1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 08:25:58 +01:00

39 Commits

Author SHA1 Message Date
Mark VanderVoord
0b899aec14 Fix conditional issue in generator script.
Bump version.
2021-01-26 08:59:27 -05:00
Mark VanderVoord
d8eb8414f4 Stop noticing my sublime files. ;) 2021-01-16 21:20:09 -05:00
Mark VanderVoord
05994f5061 Merge pull request #536 from ThrowTheSwitch/test/switch_to_actions
Attempt to get Actions Working
2021-01-16 21:05:49 -05:00
Mark VanderVoord
fcab680286 Ruby script cleanup.
Fix warnings.
Remove 32-bit tests from standard suite because they're not running on most platforms.
2021-01-16 21:03:18 -05:00
Mark VanderVoord
3c1c5338af Need to checkout.
Drop Slack support
2021-01-16 20:27:49 -05:00
Mark VanderVoord
9e7c259822 Do we need to be admin to install gems? 2021-01-16 20:19:29 -05:00
Mark VanderVoord
ce132da37f Merge pull request #535 from ThrowTheSwitch/test/switch_to_actions
Switch from Travis to Github Actions.
2021-01-16 20:15:22 -05:00
Mark VanderVoord
ffb51ecb7e Switch from Travis to Github Actions.
Update year in docs.
2021-01-16 20:05:20 -05:00
Mark VanderVoord
0b078cdb6e Merge pull request #533 from carsonalh/master
Fixed CMake install when compiled with extensions
2021-01-08 09:01:41 -05:00
Carson Holloway
53e1449f89 Fixed CMake install when compiled with extensions
This is a fix from the change I made in
`commit 418c1635f2f1bcd353b6fce23a16594c914047b8`
where I added options to compile unity with the `fixture` and `memory`
extensions:

In that version, Unity had been able to build, but there were some issues when
trying to install it. Namely, the CMake generator expressions were not
evaluated correctly, and it would try to install with a path that had
un-expanded generator commands in it, which would obviously fail and throw an
error. I've got a feeling that this is a bug with CMake, but for now the
workaround that worked in [this stackoverflow
post](https://stackoverflow.com/questions/51541678/nested-cmake-generator-expressions-are-only-partially-evaluated)
seemed to work here, as well.

Another issue with that commit was that it tried to include a
`unity_memory_internals.h` file, which did not exist. This has also been
resolved.
2021-01-08 10:34:38 +10:00
Mark VanderVoord
830f77f9ee Merge pull request #509 from alecoding/issue_507
Fix warning for issue #507
2021-01-07 18:08:51 -05:00
Mark VanderVoord
038dd81213 Merge pull request #520 from softwareinmotion/runner_mock_suffix
parse mock files correctly
2021-01-07 18:08:09 -05:00
Mark VanderVoord
99fb90a939 Merge pull request #522 from JuPrgn/master
Add guard TEST on test module template
2021-01-07 18:05:48 -05:00
Mark VanderVoord
b7469138a5 Merge pull request #530 from carsonalh/master
Added options to compile "fixture" and "memory" extensions in CMakeLists
2021-01-07 18:05:05 -05:00
Carson Holloway
418c1635f2 Added option to compile fixture and memory extensions in CMakeLists.txt 2020-12-20 12:58:11 +11:00
Mark VanderVoord
386c540510 Merge pull request #524 from sardior/exlude-details-compile-fix
Update unity.c
2020-10-12 08:36:48 -04:00
Robert Sławomir Kőműves
723b9fee53 Update unity.c
UNITY_EXCLUDE_DETAILS caused a compile error here due to UNITY_DETAIL{1,2}_NAME declaration already being skipped.
2020-10-08 00:55:47 +02:00
Julien PEYREGNE
76c3755fe3 Add guard TEST on test module template
With a test file guarded we can include this file on IDE project
(MPLAB X in my case) and compile without excluding test files.
Excluding test files on MPLAB X disable autocompletion and function
navigation.
2020-09-07 10:37:26 +02:00
Fabian Weik
c3afe99a77 parse mock files correctly 2020-08-27 13:21:45 +02:00
Mark VanderVoord
98045925af Merge pull request #514 from michaelbrockus/let_meson_handle_flags
Let meson handle flags
2020-08-06 06:37:48 -04:00
Michael Brockus
62d0e7d68e Update meson.build 2020-08-05 21:15:37 -07:00
Michael Brockus
52d5f59b72 Update meson.build 2020-08-05 21:13:06 -07:00
Mark VanderVoord
09acb0b64f Merge pull request #513 from carsonalh/msvcfix
Fix for MSVC compilation errors
2020-07-18 10:37:51 -04:00
Carson Holloway
e640949eb3 Patched compilation error for MSVC. 2020-07-18 21:59:55 +10:00
Carson Holloway
6fecc8eb38 Added MSVC options to CMakeLists.txt. 2020-07-18 21:58:54 +10:00
Carson Holloway
777ad17420 Added MSVC options to CMakeLists.txt. 2020-07-18 21:52:00 +10:00
Alessio Centazzo
8bbfe1f5ac Fix warning from issue #507
UnityFail() and UnityIgnore had the noreturn attribute with long jumps disabled
2020-06-06 08:07:57 -07:00
Mark VanderVoord
0126e4804c Merge pull request #504 from phyrwork/master
Fix TEST_ASSERT_BIT(S)_HIGH testing only lower 32-bits (Thanks @phyrwork !)
2020-05-26 08:04:03 -04:00
Connor Newton
b4b1994bd7 Fix TEST_ASSERT_BIT(S)_HIGH testing only lower 32-bits
The high/low bits masks for TEST_ASSERT_BIT(S)_HIGH/LOW are created
by casting 0/-1 to UNITY_UINT32. This isn't OK on 64-bit platforms
as it results in a high bits mask of 0x00000000ffffffff instead of
0xffffffffffffffff.

Cast 0/-1 to UNITY_UINT instead.
2020-05-26 12:58:14 +01:00
Mark VanderVoord
fedd1495c2 Merge pull request #503 from andred/master
unity: annotate noreturn APIs (fix Wsuggest-attribute=noreturn warnings)
2020-05-25 11:09:55 -04:00
André Draszik
a6a4e9766d unity: annotate noreturn APIs (fix Wsuggest-attribute=noreturn warnings)
GCC (& Clang) have the notion of pure and const functions [1],
where those attributes are intended to help the optimiser.

Annotate a few APIs here with the appropriate key words, which
also fixes Wsuggest-attribute=noreturn warning, which a
source base might have enabled:
Compiling unity.c...
.../src/unity.c: In function ‘UnityFail’:
.../src/unity.c:1759:6: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn]
 1759 | void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
      |      ^~~~~~~~~
