werewolves/werewolves-proto/src/game_test/time.rs

49 lines
1.5 KiB
Rust
Raw Normal View History

2026-02-02 00:37:37 +00:00
// Copyright (C) 2026 Emilis Bliūdžius
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use core::{cmp::Ordering, num::NonZeroU8};
#[allow(unused)]
use pretty_assertions::{assert_eq, assert_ne, assert_str_eq};
use crate::game::GameTime;
#[test]
pub fn game_time_test() {
for (l, r, exp) in &[
(
GameTime::Day {
number: NonZeroU8::new(1).unwrap(),
},
GameTime::Night { number: 0 },
Ordering::Greater,
),
(
GameTime::Night { number: 1 },
GameTime::Day {
number: NonZeroU8::new(1).unwrap(),
},
Ordering::Greater,
),
(
GameTime::Night { number: 0 },
GameTime::Day {
number: NonZeroU8::new(1).unwrap(),
},
Ordering::Less,
),
] {
assert_eq!(l.cmp(r), *exp);
}
}