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.
30 lines
629 B
30 lines
629 B
package level |
|
|
|
import ( |
|
"path/filepath" |
|
"testing" |
|
) |
|
|
|
func TestLoadLevels(t *testing.T) { |
|
path := filepath.Join("..", "..", "data", "levels.json") |
|
|
|
levels, err := LoadLevels(path) |
|
if err != nil { |
|
t.Fatalf("failed to load levels.json: %v", err) |
|
} |
|
|
|
if len(levels) == 0 { |
|
t.Fatalf("expected at least one level, got 0") |
|
} |
|
|
|
InitRegistry(levels) |
|
|
|
lvl, err := GetLevel("Metrics System", DifficultyHard) |
|
if err != nil { |
|
t.Fatalf("expected to retrieve Metrics System (hard), got %v", err) |
|
} |
|
|
|
if lvl.Difficulty != DifficultyHard { |
|
t.Errorf("unexpected difficulty: got %s, want %s", lvl.Difficulty, DifficultyHard) |
|
} |
|
}
|
|
|