add a function generateLongExpr in stackApp.c(h). Add a comprehensive conclusion on calc infix & catalan.
This commit is contained in:
@@ -10,7 +10,7 @@ void test_paren();
|
||||
void test_evaluate();
|
||||
void test_toPostfix();
|
||||
|
||||
int stackApp_test_main(){
|
||||
int main(){
|
||||
cout << "Running tests......" << endl;
|
||||
test_convert();
|
||||
test_paren();
|
||||
@@ -38,6 +38,12 @@ void test_paren(){
|
||||
void test_evaluate(){
|
||||
assert(evaluate("2*5+(3+4-2*7)/2") == 6.5);
|
||||
assert(evaluate("(0!+ 1) * 2 ^ (3!+ 4) - (5!- 67 - (8 + 9))") == 2012);
|
||||
char* expr = generateLongExpr(1024);
|
||||
//cout << expr << endl;
|
||||
cout << evaluate(expr) << endl;
|
||||
free(expr);
|
||||
//cout << evaluate("1+2*3^(1+2*3)") << endl;;
|
||||
//cout << evaluate("1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1+2*3^(1)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))") << endl;
|
||||
}
|
||||
|
||||
void test_toPostfix(){
|
||||
|
||||
Reference in New Issue
Block a user