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
65574f81
Commit
65574f81
authored
Dec 28, 2016
by
Rami Ali
Committed by
Damien George
Dec 28, 2016
Browse files
tests/basics: Add tests to improve coverage of binary.c.
parent
ea6a9583
Changes
5
Hide whitespace changes
Inline
Side-by-side
tests/basics/array_micropython.py
0 → 100644
View file @
65574f81
# test MicroPython-specific features of array.array
import
array
# arrays of objects
a
=
array
.
array
(
'O'
)
a
.
append
(
1
)
print
(
a
[
0
])
# arrays of pointers
a
=
array
.
array
(
'P'
)
a
.
append
(
1
)
print
(
a
[
0
])
tests/basics/array_micropython.py.exp
0 → 100644
View file @
65574f81
1
1
tests/basics/struct1.py
View file @
65574f81
...
...
@@ -61,6 +61,10 @@ print(struct.unpack(">q", b"\xf2\x34\x56\x78\x90\x12\x34\x56"))
print
(
struct
.
unpack
(
"<I"
,
b
"
\xff\xff\xff\xff
"
))
print
(
struct
.
unpack
(
"<Q"
,
b
"
\xff\xff\xff\xff\xff\xff\xff\xff
"
))
# check small int overflow
print
(
struct
.
unpack
(
"<i"
,
b
'
\xff\xff\xff\x7f
'
))
print
(
struct
.
unpack
(
"<q"
,
b
'
\xff\xff\xff\xff\xff\xff\xff\x7f
'
))
# network byte order
print
(
struct
.
pack
(
'!i'
,
123
))
...
...
tests/basics/struct_micropython.py
0 → 100644
View file @
65574f81
# test MicroPython-specific features of struct
try
:
import
ustruct
as
struct
except
:
try
:
import
struct
except
ImportError
:
import
sys
print
(
"SKIP"
)
sys
.
exit
()
class
A
():
pass
# pack and unpack objects
o
=
A
()
s
=
struct
.
pack
(
"<O"
,
o
)
o2
=
struct
.
unpack
(
"<O"
,
s
)
print
(
o
is
o2
[
0
])
tests/basics/struct_micropython.py.exp
0 → 100644
View file @
65574f81
True
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