mirror of
https://github.com/janet-lang/janet
synced 2025-10-29 14:47:42 +00:00
More work on nanbox implementation.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
int main() {
|
||||
int64_t i;
|
||||
int32_t i;
|
||||
dst_init();
|
||||
DstArray *array = dst_array(10);
|
||||
assert(array->capacity == 10);
|
||||
@@ -11,7 +11,8 @@ int main() {
|
||||
for (i = 0; i < 500; ++i)
|
||||
dst_array_push(array, dst_wrap_integer(i));
|
||||
for (i = 0; i < 500; ++i)
|
||||
assert(array->data[i].type == DST_INTEGER && array->data[i].as.integer == i);
|
||||
assert(dst_checktype(array->data[i], DST_INTEGER) &&
|
||||
dst_unwrap_integer(array->data[i]) == i);
|
||||
for (i = 0; i < 200; ++i)
|
||||
dst_array_pop(array);
|
||||
assert(array->count == 300);
|
||||
|
||||
@@ -7,6 +7,8 @@ int main() {
|
||||
DstAssembleResult ares;
|
||||
DstFunction *func;
|
||||
|
||||
printf("sizeof(DstValue) = %lu\n", sizeof(DstValue));
|
||||
|
||||
FILE *f = fopen("./dsts/minimal.dsts", "rb");
|
||||
fseek(f, 0, SEEK_END);
|
||||
long fsize = ftell(f);
|
||||
@@ -30,6 +32,7 @@ int main() {
|
||||
assert(pres.status == DST_PARSE_OK);
|
||||
dst_puts(dst_formatc("\nparse result: %v\n\n", pres.result.value));
|
||||
|
||||
/*
|
||||
opts.flags = 0;
|
||||
opts.source = pres.result.value;
|
||||
opts.parsemap = dst_wrap_nil();
|
||||
@@ -45,6 +48,9 @@ int main() {
|
||||
|
||||
dst_run(dst_wrap_function(func));
|
||||
dst_puts(dst_formatc("result: %v\n", dst_vm_fiber->ret));
|
||||
*/
|
||||
|
||||
dst_deinit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ int main() {
|
||||
pres = dst_parsec("'(+ 1 () [] 3 5 :hello \"hi\\h41\")");
|
||||
|
||||
assert(pres.status == DST_PARSE_OK);
|
||||
assert(pres.result.value.type == DST_TUPLE);
|
||||
assert(dst_checktype(pres.result.value, DST_TUPLE));
|
||||
|
||||
str = dst_to_string(pres.result.value);
|
||||
printf("%.*s\n", dst_string_length(str), (const char *) str);
|
||||
|
||||
Reference in New Issue
Block a user