aboutsummaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 991f43a9..ea2fe49e 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1372,6 +1372,33 @@ Succeeded!
'''
self.do_run(src, '*1,10,10.5,1,1.2340,0.00*\n0.50, 3.30, 3.30, 3.30\nsmall: 0.0000010000\n')
+ def test_zerodiv(self):
+ self.do_run(r'''
+ #include <stdio.h>
+ int main(int argc, const char* argv[])
+ {
+ float f1 = 1.0f;
+ float f2 = 0.0f;
+ float f_zero = 0.0f;
+
+ float f3 = 0.0f / f2;
+ float f4 = f2 / 0.0f;
+ float f5 = f2 / f2;
+ float f6 = f2 / f_zero;
+
+ printf("f3: %f\n", f3);
+ printf("f4: %f\n", f4);
+ printf("f5: %f\n", f5);
+ printf("f6: %f\n", f6);
+
+ return 0;
+ }
+ ''', '''f3: nan
+f4: nan
+f5: nan
+f6: nan
+''')
+
def test_isnan(self):
src = r'''
#include <stdio.h>