Skip to content

Commit

Permalink
Fixed testing macro on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
aslze committed Jun 2, 2024
1 parent bd455a1 commit de4668d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/asl/testing.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright(c) 1999-2023 aslze
// Copyright(c) 1999-2024 aslze
// Licensed under the MIT License (http://opensource.org/licenses/MIT)

#ifndef ASL_TESTING_H
Expand Down Expand Up @@ -171,7 +171,7 @@ inline String asString(const Var& x) { return x.toString(); }
#ifdef __ANDROID__
#define ASL_ASSERT(x) if(!(x)) { testResult << String(0, "\n%s: %i\nFailed: '%s'\n\n", __FILE__, __LINE__, #x); }

#define ASL_CHECK(x, op, y) if(!((x) op (y))) { testResult << String(0, "\n%s: %i\n\n* Expected '%s' %s '%s' but it is: %s\n\n", __FILE__, __LINE__, #x, #op, *asString(y), *asString(x)); }
#define ASL_EXPECT(x, op, y) if(!((x) op (y))) { testResult << String(0, "\n%s: %i\n\n* Expected '%s' %s '%s' but it is: %s\n\n", __FILE__, __LINE__, #x, #op, *asString(y), *asString(x)); }
#else

/**
Expand All @@ -190,9 +190,10 @@ ASL_EXPECT(sqrt(x), >=, 0);

#define ASL_EXPECT(x, op, y) if(!((x) op (y))) { printf("\n%s(%i): error: Expected '%s' %s '%s' but it is %s\n\n", __FILE__, __LINE__, #x, #op, *asString(y), *asString(x)); testFailed = true; }

#define ASL_CHECK(x, op, y) ASL_EXPECT(x, op, y)
#endif

#define ASL_CHECK(x, op, y) ASL_EXPECT(x, op, y)

#define ASL_APPROX(x, y, d) ASL_EXPECT(distance((x), (y)), <, (d))

/**
Expand Down

0 comments on commit de4668d

Please sign in to comment.