Skip to content

Commit

Permalink
#256 Added unit test to illustrate rounding errors when printing doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed Jan 23, 2018
1 parent c6a5825 commit 0e5e42e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/utils/src/TestEprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ void testThatHexWithWidthIsPrinted() {
verifyStdio("Some %4X text", val);
}

void testThatDoubleIsPrintedWithRoundingErrors() {
// Fixture
double val = -1234.12;
char* expected = "Implementaion has rounding errors, -1234.119995";

// Test
// Assert
verify(expected, "Implementaion has rounding errors, %f", val);
}

void testThatHexWithZeroPaddedWidthIsPrinted() {
// Fixture
int val = 0xab;
Expand Down

0 comments on commit 0e5e42e

Please sign in to comment.