public void DicDrivenTrieSet_SetEqualsTest() { var firstValues = this.GetTestValues(); var secondValues = this.GetTestValues(); var firstTarget = new DicDrivenTrieSet <char, string>( firstValues, false, this.dicFactory); var secondTarget = new DicDrivenTrieSet <char, string>( secondValues, false, this.dicFactory); // Testa a igualdade com uma colecção Assert.IsTrue(firstTarget.SetEquals(secondValues)); // Testa a igualdade com outra árvore associativa Assert.IsTrue(firstTarget.SetEquals(secondTarget)); // Testa a igualdade com valores diferentes var differentValues = this.GetTestOverlappingValues(); var differentTarget = new DicDrivenTrieSet <char, string>( differentValues, false, this.dicFactory); Assert.IsFalse(firstTarget.SetEquals(differentValues)); Assert.IsFalse(firstTarget.SetEquals(differentTarget)); }
public void DicDrivenTrieSet_UnionTest() { var values = this.GetTestValues(); var overlappingValues = this.GetTestOverlappingValues(); var expected = values.Union(overlappingValues).ToArray(); var target = new DicDrivenTrieSet <char, string>( values, false, this.dicFactory); target.UnionWith(overlappingValues); CollectionAssert.AreEquivalent(expected, target); target = new DicDrivenTrieSet <char, string>( values, false, this.dicFactory); var overlappingTarget = new DicDrivenTrieSet <char, string>( overlappingValues, false, this.dicFactory); target.UnionWith(overlappingTarget); CollectionAssert.AreEquivalent(expected, target); var expectedTarget = new DicDrivenTrieSet <char, string>( expected, false, this.dicFactory); var actual = target.SetEquals(expectedTarget); Assert.IsTrue(actual); }
public void DicDrivenTrieSet_ExceptWithTest() { var values = this.GetTestValues(); var overlappingValues = this.GetTestOverlappingValues(); var expected = values.Except(overlappingValues).ToArray(); var target = new DicDrivenTrieSet <char, string>( values, false, this.dicFactory); // Testa a versão da função actual sobre enumeráveis target.ExceptWith((IEnumerable <string>)overlappingValues); CollectionAssert.AreEquivalent( expected, target); // Testa a função actual sobre ávores associativas target = new DicDrivenTrieSet <char, string>( values, false, this.dicFactory); var exceptWith = new DicDrivenTrieSet <char, string>( overlappingValues, true, this.dicFactory); target.ExceptWith(exceptWith); CollectionAssert.AreEquivalent( expected, target); var expectedTarget = new DicDrivenTrieSet <char, string>( expected, false, this.dicFactory); Assert.IsTrue(target.SetEquals(expectedTarget)); }
public void DicDrivenTrieSet_SymmetricExceptWithTest() { // Reocorre ao HashSet para verificar a validade do teste var values = new HashSet <string>(this.GetTestValues()); var overalappingValues = new HashSet <string>(this.GetTestOverlappingValues()); var expected = new HashSet <string>(values); expected.SymmetricExceptWith(overalappingValues); var target = new DicDrivenTrieSet <char, string>( values, false, this.dicFactory); target.SymmetricExceptWith(overalappingValues); CollectionAssert.AreEquivalent(expected.ToArray(), target); target = new DicDrivenTrieSet <char, string>( values, false, this.dicFactory); var overlappingTarget = new DicDrivenTrieSet <char, string>( overalappingValues, false, this.dicFactory); target.SymmetricExceptWith(overlappingTarget); CollectionAssert.AreEquivalent(target, expected.ToArray()); var expectedTarget = new DicDrivenTrieSet <char, string>( expected, false, this.dicFactory); var actual = target.SetEquals(expectedTarget); Assert.IsTrue(actual); }