/ timer / src / tests.rs
tests.rs
 1  // Copyright (c) 2025 ADnet Contributors
 2  // This file is part of the alpha-std library.
 3  
 4  // Licensed under the Apache License, Version 2.0 (the "License");
 5  // you may not use this file except in compliance with the License.
 6  // You may obtain a copy of the License at:
 7  
 8  // http://www.apache.org/licenses/LICENSE-2.0
 9  
10  // Unless required by applicable law or agreed to in writing, software
11  // distributed under the License is distributed on an "AS IS" BASIS,
12  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  // See the License for the specific language governing permissions and
14  // limitations under the License.
15  
16  use super::*;
17  
18  #[test]
19  fn test_timer_finish() {
20      let timer = timer!("Hello");
21      finish!(timer);
22  }
23  
24  #[test]
25  fn test_timer_lap_finish() {
26      let timer = timer!("Hello");
27      lap!(timer);
28      finish!(timer);
29  }
30  
31  #[test]
32  fn test_timer_timer_finish_finish() {
33      let hello = timer!("Hello");
34      let world = timer!("World");
35      finish!(world);
36      finish!(hello);
37  }
38  
39  #[test]
40  fn test_timer_timer_lap_finish_finish() {
41      let hello = timer!("Hello World");
42      let world = timer!("Testing");
43      lap!(hello);
44      finish!(world);
45      finish!(hello);
46  }