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.
 
 
 
 
 
 

213 lines
4.8 KiB

package student_test
import (
"testing"
"github.com/01-edu/z01"
)
func TestRaid2(t *testing.T) {
// Valid sudokus
arg1 := []string{".96.4...1", "1...6...4", "5.481.39.",
"..795..43", ".3..8....", "4.5.23.18",
".1.63..59", ".59.7.83.", "..359...7",
}
/*
"3 9 6 2 4 5 7 8 1",
"1 7 8 3 6 9 5 2 4",
"5 2 4 8 1 7 3 9 6",
"2 8 7 9 5 1 6 4 3",
"9 3 1 4 8 6 2 7 5",
"4 6 5 7 2 3 9 1 8",
"7 1 2 6 3 8 4 5 9",
"6 5 9 1 7 4 8 3 2",
"8 4 3 5 9 2 1 6 7"
*/
arg2 := []string{"1.58.2...", ".9..764.5", "2..4..819",
".19..73.6", "762.83.9.", "....61.5.",
"..76...3.", "43..2.5.1", "6..3.89..",
}
/*
1 4 5 8 9 2 6 7 3
8 9 3 1 7 6 4 2 5
2 7 6 4 3 5 8 1 9
5 1 9 2 4 7 3 8 6
7 6 2 5 8 3 1 9 4
3 8 4 9 6 1 7 5 2
9 5 7 6 1 4 2 3 8
4 3 8 7 2 9 5 6 1
6 2 1 3 5 8 9 4 7
*/
arg3 := []string{"..5.3..81", "9.285..6.", "6....4.5.",
"..74.283.", "34976...5", "..83..49.",
"15..87..2", ".9....6..", ".26.495.3",
}
/*
4 7 5 9 3 6 2 8 1
9 3 2 8 5 1 7 6 4
6 8 1 2 7 4 3 5 9
5 1 7 4 9 2 8 3 6
3 4 9 7 6 8 1 2 5
2 6 8 3 1 5 4 9 7
1 5 3 6 8 7 9 4 2
7 9 4 5 2 3 6 1 8
8 2 6 1 4 9 5 7 3
*/
arg4 := []string{"34.91..2.", ".96.8..41", "..8.2..7.",
".6..57.39", "1.2.6.7..", "97..3..64",
"45.2.8..6", ".8..9..5.", "6.3..189.",
}
/*
3 4 7 9 1 5 6 2 8
2 9 6 7 8 3 5 4 1
5 1 8 6 2 4 9 7 3
8 6 4 1 5 7 2 3 9
1 3 2 4 6 9 7 8 5
9 7 5 8 3 2 1 6 4
4 5 9 2 7 8 3 1 6
7 8 1 3 9 6 4 5 2
6 2 3 5 4 1 8 9 7
*/
arg5 := []string{"..73..4.5", "....2.9..", "253.6487.",
".9.74.36.", "....3..8.", "8362.9.47",
"1..8.26.3", "6......18", ".8261...4",
}
/*"..73..4.5","....2.9..","253.6487.",".9.74.36.","....3..8.","8362.9.47","1..8.26.3","6......18",".8261...4",
9 6 7 3 8 1 4 2 5
4 1 8 5 2 7 9 3 6
2 5 3 9 6 4 8 7 1
5 9 1 7 4 8 3 6 2
7 2 4 1 3 6 5 8 9
8 3 6 2 5 9 1 4 7
1 4 9 8 7 2 6 5 3
6 7 5 4 9 3 2 1 8
3 8 2 6 1 5 7 9 4
*/
arg6 := []string{"935..7..8", "...3.8.7.", "6..5..49.",
".73..4...", "4..175.8.", ".618..247",
".187.....", "..6.8.75.", "75.4.3862",
}
/*
9 3 5 6 4 7 1 2 8
1 2 4 3 9 8 6 7 5
6 8 7 5 2 1 4 9 3
8 7 3 2 6 4 5 1 9
4 9 2 1 7 5 3 8 6
5 6 1 8 3 9 2 4 7
2 1 8 7 5 6 9 3 4
3 4 6 9 8 2 7 5 1
7 5 9 4 1 3 8 6 2
*/
arg7 := []string{"..5.2...1", ".8735..46", "4...6.5..",
".5.9.....", ".7..3541.", "69314.857",
"7415..6.8", "...284..5", "5.....3.4",
}
/*
3 6 5 4 2 9 7 8 1
2 8 7 3 5 1 9 4 6
4 1 9 8 6 7 5 3 2
1 5 4 9 7 8 2 6 3
8 7 2 6 3 5 4 1 9
6 9 3 1 4 2 8 5 7
7 4 1 5 9 3 6 2 8
9 3 6 2 8 4 1 7 5
5 2 8 7 1 6 3 9 4
*/
arg8 := []string{"..75...3.", "8..23...9", ".3479.86.",
"..3..4198", ".4815...3", "..6.23..7",
"351.6.78.", "4..31...6", ".7...5..2",
}
/*
9 6 7 5 4 8 2 3 1
8 1 5 2 3 6 4 7 9
2 3 4 7 9 1 8 6 5
5 2 3 6 7 4 1 9 8
7 4 8 1 5 9 6 2 3
1 9 6 8 2 3 5 4 7
3 5 1 9 6 2 7 8 4
4 8 2 3 1 7 9 5 6
6 7 9 4 8 5 3 1 2
*/
arg9 := []string{".58..4.21", ".6.853..7", ".39.2...5",
"8....1..6", "..37..21.", "1.6.825..",
"67.2..18.", "9..4...5.", ".8.9167.2",
}
/*
7 5 8 6 9 4 3 2 1
2 6 1 8 5 3 4 9 7
4 3 9 1 2 7 8 6 5
8 2 7 5 4 1 9 3 6
5 4 3 7 6 9 2 1 8
1 9 6 3 8 2 5 7 4
6 7 4 2 3 5 1 8 9
9 1 2 4 7 8 6 5 3
3 8 5 9 1 6 7 4 2
*/
arg10 := []string{".2.1....6", "53..8294.", "8..34...5",
"3542761..", "..6.3...4", "9....162.",
".9...3.78", "7438.9...", "..5..43.1",
}
/*
4 2 7 1 9 5 8 3 6
5 3 1 6 8 2 9 4 7
8 6 9 3 4 7 2 1 5
3 5 4 2 7 6 1 8 9
2 1 6 9 3 8 7 5 4
9 7 8 4 5 1 6 2 3
1 9 2 5 6 3 4 7 8
7 4 3 8 1 9 5 6 2
6 8 5 7 2 4 3 9 1
*/
valid := [][]string{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10}
// Invalid sudokus
argin1 := []string{".932..8.", "27.3.85..", ".8.73.254",
"9758...31", "....74.6.", "6.45.38.7",
"7....2.48", "32.4...7.", "..8.579..",
}
argin2 := []string{".867.2..4", ".2.5..8..", "154.9.237",
".7.9.5..1", ".29..4.18", "51.6...42",
"2.5.7..83", "...153...", "39...8.75",
}
/*
. . 7 3 . . 4 . 5
. . . . 2 . 9 . .
2 5 3 . 6 4 8 7 .
. 9 . 7 4 . 3 6 .
. . . . 3 . . 8 .
8 3 6 2 . 9 . 4 7
1 . . 8 . 2 6 . 3
6 . . . . . . 1 8
. 8 2 6 1 . . . 4
*/
argin3 := []string{".7....28.", ".2...6.57", "8654729..",
"..925..64", ".4..19.7.", "7.8..4..9",
"3..7..698", "..79.1...", "59..28.39",
}
argin4 := []string{"..213.748", "8.4.....2", ".178.26..",
".68.9.27.", ".932....4", "5..46.3..",
"..9.24.23", "..63..19.", "385..1.2.",
}
argin5 := []string{"9.46.3..1", "37.1..2.6", "..6..93.4",
"..13..9.5", "56..91...", "82...461.",
"..79...4.", "425.167..", "1.2..75.8",
}
invalid := [][]string{argin1, argin2, argin3, argin4, argin5}
for _, v := range valid {
z01.ChallengeMain(t, v...)
}
for _, i := range invalid {
z01.ChallengeMain(t, i...)
}
// No arguments
z01.ChallengeMain(t)
// Wrong number of arguments
z01.ChallengeMain(t, "not", "a", "sudoku")
}