Browse Source

fix up test suite

master
Martin Dørum 3 years ago
parent
commit
400172f03f
2 changed files with 4 additions and 4 deletions
  1. 2
    2
      test/src/eval.t.c
  2. 2
    2
      test/src/namespace.t.c

+ 2
- 2
test/src/eval.t.c View File



static struct l2_vm_value *var_lookup(const char *name) { static struct l2_vm_value *var_lookup(const char *name) {
l2_word atom_id = l2_strset_get(&gen.atomset, name); l2_word atom_id = l2_strset_get(&gen.atomset, name);
l2_word id = l2_vm_namespace_get(&vm, &vm.values[vm.nstack[0]], atom_id);
l2_word id = l2_vm_namespace_get(&vm, &vm.values[vm.nstack[1]], atom_id);
return &vm.values[id]; return &vm.values[id];
} }


defer(l2_gen_free(&gen)); defer(l2_gen_free(&gen));


asserteq(l2_vm_value_type(var_lookup("foo")), L2_VAL_TYPE_BUFFER); asserteq(l2_vm_value_type(var_lookup("foo")), L2_VAL_TYPE_BUFFER);
struct l2_vm_buffer *buf = var_lookup("foo")->data;
struct l2_vm_buffer *buf = var_lookup("foo")->buffer;
asserteq(buf->len, 11); asserteq(buf->len, 11);
assert(strncmp(buf->data, "hello world", 11) == 0); assert(strncmp(buf->data, "hello world", 11) == 0);
} }

+ 2
- 2
test/src/namespace.t.c View File

struct l2_vm_value val = {0}; struct l2_vm_value val = {0};


after_each() { after_each() {
free(val.data);
val.data = NULL;
free(val.ns);
val.ns = NULL;
} }


test("basic functionality") { test("basic functionality") {

Loading…
Cancel
Save