-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: parser adding empty levels b/c of blank lines
I'd solved this in dino's parser, finally hit it here.
- Loading branch information
1 parent
fa5738f
commit a45b174
Showing
3 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
extends GdUnitTestSuite | ||
class_name GameDefTest | ||
|
||
func test_level_counts(): | ||
# TODO these are unnecessarily hard-coded - should move to a more reasonable pattern, | ||
# especially so these numbers can move around | ||
|
||
var one = DotHopPuzzle.build_puzzle_node({game_def_path="res://src/puzzles/dothop-one.txt"}) | ||
assert_int(len(one.game_def.levels)).is_equal(4) | ||
|
||
var two = DotHopPuzzle.build_puzzle_node({game_def_path="res://src/puzzles/dothop-two.txt"}) | ||
assert_int(len(two.game_def.levels)).is_equal(12) | ||
|
||
var three = DotHopPuzzle.build_puzzle_node({game_def_path="res://src/puzzles/dothop-three.txt"}) | ||
assert_int(len(three.game_def.levels)).is_equal(10) | ||
|
||
var four = DotHopPuzzle.build_puzzle_node({game_def_path="res://src/puzzles/dothop-four.txt"}) | ||
assert_int(len(four.game_def.levels)).is_equal(3) | ||
|
||
var five = DotHopPuzzle.build_puzzle_node({game_def_path="res://src/puzzles/dothop-five.txt"}) | ||
assert_int(len(five.game_def.levels)).is_equal(3) | ||
|
||
var six = DotHopPuzzle.build_puzzle_node({game_def_path="res://src/puzzles/dothop-six.txt"}) | ||
assert_int(len(six.game_def.levels)).is_equal(3) | ||
|
||
func test_expected_level_count(): | ||
var parsed = Puzz.parse_game_def(null, {contents=" | ||
title DotHop | ||
author Russell Matney | ||
======= | ||
LEGEND | ||
======= | ||
. = Background | ||
a = Player | ||
o = Dot | ||
t = Goal | ||
x = Player and Dotted | ||
======= | ||
LEVELS | ||
======= | ||
....... | ||
.xooot. | ||
....... | ||
o..o.o. | ||
ox.o.ot | ||
...o.o. | ||
....... | ||
"}) # note the extra empty line! ^ | ||
|
||
assert_int(len(parsed.levels)).is_equal(2) |