diff --git a/.travis.yml b/.travis.yml index c934f82..74dc382 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ rvm: - "1.9.3" - "2.0.0" script: - - rake ci + - cd test && rake ci diff --git a/examples/example_3/rakefile.rb b/examples/example_3/rakefile.rb index 2cfadc4..9f1dbeb 100644 --- a/examples/example_3/rakefile.rb +++ b/examples/example_3/rakefile.rb @@ -3,7 +3,6 @@ UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/../..' require 'rake' require 'rake/clean' -require 'rake/testtask' require HERE+'rakefile_helper' TEMP_DIRS = [ diff --git a/makefile b/makefile deleted file mode 100644 index d1fa92f..0000000 --- a/makefile +++ /dev/null @@ -1,37 +0,0 @@ -# ========================================== -# Unity Project - A Test Framework for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -C_COMPILER=gcc -TARGET_BASE = testunity -ifeq ($(OS),Windows_NT) - TARGET_EXTENSION=.exe -else - TARGET_EXTENSION=.out -endif -TARGET = $(TARGET_BASE)$(TARGET_EXTENSION) -OUT_FILE=-o $(TARGET) -SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c -INC_DIRS=-Isrc -SYMBOLS=-DTEST -DUNITY_SUPPORT_64 -DUNITY_INCLUDE_DOUBLE - -ifeq ($(OSTYPE),cygwin) - CLEANUP = rm -f build/*.o ; rm -f $(TARGET) ; mkdir -p build -else ifeq ($(OS),Windows_NT) - CLEANUP = del /F /Q build\* && del /F /Q $(TARGET) -else - CLEANUP = rm -f build/*.o ; rm -f $(TARGET) ; mkdir -p build -endif - -all: clean default - -default: - ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c - $(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE) - ./$(TARGET) - -clean: - $(CLEANUP) - diff --git a/src/unity.c b/src/unity.c index fd5c5a9..277c0b2 100644 --- a/src/unity.c +++ b/src/unity.c @@ -5,8 +5,6 @@ ============================================================================ */ #include "unity.h" -#include -#include #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); } #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); } @@ -231,6 +229,7 @@ void UnityPrintMask(const _U_UINT mask, const _U_UINT number) //----------------------------------------------- #ifdef UNITY_FLOAT_VERBOSE +#include void UnityPrintFloat(_UF number) { char TempBuffer[32]; diff --git a/src/unity.h b/src/unity.h index b3d4bff..80e6126 100644 --- a/src/unity.h +++ b/src/unity.h @@ -6,7 +6,6 @@ #ifndef UNITY_FRAMEWORK_H #define UNITY_FRAMEWORK_H - #define UNITY #include "unity_internals.h" @@ -268,4 +267,6 @@ #define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, __LINE__, message) #define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, __LINE__, message) #define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, __LINE__, message) + +//end of UNITY_FRAMEWORK_H #endif diff --git a/src/unity_internals.h b/src/unity_internals.h index fb11665..57ce0d1 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -11,7 +11,6 @@ #include "unity_config.h" #endif -#include #include // Unity Attempts to Auto-Detect Integer Types @@ -241,7 +240,7 @@ typedef UNITY_FLOAT_TYPE _UF; #else -//Floating Point Support +//Double Floating Point Support #ifndef UNITY_DOUBLE_PRECISION #define UNITY_DOUBLE_PRECISION (1e-12f) #endif @@ -252,16 +251,27 @@ typedef UNITY_DOUBLE_TYPE _UD; #endif +#ifdef UNITY_DOUBLE_VERBOSE +#ifndef UNITY_FLOAT_VERBOSE +#define UNITY_FLOAT_VERBOSE +#endif +#endif + //------------------------------------------------------- // Output Method //------------------------------------------------------- #ifndef UNITY_OUTPUT_CHAR -//Default to using putchar, which is defined in stdio.h above + +//Default to using putchar, which is defined in stdio.h +#include #define UNITY_OUTPUT_CHAR(a) putchar(a) + #else + //If defined as something else, make sure we declare it here so it's ready for use extern int UNITY_OUTPUT_CHAR(int); + #endif //------------------------------------------------------- @@ -674,4 +684,5 @@ extern const char* UnityStrErr64; #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_DET) #endif +//End of UNITY_INTERNALS_H #endif diff --git a/Rakefile b/test/rakefile similarity index 85% rename from Rakefile rename to test/rakefile index 8364ef5..b2af40e 100644 --- a/Rakefile +++ b/test/rakefile @@ -8,7 +8,6 @@ UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/' require 'rake' require 'rake/clean' -require 'rake/testtask' require UNITY_ROOT + 'rakefile_helper' TEMP_DIRS = [ @@ -25,12 +24,7 @@ task :prepare_for_tests => TEMP_DIRS include RakefileHelpers # Load proper GCC as defult configuration -if 1.size == 8 # 8 bytes => 64-bits - DEFAULT_CONFIG_FILE = 'gcc_64.yml' -else # Assume 32-bit otherwise - DEFAULT_CONFIG_FILE = 'gcc_32.yml' -end - +DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml' configure_toolchain(DEFAULT_CONFIG_FILE) desc "Test unity with its own unit tests" diff --git a/rakefile_helper.rb b/test/rakefile_helper.rb similarity index 95% rename from rakefile_helper.rb rename to test/rakefile_helper.rb index 0b25233..7bd5d25 100644 --- a/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -6,9 +6,9 @@ require 'yaml' require 'fileutils' -require UNITY_ROOT + 'auto/unity_test_summary' -require UNITY_ROOT + 'auto/generate_test_runner' -require UNITY_ROOT + 'auto/colour_reporter' +require UNITY_ROOT + '../auto/unity_test_summary' +require UNITY_ROOT + '../auto/generate_test_runner' +require UNITY_ROOT + '../auto/colour_reporter' module RakefileHelpers diff --git a/targets/clang_strict.yml b/test/targets/clang_strict.yml similarity index 91% rename from targets/clang_strict.yml rename to test/targets/clang_strict.yml index 6960e0a..3e2bdc2 100644 --- a/targets/clang_strict.yml +++ b/test/targets/clang_strict.yml @@ -1,8 +1,8 @@ --- compiler: path: clang - source_path: 'src/' - unit_tests_path: &unit_tests_path 'test/' + source_path: '../src/' + unit_tests_path: &unit_tests_path 'tests/' build_path: &build_path 'build/' options: - '-c' diff --git a/targets/gcc_32.yml b/test/targets/gcc_32.yml similarity index 87% rename from targets/gcc_32.yml rename to test/targets/gcc_32.yml index 11c98aa..dbed355 100644 --- a/targets/gcc_32.yml +++ b/test/targets/gcc_32.yml @@ -1,7 +1,7 @@ compiler: path: gcc - source_path: 'src/' - unit_tests_path: &unit_tests_path 'test/' + source_path: '../src/' + unit_tests_path: &unit_tests_path 'tests/' build_path: &build_path 'build/' options: - '-c' diff --git a/targets/gcc_64.yml b/test/targets/gcc_64.yml similarity index 87% rename from targets/gcc_64.yml rename to test/targets/gcc_64.yml index 518b3b5..8f60340 100644 --- a/targets/gcc_64.yml +++ b/test/targets/gcc_64.yml @@ -1,7 +1,7 @@ compiler: path: gcc - source_path: 'src/' - unit_tests_path: &unit_tests_path 'test/' + source_path: '../src/' + unit_tests_path: &unit_tests_path 'tests/' build_path: &build_path 'build/' options: - '-c' diff --git a/targets/gcc_auto_limits.yml b/test/targets/gcc_auto_limits.yml similarity index 86% rename from targets/gcc_auto_limits.yml rename to test/targets/gcc_auto_limits.yml index c06cf75..72ed555 100644 --- a/targets/gcc_auto_limits.yml +++ b/test/targets/gcc_auto_limits.yml @@ -1,7 +1,7 @@ compiler: path: gcc - source_path: 'src/' - unit_tests_path: &unit_tests_path 'test/' + source_path: '../src/' + unit_tests_path: &unit_tests_path 'tests/' build_path: &build_path 'build/' options: - '-c' diff --git a/targets/gcc_auto_sizeof.yml b/test/targets/gcc_auto_sizeof.yml similarity index 86% rename from targets/gcc_auto_sizeof.yml rename to test/targets/gcc_auto_sizeof.yml index aa7c279..b7076ea 100644 --- a/targets/gcc_auto_sizeof.yml +++ b/test/targets/gcc_auto_sizeof.yml @@ -1,7 +1,7 @@ compiler: path: gcc - source_path: 'src/' - unit_tests_path: &unit_tests_path 'test/' + source_path: '../src/' + unit_tests_path: &unit_tests_path 'tests/' build_path: &build_path 'build/' options: - '-c' diff --git a/targets/gcc_auto_stdint.yml b/test/targets/gcc_auto_stdint.yml similarity index 86% rename from targets/gcc_auto_stdint.yml rename to test/targets/gcc_auto_stdint.yml index e49e268..855f587 100644 --- a/targets/gcc_auto_stdint.yml +++ b/test/targets/gcc_auto_stdint.yml @@ -1,7 +1,7 @@ compiler: path: gcc - source_path: 'src/' - unit_tests_path: &unit_tests_path 'test/' + source_path: '../src/' + unit_tests_path: &unit_tests_path 'tests/' build_path: &build_path 'build/' options: - '-c' diff --git a/targets/hitech_picc18.yml b/test/targets/hitech_picc18.yml similarity index 51% rename from targets/hitech_picc18.yml rename to test/targets/hitech_picc18.yml index eb08235..1e42989 100644 --- a/targets/hitech_picc18.yml +++ b/test/targets/hitech_picc18.yml @@ -1,11 +1,11 @@ -# rumor has it that this yaml file works for the standard edition of the +# rumor has it that this yaml file works for the standard edition of the # hitech PICC18 compiler, but not the pro version. # compiler: path: cd build && picc18 - source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' - unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' - build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' + build_path: &build_path 'build\' options: - --chip=18F87J10 - --ide=hitide @@ -19,7 +19,7 @@ compiler: - -Bl # Large memory model - -G # generate symbol file - --cp=16 # 16-bit pointers - - --double=24 + - --double=24 - -N255 # 255-char symbol names - --opt=none # Do not use any compiler optimziations - -c # compile only @@ -35,62 +35,62 @@ compiler: - 'c:/CMock/vendor/unity/examples/helper/' - *unit_tests_path defines: - prefix: '-D' - items: - - UNITY_INT_WIDTH=16 + prefix: '-D' + items: + - UNITY_INT_WIDTH=16 - UNITY_POINTER_WIDTH=16 - - CMOCK_MEM_STATIC + - CMOCK_MEM_STATIC - CMOCK_MEM_SIZE=3000 - - UNITY_SUPPORT_TEST_CASES + - UNITY_SUPPORT_TEST_CASES - _PICC18 - object_files: - # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead - extension: '.obj' - destination: *build_path + object_files: + # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead + extension: '.obj' + destination: *build_path -linker: - path: cd build && picc18 - options: - - --chip=18F87J10 - - --ide=hitide - - --cp=24 # 24-bit pointers. Is this needed for linker?? - - --double=24 # Is this needed for linker?? +linker: + path: cd build && picc18 + options: + - --chip=18F87J10 + - --ide=hitide + - --cp=24 # 24-bit pointers. Is this needed for linker?? + - --double=24 # Is this needed for linker?? - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory - - --summary=mem,file # info listing - - --summary=+psect - - --summary=+hex - - --output=+intel - - --output=+mcof - - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. - - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects - - --runtime=+clib # link in the c-runtime - - --runtime=+keep # Keep the generated startup src after its obj is linked - - -G # Generate src-level symbol file - - -MIWasTheLastToBuild.map - - --warn=0 # allow all normal warning messages - - -Bl # Large memory model (probably not needed for linking) - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.obj' - bin_files: - prefix: '-O' - extension: '.hex' - destination: *build_path + - --summary=mem,file # info listing + - --summary=+psect + - --summary=+hex + - --output=+intel + - --output=+mcof + - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. + - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects + - --runtime=+clib # link in the c-runtime + - --runtime=+keep # Keep the generated startup src after its obj is linked + - -G # Generate src-level symbol file + - -MIWasTheLastToBuild.map + - --warn=0 # allow all normal warning messages + - -Bl # Large memory model (probably not needed for linking) + includes: + prefix: '-I' + object_files: + path: *build_path + extension: '.obj' + bin_files: + prefix: '-O' + extension: '.hex' + destination: *build_path -simulator: - path: - pre_support: - - 'java -client -jar ' # note space - - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] - - 18F87J10 - post_support: +simulator: + path: + pre_support: + - 'java -client -jar ' # note space + - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] + - 18F87J10 + post_support: -:cmock: - :plugins: [] - :includes: - - Types.h +:cmock: + :plugins: [] + :includes: + - Types.h :suite_teardown: | if (num_failures) _FAILED_TEST(); @@ -98,4 +98,4 @@ simulator: _PASSED_TESTS(); return 0; -colour: true \ No newline at end of file +colour: true diff --git a/targets/iar_arm_v4.yml b/test/targets/iar_arm_v4.yml similarity index 90% rename from targets/iar_arm_v4.yml rename to test/targets/iar_arm_v4.yml index 529290c..ce847b9 100644 --- a/targets/iar_arm_v4.yml +++ b/test/targets/iar_arm_v4.yml @@ -1,8 +1,8 @@ tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' compiler: path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: 'src\' - unit_tests_path: &unit_tests_path 'test\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' build_path: &build_path 'build\' options: - --dlib_config @@ -14,7 +14,7 @@ compiler: - --no_code_motion - --no_tbaa - --no_clustering - - --no_scheduling + - --no_scheduling - --debug - --cpu_mode thumb - --endian little @@ -86,4 +86,4 @@ simulator: - sim colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: [] diff --git a/targets/iar_arm_v5.yml b/test/targets/iar_arm_v5.yml similarity index 90% rename from targets/iar_arm_v5.yml rename to test/targets/iar_arm_v5.yml index 915330a..22daad4 100644 --- a/targets/iar_arm_v5.yml +++ b/test/targets/iar_arm_v5.yml @@ -1,8 +1,8 @@ tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' compiler: path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: 'src\' - unit_tests_path: &unit_tests_path 'test\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' build_path: &build_path 'build\' options: - --dlib_config @@ -13,7 +13,7 @@ compiler: - --no_code_motion - --no_tbaa - --no_clustering - - --no_scheduling + - --no_scheduling - --debug - --cpu_mode thumb - --endian=little @@ -76,4 +76,4 @@ simulator: - sim colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: [] diff --git a/targets/iar_arm_v5_3.yml b/test/targets/iar_arm_v5_3.yml similarity index 90% rename from targets/iar_arm_v5_3.yml rename to test/targets/iar_arm_v5_3.yml index 915330a..22daad4 100644 --- a/targets/iar_arm_v5_3.yml +++ b/test/targets/iar_arm_v5_3.yml @@ -1,8 +1,8 @@ tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' compiler: path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: 'src\' - unit_tests_path: &unit_tests_path 'test\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' build_path: &build_path 'build\' options: - --dlib_config @@ -13,7 +13,7 @@ compiler: - --no_code_motion - --no_tbaa - --no_clustering - - --no_scheduling + - --no_scheduling - --debug - --cpu_mode thumb - --endian=little @@ -76,4 +76,4 @@ simulator: - sim colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: [] diff --git a/targets/iar_armcortex_LM3S9B92_v5_4.yml b/test/targets/iar_armcortex_LM3S9B92_v5_4.yml similarity index 88% rename from targets/iar_armcortex_LM3S9B92_v5_4.yml rename to test/targets/iar_armcortex_LM3S9B92_v5_4.yml index 8f10a0e..91c184d 100644 --- a/targets/iar_armcortex_LM3S9B92_v5_4.yml +++ b/test/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -2,10 +2,10 @@ tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' compiler: path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: 'src\' - unit_tests_path: &unit_tests_path 'test\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' build_path: &build_path 'build\' - options: + options: - --diag_suppress=Pa050 #- --diag_suppress=Pe111 - --debug @@ -27,7 +27,7 @@ compiler: # - --no_code_motion # - --no_tbaa # - --no_clustering -# - --no_scheduling +# - --no_scheduling includes: prefix: '-I' @@ -59,7 +59,7 @@ linker: - --semihosting - --entry __iar_program_start - --config - - [*tools_root, 'arm\config\generic.icf'] + - [*tools_root, 'arm\config\generic.icf'] # - ['C:\Temp\lm3s9b92.icf'] object_files: path: *build_path @@ -90,4 +90,4 @@ simulator: #- sim colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: [] diff --git a/targets/iar_cortexm3_v5.yml b/test/targets/iar_cortexm3_v5.yml similarity index 91% rename from targets/iar_cortexm3_v5.yml rename to test/targets/iar_cortexm3_v5.yml index 480b255..30d7178 100644 --- a/targets/iar_cortexm3_v5.yml +++ b/test/targets/iar_cortexm3_v5.yml @@ -3,8 +3,8 @@ tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' compiler: path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: 'src\' - unit_tests_path: &unit_tests_path 'test\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' build_path: &build_path 'build\' options: - --dlib_config @@ -80,4 +80,4 @@ simulator: - sim colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: [] diff --git a/targets/iar_msp430.yml b/test/targets/iar_msp430.yml similarity index 92% rename from targets/iar_msp430.yml rename to test/targets/iar_msp430.yml index 177e08b..a36d27f 100644 --- a/targets/iar_msp430.yml +++ b/test/targets/iar_msp430.yml @@ -8,8 +8,8 @@ core_config: &core_config [*core_root, 'config\'] compiler: path: [*core_bin, 'icc430.exe'] - source_path: 'src\' - unit_tests_path: &unit_tests_path 'test\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' build_path: &build_path 'build\' options: - --dlib_config @@ -91,4 +91,4 @@ simulator: - -d sim colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: [] diff --git a/targets/iar_sh2a_v6.yml b/test/targets/iar_sh2a_v6.yml similarity index 91% rename from targets/iar_sh2a_v6.yml rename to test/targets/iar_sh2a_v6.yml index 657b32b..cb264f2 100644 --- a/targets/iar_sh2a_v6.yml +++ b/test/targets/iar_sh2a_v6.yml @@ -1,8 +1,8 @@ tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' compiler: path: [*tools_root, 'sh\bin\iccsh.exe'] - source_path: 'src\' - unit_tests_path: &unit_tests_path 'test\' + source_path: '..\src\' + unit_tests_path: &unit_tests_path 'tests\' build_path: &build_path 'build\' options: - -e @@ -82,4 +82,4 @@ simulator: - sim colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: [] diff --git a/test/test_generate_test_runner.rb b/test/tests/test_generate_test_runner.rb similarity index 100% rename from test/test_generate_test_runner.rb rename to test/tests/test_generate_test_runner.rb diff --git a/test/testparameterized.c b/test/tests/testparameterized.c similarity index 100% rename from test/testparameterized.c rename to test/tests/testparameterized.c diff --git a/test/testunity.c b/test/tests/testunity.c similarity index 100% rename from test/testunity.c rename to test/tests/testunity.c