feat: remove tests from .gitignore
This commit is contained in:
parent
00000070cd
commit
000000809c
|
@ -13,6 +13,3 @@ target/
|
||||||
# downloaded inputs
|
# downloaded inputs
|
||||||
/src/inputs/*
|
/src/inputs/*
|
||||||
!/src/inputs/.keep
|
!/src/inputs/.keep
|
||||||
|
|
||||||
/src/test_inputs/*
|
|
||||||
!/src/test_inputs/.keep
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
pub fn part_one(input: &str) -> Option<u32> {
|
pub fn part_one(input: &str) -> Option<u32> {
|
||||||
let count = input.matches('(').count() - input.matches(')').count();
|
let count = input.matches('(').count() - input.matches(')').count();
|
||||||
Some(count.try_into().unwrap())
|
Some(count as u32)
|
||||||
}
|
}
|
||||||
pub fn part_two(input: &str) -> Option<u32> {
|
pub fn part_two(input: &str) -> Option<u32> {
|
||||||
let mut floor = 0;
|
let mut floor = 0;
|
||||||
for (idx, char) in input.chars().enumerate() {
|
for (idx, c) in input.trim().chars().enumerate() {
|
||||||
match char {
|
match c {
|
||||||
'(' => floor += 1,
|
'(' => floor += 1,
|
||||||
')' => floor -= 1,
|
')' => floor -= 1,
|
||||||
_ => panic!("oops"),
|
_ => panic!("oops {}", c),
|
||||||
};
|
};
|
||||||
|
|
||||||
if floor < 0 {
|
if floor < 0 {
|
||||||
|
@ -27,14 +27,12 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_one() {
|
fn test_part_one() {
|
||||||
// let input = aoc::read_file("test_inputs", 1);
|
let input = aoc::read_file("test_inputs", 1);
|
||||||
let input = "(()(()(";
|
|
||||||
assert_eq!(part_one(&input), Some(3));
|
assert_eq!(part_one(&input), Some(3));
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_two() {
|
fn test_part_two() {
|
||||||
// let input = aoc::read_file("test_inputs", 1);
|
let input = aoc::read_file("test_inputs", 1);
|
||||||
let input = "()())";
|
assert_eq!(part_two(&input), Some(11));
|
||||||
assert_eq!(part_two(&input), Some(5));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,12 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_one() {
|
fn test_part_one() {
|
||||||
// let input = aoc::read_file("test_inputs", 2);
|
let input = aoc::read_file("test_inputs", 2);
|
||||||
let input = "2x3x4";
|
|
||||||
assert_eq!(part_one(&input), Some(58));
|
assert_eq!(part_one(&input), Some(58));
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_two() {
|
fn test_part_two() {
|
||||||
// let input = aoc::read_file("test_inputs", 2);
|
let input = aoc::read_file("test_inputs", 2);
|
||||||
let input = "2x3x4";
|
|
||||||
assert_eq!(part_two(&input), Some(34));
|
assert_eq!(part_two(&input), Some(34));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,12 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_one() {
|
fn test_part_one() {
|
||||||
// let input = aoc::read_file("test_inputs", 3);
|
let input = aoc::read_file("test_inputs", 3);
|
||||||
let input = "^v^v^v^v^v";
|
|
||||||
assert_eq!(part_one(&input), Some(2));
|
assert_eq!(part_one(&input), Some(2));
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_two() {
|
fn test_part_two() {
|
||||||
// let input = aoc::read_file("test_inputs", 3);
|
let input = aoc::read_file("test_inputs", 3);
|
||||||
let input = "^v^v^v^v^v";
|
|
||||||
assert_eq!(part_two(&input), Some(11));
|
assert_eq!(part_two(&input), Some(11));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,14 +44,12 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_one() {
|
fn test_part_one() {
|
||||||
// let input = aoc::read_file("test_inputs", 4);
|
let input = aoc::read_file("test_inputs", 4);
|
||||||
let input = "abcdef";
|
|
||||||
assert_eq!(part_one(&input), Some(609043));
|
assert_eq!(part_one(&input), Some(609043));
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_two() {
|
fn test_part_two() {
|
||||||
// let input = aoc::read_file("test_inputs", 4);
|
let input = aoc::read_file("test_inputs", 4);
|
||||||
// let input = "abcdef";
|
assert_eq!(part_two(&input), Some(6742839));
|
||||||
// assert_eq!(part_two(&input), None);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,15 +64,12 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_one() {
|
fn test_part_one() {
|
||||||
// let input = aoc::read_file("test_inputs", 5);
|
let input = aoc::read_file("test_inputs", 5);
|
||||||
let input = "aaa";
|
|
||||||
assert_eq!(part_one(&input), Some(1));
|
assert_eq!(part_one(&input), Some(1));
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_part_two() {
|
fn test_part_two() {
|
||||||
// let input = aoc::read_file("test_inputs", 5);
|
let input = aoc::read_file("test_inputs", 5);
|
||||||
let input =
|
|
||||||
"qjhvhtzxzqqjkmpb\nxxyxx\nuurcxstgmygtbstg\nieodomkazucvgmuy\naaa";
|
|
||||||
assert_eq!(part_two(&input), Some(2));
|
assert_eq!(part_two(&input), Some(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
(()(()())))((((
|
|
@ -0,0 +1 @@
|
||||||
|
2x3x4
|
|
@ -0,0 +1 @@
|
||||||
|
^v^v^v^v^v
|
|
@ -0,0 +1 @@
|
||||||
|
abcdef
|
|
@ -0,0 +1,5 @@
|
||||||
|
qjhvhtzxzqqjkmpb
|
||||||
|
xxyxx
|
||||||
|
uurcxstgmygtbstg
|
||||||
|
ieodomkazucvgmuy
|
||||||
|
aaa
|
Loading…
Reference in New Issue