Browse Source

Fix day 10 tests

Tyler Hallada 4 years ago
parent
commit
f615a47bb6
1 changed files with 14 additions and 5 deletions
  1. 14 5
      src/day10.rs

+ 14 - 5
src/day10.rs

@@ -172,30 +172,39 @@ mod tests {
172 172
 
173 173
     const TEST_INPUT_ONE: &str = "inputs/10_test_one.txt";
174 174
     const TEST_INPUT: &str = "inputs/10_test.txt";
175
-    const TEST_POINT: Point = Point {
175
+    const TEST_POINT_1: Point = Point {
176 176
         position: Vector { x: 0, y: 1 },
177 177
         velocity: Vector { x: 0, y: 0 },
178 178
     };
179
+    const TEST_POINT_2: Point = Point {
180
+        position: Vector { x: 0, y: 0 },
181
+        velocity: Vector { x: 0, y: 0 },
182
+    };
179 183
     fn test_sky() -> Sky {
180 184
         Sky {
181
-            points: vec![TEST_POINT],
185
+            points: vec![TEST_POINT_1, TEST_POINT_2],
182 186
         }
183 187
     }
184 188
 
185 189
     #[test]
186 190
     fn parses_string_to_point() {
187 191
         let point = "position=< 0,  1> velocity=< 0,  0>";
188
-        assert_eq!(point.parse::<Point>().unwrap(), TEST_POINT);
192
+        assert_eq!(point.parse::<Point>().unwrap(), TEST_POINT_1);
189 193
     }
190 194
 
191 195
     #[test]
192 196
     fn reads_points_file() {
193
-        assert_eq!(read_points_file(TEST_INPUT_ONE).unwrap(), test_sky());
197
+        assert_eq!(
198
+            read_points_file(TEST_INPUT_ONE).unwrap(),
199
+            Sky {
200
+                points: vec![TEST_POINT_1]
201
+            }
202
+        );
194 203
     }
195 204
 
196 205
     #[test]
197 206
     fn displays_sky_with_one_point() {
198
-        assert_eq!(format!("{}", test_sky()), ".\n#\n");
207
+        assert_eq!(format!("{}", test_sky()), "#\n#\n");
199 208
     }
200 209
 
201 210
     #[test]