kopia lustrzana https://github.com/micropython/micropython
tests: Split out float test from builtin_round.py.
rodzic
3b603f29ec
commit
7288403b9b
|
@ -1,14 +1,8 @@
|
|||
# test round()
|
||||
# test round() with integral values
|
||||
|
||||
# check basic cases
|
||||
tests = [
|
||||
False, True,
|
||||
0, 1, -1, 10,
|
||||
0.0, 1.0, 0.1, -0.1, 123.4, 123.6, -123.4, -123.6
|
||||
]
|
||||
for t in tests:
|
||||
print(round(t))
|
||||
|
||||
# check .5 cases
|
||||
for i in range(11):
|
||||
print(round((i - 5) / 2))
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# test round() with floats
|
||||
|
||||
# check basic cases
|
||||
tests = [
|
||||
0.0, 1.0, 0.1, -0.1, 123.4, 123.6, -123.4, -123.6
|
||||
]
|
||||
for t in tests:
|
||||
print(round(t))
|
||||
|
||||
# check .5 cases
|
||||
for i in range(11):
|
||||
print(round((i - 5) / 2))
|
Ładowanie…
Reference in New Issue