From 54f732580099c29b13f1769b138f6bfe33df1031 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 19 Nov 2022 00:06:37 +0100 Subject: [PATCH] another test fixed --- test/val/float-cmp-var-const.c | 34 --------------------- test/{todo => val}/float-cmp-var-intconst.c | 34 ++++++++++++++------- 2 files changed, 23 insertions(+), 45 deletions(-) rename test/{todo => val}/float-cmp-var-intconst.c (52%) diff --git a/test/val/float-cmp-var-const.c b/test/val/float-cmp-var-const.c index 91fd35f90..984f91229 100644 --- a/test/val/float-cmp-var-const.c +++ b/test/val/float-cmp-var-const.c @@ -77,45 +77,11 @@ void varconst(void) } -void varintconst(void) -{ - printf("var vs int const\n"); - - fp1 = 10.0f; - fp2 = 20.0f; - - expect("20 == 10 is", 0, (fp2 == 10)); - expect("10 == 20 is", 0, (fp1 == 20)); - expect("10 == 10 is", 1, (fp1 == 10)); - - expect("20 != 10 is", 1, (fp2 != 10)); - expect("10 != 20 is", 1, (fp1 != 20)); - expect("10 != 10 is", 0, (fp1 != 10)); - -// expect("20 < 10 is", 1, (fp2 < 10)); -// expect("10 < 20 is", 0, (fp1 < 20)); - expect("10 < 10 is", 0, (fp1 < 10)); - -// expect("20 > 10 is", 0, (fp2 > 10)); -// expect("10 > 20 is", 1, (fp1 > 20)); - expect("10 > 10 is", 0, (fp1 > 10)); - -// expect("20 <= 10 is", 1, (fp2 <= 10)); -// expect("10 <= 20 is", 0, (fp1 <= 20)); - expect("10 <= 10 is", 1, (fp1 <= 10)); - -// expect("20 >= 10 is", 0, (fp2 >= 10)); -// expect("10 >= 20 is", 1, (fp1 >= 20)); - expect("10 >= 10 is", 1, (fp1 >= 10)); - -} - int main(void) { printf("float-cmp-var-const\n"); varconst(); - varintconst(); printf("float-cmp-var-const (res: %d)\n", result); return result; diff --git a/test/todo/float-cmp-var-intconst.c b/test/val/float-cmp-var-intconst.c similarity index 52% rename from test/todo/float-cmp-var-intconst.c rename to test/val/float-cmp-var-intconst.c index 4f2615839..83997f439 100644 --- a/test/todo/float-cmp-var-intconst.c +++ b/test/val/float-cmp-var-intconst.c @@ -31,8 +31,8 @@ unsigned long var_ulong; int result = 0; #define expect(msg, exp, val) \ - printf("%s %s%s (is:%d want:%d)\n", \ - msg, \ + printf("%s %d:%d:%s%s (is:%d want:%d)\n", \ + msg, exp, val, \ val ? "true" : "false", \ (exp != val) ? " (failed)" : "", \ exp, val \ @@ -50,17 +50,29 @@ void varintconst(void) fp1 = 10.0f; fp2 = 20.0f; - expect("20 < 10 is", 1, (fp2 < 10)); - expect("10 < 20 is", 0, (fp1 < 20)); + expect("10 == 20 is", 0, (fp1 == 20)); + expect("20 == 10 is", 0, (fp2 == 10)); + expect("20 == 20 is", 1, (fp2 == 20)); - expect("20 > 10 is", 0, (fp2 > 10)); - expect("10 > 20 is", 1, (fp1 > 20)); + expect("10 != 20 is", 1, (fp1 != 20)); + expect("20 != 10 is", 1, (fp2 != 10)); + expect("20 != 20 is", 0, (fp2 != 20)); - expect("20 <= 10 is", 1, (fp2 <= 10)); - expect("10 <= 20 is", 0, (fp1 <= 20)); + expect("10 < 20 is", 1, (fp1 < 20)); + expect("20 < 10 is", 0, (fp2 < 10)); + expect("20 < 20 is", 0, (fp2 < 20)); - expect("20 >= 10 is", 0, (fp2 >= 10)); - expect("10 >= 20 is", 1, (fp1 >= 20)); + expect("10 > 20 is", 0, (fp1 > 20)); + expect("20 > 10 is", 1, (fp2 > 10)); + expect("20 > 20 is", 0, (fp2 > 20)); + + expect("10 <= 20 is", 1, (fp1 <= 20)); + expect("20 <= 10 is", 0, (fp2 <= 10)); + expect("20 <= 20 is", 1, (fp2 <= 20)); + + expect("10 >= 20 is", 0, (fp1 >= 20)); + expect("20 >= 10 is", 1, (fp2 >= 10)); + expect("20 >= 20 is", 1, (fp2 >= 20)); } @@ -71,5 +83,5 @@ int main(void) varintconst(); printf("float-cmp-var-intconst (res: %d)\n", result); - return (result == 8) ? EXIT_FAILURE : EXIT_SUCCESS; + return result; }