oleaut32/tests: Insert the decimal seperator, if it is just 1 char.

This commit is contained in:
Marcus Meissner 2007-10-16 22:00:45 +02:00 committed by Alexandre Julliard
parent 6f865b9497
commit 2e2720fe63
1 changed files with 13 additions and 8 deletions

View File

@ -1777,7 +1777,7 @@ static HRESULT (WINAPI *pVarAbs)(LPVARIANT,LPVARIANT);
static void test_VarAbs(void) static void test_VarAbs(void)
{ {
static const WCHAR szNum[] = {'-','1','.','1','\0' }; static WCHAR szNum[] = {'-','1','.','1','\0' };
char buff[8]; char buff[8];
HRESULT hres; HRESULT hres;
VARIANT v, vDst, exp; VARIANT v, vDst, exp;
@ -1851,10 +1851,12 @@ static void test_VarAbs(void)
ok(hres == S_OK && V_VT(&vDst) == VT_CY && V_CY(&vDst).int64 == 10000, ok(hres == S_OK && V_VT(&vDst) == VT_CY && V_CY(&vDst).int64 == 10000,
"VarAbs(CY): expected 0x0 got 0x%X\n", hres); "VarAbs(CY): expected 0x0 got 0x%X\n", hres);
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buff, sizeof(buff)/sizeof(char)); GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buff, sizeof(buff)/sizeof(char));
if (buff[0] != '.' || buff[1]) if (buff[1])
{ {
trace("Skipping VarAbs(BSTR) as decimal separator is '%s'\n", buff); trace("Skipping VarAbs(BSTR) as decimal separator is '%s'\n", buff);
return; return;
} else {
szNum[2] = buff[0];
} }
V_VT(&v) = VT_BSTR; V_VT(&v) = VT_BSTR;
V_BSTR(&v) = (BSTR)szNum; V_BSTR(&v) = (BSTR)szNum;
@ -3102,8 +3104,8 @@ static void test_Round( int line, VARIANT *arg, int deci, VARIANT *expected )
static void test_VarRound(void) static void test_VarRound(void)
{ {
static const WCHAR szNumMin[] = {'-','1','.','4','5','\0' }; static WCHAR szNumMin[] = {'-','1','.','4','5','\0' };
static const WCHAR szNum[] = {'1','.','4','5','\0' }; static WCHAR szNum[] = {'1','.','4','5','\0' };
HRESULT hres; HRESULT hres;
VARIANT v, exp, vDst; VARIANT v, exp, vDst;
CY *pcy = &V_CY(&v); CY *pcy = &V_CY(&v);
@ -3139,13 +3141,16 @@ static void test_VarRound(void)
* compare the first few digits. */ * compare the first few digits. */
VARROUND(DATE,1.451,1,DATE,1.5); VARROUND(DATE,1.451,1,DATE,1.5);
VARROUND(DATE,-1.45,1,DATE,-1.4); VARROUND(DATE,-1.45,1,DATE,-1.4);
/* replace the decimal seperator */
GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buff, sizeof(buff)/sizeof(char)); GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buff, sizeof(buff)/sizeof(char));
if (buff[0] != '.' || buff[1]) if (!buff[1]) {
skip("Skipping VarRound(BSTR) as decimal separator is '%s'\n", buff); szNumMin[2] = buff[0];
else szNum[1] = buff[0];
{
VARROUND(BSTR,(BSTR)szNumMin,1,R8,-1.40); VARROUND(BSTR,(BSTR)szNumMin,1,R8,-1.40);
if (0) { VARROUND(BSTR,(BSTR)szNum,1,R8,1.50); } if (0) { VARROUND(BSTR,(BSTR)szNum,1,R8,1.50); }
} else {
skip("Skipping VarRound(BSTR) as decimal separator is '%s'\n", buff);
} }
VARROUND(R4,1.23456f,0,R4,1.0f); VARROUND(R4,1.23456f,0,R4,1.0f);