Mercurial > lbo > hg > time_test
view example/src/example.rs @ 2:c21d8b7b61cb
Feature: Name timers to allow for several timers per case.
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 02 Sep 2017 19:52:31 +0200 |
parents | 95fcaa3adf3b |
children |
line wrap: on
line source
#[cfg(test)] mod tests { #[test] fn my_test() { time_test!(); assert!(true); assert_eq!(1, 1); } #[test] fn my_test_with_initialization() { // Do possibly expensive preparation before. let a = 1; let b = 2; time_test!(); assert!(true); assert_eq!(1, 1); } #[test] fn my_test_with_multiple_timers() { time_test!(); { time_test!("all"); { // sub-test 1 time_test!("sub1"); assert_eq!(1, 1); } { // sub-test 2 time_test!("sub2"); assert!(true); } } // The order of timers will be sub1, sub2, all, <unnamed>. } }