adding cs142 code
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user