ui: basic map scroller
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
package world
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func TestPrimitiveIDs(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
id1 := uuid.New()
|
||||
id2 := uuid.New()
|
||||
id3 := uuid.New()
|
||||
|
||||
p := Point{Id: id1}
|
||||
l := Line{Id: id2}
|
||||
c := Circle{Id: id3}
|
||||
|
||||
if got := p.ID(); got != id1 {
|
||||
t.Fatalf("Point.ID() = %v, want %v", got, id1)
|
||||
}
|
||||
if got := l.ID(); got != id2 {
|
||||
t.Fatalf("Line.ID() = %v, want %v", got, id2)
|
||||
}
|
||||
if got := c.ID(); got != id3 {
|
||||
t.Fatalf("Circle.ID() = %v, want %v", got, id3)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLineMinMax(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
l := Line{
|
||||
X1: 7000, Y1: 2000,
|
||||
X2: 1000, Y2: 9000,
|
||||
}
|
||||
|
||||
if got := l.MinX(); got != 1000 {
|
||||
t.Fatalf("Line.MinX() = %d, want 1000", got)
|
||||
}
|
||||
if got := l.MaxX(); got != 7000 {
|
||||
t.Fatalf("Line.MaxX() = %d, want 7000", got)
|
||||
}
|
||||
if got := l.MinY(); got != 2000 {
|
||||
t.Fatalf("Line.MinY() = %d, want 2000", got)
|
||||
}
|
||||
if got := l.MaxY(); got != 9000 {
|
||||
t.Fatalf("Line.MaxY() = %d, want 9000", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCircleBounds(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
c := Circle{
|
||||
X: 4000,
|
||||
Y: 7000,
|
||||
Radius: 1500,
|
||||
}
|
||||
|
||||
if got := c.MinX(); got != 2500 {
|
||||
t.Fatalf("Circle.MinX() = %d, want 2500", got)
|
||||
}
|
||||
if got := c.MaxX(); got != 5500 {
|
||||
t.Fatalf("Circle.MaxX() = %d, want 5500", got)
|
||||
}
|
||||
if got := c.MinY(); got != 5500 {
|
||||
t.Fatalf("Circle.MinY() = %d, want 5500", got)
|
||||
}
|
||||
if got := c.MaxY(); got != 8500 {
|
||||
t.Fatalf("Circle.MaxY() = %d, want 8500", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user