mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
32fbf76326
Introduce class apd (automatic pointer destruction) Introduce MemoryTracker Weak symbols in MemoryAllocationLib to be able to redefine them (see MemoryTracker). Embed LegacyOS instead of a pointer. Fixed a lot of memory leaks.
190 lines
4.3 KiB
C++
Executable File
190 lines
4.3 KiB
C++
Executable File
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
|
#include "../cpp_foundation/XArray.h"
|
|
#include "../cpp_foundation/XObjArray.h"
|
|
|
|
#include "../Platform/BasicIO.h" // for PauseForKey
|
|
|
|
#include "XArray_tests.h"
|
|
#include "XObjArray_tests.h"
|
|
#include "XStringArray_test.h"
|
|
#include "XString_test.h"
|
|
#include "strcmp_test.h"
|
|
#include "strncmp_test.h"
|
|
#include "strlen_test.h"
|
|
#include "strcasecmp_test.h"
|
|
#include "printf_lite-test.h"
|
|
#include "LoadOptions_test.h"
|
|
#include "XToolsCommon_test.h"
|
|
#include "XBuffer_tests.h"
|
|
#include "plist_tests.h"
|
|
#include "find_replace_mask_Clover_tests.h"
|
|
#include "find_replace_mask_OC_tests.h"
|
|
#include "MacOsVersion_test.h"
|
|
#include "xml_lite-test.h"
|
|
#include "config-test.h"
|
|
#include "XToolsCommon_test.h"
|
|
#include "guid_tests.h"
|
|
#include "MemoryTracker_test.h"
|
|
|
|
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
|
|
#include "printlib-test.h"
|
|
#endif
|
|
|
|
|
|
/* On macOS
|
|
* sizeof(long)=8
|
|
* sizeof(long long)=8
|
|
* sizeof(size_t)=8
|
|
*/
|
|
|
|
bool all_tests()
|
|
{
|
|
bool all_ok = true;
|
|
|
|
|
|
#if defined(JIEF_DEBUG)
|
|
|
|
|
|
int ret;
|
|
ret = ParseXML_tests();
|
|
if ( ret != 0 ) {
|
|
printf("ParseXML_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = MemoryTracker_tests();
|
|
if ( ret != 0 ) {
|
|
printf("MemoryTracker_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
// ret = XUINTN_tests();
|
|
// if ( ret != 0 ) {
|
|
// printf("XUINTN_tests() failed at test %d\n", ret);
|
|
// all_ok = false;
|
|
// }
|
|
#endif
|
|
|
|
#if !defined(JIEF_DEBUG)
|
|
|
|
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
|
|
ret = printlib_tests();
|
|
if ( ret != 0 ) {
|
|
printf("printlib_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
#endif
|
|
#ifndef _MSC_VER
|
|
ret = printf_lite_tests();
|
|
if ( ret != 0 ) {
|
|
printf("printf_lite_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
#endif
|
|
ret = guid_tests();
|
|
if ( ret != 0 ) {
|
|
printf("guid_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = strlen_tests();
|
|
if ( ret != 0 ) {
|
|
printf("strlen_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = strcmp_tests();
|
|
if ( ret != 0 ) {
|
|
printf("strcmp_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = strncmp_tests();
|
|
if ( ret != 0 ) {
|
|
printf("strncmp_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = strcasecmp_tests();
|
|
if ( ret != 0 ) {
|
|
printf("strcasecmp_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = XToolsCommon_tests();
|
|
if ( ret != 0 ) {
|
|
printf("XToolsCommon_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = XArray_tests();
|
|
if ( ret != 0 ) {
|
|
printf("XArray_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = XObjArray_tests();
|
|
if ( ret != 0 ) {
|
|
printf("XObjArray_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = XString_tests();
|
|
if ( ret != 0 ) {
|
|
printf("XString_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = XStringArray_tests();
|
|
if ( ret != 0 ) {
|
|
printf("XStringArray_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = BootOptions_tests();
|
|
if ( ret != 0 ) {
|
|
printf("BootOptions_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = XBuffer_tests();
|
|
if ( ret != 0 ) {
|
|
printf("XBuffer_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = find_replace_mask_Clover_tests();
|
|
if ( ret != 0 ) {
|
|
printf("find_replace_mask_Clover_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = find_replace_mask_OC_tests();
|
|
if ( ret != 0 ) {
|
|
printf("find_replace_mask_OC_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = ParseXML_tests();
|
|
if ( ret != 0 ) {
|
|
printf("ParseXML_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = MacOsVersion_tests();
|
|
if ( ret != 0 ) {
|
|
printf("MacOsVersion_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
ret = xml_lite_tests();
|
|
if ( ret != 0 ) {
|
|
printf("xml_lite_tests() failed at test %d\n", ret);
|
|
all_ok = false;
|
|
}
|
|
|
|
#endif
|
|
|
|
if ( !all_ok ) {
|
|
printf("A test failed\n");
|
|
}
|
|
|
|
#if defined(JIEF_DEBUG)
|
|
if ( all_ok ) {
|
|
printf("All tests succeeded\n");
|
|
}
|
|
#endif
|
|
|
|
#if defined(CLOVER_BUILD) && defined(JIEF_DEBUG)
|
|
if ( all_ok ) {
|
|
// PauseForKey(NullXString8);
|
|
}else{
|
|
PauseForKey(NullXString8);
|
|
}
|
|
#endif
|
|
|
|
return all_ok;
|
|
}
|