1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-17 14:14:49 +00:00
janet/junkyard/table_test.c
bakpakin 2771171658 Much work on compiler. Fixing bugs and gradually cleaning
up code. Generalized some vector code.
2018-01-05 16:17:55 -05:00

20 lines
575 B
C

#include "unit.h"
#include <dst/dst.h>
int main() {
dst_init();
DstTable *table = dst_table(10);
assert(table->count == 0);
dst_table_put(table, dst_cstringv("a"), dst_cstringv("b"));
dst_table_put(table, dst_cstringv("b"), dst_cstringv("a"));
dst_table_put(table, dst_cstringv("a"), dst_cstringv("c"));
assert(table->count == 2);
dst_table_remove(table, dst_cstringv("a"));
assert(table->count == 1);
assert(dst_equals(
dst_table_get(table, dst_cstringv("b")),
dst_cstringv("a")
));
return 0;
}