Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Moved the assertion tests to testplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 13, 2010
1 parent 4b65e24 commit 8c26e99
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/SDL.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,6 @@ SDL_Init(Uint32 flags)
SDL_InstallParachute();
}

/* brief sanity checks for the sanity checks. :) */
SDL_assert(1);
SDL_assert_release(1);
SDL_assert_paranoid(1);
SDL_assert(0 || 1);
SDL_assert_release(0 || 1);
SDL_assert_paranoid(0 || 1);

#if 0 /* enable this to test assertion failures. */
SDL_assert_release(1 == 2);
SDL_assert_release(5 < 4);
SDL_assert_release(0 && "This is a test");
#endif

return (0);
}

Expand Down
23 changes: 23 additions & 0 deletions test/testplatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "SDL.h"
#include "SDL_endian.h"
#include "SDL_cpuinfo.h"
#include "SDL_assert.h"

/*
* Watcom C flags these as Warning 201: "Unreachable code" if you just
Expand Down Expand Up @@ -148,6 +149,26 @@ TestCPUInfo(SDL_bool verbose)
return (0);
}

int
TestAssertions(SDL_bool verbose)
{
SDL_assert(1);
SDL_assert_release(1);
SDL_assert_paranoid(1);
SDL_assert(0 || 1);
SDL_assert_release(0 || 1);
SDL_assert_paranoid(0 || 1);

#if 0 /* enable this to test assertion failures. */
SDL_assert_release(1 == 2);
SDL_assert_release(5 < 4);
SDL_assert_release(0 && "This is a test");
#endif
SDL_assert_release(0 && "This is a test");

return (0);
}

int
main(int argc, char *argv[])
{
Expand All @@ -164,5 +185,7 @@ main(int argc, char *argv[])
status += TestTypes(verbose);
status += TestEndian(verbose);
status += TestCPUInfo(verbose);
status += TestAssertions(verbose);

return status;
}

0 comments on commit 8c26e99

Please sign in to comment.