Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add support for wide characters.
  • Loading branch information
wilcob authored and wilcob committed Apr 2, 2015
commit cad2baa636ee134313fc0b2a4c462b8aceb0bc1c
1 change: 1 addition & 0 deletions include/CppUTest/CommandLineTestRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class CommandLineTestRunner

static int RunAllTests(int ac, const char** av);
static int RunAllTests(int ac, char** av);
static int RunAllTests(int ac, wchar_t** av);
CommandLineTestRunner(int ac, const char** av, TestOutput*, TestRegistry* registry);

virtual ~CommandLineTestRunner();
Expand Down
23 changes: 23 additions & 0 deletions src/CppUTest/CommandLineTestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,29 @@ int CommandLineTestRunner::RunAllTests(int ac, const char** av)
return result;
}

int CommandLineTestRunner::RunAllTests( int ac, wchar_t** av )
{
char** avc = new char*[ac];
for ( int i = 0; i < ac; i++ ) {
size_t len = wcslen( av[i] ) + 1;
avc[i] = new char[len];
wcstombs_s( 0 , avc[i], sizeof(char)*len, av[i], len );
}
int result = 0;

try {
RunAllTests( ac, avc );
}
catch ( ... ) {
}

for ( int i = 0; i < ac; i++ ) {
delete[] avc[i];
}
delete[] avc;
return result;
}

int CommandLineTestRunner::runAllTestsMain()
{
int testResult = 0;
Expand Down