adding cs142 code

This commit is contained in:
dm
2016-04-06 20:45:34 -07:00
parent 552d456d53
commit 8e52ce1982
174 changed files with 14064 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#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;
}