instinct-cli 0.3.7

Shared local memory for coding agents. Save a fix once and find it again in a new session or another connected tool.
1
2
3
4
5
6
7
8
9
10
11
12
13
# Development lexical controls; separate from the hidden retrieval evaluation.
TAA # use super::*;
TAA # #[test] fn latin_diacritics_and_ligatures_fold(){for(a,b)in[("ÁČĎÉĚÍĹĽŇÓÔÖŐŔŘŠŤÚŮÜŰÝŽ","acdeeillnoooorrstuuuuyz"),("Straße","strasse"),("Æsir Œuvre Łódź Đak Þing","aesir oeuvre lodz dak thing"),("zápis denníka projektu","zapis dennika projektu")]{assert_eq!(normalize(a),b);}}
TAA # #[test] fn decomposed_latin_accents_do_not_split_words(){assert_eq!(tokens("za\u{301}pis denni\u{301}ka"),tokens("zápis denníka"));assert_eq!(normalize("Cafe\u{301}"),"cafe");}
TAA # #[test] fn non_latin_scripts_keep_unicode_letters(){assert_eq!(normalize("ПРОЕКТ"),"проект");assert_eq!(normalize("ΕΛΛΗΝΙΚΑ"),"ελληνικα");assert_eq!(tokens("项目日志 日本語"),vec!["项目日志","日本語"]);assert_ne!(normalize("а"),normalize("a"));}
TAA # #[test] fn ascii_tokens_remain_identical(){for s in ["Run tests_before_Deploy!", "HTTP 500 errors", "a b 1 x_ 42", "can't update-config", "POST /v1/cache"]{let old:Vec<_>=s.split(|c:char|!(c.is_alphanumeric()||c=='_')).filter(|w|w.chars().count()>=2).map(str::to_lowercase).collect();assert_eq!(tokens(s),old);}}
TAA # #[test] fn greek_contextual_lowercase_matches_legacy_word_boundaries(){for s in ["ΚΟΣΜΟΣ ΧΡΟΝΟΣ","ΟΣ'Α","ΟΣ_Α","ΟΔΟΣ. ΧΡΟΝΟΣ", "ПРОЕКТ 日本語"]{let old:Vec<_>=s.split(|c:char|!(c.is_alphanumeric()||c=='_')).filter(|w|w.chars().count()>=2).map(str::to_lowercase).collect();assert_eq!(tokens(s),old,"{s}");}assert_eq!(normalize("ΚΟΣΜΟΣ"),"κοσμος");}
TAA # #[test] fn combining_marks_only_removed_after_latin(){assert_eq!(normalize("a\u{301}"),"a");assert_eq!(normalize("α\u{301}"),"α\u{301}");assert_eq!(normalize("а\u{301}"),"а\u{301}");}
TAA # #[test] fn encoding_scan_is_chunk_independent(){for input in [b"plain ASCII".as_slice(),b"literal \\u0061",b"escaped \\u00e1",b"native \\\\u010D",b"bad \\uxxxx then \\u017e","utf8 č".as_bytes()]{let mut whole=BankEncoding::default();whole.feed(input);for split in 0..=input.len(){let mut chunks=BankEncoding::default();chunks.feed(&input[..split]);chunks.feed(&input[split..]);assert_eq!(chunks.unicode,whole.unicode,"split {split}");}}}
TAA # #[test] fn normalization_is_idempotent_for_latin_blocks(){for code in 0..=0x17f{let Some(ch)=char::from_u32(code)else{continue};let first=normalize(&ch.to_string());assert_eq!(normalize(&first),first,"U+{code:04X}");}}
TAA # #[test] fn bank_encoding_detects_unicode_and_split_escapes(){let mut s=BankEncoding::default();s.feed(b"ASCII bank");assert!(!s.unicode);s.feed(b"\\u00");s.feed(b"e1");assert!(s.unicode);let mut s=BankEncoding::default();s.feed(b"\\u0061");assert!(!s.unicode);s.feed("č".as_bytes());assert!(s.unicode);}
TAA # #[test] fn precomposed_vietnamese_folds_like_its_decomposed_spelling(){for (pre,dec,plain) in [("Việt Nam","Vie\u{323}\u{302}t Nam","viet nam"),("tiếng Việt","tiê\u{301}ng Vie\u{323}\u{302}t","tieng viet"),("người","ngươ\u{300}i","nguoi"),("Hà Nội","Ha\u{300} Nô\u{323}i","ha noi"),("ước mơ","ươ\u{301}c mơ","uoc mo"),("Trương Thị","Trươ\u{300}ng Thi\u{323}","truong thi"),("sắp xếp ảnh","sa\u{301}p xê\u{301}p a\u{309}nh","sap xep anh")]{assert_eq!(normalize(pre),plain,"{pre}");assert_eq!(normalize(dec),plain,"{dec}");assert_eq!(tokens(pre),tokens(dec),"{pre}");}}
TAA # #[test] fn every_precomposed_latin_extended_letter_matches_its_decomposition_where_the_base_is_ascii(){let mut checked=0;for code in (0x180..=0x24f).chain(0x1e00..=0x1eff){let Some(ch)=char::from_u32(code)else{continue};let one=ch.to_string();let folded=normalize(&one);if folded.len()==1&&folded.is_ascii(){checked+=1;let mut decomposed=folded.clone();decomposed.push('\u{301}');assert_eq!(normalize(&decomposed),folded,"U+{code:04X}");}}assert!(checked>200,"{checked}");}