mirror of https://github.com/djcb/mu.git
mu-utils: improve tests
This commit is contained in:
parent
6ce94ce914
commit
04e3a2f9a8
|
@ -62,9 +62,10 @@ test_date_basic()
|
|||
}
|
||||
|
||||
g_setenv("TZ", hki, TRUE);
|
||||
constexpr std::array<std::tuple<const char*, bool/*is_first*/, int64_t>, 13> cases = {{
|
||||
std::vector<std::tuple<const char*, bool/*is_first*/, int64_t>> cases = {{
|
||||
{"2015-09-18T09:10:23", true, 1442556623},
|
||||
{"1972-12-14T09:10:23", true, 93165023},
|
||||
{"1972-12-14T09:10", true, 93165000},
|
||||
{"1854-11-18T17:10:23", true, 0},
|
||||
|
||||
{"2000-02-31T09:10:23", true, 951861599},
|
||||
|
@ -152,9 +153,11 @@ static void
|
|||
test_flatten()
|
||||
{
|
||||
CaseVec cases = {
|
||||
{"Менделе́ев", true, "менделеев"},
|
||||
{"", false, ""},
|
||||
{"Ångström", true, "angstrom"},
|
||||
{"Менделе́ев", true, "менделеев"},
|
||||
{"", true, ""},
|
||||
{"Ångström", true, "angstrom"},
|
||||
{"đodø", true, "dodo"},
|
||||
|
||||
// don't touch combining characters in CJK etc.
|
||||
{"スポンサーシップ募集",true, "スポンサーシップ募集"}
|
||||
};
|
||||
|
@ -180,9 +183,10 @@ static void
|
|||
test_clean()
|
||||
{
|
||||
CaseVec cases = {
|
||||
{"\t a\t\nb ", true, "a b"},
|
||||
{"", false, ""},
|
||||
{"Ångström", true, "Ångström"},
|
||||
{"\t a\t\nb ", true, "a b"},
|
||||
{"", true, ""},
|
||||
{"Ångström", true, "Ångström"},
|
||||
{"\345\245", true, ".."},
|
||||
};
|
||||
|
||||
test_cases(cases, [](auto s, auto f) { return utf8_clean(s); });
|
||||
|
@ -193,9 +197,10 @@ static void
|
|||
test_word_break()
|
||||
{
|
||||
CaseVec cases = {
|
||||
{"aap+noot&mies", true, "aap noot mies"},
|
||||
{"hallo", true, "hallo"},
|
||||
{"aap+noot&mies", true, "aap noot mies"},
|
||||
{"hallo", true, "hallo"},
|
||||
{" foo-bar###cuux,fnorb ", true, "foo bar cuux fnorb"},
|
||||
{"eyes\nof\tMedusa", true, "eyes of Medusa"},
|
||||
};
|
||||
|
||||
test_cases(cases, [](auto s, auto f) { return utf8_wordbreak(s); });
|
||||
|
|
Loading…
Reference in New Issue