adding cs235
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#include <stdio.h>
|
||||
#include <cassert>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "maze.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
srand (time(NULL));
|
||||
maze m;
|
||||
|
||||
m.createRandomMaze();
|
||||
bool b;
|
||||
if (argc == 2) {
|
||||
b = m.importMaze(argv[1]);
|
||||
}
|
||||
else {
|
||||
b = m.importMaze("Mazes/test1.txt");
|
||||
}
|
||||
if (b) {
|
||||
cout << "success" << endl;
|
||||
}
|
||||
else {
|
||||
cout << "failure" << endl;
|
||||
}
|
||||
m.importMaze("Mazes/maze_sample.txt");
|
||||
assert(m.traverseMaze());
|
||||
cout << m << endl;
|
||||
m.importMaze("Mazes/solvableMaze.txt");
|
||||
assert(m.traverseMaze());
|
||||
cout << m << endl;
|
||||
cout << m.getMazePath() << endl;
|
||||
cout << "first" << endl;
|
||||
m.importMaze("Mazes/solvableMaze2.txt");
|
||||
assert(m.traverseMaze());
|
||||
cout << m.getMazePath() << endl;
|
||||
cout << "second" << endl;
|
||||
m.importMaze("Mazes/badMaze1.txt");
|
||||
assert(!m.traverseMaze());
|
||||
m.importMaze("Mazes/badMaze2.txt");
|
||||
assert(!m.traverseMaze());
|
||||
m.importMaze("Mazes/badMaze2.txt");
|
||||
assert(!m.traverseMaze());
|
||||
m.importMaze("Mazes/maze_sample.txt");
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user