libttl 0.1.1

A library for simulating TTL logic chips
Documentation
use libttl::chips::{Chip, Chip7432, PinType};
use libttl::logic_level::or;
mod chip_tests_common;
use chip_tests_common::*;


#[test]
fn test_7432_pin_types() {
    let chip = Chip7432::new();
     // Same pinout as 7400 for Input/Output
    let expected = [
        (1, PinType::Input), (2, PinType::Input), (3, PinType::Output),
        (4, PinType::Input), (5, PinType::Input), (6, PinType::Output),
        (8, PinType::Output), (9, PinType::Input), (10, PinType::Input),
        (11, PinType::Output), (12, PinType::Input), (13, PinType::Input),
    ];
    test_pin_types(&chip, &expected);
    assert_eq!(chip.pin_count(), 14);
     assert_eq!(chip.name(), "7432");
}

#[test]
fn test_7432_logic() {
    let mut chip = Chip7432::new();

    // Gate 1: Inputs 1, 2 -> Output 3
    test_logic_2_input_1_output(&mut chip, 1, 2, 3, or);

    // Gate 2: Inputs 4, 5 -> Output 6
    test_logic_2_input_1_output(&mut chip, 4, 5, 6, or);

    // Gate 3: Inputs 9, 10 -> Output 8
    test_logic_2_input_1_output(&mut chip, 9, 10, 8, or);

    // Gate 4: Inputs 12, 13 -> Output 11
    test_logic_2_input_1_output(&mut chip, 12, 13, 11, or);
}