Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/09/15 09:48:30 (10 years ago)
Author:
gkronber
Message:

#2283 new experiments

File:
1 edited

Legend:

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

    r11966 r11972  
    6868    public void TestDivisionExpansion() {
    6969      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)"));
    7474
    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)"));
    7777      // a*b*e%(c+d)%(a+b)
    7878    }
     
    8282      Assert.AreEqual("1", extender.CanonicalRepresentation("a%a"));
    8383      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"));
    8686      Assert.AreEqual("a", extender.CanonicalRepresentation("a%(a%a)"));
    8787      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)"));
    8990    }
    9091  }
Note: See TracChangeset for help on using the changeset viewer.