Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
0589c19d
Commit
0589c19d
authored
May 08, 2015
by
Damien George
Browse files
tests: Add test for machine module (mem* functions).
parent
76abb2e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/extmod/machine1.py
0 → 100644
View file @
0589c19d
# test machine module
import
machine
import
uctypes
print
(
machine
.
mem8
)
buf
=
bytearray
(
8
)
addr
=
uctypes
.
addressof
(
buf
)
machine
.
mem8
[
addr
]
=
123
print
(
machine
.
mem8
[
addr
])
machine
.
mem16
[
addr
]
=
12345
print
(
machine
.
mem16
[
addr
])
machine
.
mem32
[
addr
]
=
123456789
print
(
machine
.
mem32
[
addr
])
try
:
machine
.
mem16
[
1
]
except
ValueError
:
print
(
"ValueError"
)
try
:
machine
.
mem16
[
1
]
=
1
except
ValueError
:
print
(
"ValueError"
)
try
:
del
machine
.
mem8
[
0
]
except
TypeError
:
print
(
"TypeError"
)
tests/extmod/machine1.py.exp
0 → 100644
View file @
0589c19d
<8-bit memory>
123
12345
123456789
ValueError
ValueError
TypeError
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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