126 Commits

Author SHA1 Message Date
2d4e32cda1 Print 9 digits if we have double precision capability. 2017-11-07 22:44:59 -05:00
74ba70283a Improve accuracy of UnityPrintFloat() for common cases. 2017-11-07 11:42:19 -05:00
8ff74d6000 Allow UnityPrintFloat() to print a 7th digit. 2017-11-07 11:42:19 -05:00
cc909efed3 Implement optional printing of execution time for each test 2017-09-10 13:00:09 +12:00
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
dbdd168e46 Fix test link error. 2017-08-25 15:47:40 -04:00
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
f2fdf1a133 Added Greater than and Less than asserts from other PR 2017-05-13 15:59:51 -04:00
3062c39725 Starting to enforce our coding style. The first step is that we’ve pulled in Rubocop to check out Ruby syntax. There is likely a bit of customization to do yet AND there is definitely that backlog of todo’s that we just told it to ignore. 2017-03-28 08:44:32 -04:00
0dddf498c2 also update strings to support each element of an array. 2017-03-21 23:57:15 -04:00
a11a13750d Added memory each equal assertion 2017-03-21 18:28:49 -04:00
d8d67a708c Added each_equal assertions for float and double 2017-03-21 17:05:19 -04:00
b7956ea988 Added more tests for all the numerical types when performing each_equal assertions 2017-03-21 16:24:16 -04:00
7fe31915d0 Added some tests to prove this works. Still work in progress 2017-03-21 14:37:52 -04:00
b4f6afa4cf Test for printing max width of a hex number, back to 100% test coverage
Correct clean target and print test fails during coverage in Makefile
2017-01-23 23:05:06 -06:00
ef1e2ad58c Option to exclude setjump/longjmp, setjmp.h
Using this option changes the control flow of Unity, but is useful on
constrained embedded systems. You can't fully simulate the power of
'longjmp' with just 'return', but Unity still works well, all tests pass.
2017-01-14 11:15:30 -06:00
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
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
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
f771f0b98f Finish cleaning up float options in testunity 2016-12-29 23:06:34 -06:00
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
65e401f3de Always run the tearDown() even if test is ignored 2016-12-24 13:56:04 -06:00
64f90b1925 Fix test that failed when any other test failed, too distracting 2016-12-23 22:57:21 -06:00
b0870ec8b9 Merge branch 'feature/print-floats'
Fix new type name conflicts

Conflicts:
	src/unity.c
	src/unity_internals.h
2016-12-15 21:15:30 -06:00
8e31f5d869 Revised internal type naming scheme to better sandbox Unity away from everything else. Sure, short was nice, but not at the expense of naming collisions. 2016-11-29 08:38:51 -05:00
aa4d773df2 Tests for Printing All float values
Takes about 10 minutes to run all floats, so split into 3 tests for parallel
running later. This was useful during development for finding hard corner cases
and getting the routine to high quality. Off by default.
Note that all floats 16.0 and up can be represented uniquely (in this format) and will
round-trip back to the exact same float with sscanf(). This property is true for
UnityPrintFloat, despite a few rounding error cases, it will produce output identity.

Better comments and refactor on round ties to even
Add upper threshold value on round to even feature since numerical precision issues
start to give approximations when dividing one large double by another. When tested
on float values, using 1e22 gave the fewest rounding errors.

