-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d985008
commit 930985a
Showing
20 changed files
with
108 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/test/java/org/logicng/datastructures/ubtrees/UBNodeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.logicng.datastructures.ubtrees; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.logicng.algorithms.primecomputation.PrimeResult; | ||
import org.logicng.formulas.F; | ||
import org.logicng.formulas.Literal; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.SortedSet; | ||
import java.util.TreeSet; | ||
|
||
/** | ||
* Unit Tests for the class {@link UBNode}. | ||
* @version 2.0.0 | ||
* @since 2.0.0 | ||
*/ | ||
public class UBNodeTest { | ||
|
||
private final UBNode<Integer> node1; | ||
private final UBNode<String> node2; | ||
|
||
public UBNodeTest() { | ||
this.node1 = new UBNode<>(1); | ||
this.node2 = new UBNode<>("String"); | ||
} | ||
|
||
@Test | ||
public void testHashCode() { | ||
assertThat(this.node1.hashCode()).isEqualTo(this.node1.hashCode()); | ||
assertThat(this.node1.hashCode()).isEqualTo(new UBNode<>(1).hashCode()); | ||
} | ||
|
||
@Test | ||
public void testEquals() { | ||
assertThat(this.node1.hashCode()).isEqualTo(this.node1.hashCode()); | ||
final List<SortedSet<Literal>> primeImplicants = new ArrayList<>(); | ||
primeImplicants.add(new TreeSet<>(Arrays.asList(F.A, F.NB))); | ||
primeImplicants.add(new TreeSet<>(Arrays.asList(F.A, F.C))); | ||
final List<SortedSet<Literal>> primeImplicates = new ArrayList<>(); | ||
primeImplicates.add(new TreeSet<>(Arrays.asList(F.A, F.NB))); | ||
final PrimeResult otherResult = new PrimeResult(primeImplicants, primeImplicates, PrimeResult.CoverageType.IMPLICANTS_COMPLETE); | ||
assertThat(this.node1.equals(this.node1)).isTrue(); | ||
assertThat(this.node1.equals(new UBNode<>(1))).isTrue(); | ||
assertThat(this.node1.equals(this.node2)).isFalse(); | ||
assertThat(this.node2.equals(this.node1)).isFalse(); | ||
assertThat(this.node1.equals(null)).isFalse(); | ||
} | ||
|
||
@Test | ||
public void testToString() { | ||
assertThat(this.node1.toString()).isEqualTo( | ||
"UBNode{" + | ||
"element=1" + | ||
", children={}" + | ||
", set=null" + | ||
'}'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters