From 7198499dd06bd3f39ba71ab63101a65ebe3d5c1e Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Tue, 24 Jul 2018 15:41:18 -0700 Subject: [PATCH] oleaut32/tests: Add test for VarBstrFromI4. Signed-off-by: Daniel Lehman Signed-off-by: Alexandre Julliard --- dlls/oleaut32/tests/vartype.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c index e93a6e6a8da..8c454e2b7bc 100644 --- a/dlls/oleaut32/tests/vartype.c +++ b/dlls/oleaut32/tests/vartype.c @@ -4540,6 +4540,36 @@ static void test_VarBoolChangeTypeEx(void) * BSTR */ +static void test_VarBstrFromI4(void) +{ + static const WCHAR int_min[] = { '-','2','1','4','7','4','8','3','6','4','8','\0' }; + static const WCHAR minus_42[] = { '-','4','2','\0' }; + BSTR bstr = NULL; + HRESULT hres; + LONG value; + LCID lcid; + + lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); + + value = -2147483648; + hres = VarBstrFromI4(value, lcid, LOCALE_NOUSEROVERRIDE, &bstr); + ok(hres == S_OK, "got hres 0x%08x\n", hres); + if (bstr) + { + todo_wine ok(memcmp(bstr, int_min, sizeof(int_min)) == 0, "string different\n"); + SysFreeString(bstr); + } + + value = -42; + hres = VarBstrFromI4(value, lcid, LOCALE_NOUSEROVERRIDE, &bstr); + ok(hres == S_OK, "got hres 0x%08x\n", hres); + if (bstr) + { + ok(memcmp(bstr, minus_42, sizeof(minus_42)) == 0, "string different\n"); + SysFreeString(bstr); + } +} + static void test_VarBstrFromR4(void) { static const WCHAR szNative[] = { '6','5','4','3','2','2','.','3','\0' }; @@ -6347,6 +6377,7 @@ START_TEST(vartype) test_VarBoolCopy(); test_VarBoolChangeTypeEx(); + test_VarBstrFromI4(); test_VarBstrFromR4(); test_VarBstrFromDate(); test_VarBstrFromCy();