aboutsummaryrefslogtreecommitdiff
path: root/2023
diff options
context:
space:
mode:
authorMatias Linares <matias@deprecated.org>2023-12-03 15:12:32 -0300
committerMatias Linares <matias@deprecated.org>2023-12-03 15:12:32 -0300
commit815a5cc136665f79ccab88e25a12242867f1d235 (patch)
tree700e46112d5c01b1d18b85be86e21ecfd1988d3d /2023
parentd073dcaa66567e58d6f9a36b15c9e54b91ed8c54 (diff)
downloadadvent-of-code-815a5cc136665f79ccab88e25a12242867f1d235.tar.gz
Move tests
Diffstat (limited to '2023')
-rw-r--r--2023/day-01/src/bin/part2.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/2023/day-01/src/bin/part2.rs b/2023/day-01/src/bin/part2.rs
index 5185b76..99f8748 100644
--- a/2023/day-01/src/bin/part2.rs
+++ b/2023/day-01/src/bin/part2.rs
@@ -19,18 +19,6 @@ fn find_min<'a>(matches: &[(usize, &'a str)]) -> (usize, &'a str) {
(*position, word)
}
-#[test]
-fn test_find_min_1() {
- let input = vec!((1, "eight"), (2, "eight"), (3, "2"));
- assert_eq!(find_min(&input), (1, "eight"));
-}
-
-#[test]
-fn test_find_min_2() {
- let input = vec!((4, "eight"), (5, "eight"), (3, "2"));
- assert_eq!(find_min(&input), (3, "2"));
-}
-
fn find_max<'a>(matches: &[(usize, &'a str)]) -> (usize, &'a str) {
let (position, word) = matches.iter().min_by(|(x,_), (y, _)| {
y.cmp(x)
@@ -58,6 +46,19 @@ fn process_line(s: &str) -> i32 {
(mapping[min_number] * 10) + mapping[max_number]
}
+
+#[test]
+fn test_find_min_1() {
+ let input = vec!((1, "eight"), (2, "eight"), (3, "2"));
+ assert_eq!(find_min(&input), (1, "eight"));
+}
+
+#[test]
+fn test_find_min_2() {
+ let input = vec!((4, "eight"), (5, "eight"), (3, "2"));
+ assert_eq!(find_min(&input), (3, "2"));
+}
+
#[test]
fn simple_input() {
let string = "onetwo";