Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
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
trs
Commits
1efc3675
Commit
1efc3675
authored
Feb 20, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added leiden oefenopgave test cases.
parent
63ab861b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
20 deletions
+50
-20
tests/test_leiden_oefenopgave.py
tests/test_leiden_oefenopgave.py
+50
-20
No files found.
tests/test_leiden_oefenopgave.py
View file @
1efc3675
...
@@ -30,6 +30,8 @@ class TestLeidenOefenopgave(TestCase):
...
@@ -30,6 +30,8 @@ class TestLeidenOefenopgave(TestCase):
'(xx + x * 1 + 1x + 1 * 1)(x + 1)'
,
'(xx + x * 1 + 1x + 1 * 1)(x + 1)'
,
'(x ^ (1 + 1) + x * 1 + 1x + 1 * 1)(x + 1)'
,
'(x ^ (1 + 1) + x * 1 + 1x + 1 * 1)(x + 1)'
,
'(x ^ 2 + x * 1 + 1x + 1 * 1)(x + 1)'
,
'(x ^ 2 + x * 1 + 1x + 1 * 1)(x + 1)'
,
'(x ^ 2 + x + 1x + 1 * 1)(x + 1)'
,
'(x ^ 2 + x + x + 1 * 1)(x + 1)'
,
'(x ^ 2 + (1 + 1)x + 1 * 1)(x + 1)'
,
'(x ^ 2 + (1 + 1)x + 1 * 1)(x + 1)'
,
'(x ^ 2 + 2x + 1 * 1)(x + 1)'
,
'(x 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3 * x ^ 2 + 3x + 1'
,
...
@@ -56,6 +60,8 @@ class TestLeidenOefenopgave(TestCase):
...
@@ -56,6 +60,8 @@ class TestLeidenOefenopgave(TestCase):
'xx + x * 1 + 1x + 1 * 1'
,
'xx + x * 1 + 1x + 1 * 1'
,
'x ^ (1 + 1) + x * 1 + 1x + 1 * 1'
,
'x ^ (1 + 1) + x * 1 + 1x + 1 * 1'
,
'x ^ 2 + x * 1 + 1x + 1 * 1'
,
'x ^ 2 + x * 1 + 1x + 1 * 1'
,
'x ^ 2 + x + 1x + 1 * 1'
,
'x ^ 2 + x + x + 1 * 1'
,
'x ^ 2 + (1 + 1)x + 1 * 1'
,
'x ^ 2 + (1 + 1)x + 1 * 1'
,
'x ^ 2 + 2x + 1 * 1'
,
'x ^ 2 + 2x + 1 * 1'
,
'x ^ 2 + 2x + 1'
],
'x ^ 2 + 2x + 1'
],
...
@@ -76,15 +82,32 @@ class TestLeidenOefenopgave(TestCase):
...
@@ -76,15 +82,32 @@ class TestLeidenOefenopgave(TestCase):
self
.
assertRewrite
(
chain
)
self
.
assertRewrite
(
chain
)
def
test_1_4_1
(
self
):
def
test_1_4_1
(
self
):
self
.
assertRewrite
([
'x * -1 + 1x'
,
'(-1 + 1)x'
,
'0x'
,
'0'
])
self
.
assertRewrite
([
'x * -1 + 1x'
,
'-x * 1 + 1x'
,
'-x + 1x'
,
'-x + x'
,
'(-1 + 1)x'
,
'0x'
,
'0'
])
def
test_1_4_2
(
self
):
def
test_1_4_2
(
self
):
# FIXME: self.assertRewrite(['x * -1 - 1x', '(-1 + -1)x', '-2x'])
self
.
assertRewrite
([
'x * -1 - 1x'
,
pass
'-x * 1 - 1x'
,
'-x - 1x'
,
'-x - x'
,
'(1 + 1) * -x'
,
'2 * -x'
,
'-2x'
])
def
test_1_4_3
(
self
):
def
test_1_4_3
(
self
):
# FIXME: self.assertRewrite(['x * -1 + x * -1', '(-1 + -1)x', '-2x'])
self
.
assertRewrite
([
'x * -1 + x * -1'
,
pass
'-x * 1 + x * -1'
,
'-x + x * -1'
,
'-x - x * 1'
,
'-x - x'
,
'(1 + 1) * -x'
,
'2 * -x'
,
'-2x'
])
def
test_1_5
(
self
):
def
test_1_5
(
self
):
self
.
assertRewrite
([
'(2x + x)x'
,
'(2 + 1)xx'
,
'3xx'
,
self
.
assertRewrite
([
'(2x + x)x'
,
'(2 + 1)xx'
,
'3xx'
,
...
@@ -113,18 +136,25 @@ class TestLeidenOefenopgave(TestCase):
...
@@ -113,18 +136,25 @@ class TestLeidenOefenopgave(TestCase):
def
test_3
(
self
):
def
test_3
(
self
):
pass
pass
def
test_4
(
self
):
def
test_4_1
(
self
):
for
exp
,
solution
in
[
self
.
assertRewrite
([
'2/15 + 1/4'
,
'8 / 60 + 15 / 60'
,
'(8 + 15) / 60'
,
(
'2/15 + 1/4'
,
'8 / 60 + 15 / 60'
),
'23 / 60'
])
(
'8/60 + 15/60'
,
'(8 + 15) / 60'
),
(
'(8 + 15) / 60'
,
'23 / 60'
),
def
test_4_2
(
self
):
(
'2/7 - 4/11'
,
'22 / 77 - 28 / 77'
),
self
.
assertRewrite
([
'2/7 - 4/11'
,
'22 / 77 - 28 / 77'
,
(
'22/77 - 28/77'
,
'(22 - 28) / 77'
),
'(22 - 28) / 77'
,
'-6 / 77'
])
(
'(22 - 28)/77'
,
'-6 / 77'
),
# FIXME: ('(7/3) * (3/5)', '7 / 5'),
#def test_4_3(self):
# FIXME: ('(3/4) / (5/6)', '9 / 10'),
# self.assertRewrite(['(7/3) * (3/5)', '7 / 5'])
# FIXME: ('1/4 * 1/x', '1 / (4x)'),
# FIXME: ('(3/x^2) / (x/7)', '21 / x^3'),
#def test_4_4(self):
# FIXME: ('1/x + 2/(x+1)', '(3x + 1) / (x * (x + 1))'),
# self.assertRewrite(['(3/4) / (5/6)', '9 / 10'])
]:
self
.
assertEqual
(
str
(
rewrite
(
exp
)),
solution
)
#def test_4_5(self):
# self.assertRewrite(['1/4 * 1/x', '1 / (4x)'])
#def test_4_6(self):
# self.assertRewrite(['(3/x^2) / (x/7)', '21 / x^3'])
#def test_4_7(self):
# self.assertRewrite(['1/x + 2/(x+1)', '(3x + 1) / (x * (x + 1))'])
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