(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func TestAngleBetween(t *testing.T) { |
| 65 | var tests = []struct { |
| 66 | theta, lower, upper float64 |
| 67 | between bool |
| 68 | }{ |
| 69 | {0.0, 0.0, 1.0, true}, |
| 70 | {1.0, 0.0, 1.0, true}, |
| 71 | {0.5, 0.0, 1.0, true}, |
| 72 | {0.5 + 2.0*math.Pi, 0.0, 1.0, true}, |
| 73 | {0.5, 0.0 + 2.0*math.Pi, 1.0 + 2.0*math.Pi, true}, |
| 74 | {0.5, 1.0 + 2.0*math.Pi, 0.0 + 2.0*math.Pi, true}, |
| 75 | {0.5 - 2.0*math.Pi, 0.0, 1.0, true}, |
| 76 | {0.5, 0.0 - 2.0*math.Pi, 1.0 - 2.0*math.Pi, true}, |
| 77 | {0.5, 1.0 - 2.0*math.Pi, 0.0 - 2.0*math.Pi, true}, |
| 78 | {-0.1, 0.0, 1.0, false}, |
| 79 | {1.1, 0.0, 1.0, false}, |
| 80 | {2.0, 3.0, 1.0, true}, |
| 81 | {0.75 * math.Pi, 1.5 * math.Pi, 2.5 * math.Pi, false}, |
| 82 | |
| 83 | // tolerance |
| 84 | {0.0 - Epsilon, 0.0, 1.0, true}, |
| 85 | {1.0 + Epsilon, 0.0, 1.0, true}, |
| 86 | {0.0 - Epsilon, 1.0, 0.0, true}, |
| 87 | {1.0 + Epsilon, 1.0, 0.0, true}, |
| 88 | } |
| 89 | for _, tt := range tests { |
| 90 | t.Run(fmt.Sprintf("%g<=%g<=%g", tt.theta, tt.lower, tt.upper), func(t *testing.T) { |
| 91 | test.T(t, angleBetween(tt.theta, tt.lower, tt.upper), tt.between) |
| 92 | }) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | func TestAngleBetweenExclusive(t *testing.T) { |
| 97 | var tests = []struct { |
nothing calls this directly
no test coverage detected