vector/govector_test.go

30 lines
349 B
Go
Raw Normal View History

2013-08-08 20:34:27 -07:00
package govector
import (
// "fmt"
"testing"
)
func TestSub(t *testing.T) {
2013-08-08 20:36:15 -07:00
p1 := Point2d{10, 10}
p2 := Point2d{5, 5}
2013-08-08 20:34:27 -07:00
v := p1.sub(p2)
2013-08-08 20:36:15 -07:00
if v != (Vector2d{5, 5}) {
2013-08-08 20:34:27 -07:00
t.Errorf("Sub Error")
}
}
func TestMag(t *testing.T) {
2013-08-08 20:36:15 -07:00
p1 := Point2d{10, 10}
p2 := Point2d{7, 6}
2013-08-08 20:34:27 -07:00
v := p1.sub(p2)
m := v.mag()
if m != 5 {
t.Errorf("Mag Error")
}
}