Skip to content

Commit

Permalink
Add pntr_assert()
Browse files Browse the repository at this point in the history
  • Loading branch information
RobLoach committed Apr 17, 2024
1 parent 2a80578 commit ff599f6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
8 changes: 6 additions & 2 deletions pntr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,10 @@ extern "C" {
#define STBTT_cos(x) PNTR_COSF((float)(x))
#endif

#ifndef STBTT_fabs
#define STBTT_fabs(x) PNTR_FABSF(x)
#endif

#ifndef PNTR_ENABLE_MATH
#ifndef STBTT_sqrt
float _pntr_sqrtf(float number) {
Expand Down Expand Up @@ -1166,7 +1170,7 @@ extern "C" {
}
#define STBTT_acos(x) _pntr_acos((x))
#endif
#else
#else // PNTR_ENABLE_MATH
#ifndef STBTT_sqrt
#define STBTT_sqrt(x) sqrt(x)
#endif
Expand All @@ -1176,7 +1180,7 @@ extern "C" {
#ifndef STBTT_acos
#define STBTT_acos(x) acos(x)
#endif
#endif
#endif // PNTR_ENABLE_MATH

#ifndef STBTT_malloc
#define STBTT_malloc(x,u) ((void)(u), PNTR_MALLOC(x))
Expand Down
4 changes: 4 additions & 0 deletions pntr_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
} while(0)
#endif // PNTR_ASSERT_VECTOR_EQUALS

#ifndef pntr_assert
#define pntr_assert(condition) PNTR_ASSERT(condition)
#endif // pntr_assert

/**
* @}
*/
Expand Down
18 changes: 9 additions & 9 deletions test/pntr_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,15 +668,6 @@ MODULE(pntr, {
pntr_unload_image(image);
});

IT("No reported errors", {
const char* err = "";
if (pntr_get_error() != NULL) {
err = pntr_get_error();
}

STREQUALS(err, "");
});

IT("_pntr_rectangle_intersect", {
pntr_rectangle out;
EQUALS(_pntr_rectangle_intersect(-10, -10, 5, 5, 0, 0, 100, 100, &out), false);
Expand All @@ -695,6 +686,15 @@ MODULE(pntr, {
pntr_rectangle expected = (pntr_rectangle) {20, 20, 10, 10};
RECTEQUALS(out, expected);
});

IT("No reported errors", {
const char* err = "";
if (pntr_get_error() != NULL) {
err = pntr_get_error();
}

STREQUALS(err, "");
});
})

int main() {
Expand Down

0 comments on commit ff599f6

Please sign in to comment.