Testing

Running Tests

# Full suite
cargo test

# With printed output
cargo test -- --nocapture

# Single test
cargo test test_gdsii_round_trip

# By module
cargo test geometry
cargo test boolean_ops
cargo test flexpath
cargo test topology

# Doc tests only
cargo test --doc

Test Counts

SuiteTests
Unit tests (all modules)115
Integration tests41
Doc tests8
Total164

All 164 pass. Zero failures. Zero external dependencies.

Coverage by Module

ModuleTests
gdsii7
oasis11
converter3
geometry22
boolean_ops12
flexpath10
curve9
topology13
streaming8
aref_expansion6
properties4
format_detection6
Integration (cross-module)41
Doc tests8

Writing Tests

#![allow(unused)]
fn main() {
#[test]
fn test_my_feature() {
    let mut gds = GDSIIFile::new("TEST".to_string());
    gds.structures.push(GDSStructure {
        name: "CELL".to_string(),
        creation_time: GDSTime::now(),
        modification_time: GDSTime::now(),
        strclass: None,
        elements: Vec::new(),
    });
    assert_eq!(gds.structures.len(), 1);
}
}

For file I/O tests, clean up after yourself:

#![allow(unused)]
fn main() {
#[test]
fn test_round_trip() -> Result<(), Box<dyn std::error::Error>> {
    let path = "test_rt.gds";
    let gds = make_test_file();
    gds.write_to_file(path)?;
    let read = GDSIIFile::read_from_file(path)?;
    std::fs::remove_file(path)?;
    assert_eq!(gds.library_name, read.library_name);
    Ok(())
}
}