Use caseless string comparison for Demos test name matching

This commit is contained in:
Jake Turner committed 2026-10-23 13:01:30 +01:00
1 parent d6a4009894
commit b7f943f6c5
1 file changed
+15 -2
+15 -2
View File
@@ -40,6 +40,12 @@
#define NK_ASSERT(expr) TEST_ASSERT(expr, "nuklear assertion failed")
#include "3rdparty/nuklear/nuklear.h"
static void ToLower(std::string &str)
{
for(char &c : str)
c = tolower(c);
}
#if defined(WIN32)
#define NK_GDI_IMPLEMENTATION
@@ -480,9 +486,13 @@ Usage: %s Test_Name [test_options]
bool validTestArg = false;
if(argc >= 2)
{
std::string match(argv[1]);
ToLower(match);
for(const TestMetadata &test : tests)
{
if(!strcmp(test.Name, argv[1]))
std::string name(test.Name);
ToLower(name);
if(name == match)
{
validTestArg = true;
break;
@@ -673,9 +683,12 @@ Usage: %s Test_Name [test_options]
SetUnhandledExceptionFilter(&exceptionHandler);
#endif
ToLower(testchoice);
for(const TestMetadata &test : tests)
{
if(testchoice == test.Name)
std::string name(test.Name);
ToLower(name);
if(testchoice == name)
{
TEST_LOG("Running '%s'", test.Name);
test.test->Prepare(argc, argv);