# -*-python-*- # (c): Asko Soukka import org.fenfire as ff from org.fenfire.fenmm import MindNet def testMindNet(): """ Test FenMM's MindNet storage. """ net = MindNet() a = ff.swamp.Nodes.N() b = ff.swamp.Nodes.N() c = ff.swamp.Nodes.N() assert not net.hasBeenLinked(a, b), 'No nodes should not be added yet into MindNet.' net.link(a, b) assert net.hasBeenLinked(a, b), 'Nodes a and b should be linked in MindNet.' assert net.hasBeenLinked(b, a), 'Nodes a and b should be linked bidirectionally in MindNet.' net.link(a, c) assert net.hasBeenLinked(a, c), 'Nodes a and c should be linked in MindNet.' assert net.hasBeenLinked(c, a), 'Nodes a and c should be linked bidirectionally in MindNet.' assert not net.hasBeenLinked(b, c), 'Nodes b and c should not be linked in MindNet.' assert not net.hasBeenLinked(c, b), 'Nodes b and c should not be linked in MindNet.' assert not net.hasBeenLinked(None, None), 'Null objects cannot be linked in MindNet.' assert not net.hasBeenLinked(a, None), 'Null objects cannot be linked in MindNet.' assert not net.hasBeenLinked(None, a), 'Null objects cannot be linked in MindNet.'