Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 492 Bytes

Readme.md

File metadata and controls

21 lines (18 loc) · 492 Bytes

Resistor

resistor is a library for calculating the resistance of a resistor based on the color bands.

#[test]
fn test_red4() {
    let resistor = ResistorBuilder::FourBand {
        first: ResistorColor::Red,
        second: ResistorColor::Red,
        multiplier: ResistorColor::Red,
        tolerance: ResistorColor::Red,
    }
    .build()
    .unwrap();
    assert_eq!(resistor.resistance, 2200.0);
    assert_eq!(resistor.to_string(), "Resistor(2200Ω ± 2%)");
}