-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing.out
124 lines (100 loc) · 3.02 KB
/
testing.out
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
bash -v testing.sh
#!/bin/bash
# Testing script for sudoku.c
# Authors: Dylan Beinstock, Salifyanji J. Namwila, and Veronica Quidore
# Date: November 11 2021
#
# usage: bash -v testing.sh
############################################
### Tests with invalid arguements ###
# 1 argument
./sudoku
Incorrect number of arguments. Usage: ./sudoku mode difficulty size
# 2 argument
./sudoku create
Create mode requires a third arguemnt for the difficulty
# 2 argument with invalid mode
./sudoku invalid_mode
Mode must be 'create' or 'solve'
# 3 argument with invalid mode
./sudoku invalid_mode easy
Mode must be 'create' or 'solve'
# 3 argument with invalid difficulty
./sudoku create invalid_difficulty
Difficulty must be 'easy' or 'hard'
# 4 argument with invalid size
./sudoku create easy 5
Unsuccessful creating puzzle
############################################
### Tests with invalid solve arguements ###
# solve that breaks sudoku rules
cat testing_files/invalid_sudoku.txt | ./sudoku solve
Invalid sudoku provided.
# solve less than 25 given numbers
cat testing_files/less_25_numbers.txt | ./sudoku solve
Invalid sudoku provided.
# solve with too few inputs
cat testing_files/too_few_inputs.txt | ./sudoku solve
Format Error: Could not parsed puzzle.
# solve with too many inputss
cat testing_files/too_many_inputs.txt | ./sudoku solve
Format Error: Could not parsed puzzle.
############################################
##### Tests with Valid arguements ######
# Create and Solve easy
./sudoku create easy | ./sudoku solve easy
+-------+-------+-------+
| 8 1 2 | 3 4 6 | 5 9 7 |
| 3 9 4 | 5 7 1 | 6 2 8 |
| 6 7 5 | 8 9 2 | 4 1 3 |
+-------+-------+-------+
| 1 8 3 | 4 2 5 | 9 7 6 |
| 4 6 7 | 9 1 8 | 2 3 5 |
| 2 5 9 | 6 3 7 | 8 4 1 |
+-------+-------+-------+
| 7 2 8 | 1 6 9 | 3 5 4 |
| 5 3 1 | 2 8 4 | 7 6 9 |
| 9 4 6 | 7 5 3 | 1 8 2 |
+-------+-------+-------+
sleep 2
# Create and Solve hard
./sudoku create hard | ./sudoku solve hard
+-------+-------+-------+
| 6 9 4 | 2 8 5 | 3 7 1 |
| 7 1 3 | 6 9 4 | 8 5 2 |
| 2 8 5 | 3 1 7 | 9 4 6 |
+-------+-------+-------+
| 5 4 1 | 8 6 2 | 7 3 9 |
| 9 7 6 | 5 3 1 | 2 8 4 |
| 3 2 8 | 4 7 9 | 6 1 5 |
+-------+-------+-------+
| 1 5 7 | 9 2 8 | 4 6 3 |
| 4 6 9 | 7 5 3 | 1 2 8 |
| 8 3 2 | 1 4 6 | 5 9 7 |
+-------+-------+-------+
sleep 2
#Solve with 2 arguments
./sudoku create easy | ./sudoku solve
+-------+-------+-------+
| 9 4 2 | 5 1 6 | 3 7 8 |
| 3 1 5 | 8 7 9 | 2 6 4 |
| 6 8 7 | 2 4 3 | 9 5 1 |
+-------+-------+-------+
| 1 5 3 | 6 9 7 | 8 4 2 |
| 4 9 6 | 1 2 8 | 5 3 7 |
| 7 2 8 | 4 3 5 | 6 1 9 |
+-------+-------+-------+
| 8 7 1 | 3 6 2 | 4 9 5 |
| 2 3 9 | 7 5 4 | 1 8 6 |
| 5 6 4 | 9 8 1 | 7 2 3 |
+-------+-------+-------+
sleep 2
#Solve a known solution and compare to the solution
cat testing_files/sudoku_1_input.txt | ./sudoku solve > testing_files/sudoku_1_output.txt
if diff testing_files/sudoku_1_output.txt testing_files/sudoku_1_solution.txt
then
echo "Sudoku files are the same"
else
echo "Sudoku files are different"
fi
Sudoku files are the same