Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/06/15 19:45:12 (10 years ago)
Author:
gkronber
Message:

worked on expression expander for const opt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/Test/TestCanonicalExpressions.cs

    r11902 r11966  
    6262
    6363      // 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)"));
    6565      Assert.AreEqual("a*b+a*d+b*c+c*d", extender.CanonicalRepresentation("(b-d)*(c-a)"));
    6666    }
     
    7474
    7575      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)"));
    7777      // a*b*e%(c+d)%(a+b)
    7878    }
     
    8080    public void TestDivisionCancellation() {
    8181      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")); 
    8585      Assert.AreEqual("1%a", extender.CanonicalRepresentation("a%a%a"));
    8686      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)"));
    8789    }
    8890  }
Note: See TracChangeset for help on using the changeset viewer.