diff --git a/src/one.rs b/src/one.rs index 8eaa076..1498a50 100644 --- a/src/one.rs +++ b/src/one.rs @@ -7,11 +7,21 @@ pub struct Args { } impl Problem for Args { - // We could derive it mathematically, ... or write a dump loop - fn solve(self, _: GlobalArgs) -> color_eyre::Result<()> { - let sum: u64 = (0..self.until).filter(|x| x % 3 == 0 || x % 5 == 0).sum(); - println!("Sum of 0..{}: {}", self.until, sum); + type Solution = u64; - Ok(()) + // We could derive it mathematically, ... or write a dump loop + fn solve(self, _: GlobalArgs) -> color_eyre::Result { + let sum = (0..self.until).filter(|x| x % 3 == 0 || x % 5 == 0).sum(); + + Ok(sum) } } + +#[cfg(test)] +#[test] +fn rsp() { + assert_eq!( + Args { until: 1000 }.solve(GlobalArgs::default()).unwrap(), + 233168 + ); +}