maze-solver-go/io/reader/text_test.go
Karma Riuk fa4c13812d Reader -> Reader+Parser refactoring: COMPLETE
Added a string reader too so that one can create a maze just with a slice of stings and RawMaze now has chunks of bytes to limit memory usage with big mazes (hopefully)
2023-08-05 16:21:56 +02:00

109 lines
1.8 KiB
Go

package reader
import (
// "maze-solver/maze"
// "maze-solver/utils"
// "reflect"
"testing"
)
func TestTextReadTrivial(t *testing.T) {
/*
tests := []struct {
name string
filename string
pathChar byte
wallChar byte
expected *maze.RawMaze
}{
{
"Trivial",
"../../assets/trivial.txt",
' ',
'#',
&maze.RawMaze{
PathChar: ' ',
WallChar: '#',
Data: []string{
"## ##",
"# #",
"### #",
},
},
},
{
"Trivial Bigger",
"../../assets/trivial-bigger.txt",
' ',
'#',
&maze.RawMaze{
PathChar: ' ',
WallChar: '#',
Data: []string{
"### ###",
"### ###",
"# #",
"##### #",
"##### #",
},
},
},
{
"Bigger Staggered",
"../../assets/trivial-bigger-staggered.txt",
' ',
'#',
&maze.RawMaze{
PathChar: ' ',
WallChar: '#',
Data: []string{
"### ###",
"### ###",
"# #",
"#### ##",
"#### ##",
},
},
},
{
"Normal",
"../../assets/normal.txt",
' ',
'#',
&maze.RawMaze{
PathChar: ' ',
WallChar: '#',
Data: []string{
"##### #####",
"# # #",
"##### ### #",
"# # #",
"# # ##### #",
"# # #",
"### ### # #",
"# # # #",
"# ####### #",
"# # #",
"##### #####",
},
},
},
}
for _, test := range tests {
reader := TextReader{
Filename: test.filename,
PathChar: test.pathChar,
WallChar: test.wallChar,
}
got, err := reader.Read()
utils.Check(err, "Couldn't read file %q", reader.Filename)
if !reflect.DeepEqual(got, test.expected) {
t.Fatalf("%s: lexed mazes do not match\nGot: %v\nWant: %v", test.name, got, test.expected)
}
}
*/
}