Skip to content

Commit

Permalink
#42 Dirty but works. Need more unit tests and lot refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
la10736 committed Oct 20, 2019
1 parent 402d7d4 commit c736acc
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 100 deletions.
24 changes: 24 additions & 0 deletions resources/rstest/happy_path.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use rstest::*;

#[fixture]
fn inject() -> u32 { 0 }

#[fixture]
fn ex() -> u32 { 42 }

#[fixture]
fn fix(inject: u32, ex: u32) -> bool { (inject * 2) == ex }

#[rstest(
fix(21),
a, b,
case(21, 2),
case::second(14, 3),
expected => [4, 2*3-2],
input => ["ciao", "buzz"],
)]
fn happy(fix: bool, a: u32, b: u32, expected: usize, input: &str) {
assert!(fix);
assert_eq!(a*b, 42);
assert_eq!(expected, input.len());
}
Loading

0 comments on commit c736acc

Please sign in to comment.