public void Default() { var factory = new MutexTokenFactory(); var model = new ComparisonModel(factory.GetTokenWrapperEnumerable(defaultTokenSet), new []{ new SourceEntityData("stud1", "assignment1", defaultTokenSet, "bla" ), new SourceEntityData("stud2", "assignment1", new[] {"CASE", "DECREMENT"}, "bla2") }, factory); model.Calculate(); Assert.AreEqual(100, model.MaximumSimilarity); }
public void ANTLRITokenVersusMutexTokenImpl() { var factory = new MutexTokenFactory(); var itokens = factory.GetTokenWrapperListFromSource("void main(int argc, char** argv)").ToGSTTokenList(); var tokennames = new[] { "VOID", "IDENTIFIER", "INTEGER_DATATYPE", "IDENTIFIER", "POINTER_DATATYPE", "IDENTIFIER" }; var mutextokens = factory.GetTokenWrapperEnumerable(tokennames).ToGSTTokenList(); for (int i = 0; i < itokens.Count; i++) { Assert.AreEqual(itokens[i].GetHashCode(), mutextokens[i].GetHashCode()); } var algo = new HashingGSTAlgorithm<GSTToken<TokenWrapper>>(itokens, mutextokens) { MinimumMatchLength = 3 }; algo.RunToCompletion(); Assert.AreEqual(100, algo.Similarity); }