Browse Source

pheromones: add tests

Bastien Sevajol 9 years ago
parent
commit
24529755e2
1 changed files with 38 additions and 0 deletions
  1. 38 0
      intelligine/tests/simulation/pheromone/TestDirection.py

+ 38 - 0
intelligine/tests/simulation/pheromone/TestDirection.py View File

@@ -79,3 +79,41 @@ class TestDirection(Base):
79 79
 
80 80
         for direction_wanted in test_data:
81 81
             self._test_direction(test_data[direction_wanted], direction_wanted)
82
+
83
+    def test_with_multiple_same_intensity(self):
84
+        """
85
+        Test find route in middle of multiple pheromones
86
+        :return:
87
+        """
88
+        test_data = {
89
+            10: {
90
+                (0, 0, 0): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (10, 1)}},
91
+                (0, -1, -1): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (9, 1)}},
92
+                (0, 1, 1): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (12, 1)}}
93
+            },
94
+            10: {
95
+                (0, 0, 0): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (10, 1)}},
96
+                (0, -1, -1): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (9, 1)}},
97
+                (0, 1, 1): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (12, 1)}},
98
+                (0, 0, 1): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (12, 1)}}
99
+            },
100
+        }
101
+
102
+        for direction_wanted in test_data:
103
+            self._test_direction(test_data[direction_wanted], direction_wanted)
104
+
105
+    def test_with_multiple_different_intensity(self):
106
+        """
107
+        Test find route in middle of multiple pheromones
108
+        :return:
109
+        """
110
+        test_data = {
111
+            10: {
112
+                (0, 0, 0): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (10, 2)}},
113
+                (0, -1, -1): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (9, 2)}},
114
+                (0, 1, 1): {PHEROMON_DIRECTION: {PHEROMON_DIR_EXPLO: (8, 1)}}
115
+            }
116
+        }
117
+
118
+        for direction_wanted in test_data:
119
+            self._test_direction(test_data[direction_wanted], direction_wanted)