On later Rubies calling create_run_test() causes the generation of warnings of the following form:
warning: Passing safe_level with the 2nd argument of ERB.new is deprecated...
warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated...
This patch removes the noise.
YAML.load is now interpreted as YAML.safe_load, which breaks where the
YAML file contains aliases. If we can assume our yaml files are
trusted (since this a development tool), we can check for the presence
of YAML.unsafe_load and use it instead if it exists.
Before this change a single range such as TEST_RANGE([5, 100, 5]) would
generate the following error:
undefined method `flatten' for 5:Integer (NoMethodError)
The problem is that reduce called on an array with a single element
returns that element which isn't an array of arrays as expected by the
following block.
This commit change the regex to accept more spaces inside the brackets
of the TEST_RANGE().
I use clang-format through vscode "editor.formatOnSave": true feature and it produce
padding spaces inside the array brackets by default.
```c
int a[] = [1, 2];
```
is changed into
```c
int a[] = [ 1, 2 ];
```
Also, every time I save a file containing a TEST_RANGE() with ctrl + s,
it breaks it.
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.
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>
TEST_RANGE([start, stop, step]) generates following runs of the test
function: test(start), test(start + step), ..., test(start + n * step),
where start + n * step <= stop. The step must be positive.
If the test function takes several arguments, the following syntax must be used:
TEST_RANGE([arg1_start, arg1_stop, arg1_step], ..., [argN_start, argN_stop, argN_step])
This addresses issues #53 and #144.
Reported-by: Alex Rodriguez <alejmrm@gmail.com>
Reported-by: Hiroaki Yamazoe <PastelParasol@gmail.com>
By passing --omit_begin_end=1 to generate_test_runner.rb, the script
will now omit calls to UnityBegin and UnityEnd when running tests in a
suite.
This allows multiple suites to be executed in a row, and then have an overall
summary of the tests which were executed across all suites.
Converting RUN_TEST() from a macro to a function significantly reduces the size
of the compiled binary. On amd64, the largest test runner in the test suite
(testsample_DefaultsThroughCommandLine_runner.o) was reduced from 3.4 kB to 2.4
kB (stripped).
The include must be in the first line, else you may expect some issues.
Some autoformat tools could sort the includes alphabetically and could
break the test.
- Running time macros have been made more portable, previously it was not
possible to override all macros
- Running time macros will be executed by default test runner, and auto test
runners
- Adds a default execution time implementation for unix. (Previous default
implementation only worked on Windows)
- For embedded platforms there is a simple method of getting a default
implementation by defining a single macro UNITY_CLOCK_MS()
- Removed need for UNITY_EXEC_TIME_RESET. This was not being used for the default
implementations, if anything ever did need reset-like functionality it could
simply be wrapped up with the start or stop macros for that platform