mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-25 01:11:36 +01:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b899aec14 | ||
|
|
d8eb8414f4 | ||
|
|
05994f5061 | ||
|
|
fcab680286 | ||
|
|
3c1c5338af | ||
|
|
9e7c259822 | ||
|
|
ce132da37f | ||
|
|
ffb51ecb7e | ||
|
|
0b078cdb6e | ||
|
|
53e1449f89 | ||
|
|
830f77f9ee | ||
|
|
038dd81213 | ||
|
|
99fb90a939 | ||
|
|
b7469138a5 | ||
|
|
418c1635f2 | ||
|
|
386c540510 | ||
|
|
723b9fee53 | ||
|
|
76c3755fe3 | ||
|
|
c3afe99a77 | ||
|
|
98045925af | ||
|
|
62d0e7d68e | ||
|
|
52d5f59b72 | ||
|
|
09acb0b64f | ||
|
|
e640949eb3 | ||
|
|
6fecc8eb38 | ||
|
|
777ad17420 | ||
|
|
8bbfe1f5ac | ||
|
|
0126e4804c | ||
|
|
b4b1994bd7 | ||
|
|
fedd1495c2 | ||
|
|
a6a4e9766d | ||
|
|
06a668579f | ||
|
|
9760c4f14f | ||
|
|
f5ff3504b5 | ||
|
|
b0032caca4 | ||
|
|
dcb30731f8 | ||
|
|
77c394e975 | ||
|
|
87f382fbb2 | ||
|
|
97f6d55256 |
32
.github/workflows/main.yml
vendored
Normal file
32
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
# Continuous Integration Workflow: Test case suite run + validation build check
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
# Controls when the action will run.
|
||||||
|
# Triggers the workflow on push or pull request events but only for the master branch
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Job: Unit test suite
|
||||||
|
unit-tests:
|
||||||
|
name: "Unit Tests"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Install Ruby Testing Tools
|
||||||
|
- name: Setup Ruby Testing Tools
|
||||||
|
run: |
|
||||||
|
sudo gem install rspec
|
||||||
|
sudo gem install rubocop -v 0.57.2
|
||||||
|
|
||||||
|
# Checks out repository under $GITHUB_WORKSPACE
|
||||||
|
- name: Checkout Latest Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Run Tests
|
||||||
|
- name: Run All Unit Tests
|
||||||
|
run: |
|
||||||
|
cd test && rake ci
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,3 +9,5 @@ examples/example_1/test1.out
|
|||||||
examples/example_1/test2.out
|
examples/example_1/test2.out
|
||||||
examples/example_2/all_tests.out
|
examples/example_2/all_tests.out
|
||||||
examples/example_4/builddir
|
examples/example_4/builddir
|
||||||
|
*.sublime-project
|
||||||
|
*.sublime-workspace
|
||||||
|
|||||||
26
.travis.yml
26
.travis.yml
@@ -1,26 +0,0 @@
|
|||||||
sudo: required
|
|
||||||
language: ruby c
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
#- os: osx
|
|
||||||
# compiler: clang
|
|
||||||
# osx_image: xcode7.3
|
|
||||||
- os: linux
|
|
||||||
dist: trusty
|
|
||||||
rvm: "2.4"
|
|
||||||
compiler: gcc
|
|
||||||
- os: linux
|
|
||||||
dist: xenial
|
|
||||||
rvm: "2.7"
|
|
||||||
compiler: clang
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install --assume-yes --quiet gcc-multilib; fi
|
|
||||||
|
|
||||||
install:
|
|
||||||
- gem install rspec
|
|
||||||
- gem install rubocop -v 0.57.2
|
|
||||||
|
|
||||||
script:
|
|
||||||
- cd test && rake ci
|
|
||||||
@@ -41,6 +41,21 @@ project(unity
|
|||||||
DESCRIPTION "C Unit testing framework."
|
DESCRIPTION "C Unit testing framework."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Options to Build With Extras -------------------------------------------------
|
||||||
|
option(UNITY_EXTENSION_FIXTURE "Compiles Unity with the \"fixture\" extension." OFF)
|
||||||
|
option(UNITY_EXTENSION_MEMORY "Compiles Unity with the \"memory\" extension." OFF)
|
||||||
|
|
||||||
|
set(UNITY_EXTENSION_FIXTURE_ENABLED $<BOOL:${UNITY_EXTENSION_FIXTURE}>)
|
||||||
|
set(UNITY_EXTENSION_MEMORY_ENABLED $<OR:${UNITY_EXTENSION_FIXTURE_ENABLED},$<BOOL:${UNITY_EXTENSION_MEMORY}>>)
|
||||||
|
|
||||||
|
if(${UNITY_EXTENSION_FIXTURE})
|
||||||
|
message(STATUS "Unity: Bulding with the fixture extension.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${UNITY_EXTENSION_MEMORY})
|
||||||
|
message(STATUS "Unity: Bulding with the memory extension.")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Main target ------------------------------------------------------------------
|
# Main target ------------------------------------------------------------------
|
||||||
add_library(${PROJECT_NAME} STATIC)
|
add_library(${PROJECT_NAME} STATIC)
|
||||||
add_library(${PROJECT_NAME}::framework ALIAS ${PROJECT_NAME})
|
add_library(${PROJECT_NAME}::framework ALIAS ${PROJECT_NAME})
|
||||||
@@ -52,6 +67,8 @@ include(CMakePackageConfigHelpers)
|
|||||||
target_sources(${PROJECT_NAME}
|
target_sources(${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/unity.c
|
src/unity.c
|
||||||
|
$<$<BOOL:${UNITY_EXTENSION_FIXTURE_ENABLED}>:extras/fixture/src/unity_fixture.c>
|
||||||
|
$<$<BOOL:${UNITY_EXTENSION_MEMORY_ENABLED}>:extras/memory/src/unity_memory.c>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME}
|
target_include_directories(${PROJECT_NAME}
|
||||||
@@ -59,10 +76,16 @@ target_include_directories(${PROJECT_NAME}
|
|||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
|
||||||
|
$<BUILD_INTERFACE:$<$<BOOL:${UNITY_EXTENSION_MEMORY_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/memory/src>>
|
||||||
|
$<BUILD_INTERFACE:$<$<BOOL:${UNITY_EXTENSION_FIXTURE_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/fixture/src>>
|
||||||
)
|
)
|
||||||
|
|
||||||
set(${PROJECT_NAME}_PUBLIC_HEADERS src/unity.h
|
set(${PROJECT_NAME}_PUBLIC_HEADERS
|
||||||
src/unity_internals.h
|
src/unity.h
|
||||||
|
src/unity_internals.h
|
||||||
|
$<$<BOOL:${UNITY_EXTENSION_FIXTURE_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/fixture/src/unity_fixture.h>
|
||||||
|
$<$<BOOL:${UNITY_EXTENSION_FIXTURE_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/fixture/src/unity_fixture_internals.h>
|
||||||
|
$<$<BOOL:${UNITY_EXTENSION_MEMORY_ENABLED}>:${CMAKE_CURRENT_SOURCE_DIR}/extras/memory/src/unity_memory.h>
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME}
|
set_target_properties(${PROJECT_NAME}
|
||||||
@@ -86,7 +109,9 @@ target_compile_options(${PROJECT_NAME}
|
|||||||
-Wno-missing-braces
|
-Wno-missing-braces
|
||||||
-Wold-style-cast
|
-Wold-style-cast
|
||||||
-Wshadow
|
-Wshadow
|
||||||
-Wweak-vtables>
|
-Wweak-vtables
|
||||||
|
-Werror
|
||||||
|
-Wall>
|
||||||
$<$<C_COMPILER_ID:GNU>:-Waddress
|
$<$<C_COMPILER_ID:GNU>:-Waddress
|
||||||
-Waggregate-return
|
-Waggregate-return
|
||||||
-Wformat-nonliteral
|
-Wformat-nonliteral
|
||||||
@@ -101,9 +126,10 @@ target_compile_options(${PROJECT_NAME}
|
|||||||
-Wno-unused-parameter
|
-Wno-unused-parameter
|
||||||
-Wunreachable-code
|
-Wunreachable-code
|
||||||
-Wwrite-strings
|
-Wwrite-strings
|
||||||
-Wpointer-arith>
|
-Wpointer-arith
|
||||||
-Wall
|
-Werror
|
||||||
-Werror
|
-Wall>
|
||||||
|
$<$<C_COMPILER_ID:MSVC>:/Wall>
|
||||||
)
|
)
|
||||||
|
|
||||||
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
|
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) <year> 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
|
Copyright (c) <year> 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -1,8 +1,17 @@
|
|||||||
Unity Test API
|
Unity Test 
|
||||||
==============
|
==========
|
||||||
|
__Copyright (c) 2007 - 2021 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
|
||||||
|
|
||||||
[](https://travis-ci.org/ThrowTheSwitch/Unity)
|
Welcome to the Unity Test Project, one of the main projects of ThrowTheSwitch.org. Unity Test is a
|
||||||
__Copyright (c) 2007 - 2020 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
|
unit testing framework built for C, with a focus on working with embedded toolchains.
|
||||||
|
|
||||||
|
This project is made to test code targetting microcontrollers big and small. The core project is a
|
||||||
|
single C file and a pair of headers, allowing it to the added to your existing build setup without
|
||||||
|
too much headache. You may use any compiler you wish, and may use most existing build systems
|
||||||
|
including make, cmake, etc. If you'd like to leave the hard work to us, you might be interested
|
||||||
|
in Ceedling, a build tool also by ThrowTheSwitch.org.
|
||||||
|
|
||||||
|
If you're new to Unity, we encourage you to tour the [getting started guide](docs/UnityGettingStartedGuide.md)
|
||||||
|
|
||||||
Getting Started
|
Getting Started
|
||||||
===============
|
===============
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ require 'fileutils'
|
|||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
|
||||||
# TEMPLATE_TST
|
# TEMPLATE_TST
|
||||||
TEMPLATE_TST ||= '#include "unity.h"
|
TEMPLATE_TST ||= '#ifdef TEST
|
||||||
|
|
||||||
|
#include "unity.h"
|
||||||
|
|
||||||
%2$s#include "%1$s.h"
|
%2$s#include "%1$s.h"
|
||||||
|
|
||||||
@@ -29,6 +31,8 @@ void test_%4$s_NeedToImplement(void)
|
|||||||
{
|
{
|
||||||
TEST_IGNORE_MESSAGE("Need to Implement %1$s");
|
TEST_IGNORE_MESSAGE("Need to Implement %1$s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // TEST
|
||||||
'.freeze
|
'.freeze
|
||||||
|
|
||||||
# TEMPLATE_SRC
|
# TEMPLATE_SRC
|
||||||
@@ -164,22 +168,19 @@ class UnityModuleGenerator
|
|||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
def neutralize_filename(name, start_cap=true)
|
def neutralize_filename(name, start_cap = true)
|
||||||
return name if name.empty?
|
return name if name.empty?
|
||||||
name = name.split(/(?:\s+|_|(?=[A-Z][a-z]))|(?<=[a-z])(?=[A-Z])/).map{|v|v.capitalize}.join('_')
|
name = name.split(/(?:\s+|_|(?=[A-Z][a-z]))|(?<=[a-z])(?=[A-Z])/).map { |v| v.capitalize }.join('_')
|
||||||
if start_cap
|
name = name[0].downcase + name[1..-1] unless start_cap
|
||||||
return name
|
return name
|
||||||
else
|
|
||||||
return name[0].downcase + name[1..-1]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
############################
|
############################
|
||||||
def create_filename(part1, part2 = '')
|
def create_filename(part1, part2 = '')
|
||||||
name = part2.empty? ? part1 : part1 + '_' + part2
|
name = part2.empty? ? part1 : part1 + '_' + part2
|
||||||
case (@options[:naming])
|
case (@options[:naming])
|
||||||
when 'bumpy' then neutralize_filename(name,false).gsub('_','')
|
when 'bumpy' then neutralize_filename(name,false).delete('_')
|
||||||
when 'camel' then neutralize_filename(name).gsub('_','')
|
when 'camel' then neutralize_filename(name).delete('_')
|
||||||
when 'snake' then neutralize_filename(name).downcase
|
when 'snake' then neutralize_filename(name).downcase
|
||||||
when 'caps' then neutralize_filename(name).upcase
|
when 'caps' then neutralize_filename(name).upcase
|
||||||
else name
|
else name
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ class UnityTestRunnerGenerator
|
|||||||
mock_headers = []
|
mock_headers = []
|
||||||
includes.each do |include_path|
|
includes.each do |include_path|
|
||||||
include_file = File.basename(include_path)
|
include_file = File.basename(include_path)
|
||||||
mock_headers << include_path if include_file =~ /^#{@options[:mock_prefix]}.*#{@options[:mock_suffix]}$/i
|
mock_headers << include_path if include_file =~ /^#{@options[:mock_prefix]}.*#{@options[:mock_suffix]}\.h$/i
|
||||||
end
|
end
|
||||||
mock_headers
|
mock_headers
|
||||||
end
|
end
|
||||||
@@ -206,7 +206,7 @@ class UnityTestRunnerGenerator
|
|||||||
@options[:has_setup] = source =~ /void\s+#{@options[:setup_name]}\s*\(/
|
@options[:has_setup] = source =~ /void\s+#{@options[:setup_name]}\s*\(/
|
||||||
@options[:has_teardown] = source =~ /void\s+#{@options[:teardown_name]}\s*\(/
|
@options[:has_teardown] = source =~ /void\s+#{@options[:teardown_name]}\s*\(/
|
||||||
@options[:has_suite_setup] ||= (source =~ /void\s+suiteSetUp\s*\(/)
|
@options[:has_suite_setup] ||= (source =~ /void\s+suiteSetUp\s*\(/)
|
||||||
@options[:has_suite_teardown] ||= (source =~ /void\s+suiteTearDown\s*\(/)
|
@options[:has_suite_teardown] ||= (source =~ /int\s+suiteTearDown\s*\(int\s+([a-zA-Z0-9_])+\s*\)/)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_header(output, mocks, testfile_includes = [])
|
def create_header(output, mocks, testfile_includes = [])
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*=======Test Runner Used To Run Each Test=====*/
|
/*=======Test Runner Used To Run Each Test=====*/
|
||||||
static void run_test(UnityTestFunction func, const char* name, int line_num)
|
static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num)
|
||||||
{
|
{
|
||||||
Unity.CurrentTestName = name;
|
Unity.CurrentTestName = name;
|
||||||
Unity.CurrentTestLineNumber = line_num;
|
Unity.CurrentTestLineNumber = line_num;
|
||||||
|
|||||||
36
meson.build
36
meson.build
@@ -7,42 +7,8 @@
|
|||||||
project('unity', 'c',
|
project('unity', 'c',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=0.53.0',
|
meson_version: '>=0.53.0',
|
||||||
default_options: ['layout=flat', 'warning_level=3', 'werror=true', 'c_std=c11']
|
default_options: ['werror=true', 'c_std=c11']
|
||||||
)
|
)
|
||||||
lang = 'c'
|
|
||||||
cc = meson.get_compiler(lang)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Meson: Add compiler flags
|
|
||||||
if cc.get_id() == 'clang'
|
|
||||||
add_project_arguments(cc.get_supported_arguments(
|
|
||||||
[
|
|
||||||
'-Wexit-time-destructors',
|
|
||||||
'-Wglobal-constructors',
|
|
||||||
'-Wmissing-prototypes',
|
|
||||||
'-Wmissing-noreturn',
|
|
||||||
'-Wno-missing-braces',
|
|
||||||
'-Wold-style-cast', '-Wpointer-arith', '-Wweak-vtables',
|
|
||||||
'-Wcast-align', '-Wconversion', '-Wcast-qual', '-Wshadow'
|
|
||||||
]
|
|
||||||
), language: lang)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if cc.get_argument_syntax() == 'gcc'
|
|
||||||
add_project_arguments(cc.get_supported_arguments(
|
|
||||||
[
|
|
||||||
'-Wformat', '-Waddress', '-Winit-self', '-Wno-multichar',
|
|
||||||
'-Wpointer-arith' , '-Wwrite-strings' ,
|
|
||||||
'-Wno-parentheses' , '-Wno-type-limits' ,
|
|
||||||
'-Wformat-security' , '-Wunreachable-code' ,
|
|
||||||
'-Waggregate-return' , '-Wformat-nonliteral' ,
|
|
||||||
'-Wmissing-declarations', '-Wmissing-include-dirs' ,
|
|
||||||
'-Wno-unused-parameter'
|
|
||||||
]
|
|
||||||
), language: lang)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
|
||||||
# Sub directory to project source code
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)
|
unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)
|
||||||
|
|||||||
@@ -7,5 +7,5 @@
|
|||||||
unity_dir = include_directories('.')
|
unity_dir = include_directories('.')
|
||||||
|
|
||||||
unity_lib = static_library(meson.project_name(),
|
unity_lib = static_library(meson.project_name(),
|
||||||
sources: ['unity.c'],
|
files('unity.c'),
|
||||||
include_directories: unity_dir)
|
include_directories: unity_dir)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
Unity Project - A Test Framework for C
|
Unity Project - A Test Framework for C
|
||||||
Copyright (c) 2007-19 Mike Karlesky, Mark VanderVoord, Greg Williams
|
Copyright (c) 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||||
[Released under MIT License. Please refer to license.txt for details]
|
[Released under MIT License. Please refer to license.txt for details]
|
||||||
============================================================================ */
|
============================================================================ */
|
||||||
|
|
||||||
@@ -67,9 +67,10 @@ static const char PROGMEM UnityStrBreaker[] = "------------------
|
|||||||
static const char PROGMEM UnityStrResultsTests[] = " Tests ";
|
static const char PROGMEM UnityStrResultsTests[] = " Tests ";
|
||||||
static const char PROGMEM UnityStrResultsFailures[] = " Failures ";
|
static const char PROGMEM UnityStrResultsFailures[] = " Failures ";
|
||||||
static const char PROGMEM UnityStrResultsIgnored[] = " Ignored ";
|
static const char PROGMEM UnityStrResultsIgnored[] = " Ignored ";
|
||||||
|
#ifndef UNITY_EXCLUDE_DETAILS
|
||||||
static const char PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
|
static const char PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
|
||||||
static const char PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
|
static const char PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
|
||||||
|
#endif
|
||||||
/*-----------------------------------------------
|
/*-----------------------------------------------
|
||||||
* Pretty Printers & Test Result Output Handlers
|
* Pretty Printers & Test Result Output Handlers
|
||||||
*-----------------------------------------------*/
|
*-----------------------------------------------*/
|
||||||
@@ -1001,7 +1002,7 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
|
|||||||
is_trait = !isinf(actual) && !isnan(actual);
|
is_trait = !isinf(actual) && !isnan(actual);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default: /* including UNITY_FLOAT_INVALID_TRAIT */
|
||||||
trait_index = 0;
|
trait_index = 0;
|
||||||
trait_names[0] = UnityStrInvalidFloatTrait;
|
trait_names[0] = UnityStrInvalidFloatTrait;
|
||||||
break;
|
break;
|
||||||
@@ -1141,7 +1142,7 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
|||||||
is_trait = !isinf(actual) && !isnan(actual);
|
is_trait = !isinf(actual) && !isnan(actual);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default: /* including UNITY_FLOAT_INVALID_TRAIT */
|
||||||
trait_index = 0;
|
trait_index = 0;
|
||||||
trait_names[0] = UnityStrInvalidFloatTrait;
|
trait_names[0] = UnityStrInvalidFloatTrait;
|
||||||
break;
|
break;
|
||||||
|
|||||||
12
src/unity.h
12
src/unity.h
@@ -1,6 +1,6 @@
|
|||||||
/* ==========================================
|
/* ==========================================
|
||||||
Unity Project - A Test Framework for C
|
Unity Project - A Test Framework for C
|
||||||
Copyright (c) 2007-19 Mike Karlesky, Mark VanderVoord, Greg Williams
|
Copyright (c) 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||||
[Released under MIT License. Please refer to license.txt for details]
|
[Released under MIT License. Please refer to license.txt for details]
|
||||||
========================================== */
|
========================================== */
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#define UNITY_VERSION_MAJOR 2
|
#define UNITY_VERSION_MAJOR 2
|
||||||
#define UNITY_VERSION_MINOR 5
|
#define UNITY_VERSION_MINOR 5
|
||||||
#define UNITY_VERSION_BUILD 1
|
#define UNITY_VERSION_BUILD 2
|
||||||
#define UNITY_VERSION ((UNITY_VERSION_MAJOR << 16) | (UNITY_VERSION_MINOR << 8) | UNITY_VERSION_BUILD)
|
#define UNITY_VERSION ((UNITY_VERSION_MAJOR << 16) | (UNITY_VERSION_MINOR << 8) | UNITY_VERSION_BUILD)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -150,10 +150,10 @@ void verifyTest(void);
|
|||||||
#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL)
|
||||||
#define TEST_ASSERT_EQUAL_CHAR(expected, actual) UNITY_TEST_ASSERT_EQUAL_CHAR((expected), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_EQUAL_CHAR(expected, actual) UNITY_TEST_ASSERT_EQUAL_CHAR((expected), (actual), __LINE__, NULL)
|
||||||
#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL)
|
||||||
#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(-1), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT)(-1), (actual), __LINE__, NULL)
|
||||||
#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(0), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT)(0), (actual), __LINE__, NULL)
|
||||||
#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-1), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT)1 << (bit)), (UNITY_UINT)(-1), (actual), __LINE__, NULL)
|
||||||
#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(0), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT)1 << (bit)), (UNITY_UINT)(0), (actual), __LINE__, NULL)
|
||||||
|
|
||||||
/* Integer Not Equal To (of all sizes) */
|
/* Integer Not Equal To (of all sizes) */
|
||||||
#define TEST_ASSERT_NOT_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
#define TEST_ASSERT_NOT_EQUAL_INT(threshold, actual) UNITY_TEST_ASSERT_NOT_EQUAL_INT((threshold), (actual), __LINE__, NULL)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* ==========================================
|
/* ==========================================
|
||||||
Unity Project - A Test Framework for C
|
Unity Project - A Test Framework for C
|
||||||
Copyright (c) 2007-19 Mike Karlesky, Mark VanderVoord, Greg Williams
|
Copyright (c) 2007-21 Mike Karlesky, Mark VanderVoord, Greg Williams
|
||||||
[Released under MIT License. Please refer to license.txt for details]
|
[Released under MIT License. Please refer to license.txt for details]
|
||||||
========================================== */
|
========================================== */
|
||||||
|
|
||||||
@@ -40,6 +40,12 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __GNUC__
|
||||||
|
# define UNITY_FUNCTION_ATTR(a) __attribute__((a))
|
||||||
|
#else
|
||||||
|
# define UNITY_FUNCTION_ATTR(a) /* ignore */
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-------------------------------------------------------
|
/*-------------------------------------------------------
|
||||||
* Guess Widths If Not Specified
|
* Guess Widths If Not Specified
|
||||||
*-------------------------------------------------------*/
|
*-------------------------------------------------------*/
|
||||||
@@ -611,8 +617,14 @@ void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
|
|||||||
const UNITY_DISPLAY_STYLE_T style,
|
const UNITY_DISPLAY_STYLE_T style,
|
||||||
const UNITY_FLAGS_T flags);
|
const UNITY_FLAGS_T flags);
|
||||||
|
|
||||||
|
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||||
|
void UnityFail(const char* message, const UNITY_LINE_TYPE line) UNITY_FUNCTION_ATTR(noreturn);
|
||||||
|
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line) UNITY_FUNCTION_ATTR(noreturn);
|
||||||
|
#else
|
||||||
void UnityFail(const char* message, const UNITY_LINE_TYPE line);
|
void UnityFail(const char* message, const UNITY_LINE_TYPE line);
|
||||||
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
|
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
|
||||||
|
#endif
|
||||||
|
|
||||||
void UnityMessage(const char* message, const UNITY_LINE_TYPE line);
|
void UnityMessage(const char* message, const UNITY_LINE_TYPE line);
|
||||||
|
|
||||||
#ifndef UNITY_EXCLUDE_FLOAT
|
#ifndef UNITY_EXCLUDE_FLOAT
|
||||||
@@ -701,11 +713,8 @@ extern const char UnityStrErrShorthand[];
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNITY_SUPPORT_VARIADIC_MACROS
|
#ifdef UNITY_SUPPORT_VARIADIC_MACROS
|
||||||
#define RUN_TEST(...) UnityDefaultTestRun(RUN_TEST_FIRST(__VA_ARGS__), RUN_TEST_SECOND(__VA_ARGS__))
|
#define RUN_TEST(...) RUN_TEST_AT_LINE(__VA_ARGS__, __LINE__, throwaway)
|
||||||
#define RUN_TEST_FIRST(...) RUN_TEST_FIRST_HELPER(__VA_ARGS__, throwaway)
|
#define RUN_TEST_AT_LINE(func, line, ...) UnityDefaultTestRun(func, #func, line)
|
||||||
#define RUN_TEST_FIRST_HELPER(first, ...) (first), #first
|
|
||||||
#define RUN_TEST_SECOND(...) RUN_TEST_SECOND_HELPER(__VA_ARGS__, __LINE__, throwaway)
|
|
||||||
#define RUN_TEST_SECOND_HELPER(first, second, ...) (second)
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ endif
|
|||||||
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
|
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
|
||||||
#CFLAGS += -Wconversion #disabled because if falsely complains about the isinf and isnan macros
|
#CFLAGS += -Wconversion #disabled because if falsely complains about the isinf and isnan macros
|
||||||
CFLAGS += -Wno-switch-enum -Wno-double-promotion
|
CFLAGS += -Wno-switch-enum -Wno-double-promotion
|
||||||
|
CFLAGS += -Wno-poison-system-directories
|
||||||
CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstrict-overflow \
|
CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstrict-overflow \
|
||||||
-Wstrict-prototypes -Wswitch-default -Wundef
|
-Wstrict-prototypes -Wswitch-default -Wundef
|
||||||
#DEBUG = -O0 -g
|
#DEBUG = -O0 -g
|
||||||
|
|||||||
@@ -300,8 +300,8 @@ module RakefileHelpers
|
|||||||
|
|
||||||
def run_make_tests()
|
def run_make_tests()
|
||||||
[ "make -s", # test with all defaults
|
[ "make -s", # test with all defaults
|
||||||
"make -s DEBUG=-m32", # test 32-bit architecture with 64-bit support
|
#"make -s DEBUG=-m32", # test 32-bit architecture with 64-bit support
|
||||||
"make -s DEBUG=-m32 UNITY_SUPPORT_64=", # test 32-bit build without 64-bit types
|
#"make -s DEBUG=-m32 UNITY_SUPPORT_64=", # test 32-bit build without 64-bit types
|
||||||
"make -s UNITY_INCLUDE_DOUBLE= ", # test without double
|
"make -s UNITY_INCLUDE_DOUBLE= ", # test without double
|
||||||
"cd #{File.join("..","extras","fixture",'test')} && make -s default noStdlibMalloc",
|
"cd #{File.join("..","extras","fixture",'test')} && make -s default noStdlibMalloc",
|
||||||
"cd #{File.join("..","extras","fixture",'test')} && make -s C89",
|
"cd #{File.join("..","extras","fixture",'test')} && make -s C89",
|
||||||
|
|||||||
Reference in New Issue
Block a user