Example #1
0
void test_string_hash_set()
{

    FcitxStringHashSet* sset = fcitx_string_hashset_parse("a,b,c,d", ',');
    assert(fcitx_dict_size(sset) == 4);
    assert(fcitx_string_hashset_contains(sset, "c"));
    assert(!fcitx_string_hashset_contains(sset, "e"));
    fcitx_string_hashset_remove(sset, "c");
    assert(!fcitx_string_hashset_contains(sset, "c"));
    fcitx_string_hashset_insert(sset, "e");
    assert(fcitx_string_hashset_contains(sset, "e"));

    /* uthash guarantee order, so we can sure about this */
    char* joined = fcitx_string_hashset_join(sset, ',');
    assert(strcmp(joined, "a,b,d,e") == 0);

    free(joined);

    fcitx_string_hashset_free(sset);
}
Example #2
0
bool fcitx_configuration_has_sub_items(const FcitxConfiguration* config)
{
    return config->subitems && fcitx_dict_size(config->subitems);
}