This commit is contained in:
2026-05-10 13:08:29 -05:00
parent 6a4d9eb544
commit 65aedb5a49
6 changed files with 19 additions and 8 deletions

View File

@@ -83,8 +83,8 @@ tyche: src/tyche.o libtyche.a
tyche-test: CFLAGS += ${DEBUG_CFLAGS} tyche-test: CFLAGS += ${DEBUG_CFLAGS}
tyche-test: LDFLAGS += ${DEBUG_LDFLAGS} tyche-test: LDFLAGS += ${DEBUG_LDFLAGS}
tyche-test: src/tests.o libtyche.a tyche-test: test/tests.o
$(CC) -o $@ $^ ${LDFLAGS} $(CC) -o $@ $^ ${LDFLAGS} -I../lib
libtyche.a: lib/vm.o libtyche.a: lib/vm.o
ar rcs $@ $^ ar rcs $@ $^

View File

@@ -42,17 +42,17 @@ static uint32_t value_idx(VALUE v)
return v.idx; return v.idx;
} }
VALUE create_value_integer(int32_t v) static VALUE create_value_integer(int32_t v)
{ {
return (VALUE) { .type = TT_INTEGER, .i = v }; return (VALUE) { .type = TT_INTEGER, .i = v };
} }
VALUE create_value_real(float f) static VALUE create_value_real(float f)
{ {
return (VALUE) { .type = TT_INTEGER, .f = f }; return (VALUE) { .type = TT_INTEGER, .f = f };
} }
VALUE create_value_idx(TYC_TYPE type, uint32_t idx) static VALUE create_value_idx(TYC_TYPE type, uint32_t idx)
{ {
#ifdef CHECK_TYCHE_BUGS #ifdef CHECK_TYCHE_BUGS
if (type != TT_FUNCTION && type != TT_NATIVE_PTR && type != TT_ARRAY && type != TT_TABLE && type != TT_STRING && type != TT_STRING_CONST) if (type != TT_FUNCTION && type != TT_NATIVE_PTR && type != TT_ARRAY && type != TT_TABLE && type != TT_STRING && type != TT_STRING_CONST)

View File

@@ -0,0 +1 @@
#include "stack.c"

View File

@@ -1,3 +0,0 @@
int main()
{
}

6
src/tests.yaml Normal file
View File

@@ -0,0 +1,6 @@
- name: Basic test
assembly: |
.func 0
pushi 2
ret
expected: 2

7
test/tests.cc Normal file
View File

@@ -0,0 +1,7 @@
extern "C" {
#include "../lib/vm.c"
}
int main()
{
}