-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatter_server_test.py
88 lines (77 loc) · 2.88 KB
/
matter_server_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import unittest
from scoping_simulations.utils.blockworld import Blockworld
from scoping_simulations.utils.blockworld_library import (
bl_nonoverlapping_simple,
bl_nonoverlapping_simple_named,
)
blsn = bl_nonoverlapping_simple_named
class TestMatterServer(unittest.TestCase):
# def test_empty(self):
# server = ms.Physics_Server()
# self.assertTrue(server.get_stability([]))
# def test_stonehenge(self):
# world = Blockworld(block_library=bl_nonoverlapping_simple)
# # actions are baseblocks with an x coordinate as a tuple
# stonehenge = [
# (blsn['h2'], 1),
# (blsn['h2'], 3),
# (blsn['v3'], 1),
# ]
# for action in stonehenge:
# world.apply_action(action)
# self.assertTrue(world.stability())
# def test_bad_stonehenge(self):
# world = Blockworld(block_library=bl_nonoverlapping_simple)
# # actions are baseblocks with an x coordinate as a tuple
# stonehenge = [
# (blsn['v2'], 1),
# (blsn['h3'], 1),
# (blsn['v2'], 3),
# ]
# stables = []
# for action in stonehenge:
# world.apply_action(action)
# stables.append(world.stability())
# print(stables)
# self.assertTrue(False in stables)
# self.assertEqual(stables, [True, False, False])
# def test_single_overlap(self):
# world = Blockworld(block_library=bl_nonoverlapping_simple)
# # actions are baseblocks with an x coordinate as a tuple
# actions = [
# (blsn['v2'], 1),
# (blsn['h2'], 1),
# ]
# for action in actions:
# world.apply_action(action)
# self.assertFalse(world.stability())
# def test_single_overlap_other_side(self):
# world = Blockworld(block_library=bl_nonoverlapping_simple)
# # actions are baseblocks with an x coordinate as a tuple
# actions = [
# (blsn['v2'], 2),
# (blsn['h2'], 1),
# ]
# for action in actions:
# world.apply_action(action)
# self.assertFalse(world.stability())
def test_13_47(self):
# this is one of the worlds listed as stable in the subgoal node, but should not be (as the intermediate states are instable).
world = Blockworld(block_library=bl_nonoverlapping_simple)
# actions are baseblocks with an x coordinate as a tuple
actions = [
(blsn["h3"], 1),
(blsn["v2"], 1),
(blsn["h2"], 2),
(blsn["h2"], 3),
(blsn["v3"], 4),
(blsn["h3"], 1),
]
stables = []
for action in actions:
world.apply_action(action)
stables.append(world.stability())
print(stables)
self.assertTrue(False in stables)
if __name__ == "__main__":
unittest.main()