// test: echo -e '{sto (1, 1 + 1), rcl (1) * 3}' | calc.exe | grep -q '=> 6'
// test: echo -e '{\n{}\n{1, 2\n{sto (1, 1 + 1),\npow(2, {sto (1, 1 + 2), 2}, {rcl(2)})\n2 {sto (1, 1 + 1)}' | calc.exe | grep -c error | xargs test 6 =
// test: echo -e '1 }\n1 )\n1 , 2\n ' | calc.exe | grep -c error | xargs test 3 =
+// test: echo -e 'print (1)' | calc.exe -v 3 | grep -q Print
// test: echo -e 'si\t\t (pi / 2)' | calc.exe | grep -q '=> 1'
// Gauss sequence
list[i][j] = '\0';
}
}
- if (list[l] == NULL) {
- VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n"));
- exit (1);
+ if (list[l] != NULL) {
+ l++;
}
- l++;
}
for (i = 0; i < NB_FUNCTIONS; i++) {
list[l] = strdup ((functions + i)->keyword);
- if (list[l] == NULL) {
- VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n"));
- exit (1);
+ if (list[l] != NULL) {
+ l++;
}
- l++;
}
for (i = 0; i < NB_CONSTANTS; i++) {
list[l] = strdup ((constants + i)->keyword);
- if (list[l] == NULL) {
- VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n"));
- exit (1);
+ if (list[l] != NULL) {
+ l++;
}
- l++;
}
for (i = 0; i < NB_SYMBOLS; i++) {
list[l] = strdup (symbols[i]);
- if (list[l] == NULL) {
- VERBOSE (ERROR, fprintf (stderr, "can't allocate memory\n"));
- exit (1);
+ if (list[l] != NULL) {
+ l++;
}
- l++;
}
return (list);