mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-17 11:44:09 +08:00
rearranged project to centralize all self-test stuff under test directory. only pull in includes when required.
This commit is contained in:
@ -3,4 +3,4 @@ rvm:
|
|||||||
- "1.9.3"
|
- "1.9.3"
|
||||||
- "2.0.0"
|
- "2.0.0"
|
||||||
script:
|
script:
|
||||||
- rake ci
|
- cd test && rake ci
|
||||||
|
@ -3,7 +3,6 @@ UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/../..'
|
|||||||
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/clean'
|
require 'rake/clean'
|
||||||
require 'rake/testtask'
|
|
||||||
require HERE+'rakefile_helper'
|
require HERE+'rakefile_helper'
|
||||||
|
|
||||||
TEMP_DIRS = [
|
TEMP_DIRS = [
|
||||||
|
37
makefile
37
makefile
@ -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)
|
|
||||||
|
|
@ -5,8 +5,6 @@
|
|||||||
============================================================================ */
|
============================================================================ */
|
||||||
|
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
|
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
|
||||||
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 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
|
#ifdef UNITY_FLOAT_VERBOSE
|
||||||
|
#include <string.h>
|
||||||
void UnityPrintFloat(_UF number)
|
void UnityPrintFloat(_UF number)
|
||||||
{
|
{
|
||||||
char TempBuffer[32];
|
char TempBuffer[32];
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#ifndef UNITY_FRAMEWORK_H
|
#ifndef UNITY_FRAMEWORK_H
|
||||||
#define UNITY_FRAMEWORK_H
|
#define UNITY_FRAMEWORK_H
|
||||||
|
|
||||||
#define UNITY
|
#define UNITY
|
||||||
|
|
||||||
#include "unity_internals.h"
|
#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_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_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)
|
#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
|
#endif
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "unity_config.h"
|
#include "unity_config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
// Unity Attempts to Auto-Detect Integer Types
|
// Unity Attempts to Auto-Detect Integer Types
|
||||||
@ -241,7 +240,7 @@ typedef UNITY_FLOAT_TYPE _UF;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
//Floating Point Support
|
//Double Floating Point Support
|
||||||
#ifndef UNITY_DOUBLE_PRECISION
|
#ifndef UNITY_DOUBLE_PRECISION
|
||||||
#define UNITY_DOUBLE_PRECISION (1e-12f)
|
#define UNITY_DOUBLE_PRECISION (1e-12f)
|
||||||
#endif
|
#endif
|
||||||
@ -252,16 +251,27 @@ typedef UNITY_DOUBLE_TYPE _UD;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNITY_DOUBLE_VERBOSE
|
||||||
|
#ifndef UNITY_FLOAT_VERBOSE
|
||||||
|
#define UNITY_FLOAT_VERBOSE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// Output Method
|
// Output Method
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|
||||||
#ifndef UNITY_OUTPUT_CHAR
|
#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)
|
#define UNITY_OUTPUT_CHAR(a) putchar(a)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
//If defined as something else, make sure we declare it here so it's ready for use
|
//If defined as something else, make sure we declare it here so it's ready for use
|
||||||
extern int UNITY_OUTPUT_CHAR(int);
|
extern int UNITY_OUTPUT_CHAR(int);
|
||||||
|
|
||||||
#endif
|
#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)
|
#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
|
#endif
|
||||||
|
|
||||||
|
//End of UNITY_INTERNALS_H
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +8,6 @@ UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/'
|
|||||||
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/clean'
|
require 'rake/clean'
|
||||||
require 'rake/testtask'
|
|
||||||
require UNITY_ROOT + 'rakefile_helper'
|
require UNITY_ROOT + 'rakefile_helper'
|
||||||
|
|
||||||
TEMP_DIRS = [
|
TEMP_DIRS = [
|
||||||
@ -25,12 +24,7 @@ task :prepare_for_tests => TEMP_DIRS
|
|||||||
include RakefileHelpers
|
include RakefileHelpers
|
||||||
|
|
||||||
# Load proper GCC as defult configuration
|
# Load proper GCC as defult configuration
|
||||||
if 1.size == 8 # 8 bytes => 64-bits
|
DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml'
|
||||||
DEFAULT_CONFIG_FILE = 'gcc_64.yml'
|
|
||||||
else # Assume 32-bit otherwise
|
|
||||||
DEFAULT_CONFIG_FILE = 'gcc_32.yml'
|
|
||||||
end
|
|
||||||
|
|
||||||
configure_toolchain(DEFAULT_CONFIG_FILE)
|
configure_toolchain(DEFAULT_CONFIG_FILE)
|
||||||
|
|
||||||
desc "Test unity with its own unit tests"
|
desc "Test unity with its own unit tests"
|
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require UNITY_ROOT + 'auto/unity_test_summary'
|
require UNITY_ROOT + '../auto/unity_test_summary'
|
||||||
require UNITY_ROOT + 'auto/generate_test_runner'
|
require UNITY_ROOT + '../auto/generate_test_runner'
|
||||||
require UNITY_ROOT + 'auto/colour_reporter'
|
require UNITY_ROOT + '../auto/colour_reporter'
|
||||||
|
|
||||||
module RakefileHelpers
|
module RakefileHelpers
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
compiler:
|
compiler:
|
||||||
path: clang
|
path: clang
|
||||||
source_path: 'src/'
|
source_path: '../src/'
|
||||||
unit_tests_path: &unit_tests_path 'test/'
|
unit_tests_path: &unit_tests_path 'tests/'
|
||||||
build_path: &build_path 'build/'
|
build_path: &build_path 'build/'
|
||||||
options:
|
options:
|
||||||
- '-c'
|
- '-c'
|
@ -1,7 +1,7 @@
|
|||||||
compiler:
|
compiler:
|
||||||
path: gcc
|
path: gcc
|
||||||
source_path: 'src/'
|
source_path: '../src/'
|
||||||
unit_tests_path: &unit_tests_path 'test/'
|
unit_tests_path: &unit_tests_path 'tests/'
|
||||||
build_path: &build_path 'build/'
|
build_path: &build_path 'build/'
|
||||||
options:
|
options:
|
||||||
- '-c'
|
- '-c'
|
@ -1,7 +1,7 @@
|
|||||||
compiler:
|
compiler:
|
||||||
path: gcc
|
path: gcc
|
||||||
source_path: 'src/'
|
source_path: '../src/'
|
||||||
unit_tests_path: &unit_tests_path 'test/'
|
unit_tests_path: &unit_tests_path 'tests/'
|
||||||
build_path: &build_path 'build/'
|
build_path: &build_path 'build/'
|
||||||
options:
|
options:
|
||||||
- '-c'
|
- '-c'
|
@ -1,7 +1,7 @@
|
|||||||
compiler:
|
compiler:
|
||||||
path: gcc
|
path: gcc
|
||||||
source_path: 'src/'
|
source_path: '../src/'
|
||||||
unit_tests_path: &unit_tests_path 'test/'
|
unit_tests_path: &unit_tests_path 'tests/'
|
||||||
build_path: &build_path 'build/'
|
build_path: &build_path 'build/'
|
||||||
options:
|
options:
|
||||||
- '-c'
|
- '-c'
|
@ -1,7 +1,7 @@
|
|||||||
compiler:
|
compiler:
|
||||||
path: gcc
|
path: gcc
|
||||||
source_path: 'src/'
|
source_path: '../src/'
|
||||||
unit_tests_path: &unit_tests_path 'test/'
|
unit_tests_path: &unit_tests_path 'tests/'
|
||||||
build_path: &build_path 'build/'
|
build_path: &build_path 'build/'
|
||||||
options:
|
options:
|
||||||
- '-c'
|
- '-c'
|
@ -1,7 +1,7 @@
|
|||||||
compiler:
|
compiler:
|
||||||
path: gcc
|
path: gcc
|
||||||
source_path: 'src/'
|
source_path: '../src/'
|
||||||
unit_tests_path: &unit_tests_path 'test/'
|
unit_tests_path: &unit_tests_path 'tests/'
|
||||||
build_path: &build_path 'build/'
|
build_path: &build_path 'build/'
|
||||||
options:
|
options:
|
||||||
- '-c'
|
- '-c'
|
@ -3,9 +3,9 @@
|
|||||||
#
|
#
|
||||||
compiler:
|
compiler:
|
||||||
path: cd build && picc18
|
path: cd build && picc18
|
||||||
source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --chip=18F87J10
|
- --chip=18F87J10
|
||||||
- --ide=hitide
|
- --ide=hitide
|
@ -1,8 +1,8 @@
|
|||||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
|
||||||
compiler:
|
compiler:
|
||||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
source_path: 'src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --dlib_config
|
- --dlib_config
|
@ -1,8 +1,8 @@
|
|||||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
|
||||||
compiler:
|
compiler:
|
||||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
source_path: 'src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --dlib_config
|
- --dlib_config
|
@ -1,8 +1,8 @@
|
|||||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
|
||||||
compiler:
|
compiler:
|
||||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
source_path: 'src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --dlib_config
|
- --dlib_config
|
@ -2,8 +2,8 @@
|
|||||||
tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\'
|
tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\'
|
||||||
compiler:
|
compiler:
|
||||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
source_path: 'src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --diag_suppress=Pa050
|
- --diag_suppress=Pa050
|
@ -3,8 +3,8 @@
|
|||||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\'
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\'
|
||||||
compiler:
|
compiler:
|
||||||
path: [*tools_root, 'arm\bin\iccarm.exe']
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
source_path: 'src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --dlib_config
|
- --dlib_config
|
@ -8,8 +8,8 @@ core_config: &core_config [*core_root, 'config\']
|
|||||||
|
|
||||||
compiler:
|
compiler:
|
||||||
path: [*core_bin, 'icc430.exe']
|
path: [*core_bin, 'icc430.exe']
|
||||||
source_path: 'src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --dlib_config
|
- --dlib_config
|
@ -1,8 +1,8 @@
|
|||||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\'
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\'
|
||||||
compiler:
|
compiler:
|
||||||
path: [*tools_root, 'sh\bin\iccsh.exe']
|
path: [*tools_root, 'sh\bin\iccsh.exe']
|
||||||
source_path: 'src\'
|
source_path: '..\src\'
|
||||||
unit_tests_path: &unit_tests_path 'test\'
|
unit_tests_path: &unit_tests_path 'tests\'
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- -e
|
- -e
|
Reference in New Issue
Block a user