Skip to content

Commit

Permalink
Add two extra tests cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpallant committed Oct 8, 2024
1 parent f3f01dd commit 3703e57
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
16 changes: 16 additions & 0 deletions exercise-book/src/green-yellow-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ fn a_bit_of_everything() {
"🟩⬜🟨🟨"
);
}

#[test]
fn two_in_guess_one_in_secret() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 3], &[3, 9, 9, 9]),
"⬜⬜🟨⬜"
);
}

#[test]
fn two_in_secret_one_in_guess() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 4], &[3, 3, 9, 9]),
"⬜⬜🟨⬜"
);
}
```

## Knowledge
Expand Down
16 changes: 16 additions & 0 deletions exercise-solutions/green-yellow/src/bin/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,19 @@ fn a_bit_of_everything() {
"🟩⬜🟨🟨"
);
}

#[test]
fn two_in_guess_one_in_secret() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 3], &[3, 9, 9, 9]),
"⬜⬜🟨⬜"
);
}

#[test]
fn two_in_secret_one_in_guess() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 4], &[3, 3, 9, 9]),
"⬜⬜🟨⬜"
);
}
16 changes: 16 additions & 0 deletions exercise-solutions/green-yellow/src/bin/step4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,19 @@ fn a_bit_of_everything() {
"🟩⬜🟨🟨"
);
}

#[test]
fn two_in_guess_one_in_secret() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 3], &[3, 9, 9, 9]),
"⬜⬜🟨⬜"
);
}

#[test]
fn two_in_secret_one_in_guess() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 4], &[3, 3, 9, 9]),
"⬜⬜🟨⬜"
);
}
16 changes: 16 additions & 0 deletions exercise-solutions/green-yellow/src/bin/step5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,19 @@ fn a_bit_of_everything() {
"🟩⬜🟨🟨"
);
}

#[test]
fn two_in_guess_one_in_secret() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 3], &[3, 9, 9, 9]),
"⬜⬜🟨⬜"
);
}

#[test]
fn two_in_secret_one_in_guess() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 4], &[3, 3, 9, 9]),
"⬜⬜🟨⬜"
);
}
16 changes: 16 additions & 0 deletions exercise-solutions/green-yellow/src/bin/step6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,19 @@ fn a_bit_of_everything() {
"🟩⬜🟨🟨"
);
}

#[test]
fn two_in_guess_one_in_secret() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 3], &[3, 9, 9, 9]),
"⬜⬜🟨⬜"
);
}

#[test]
fn two_in_secret_one_in_guess() {
assert_eq!(
&calc_green_and_yellow(&[1, 2, 3, 4], &[3, 3, 9, 9]),
"⬜⬜🟨⬜"
);
}

0 comments on commit 3703e57

Please sign in to comment.