use libttl::chips::{Chip, Chip7404, PinType};
use libttl::logic_level::LogicLevel;
mod chip_tests_common;
use chip_tests_common::*;
use std::ops::Not;
#[test]
fn test_7404_pin_types() {
let chip = Chip7404::new();
let expected = [
(1, PinType::Input), (2, PinType::Output), (3, PinType::Input),
(4, PinType::Output), (5, PinType::Input), (6, PinType::Output),
(8, PinType::Output), (9, PinType::Input), (10, PinType::Output),
(11, PinType::Input), (12, PinType::Output), (13, PinType::Input),
];
test_pin_types(&chip, &expected);
assert_eq!(chip.pin_count(), 14);
assert_eq!(chip.name(), "7404");
}
#[test]
fn test_7404_logic() {
let mut chip = Chip7404::new();
let not_logic = |l: LogicLevel| l.not();
test_logic_1_input_1_output(&mut chip, 1, 2, not_logic);
test_logic_1_input_1_output(&mut chip, 3, 4, not_logic);
test_logic_1_input_1_output(&mut chip, 5, 6, not_logic);
test_logic_1_input_1_output(&mut chip, 9, 8, not_logic);
test_logic_1_input_1_output(&mut chip, 11, 10, not_logic);
test_logic_1_input_1_output(&mut chip, 13, 12, not_logic);
}