Skip to content

Commit

Permalink
Added parens around parameters in equal checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
codeplea committed Jan 21, 2016
1 parent 51f2764 commit b019db3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions minctest.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MINCTEST - Minimal C Test Library - 0.1
*
* Copyright (c) 2014, 2015 Lewis Van Winkle
* Copyright (c) 2014, 2015, 2016 Lewis Van Winkle
*
* https://CodePlea.com
*
Expand Down Expand Up @@ -109,18 +109,18 @@ static int lfails = 0;
/* Assert two integers are equal. */
#define lequal(a, b) do {\
++ltests;\
if (a != b) {\
if ((a) != (b)) {\
++lfails;\
printf("%s:%d (%d != %d)\n", __FILE__, __LINE__, a, b);\
printf("%s:%d (%d != %d)\n", __FILE__, __LINE__, (a), (b));\
}} while (0)


/* Assert two floats are equal (Within LTEST_FLOAT_TOLERANCE). */
#define lfequal(a, b) do {\
++ltests;\
if (fabs((double)a-(double)b) > LTEST_FLOAT_TOLERANCE) {\
if (fabs((double)(a)-(double)(b)) > LTEST_FLOAT_TOLERANCE) {\
++lfails;\
printf("%s:%d (%f != %f)\n", __FILE__, __LINE__, (double)a, (double)b);\
printf("%s:%d (%f != %f)\n", __FILE__, __LINE__, (double)(a), (double)(b));\
}} while (0)


Expand Down

0 comments on commit b019db3

Please sign in to comment.