CloverBootloader/rEFIt_UEFI/cpp_unit_test/all_tests.cpp

125 lines
2.7 KiB
C++
Raw Normal View History

#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
#include "../cpp_foundation/XArray.h"
#include "../cpp_foundation/XObjArray.h"
2020-03-28 16:14:18 +01:00
#include "../Platform/BasicIO.h" // for PauseForKey
2020-03-26 13:59:20 +01:00
#include "XArray_tests.h"
#include "XObjArray_tests.h"
#include "XStringWArray_test.h"
2020-03-12 15:40:38 +01:00
#include "XString_test.h"
#include "strcmp_test.h"
#include "strncmp_test.h"
#include "strlen_test.h"
#include "printf_lite-test.h"
2020-04-05 14:25:39 +02:00
#include "LoadOptions_test.h"
2020-04-10 13:01:16 +02:00
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
#include "poolprint-test.h"
#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;
int ret;
ret = XString_tests();
2020-04-23 15:20:48 +02:00
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("XString16_tests() failed at test %d\n", ret);
2020-04-23 15:20:48 +02:00
all_ok = false;
}
//return ret;
// ret = XUINTN_tests();
// if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
// printf("XUINTN_tests() failed at test %d\n", ret);
// all_ok = false;
// }
#if defined(JIEF_DEBUG) && defined(CLOVER_BUILD)
ret = printlib_tests();
2020-04-10 13:01:16 +02:00
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("printlib_tests() failed at test %d\n", ret);
2020-04-10 13:01:16 +02:00
all_ok = false;
}
ret = poolprint_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("poolprint_tests() failed at test %d\n", ret);
2020-04-10 13:01:16 +02:00
all_ok = false;
}
2020-04-24 11:30:09 +02:00
#endif
#ifndef _MSC_VER
ret = printf_lite_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("printf_lite_tests() failed at test %d\n", ret);
all_ok = false;
}
#endif
ret = strlen_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("strlen_tests() failed at test %d\n", ret);
2020-04-05 14:25:39 +02:00
all_ok = false;
}
ret = BootOptions_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("BootOptions_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = strcmp_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("strcmp_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = strncmp_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("strncmp_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = XArray_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("XArray_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = XObjArray_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("XObjArray_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = XStringWArray_tests();
if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
printf("XStringWArray_tests() failed at test %d\n", ret);
all_ok = false;
}
// ret = XUINTN_tests();
// if ( ret != 0 ) {
2020-04-24 11:30:09 +02:00
// printf("XUINTN_tests() failed at test %d\n", ret);
// all_ok = false;
// }
if ( !all_ok ) {
2020-04-24 11:30:09 +02:00
printf("A test failed\n");
}
#if defined(JIEF_DEBUG)
2020-04-10 13:01:16 +02:00
if ( all_ok ) {
printf("All tests are ok\n");
}
#endif
#if defined(CLOVER_BUILD) && defined(JIEF_DEBUG)
2020-04-10 13:01:16 +02:00
if ( all_ok ) {
// PauseForKey(L"press");
}else{
PauseForKey(L"press");
}
#endif
return all_ok;
}