Add _parse_str interface.

Rewrite _set_str to use the _parse_str
This commit is contained in:
Patrick Pelissier committed 2018-05-03 12:59:58 +02:00
1 parent 2ad8ae3451
commit 6b24842704
2 files changed
+19 -7

No files matched your search

+5 -3
View File
@@ -105,15 +105,17 @@ static void test1(void)
assert (b == false);
assert (bitset_size(set) == 196);
bitset_set_str(set, "[1010101010101010101000000000000000000000000000000000000000000000000000001111]");
bitset_parse_str(set, "[1010101010101010101000000000000000000000000000000000000000000000000000001111]", NULL);
bitset_push_at(set, 23, true);
bitset_t set3;
bitset_init(set3);
bitset_set_str(set3, "[10101010101010101010000100000000000000000000000000000000000000000000000001111]");
bitset_parse_str(set3, "[10101010101010101010000100000000000000000000000000000000000000000000000001111]", NULL);
assert(bitset_equal_p(set, set3));
bitset_push_at(set, 25, true);
bitset_set_str(set3, "[101010101010101010100001010000000000000000000000000000000000000000000000001111]");
const char *sp;
bitset_parse_str(set3, "[101010101010101010100001010000000000000000000000000000000000000000000000001111]", &sp);
assert(bitset_equal_p(set, set3));
assert (*sp == 0);
bitset_clear(set3);
bitset_clean(set);