brainvision 0.0.1

Rust library and TUI for Brain Products BrainVision RDA EEG streams over TCP/IP
Documentation
use brainvision::types::*;

#[test]
fn test_ports() {
    assert_eq!(RDA_PORT_I16, 51244);
    assert_eq!(RDA_PORT_F32, 51234);
}

#[test]
fn test_envelope_len() {
    assert_eq!(ENVELOPE_LEN, 20);
}

#[test]
fn test_guids_len() {
    assert_eq!(GUID_START.len(), 16);
    assert_eq!(GUID_DATA16.len(), 16);
    assert_eq!(GUID_DATA32.len(), 16);
    assert_eq!(GUID_STOP.len(), 16);
}

#[test]
fn test_header_info_rate() {
    let h = HeaderInfo {
        channel_count: 8,
        sampling_interval_us: 2000.0,
        resolutions_uv: vec![0.1; 8],
        channel_names: vec![],
    };
    assert!((h.sampling_rate_hz() - 500.0).abs() < 1e-9);
}

#[test]
fn test_header_info_zero_rate() {
    let h = HeaderInfo::default();
    assert_eq!(h.sampling_rate_hz(), 0.0);
}

#[test]
fn test_marker_fields() {
    let m = Marker {
        position: 10,
        points: 5,
        channel: -1,
        kind: "Stimulus".into(),
        description: "S 11".into(),
    };
    assert_eq!(m.position, 10);
    assert_eq!(m.kind, "Stimulus");
}

#[test]
fn test_data_block_fields() {
    let d = DataBlock {
        block: 1,
        points: 2,
        samples_uv: vec![1.0, 2.0, 3.0, 4.0],
        markers: vec![],
    };
    assert_eq!(d.block, 1);
    assert_eq!(d.points, 2);
    assert_eq!(d.samples_uv.len(), 4);
}