.../src/unity.c: In function ‘UnityIgnore’:
.../src/unity.c:1796:6: warning: function might be candidate for attribute ‘noreturn’ [-Wsuggest-attribute=noreturn]
 1796 | void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
      |      ^~~~~~~~~~~

[1] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

Signed-off-by: André Draszik <git@andred.net>
2020-05-25 15:49:47 +01:00
Mark VanderVoord
06a668579f Merge pull request #501 from andred/master
allow compilation with stricter warnings (Thanks @andred !)
2020-05-25 06:59:32 -04:00
André Draszik
9760c4f14f unity: fix Wswitch-enum warning
Compiling a source base / test with Wswitch-enum enabled, gives
the following warning:

../src/unity.c: In function ‘UnityAssertFloatSpecial’:
../src/unity.c:1092:5: warning: enumeration value ‘UNITY_FLOAT_INVALID_TRAIT’ not handled in switch [-Wswitch-enum]
 1092 |     switch (style)
      |     ^~~~~~

Fix by adding the missing value to the default (unhandled) case.

Signed-off-by: André Draszik <git@andred.net>
2020-05-25 08:58:37 +01:00
André Draszik
f5ff3504b5 auto/run_test: fix Wsign-compare warning
Compiling a source base / test with Wsign-compare enabled, gives
the following warning:

build/test/runners/test_system_runner.c: In function ‘run_test’:
build/test/runners/test_system_runner.c:62:35: warning: conversion to ‘UNITY_UINT’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
   62 |     Unity.CurrentTestLineNumber = line_num;
      |                                   ^~~~~~~~

Fix by updating the type in the function declaration.

Signed-off-by: André Draszik <git@andred.net>
2020-05-25 07:14:14 +01:00
Mark VanderVoord
b0032caca4 Merge pull request #499 from jsloth/bugfix/suiteTearDown
Fixed suiteTearDown not matching prototype
2020-05-04 16:09:30 -04:00
Jakob Olesen
dcb30731f8 Fixed suiteTearDown not matching prototype
Fixed suiteTearDown to match prototype in unity.h
2020-05-04 20:34:45 +02:00
Mark VanderVoord
77c394e975 Merge pull request #498 from AlariOis/master
c99 support for new RUN_TEST macro. Thanks @AlariOis !
2020-05-04 09:48:23 -04:00
Mark VanderVoord
87f382fbb2 Merge branch 'master' into master 2020-05-04 09:45:03 -04:00
Alari Õis
97f6d55256 c99 support for new RUN_TEST macro 2020-05-04 08:20:19 +03:00
16 changed files with 125 additions and 104 deletions

