[ATL_APITEST] Add 'atltest.h' and use it (#1822)

- Add "atltest.h" header file for common use in atl_apitest.
- Delete the duplicated and simplify.
This commit is contained in:
Katayama Hirofumi MZ 2019-08-12 19:24:08 +09:00 committed by GitHub
parent 610b852451
commit a800fa7bb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 147 additions and 298 deletions

View file

@ -8,27 +8,7 @@
#ifdef HAVE_APITEST
#include <apitest.h>
#else
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
int g_tests_executed = 0;
int g_tests_failed = 0;
void ok_func(const char *file, int line, bool value, const char *fmt, ...)
{
va_list va;
va_start(va, fmt);
if (!value)
{
printf("%s (%d): ", file, line);
vprintf(fmt, va);
g_tests_failed++;
}
g_tests_executed++;
va_end(va);
}
#undef ok
#define ok(value, ...) ok_func(__FILE__, __LINE__, value, __VA_ARGS__)
#define START_TEST(x) int main(void)
#include "atltest.h"
#endif
#include <atlbase.h>
@ -178,9 +158,4 @@ START_TEST(CSimpleArray)
}
ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
ok(array1.GetSize() == 0, "Expected array1.GetSize() is 0, was: %d\n", array1.GetSize());
#ifndef HAVE_APITEST
printf("CSimpleArray: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed);
return g_tests_failed;
#endif
}