diff options
| author | Damien George <damien.p.george@gmail.com> | 2016-03-15 13:20:18 +0000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2016-03-15 13:20:18 +0000 |
| commit | 157056ecdf378898996ba095c3d7bcf625368103 (patch) | |
| tree | 21f508f1ba8ab951b3acb59605d23825778b6dc9 | |
| parent | ab69ed7dac1bf0ef36238b6289d436e9932180bc (diff) | |
tests: Add new subdir "stress/" specifically for stress tests.
| -rwxr-xr-x | tests/run-tests | 4 | ||||
| -rw-r--r-- | tests/stress/dict_copy.py | 7 | ||||
| -rw-r--r-- | tests/stress/dict_create.py | 8 | ||||
| -rw-r--r-- | tests/stress/list_sort.py | 6 |
4 files changed, 23 insertions, 2 deletions
diff --git a/tests/run-tests b/tests/run-tests index feb971c97..887af701c 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -365,7 +365,7 @@ def main(): if args.test_dirs is None: if args.target == 'pyboard': # run pyboard tests - test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod', 'pyb', 'pybnative', 'inlineasm') + test_dirs = ('basics', 'micropython', 'float', 'misc', 'stress', 'extmod', 'pyb', 'pybnative', 'inlineasm') elif args.target == 'esp8266': test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod') elif args.target == 'wipy': @@ -373,7 +373,7 @@ def main(): test_dirs = ('basics', 'micropython', 'misc', 'extmod', 'wipy') else: # run PC tests - test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'unicode', 'extmod', 'unix', 'cmdline') + test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'stress', 'unicode', 'extmod', 'unix', 'cmdline') else: # run tests from these directories test_dirs = args.test_dirs diff --git a/tests/stress/dict_copy.py b/tests/stress/dict_copy.py new file mode 100644 index 000000000..36db9bb7e --- /dev/null +++ b/tests/stress/dict_copy.py @@ -0,0 +1,7 @@ +# copying a large dictionary + +a = {i:2*i for i in range(1000)} +b = a.copy() +for i in range(1000): + print(i, b[i]) +print(len(b)) diff --git a/tests/stress/dict_create.py b/tests/stress/dict_create.py new file mode 100644 index 000000000..e9db40a8e --- /dev/null +++ b/tests/stress/dict_create.py @@ -0,0 +1,8 @@ +# create a large dictionary + +d = {} +x = 1 +while x < 1000: + d[x] = x + x += 1 +print(d[500]) diff --git a/tests/stress/list_sort.py b/tests/stress/list_sort.py new file mode 100644 index 000000000..3a7701a1e --- /dev/null +++ b/tests/stress/list_sort.py @@ -0,0 +1,6 @@ +# test large list sorting (should not stack overflow) +l = list(range(2000)) +l.sort() +print(l[0], l[-1]) +l.sort(reverse=True) +print(l[0], l[-1]) |
