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
f256cfef
Commit
f256cfef
authored
Mar 14, 2015
by
Damien George
Browse files
tests: Add some more tests for complex numbers and ure module.
parent
fa1edff0
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/extmod/ure1.py
View file @
f256cfef
...
...
@@ -56,3 +56,9 @@ print(m.group(0))
m
=
re
.
search
(
"w.r"
,
"hello world"
)
print
(
m
.
group
(
0
))
m
=
re
.
match
(
'a+?'
,
'ab'
);
print
(
m
.
group
(
0
))
m
=
re
.
match
(
'a*?'
,
'ab'
);
print
(
m
.
group
(
0
))
m
=
re
.
match
(
'^ab$'
,
'ab'
);
print
(
m
.
group
(
0
))
m
=
re
.
match
(
'a|b'
,
'b'
);
print
(
m
.
group
(
0
))
m
=
re
.
match
(
'a|b|c'
,
'c'
);
print
(
m
.
group
(
0
))
tests/float/complex1.py
View file @
f256cfef
...
...
@@ -13,7 +13,7 @@ print(complex(1j, 2j))
# unary ops
print
(
bool
(
1j
))
print
(
+
(
1j
))
#
print(-(1
j)) uPy doesn't print correctly
print
(
-
(
1
+
2j
))
# binary ops
print
(
1j
+
2
)
...
...
@@ -23,10 +23,10 @@ print(1j - 2j)
print
(
1j
*
2
)
print
(
1j
*
2j
)
print
(
1j
/
2
)
#
print(1j /
2j) uPy doesn't print correctly
#print(1j ** 2) uPy doesn't print correctly
#print(1j ** 2j) uPy doesn't print correctly
print
(
1j
/
(
1
+
2j
))
ans
=
1j
**
2.5
;
print
(
"%.5g %.5g"
%
(
ans
.
real
,
ans
.
imag
))
ans
=
1j
**
2.5j
;
print
(
"%.5g %.5g"
%
(
ans
.
real
,
ans
.
imag
))
# builtin abs
print
(
abs
(
1j
))
print
(
abs
(
1j
+
2
))
print
(
"%.5g"
%
abs
(
1j
+
2
))
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