#![deny(clippy::all, clippy::pedantic, clippy::nursery, clippy::perf)]
pub mod macros;
pub mod prelude;
#[must_use]
pub const fn not(a: bool) -> bool {
!a
}
#[must_use]
pub const fn and(a: bool, b: bool) -> bool {
a && b
}
#[must_use]
pub const fn or(a: bool, b: bool) -> bool {
a || b
}
#[must_use]
pub const fn xor(a: bool, b: bool) -> bool {
a ^ b
}
#[must_use]
pub const fn imply(a: bool, b: bool) -> bool {
!a || b
}
#[must_use]
pub const fn iff(a: bool, b: bool) -> bool {
imply(a, b) && imply(b, a)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_not() {
assert!(!not(true));
assert!(not(false));
}
#[test]
fn test_and() {
assert!(and(true, true));
assert!(!and(true, false));
assert!(!and(false, true));
assert!(!and(false, false));
}
#[test]
fn test_or() {
assert!(or(true, true));
assert!(or(true, false));
assert!(or(false, true));
assert!(!or(false, false));
}
#[test]
fn test_xor() {
assert!(!xor(true, true));
assert!(xor(true, false));
assert!(xor(false, true));
assert!(!xor(false, false));
}
#[test]
fn test_imply() {
assert!(imply(true, true));
assert!(!imply(true, false));
assert!(imply(false, true));
assert!(imply(false, false));
}
#[test]
fn test_iff() {
assert!(iff(true, true));
assert!(!iff(true, false));
assert!(!iff(false, true));
assert!(iff(false, false));
}
}