//! Exact-output parity against stored vectors.
//!
//! Each vector pins both directions: `compress(input)` must equal the stored
//! base-62 string, and `decompress` of that string must rebuild the input. This
//! proves wire-format parity, not just internal round-trip consistency.

mod common;

#[test]
fn golden_vectors_compress_exact() {
    for v in common::load_vectors() {
        let input = common::units_to_string(&v.input_units);
        assert_eq!(input.encode_utf16().count(), v.input_len, "len: {}", v.name);
        let got = lzbase62::compress(&input);
        assert_eq!(got, v.compressed, "compress mismatch: {}", v.name);
    }
}

#[test]
fn golden_vectors_decompress_roundtrip() {
    for v in common::load_vectors() {
        let input = common::units_to_string(&v.input_units);
        let back = lzbase62::decompress(&v.compressed);
        assert_eq!(back, input, "decompress mismatch: {}", v.name);
    }
}

#[test]
fn golden_vectors_streaming_matches_plain() {
    for v in common::load_vectors() {
        if v.input_units.is_empty() {
            continue;
        }
        let input = common::units_to_string(&v.input_units);
        let streamed = common::compress_streamed(&input);
        assert_eq!(streamed, v.compressed, "streamed compress: {}", v.name);
        let back = common::decompress_streamed(&streamed);
        assert_eq!(back, input, "streamed decompress: {}", v.name);
    }
}
