コード例 #1
0
ファイル: test_wnet.py プロジェクト: uncledickHe/armspeech
 def test_topSort_emitting_self_cycle_ok(self):
     edges = {
         0: [(None, 1)],
         1: [(None, 2), ('a', 1)],
         2: []
     }
     elems = [ None for node in range(3) ]
     net = wnet.ConcreteNet(0, 2, elems, edges)
     for forwards in [False, True]:
         for debugCheckInvariants in [False, True]:
             wnet.topSort(net, defaultDeltaTime, forwards = forwards, detectCycles = True, debugCheckInvariants = debugCheckInvariants)
コード例 #2
0
ファイル: test_wnet.py プロジェクト: uncledickHe/armspeech
 def test_topSort(self, its = 1000):
     for it in range(its):
         net = gen_simple_ConcreteNet(defaultGenLabel, defaultDeltaTime, sortable = True, pathMustExist = True)
         if randBool():
             net = wnet.concretizeNetSimple(net, accessibleOnly = True)
         sortedNodes = wnet.topSort(net, defaultDeltaTime, forwards = randBool(), detectCycles = randBool(), debugCheckInvariants = randBool())
         assert is_valid_topSort(net, sortedNodes, defaultDeltaTime)
コード例 #3
0
ファイル: test_wnet.py プロジェクト: uncledickHe/armspeech
 def test_topSort_net_not_necessarily_sortable(self, its = 500):
     for it in range(its):
         net = gen_simple_ConcreteNet(defaultGenLabel, defaultDeltaTime, sortable = False, pathMustExist = True)
         if randBool():
             net = wnet.concretizeNetSimple(net, accessibleOnly = True)
         sortedNodes = wnet.topSort(net, defaultDeltaTime, forwards = randBool(), detectCycles = False, debugCheckInvariants = randBool())
         # perform basic sanity checks (don't check return value, since we
         #   already know the net is probably not sortable)
         is_valid_topSort(net, sortedNodes, defaultDeltaTime)
コード例 #4
0
ファイル: test_wnet.py プロジェクト: uncledickHe/armspeech
 def test_concretizeNetTopSort(self, its = 1000):
     for it in range(its):
         net = gen_simple_ConcreteNet(defaultGenLabel, defaultDeltaTime, sortable = True, pathMustExist = True)
         if randBool():
             net = wnet.concretizeNetSimple(net, accessibleOnly = True)
         sortedNodes = wnet.topSort(net, defaultDeltaTime)
         sortedNet = wnet.concretizeNetTopSort(net, defaultDeltaTime)
         sortedNetNodeSet = wnet.nodeSetCompute(sortedNet, accessibleOnly = False)
         assert wnet.netIsTopSorted(sortedNet, sortedNetNodeSet, defaultDeltaTime)
         assert len(sortedNetNodeSet) == len(sortedNodes)