6 int main(int argc
, char ** argv
)
8 /* by default, 0 <-> NULL */
9 assert(quark_from_string(NULL
) == 0);
10 assert(quark_to_string(0) == NULL
);
12 /* strings are internalized, setting the same value multiple times
13 * will give the same quark */
14 const char * foo
= "foo";
15 assert(quark_from_string(foo
) == 1);
16 assert(quark_from_string(foo
) == 1);
18 /* this is a copy of the string, unless the quark_from_static_string
20 assert(quark_to_string(1) != foo
);
21 const char *bar
= "bar";
22 assert(quark_from_static_string(bar
) == 2);
23 assert(quark_to_string(2) == bar
);
25 /* this is the same for the same string content at a different address */
26 char * foo2
= strdup(foo
);
27 assert(quark_from_string(foo2
) == 1);
28 assert(quark_to_string(1) != foo2
);