Skip to content

Commit

Permalink
tests taken from master's values
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Apr 5, 2024
1 parent 79c5e3c commit fd88e51
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions unittests/test_virtual_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,59 @@ def test_version_5_8_by_8(self):
expected.append((('127.0.0.0', 0), sp))
expected.append((((0, 0), 0), sp))
self.assertEqual(expected, spinnaker_links)
# 8 links on each of the 6 sides recorded 3 times
# Except for the Ethernet Chip's 3 links which are only recorded twice
expected_fpgas = 8 * 6 * 3 - 3
self.assertEqual(expected_fpgas, len(vm._fpga_links))
keys = set([('127.0.0.0', 0, 0), ((7, 3), 0, 0), ((0, 0), 0, 0),
('127.0.0.0', 0, 1), ((7, 3), 0, 1), ((0, 0), 0, 1),
('127.0.0.0', 0, 2), ((6, 2), 0, 2), ((0, 0), 0, 2),
('127.0.0.0', 0, 3), ((6, 2), 0, 3), ((0, 0), 0, 3),
('127.0.0.0', 0, 4), ((5, 1), 0, 4), ((0, 0), 0, 4),
('127.0.0.0', 0, 5), ((5, 1), 0, 5), ((0, 0), 0, 5),
('127.0.0.0', 0, 6), ((4, 0), 0, 6), ((0, 0), 0, 6),
('127.0.0.0', 0, 7), ((4, 0), 0, 7), ((0, 0), 0, 7),
('127.0.0.0', 0, 8), ((4, 0), 0, 8), ((0, 0), 0, 8),
('127.0.0.0', 0, 9), ((3, 0), 0, 9), ((0, 0), 0, 9),
('127.0.0.0', 0, 10), ((3, 0), 0, 10), ((0, 0), 0, 10),
('127.0.0.0', 0, 11), ((2, 0), 0, 11), ((0, 0), 0, 11),
('127.0.0.0', 0, 12), ((2, 0), 0, 12), ((0, 0), 0, 12),
('127.0.0.0', 0, 13), ((1, 0), 0, 13), ((0, 0), 0, 13),
('127.0.0.0', 0, 14), ((1, 0), 0, 14), ((0, 0), 0, 14),
('127.0.0.0', 0, 15), ((0, 0), 0, 15),
('127.0.0.0', 1, 0), ((0, 0), 1, 0),
('127.0.0.0', 1, 1), ((0, 0), 1, 1),
('127.0.0.0', 1, 2), ((0, 1), 1, 2), ((0, 0), 1, 2),
('127.0.0.0', 1, 3), ((0, 1), 1, 3), ((0, 0), 1, 3),
('127.0.0.0', 1, 4), ((0, 2), 1, 4), ((0, 0), 1, 4),
('127.0.0.0', 1, 5), ((0, 2), 1, 5), ((0, 0), 1, 5),
('127.0.0.0', 1, 6), ((0, 3), 1, 6), ((0, 0), 1, 6),
('127.0.0.0', 1, 7), ((0, 3), 1, 7), ((0, 0), 1, 7),
('127.0.0.0', 1, 8), ((0, 3), 1, 8), ((0, 0), 1, 8),
('127.0.0.0', 1, 9), ((1, 4), 1, 9), ((0, 0), 1, 9),
('127.0.0.0', 1, 10), ((1, 4), 1, 10), ((0, 0), 1, 10),
('127.0.0.0', 1, 11), ((2, 5), 1, 11), ((0, 0), 1, 11),
('127.0.0.0', 1, 12), ((2, 5), 1, 12), ((0, 0), 1, 12),
('127.0.0.0', 1, 13), ((3, 6), 1, 13), ((0, 0), 1, 13),
('127.0.0.0', 1, 14), ((3, 6), 1, 14), ((0, 0), 1, 14),
('127.0.0.0', 1, 15), ((4, 7), 1, 15), ((0, 0), 1, 15),
('127.0.0.0', 2, 0), ((4, 7), 2, 0), ((0, 0), 2, 0),
('127.0.0.0', 2, 1), ((4, 7), 2, 1), ((0, 0), 2, 1),
('127.0.0.0', 2, 2), ((5, 7), 2, 2), ((0, 0), 2, 2),
('127.0.0.0', 2, 3), ((5, 7), 2, 3), ((0, 0), 2, 3),
('127.0.0.0', 2, 4), ((6, 7), 2, 4), ((0, 0), 2, 4),
('127.0.0.0', 2, 5), ((6, 7), 2, 5), ((0, 0), 2, 5),
('127.0.0.0', 2, 6), ((7, 7), 2, 6), ((0, 0), 2, 6),
('127.0.0.0', 2, 7), ((7, 7), 2, 7), ((0, 0), 2, 7),
('127.0.0.0', 2, 8), ((7, 7), 2, 8), ((0, 0), 2, 8),
('127.0.0.0', 2, 9), ((7, 6), 2, 9), ((0, 0), 2, 9),
('127.0.0.0', 2, 10), ((7, 6), 2, 10), ((0, 0), 2, 10),
('127.0.0.0', 2, 11), ((7, 5), 2, 11), ((0, 0), 2, 11),
('127.0.0.0', 2, 12), ((7, 5), 2, 12), ((0, 0), 2, 12),
('127.0.0.0', 2, 13), ((7, 4), 2, 13), ((0, 0), 2, 13),
('127.0.0.0', 2, 14), ((7, 4), 2, 14), ((0, 0), 2, 14),
('127.0.0.0', 2, 15), ((7, 3), 2, 15), ((0, 0), 2, 15)])
self.assertEqual(keys, set(vm._fpga_links.keys()))

def test_version_5_12_by_12(self):
set_config("Machine", "version", 5)
Expand All @@ -160,6 +213,10 @@ def test_version_5_12_by_12(self):
spinnaker_links = (list(vm.spinnaker_links))
expected = []
self.assertEqual(expected, spinnaker_links)
# 8 links on each of the 6 sides recorded 3 times
# Except for the Ethernet Chip's 3 links which are only recorded twice
expected_fpgas = (8 * 6 * 3 - 3) * 3
self.assertEqual(expected_fpgas, len(vm._fpga_links))

def test_version_5_16_by_16(self):
set_config("Machine", "version", 5)
Expand All @@ -182,6 +239,10 @@ def test_version_5_16_by_16(self):
expected.append((('127.0.4.8', 0), sp))
expected.append((((4, 8), 0), sp))
self.assertEqual(expected, spinnaker_links)
# 8 links on each of the 6 sides recorded 3 times
# Except for the Ethernet Chip's 3 links which are only recorded twice
expected_fpgas = (8 * 6 * 3 - 3) * 3
self.assertEqual(expected_fpgas, len(vm._fpga_links))

def test_version_5_hole(self):
set_config("Machine", "version", 5)
Expand Down

0 comments on commit fd88e51

Please sign in to comment.