Slide 46
Slide 46 text
func TestRectangle(t *testing.T) {
var r Rectangle = &Square{}
expectedX, expectedY := 100, 200
r.SetX(100)
r.SetY(200)
if x := r.GetX(); x != expectedX {
t.Errorf("x expected %d, but got %d", expectedX, x)
}
if y := r.GetY(); y != expectedY {
t.Errorf("y expected %d, but got %d", expectedX, y)
}
}