Skip to content

Commit

Permalink
Merge 41ea53f into b16268e
Browse files Browse the repository at this point in the history
  • Loading branch information
xnuter committed Mar 27, 2023
2 parents b16268e + 41ea53f commit 0812b3a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "perf-gauge"
version = "0.1.19"
version = "0.1.20"
authors = ["Eugene Retunsky"]
license = "MIT OR Apache-2.0"
edition = "2021"
Expand Down
29 changes: 29 additions & 0 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,32 @@ impl fmt::Display for BenchmarkMode {
}
}
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn test_generate_random_vec() {
let random_data = BenchmarkConfig::generate_random_vec("100");
assert_eq!(random_data.len(), 100);
}

#[test]
fn test_read_file_as_vec() {
let random_data = BenchmarkConfig::read_file_as_vec("Cargo.toml");
assert!(!random_data.is_empty());
}

#[test]
#[should_panic]
fn test_read_file_as_vec_panic() {
BenchmarkConfig::read_file_as_vec("not_existing_file");
}

#[test]
#[should_panic]
fn test_generate_random_vec_panic() {
BenchmarkConfig::generate_random_vec("not_a_number");
}
}

0 comments on commit 0812b3a

Please sign in to comment.