diff options
| author | Brad Clawsie <brad@b7j0c.org> | 2026-11-10 10:42:55 -0600 |
|---|---|---|
| committer | Brad Clawsie <brad@b7j0c.org> | 2026-11-10 10:42:55 -0600 |
| commit | d21e6d65ea0bc31fff33aea0e257074a4ca1f5ef (patch) | |
| tree | 4857202cbd470dae48f4e0933e3b1f8c9375e054 /ex6_10/src/main.rs | |
| parent | b5dbec1a97056d59875aeae9d6fbca556fa7fefe (diff) | |
feat: ex6_10
commit 58407b43c8e31c86da32518fb372d347eb0cd068
Author: Brad Clawsie <brad@b7j0c.org>
Date: Tue Nov 10 10:42:42 2026 -0600
feat: ex6_10
Diffstat (limited to 'ex6_10/src/main.rs')
| -rw-r--r-- | ex6_10/src/main.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ex6_10/src/main.rs b/ex6_10/src/main.rs new file mode 100644 index 0000000..3fdb5b7 --- /dev/null +++ b/ex6_10/src/main.rs @@ -0,0 +1,17 @@ +fn slice_sum(ns: &[u32]) -> u32 { + ns.iter().sum() +} + +fn main() { + println!("Hello, world!"); +} + +#[cfg(test)] +mod tests { + use crate::*; + + #[test] + fn t0() { + assert_eq!(slice_sum(vec![1,2,3].as_slice()), 6); + } +} |
