MCPcopy
hub / github.com/tdewolff/canvas / TestAngleBetweenExclusive

Function TestAngleBetweenExclusive

util_test.go:96–122  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestAngleBetweenExclusive(t *testing.T) {
97 var tests = []struct {
98 theta, lower, upper float64
99 between bool
100 }{
101 {0.0, 0.0, 1.0, false},
102 {1.0, 0.0, 1.0, false},
103 {0.5, 0.0, 1.0, true},
104 {0.5, 1.0, 0.0, true},
105 {0.5 + 2.0*math.Pi, 0.0, 1.0, true},
106 {0.5, 0.0 + 2.0*math.Pi, 1.0 + 2.0*math.Pi, true},
107 {0.5, 1.0 + 2.0*math.Pi, 0.0 + 2.0*math.Pi, true},
108 {0.5 - 2.0*math.Pi, 0.0, 1.0, true},
109 {0.5, 0.0 - 2.0*math.Pi, 1.0 - 2.0*math.Pi, true},
110 {0.5, 1.0 - 2.0*math.Pi, 0.0 - 2.0*math.Pi, true},
111 {-0.1, 0.0, 1.0, false},
112 {1.1, 0.0, 1.0, false},
113 {2.0, 3.0, 1.0, true},
114 {0.75 * math.Pi, 1.5 * math.Pi, 2.5 * math.Pi, false},
115 {0.5 * math.Pi, 1.75 * math.Pi, 3.0 * math.Pi, true},
116 }
117 for _, tt := range tests {
118 t.Run(fmt.Sprintf("%g<%g<%g", tt.theta, tt.lower, tt.upper), func(t *testing.T) {
119 test.T(t, angleBetweenExclusive(tt.theta, tt.lower, tt.upper), tt.between)
120 })
121 }
122}
123
124func TestCSSColor(t *testing.T) {
125 test.String(t, CSSColor(Cyan).String(), "#0ff")

Callers

nothing calls this directly

Calls 3

angleBetweenExclusiveFunction · 0.85
TMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected