diff options
Diffstat (limited to 'support/dktools/test-dk4maal.ctr')
-rw-r--r-- | support/dktools/test-dk4maal.ctr | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/support/dktools/test-dk4maal.ctr b/support/dktools/test-dk4maal.ctr deleted file mode 100644 index 285a3258ca..0000000000 --- a/support/dktools/test-dk4maal.ctr +++ /dev/null @@ -1,87 +0,0 @@ -#include "dk4conf.h" - -#include <stdio.h> - -#include "dk4error.h" -#include "dk4maal.h" - -$!trace-include - - -static -void -show_error(dk4_er_t *erp) -{ - if (DK4_E_NONE != erp->ec) { - switch(erp->ec) { - case DK4_E_MATH_OVERFLOW: { - printf(" overflow"); - } break; - case DK4_E_MATH_DIVZERO: { - printf(" divzero"); - } break; - default: { - printf(" %d", erp->ec); - } break; - } - } -} - - - -int main(void) -{ - char buffer[128]; /* Input line buffer */ - dk4_er_t er; /* Error report */ - long i1; /* First operand */ - long i2; /* Second operand */ - int exc; /* Exit code */ - int cc; /* Flag: Can continue */ - long c1; /* First operand as char */ - long c2; /* Second operand as char */ - long c3; /* Result as char */ - - $!trace-init test-dk4maac.deb - $? "+ main" - exc = 0; - cc = 1; - while((1 == cc) && (fgets(buffer, sizeof(buffer), stdin))) { - if (sscanf(buffer, "%ld %ld", &i1, &i2) == 2) { - c1 = i1; - c2 = i2; - printf("%ld %ld\n", (long)c1, (long)c2); - dk4error_init(&er); - c3 = dk4ma_long_add(c1, c2, &er); - printf("\t+ %ld", c3); - show_error(&er); - printf("\n"); - - dk4error_init(&er); - c3 = dk4ma_long_sub(c1, c2, &er); - printf("\t- %ld", c3); - show_error(&er); - printf("\n"); - - dk4error_init(&er); - c3 = dk4ma_long_mul(c1, c2, &er); - printf("\t* %ld", c3); - show_error(&er); - printf("\n"); - - dk4error_init(&er); - c3 = dk4ma_long_div(c1, c2, &er); - printf("\t/ %ld", c3); - show_error(&er); - printf("\n"); - } else { - exc = 1; - fprintf(stderr, "test-dk4maac:ERROR: Invalid input line!\n"); - fflush(stderr); - cc = 0; - } - } - $? "- main" - $!trace-end - return exc; -} - |