From ab1c724ba293ee660e27f45ad2bf4beeb557bafc Mon Sep 17 00:00:00 2001 From: Anh Nguyen-Tuong <zenpoems@gmail.com> Date: Tue, 19 Mar 2019 21:42:16 -0400 Subject: [PATCH] Add micro test --- tools/laf/test/test_cmp_16_neg.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/laf/test/test_cmp_16_neg.c diff --git a/tools/laf/test/test_cmp_16_neg.c b/tools/laf/test/test_cmp_16_neg.c new file mode 100644 index 0000000..28cca70 --- /dev/null +++ b/tools/laf/test/test_cmp_16_neg.c @@ -0,0 +1,27 @@ +#include <stdio.h> +#include <stdlib.h> + +volatile int compare_me(short x) +{ + if (x == -0x1234) + abort(); +} + +int main(int argc, char **argv) +{ + short x; + FILE *fp = fopen(argv[1],"r"); + + if (!fp) { + fprintf(stderr, "Need input file\n"); + return 1; + } + + fread(&x, 4, 1, fp); + + compare_me(x); + + fclose(fp); + return 0; + +} -- GitLab