int main() { test_basic_operations(); test_set_and_get_for_all_data_types(); test_contains_and_find_one_for_all_data_types(); test_internal_type_conversion(); test_contains(); test_find_one(); return 0; }
void runTest() { Source a ("a"); Source b ("b"); Source c ("c"); Source d ("d"); Source e ("e"); Source f ("f"); Source g ("g"); // // a { b { d { f }, e }, c { g } } // a.add ( b ); a.add ( c ); c.add ( g ); b.add ( d ); b.add ( e ); d.add ( f ); beginTestCase ("peel_name"); test_peel_name ("a", "a", ""); test_peel_name ("foo/bar", "foo", "bar"); test_peel_name ("foo/goo/bar", "foo", "goo/bar"); test_peel_name ("", "", ""); beginTestCase ("peel_leading_slash"); test_peel_leading_slash ("foo/", "foo/", false); test_peel_leading_slash ("foo", "foo", false); test_peel_leading_slash ("/foo/", "foo/", true); test_peel_leading_slash ("/foo", "foo", true); beginTestCase ("peel_trailing_slashstar"); test_peel_trailing_slashstar ("/foo/goo/*", "/foo/goo", true); test_peel_trailing_slashstar ("foo/goo/*", "foo/goo", true); test_peel_trailing_slashstar ("/foo/goo/", "/foo/goo", false); test_peel_trailing_slashstar ("foo/goo", "foo/goo", false); test_peel_trailing_slashstar ("", "", false); test_peel_trailing_slashstar ("/", "", false); test_peel_trailing_slashstar ("/*", "", true); test_peel_trailing_slashstar ("//", "/", false); test_peel_trailing_slashstar ("**", "*", true); test_peel_trailing_slashstar ("*/", "*", false); beginTestCase ("find_one"); test_find_one (a, &b, "b"); test_find_one (a, nullptr, "d"); test_find_one (b, &e, "e"); test_find_one (d, &f, "f"); beginTestCase ("find_path"); test_find_path (a, "a", nullptr); test_find_path (a, "e", nullptr); test_find_path (a, "a/b", nullptr); test_find_path (a, "a/b/e", nullptr); test_find_path (a, "b/e/g", nullptr); test_find_path (a, "b/e/f", nullptr); test_find_path (a, "b", &b); test_find_path (a, "b/e", &e); test_find_path (a, "b/d/f", &f); beginTestCase ("find_one_deep"); test_find_one_deep (a, "z", nullptr); test_find_one_deep (a, "g", &g); test_find_one_deep (a, "b", &b); test_find_one_deep (a, "d", &d); test_find_one_deep (a, "f", &f); beginTestCase ("find"); test_find (a, "", &a, false); test_find (a, "*", &a, true); test_find (a, "/b", &b, false); test_find (a, "b", &b, false); test_find (a, "d", &d, false); test_find (a, "/b*", &b, true); test_find (a, "b*", &b, true); test_find (a, "d*", &d, true); test_find (a, "/b/*", &b, true); test_find (a, "b/*", &b, true); test_find (a, "d/*", &d, true); test_find (a, "a", nullptr, false); test_find (a, "/d", nullptr, false); test_find (a, "/d*", nullptr, true); test_find (a, "/d/*", nullptr, true); }