From: Mike D. Lowis Date: Thu, 24 Sep 2015 14:03:22 +0000 (-0400) Subject: Setup unit test framework X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=92b481c4e1d0a34ca9be7f6dce9dbc7166880259;p=proto%2Fgir.git Setup unit test framework --- diff --git a/.gitmodules b/.gitmodules index 3806bc3..48ebd4b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "modules/build-system"] path = modules/build-system url = https://github.com/mikedlowis/build-system.git +[submodule "modules/atf"] + path = modules/atf + url = https://github.com/mikedlowis/atf.git diff --git a/build.rb b/build.rb index 8c026f1..698cd79 100755 --- a/build.rb +++ b/build.rb @@ -7,22 +7,26 @@ require './modules/build-system/setup' # Define the default compiler environment main_env = BuildEnv.new do |env| env["CFLAGS"] += ['-O3', '-Wall', '-Wextra', '--std=c99', '--pedantic'] - env["CPPPATH"] += Dir['modules/libc/source/**/'] + env["CPPPATH"] += Dir['modules/atf/source/**/'] end +sources = Dir['source/**/*.c'] - ['source/main.c'] +test_sources = Dir['tests/**/*.c'] + ['modules/atf/source/atf.c'] + #------------------------------------------------------------------------------ # Release Build Targets #------------------------------------------------------------------------------ -# Build third party libraries -#main_env.Library('build/lib/libc.a', FileList['modules/libc/source/**/*.c']) -runtime_libs = []#['build/lib/libc.a'] +# Build the language library +main_env.Library('libgir.a', sources) -# Build the parser -main_env.Program('gir', FileList['source/*.c'] + runtime_libs) +# Build the interpreter +main_env.Program('gir', ['source/main.c', 'libgir.a']) #------------------------------------------------------------------------------ # Test Build Targets #------------------------------------------------------------------------------ if Opts[:profile].include? "test" # Do nothing for now + main_env.Program('test_gir', test_sources + ['libgir.a']) + main_env.Command('Unit Tests', 'test_gir', "CMD" => ['./test_gir']) end diff --git a/modules/atf b/modules/atf new file mode 160000 index 0000000..1105e4a --- /dev/null +++ b/modules/atf @@ -0,0 +1 @@ +Subproject commit 1105e4a88bbda546991da0314ba6060f9f624dba diff --git a/source/gir.c b/source/gir.c index d47d3c1..52f97fe 100644 --- a/source/gir.c +++ b/source/gir.c @@ -21,6 +21,8 @@ Obj* Map; Obj* Set; Obj* Block; +hamt_t InternPool; + /* Private API Declarations *****************************************************************************/ @@ -29,6 +31,7 @@ Obj* Block; void gir_init(void* stack_btm) { (void)stack_btm; +// hamt_init(&InternPool); } void gir_deinit(void) diff --git a/tests/main.c b/tests/main.c new file mode 100644 index 0000000..9b608b3 --- /dev/null +++ b/tests/main.c @@ -0,0 +1,9 @@ +#include "atf.h" + +int main(int argc, char** argv) +{ + (void)argc; + (void)argv; + //RUN_EXTERN_TEST_SUITE(Opts); + return PRINT_TEST_RESULTS(); +}