32
.github/workflows/main.yml vendored Normal file
View 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
View File

@@ -9,3 +9,5 @@ examples/example_1/test1.out
examples/example_1/test2.out
examples/example_2/all_tests.out
examples/example_4/builddir
*.sublime-project
*.sublime-workspace

View File

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

View File

@@ -41,6 +41,21 @@ project(unity
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 ------------------------------------------------------------------
add_library(${PROJECT_NAME} STATIC)
add_library(${PROJECT_NAME}::framework ALIAS ${PROJECT_NAME})
@@ -52,6 +67,8 @@ include(CMakePackageConfigHelpers)
target_sources(${PROJECT_NAME}
PRIVATE
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}
@@ -59,10 +76,16 @@ target_include_directories(${PROJECT_NAME}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<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
src/unity_internals.h
set(${PROJECT_NAME}_PUBLIC_HEADERS
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}
@@ -86,7 +109,9 @@ target_compile_options(${PROJECT_NAME}
-Wno-missing-braces
-Wold-style-cast
-Wshadow
-Wweak-vtables>
-Wweak-vtables
-Werror
-Wall>
$<$<C_COMPILER_ID:GNU>:-Waddress
-Waggregate-return
-Wformat-nonliteral
@@ -101,9 +126,10 @@ target_compile_options(${PROJECT_NAME}
-Wno-unused-parameter
-Wunreachable-code
-Wwrite-strings
-Wpointer-arith>
-Wall
-Werror
-Wpointer-arith
-Werror
-Wall>
$<$<C_COMPILER_ID:MSVC>:/Wall>
)
write_basic_package_version_file(${PROJECT_NAME}ConfigVersion.cmake

View File

@@ -1,6 +1,6 @@
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
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,8 +1,17 @@
Unity Test API
==============
Unity Test ![CI](https://github.com/ThrowTheSwitch/Unity/workflows/CI/badge.svg)
==========
__Copyright (c) 2007 - 2021 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
[![Unity Build Status](https://api.travis-ci.org/ThrowTheSwitch/Unity.png?branch=master)](https://travis-ci.org/ThrowTheSwitch/Unity)
__Copyright (c) 2007 - 2020 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
Welcome to the Unity Test Project, one of the main projects of ThrowTheSwitch.org. Unity Test is a
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
===============

View File

@@ -13,7 +13,9 @@ require 'fileutils'
require 'pathname'
# TEMPLATE_TST
TEMPLATE_TST ||= '#include "unity.h"
TEMPLATE_TST ||= '#ifdef TEST
#include "unity.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");
}
#endif // TEST
'.freeze
# TEMPLATE_SRC
@@ -164,22 +168,19 @@ class UnityModuleGenerator
end
############################
def neutralize_filename(name, start_cap=true)
def neutralize_filename(name, start_cap = true)
return name if name.empty?
name = name.split(/(?:\s+|_|(?=[A-Z][a-z]))|(?<=[a-z])(?=[A-Z])/).map{|v|v.capitalize}.join('_')
if start_cap
return name
else
return name[0].downcase + name[1..-1]
end
name = name.split(/(?:\s+|_|(?=[A-Z][a-z]))|(?<=[a-z])(?=[A-Z])/).map { |v| v.capitalize }.join('_')
name = name[0].downcase + name[1..-1] unless start_cap
return name
end
############################
def create_filename(part1, part2 = '')
name = part2.empty? ? part1 : part1 + '_' + part2
case (@options[:naming])
when 'bumpy' then neutralize_filename(name,false).gsub('_','')
when 'camel' then neutralize_filename(name).gsub('_','')
when 'bumpy' then neutralize_filename(name,false).delete('_')
when 'camel' then neutralize_filename(name).delete('_')
when 'snake' then neutralize_filename(name).downcase
when 'caps' then neutralize_filename(name).upcase
else name

View File

@@ -197,7 +197,7 @@ class UnityTestRunnerGenerator
mock_headers = []
includes.each do |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
mock_headers
end
@@ -206,7 +206,7 @@ class UnityTestRunnerGenerator
@options[:has_setup] = source =~ /void\s+#{@options[:setup_name]}\s*\(/
@options[:has_teardown] = source =~ /void\s+#{@options[:teardown_name]}\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
def create_header(output, mocks, testfile_includes = [])

View File

@@ -1,5 +1,5 @@
/*=======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.CurrentTestLineNumber = line_num;

View File

@@ -7,42 +7,8 @@
project('unity', 'c',
license: 'MIT',
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')
unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)

View File

@@ -7,5 +7,5 @@
unity_dir = include_directories('.')
unity_lib = static_library(meson.project_name(),
sources: ['unity.c'],
files('unity.c'),
include_directories: unity_dir)

View File

@@ -1,6 +1,6 @@
/* =========================================================================
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]
============================================================================ */
@@ -67,9 +67,10 @@ static const char PROGMEM UnityStrBreaker[] = "------------------
static const char PROGMEM UnityStrResultsTests[] = " Tests ";
static const char PROGMEM UnityStrResultsFailures[] = " Failures ";
static const char PROGMEM UnityStrResultsIgnored[] = " Ignored ";
#ifndef UNITY_EXCLUDE_DETAILS
static const char PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
static const char PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
#endif
/*-----------------------------------------------
* Pretty Printers & Test Result Output Handlers
*-----------------------------------------------*/
@@ -1001,7 +1002,7 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
is_trait = !isinf(actual) && !isnan(actual);
break;
default:
default: /* including UNITY_FLOAT_INVALID_TRAIT */
trait_index = 0;
trait_names[0] = UnityStrInvalidFloatTrait;
break;
@@ -1141,7 +1142,7 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
is_trait = !isinf(actual) && !isnan(actual);
break;
default:
default: /* including UNITY_FLOAT_INVALID_TRAIT */
trait_index = 0;
trait_names[0] = UnityStrInvalidFloatTrait;
break;

View File

@@ -1,6 +1,6 @@
/* ==========================================
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]
========================================== */
@@ -10,7 +10,7 @@
#define UNITY_VERSION_MAJOR 2
#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)
#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_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_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (UNITY_UINT32)(-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_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((UNITY_UINT32)1 << (bit)), (UNITY_UINT32)(-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_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_UINT)(0), (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_UINT)1 << (bit)), (UNITY_UINT)(0), (actual), __LINE__, NULL)
/* 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)

View File

@@ -1,6 +1,6 @@
/* ==========================================
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]
========================================== */
@@ -40,6 +40,12 @@
#include <limits.h>
#endif
#if defined __GNUC__
# define UNITY_FUNCTION_ATTR(a) __attribute__((a))
#else
# define UNITY_FUNCTION_ATTR(a) /* ignore */
#endif
/*-------------------------------------------------------
* Guess Widths If Not Specified
*-------------------------------------------------------*/
@@ -611,8 +617,14 @@ void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
const UNITY_DISPLAY_STYLE_T style,
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 UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
#endif
void UnityMessage(const char* message, const UNITY_LINE_TYPE line);
#ifndef UNITY_EXCLUDE_FLOAT
@@ -701,11 +713,8 @@ extern const char UnityStrErrShorthand[];
#endif
#endif
#ifdef UNITY_SUPPORT_VARIADIC_MACROS
#define RUN_TEST(...) UnityDefaultTestRun(RUN_TEST_FIRST(__VA_ARGS__), RUN_TEST_SECOND(__VA_ARGS__))
#define RUN_TEST_FIRST(...) RUN_TEST_FIRST_HELPER(__VA_ARGS__, throwaway)
#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)
#define RUN_TEST(...) RUN_TEST_AT_LINE(__VA_ARGS__, __LINE__, throwaway)
#define RUN_TEST_AT_LINE(func, line, ...) UnityDefaultTestRun(func, #func, line)
#endif
#endif

View File

@@ -10,6 +10,7 @@ endif
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
#CFLAGS += -Wconversion #disabled because if falsely complains about the isinf and isnan macros
CFLAGS += -Wno-switch-enum -Wno-double-promotion
CFLAGS += -Wno-poison-system-directories
CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstrict-overflow \
-Wstrict-prototypes -Wswitch-default -Wundef
#DEBUG = -O0 -g

View File

@@ -300,8 +300,8 @@ module RakefileHelpers
def run_make_tests()
[ "make -s", # test with all defaults
"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", # 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 UNITY_INCLUDE_DOUBLE= ", # test without double
"cd #{File.join("..","extras","fixture",'test')} && make -s default noStdlibMalloc",
"cd #{File.join("..","extras","fixture",'test')} && make -s C89",