pub fn apply_and(left: bool, right: bool) -> bool {
left && right
}
pub fn apply_or(left: bool, right: bool) -> bool {
left || right
}
pub fn apply_not(value: bool) -> bool {
!value
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn and_truth_table() {
assert!(!apply_and(false, false));
assert!(!apply_and(false, true));
assert!(!apply_and(true, false));
assert!(apply_and(true, true));
}
#[test]
fn or_truth_table() {
assert!(!apply_or(false, false));
assert!(apply_or(false, true));
assert!(apply_or(true, false));
assert!(apply_or(true, true));
}
#[test]
fn not_inverts() {
assert!(apply_not(false));
assert!(!apply_not(true));
}
}