- Timestamp:
- 02/09/15 09:48:30 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Test/TestCanonicalExpressions.cs
r11966 r11972 68 68 public void TestDivisionExpansion() { 69 69 var extender = new ExpressionExtender(); 70 Assert.AreEqual("a %c+b%c", extender.CanonicalRepresentation("(b+a)%c"));71 Assert.AreEqual("a %c%d+b%c%d", extender.CanonicalRepresentation("(b+a)%(d*c)"));72 Assert.AreEqual("a %(c+d)+b%(c+d)", extender.CanonicalRepresentation("(b-a)%(d-c)"));73 Assert.AreEqual("a*b %(c+d)", extender.CanonicalRepresentation("(b*a)%(d-c)"));70 Assert.AreEqual("a*1/c+b*1/c", extender.CanonicalRepresentation("(b+a)%c")); 71 Assert.AreEqual("a*1/c*1/d+b*1/c*1/d", extender.CanonicalRepresentation("(b+a)%(d*c)")); 72 Assert.AreEqual("a*1/(c+d)+b*1/(c+d)", extender.CanonicalRepresentation("(b-a)%(d-c)")); 73 Assert.AreEqual("a*b*1/(c+d)", extender.CanonicalRepresentation("(b*a)%(d-c)")); 74 74 75 Assert.AreEqual("a*b %(a+b)%(c+d)", extender.CanonicalRepresentation("(b*a)%(d-c)%(a+b)"));76 Assert.AreEqual("a*b %(a%e+b%e)%(c+d)", extender.CanonicalRepresentation("((b*a)%(d-c))%((a+b)%e)"));75 Assert.AreEqual("a*b*1/(a+b)*1/(c+d)", extender.CanonicalRepresentation("(b*a)%(d-c)%(a+b)")); 76 Assert.AreEqual("a*b*1/(a*1/e+b*1/e)*1/(c+d)", extender.CanonicalRepresentation("((b*a)%(d-c))%((a+b)%e)")); 77 77 // a*b*e%(c+d)%(a+b) 78 78 } … … 82 82 Assert.AreEqual("1", extender.CanonicalRepresentation("a%a")); 83 83 Assert.AreEqual("a", extender.CanonicalRepresentation("a*a%a")); 84 Assert.AreEqual("1 %a", extender.CanonicalRepresentation("(a%a)%a"));85 Assert.AreEqual("1 %a", extender.CanonicalRepresentation("a%a%a"));84 Assert.AreEqual("1/a", extender.CanonicalRepresentation("(a%a)%a")); 85 Assert.AreEqual("1/a", extender.CanonicalRepresentation("a%a%a")); 86 86 Assert.AreEqual("a", extender.CanonicalRepresentation("a%(a%a)")); 87 87 Assert.AreEqual("1", extender.CanonicalRepresentation("(a+b)%(b+a)")); 88 Assert.AreEqual("1%a+1%b", extender.CanonicalRepresentation("(a+b)%(a*b)")); 88 Assert.AreEqual("1/a+1/b", extender.CanonicalRepresentation("(a+b)%(a*b)")); 89 Assert.AreEqual("a*1/(a*c*1/b+e*1/d*1/f)+b*1/(a*c*1/b+e*1/d*1/f)", extender.CanonicalRepresentation("(a+b)%(a%b*c+e%f%d)")); 89 90 } 90 91 }
Note: See TracChangeset
for help on using the changeset viewer.