support/testing: add micropython runtime test
Signed-off-by: Julien Olivain <ju.o@free.fr> [me: rework the test mostly for eye-candyness] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
committed by
Yann E. MORIN
parent
6c9be611a8
commit
0c6ffa5513
25
support/testing/tests/package/test_micropython/rootfs-overlay/root/mandel.py
Executable file
25
support/testing/tests/package/test_micropython/rootfs-overlay/root/mandel.py
Executable file
@@ -0,0 +1,25 @@
|
||||
#! /usr/bin/env micropython
|
||||
|
||||
from micropython import mem_info
|
||||
|
||||
POINTS = list(",.:-;!/>)|&IH%*Z")
|
||||
|
||||
|
||||
def mandel():
|
||||
for y in range(-15, 16):
|
||||
for x in range(1, 85):
|
||||
i = 0
|
||||
r = 0
|
||||
for k in range(112):
|
||||
j = (r*r) - (i*i) - 2 + (x/25)
|
||||
i = 2 * r * i + (y/10)
|
||||
if j*j + i*i >= 11:
|
||||
break
|
||||
r = j
|
||||
print(POINTS[k & 0xF], end='')
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mandel()
|
||||
mem_info()
|
||||
Reference in New Issue
Block a user