Skip to content

Commit

Permalink
Added a test to assert that every solution has an assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Mar 23, 2024
1 parent d1807ef commit 09e819c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/solutions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,16 @@ pub mod totient_maximum;
pub mod triangular_pentagonal_and_hexagonal;
pub mod truncatable_primes;
pub mod xor_decryption;

#[cfg(test)]
mod tests {
#[test]
fn all_solutions_assertions() {
// Every solution should assert the equality of the expected and
// observed answers.
for dirent in std::fs::read_dir("src/solutions").unwrap() {
let code = std::fs::read_to_string(dirent.unwrap().path()).unwrap();
assert!(code.contains("assert_eq!"));
}
}
}

0 comments on commit 09e819c

Please sign in to comment.