MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / let_assert

Function let_assert

scripts/test_stringzilla.cpp:2777–2817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2775
2776 sz::string words_str = "foo bar baz";
2777 let_assert(auto w = words_str.utf8_split().template to<std::vector<std::string>>(),
2778 w.size() == 3 && w[2] == "baz");
2779 }
2780
2781 // Test Unicode case folding
2782 {
2783 auto case_fold = [](sz::string s) -> sz::string {
2784 assert(s.try_utf8_case_fold());
2785 return s;
2786 };
2787
2788 // ASCII uppercase to lowercase
2789 assert(case_fold("HELLO WORLD") == "hello world");
2790 assert(case_fold("ABC") == "abc");
2791 assert(case_fold("abc") == "abc"); // already lowercase
2792 assert(case_fold("123") == "123"); // no change for digits
2793 assert(case_fold("") == ""); // empty string
2794
2795 // German Eszett - one-to-many expansion
2796 assert(case_fold("\xC3\x9F") == "ss"); // U+00DF -> ss
2797 assert(case_fold("STRAẞE") == "strasse"); // Capital U+1E9E -> ss
2798
2799 // Cyrillic uppercase to lowercase
2800 assert(case_fold("ПРИВЕТ") == "привет");
2801
2802 // Greek uppercase to lowercase
2803 assert(case_fold("ΑΒΓΔ") == "αβγδ");
2804
2805 // Latin Extended characters
2806 assert(case_fold("ÀÁÂ") == "àáâ");
2807
2808 // Armenian
2809 assert(case_fold("Ա") == "ա"); // U+0531 -> U+0561
2810
2811 // Mixed case preservation for non-alphabetic
2812 assert(case_fold("Hello 123 World!") == "hello 123 world!");
2813
2814 // Unicode characters without case folding should pass through unchanged
2815 assert(case_fold("日本語") == "日本語"); // Japanese (no case)
2816 assert(case_fold("中文") == "中文"); // Chinese (no case)
2817 }
2818}
2819
2820/**

Callers 1

Calls 4

try_utf8_case_foldMethod · 0.80
insertMethod · 0.80
utf8_splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…