Skip to content

Commit 7f0e563

Browse files
committed
tests/micropython: Add test for micropython.opt_level() function.
1 parent 7dc2345 commit 7f0e563

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

tests/micropython/opt_level.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import micropython as micropython
2+
3+
# check we can get and set the level
4+
micropython.opt_level(0)
5+
print(micropython.opt_level())
6+
micropython.opt_level(1)
7+
print(micropython.opt_level())
8+
9+
# check that the optimisation levels actually differ
10+
micropython.opt_level(0)
11+
exec('print(__debug__)')
12+
micropython.opt_level(1)
13+
exec('print(__debug__)')
14+
exec('assert 0')

tests/micropython/opt_level.py.exp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0
2+
1
3+
True
4+
False

0 commit comments

Comments
 (0)