-
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.
test(randomised kruskal): length of walls
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package Generators | ||
|
||
import ( | ||
"github.com/msmp-core/maze-generator-cli/utils" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func TestWallsRandomisedKruskal(t *testing.T) { | ||
maze, err := GenerateNewMaze(5, 5, NewRandomisedKruskal) | ||
if err != nil { | ||
t.Error(err.Error()) | ||
return | ||
} | ||
if len(maze.Walls) != 45 { | ||
t.Error(utils.FormatTestError("bad length of total walls", strconv.Itoa(45), | ||
strconv.Itoa(len(maze.Walls)))) | ||
} | ||
} |
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,13 @@ | ||
package utils | ||
|
||
import "fmt" | ||
|
||
// FormatTestError format for you your test error messages. | ||
// | ||
// excepted is the value excepted. | ||
// got is the value got. | ||
// | ||
// Return the formatted string | ||
func FormatTestError(msg string, excepted string, got string) string { | ||
return fmt.Sprintf("%s\nexcepted: %s\ngot %s\n", msg, excepted, got) | ||
} |