diff --git a/Makefile b/Makefile index d5cb4f9..9ae4fab 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,9 @@ main.o: main.scm %.o: %.scm $(CHICKEN_C) $< -e -c -o $@ -sex-tests: $(OBJ) tests/run.scm - $(CHICKEN_C) tests/run.scm -c -o sex-tests.o - $(CHICKEN_C) $(OBJ) sex-tests.o -o sex-tests +sex-tests: $(OBJ) tests/*.scm + cd ./tests && $(CHICKEN_C) run.scm -c -o sex-tests.o + $(CHICKEN_C) $(OBJ) ./tests/sex-tests.o -o sex-tests clean: - rm -f $(OBJ) sexc sex-tests main.o sex-test.o + rm -f $(OBJ) sexc sex-tests main.o ./tests/sex-tests.o diff --git a/tests/basic.scm b/tests/basic.scm new file mode 100644 index 0000000..6bb3c70 --- /dev/null +++ b/tests/basic.scm @@ -0,0 +1,26 @@ +;;; unkebabify +(test '- (unkebabify '-)) +(test '-- (unkebabify '--)) +(test '-> (unkebabify '->)) +(test '-= (unkebabify '-=)) +(test 'kebab_case (unkebabify 'kebab-case)) +(test '_what_ (unkebabify '-what-)) +(test 'this->member (unkebabify 'this->member)) +(test '_this_->_member_ (unkebabify '-this-->-member-)) +(test '__->>> (unkebabify '--->>>)) + +;;; atom-to-fmt-c +(test '%fun (atom-to-fmt-c 'fn)) +(test '%prototype (atom-to-fmt-c 'prototype)) +(test '%var (atom-to-fmt-c 'var)) +(test '%block-begin (atom-to-fmt-c 'begin)) +(test '%define (atom-to-fmt-c 'define)) +(test '%pointer (atom-to-fmt-c 'pointer)) +(test '%array (atom-to-fmt-c 'array)) +(test 'vector-ref (atom-to-fmt-c '@)) +(test '%include (atom-to-fmt-c 'include)) +(test '%cast (atom-to-fmt-c 'cast)) + +;;; make-field-access +(test 'a.b (make-field-access '(.b a))) +(test 'a.b.c (make-field-access '(.c a.b))) diff --git a/tests/run.scm b/tests/run.scm index f6a3386..56019ec 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -6,32 +6,8 @@ srfi-1 test) -;;; unkebabify -(test '- (unkebabify '-)) -(test '-- (unkebabify '--)) -(test '-> (unkebabify '->)) -(test '-= (unkebabify '-=)) -(test 'kebab_case (unkebabify 'kebab-case)) -(test '_what_ (unkebabify '-what-)) -(test 'this->member (unkebabify 'this->member)) -(test '_this_->_member_ (unkebabify '-this-->-member-)) -(test '__->>> (unkebabify '--->>>)) - -;;; atom-to-fmt-c -(test '%fun (atom-to-fmt-c 'fn)) -(test '%prototype (atom-to-fmt-c 'prototype)) -(test '%var (atom-to-fmt-c 'var)) -(test '%block-begin (atom-to-fmt-c 'begin)) -(test '%define (atom-to-fmt-c 'define)) -(test '%pointer (atom-to-fmt-c 'pointer)) -(test '%array (atom-to-fmt-c 'array)) -(test 'vector-ref (atom-to-fmt-c '@)) -(test '%include (atom-to-fmt-c 'include)) -(test '%cast (atom-to-fmt-c 'cast)) - -;;; make-field-access -(test 'a.b (make-field-access '(.b a))) -(test 'a.b.c (make-field-access '(.c a.b))) +(include "basic.scm") +(include "types.scm") ;;; Should be the last in the test suite (test-exit) diff --git a/tests/types.scm b/tests/types.scm new file mode 100644 index 0000000..cb14c40 --- /dev/null +++ b/tests/types.scm @@ -0,0 +1 @@ +(test "char *" (to-c-type '(%pointer char)))