We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a053e37 commit 4d659f5Copy full SHA for 4d659f5
1 file changed
tests/micropython/heapalloc.py
@@ -0,0 +1,26 @@
1
+# check that we can do certain things without allocating heap memory
2
+
3
+import gc
4
5
+def f(a):
6
+ print(a)
7
8
+def g(a, b=2):
9
+ print(a, b)
10
11
+global_var = 1
12
13
+def h():
14
+ global global_var
15
+ global_var = 2 # set an existing global variable
16
+ for i in range(2): # for loop
17
+ f(i) # function call
18
+ f(i * 2 + 1) # binary operation with small ints
19
+ f(a=i) # keyword arguments
20
+ g(i) # default arg (second one)
21
+ g(i, i) # 2 args
22
23
+# call h with heap allocation disabled
24
+gc.disable()
25
+h()
26
+gc.enable()
0 commit comments