-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from SpiNNakerManchester/same_chip_monster
rubbered
- Loading branch information
Showing
3 changed files
with
138 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
unittests/utilities_tests/test_placer_algorithm_utilities.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import unittest | ||
from pacman.utilities.algorithm_utilities.placer_algorithm_utilities import \ | ||
add_set | ||
|
||
|
||
class TestUtilities(unittest.TestCase): | ||
|
||
def test_add_join(self): | ||
all_sets = list() | ||
all_sets.append({1, 2}) | ||
all_sets.append({3, 4}) | ||
all_sets.append({5, 6}) | ||
new_set = {2, 4} | ||
add_set(all_sets, new_set) | ||
self.assertEqual(2, len(all_sets)) | ||
self.assertIn({1, 2, 3, 4}, all_sets) | ||
self.assertIn({5, 6}, all_sets) | ||
|
||
def test_add_one(self): | ||
all_sets = list() | ||
all_sets.append({1, 2}) | ||
all_sets.append({3, 4}) | ||
all_sets.append({5, 6}) | ||
new_set = {2, 7} | ||
add_set(all_sets, new_set) | ||
self.assertEqual(3, len(all_sets)) | ||
self.assertIn({1, 2, 7}, all_sets) | ||
self.assertIn({3, 4}, all_sets) | ||
self.assertIn({5, 6}, all_sets) | ||
|
||
def test_add_new(self): | ||
all_sets = list() | ||
all_sets.append({1, 2}) | ||
all_sets.append({3, 4}) | ||
all_sets.append({5, 6}) | ||
new_set = {8, 7} | ||
add_set(all_sets, new_set) | ||
self.assertEqual(4, len(all_sets)) | ||
self.assertIn({1, 2}, all_sets) | ||
self.assertIn({3, 4}, all_sets) | ||
self.assertIn({5, 6}, all_sets) | ||
self.assertIn({7, 8}, all_sets) |