Commit Graph

324 Commits

Author SHA1 Message Date
Mark VanderVoord
62f6cb247a Merge pull request #312 from shreyasbharath/master_fix_integer_underflow
Fix unsigned integer underflow in UnityAssertEqualIntArray (Thanks @shreyasbharath )
2017-11-27 06:50:49 -05:00
Shreyas Balakrishna
4325773e76 Fix unsigned integer underflow in UnityAssertEqualIntArray 2017-11-23 14:59:00 +13:00
John Lindgren
a6d3f3a59a Restore round-to-even behavior. 2017-11-07 23:25:27 -05:00
John Lindgren
2d4e32cda1 Print 9 digits if we have double precision capability. 2017-11-07 22:44:59 -05:00
John Lindgren
74ba70283a Improve accuracy of UnityPrintFloat() for common cases. 2017-11-07 11:42:19 -05:00
John Lindgren
8ff74d6000 Allow UnityPrintFloat() to print a 7th digit. 2017-11-07 11:42:19 -05:00
Mark VanderVoord
774da10e00 Merge pull request #296 from jlindgren90/master
Allow suiteSetUp() and suiteTearDown() to be provided as normal C functions (Thanks @jlindgren90 )
2017-11-04 09:04:53 -04:00
John Lindgren
629b86d541 Merge unity_setup.h into unity.h. 2017-11-01 11:36:26 -04:00
Mark VanderVoord
38c387b76f Merge pull request #304 from VLambret/master
Color test results using ANSI escape codes (Thanks for the work, @VLambret !)
2017-10-24 15:08:50 -04:00
Victor Lambret
17d4ea92e1 Color test results using ANSI escape codes
Help error detection by adding specific colors for test results. This
behavior is activated only when unity if compiled with UNITY_COLOR flag.
2017-10-24 07:33:30 +02:00
John Lindgren
a7e8797e0c Fix link errors with MinGW.
MinGW supports a limited form of weak symbols, with the restriction
that weak/default implementations need to be defined in the same
translation unit they are called from.  Strong/overriding symbols
may of course be specified in a different translation unit.
2017-10-09 10:49:58 -04:00
jsalling
8caade7e68 Fix bug in greater/less than asserts on unsigned int
Check for unsigned types, add 'or equal to' support
 Consolidate to one function to remove repeated code
2017-09-20 18:13:12 -05:00
John Lindgren
2593c31bb7 Allow suiteSetUp() and suiteTearDown() to be provided as normal C functions.
This is simpler and more flexible than embedding C code in the Ruby options
(:suite_setup and :suite_teardown).  However, support for :suite_setup and
:suite_teardown is kept for backwards compatibility.

Several configurations are possible:
1. :suite_setup and :suite_teardown options provided and used.
2. :suite_setup and :suite_teardown options not provided (nil):
  2a. Weak symbols not supported; suiteSetUp() and suiteTearDown() are not called.
      It would be simpler to make user-provided functions mandatory in this case,
      but it could break some pre-existing test suites.
  2b. Weak symbols are supported and the stub implementations of suiteSetUp() and
      suiteTearDown() are called if there are no user-provided functions.
  2c. Weak symbols are supported but overridden by user-provided suiteSetUp() and
      suiteTearDown() functions.
