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
fa97ae38
Commit
fa97ae38
authored
Sep 13, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made combine_groups a high-priority rule.
parent
c3a2ee8a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
23 deletions
+27
-23
src/rules/precedences.py
src/rules/precedences.py
+5
-1
tests/test_leiden_oefenopgave.py
tests/test_leiden_oefenopgave.py
+22
-22
No files found.
src/rules/precedences.py
View file @
fa97ae38
...
...
@@ -48,6 +48,10 @@ HIGH = [
add_numerics
,
multiply_numerics
,
negated_factor
,
# Combine occurences before doing other stuff to prevent duplicate
# calculations
combine_groups
,
]
...
...
@@ -74,7 +78,7 @@ RELATIVE = [
# Combine groups before expanding them
# Expand 'single' before 'double' to avoid unnessecary complexity
(
combine_groups
,
expand_single
,
expand_double
),
(
expand_single
,
expand_double
),
(
factor_out_exponent_important
,
raise_numerics
),
...
...
tests/test_leiden_oefenopgave.py
View file @
fa97ae38
...
...
@@ -46,22 +46,22 @@ class TestLeidenOefenopgave(TestCase):
'(xx + x + 1x + 1 * 1)(x + 1)'
,
'(xx + x + x + 1 * 1)(x + 1)'
,
'(xx + x + x + 1)(x + 1)'
,
'(x
^ (1 + 1) + x +
x + 1)(x + 1)'
,
'(x
^ 2 + x +
x + 1)(x + 1)'
,
'(x ^
2 + (1 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+ x +
x + 1'
,
'x ^
2 + (1 + 1)
x + 1'
,
'x
x + (1 + 1)
x + 1'
,
'x
x + 2
x + 1'
,
'x ^
(1 + 1) + 2
x + 1'
,
'x ^ 2 + 2x + 1'
,
])
...
...
@@ -92,10 +92,10 @@ class TestLeidenOefenopgave(TestCase):
'xx - x + (-1)x + 1'
,
'xx - x - 1x + 1'
,
'xx - x - x + 1'
,
'x
^ (1 + 1) - x -
x + 1'
,
'x
^ 2 - x -
x + 1'
,
'x
^ 2 + (1 + 1) * -
x + 1'
,
'x ^
2 + 2 * -
x + 1'
,
'x
x + (1 + 1) * -
x + 1'
,
'x
x + 2 * -
x + 1'
,
'x
x - 2
x + 1'
,
'x ^
(1 + 1) - 2
x + 1'
,
'x ^ 2 - 2x + 1'
,
])
...
...
@@ -153,11 +153,11 @@ class TestLeidenOefenopgave(TestCase):
'-(20x + (-16)xx + 25 + (-20)x)'
,
'-(20x - 16xx + 25 + (-20)x)'
,
'-(20x - 16xx + 25 - 20x)'
,
'-(
20x - 16x ^ (1 + 1) + 25 - 20x
)'
,
'-(
20x - 16x ^ 2 + 25 - 20x
)'
,
'-(
(1 - 1)20x - 16x ^ 2
+ 25)'
,
'-(
0 * 20x - 16x ^ 2
+ 25)'
,
'-(
0 - 16x ^ 2
+ 25)'
,
'-(
(1 - 1)20x - 16xx + 25
)'
,
'-(
0 * 20x - 16xx + 25
)'
,
'-(
0 - 16xx
+ 25)'
,
'-(
-16xx
+ 25)'
,
'-(
-16x ^ (1 + 1)
+ 25)'
,
'-(-16x ^ 2 + 25)'
,
'--16x ^ 2 - 25'
,
'16x ^ 2 - 25'
,
...
...
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