You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
855 B
50 lines
855 B
package gohan |
|
|
|
import ( |
|
"testing" |
|
) |
|
|
|
func TestActiveEntities(t *testing.T) { |
|
Reset() |
|
w.cacheTime = 0 |
|
|
|
active := CurrentEntities() |
|
if active != 0 { |
|
t.Fatalf("expected 0 active entities, got %d", active) |
|
} |
|
|
|
active = CurrentEntities() |
|
if active != 0 { |
|
t.Fatalf("expected 0 active entities, got %d", active) |
|
} |
|
|
|
// Create entity. |
|
e1 := NewEntity() |
|
|
|
active = CurrentEntities() |
|
if active != 1 { |
|
t.Fatalf("expected 1 active entities, got %d", active) |
|
} |
|
|
|
// Create entity. |
|
e2 := NewEntity() |
|
|
|
active = CurrentEntities() |
|
if active != 2 { |
|
t.Fatalf("expected 2 active entities, got %d", active) |
|
} |
|
|
|
e1.Remove() |
|
|
|
active = CurrentEntities() |
|
if active != 1 { |
|
t.Fatalf("expected 1 active entities, got %d", active) |
|
} |
|
|
|
e2.Remove() |
|
|
|
active = CurrentEntities() |
|
if active != 0 { |
|
t.Fatalf("expected 0 active entities, got %d", active) |
|
} |
|
}
|
|
|