mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Introducing quiz, the testing framework
This commit is contained in:
15
Makefile
15
Makefile
@@ -74,15 +74,18 @@ include ion/Makefile
|
||||
include kandinsky/Makefile
|
||||
include poincare/Makefile
|
||||
|
||||
# Quiz should be included at the end
|
||||
include quiz/Makefile
|
||||
|
||||
run: boot.elf
|
||||
$(GDB) -x gdb_script.gdb boot.elf
|
||||
|
||||
test: test.elf
|
||||
$(GDB) -x test/gdb_script.gdb test.elf
|
||||
#test: test.elf
|
||||
# $(GDB) -x test/gdb_script.gdb test.elf
|
||||
|
||||
test.elf: $(objs) $(tests) test/runner.o
|
||||
@echo "LD $@"
|
||||
@$(LD) $(LDFLAGS) $(objs) $(tests) test/runner.o -o $@
|
||||
#test.elf: $(objs) $(tests) test/symbols.c test/runner.o
|
||||
# @echo "LD $@"
|
||||
# @$(LD) $(LDFLAGS) $(objs) $(tests) test/runner.o -o $@
|
||||
|
||||
boot.hex: boot.elf
|
||||
@echo "OBJCOPY $@"
|
||||
@@ -106,4 +109,4 @@ boot.elf: $(objs)
|
||||
|
||||
clean:
|
||||
@echo "CLEAN"
|
||||
@rm -f $(objs) $(tests) $(products)
|
||||
@rm -f $(objs) $(test_objs) $(products)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SFLAGS += -Ikandinsky/include
|
||||
objs += $(addprefix kandinsky/src/, font.o line.o pixel.o rect.o text.o)
|
||||
tests += $(addprefix kandinsky/test/, set_pixel.o)
|
||||
tests += $(addprefix kandinsky/test/, set_pixel.c)
|
||||
|
||||
FREETYPE_PATH := /usr/local/Cellar/freetype/2.5.5
|
||||
LIBPNG_PATH := /usr/local/Cellar/libpng/1.6.17
|
||||
|
||||
10
quiz/Makefile
Normal file
10
quiz/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
symbols_file = $(addprefix quiz/src/, symbols.c)
|
||||
products += $(symbols_file)
|
||||
|
||||
$(symbols_file): $(tests)
|
||||
@echo "AWK $@"
|
||||
@awk -f quiz/src/symbols.awk $(tests) > $@
|
||||
|
||||
test_objs = $(subst .c,.o, $(subst .cpp,.o,$(tests)))
|
||||
|
||||
test.elf: quiz/src/symbols.o $(test_objs)
|
||||
8
quiz/README.txt
Normal file
8
quiz/README.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Quiz is a simple test framework.
|
||||
|
||||
To write a test using quiz, all you have to do is #include quiz.h, and then
|
||||
define tests using the TEST(my_test_name) macro.
|
||||
|
||||
You should then add your test files to the "tests" variable in the Makefile.
|
||||
|
||||
Then running "make test" will compile and run your tests!
|
||||
1
quiz/include/quiz.h
Normal file
1
quiz/include/quiz.h
Normal file
@@ -0,0 +1 @@
|
||||
#define TEST(foo) void test_##foo()
|
||||
11
quiz/src/symbols.awk
Normal file
11
quiz/src/symbols.awk
Normal file
@@ -0,0 +1,11 @@
|
||||
BEGIN {
|
||||
print "void * pointers[] = {"
|
||||
}
|
||||
|
||||
#FIXME: Is there a way to capture subexpression in awk? The following gsub is
|
||||
# kind of ugly
|
||||
/TEST\(([a-z0-9_]+)\)/ { gsub(/(TEST\()|(\))/, "", $1); print "test_" $1 "," }
|
||||
|
||||
END {
|
||||
print "};"
|
||||
}
|
||||
Reference in New Issue
Block a user