static void DoI64DoubleTest(WCHAR *formatstr, INT64 value, WCHAR *valuestr, WCHAR *checkstr1) { WCHAR buf[256] = { 0 }; testvswp(buf, formatstr, value); if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) { Fail("ERROR: failed to insert %s into \"%s\"\n" "Expected \"%s\", got \"%s\".\n", value, convertC(formatstr), convertC(checkstr1), convertC(buf)); } }
/* ditto with wcslen */ static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr, WCHAR *checkstr1) { WCHAR buf[256] = { 0 }; testvswp(buf, formatstr, param); if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0) { Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n" "Expected \"%s\" got \"%s\".\n", paramstr, convertC(formatstr), convertC(checkstr1), convertC(buf)); } }
static void DoShortTest(WCHAR *formatstr, int param, WCHAR *checkstr) { WCHAR buf[256] = { 0 }; short int n = -1; testvswp(buf, formatstr, &n); if (n != param) { Fail("ERROR: Expected count parameter to resolve to %d, got %d\n", param, n); } if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0) { Fail("ERROR: Expected \"%s\" got \"%s\".\n", convertC(checkstr), convertC(buf)); } }
int __cdecl main(int argc, char *argv[]) { WCHAR *checkstr = NULL; WCHAR buf[256] = { 0 }; if (PAL_Initialize(argc, argv) != 0) return(FAIL); checkstr = convert("hello world"); testvswp(buf, checkstr); if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0) { Fail("ERROR: Expected \"%s\", got \"%s\"\n", convertC(checkstr), convertC(buf)); } free(checkstr); PAL_Terminate(); return PASS; }