From 90b0e548bd63c7c9bea37573d7c3743479d50ff8 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Thu, 6 Mar 2014 21:36:51 -0800 Subject: [PATCH] stub out some tests --- test/Makefile | 29 +++++++++++++++++++++++++++++ test/test_parse.c | 25 +++++++++++++++++++++++++ test/test_primitive.c | 22 ++++++++++++++++++++++ test/test_str.c | 21 +++++++++++++++++++++ test/test_sym.c | 23 +++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 test/test_parse.c create mode 100644 test/test_primitive.c create mode 100644 test/test_str.c create mode 100644 test/test_sym.c diff --git a/test/Makefile b/test/Makefile index 4afb8a9..bdc457a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -10,6 +10,10 @@ TESTS = test_comment \ test_lake \ test_list + # test_parse \ + # test_primitive \ + # test_str \ + # test_sym all: $(TESTS) @@ -50,6 +54,31 @@ test_lake: laketest.o test_lake.o @./test_lake @echo +test_list: laketest.o test_list.o + $(CC) $(CFLAGS) $^ $(OBJS) -o $@ + @./test_list + @echo + +test_parse: laketest.o test_parse.o + $(CC) $(CFLAGS) $^ $(OBJS) -o $@ + @./test_parse + @echo + +test_primitive: laketest.o test_primitive.o + $(CC) $(CFLAGS) $^ $(OBJS) -o $@ + @./test_primitive + @echo + +test_str: laketest.o test_str.o + $(CC) $(CFLAGS) $^ $(OBJS) -o $@ + @./test_str + @echo + +test_sym: laketest.o test_sym.o + $(CC) $(CFLAGS) $^ $(OBJS) -o $@ + @./test_sym + @echo + clean: -rm -f *.o $(TESTS) diff --git a/test/test_parse.c b/test/test_parse.c new file mode 100644 index 0000000..d4a63cc --- /dev/null +++ b/test/test_parse.c @@ -0,0 +1,25 @@ +#include "laketest.h" + +/** + * parse.h + * Lake Scheme + * + * Copyright 2011 Sami Samhuri + * MIT License + * + */ + +#ifndef _LAKE_PARSE_H +#define _LAKE_PARSE_H + +#include +#include "lake.h" + +#define PARSE_EOF -1 +#define PARSE_ERR -2 + +LakeVal *parse_expr(LakeCtx *ctx, char *s, size_t n); +LakeList *parse_exprs(LakeCtx *ctx, char *s, size_t n); +LakeList *parse_naked_list(LakeCtx *ctx, char *s, size_t n); + +#endif diff --git a/test/test_primitive.c b/test/test_primitive.c new file mode 100644 index 0000000..e422f92 --- /dev/null +++ b/test/test_primitive.c @@ -0,0 +1,22 @@ +#include "laketest.h" + +/** + * primitive.h + * Lake Scheme + * + * Copyright 2011 Sami Samhuri + * MIT License + * + */ + +#ifndef _LAKE_PRIMITIVE_H +#define _LAKE_PRIMITIVE_H + +#include "env.h" +#include "lake.h" + +LakePrimitive *prim_make(char *name, int arity, lake_prim fn); +char *prim_repr(LakePrimitive *prim); +void bind_primitives(LakeCtx *ctx); + +#endif diff --git a/test/test_str.c b/test/test_str.c new file mode 100644 index 0000000..5450429 --- /dev/null +++ b/test/test_str.c @@ -0,0 +1,21 @@ +/** + * test_str.c + * Lake Scheme + * + * Copyright 2011 Sami Samhuri + * MIT License + * + */ + +#include "common.h" +#include "laketest.h" +#include "lake.h" + +/* LakeStr *lake_str_make(void) */ +/* void lake_str_free(LakeStr *str) */ +/* LakeStr *lake_str_copy(LakeStr *str) */ +/* LakeStr *lake_str_from_c(char *s) */ +/* char *lake_str_val(LakeStr *str) */ +/* LakeInt *lake_str_len(LakeStr *str) */ +/* int lake_str_equal(LakeStr *a, LakeStr *b) */ +/* LakeStr *lake_str_to_str(LakeStr *str) */ diff --git a/test/test_sym.c b/test/test_sym.c new file mode 100644 index 0000000..ae4a422 --- /dev/null +++ b/test/test_sym.c @@ -0,0 +1,23 @@ +#include "laketest.h" + +/** + * sym.h + * Lake Scheme + * + * Copyright 2011 Sami Samhuri + * MIT License + * + */ + +#ifndef _LAKE_SYM_H +#define _LAKE_SYM_H + +#include "lake.h" + +LakeSym *sym_intern(LakeCtx *ctx, char *s); +LakeStr *sym_to_str(LakeSym *sym); +LakeSym *sym_from_str(LakeCtx *ctx, LakeStr *str); +char *sym_repr(LakeSym *sym); +unsigned long sym_val(LakeSym *sym); + +#endif \ No newline at end of file