diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-29 14:56:09 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-29 14:56:09 +0000 |
commit | 92ab95f21539d94c2139974b3995699a155f5a97 (patch) | |
tree | fb1e917f68ec818edf3ba65753427682c4f51970 /tests/basics/fun_largestate.py | |
parent | 598af3a7d6bab1f106f6969ebab2d6f4e11ee963 (diff) | |
download | micropython-92ab95f21539d94c2139974b3995699a155f5a97.tar.gz micropython-92ab95f21539d94c2139974b3995699a155f5a97.zip |
tests: Add some tests to improve coverage.
Diffstat (limited to 'tests/basics/fun_largestate.py')
-rw-r--r-- | tests/basics/fun_largestate.py | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/basics/fun_largestate.py b/tests/basics/fun_largestate.py index f13619295f..124f1e506f 100644 --- a/tests/basics/fun_largestate.py +++ b/tests/basics/fun_largestate.py @@ -1,5 +1,6 @@ # test large function (stack) state +# this function creates 127 locals def f(): x0 = 1 x1 = 1 @@ -128,10 +129,31 @@ def f(): x124 = 1 x125 = 1 x126 = 1 - f() +# this function pushes 128 elements onto the function stack def g(): x = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,] - g() + +# this function exercises load_fast_n and store_fast_n opcodes +def h(): + x0 = 1 + x1 = x0 + x2 = x1 + x3 = x2 + x4 = x3 + x5 = x4 + x6 = x5 + x7 = x6 + x8 = x7 + x9 = x8 + x10 = x9 + x11 = x10 + x12 = x11 + x13 = x12 + x14 = x13 + x15 = x14 + x16 = x15 + x17 = x16 +h() |