Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
graph_drawing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
graph_drawing
Commits
003a9e25
Commit
003a9e25
authored
Dec 11, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some unit tests for exponentiation expressions.
parent
4d65a52b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
tests/test_line.py
tests/test_line.py
+12
-2
No files found.
tests/test_line.py
View file @
003a9e25
...
@@ -45,10 +45,20 @@ class TestLine(unittest.TestCase):
...
@@ -45,10 +45,20 @@ class TestLine(unittest.TestCase):
node_pow
=
Node
(
'^'
,
a
,
Node
(
'+'
,
b
,
c
))
node_pow
=
Node
(
'^'
,
a
,
Node
(
'+'
,
b
,
c
))
self
.
assertEquals
(
generate_line
(
node_pow
),
'a ^ (b + c)'
)
self
.
assertEquals
(
generate_line
(
node_pow
),
'a ^ (b + c)'
)
def
test_pow_intermediate
(
self
):
def
test_pow_intermediate1
(
self
):
# expression: (a(b+c))^(d+e)
a
,
b
,
c
,
d
,
e
=
Leaf
(
'a'
),
Leaf
(
'b'
),
Leaf
(
'c'
),
Leaf
(
'd'
),
Leaf
(
'e'
)
a
,
b
,
c
,
d
,
e
=
Leaf
(
'a'
),
Leaf
(
'b'
),
Leaf
(
'c'
),
Leaf
(
'd'
),
Leaf
(
'e'
)
node_bc
=
Node
(
'+'
,
b
,
c
)
node_bc
=
Node
(
'+'
,
b
,
c
)
node_de
=
Node
(
'+'
,
d
,
e
)
node_de
=
Node
(
'+'
,
d
,
e
)
node_mul
=
Node
(
'*'
,
a
,
node_bc
)
node_mul
=
Node
(
'*'
,
a
,
node_bc
)
node_pow
=
Node
(
'^'
,
node_mul
,
node_de
)
node_pow
=
Node
(
'^'
,
node_mul
,
node_de
)
self
.
assertEquals
(
generate_line
(
node_pow
),
'a * (b + c) ^ (d + e)'
)
self
.
assertEquals
(
generate_line
(
node_pow
),
'(a * (b + c)) ^ (d + e)'
)
def
test_pow_intermediate2
(
self
):
# expression: a(b+c)^(d+e)
a
,
b
,
c
,
d
,
e
=
Leaf
(
'a'
),
Leaf
(
'b'
),
Leaf
(
'c'
),
Leaf
(
'd'
),
Leaf
(
'e'
)
node_bc
=
Node
(
'+'
,
b
,
c
)
node_de
=
Node
(
'+'
,
d
,
e
)
node_pow
=
Node
(
'^'
,
node_bc
,
node_de
)
node_mul
=
Node
(
'*'
,
a
,
node_pow
)
self
.
assertEquals
(
generate_line
(
node_mul
),
'a * (b + c) ^ (d + e)'
)
Write
Preview
Markdown
is supported
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