|
@@ -43,35 +43,35 @@ class MySubjects(Subjects):
|
43
|
43
|
|
44
|
44
|
|
45
|
45
|
class TestCycle(BaseTest):
|
46
|
|
- # def test_subjects_cycle(self):
|
47
|
|
- # shared.reset()
|
48
|
|
- # config = Config({'core': {'use_x_cores': 2}})
|
49
|
|
- # logger = SynergineLogger(name='test')
|
50
|
|
- #
|
51
|
|
- # simulation = Simulation(config)
|
52
|
|
- # subjects = MySubjects(simulation=simulation)
|
53
|
|
- # simulation.subjects = subjects
|
54
|
|
- #
|
55
|
|
- # # Prepare simulation class index
|
56
|
|
- # simulation.add_to_index(MySubjectBehavior)
|
57
|
|
- # simulation.add_to_index(MySubjectMechanism)
|
58
|
|
- # simulation.add_to_index(MySubject)
|
59
|
|
- #
|
60
|
|
- # for i in range(3):
|
61
|
|
- # subjects.append(MySubject(config, simulation=simulation))
|
62
|
|
- #
|
63
|
|
- # cycle_manager = CycleManager(
|
64
|
|
- # config=config,
|
65
|
|
- # logger=logger,
|
66
|
|
- # simulation=simulation,
|
67
|
|
- # )
|
68
|
|
- #
|
69
|
|
- # events = cycle_manager.next()
|
70
|
|
- # cycle_manager.stop()
|
71
|
|
- #
|
72
|
|
- # assert 3 == len(events)
|
73
|
|
- # event_values = [e.value for e in events]
|
74
|
|
- # assert all([s.id * 2 in event_values for s in subjects])
|
|
46
|
+ def test_subjects_cycle(self):
|
|
47
|
+ shared.reset()
|
|
48
|
+ config = Config({'core': {'use_x_cores': 2}})
|
|
49
|
+ logger = SynergineLogger(name='test')
|
|
50
|
+
|
|
51
|
+ simulation = Simulation(config)
|
|
52
|
+ subjects = MySubjects(simulation=simulation)
|
|
53
|
+ simulation.subjects = subjects
|
|
54
|
+
|
|
55
|
+ # Prepare simulation class index
|
|
56
|
+ simulation.add_to_index(MySubjectBehavior)
|
|
57
|
+ simulation.add_to_index(MySubjectMechanism)
|
|
58
|
+ simulation.add_to_index(MySubject)
|
|
59
|
+
|
|
60
|
+ for i in range(3):
|
|
61
|
+ subjects.append(MySubject(config, simulation=simulation))
|
|
62
|
+
|
|
63
|
+ cycle_manager = CycleManager(
|
|
64
|
+ config=config,
|
|
65
|
+ logger=logger,
|
|
66
|
+ simulation=simulation,
|
|
67
|
+ )
|
|
68
|
+
|
|
69
|
+ events = cycle_manager.next()
|
|
70
|
+ cycle_manager.stop()
|
|
71
|
+
|
|
72
|
+ assert 3 == len(events)
|
|
73
|
+ event_values = [e.value for e in events]
|
|
74
|
+ assert all([s.id * 2 in event_values for s in subjects])
|
75
|
75
|
|
76
|
76
|
def test_new_subject(self):
|
77
|
77
|
shared.reset()
|