1 #include "../src/fchash.c"
2 #include "../src/fcstr.c"
5 FcLangNormalize (const FcChar8 *lang)
26 ret = malloc (sizeof (Test));
29 ret->table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase,
30 (FcCompareFunc) FcStrCmp,
33 (FcDestroyFunc) FcStrFree,
43 FcHashTableDestroy (test->table);
48 test_add (Test *test, FcChar8 *key, FcBool replace)
52 FcBool (*hash_add) (FcHashTable *, void *, void *);
55 uuid_generate_random (uuid);
57 hash_add = FcHashTableReplace;
59 hash_add = FcHashTableAdd;
60 if (!hash_add (test->table, key, uuid))
62 if (!FcHashTableFind (test->table, key, &u))
64 ret = (uuid_compare (uuid, u) == 0);
71 test_remove (Test *test, FcChar8 *key)
75 if (!FcHashTableFind (test->table, key, &u))
78 if (!FcHashTableRemove (test->table, key))
80 if (FcHashTableFind (test->table, key, &u))
95 if (!test_add (test, "foo", FcFalse))
100 /* second op to add */
101 if (!test_add (test, "bar", FcFalse))
106 /* dup not allowed */
107 if (test_add (test, "foo", FcFalse))
113 if (!test_add (test, "foo", FcTrue))
119 if (!test_remove (test, "foo"))
124 /* not found to remove */
125 if (test_remove (test, "foo"))
130 /* complex op in pointer */
131 if (!test_add (test, "foo", FcFalse))
136 if (test_add (test, "foo", FcFalse))
141 if (!test_remove (test, "foo"))
146 if (!test_add (test, "foo", FcFalse))
151 if (!test_remove (test, "bar"))
156 /* completely remove */
157 if (!test_remove (test, "foo"))
162 /* completely remove from the last one */
163 if (!test_add (test, "foo", FcFalse))
168 if (!test_add (test, "bar", FcFalse))
173 if (!test_remove (test, "bar"))
178 if (!test_remove (test, "foo"))