from scripts.cer_divergence import cer


def test_identical_text_is_zero():
    assert cer("hello world", "hello world") == 0.0


def test_single_substitution():
    # 1 edit over 5 reference chars
    assert cer("hello", "hallo") == 0.2


def test_empty_reference_with_output_is_one():
    assert cer("", "abc") == 1.0


def test_empty_both_is_zero():
    assert cer("", "") == 0.0
