mirror of
https://github.com/samsonjs/lake.git
synced 2026-03-25 08:55:49 +00:00
stub out some tests
This commit is contained in:
parent
6fb57ec9f3
commit
90b0e548bd
5 changed files with 120 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
25
test/test_parse.c
Normal file
25
test/test_parse.c
Normal file
|
|
@ -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 <stdlib.h>
|
||||
#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
|
||||
22
test/test_primitive.c
Normal file
22
test/test_primitive.c
Normal file
|
|
@ -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
|
||||
21
test/test_str.c
Normal file
21
test/test_str.c
Normal file
|
|
@ -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) */
|
||||
23
test/test_sym.c
Normal file
23
test/test_sym.c
Normal file
|
|
@ -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
|
||||
Loading…
Reference in a new issue