/** * */ package it.univr.di.cstnu.graph; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.ObjectSet; import it.univr.di.labeledvalue.Label; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; /** * @author posenato */ public class LabeledNodeTest { // static LabeledNodeSupplier nodeFactory = new LabeledNodeSupplier(); /** * */ LabeledNode a; /** * @throws java.lang.Exception none */ @Before public void setUp() throws Exception { // this.alphabet = new ALabelAlphabet(); this.a = LabeledNodeSupplier.get("A"); this.a.setLabel(Label.emptyLabel); } /** */ @Test public final void testEquals() { final LabeledNode aa = LabeledNodeSupplier.get("A"); aa.setLabel(Label.emptyLabel); assertTrue(this.a.equalsByName(aa)); assertNotEquals(this.a, aa); assertNotSame(this.a, aa); } /** */ @Test public final void potentialPut1() { this.a.putLabeledPotential(Label.parse("b"), -1); this.a.putLabeledPotential(Label.parse("b"), -1);// ignored this.a.putLabeledPotential(Label.parse("a"), -1); ObjectSet> entrySet = this.a.getLabeledPotential().entrySet();//ok assertEquals("{b=>-1, a=>-1}", entrySet.toString()); this.a.putLabeledPotential(Label.parse("¬b"), -1); entrySet = this.a.getLabeledPotential().entrySet();//ok assertEquals("{⊡=>-1}", entrySet.toString()); } }