main.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // SexyKanjiTestSuite.cpp : Defines the entry point for the console application.
  2. //
  3. #include "MiniCppUnit.hxx"
  4. #ifdef WIN32
  5. #include <direct.h>
  6. #else
  7. #include <unistd.h>
  8. #endif // WIN32
  9. #include <ctime>
  10. #include "KString.h"
  11. #include <stdio.h>
  12. #include "spine/extension.h"
  13. #include "spine/spine.h"
  14. #include "KMemory.h" // last include
  15. void RegisterMemoryLeakDetector()
  16. {
  17. // Register our malloc and free functions to track memory leaks
  18. #ifdef KANJI_MEMTRACE
  19. _spSetDebugMalloc(_kanjimalloc);
  20. #endif
  21. _spSetMalloc(_kanjimalloc);
  22. _spSetRealloc(_kanjirealloc);
  23. _spSetFree(_kanjifree);
  24. }
  25. int main(int argc, char* argv[])
  26. {
  27. RegisterMemoryLeakDetector();
  28. // Start Timing
  29. time_t start_time, end_time;
  30. time(&start_time);
  31. /* Set working directory to current location for opening test data */
  32. #ifdef WIN32
  33. _chdir( GetFileDir(argv[0], false).c_str() );
  34. #else
  35. chdir(GetFileDir(argv[0], false).c_str());
  36. #endif
  37. // Run Test Suite
  38. if(JetBrains::underTeamcity()) gTeamCityListener.startSuite("Spine-C Test Suite");
  39. int ret_val = TestFixtureFactory::theInstance().runTests() ? 0 : -1;
  40. if(JetBrains::underTeamcity()) gTeamCityListener.endSuite("Spine-C Test Suite");
  41. // End Timing
  42. time(&end_time);
  43. double secs = difftime(end_time,start_time);
  44. printf("\n\n%i minutes and %i seconds of your life taken from you by these tests.\n", ((int)secs) / 60, ((int)secs) % 60);
  45. spAnimationState_disposeStatics(); // Fix for #775
  46. return ret_val;
  47. }
  48. extern "C" { // probably unnecessary
  49. void _spAtlasPage_createTexture(spAtlasPage* self, const char* path) {
  50. self->rendererObject = 0;
  51. self->width = 2048;
  52. self->height = 2048;
  53. }
  54. void _spAtlasPage_disposeTexture(spAtlasPage* self) {
  55. }
  56. char* _spUtil_readFile(const char* path, int* length) {
  57. return _spReadFile(path, length);
  58. }
  59. }