unicode

Branch: main

Switch branches or tags

Branch: main
Go to file t

413 files indexed

History
Code

bench/normperf/normperf_bench_test.mbt
1///|2// Keep the matrix in one block so bare moon bench runs every case sequentially.3test "ICU normperf full corpus matrix" (b : @bench.T) {4  for fixture in fixtures() {5    for6      (form_name, form, expected) in [7        ("NFC", @normalization.NFC, fixture.nfc),8        ("NFD", @normalization.NFD, fixture.nfd),9      ] {10      for11        (state, input) in [12          ("orig", fixture.original),13          ("nfc", fixture.nfc),14          ("nfd", fixture.nfd),15        ] {16        assert_eq(@normalization.normalize(input, form), expected)17        assert_eq(@normalization.is_normalized(input, form), input == expected)18        let name = "\{fixture.name}/\{state}/\{form_name}"19        b.bench(name="\{name}/normalize", fn() {20          b.keep(@normalization.normalize(input, form))21        })22        b.bench(name="\{name}/check", fn() {23          b.keep(@normalization.is_normalized(input, form))24        })25      }26    }27  }28}29