Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
4d659f56
Commit
4d659f56
authored
May 31, 2014
by
Damien George
Browse files
tests: Add feature test for when heap allocation is disabled.
parent
a053e37b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/micropython/heapalloc.py
0 → 100644
View file @
4d659f56
# check that we can do certain things without allocating heap memory
import
gc
def
f
(
a
):
print
(
a
)
def
g
(
a
,
b
=
2
):
print
(
a
,
b
)
global_var
=
1
def
h
():
global
global_var
global_var
=
2
# set an existing global variable
for
i
in
range
(
2
):
# for loop
f
(
i
)
# function call
f
(
i
*
2
+
1
)
# binary operation with small ints
f
(
a
=
i
)
# keyword arguments
g
(
i
)
# default arg (second one)
g
(
i
,
i
)
# 2 args
# call h with heap allocation disabled
gc
.
disable
()
h
()
gc
.
enable
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment