From 9d27183bde0a70521a0d189636e53975df2260eb Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 20 Mar 2024 13:30:22 +1100 Subject: [PATCH] tests/float/float_struct_e.py: Add specific test for struct 'e' type. Signed-off-by: Damien George --- tests/float/float_struct_e.py | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/float/float_struct_e.py diff --git a/tests/float/float_struct_e.py b/tests/float/float_struct_e.py new file mode 100644 index 0000000000..403fbc5db4 --- /dev/null +++ b/tests/float/float_struct_e.py @@ -0,0 +1,43 @@ +# Test struct pack/unpack with 'e' typecode. + +try: + import struct +except ImportError: + print("SKIP") + raise SystemExit + +test_values = ( + 1e-7, + 2e-7, + 1e-6, + 1e-5, + 1e-4, + 1e-3, + 1e-2, + 0.1, + 0, + 1, + 2, + 4, + 8, + 10, + 100, + 1e3, + 1e4, + 6e4, + float("inf"), +) + +for j in test_values: + for i in (j, -j): + x = struct.pack("