MCPcopy Index your code
hub / github.com/EngoEngine/engo / TestPointNormalize

Function TestPointNormalize

math_test.go:258–272  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

256}
257
258func TestPointNormalize(t *testing.T) {
259 data := []struct {
260 p1, unit Point
261 mag float32
262 }{
263 {p1: Point{X: 0, Y: 0}, unit: Point{X: 0, Y: 0}, mag: 0.0},
264 {p1: Point{X: 3, Y: 4}, unit: Point{X: 0.6, Y: 0.8}, mag: 5.0},
265 {p1: Point{X: -3, Y: -4}, unit: Point{X: -0.6, Y: -0.8}, mag: 5.0},
266 }
267 for _, d := range data {
268 if actualUnit, actualMag := d.p1.Normalize(); !actualUnit.Equal(d.unit) || actualMag != d.mag {
269 t.Errorf("Test Point.Normalize failed. p1: %v, wanted: %v, %v, got: %v, %v", d.p1, d.unit, d.mag, actualUnit, actualMag)
270 }
271 }
272}
273
274type testContainer struct {
275 bounds AABB

Callers

nothing calls this directly

Calls 2

NormalizeMethod · 0.80
EqualMethod · 0.80

Tested by

no test coverage detected