package spawn import ( "testing" ) func TestPackageBuild(t *testing.T) { // Simple test to verify the package builds spawn := NewSpawn() if spawn == nil { t.Fatal("NewSpawn returned nil") } // ID should be generated starting from 1 if spawn.GetID() <= 0 { t.Errorf("Expected ID > 0, got %d", spawn.GetID()) } } func TestSpawnBasics(t *testing.T) { spawn := NewSpawn() spawn.SetName("Test Spawn") // GetName returns the full byte array, so we need to compare with trimmed string name := spawn.GetName() if len(name) == 0 || name[0:10] != "Test Spawn" { t.Errorf("Expected name to start with 'Test Spawn', got '%s'", name[:min(len(name), 20)]) } spawn.SetLevel(25) if spawn.GetLevel() != 25 { t.Errorf("Expected level 25, got %d", spawn.GetLevel()) } } func min(a, b int) int { if a < b { return a } return b }