Permalink
Browse files

changed color setting so that it looks correct in dark

  • Loading branch information...
liuliu committed Mar 14, 2012
1 parent 4c59179 commit 14146c887a0b985f1d644f8ec014aa85484fd332
Showing with 13 additions and 13 deletions.
  1. +8 −8 case.h
  2. +5 −5 case_main.h
View
16 case.h
@@ -57,7 +57,7 @@ static void INTERNAL_CATCH_UNIQUE_NAME(__test_case_driver__) (char* __case_name_
#define REQUIRE_EQ(a, b, err, ...) { \
if ((a) != (b)) \
{ \
- printf("\n\t\033[0;31mREQUIRE_EQ\033[0;30m: %s:%d: %s(%lg) != %s(%lg), " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_EQ\033[0;0m: %s:%d: %s(%lg) != %s(%lg), " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), ##__VA_ARGS__); \
ABORT_CASE; \
} }
@@ -66,14 +66,14 @@ int __case_i__; \
for (__case_i__ = 0; __case_i__ < (len); __case_i__++) \
if (((type*)(a))[__case_i__] != ((type*)(b))[__case_i__]) \
{ \
- printf("\n\t\033[0;31mREQUIRE_ARRAY_EQ\033[0;30m: %s:%d: %s[%d](%lg) != %s[%d](%lg), " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_ARRAY_EQ\033[0;0m: %s:%d: %s[%d](%lg) != %s[%d](%lg), " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], ##__VA_ARGS__); \
ABORT_CASE; \
} }
#define REQUIRE_EQ_WITH_TOLERANCE(a, b, t, err, ...) { \
if ((double)((a) - (b)) > (t) || (double)((a) - (b)) < -(t)) \
{ \
- printf("\n\t\033[0;31mREQUIRE_EQ_WITH_TOLERANCE\033[0;30m: %s:%d: %s(%lg) != %s(%lg) | +-%lg, " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), (double)(t), ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_EQ_WITH_TOLERANCE\033[0;0m: %s:%d: %s(%lg) != %s(%lg) | +-%lg, " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), (double)(t), ##__VA_ARGS__); \
ABORT_CASE; \
} }
@@ -82,14 +82,14 @@ int __case_i__; \
for (__case_i__ = 0; __case_i__ < (len); __case_i__++) \
if ((double)(((type*)(a))[__case_i__] - ((type*)(b))[__case_i__]) > (t) || (double)(((type*)(a))[__case_i__] - ((type*)(b))[__case_i__]) < -(t)) \
{ \
- printf("\n\t\033[0;31mREQUIRE_ARRAY_EQ_WITH_TOLERANCE\033[0;30m: %s:%d: %s[%d](%lg) != %s[%d](%lg) | +-%lg, " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], (double)(t), ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_ARRAY_EQ_WITH_TOLERANCE\033[0;0m: %s:%d: %s[%d](%lg) != %s[%d](%lg) | +-%lg, " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], (double)(t), ##__VA_ARGS__); \
ABORT_CASE; \
} }
#define REQUIRE_NOT_EQ(a, b, err, ...) { \
if ((a) == (b)) \
{ \
- printf("\n\t\033[0;31mREQUIRE_NOT_EQ\033[0;30m: %s:%d: %s(%lg) == %s(%lg), " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_NOT_EQ\033[0;0m: %s:%d: %s(%lg) == %s(%lg), " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), ##__VA_ARGS__); \
ABORT_CASE; \
} }
@@ -98,14 +98,14 @@ int __case_i__; \
for (__case_i__ = 0; __case_i__ < (len); __case_i__++) \
if (((type*)(a))[__case_i__] == ((type*)(b))[__case_i__]) \
{ \
- printf("\n\t\033[0;31mREQUIRE_ARRAY_NOT_EQ\033[0;30m: %s:%d: %s[%d](%lg) == %s[%d](%lg), " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_ARRAY_NOT_EQ\033[0;0m: %s:%d: %s[%d](%lg) == %s[%d](%lg), " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], ##__VA_ARGS__); \
ABORT_CASE; \
} }
#define REQUIRE_NOT_EQ_WITH_TOLERANCE(a, b, t, err, ...) { \
if ((double)((a) - (b)) <= (t) && (double)((a) - (b)) >= -(t)) \
{ \
- printf("\n\t\033[0;31mREQUIRE_NOT_EQ_WITH_TLERANCE\033[0;30m: %s:%d: %s(%lg) == %s(%lg) | +-%lg, " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), (double)(t), ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_NOT_EQ_WITH_TLERANCE\033[0;0m: %s:%d: %s(%lg) == %s(%lg) | +-%lg, " err, __FILE__, __LINE__, #a, (double)(a), #b, (double)(b), (double)(t), ##__VA_ARGS__); \
ABORT_CASE; \
} }
@@ -114,7 +114,7 @@ int __case_i__; \
for (__case_i__ = 0; __case_i__ < (len); __case_i__++) \
if ((double)(((type*)(a))[__case_i__] - ((type*)(b))[__case_i__]) <= (t) && (double)(((type*)(a))[__case_i__] - ((type*)(b))[__case_i__]) >= -(t)) \
{ \
- printf("\n\t\033[0;31mREQUIRE_ARRAY_NOT_EQ_WITH_TOLERANCE\033[0;30m: %s:%d: %s[%d](%lg) == %s[%d](%lg) | +-%lg, " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], (double)(t), ##__VA_ARGS__); \
+ printf("\n\t\033[0;31mREQUIRE_ARRAY_NOT_EQ_WITH_TOLERANCE\033[0;0m: %s:%d: %s[%d](%lg) == %s[%d](%lg) | +-%lg, " err, __FILE__, __LINE__, #a, __case_i__, (double)((type*)(a))[__case_i__], #b, __case_i__, (double)((type*)(b))[__case_i__], (double)(t), ##__VA_ARGS__); \
ABORT_CASE; \
} }
View
@@ -258,24 +258,24 @@ int main(int argc, char** argv)
case_t* test_suite = (case_t*)(start_pointer + i);
if (test_suite->sig == 0x883253372849284B)
{
- printf("\033[0;34m[%d/%d]\033[0;30m \033[1;33m[RUN]\033[0;30m %s ...", j, total, test_suite->name);
+ printf("\033[0;34m[%d/%d]\033[0;0m \033[1;33m[RUN]\033[0;0m %s ...", j, total, test_suite->name);
int result = 0;
test_suite->driver(test_suite->name, &result);
if (result == 0)
{
pass++;
- printf("\r\033[0;34m[%d/%d]\033[0;30m \033[1;32m[PASS]\033[0;30m %s \n", j, total, test_suite->name);
+ printf("\r\033[0;34m[%d/%d]\033[0;0m \033[1;32m[PASS]\033[0;0m %s \n", j, total, test_suite->name);
} else {
fail++;
- printf("\n\033[0;34m[%d/%d]\033[0;30m \033[1;31m[FAIL]\033[0;30m %s\n", j, total, test_suite->name);
+ printf("\n\033[0;34m[%d/%d]\033[0;0m \033[1;31m[FAIL]\033[0;0m %s\n", j, total, test_suite->name);
}
j++;
}
}
if (fail == 0)
- printf("\033[0;32mall test case(s) passed, congratulations!\033[0;30m\n");
+ printf("\033[0;32mall test case(s) passed, congratulations!\033[0;0m\n");
else
- printf("\033[0;31m%d of %d test case(s) passed\033[0;30m\n", pass, fail + pass);
+ printf("\033[0;31m%d of %d test case(s) passed\033[0;0m\n", pass, fail + pass);
return 0;
}

0 comments on commit 14146c8

Please sign in to comment.