8000 tests/float: Improve formatfloat.c test coverage using Python. · rch/micropython@64dc925 · GitHub
[go: up one dir, main page]

Skip to content

Commit 64dc925

Browse files
flowergrassdpgeorge
authored andcommitted
tests/float: Improve formatfloat.c test coverage using Python.
1 parent ec72db8 commit 64dc925

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

tests/float/string_format_modulo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@
4242
print(('%.40g' % 1e-2)[:2])
4343
print(('%.40g' % 1e-3)[:2])
4444
print(('%.40g' % 1e-4)[:2])
45+
46+
print("%.0g" % 1) # 0 precision 'g'

tests/float/string_format_modulo3.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# uPy and CPython outputs differ for the following
2+
print("%.1g" % -9.9) # round up 'g' with '-' sign
3+
print("%.1e" % 9.99) # round up with positive exponent
4+
print("%.1e" % 0.999) # round up with negative exponent
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-10
2+
1.00e+01
3+
1.00e-00

0 commit comments

Comments
 (0)
0