■
使い方
http://rest-term.com/archives/3138/
(1)
http://goyoki.hatenablog.com/entry/20110812/1313167570
(2)
http://dorapanda.asablo.jp/blog/2014/05/30/7330598
-
- -
// CppUtest_test1.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" #include <windows.h> #include <string> #include "CppUTest/CommandLineTestRunner.h" #ifdef _DEBUG bool _trace(TCHAR *format, ...) { TCHAR buffer[1000] = { 0 }; va_list argptr; va_start(argptr, format); wvsprintf(buffer, format, argptr); va_end(argptr); OutputDebugString(buffer); return true; } bool _trace_c(char *format, ...) { char buffer[1000] = { 0 }; va_list argptr; va_start(argptr, format); vsprintf(buffer, format, argptr); va_end(argptr); printf(buffer); return true; } #endif int _tmain(int argc, _TCHAR* argv[]) { char* locale = setlocale(LC_ALL, "Japanese"); char** argv_c = (char **)malloc(sizeof(char *) * argc); for (size_t i = 0; i < argc; i++) { std::wstring inputwstr = argv[0]; int wide_len = inputwstr.length(); int multi_len = ::wcstombs(NULL, inputwstr.c_str(), wide_len); argv_c[i] = (char*)calloc(multi_len + 1, sizeof(char)); ::wcstombs(argv_c[i], inputwstr.c_str(), multi_len); _trace_c("%s\n", argv_c[i]); } // テストランナー int ret = RUN_ALL_TESTS(argc, argv_c); for (size_t i = 0; i < argc; i++) { free(argv_c[i]); } free(argv_c); setlocale(LC_ALL, locale); }