From e51ac7ec7d3e32e1771c9f824da3dc7e4dcd2bc5 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 13 Dec 2025 19:21:04 +0100 Subject: add c-testsuite --- .../external/c-testsuite/tests/single-exec/00174.c | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 test/external/c-testsuite/tests/single-exec/00174.c (limited to 'test/external/c-testsuite/tests/single-exec/00174.c') diff --git a/test/external/c-testsuite/tests/single-exec/00174.c b/test/external/c-testsuite/tests/single-exec/00174.c new file mode 100644 index 0000000..e3491f5 --- /dev/null +++ b/test/external/c-testsuite/tests/single-exec/00174.c @@ -0,0 +1,50 @@ +#include +#include + +int main() +{ + // variables + float a = 12.34 + 56.78; + printf("%f\n", a); + + // infix operators + printf("%f\n", 12.34 + 56.78); + printf("%f\n", 12.34 - 56.78); + printf("%f\n", 12.34 * 56.78); + printf("%f\n", 12.34 / 56.78); + + // comparison operators + printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78); + printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34); + printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34); + + // assignment operators + a = 12.34; + a += 56.78; + printf("%f\n", a); + + a = 12.34; + a -= 56.78; + printf("%f\n", a); + + a = 12.34; + a *= 56.78; + printf("%f\n", a); + + a = 12.34; + a /= 56.78; + printf("%f\n", a); + + // prefix operators + printf("%f\n", +12.34); + printf("%f\n", -12.34); + + // type coercion + a = 2; + printf("%f\n", a); + printf("%f\n", sin(2)); + + return 0; +} + +/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ -- cgit v1.2.3