CloverBootloader/rEFIt_UEFI/cpp_unit_test/LoadOptions_test.cpp

54 lines
1.6 KiB
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
2020-04-17 14:27:38 +02:00
// {
// XString LoadOptions;
//
2020-04-30 08:22:26 +02:00
// LoadOptions = AddLoadOption(LoadOptions, "opt1"_XS8);
// LoadOptions = AddLoadOption(LoadOptions, "opt2"_XS8);
// LoadOptions = AddLoadOption(LoadOptions, "opt3"_XS8);
2020-04-17 14:27:38 +02:00
//
2020-04-30 08:22:26 +02:00
// if ( LoadOptions != "opt1 opt2 opt3"_XS8 ) return 10;
2020-04-17 14:27:38 +02:00
//
2020-04-30 08:22:26 +02:00
// XString LoadOptions1 = RemoveLoadOption(LoadOptions, "opt1"_XS8);
// if ( LoadOptions1 != "opt2 opt3"_XS8 ) return 11;
// XString LoadOptions2 = RemoveLoadOption(LoadOptions, "opt2"_XS8);
// if ( LoadOptions2 != "opt1 opt3"_XS8 ) return 12;
// XString LoadOptions3 = RemoveLoadOption(LoadOptions, "opt3"_XS8);
// if ( LoadOptions3 != "opt1 opt2"_XS8 ) return 13;
2020-04-17 14:27:38 +02:00
// }
2020-04-05 14:25:39 +02:00
{
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;
}