oleaut32/tests: Add more VarParseNumFromStr() hexadecimal/octal tests.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2021-07-27 01:43:17 +02:00 committed by Alexandre Julliard
parent fd0a55ce46
commit a74e2871ab
1 changed files with 48 additions and 1 deletions

View File

@ -1495,7 +1495,7 @@ static void test_VarParseNumFromStrEn(void)
EXPECTFAIL;
EXPECTRGB(0,FAILDIG);
/* Octal */
/* A leading 0 does not an octal number make */
CONVERT("0100", NUMPRS_HEX_OCT);
EXPECT(1,NUMPRS_HEX_OCT,0,4,0,2);
EXPECTRGB(0,1);
@ -1546,6 +1546,20 @@ static void test_VarParseNumFromStrEn(void)
EXPECTRGB(1,2);
EXPECTRGB(3,FAILDIG);
/* Only integers are allowed when using an alternative radix */
CONVERT("&ha.2", NUMPRS_HEX_OCT|NUMPRS_DECIMAL);
if (broken(1)) /* FIXME Reenable once Wine is less broken */
EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_DECIMAL,NUMPRS_HEX_OCT,3,4,0);
todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags);
EXPECTRGB(0,10);
todo_wine EXPECTRGB(1,FAILDIG);
/* Except if it looks like a plain decimal number */
CONVERT("01.2", NUMPRS_HEX_OCT|NUMPRS_DECIMAL);
EXPECT(2,NUMPRS_HEX_OCT|NUMPRS_DECIMAL,NUMPRS_DECIMAL,4,0,-1);
EXPECT2(1,2);
EXPECTRGB(3,FAILDIG);
/** NUMPRS_PARENS **/
/* Empty parens = error */
@ -1584,6 +1598,14 @@ static void test_VarParseNumFromStrEn(void)
*/
EXPECTRGB(4,FAILDIG);
/* With flag, thousands sep. and following digits consumed */
CONVERT("&h1,000", NUMPRS_HEX_OCT|NUMPRS_THOUSANDS);
if (broken(1)) /* FIXME Reenable once Wine is less broken */
EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_THOUSANDS,NUMPRS_HEX_OCT,3,4,0);
todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags);
EXPECTRGB(0,1);
todo_wine EXPECTRGB(1,FAILDIG);
/* With flag and decimal point, thousands sep. but not decimals consumed */
CONVERT("1,001.0", NUMPRS_THOUSANDS);
EXPECT(4,NUMPRS_THOUSANDS,NUMPRS_THOUSANDS,5,0,0);
@ -1636,6 +1658,17 @@ static void test_VarParseNumFromStrEn(void)
EXPECT2(1,1);
EXPECTRGB(2,FAILDIG);
/* With flag, currency amounts cannot be in hexadecimal */
CONVERT("$&ha", NUMPRS_HEX_OCT|NUMPRS_CURRENCY);
todo_wine EXPECTFAIL;
CONVERT("&ha$", NUMPRS_HEX_OCT|NUMPRS_CURRENCY);
if (broken(1)) /* FIXME Reenable once Wine is less broken */
EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_CURRENCY,NUMPRS_HEX_OCT,3,4,0);
todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags);
EXPECTRGB(0,10);
EXPECTRGB(1,FAILDIG);
/* With flag, the sign cannot be repeated before the amount */
CONVERT("$$11", NUMPRS_CURRENCY);
EXPECTFAIL;
@ -1768,6 +1801,20 @@ static void test_VarParseNumFromStrEn(void)
EXPECT(1,NUMPRS_EXPONENT,NUMPRS_EXPONENT,3,0,1);
EXPECT2(1,FAILDIG);
/* With flag, incompatible with NUMPRS_HEX_OCT */
CONVERT("&o1e1", NUMPRS_HEX_OCT|NUMPRS_EXPONENT);
if (broken(1)) /* FIXME Reenable once Wine is less broken */
EXPECT(1,NUMPRS_HEX_OCT|NUMPRS_EXPONENT,NUMPRS_HEX_OCT,3,3,0);
todo_wine ok(np.dwOutFlags == NUMPRS_HEX_OCT, "Got dwOutFlags=%08x\n", np.dwOutFlags);
EXPECT2(1,FAILDIG);
/* With flag, even if it sort of looks like an exponent */
CONVERT("&h1e2", NUMPRS_HEX_OCT|NUMPRS_EXPONENT);
EXPECT(3,NUMPRS_HEX_OCT|NUMPRS_EXPONENT,NUMPRS_HEX_OCT,5,4,0);
EXPECT2(1,0xe);
EXPECTRGB(2,2);
EXPECTRGB(3,FAILDIG);
/* Negative exponents are accepted without flags */
CONVERT("1e-1", NUMPRS_EXPONENT);
EXPECT(1,NUMPRS_EXPONENT,NUMPRS_EXPONENT,4,0,-1);