Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/16/18 18:36:17 (6 years ago)
Author:
lkammere
Message:

#2886: Add basic implementation for inverse factors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2886_SymRegGrammarEnumeration/Test/TreeHashingTest.cs

    r15746 r15784  
    106106    }
    107107
     108    [TestMethod]
     109    [TestCategory("TreeHashing")]
     110    public void InverseFactorCancelationSimple() {
     111      SymbolString s1 = new SymbolString(new Symbol[] { varA, grammar.Inv, varB, grammar.Multiplication, varA, grammar.Multiplication, varA, grammar.Multiplication });
     112      SymbolString s2 = new SymbolString(new Symbol[] { varA, varB, grammar.Multiplication });
     113
     114      int hash1 = grammar.CalcHashCode(s1);
     115      int hash2 = grammar.CalcHashCode(s2);
     116
     117      Assert.AreEqual(hash1, hash2);
     118    }
     119
     120    [TestMethod]
     121    [TestCategory("TreeHashing")]
     122    public void InverseFactorCancelationComplex() {
     123      SymbolString s1 = new SymbolString(new Symbol[] { varA, grammar.Sin, varA, varA, grammar.Multiplication, varA, grammar.Addition, grammar.Sin, grammar.Addition });
     124      SymbolString s2 = new SymbolString(new Symbol[] { varA, varA, varA, grammar.Multiplication, grammar.Addition, grammar.Sin, varA, grammar.Inv, varA, grammar.Sin, varA, grammar.Multiplication, grammar.Multiplication, grammar.Addition });
     125
     126      int hash1 = grammar.CalcHashCode(s1);
     127      int hash2 = grammar.CalcHashCode(s2);
     128
     129      Assert.AreEqual(hash1, hash2);
     130    }
    108131
    109132    #region parser
Note: See TracChangeset for help on using the changeset viewer.