192 Commits

Author SHA1 Message Date
b29ad2ee68 Removing unnecessary function prototypes, inline PrintOk/Fail 2017-01-18 09:14:02 -06:00
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
de6f516330 Revert "Cleanup Assert Array idiom to be the same everywhere"
This reverts commit ee3821949870afb38b844b6a5a2f688bface2bd7.
Removing these changes per coding standard, after the code review
2017-01-17 21:43:25 -06:00
437c474b07 Put back (char) casts, better formatting 2017-01-17 21:26:15 -06:00
480335061c No print masking of integers, bounds on hex printing 2017-01-15 19:51:32 -06:00
ee38219498 Cleanup Assert Array idiom to be the same everywhere 2017-01-14 11:10:58 -06:00
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
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
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
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
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
5112d7dfbd Use default int size for any bad STYLE_T enum value
Defensive coding
2017-01-06 20:45:33 -06:00
4c78cde202 Finish clean up of float support options 2016-12-30 20:24:45 -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
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
03e2209e1b Rename UNITY_SKIP_EXECUTION to RETURN_IF_FAIL_OR_IGNORE 2016-12-28 20:33:22 -06:00
65e401f3de Always run the tearDown() even if test is ignored 2016-12-24 13:56:04 -06:00
46560a8030 Add correct masking behavior on unsigned values 2016-12-23 22:28:37 -06:00
5f386a42ff Refactor of IntArray function with switch inside loop, remove repeated code 2016-12-23 22:19:42 -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
393f2cb544 Refactor printing after the decimal point, signed types, small numbers...
Change some types to signed for simpler code and speed
Added format to distinguish small numbers
2016-11-19 13:52:24 -06:00
2de0e8285d Key idea is using double precision calculations makes everything better
Print 9 digits
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
30ba118c47 Add printing for large numbers in exponential format
Delete old method for printing
2016-11-16 23:00:01 -06:00
9653fbf7ac Use an integer cast to print floating point numbers more precisely
Improve printing six decimal places, remove trailing 0's, fix the carry when
numbers like 0.9999999 round up and print leading zeros in the decimal

The first attempt at printing floats had precision issues where the last few
digits would often be wrong. This next approach may yield a better algorithm
for numbers less than 4.29 billion, those that fit in 32 bits.
2016-11-16 20:37:12 -06:00
ac455f2798 We can’t guarantee that the built-in function insane will return 1. It might return any other non-negative value. Therefore we need to force it to be 1 so we can use the comparison operator later. 2016-11-15 09:29:08 -05:00
d4a35f0949 Refactor to delete smaller number decimal format
Generalize loop to print decimal format and exponential
 Add '+' to exponent when printing larger floats
2016-11-12 23:08:54 -06:00
6ec7c78b66 Writing a float printing routine 2016-11-12 23:08:54 -06:00
4ce86fd1c0 Merge pull request #226 from jsalling/feature/nan-not-eq-nan
Add option to set NaN not equal NaN for floating point assertions
2016-10-12 06:54:38 -04:00
933cc97364 Add option to set NaN != NaN for floating point assertions 2016-10-10 21:20:10 -05:00
148b4977cf check 'i' limit before using it as an array index.
fix cppcheck "Array index 'i' is used before limits check."
2016-09-26 16:01:03 -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
0f07adfa00 Merge pull request #202 from kroesche/feature/fix_exclude_fp_warnings
Fix warnings if you use UNITY_EXCLUDE_FLOAT
2016-09-21 20:53:45 -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
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
6d54ec2ff7 Get rid of conversion warning when using UNITY_FLOAT_VERBOSE with doubles
Change the parameter of UnityPrintFloat from float to double (_UD)
 The call to snprintf uses implict default promotion to a double anyway
2016-08-27 15:34:10 -05:00
54aa838c8a Change the fallback isinf() macro to NOT need f_zero defined
Delete old comments from before math.h was the default isinf() method
2016-08-27 15:27:52 -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
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
daad2bc82b removed some newer style comments that crept into the codebase. 2016-08-23 06:46:51 -04:00