diff options
author | Aria <me@aria.rip> | 2023-11-30 17:49:04 +0000 |
---|---|---|
committer | Aria <me@aria.rip> | 2023-11-30 17:49:04 +0000 |
commit | 947da9820855181fc07dc06fe14416a046225487 (patch) | |
tree | 6b808055ee933c5109976ced10281ba8a1f01772 /src/tests | |
parent | e1a0a2f4f0d1ed88335dac157944d9460fc441de (diff) |
test: add benchmark for example_stack (for testing)
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/example_stack/Cargo.toml | 6 | ||||
-rw-r--r-- | src/tests/example_stack/benches/do_stuff.rs | 6 | ||||
-rw-r--r-- | src/tests/example_stack/src/lib.rs (renamed from src/tests/example_stack/src/main.rs) | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/tests/example_stack/Cargo.toml b/src/tests/example_stack/Cargo.toml index 9827bef..3e3e617 100644 --- a/src/tests/example_stack/Cargo.toml +++ b/src/tests/example_stack/Cargo.toml @@ -6,4 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -primrose-library = { path = "../../crates/library" }
\ No newline at end of file +primrose-library = { path = "../../crates/library" } + +[[bench]] +name = "do_stuff" +harness = false
\ No newline at end of file diff --git a/src/tests/example_stack/benches/do_stuff.rs b/src/tests/example_stack/benches/do_stuff.rs new file mode 100644 index 0000000..69d50d5 --- /dev/null +++ b/src/tests/example_stack/benches/do_stuff.rs @@ -0,0 +1,6 @@ +fn main() { + // TODO: some actual benchmarking, not just a random loop + for _ in 0..20 { + example_stack::do_something(); + } +} diff --git a/src/tests/example_stack/src/main.rs b/src/tests/example_stack/src/lib.rs index d36e683..d8e95f3 100644 --- a/src/tests/example_stack/src/main.rs +++ b/src/tests/example_stack/src/lib.rs @@ -1,7 +1,7 @@ mod types; use types::*; -fn main() { +pub fn do_something() { let mut c = StackCon::<u32>::default(); for x in 0..10 { c.insert(x); |