- Timestamp:
- 02/06/15 19:45:12 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Test/TestCanonicalExpressions.cs
r11902 r11966 62 62 63 63 // when using constant opt the negative sign is not necessary because a negative factor can be produced 64 Assert.AreEqual("a*b+ c*b", extender.CanonicalRepresentation("b*(c-a)"));64 Assert.AreEqual("a*b+b*c", extender.CanonicalRepresentation("b*(c-a)")); 65 65 Assert.AreEqual("a*b+a*d+b*c+c*d", extender.CanonicalRepresentation("(b-d)*(c-a)")); 66 66 } … … 74 74 75 75 Assert.AreEqual("a*b%(a+b)%(c+d)", extender.CanonicalRepresentation("(b*a)%(d-c)%(a+b)")); 76 Assert.AreEqual("a*b%( c+d)%(a%e+b%e)", extender.CanonicalRepresentation("((b*a)%(d-c))%((a+b)%e)"));76 Assert.AreEqual("a*b%(a%e+b%e)%(c+d)", extender.CanonicalRepresentation("((b*a)%(d-c))%((a+b)%e)")); 77 77 // a*b*e%(c+d)%(a+b) 78 78 } … … 80 80 public void TestDivisionCancellation() { 81 81 var extender = new ExpressionExtender(); 82 Assert.AreEqual(" a", extender.CanonicalRepresentation("a%a"));83 Assert.AreEqual("a *a", extender.CanonicalRepresentation("a*a%a"));84 Assert.AreEqual("1%a", extender.CanonicalRepresentation("(a%a)%a")); 82 Assert.AreEqual("1", extender.CanonicalRepresentation("a%a")); 83 Assert.AreEqual("a", extender.CanonicalRepresentation("a*a%a")); 84 Assert.AreEqual("1%a", extender.CanonicalRepresentation("(a%a)%a")); 85 85 Assert.AreEqual("1%a", extender.CanonicalRepresentation("a%a%a")); 86 86 Assert.AreEqual("a", extender.CanonicalRepresentation("a%(a%a)")); 87 Assert.AreEqual("1", extender.CanonicalRepresentation("(a+b)%(b+a)")); 88 Assert.AreEqual("1%a+1%b", extender.CanonicalRepresentation("(a+b)%(a*b)")); 87 89 } 88 90 }
Note: See TracChangeset
for help on using the changeset viewer.