2017-09-13 18:12:23 -04:00
John Lindgren
fcd4883c5e Fix compiler warning due to reusing symbol 'exp'. 2017-09-11 10:06:04 -04:00
balaksh
cc909efed3 Implement optional printing of execution time for each test 2017-09-10 13:00:09 +12:00
Mark VanderVoord
7b2ad10c92 Merge pull request #285 from dpostorivo/gt_lt_asserts
Cleanup Greater than and Less than asserts from other PR (#264) (Thanks @dpostorivo and @Dommar92 !)
2017-09-08 13:27:22 -04:00
John Lindgren
2ae2bdb376 Make code C89-compliant. 2017-08-25 15:52:06 -04:00
John Lindgren
0e7eb545b9 Rewrite UnityPrintFloat to match printf("%.6g").
The existing implementation was not very good:
 - It printed all very small values as "0.000000..."
 - It did not distinguish positive and negative zero
 - In some cases it printed extra garbage digits for single-precision values
   (e.g. 3.9e+30 was printed as 3.90000013+30)

Tests have been updated to check that we now match printf("%.6g") for
1,000,000 randomly chosen values, except for rounding of the 6th digit.
2017-08-25 14:27:37 -04:00
Dom Postorivo
f2fdf1a133 Added Greater than and Less than asserts from other PR 2017-05-13 15:59:51 -04:00
Mark VanderVoord
ee038c248c Ha! Forgot to add the correct comment style 2017-03-26 18:30:22 -04:00
Mark VanderVoord
d6b350874b Clean up some const issues, particularly when moving between single and double pointers 2017-03-26 18:25:25 -04:00
Mark VanderVoord
0dddf498c2 also update strings to support each element of an array. 2017-03-21 23:57:15 -04:00
Mark VanderVoord
a11a13750d Added memory each equal assertion 2017-03-21 18:28:49 -04:00
Mark VanderVoord
d8d67a708c Added each_equal assertions for float and double 2017-03-21 17:05:19 -04:00
Mark VanderVoord
7fe31915d0 Added some tests to prove this works. Still work in progress 2017-03-21 14:37:52 -04:00
Mark VanderVoord
56eeacd0b2 prepare for comparing value to array by setting up explicit compare of array to array in ints 2017-03-21 08:00:48 -04:00
Max Bruckner
1c556d2e4c Fix -Wconversion with gcc-4.3 2017-03-18 17:42:02 +01:00
Max Bruckner
7bce0b4f0c Fix warning with ubsan and -Wconversion
This fixes a compiler warning about a lossy conversion from long
unsigned int to int when compiling unity with gcc 6.3.1 and
the options -std=c89 -Wconversion -fsanitize=undefined
2017-03-01 17:10:16 +01:00
Max Bruckner
1bf22d39f5 Fix warnings with -Wdouble-promotion
This fixes compiler warnings that clang produces with the
-Wdouble-promotion compiler option.

This only happens if double precision floating point numbers are
enabled.

The implicit double promotion occurs because numbers of type UNITY_FLOAT
are passed into UnityPrintFloat, which expects const UNITY_DOUBLE.

This commit fixes it by explicitly casting to UNITY_DOUBLE.
2017-03-01 10:15:06 +01:00
Crt Mori
3588e5b6d3 Aligning definition and declaration of UnityPrintFloat
There was a mismatch of definition and declaration of UnityPrintFloat
and this commit aligns both on const UNITY_DOUBLE, but then inside it
actually uses a positive version of the variable only.
2017-01-24 22:52:43 +01:00
Mark VanderVoord
78938f6f05 Merge pull request #254 from jsalling/cleanup/clang-format
Formatting source code to existing style
2017-01-19 06:56:35 -05:00
jsalling
97e4bd252a Ran Unity into a source code formatter, no code changes
Used clang-format, which produces noise on stuff you don't care about
and requires setting it up to match the existing code base. Kept the
potentially useful changes, discarded the rest, some manual tweaking
required. It did catch lots of pesky indentation mistakes.
2017-01-18 19:48:40 -06:00
jsalling
b29ad2ee68 Removing unnecessary function prototypes, inline PrintOk/Fail 2017-01-18 09:14:02 -06:00
Mark VanderVoord
04e10f95ee Merge pull request #249 from jsalling/feature/no-print-mask
No print masking of integers, bounds on hex printing (Thanks!)
2017-01-18 09:01:45 -05:00
jsalling
de6f516330 Revert "Cleanup Assert Array idiom to be the same everywhere"
This reverts commit ee38219498.
Removing these changes per coding standard, after the code review
2017-01-17 21:43:25 -06:00
jsalling
437c474b07 Put back (char) casts, better formatting 2017-01-17 21:26:15 -06:00
jsalling
480335061c No print masking of integers, bounds on hex printing 2017-01-15 19:51:32 -06:00
jsalling
ee38219498 Cleanup Assert Array idiom to be the same everywhere 2017-01-14 11:10:58 -06:00
jsalling
4d747080a9 Rename Array Check helper, always return, never longjmp
Move longjump inside caller, to functions returning 'void'
This single function needed to change to allow optional setjmp.h
2017-01-14 10:56:24 -06:00
jsalling
5449f1e4d1 Condense all longjmp calls into TEST_ABORT()
The setjmp calls are all in TEST_PROTECT() already
2017-01-14 10:41:03 -06:00
Mark VanderVoord
6695e9e975 Merge pull request #242 from jsalling/feature/fixture-test-name
Fixture - Remove duplicate output of test name in verbose mode
2017-01-13 16:38:10 -05:00
Mark VanderVoord
9954d4f863 Merge pull request #244 from jsalling/cleanup/promotion-warnings
Remove promotion warnings on float constants, Inline the isneg/ispos macros
2017-01-13 15:46:07 -05:00
Mark VanderVoord
7b87a579d1 Merge pull request #245 from jsalling/feature/teardown-not-ignore
Always run the tearDown() even if test is ignored
2017-01-13 15:43:26 -05:00
Mark VanderVoord
9e8ab3df84 Merge pull request #241 from jsalling/cleanup/float-testing
Cleanup floating point print testing, update docs
2017-01-13 15:42:15 -05:00
Mark VanderVoord
85ef109282 Merge pull request #240 from jsalling/refactor/skip-exec
Rename UNITY_SKIP_EXECUTION to RETURN_IF_FAIL_OR_IGNORE
2017-01-13 12:08:15 -05:00
jsalling
5112d7dfbd Use default int size for any bad STYLE_T enum value
Defensive coding
2017-01-06 20:45:33 -06:00
jsalling
4c78cde202 Finish clean up of float support options 2016-12-30 20:24:45 -06:00
jsalling
bd4ac58486 Inline the isneg/ispos macros, remove promotion warnings on constants
Originated from commit c6dc96f3 but are rarely used and not in math.h
Removes float to double promotion warning and simplifies the code
'gcc -std=gnu99 -Wdouble-promotion' spits out these warnings
2016-12-29 20:47:03 -06:00
jsalling
5f33721924 Remove duplicate output of test name, Fixture verbose mode
Remove UNITY_FIXTURES option, which was probably not doing what was
originally indended. It was suppressing the test name even in quiet mode.
2016-12-28 21:18:50 -06:00
jsalling
03e2209e1b Rename UNITY_SKIP_EXECUTION to RETURN_IF_FAIL_OR_IGNORE 2016-12-28 20:33:22 -06:00