CloverBootloader/rEFIt_UEFI/cpp_unit_test/LoadOptions_test.cpp

38 lines
976 B
C++
Raw Normal View History

2020-08-17 21:40:52 +02:00
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
2020-04-05 14:25:39 +02:00
#include "../cpp_foundation/XString.h"
#include "../cpp_foundation/XStringArray.h"
#include "global_test.h"
int BootOptions_tests()
{
#ifdef JIEF_DEBUG
2020-04-24 11:30:09 +02:00
// printf("XStringW_tests -> Enter\n");
2020-04-05 14:25:39 +02:00
#endif
{
XString8Array LoadOptions;
2020-04-05 14:25:39 +02:00
2020-04-30 08:22:26 +02:00
LoadOptions.AddID("opt1"_XS8);
LoadOptions.AddID("opt2"_XS8);
LoadOptions.AddID("opt3"_XS8);
2020-04-05 14:25:39 +02:00
2020-04-30 08:22:26 +02:00
if ( LoadOptions.ConcatAll(" "_XS8) != "opt1 opt2 opt3"_XS8 ) return 30;
2020-04-05 14:25:39 +02:00
XString8Array LoadOptions1 = LoadOptions;
2020-04-30 08:22:26 +02:00
LoadOptions1.remove("opt1"_XS8);
if ( LoadOptions1.ConcatAll(" "_XS8) != "opt2 opt3"_XS8 ) return 31;
XString8Array LoadOptions2 = LoadOptions;
2020-04-30 08:22:26 +02:00
LoadOptions2.remove("opt2"_XS8);
if ( LoadOptions2.ConcatAll(" "_XS8) != "opt1 opt3"_XS8 ) return 32;
XString8Array LoadOptions3 = LoadOptions;
2020-04-30 08:22:26 +02:00
LoadOptions3.remove("opt3"_XS8);
if ( LoadOptions3.ConcatAll(" "_XS8) != "opt1 opt2"_XS8 ) return 33;
2020-04-05 14:25:39 +02:00
}
return 0;
}