Home | History | Annotate | Download | only in testdata
      1   ./testdata/hist.go
      2 55:	func test() {
      3 57:		l := line{point{1 + zero, 2 + zero}, point{3 + zero, 4 + zero}}
      4 58:		tinycall()                // this forces l etc to stack
      5 59:		dx := l.end.x - l.begin.x //gdb-dbg=(l.begin.x,l.end.y)//gdb-opt=(l,dx/O,dy/O)
      6 60:		dy := l.end.y - l.begin.y //gdb-opt=(dx,dy/O)
      7 61:		sink = dx + dy            //gdb-opt=(dx,dy)
      8 63:		hist := make([]int, 7)                                //gdb-opt=(dx/O,dy/O) // TODO sink is missing if this code is in 'test' instead of 'main'
      9 64:		var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A) // TODO cannedInput/A is missing if this code is in 'test' instead of 'main'
     10 65:		if len(os.Args) > 1 {
     11 73:		scanner := bufio.NewScanner(reader)
     12 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     13 75:			s := scanner.Text()
     14 76:			i, err := strconv.ParseInt(s, 10, 64)
     15 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     16 81:			hist = ensure(int(i), hist)
     17 82:			hist[int(i)]++
     18 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     19 75:			s := scanner.Text()
     20 76:			i, err := strconv.ParseInt(s, 10, 64)
     21 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     22 81:			hist = ensure(int(i), hist)
     23 82:			hist[int(i)]++
     24 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     25 75:			s := scanner.Text()
     26 76:			i, err := strconv.ParseInt(s, 10, 64)
     27 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     28 81:			hist = ensure(int(i), hist)
     29 82:			hist[int(i)]++
     30 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     31 75:			s := scanner.Text()
     32 76:			i, err := strconv.ParseInt(s, 10, 64)
     33 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     34 81:			hist = ensure(int(i), hist)
     35 82:			hist[int(i)]++
     36 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     37 75:			s := scanner.Text()
     38 76:			i, err := strconv.ParseInt(s, 10, 64)
     39 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     40 81:			hist = ensure(int(i), hist)
     41 82:			hist[int(i)]++
     42 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     43 75:			s := scanner.Text()
     44 76:			i, err := strconv.ParseInt(s, 10, 64)
     45 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     46 81:			hist = ensure(int(i), hist)
     47 82:			hist[int(i)]++
     48 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     49 75:			s := scanner.Text()
     50 76:			i, err := strconv.ParseInt(s, 10, 64)
     51 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     52 81:			hist = ensure(int(i), hist)
     53 82:			hist[int(i)]++
     54 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     55 75:			s := scanner.Text()
     56 76:			i, err := strconv.ParseInt(s, 10, 64)
     57 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     58 81:			hist = ensure(int(i), hist)
     59 82:			hist[int(i)]++
     60 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     61 75:			s := scanner.Text()
     62 76:			i, err := strconv.ParseInt(s, 10, 64)
     63 77:			if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)
     64 81:			hist = ensure(int(i), hist)
     65 82:			hist[int(i)]++
     66 74:		for scanner.Scan() { //gdb-opt=(scanner/A)
     67 84:		t := 0
     68 85:		n := 0
     69 86:		for i, a := range hist {
     70 87:			if a == 0 { //gdb-opt=(a,n,t)
     71 88:				continue
     72 86:		for i, a := range hist {
     73 87:			if a == 0 { //gdb-opt=(a,n,t)
     74 90:			t += i * a
     75 91:			n += a
     76 92:			fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
     77 86:		for i, a := range hist {
     78 87:			if a == 0 { //gdb-opt=(a,n,t)
     79 90:			t += i * a
     80 91:			n += a
     81 92:			fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
     82 86:		for i, a := range hist {
     83 87:			if a == 0 { //gdb-opt=(a,n,t)
     84 88:				continue
     85 86:		for i, a := range hist {
     86 87:			if a == 0 { //gdb-opt=(a,n,t)
     87 90:			t += i * a
     88 91:			n += a
     89 92:			fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
     90 86:		for i, a := range hist {
     91 87:			if a == 0 { //gdb-opt=(a,n,t)
     92 90:			t += i * a
     93 91:			n += a
     94 92:			fmt.Fprintf(os.Stderr, "%d\t%d\t%d\t%d\t%d\n", i, a, n, i*a, t) //gdb-dbg=(n,i,t)
     95 86:		for i, a := range hist {
     96 87:			if a == 0 { //gdb-opt=(a,n,t)
     97 88:				continue
     98 86:		for i, a := range hist {
     99 98:	}
    100