(t *testing.T)
| 79 | } |
| 80 | |
| 81 | func TestIssue514(t *testing.T) { |
| 82 | for _, ulp := range []int{ |
| 83 | 0, |
| 84 | +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +21, +22, |
| 85 | -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, |
| 86 | } { |
| 87 | t.Run(fmt.Sprintf("ulps%+02d", ulp), func(t *testing.T) { |
| 88 | done := make(chan int) |
| 89 | go func() { |
| 90 | defer close(done) |
| 91 | |
| 92 | p := plot.New() |
| 93 | |
| 94 | var ( |
| 95 | y1 = 100.0 |
| 96 | y2 = y1 |
| 97 | ) |
| 98 | |
| 99 | switch { |
| 100 | case ulp < 0: |
| 101 | y2 = math.Float64frombits(math.Float64bits(y1) - uint64(-ulp)) |
| 102 | case ulp > 0: |
| 103 | y2 = math.Float64frombits(math.Float64bits(y1) + uint64(ulp)) |
| 104 | } |
| 105 | |
| 106 | pts, err := plotter.NewScatter(plotter.XYs{ |
| 107 | {X: 1, Y: y1}, |
| 108 | {X: 1, Y: y2}, |
| 109 | }) |
| 110 | if err != nil { |
| 111 | t.Errorf("could not create scatter: %v", err) |
| 112 | return |
| 113 | } |
| 114 | |
| 115 | p.Add(pts) |
| 116 | |
| 117 | c := draw.NewCanvas(&recorder.Canvas{}, 100, 100) |
| 118 | p.Draw(c) |
| 119 | }() |
| 120 | |
| 121 | timeout := time.NewTimer(100 * time.Millisecond) |
| 122 | defer timeout.Stop() |
| 123 | |
| 124 | select { |
| 125 | case <-done: |
| 126 | case <-timeout.C: |
| 127 | t.Fatalf("could not create plot with small axis range within allotted time") |
| 128 | } |
| 129 | }) |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | func TestDrawGlyphBoxes(t *testing.T) { |
| 134 | cmpimg.CheckPlot(func() { |
nothing calls this directly
no test coverage detected