school/cs142/smcquay/midterm2/unittest.cc
2016-04-06 20:45:34 -07:00

28 lines
614 B
C++

#include <string>
#include <cassert>
using namespace std;
#include "util.h"
int main(int argc, char * argv []) {
bool verbose = false;
if(argc > 1)
verbose = true;
assert(9 == _test_run(10, 1, verbose));
assert(3 == _test_run(10, 3, verbose));
assert(9 == _test_run(10, 12, verbose));
assert(19 == _test_run(20, 3, verbose));
assert(4 == _test_run(15, 7, verbose));
for(int i=0; i >= -1; i--) {
try {
_test_run(1500000, i);
}
catch(string e) {
assert(e == "rule violation: m > 0");
}
}
return 0;
}