Fix warnings from gcc. Some float constants do not behave well in existing tests.
Add casts where conversions could be imprecise.
2016-11-19 13:59:19 -06:00
25f6417351 Refactor repeated code to print float expected and actual
Move double tests down in the file
2016-11-19 13:52:24 -06:00
9f4b1a332f Tests for Printing Floating Point numbers 2016-11-19 13:52:24 -06:00
47f6a85b8c Make UnityPrintFloat on by default
Remove UNITY_FLOAT_VERBOSE entirely, add option UNITY_EXCLUDE_FLOAT_PRINT
Remove some questionable float casts from doubles
Default to Round Ties to Even behavior, add option to Round Ties Away from Zero
2016-11-19 13:52:24 -06:00
54fe786fae Round ties to even by default, many C libraries follow this
Linux gcc & clang and OSX clang produce output with ties round to even
Windows mingw gcc does not
Example 0.0078125 prints '0.007812'
2016-11-19 13:52:24 -06:00
4a27d14734 Correct boundary conditions and add tests 2016-11-19 13:52:24 -06:00
1dfcb54491 Start adding tests. Add const and simplify code. 2016-11-19 13:52:24 -06:00
e48fe0a07c Reorganize NaN and Inf printing into if-else blocks 2016-11-19 13:51:59 -06:00
4faae4435d removed duplicated declaration of putcharSpy 2016-11-16 21:37:51 -02:00
933cc97364 Add option to set NaN != NaN for floating point assertions 2016-10-10 21:20:10 -05:00
dce6d329ff Finished fixing floating point comparisons. We have streamlined how floats and doubles are checked, but we still can't compare them for equality directly. So we're directly testing for infinite and NaN before checking diffs. Also, we've officially decided that for testing purposes NaN shall equal NaN, +Inf shall equal +Inf, and -Inf shall equal -Inf. It's what most people expect during a test. 2016-09-22 08:35:22 -04:00
7dc17efbb3 Merge pull request #215 from jsalling/bugfix/inf-equals-inf
Bugfix Inf equals Inf
2016-09-21 20:52:58 -04:00
95435afa4e Merge pull request #214 from jsalling/feature/c-strings
Print escapes for C strings
2016-09-07 07:48:09 -04:00
de39186187 Add test for C string escape sequences 2016-09-01 01:18:03 -05:00
af590028fa Unity to print C-style escaped strings as "\x16"
Changes from "\0x16" before, makes it easier to copy strings from output
2016-09-01 01:18:03 -05:00
0cc3e45a23 Suppress output of FAIL messages that are expected during testing
Works when using the putcharSpy, transparent without it
2016-08-31 20:43:21 -05:00
028ca953d7 Finish checking for equal floats in Arrays functions
Refactor to use the same code everywhere for FloatWithin check
 Rename and fix a few tests for new behavior, infinity == infinity
2016-08-27 15:12:45 -05:00
268c5b7e0b Make testunity.c printing uniform during failure, delete word "Previous" 2016-08-25 23:02:11 -05:00
3108aba5c7 If two floats happen to be equal, return right away
Covers the cases where infinity == infinity
2016-08-23 22:36:02 -05:00
57676b5edc - Fixed cases with wildcards in file handling. 2016-07-17 19:11:09 -04:00
1cecab30e8 - Added alias for filter -n of -f
- Added ability to surround filter strings in either type of quotes
- Added ability to filter on multiple test strings as a comma delimited list
- Added ability to filter on test_file:test_name
- Added ability to use alternate syntax for filter of -f="blah"
2016-07-08 17:35:37 -04:00
eba387fa3e - Add tests which prove command line arguments now work with runner. Fixed a few bugs in this area. 2016-06-27 08:41:58 -04:00
96f51e8530 Updated method of testing generate_test_runner script to be a FUNCTIONAL test instead of a perfect code match. Backfilled most tests and added some coverage not previously present. Still need to test new command line args and a few cmock details. 2016-06-22 20:57:11 -04:00
c5c392b18a update UNITY_OUTPUT_CHAR to not return a value (because we never check it anyway).
add UNITY_OUTPUT_FLUSH to make sure we get the output we need on aborted tests and whatnot.
2016-05-06 10:47:39 -04:00
c5238adab2 100% code coverage for Unity project
Add test for failure count and UnityEnd return value
 Cover printing escape codes with length parameter
 Full statement coverage
2016-05-03 21:58:29 -05:00