Cotton code
29 lines · 1.9 KB · RustRaw
use super::*;/// RULE (owner, 17 Nov 2026): Telugu speech is written in Latin letters for now, the one value in script/written.json; a consonant carries "a" unless a vowel sign or the virama follows, long vowels are doubled, the anusvara is "n" before a velar, palatal, retroflex or dental and "m" otherwise, and Telugu digits are 0-9.#[test]fn telugu_is_written_in_latin_letters() {    assert_eq!(script_of("te"), Script::Latin);    assert_eq!(script_of("hi"), Script::Native, "a language the file does not name keeps its own script");    assert_eq!(as_written("రేపు"), "repu");    assert_eq!(as_written("ఎల్లుండి"), "ellundi");    assert_eq!(as_written("ఈ రోజు"), "ee roju");    assert_eq!(as_written("సోమవారం"), "somavaaram");    assert_eq!(as_written("మంగళవారం"), "mangalavaaram");    assert_eq!(as_written("శుక్రవారం"), "shukravaaram");    assert_eq!(as_written("సంబంధం"), "sambandham");    assert_eq!(as_written("చేద్దాం"), "cheddaam");    assert_eq!(as_written("నాకు ఐదు నిమిషాలు కావాలి"), "naaku aidu nimishaalu kaavaali");    assert_eq!(as_written("౨౫ తారీఖు"), "25 taareekhu");}/// RULE (owner, 17 Nov 2026): Only Telugu letters change: English, Hindi and marks pass through, Latin text is left as it is, and writing twice reads the same as once.#[test]fn writing_leaves_everything_else_and_twice_is_once() {    let mixed = "OK, so the vendor రేపు call చేస్తాడు, कल तक.";    let once = as_written(mixed);    assert_eq!(once, "OK, so the vendor repu call chestaadu, कल तक.");    assert_eq!(as_written(&once), once);    assert_eq!(as_written("plain English\u{200c}text"), "plain English\u{200c}text", "a joiner outside Telugu stays");    assert_eq!(in_latin_letters("गुरुवार ఆదివారం"), "गुरुवार aadivaaram");}