rearranged project to centralize all self-test stuff under test directory. only pull in includes when required.

This commit is contained in:
Mark VanderVoord
2014-07-30 10:14:02 -04:00
parent f8f5c39e26
commit bff1fc68cb
25 changed files with 116 additions and 149 deletions

View File

@ -3,4 +3,4 @@ rvm:
- "1.9.3"
- "2.0.0"
script:
- rake ci
- cd test && rake ci

View File

@ -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 = [

View File

@ -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)

View File

@ -5,8 +5,6 @@
============================================================================ */
#include "unity.h"
#include <stdio.h>
#include <string.h>
#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 <string.h>
void UnityPrintFloat(_UF number)
{
char TempBuffer[32];

View File

@ -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

View File

@ -11,7 +11,6 @@
#include "unity_config.h"
#endif
#include <stdio.h>
#include <setjmp.h>
// 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 <stdio.h>
#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

View File

@ -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"

View File

@ -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

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -3,9 +3,9 @@
#
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -2,8 +2,8 @@
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:
- --diag_suppress=Pa050

View File

@ -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

View File

@ -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

View File

@ -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