diff --git a/.travis.yml b/.travis.yml index 8c20e61..5a17741 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,19 @@ language: cpp +os: + - linux + - osx compiler: - clang - gcc +matrix: + include: + # Windows x64 builds (MSVC) + - os: windows + script: + - ./test.bat travis + +before_install: + - eval "${MATRIX_EVAL}" install: - cd test script: diff --git a/test/HandmadeTest.h b/test/HandmadeTest.h index 66b556d..c142e11 100644 --- a/test/HandmadeTest.h +++ b/test/HandmadeTest.h @@ -212,9 +212,9 @@ hmt_covercase* _hmt_covercases = 0; hmt_category _hmt_new_category(const char* name) { hmt_category cat = { - .name = name, - .num_tests = 0, - .tests = (hmt_test*) malloc(HMT_ARRAY_SIZE * sizeof(hmt_test)) + name, // name + 0, // num_tests + (hmt_test*) malloc(HMT_ARRAY_SIZE * sizeof(hmt_test)), // tests }; return cat; @@ -222,8 +222,8 @@ hmt_category _hmt_new_category(const char* name) { hmt_test _hmt_new_test(const char* name, hmt_test_func func) { hmt_test test = { - .name = name, - .func = func + name, // name + func, // func }; return test; @@ -231,10 +231,10 @@ hmt_test _hmt_new_test(const char* name, hmt_test_func func) { hmt_covercase _hmt_new_covercase(const char* name, int expected) { hmt_covercase covercase = { - .name = name, - .expected_asserts = expected, - .actual_asserts = 0, - .asserted_lines = (int*) malloc(HMT_ARRAY_SIZE * sizeof(int)), + name, // name + expected, // expected_asserts + 0, // actual_asserts + (int*) malloc(HMT_ARRAY_SIZE * sizeof(int)), // asserted_lines }; return covercase; @@ -331,8 +331,8 @@ int hmt_run_all_tests() { printf(" %s:", test.name); hmt_testresult result = { - .count_cases = 0, - .count_failures = 0 + 0, // count_cases + 0, // count_failures }; test.func(&result); diff --git a/test/hmm_test.h b/test/hmm_test.h index 60fbfd0..e674c29 100644 --- a/test/hmm_test.h +++ b/test/hmm_test.h @@ -3,6 +3,7 @@ #define HANDMADE_TEST_IMPLEMENTATION #include "HandmadeTest.h" +#undef COVERAGE // Make sure we don't double-define initializers from the header part #include "../HandmadeMath.h" #include "categories/ScalarMath.h" diff --git a/test/test.bat b/test/test.bat new file mode 100644 index 0000000..1d0b5f5 --- /dev/null +++ b/test/test.bat @@ -0,0 +1,27 @@ +@echo off + +if "%1%"=="travis" ( + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64 +) else ( + where /q cl + if ERRORLEVEL 1 ( + for /f "delims=" %%a in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -find VC\Auxiliary\Build\vcvarsall.bat') do (%%a x64) + ) +) + +if not exist "build" mkdir build +pushd build + +cl /Fehmm_test_c.exe ..\HandmadeMath.c ..\hmm_test.c +hmm_test_c + +cl /Fehmm_test_c_no_sse.exe /DHANDMADE_MATH_NO_SSE ..\HandmadeMath.c ..\hmm_test.c +hmm_test_c_no_sse + +cl /Fehmm_test_cpp.exe ..\HandmadeMath.cpp ..\hmm_test.cpp +hmm_test_cpp + +cl /Fehmm_test_cpp_no_sse.exe /DHANDMADE_MATH_NO_SSE ..\HandmadeMath.cpp ..\hmm_test.cpp +hmm_test_cpp_no_sse + +popd