use gemma::chip8::sound_timer::SoundTimer; /// Tests for The Sound Timer /// /// #[test] fn sound_timer_default() { let x = SoundTimer::default(); assert_eq!(x.current(), 0); } #[test] fn sound_timer_ticks_reduce_time() { let mut st = SoundTimer::new(); st.set_timer(100); st.tick(); st.tick(); st.tick(); assert_eq!(st.current(), 97); } #[test] fn sound_timer_out_of_ticks_works() { let mut st = SoundTimer::new(); st.set_timer(0); st.tick(); st.tick(); st.tick(); assert_eq!(st.current(), 0); }