Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1600 lines
49 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. gnftest.c
  5. Abstract:
  6. Test module for NLS API GetNumberFormat.
  7. NOTE: This code was simply hacked together quickly in order to
  8. test the different code modules of the NLS component.
  9. This is NOT meant to be a formal regression test.
  10. Revision History:
  11. 07-28-93 JulieB Created.
  12. --*/
  13. //
  14. // Include Files.
  15. //
  16. #include "nlstest.h"
  17. //
  18. // Constant Declarations.
  19. //
  20. #define BUFSIZE 500 // buffer size in wide chars
  21. #define GNF_INVALID_FLAGS ((DWORD)(~(LOCALE_NOUSEROVERRIDE)))
  22. #define GNF_ENGLISH_US L"1,234,567.44"
  23. #define GNF_CZECH L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44"
  24. //
  25. // Global Variables.
  26. //
  27. LCID Locale;
  28. LPWSTR pValue;
  29. LPWSTR pNegValue;
  30. NUMBERFMT NumFmt;
  31. WCHAR lpNumberStr[BUFSIZE];
  32. //
  33. // Number format buffers must be in line with the pAllLocales global
  34. // buffer.
  35. //
  36. LPWSTR pPosNumber[] =
  37. {
  38. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0402
  39. L"1,234,567.44", // 0x0404
  40. L"1,234,567.44", // 0x0804
  41. L"1,234,567.44", // 0x0c04
  42. L"1,234,567.44", // 0x1004
  43. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0405
  44. L"1.234.567,44", // 0x0406
  45. L"1.234.567,44", // 0x0407
  46. L"1'234'567.44", // 0x0807
  47. L"1.234.567,44", // 0x0c07
  48. L"1.234.567,44", // 0x0408
  49. L"1,234,567.44", // 0x0409
  50. L"1,234,567.44", // 0x0809
  51. L"1,234,567.44", // 0x0c09
  52. L"1,234,567.44", // 0x1009
  53. L"1,234,567.44", // 0x1409
  54. L"1,234,567.44", // 0x1809
  55. L"1.234.567,44", // 0x040a
  56. L"1,234,567.44", // 0x080a
  57. L"1.234.567,44", // 0x0c0a
  58. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x040b
  59. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x040c
  60. L"1.234.567,44", // 0x080c
  61. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0c0c
  62. L"1'234'567.44", // 0x100c
  63. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x040e
  64. L"1.234.567,44", // 0x040f
  65. L"1.234.567,44", // 0x0410
  66. L"1'234'567.44", // 0x0810
  67. L"1,234,567.44", // 0x0411
  68. L"1,234,567.44", // 0x0412
  69. L"1.234.567,44", // 0x0413
  70. L"1.234.567,44", // 0x0813
  71. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0414
  72. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0814
  73. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0415
  74. L"1.234.567,44", // 0x0416
  75. L"1.234.567,44", // 0x0816
  76. L"1.234.567,44", // 0x0418
  77. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0419
  78. L"1.234.567,44", // 0x041a
  79. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x041b
  80. L"1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x041d
  81. L"1.234.567,44", // 0x041f
  82. L"1.234.567,44" // 0x0424
  83. };
  84. LPWSTR pNegNumber[] =
  85. {
  86. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0402
  87. L"-1,234,567.44", // 0x0404
  88. L"-1,234,567.44", // 0x0804
  89. L"-1,234,567.44", // 0x0c04
  90. L"-1,234,567.44", // 0x1004
  91. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0405
  92. L"-1.234.567,44", // 0x0406
  93. L"-1.234.567,44", // 0x0407
  94. L"-1'234'567.44", // 0x0807
  95. L"-1.234.567,44", // 0x0c07
  96. L"-1.234.567,44", // 0x0408
  97. L"-1,234,567.44", // 0x0409
  98. L"-1,234,567.44", // 0x0809
  99. L"-1,234,567.44", // 0x0c09
  100. L"-1,234,567.44", // 0x1009
  101. L"-1,234,567.44", // 0x1409
  102. L"-1,234,567.44", // 0x1809
  103. L"-1.234.567,44", // 0x040a
  104. L"-1,234,567.44", // 0x080a
  105. L"-1.234.567,44", // 0x0c0a
  106. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x040b
  107. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x040c
  108. L"-1.234.567,44", // 0x080c
  109. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0c0c
  110. L"-1'234'567.44", // 0x100c
  111. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x040e
  112. L"-1.234.567,44", // 0x040f
  113. L"-1.234.567,44", // 0x0410
  114. L"-1'234'567.44", // 0x0810
  115. L"-1,234,567.44", // 0x0411
  116. L"-1,234,567.44", // 0x0412
  117. L"-1.234.567,44", // 0x0413
  118. L"-1.234.567,44", // 0x0813
  119. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0414
  120. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0814
  121. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0415
  122. L"-1.234.567,44", // 0x0416
  123. L"-1.234.567,44", // 0x0816
  124. L"-1.234.567,44", // 0x0418
  125. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x0419
  126. L"- 1.234.567,44", // 0x041a
  127. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x041b
  128. L"-1\x00a0\x0032\x0033\x0034\x00a0\x0035\x0036\x0037,44", // 0x041d
  129. L"-1.234.567,44", // 0x041f
  130. L"-1.234.567,44" // 0x0424
  131. };
  132. //
  133. // Forward Declarations.
  134. //
  135. BOOL
  136. InitGetNumberFormat();
  137. int
  138. GNF_BadParamCheck();
  139. int
  140. GNF_NormalCase();
  141. int
  142. GNF_Ansi();
  143. ////////////////////////////////////////////////////////////////////////////
  144. //
  145. // TestGetNumberFormat
  146. //
  147. // Test routine for GetNumberFormatW API.
  148. //
  149. // 07-28-93 JulieB Created.
  150. ////////////////////////////////////////////////////////////////////////////
  151. int TestGetNumberFormat()
  152. {
  153. int ErrCount = 0; // error count
  154. //
  155. // Print out what's being done.
  156. //
  157. printf("\n\nTESTING GetNumberFormatW...\n\n");
  158. //
  159. // Initialize global variables.
  160. //
  161. if (!InitGetNumberFormat())
  162. {
  163. printf("\nABORTED TestGetNumberFormat: Could not Initialize.\n");
  164. return (1);
  165. }
  166. //
  167. // Test bad parameters.
  168. //
  169. ErrCount += GNF_BadParamCheck();
  170. //
  171. // Test normal cases.
  172. //
  173. ErrCount += GNF_NormalCase();
  174. //
  175. // Test Ansi version.
  176. //
  177. ErrCount += GNF_Ansi();
  178. //
  179. // Print out result.
  180. //
  181. printf("\nGetNumberFormatW: ERRORS = %d\n", ErrCount);
  182. //
  183. // Return total number of errors found.
  184. //
  185. return (ErrCount);
  186. }
  187. ////////////////////////////////////////////////////////////////////////////
  188. //
  189. // InitGetNumberFormat
  190. //
  191. // This routine initializes the global variables. If no errors were
  192. // encountered, then it returns TRUE. Otherwise, it returns FALSE.
  193. //
  194. // 07-28-93 JulieB Created.
  195. ////////////////////////////////////////////////////////////////////////////
  196. BOOL InitGetNumberFormat()
  197. {
  198. //
  199. // Make a Locale.
  200. //
  201. Locale = MAKELCID(0x0409, 0);
  202. //
  203. // Initialize the value.
  204. //
  205. pValue = L"1234567.4444";
  206. pNegValue = L"-1234567.4444";
  207. //
  208. // Initialize the number format structure.
  209. //
  210. NumFmt.NumDigits = 3;
  211. NumFmt.LeadingZero = 1;
  212. NumFmt.Grouping = 3;
  213. NumFmt.lpDecimalSep = L"/";
  214. NumFmt.lpThousandSep = L";";
  215. NumFmt.NegativeOrder = 1;
  216. //
  217. // Return success.
  218. //
  219. return (TRUE);
  220. }
  221. ////////////////////////////////////////////////////////////////////////////
  222. //
  223. // GNF_BadParamCheck
  224. //
  225. // This routine passes in bad parameters to the API routines and checks to
  226. // be sure they are handled properly. The number of errors encountered
  227. // is returned to the caller.
  228. //
  229. // 07-28-93 JulieB Created.
  230. ////////////////////////////////////////////////////////////////////////////
  231. int GNF_BadParamCheck()
  232. {
  233. int NumErrors = 0; // error count - to be returned
  234. int rc; // return code
  235. NUMBERFMT MyNumFmt; // number format
  236. //
  237. // Bad Locale.
  238. //
  239. // Variation 1 - Bad Locale
  240. rc = GetNumberFormatW( (LCID)333,
  241. 0,
  242. pValue,
  243. NULL,
  244. lpNumberStr,
  245. BUFSIZE );
  246. CheckReturnBadParam( rc,
  247. 0,
  248. ERROR_INVALID_PARAMETER,
  249. "Bad Locale",
  250. &NumErrors );
  251. //
  252. // Null Pointers.
  253. //
  254. // Variation 1 - lpNumberStr = NULL
  255. rc = GetNumberFormatW( Locale,
  256. 0,
  257. pValue,
  258. NULL,
  259. NULL,
  260. BUFSIZE );
  261. CheckReturnBadParam( rc,
  262. 0,
  263. ERROR_INVALID_PARAMETER,
  264. "lpNumberStr NULL",
  265. &NumErrors );
  266. // Variation 2 - lpValue = NULL
  267. rc = GetNumberFormatW( Locale,
  268. 0,
  269. NULL,
  270. NULL,
  271. lpNumberStr,
  272. BUFSIZE );
  273. CheckReturnBadParam( rc,
  274. 0,
  275. ERROR_INVALID_PARAMETER,
  276. "lpNumberStr NULL",
  277. &NumErrors );
  278. //
  279. // Bad Count.
  280. //
  281. // Variation 1 - cchNumber < 0
  282. rc = GetNumberFormatW( Locale,
  283. 0,
  284. pValue,
  285. NULL,
  286. lpNumberStr,
  287. -1 );
  288. CheckReturnBadParam( rc,
  289. 0,
  290. ERROR_INVALID_PARAMETER,
  291. "cchNumber < 0",
  292. &NumErrors );
  293. //
  294. // Invalid Flag.
  295. //
  296. // Variation 1 - dwFlags = invalid
  297. rc = GetNumberFormatW( Locale,
  298. GNF_INVALID_FLAGS,
  299. pValue,
  300. NULL,
  301. lpNumberStr,
  302. BUFSIZE );
  303. CheckReturnBadParam( rc,
  304. 0,
  305. ERROR_INVALID_FLAGS,
  306. "Flag invalid",
  307. &NumErrors );
  308. // Variation 2 - lpFormat and NoUserOverride
  309. rc = GetNumberFormatW( Locale,
  310. LOCALE_NOUSEROVERRIDE,
  311. pValue,
  312. &NumFmt,
  313. lpNumberStr,
  314. BUFSIZE );
  315. CheckReturnBadParam( rc,
  316. 0,
  317. ERROR_INVALID_FLAGS,
  318. "lpFormat and NoUserOverride",
  319. &NumErrors );
  320. // Variation 3 - Use CP ACP, lpFormat and NoUserOverride
  321. rc = GetNumberFormatW( Locale,
  322. LOCALE_USE_CP_ACP | LOCALE_NOUSEROVERRIDE,
  323. pValue,
  324. &NumFmt,
  325. lpNumberStr,
  326. BUFSIZE );
  327. CheckReturnBadParam( rc,
  328. 0,
  329. ERROR_INVALID_FLAGS,
  330. "Use CP ACP, lpFormat and NoUserOverride",
  331. &NumErrors );
  332. //
  333. // Buffer Too Small.
  334. //
  335. // Variation 1 - cchNumber = too small
  336. rc = GetNumberFormatW( Locale,
  337. 0,
  338. pValue,
  339. NULL,
  340. lpNumberStr,
  341. 2 );
  342. CheckReturnBadParam( rc,
  343. 0,
  344. ERROR_INSUFFICIENT_BUFFER,
  345. "cchNumber too small",
  346. &NumErrors );
  347. //
  348. // Bad format passed in.
  349. //
  350. // Variation 1 - bad NumDigits
  351. MyNumFmt.NumDigits = 10;
  352. MyNumFmt.LeadingZero = 1;
  353. MyNumFmt.Grouping = 3;
  354. MyNumFmt.lpDecimalSep = L"/";
  355. MyNumFmt.lpThousandSep = L";";
  356. MyNumFmt.NegativeOrder = 1;
  357. rc = GetNumberFormatW( Locale,
  358. 0,
  359. pValue,
  360. &MyNumFmt,
  361. lpNumberStr,
  362. BUFSIZE );
  363. CheckReturnBadParam( rc,
  364. 0,
  365. ERROR_INVALID_PARAMETER,
  366. "bad NumDigits",
  367. &NumErrors );
  368. // Variation 2 - bad LeadingZero
  369. MyNumFmt.NumDigits = 3;
  370. MyNumFmt.LeadingZero = 2;
  371. MyNumFmt.Grouping = 3;
  372. MyNumFmt.lpDecimalSep = L"/";
  373. MyNumFmt.lpThousandSep = L";";
  374. MyNumFmt.NegativeOrder = 1;
  375. rc = GetNumberFormatW( Locale,
  376. 0,
  377. pValue,
  378. &MyNumFmt,
  379. lpNumberStr,
  380. BUFSIZE );
  381. CheckReturnBadParam( rc,
  382. 0,
  383. ERROR_INVALID_PARAMETER,
  384. "bad LeadingZero",
  385. &NumErrors );
  386. // Variation 3 - bad Grouping
  387. MyNumFmt.NumDigits = 3;
  388. MyNumFmt.LeadingZero = 1;
  389. MyNumFmt.Grouping = 10000;
  390. MyNumFmt.lpDecimalSep = L"/";
  391. MyNumFmt.lpThousandSep = L";";
  392. MyNumFmt.NegativeOrder = 1;
  393. rc = GetNumberFormatW( Locale,
  394. 0,
  395. pValue,
  396. &MyNumFmt,
  397. lpNumberStr,
  398. BUFSIZE );
  399. CheckReturnBadParam( rc,
  400. 0,
  401. ERROR_INVALID_PARAMETER,
  402. "bad Grouping",
  403. &NumErrors );
  404. // Variation 4 - bad DecimalSep
  405. MyNumFmt.NumDigits = 3;
  406. MyNumFmt.LeadingZero = 1;
  407. MyNumFmt.Grouping = 3;
  408. MyNumFmt.lpDecimalSep = NULL;
  409. MyNumFmt.lpThousandSep = L";";
  410. MyNumFmt.NegativeOrder = 1;
  411. rc = GetNumberFormatW( Locale,
  412. 0,
  413. pValue,
  414. &MyNumFmt,
  415. lpNumberStr,
  416. BUFSIZE );
  417. CheckReturnBadParam( rc,
  418. 0,
  419. ERROR_INVALID_PARAMETER,
  420. "bad DecimalSep",
  421. &NumErrors );
  422. // Variation 5 - bad DecimalSep 2
  423. MyNumFmt.NumDigits = 3;
  424. MyNumFmt.LeadingZero = 1;
  425. MyNumFmt.Grouping = 3;
  426. MyNumFmt.lpDecimalSep = L"////";
  427. MyNumFmt.lpThousandSep = L";";
  428. MyNumFmt.NegativeOrder = 1;
  429. rc = GetNumberFormatW( Locale,
  430. 0,
  431. pValue,
  432. &MyNumFmt,
  433. lpNumberStr,
  434. BUFSIZE );
  435. CheckReturnBadParam( rc,
  436. 0,
  437. ERROR_INVALID_PARAMETER,
  438. "bad DecimalSep 2",
  439. &NumErrors );
  440. // Variation 6 - bad DecimalSep 3
  441. MyNumFmt.NumDigits = 3;
  442. MyNumFmt.LeadingZero = 1;
  443. MyNumFmt.Grouping = 3;
  444. MyNumFmt.lpDecimalSep = L"6";
  445. MyNumFmt.lpThousandSep = L";";
  446. MyNumFmt.NegativeOrder = 1;
  447. rc = GetNumberFormatW( Locale,
  448. 0,
  449. pValue,
  450. &MyNumFmt,
  451. lpNumberStr,
  452. BUFSIZE );
  453. CheckReturnBadParam( rc,
  454. 0,
  455. ERROR_INVALID_PARAMETER,
  456. "bad DecimalSep 3",
  457. &NumErrors );
  458. // Variation 7 - bad ThousandSep
  459. MyNumFmt.NumDigits = 3;
  460. MyNumFmt.LeadingZero = 1;
  461. MyNumFmt.Grouping = 3;
  462. MyNumFmt.lpDecimalSep = L"/";
  463. MyNumFmt.lpThousandSep = NULL;
  464. MyNumFmt.NegativeOrder = 1;
  465. rc = GetNumberFormatW( Locale,
  466. 0,
  467. pValue,
  468. &MyNumFmt,
  469. lpNumberStr,
  470. BUFSIZE );
  471. CheckReturnBadParam( rc,
  472. 0,
  473. ERROR_INVALID_PARAMETER,
  474. "bad ThousandSep",
  475. &NumErrors );
  476. // Variation 8 - bad ThousandSep 2
  477. MyNumFmt.NumDigits = 3;
  478. MyNumFmt.LeadingZero = 1;
  479. MyNumFmt.Grouping = 3;
  480. MyNumFmt.lpDecimalSep = L"/";
  481. MyNumFmt.lpThousandSep = L";;;;";
  482. MyNumFmt.NegativeOrder = 1;
  483. rc = GetNumberFormatW( Locale,
  484. 0,
  485. pValue,
  486. &MyNumFmt,
  487. lpNumberStr,
  488. BUFSIZE );
  489. CheckReturnBadParam( rc,
  490. 0,
  491. ERROR_INVALID_PARAMETER,
  492. "bad ThousandSep 2",
  493. &NumErrors );
  494. // Variation 9 - bad ThousandSep 3
  495. MyNumFmt.NumDigits = 3;
  496. MyNumFmt.LeadingZero = 1;
  497. MyNumFmt.Grouping = 3;
  498. MyNumFmt.lpDecimalSep = L"/";
  499. MyNumFmt.lpThousandSep = L"6";
  500. MyNumFmt.NegativeOrder = 1;
  501. rc = GetNumberFormatW( Locale,
  502. 0,
  503. pValue,
  504. &MyNumFmt,
  505. lpNumberStr,
  506. BUFSIZE );
  507. CheckReturnBadParam( rc,
  508. 0,
  509. ERROR_INVALID_PARAMETER,
  510. "bad ThousandSep 3",
  511. &NumErrors );
  512. // Variation 10 - bad negative order
  513. MyNumFmt.NumDigits = 3;
  514. MyNumFmt.LeadingZero = 1;
  515. MyNumFmt.Grouping = 3;
  516. MyNumFmt.lpDecimalSep = L"/";
  517. MyNumFmt.lpThousandSep = L";";
  518. MyNumFmt.NegativeOrder = 5;
  519. rc = GetNumberFormatW( Locale,
  520. 0,
  521. pValue,
  522. &MyNumFmt,
  523. lpNumberStr,
  524. BUFSIZE );
  525. CheckReturnBadParam( rc,
  526. 0,
  527. ERROR_INVALID_PARAMETER,
  528. "bad negative order",
  529. &NumErrors );
  530. //
  531. // Return total number of errors found.
  532. //
  533. return (NumErrors);
  534. }
  535. ////////////////////////////////////////////////////////////////////////////
  536. //
  537. // GNF_NormalCase
  538. //
  539. // This routine tests the normal cases of the API routine.
  540. //
  541. // 07-28-93 JulieB Created.
  542. ////////////////////////////////////////////////////////////////////////////
  543. int GNF_NormalCase()
  544. {
  545. int NumErrors = 0; // error count - to be returned
  546. int rc; // return code
  547. int ctr; // loop counter
  548. #ifdef PERF
  549. DbgBreakPoint();
  550. #endif
  551. //
  552. // Locales.
  553. //
  554. // Variation 1 - System Default Locale
  555. rc = GetNumberFormatW( LOCALE_SYSTEM_DEFAULT,
  556. 0,
  557. pValue,
  558. NULL,
  559. lpNumberStr,
  560. BUFSIZE );
  561. CheckReturnValidW( rc,
  562. -1,
  563. lpNumberStr,
  564. GNF_ENGLISH_US,
  565. "sys default locale",
  566. &NumErrors );
  567. // Variation 2 - Current User Locale
  568. rc = GetNumberFormatW( LOCALE_USER_DEFAULT,
  569. 0,
  570. pValue,
  571. NULL,
  572. lpNumberStr,
  573. BUFSIZE );
  574. CheckReturnValidW( rc,
  575. -1,
  576. lpNumberStr,
  577. GNF_ENGLISH_US,
  578. "current user locale",
  579. &NumErrors );
  580. //
  581. // Language Neutral.
  582. //
  583. // Variation 1 - neutral
  584. rc = GetNumberFormatW( 0x0000,
  585. 0,
  586. pValue,
  587. NULL,
  588. lpNumberStr,
  589. BUFSIZE );
  590. CheckReturnValidW( rc,
  591. -1,
  592. lpNumberStr,
  593. GNF_ENGLISH_US,
  594. "neutral locale",
  595. &NumErrors );
  596. // Variation 2 - sys default
  597. rc = GetNumberFormatW( 0x0400,
  598. 0,
  599. pValue,
  600. NULL,
  601. lpNumberStr,
  602. BUFSIZE );
  603. CheckReturnValidW( rc,
  604. -1,
  605. lpNumberStr,
  606. GNF_ENGLISH_US,
  607. "sys default locale",
  608. &NumErrors );
  609. // Variation 3 - user default
  610. rc = GetNumberFormatW( 0x0800,
  611. 0,
  612. pValue,
  613. NULL,
  614. lpNumberStr,
  615. BUFSIZE );
  616. CheckReturnValidW( rc,
  617. -1,
  618. lpNumberStr,
  619. GNF_ENGLISH_US,
  620. "user default locale",
  621. &NumErrors );
  622. // Variation 4 - sub lang neutral US
  623. rc = GetNumberFormatW( 0x0009,
  624. 0,
  625. pValue,
  626. NULL,
  627. lpNumberStr,
  628. BUFSIZE );
  629. CheckReturnValidW( rc,
  630. -1,
  631. lpNumberStr,
  632. GNF_ENGLISH_US,
  633. "sub lang neutral US",
  634. &NumErrors );
  635. // Variation 5 - sub lang neutral Czech
  636. rc = GetNumberFormatW( 0x0005,
  637. 0,
  638. pValue,
  639. NULL,
  640. lpNumberStr,
  641. BUFSIZE );
  642. CheckReturnValidW( rc,
  643. -1,
  644. lpNumberStr,
  645. GNF_CZECH,
  646. "sub lang neutral Czech",
  647. &NumErrors );
  648. //
  649. // Use CP ACP.
  650. //
  651. // Variation 1 - Use CP ACP, System Default Locale
  652. rc = GetNumberFormatW( LOCALE_SYSTEM_DEFAULT,
  653. LOCALE_USE_CP_ACP,
  654. pValue,
  655. NULL,
  656. lpNumberStr,
  657. BUFSIZE );
  658. CheckReturnValidW( rc,
  659. -1,
  660. lpNumberStr,
  661. GNF_ENGLISH_US,
  662. "Use CP ACP, sys default locale",
  663. &NumErrors );
  664. //
  665. // cchNumber.
  666. //
  667. // Variation 1 - cchNumber = size of lpNumberStr buffer
  668. rc = GetNumberFormatW( Locale,
  669. 0,
  670. pValue,
  671. NULL,
  672. lpNumberStr,
  673. BUFSIZE );
  674. CheckReturnValidW( rc,
  675. -1,
  676. lpNumberStr,
  677. GNF_ENGLISH_US,
  678. "cchNumber = bufsize",
  679. &NumErrors );
  680. // Variation 2 - cchNumber = 0
  681. lpNumberStr[0] = 0x0000;
  682. rc = GetNumberFormatW( Locale,
  683. 0,
  684. pValue,
  685. NULL,
  686. lpNumberStr,
  687. 0 );
  688. CheckReturnValidW( rc,
  689. -1,
  690. NULL,
  691. GNF_ENGLISH_US,
  692. "cchNumber zero",
  693. &NumErrors );
  694. // Variation 3 - cchNumber = 0, lpNumberStr = NULL
  695. rc = GetNumberFormatW( Locale,
  696. 0,
  697. pValue,
  698. NULL,
  699. NULL,
  700. 0 );
  701. CheckReturnValidW( rc,
  702. -1,
  703. NULL,
  704. GNF_ENGLISH_US,
  705. "cchNumber (NULL ptr)",
  706. &NumErrors );
  707. //
  708. // lpFormat - pValue = 1234567.4444
  709. //
  710. // NumFmt.NumDigits = 3;
  711. // NumFmt.LeadingZero = 1;
  712. // NumFmt.Grouping = 3;
  713. // NumFmt.lpDecimalSep = L"/";
  714. // NumFmt.lpThousandSep = L";";
  715. // NumFmt.NegativeOrder = 1;
  716. //
  717. // Variation 1 - lpFormat
  718. rc = GetNumberFormatW( 0x0409,
  719. 0,
  720. pValue,
  721. &NumFmt,
  722. lpNumberStr,
  723. BUFSIZE );
  724. CheckReturnValidW( rc,
  725. -1,
  726. lpNumberStr,
  727. L"1;234;567/444",
  728. "lpFormat (1;234;567/444)",
  729. &NumErrors );
  730. // Variation 2 - lpFormat leading zero
  731. rc = GetNumberFormatW( 0x0409,
  732. 0,
  733. L".4444",
  734. &NumFmt,
  735. lpNumberStr,
  736. BUFSIZE );
  737. CheckReturnValidW( rc,
  738. -1,
  739. lpNumberStr,
  740. L"0/444",
  741. "lpFormat (0/444)",
  742. &NumErrors );
  743. // Variation 3 - lpFormat no decimal
  744. rc = GetNumberFormatW( 0x0409,
  745. 0,
  746. L"1234567",
  747. &NumFmt,
  748. lpNumberStr,
  749. BUFSIZE );
  750. CheckReturnValidW( rc,
  751. -1,
  752. lpNumberStr,
  753. L"1;234;567/000",
  754. "lpFormat (1;234;567/000)",
  755. &NumErrors );
  756. // Variation 4 - grouping check
  757. rc = GetNumberFormatW( 0x0409,
  758. 0,
  759. L"123456",
  760. &NumFmt,
  761. lpNumberStr,
  762. BUFSIZE );
  763. CheckReturnValidW( rc,
  764. -1,
  765. lpNumberStr,
  766. L"123;456/000",
  767. "lpFormat (123;456/000)",
  768. &NumErrors );
  769. // Variation 5 - grouping check
  770. rc = GetNumberFormatW( 0x0409,
  771. 0,
  772. L"12",
  773. &NumFmt,
  774. lpNumberStr,
  775. BUFSIZE );
  776. CheckReturnValidW( rc,
  777. -1,
  778. lpNumberStr,
  779. L"12/000",
  780. "grouping (12/000)",
  781. &NumErrors );
  782. // Variation 6 - rounding check
  783. NumFmt.NumDigits = 0;
  784. rc = GetNumberFormatW( 0x0409,
  785. 0,
  786. L".9999",
  787. &NumFmt,
  788. lpNumberStr,
  789. BUFSIZE );
  790. CheckReturnValidW( rc,
  791. -1,
  792. lpNumberStr,
  793. L"1",
  794. "rounding (1)",
  795. &NumErrors );
  796. NumFmt.NumDigits = 3;
  797. // Variation 7 - rounding check
  798. NumFmt.NumDigits = 0;
  799. NumFmt.LeadingZero = 0;
  800. rc = GetNumberFormatW( 0x0409,
  801. 0,
  802. L".9999",
  803. &NumFmt,
  804. lpNumberStr,
  805. BUFSIZE );
  806. CheckReturnValidW( rc,
  807. -1,
  808. lpNumberStr,
  809. L"1",
  810. "rounding (1) 2",
  811. &NumErrors );
  812. NumFmt.NumDigits = 3;
  813. NumFmt.LeadingZero = 1;
  814. // Variation 8 - rounding check
  815. NumFmt.NumDigits = 0;
  816. rc = GetNumberFormatW( 0x0409,
  817. 0,
  818. L".4999",
  819. &NumFmt,
  820. lpNumberStr,
  821. BUFSIZE );
  822. CheckReturnValidW( rc,
  823. -1,
  824. lpNumberStr,
  825. L"0",
  826. "rounding (0)",
  827. &NumErrors );
  828. NumFmt.NumDigits = 3;
  829. // Variation 9 - rounding check
  830. NumFmt.NumDigits = 0;
  831. NumFmt.LeadingZero = 0;
  832. rc = GetNumberFormatW( 0x0409,
  833. 0,
  834. L".4999",
  835. &NumFmt,
  836. lpNumberStr,
  837. BUFSIZE );
  838. CheckReturnValidW( rc,
  839. -1,
  840. lpNumberStr,
  841. L"0",
  842. "rounding (0) 2",
  843. &NumErrors );
  844. NumFmt.NumDigits = 3;
  845. NumFmt.LeadingZero = 1;
  846. // Variation 10 - strip leading zeros
  847. rc = GetNumberFormatW( 0x0409,
  848. 0,
  849. L"000000034.5",
  850. &NumFmt,
  851. lpNumberStr,
  852. BUFSIZE );
  853. CheckReturnValidW( rc,
  854. -1,
  855. lpNumberStr,
  856. L"34/500",
  857. "strip zeros (34/500)",
  858. &NumErrors );
  859. // Variation 11 - neg zero value
  860. rc = GetNumberFormatW( 0x0409,
  861. 0,
  862. L"-0.0001",
  863. &NumFmt,
  864. lpNumberStr,
  865. BUFSIZE );
  866. CheckReturnValidW( rc,
  867. -1,
  868. lpNumberStr,
  869. L"0/000",
  870. "neg zero (0/000)",
  871. &NumErrors );
  872. // Variation 12 - neg zero value
  873. rc = GetNumberFormatW( 0x0409,
  874. 0,
  875. L"-0.0009",
  876. &NumFmt,
  877. lpNumberStr,
  878. BUFSIZE );
  879. CheckReturnValidW( rc,
  880. -1,
  881. lpNumberStr,
  882. L"-0/001",
  883. "neg zero (-0/001)",
  884. &NumErrors );
  885. //
  886. // Flag values.
  887. //
  888. // Variation 1 - NOUSEROVERRIDE
  889. rc = GetNumberFormatW( Locale,
  890. LOCALE_NOUSEROVERRIDE,
  891. pValue,
  892. NULL,
  893. lpNumberStr,
  894. BUFSIZE );
  895. CheckReturnValidW( rc,
  896. -1,
  897. lpNumberStr,
  898. GNF_ENGLISH_US,
  899. "NoUserOverride",
  900. &NumErrors );
  901. //
  902. // Test all locales - pValue = 1234567.4444
  903. //
  904. for (ctr = 0; ctr < NumLocales; ctr++)
  905. {
  906. rc = GetNumberFormatW( pAllLocales[ctr],
  907. 0,
  908. pValue,
  909. NULL,
  910. lpNumberStr,
  911. BUFSIZE );
  912. CheckReturnValidLoopW( rc,
  913. -1,
  914. lpNumberStr,
  915. pPosNumber[ctr],
  916. "Pos",
  917. pAllLocales[ctr],
  918. &NumErrors );
  919. }
  920. //
  921. // Test all locales - pNegValue = -1234567.4444
  922. //
  923. for (ctr = 0; ctr < NumLocales; ctr++)
  924. {
  925. rc = GetNumberFormatW( pAllLocales[ctr],
  926. 0,
  927. pNegValue,
  928. NULL,
  929. lpNumberStr,
  930. BUFSIZE );
  931. CheckReturnValidLoopW( rc,
  932. -1,
  933. lpNumberStr,
  934. pNegNumber[ctr],
  935. "Neg",
  936. pAllLocales[ctr],
  937. &NumErrors );
  938. }
  939. //
  940. // Special case checks.
  941. //
  942. // Variation 1 - rounding check
  943. NumFmt.NumDigits = 3;
  944. NumFmt.LeadingZero = 1;
  945. NumFmt.Grouping = 0;
  946. NumFmt.lpDecimalSep = L".";
  947. NumFmt.lpThousandSep = L",";
  948. NumFmt.NegativeOrder = 1;
  949. rc = GetNumberFormatW( 0x0409,
  950. 0,
  951. L"799.9999",
  952. &NumFmt,
  953. lpNumberStr,
  954. BUFSIZE );
  955. CheckReturnValidW( rc,
  956. -1,
  957. lpNumberStr,
  958. L"800.000",
  959. "rounding (800.000)",
  960. &NumErrors );
  961. NumFmt.NumDigits = 3;
  962. NumFmt.LeadingZero = 1;
  963. NumFmt.Grouping = 2;
  964. NumFmt.lpDecimalSep = L".";
  965. NumFmt.lpThousandSep = L",";
  966. NumFmt.NegativeOrder = 1;
  967. rc = GetNumberFormatW( 0x0409,
  968. 0,
  969. L"799.9999",
  970. &NumFmt,
  971. lpNumberStr,
  972. BUFSIZE );
  973. CheckReturnValidW( rc,
  974. -1,
  975. lpNumberStr,
  976. L"8,00.000",
  977. "rounding (8,00.000)",
  978. &NumErrors );
  979. rc = GetNumberFormatW( 0x0409,
  980. 0,
  981. L"-799.9999",
  982. &NumFmt,
  983. lpNumberStr,
  984. BUFSIZE );
  985. CheckReturnValidW( rc,
  986. -1,
  987. lpNumberStr,
  988. L"-8,00.000",
  989. "rounding (-8,00.000)",
  990. &NumErrors );
  991. // Variation 2 - rounding check
  992. NumFmt.NumDigits = 0 ;
  993. NumFmt.LeadingZero = 1 ;
  994. NumFmt.Grouping = 2 ;
  995. NumFmt.lpDecimalSep = L"." ;
  996. NumFmt.lpThousandSep = L"," ;
  997. NumFmt.NegativeOrder = 1 ;
  998. rc = GetNumberFormatW( 0x0409,
  999. 0,
  1000. L"9.500",
  1001. &NumFmt,
  1002. lpNumberStr,
  1003. BUFSIZE );
  1004. CheckReturnValidW( rc,
  1005. -1,
  1006. lpNumberStr,
  1007. L"10",
  1008. "rounding (10)",
  1009. &NumErrors );
  1010. rc = GetNumberFormatW( 0x0409,
  1011. 0,
  1012. L"-9.500",
  1013. &NumFmt,
  1014. lpNumberStr,
  1015. BUFSIZE );
  1016. CheckReturnValidW( rc,
  1017. -1,
  1018. lpNumberStr,
  1019. L"-10",
  1020. "rounding (-10)",
  1021. &NumErrors );
  1022. rc = GetNumberFormatW( 0x0409,
  1023. 0,
  1024. L"99.500",
  1025. &NumFmt,
  1026. lpNumberStr,
  1027. BUFSIZE );
  1028. CheckReturnValidW( rc,
  1029. -1,
  1030. lpNumberStr,
  1031. L"1,00",
  1032. "rounding (1,00)",
  1033. &NumErrors );
  1034. rc = GetNumberFormatW( 0x0409,
  1035. 0,
  1036. L"-99.500",
  1037. &NumFmt,
  1038. lpNumberStr,
  1039. BUFSIZE );
  1040. CheckReturnValidW( rc,
  1041. -1,
  1042. lpNumberStr,
  1043. L"-1,00",
  1044. "rounding (-1,00)",
  1045. &NumErrors );
  1046. // Variation 3 - rounding check
  1047. NumFmt.NumDigits = 2;
  1048. NumFmt.LeadingZero = 1;
  1049. NumFmt.Grouping = 3;
  1050. NumFmt.NegativeOrder = 1;
  1051. NumFmt.lpDecimalSep = L"/";
  1052. NumFmt.lpThousandSep = L";";
  1053. rc = GetNumberFormatW( 0x0409,
  1054. 0,
  1055. L"1.3",
  1056. &NumFmt,
  1057. lpNumberStr,
  1058. BUFSIZE );
  1059. CheckReturnValidW( rc,
  1060. -1,
  1061. lpNumberStr,
  1062. L"1/30",
  1063. "rounding (1/30)",
  1064. &NumErrors );
  1065. rc = GetNumberFormatW( 0x0409,
  1066. 0,
  1067. L"1.399",
  1068. &NumFmt,
  1069. lpNumberStr,
  1070. BUFSIZE );
  1071. CheckReturnValidW( rc,
  1072. -1,
  1073. lpNumberStr,
  1074. L"1/40",
  1075. "rounding (1/40)",
  1076. &NumErrors );
  1077. rc = GetNumberFormatW( 0x0409,
  1078. 0,
  1079. L"0.999",
  1080. &NumFmt,
  1081. lpNumberStr,
  1082. BUFSIZE );
  1083. CheckReturnValidW( rc,
  1084. -1,
  1085. lpNumberStr,
  1086. L"1/00",
  1087. "rounding (1/00)",
  1088. &NumErrors );
  1089. rc = GetNumberFormatW( 0x0409,
  1090. 0,
  1091. L".999",
  1092. &NumFmt,
  1093. lpNumberStr,
  1094. BUFSIZE );
  1095. CheckReturnValidW( rc,
  1096. -1,
  1097. lpNumberStr,
  1098. L"1/00",
  1099. "rounding (1/00) 2",
  1100. &NumErrors );
  1101. rc = GetNumberFormatW( 0x0409,
  1102. 0,
  1103. L"-1.3",
  1104. &NumFmt,
  1105. lpNumberStr,
  1106. BUFSIZE );
  1107. CheckReturnValidW( rc,
  1108. -1,
  1109. lpNumberStr,
  1110. L"-1/30",
  1111. "rounding (-1/30)",
  1112. &NumErrors );
  1113. //
  1114. // Variation 4 - rounding check
  1115. //
  1116. NumFmt.NumDigits = 3;
  1117. NumFmt.LeadingZero = 0;
  1118. NumFmt.Grouping = 2;
  1119. NumFmt.NegativeOrder = 1;
  1120. NumFmt.lpDecimalSep = L".";
  1121. NumFmt.lpThousandSep = L",";
  1122. rc = GetNumberFormatW( 0x0409,
  1123. 0,
  1124. L".9999",
  1125. &NumFmt,
  1126. lpNumberStr,
  1127. BUFSIZE );
  1128. CheckReturnValidW( rc,
  1129. -1,
  1130. lpNumberStr,
  1131. L"1.000",
  1132. "rounding (1.000)",
  1133. &NumErrors );
  1134. // Variation 5 - grouping check
  1135. NumFmt.NumDigits = 3;
  1136. NumFmt.LeadingZero = 1;
  1137. NumFmt.Grouping = 32;
  1138. NumFmt.lpDecimalSep = L".";
  1139. NumFmt.lpThousandSep = L",";
  1140. NumFmt.NegativeOrder = 1;
  1141. rc = GetNumberFormatW( 0x0409,
  1142. 0,
  1143. L"1234567.999",
  1144. &NumFmt,
  1145. lpNumberStr,
  1146. BUFSIZE );
  1147. CheckReturnValidW( rc,
  1148. -1,
  1149. lpNumberStr,
  1150. L"12,34,567.999",
  1151. "grouping (12,34,567.999)",
  1152. &NumErrors );
  1153. rc = GetNumberFormatW( 0x0409,
  1154. 0,
  1155. L"-1234567.999",
  1156. &NumFmt,
  1157. lpNumberStr,
  1158. BUFSIZE );
  1159. CheckReturnValidW( rc,
  1160. -1,
  1161. lpNumberStr,
  1162. L"-12,34,567.999",
  1163. "grouping (-12,34,567.999)",
  1164. &NumErrors );
  1165. rc = GetNumberFormatW( 0x0409,
  1166. 0,
  1167. L"9999999.9999",
  1168. &NumFmt,
  1169. lpNumberStr,
  1170. BUFSIZE );
  1171. CheckReturnValidW( rc,
  1172. -1,
  1173. lpNumberStr,
  1174. L"1,00,00,000.000",
  1175. "grouping/rounding (1,00,00,000.000)",
  1176. &NumErrors );
  1177. rc = GetNumberFormatW( 0x0409,
  1178. 0,
  1179. L"-9999999.9999",
  1180. &NumFmt,
  1181. lpNumberStr,
  1182. BUFSIZE );
  1183. CheckReturnValidW( rc,
  1184. -1,
  1185. lpNumberStr,
  1186. L"-1,00,00,000.000",
  1187. "grouping/rounding (-1,00,00,000.000)",
  1188. &NumErrors );
  1189. // Variation 6 - grouping check
  1190. NumFmt.NumDigits = 3;
  1191. NumFmt.LeadingZero = 1;
  1192. NumFmt.Grouping = 320;
  1193. NumFmt.lpDecimalSep = L".";
  1194. NumFmt.lpThousandSep = L",";
  1195. NumFmt.NegativeOrder = 1;
  1196. rc = GetNumberFormatW( 0x0409,
  1197. 0,
  1198. L"123456789.999",
  1199. &NumFmt,
  1200. lpNumberStr,
  1201. BUFSIZE );
  1202. CheckReturnValidW( rc,
  1203. -1,
  1204. lpNumberStr,
  1205. L"1234,56,789.999",
  1206. "grouping (1234,56789.999)",
  1207. &NumErrors );
  1208. rc = GetNumberFormatW( 0x0409,
  1209. 0,
  1210. L"-123456789.999",
  1211. &NumFmt,
  1212. lpNumberStr,
  1213. BUFSIZE );
  1214. CheckReturnValidW( rc,
  1215. -1,
  1216. lpNumberStr,
  1217. L"-1234,56,789.999",
  1218. "grouping (-1234,56,789.999)",
  1219. &NumErrors );
  1220. rc = GetNumberFormatW( 0x0409,
  1221. 0,
  1222. L"9999999.9999",
  1223. &NumFmt,
  1224. lpNumberStr,
  1225. BUFSIZE );
  1226. CheckReturnValidW( rc,
  1227. -1,
  1228. lpNumberStr,
  1229. L"100,00,000.000",
  1230. "grouping/rounding (100,00,000.000)",
  1231. &NumErrors );
  1232. rc = GetNumberFormatW( 0x0409,
  1233. 0,
  1234. L"-9999999.9999",
  1235. &NumFmt,
  1236. lpNumberStr,
  1237. BUFSIZE );
  1238. CheckReturnValidW( rc,
  1239. -1,
  1240. lpNumberStr,
  1241. L"-100,00,000.000",
  1242. "grouping/rounding (-100,00,000.000)",
  1243. &NumErrors );
  1244. // Variation 7 - large number check
  1245. SetLastError(0);
  1246. rc = GetNumberFormat( LOCALE_USER_DEFAULT,
  1247. 0,
  1248. L"10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  1249. NULL,
  1250. lpNumberStr,
  1251. BUFSIZE );
  1252. CheckReturnValidW( rc,
  1253. -1,
  1254. lpNumberStr,
  1255. L"10,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00",
  1256. "big number",
  1257. &NumErrors );
  1258. CheckLastError( 0,
  1259. "Last Error should be 0 - call should have succeeded",
  1260. &NumErrors );
  1261. //
  1262. // Return total number of errors found.
  1263. //
  1264. return (NumErrors);
  1265. }
  1266. ////////////////////////////////////////////////////////////////////////////
  1267. //
  1268. // GNF_Ansi
  1269. //
  1270. // This routine tests the Ansi version of the API routine.
  1271. //
  1272. // 07-28-93 JulieB Created.
  1273. ////////////////////////////////////////////////////////////////////////////
  1274. int GNF_Ansi()
  1275. {
  1276. int NumErrors = 0; // error count - to be returned
  1277. int rc; // return code
  1278. BYTE pNumStrA[BUFSIZE]; // ptr to number string buffer
  1279. NUMBERFMTA NumFmtA; // number format structure
  1280. //
  1281. // GetNumberFormatA.
  1282. //
  1283. // Variation 1 - cchNumber = size of lpNumberStr buffer
  1284. rc = GetNumberFormatA( Locale,
  1285. 0,
  1286. "123456.789",
  1287. NULL,
  1288. pNumStrA,
  1289. BUFSIZE );
  1290. CheckReturnValidA( rc,
  1291. -1,
  1292. pNumStrA,
  1293. "123,456.79",
  1294. NULL,
  1295. "A version cchNumber = bufsize",
  1296. &NumErrors );
  1297. // Variation 2 - cchNumber = 0
  1298. pNumStrA[0] = 0x00;
  1299. rc = GetNumberFormatA( Locale,
  1300. 0,
  1301. "123456.789",
  1302. NULL,
  1303. pNumStrA,
  1304. 0 );
  1305. CheckReturnValidA( rc,
  1306. -1,
  1307. NULL,
  1308. "123,456.79",
  1309. NULL,
  1310. "A version cchNumber zero",
  1311. &NumErrors );
  1312. // Variation 3 - cchNumber = 0, lpNumberStr = NULL
  1313. rc = GetNumberFormatA( Locale,
  1314. 0,
  1315. "123456.789",
  1316. NULL,
  1317. NULL,
  1318. 0 );
  1319. CheckReturnValidA( rc,
  1320. -1,
  1321. NULL,
  1322. "123,456.79",
  1323. NULL,
  1324. "A version cchNumber (NULL ptr)",
  1325. &NumErrors );
  1326. //
  1327. // Use CP ACP.
  1328. //
  1329. // Variation 1 - Use CP ACP, cchNumber = bufsize
  1330. rc = GetNumberFormatA( Locale,
  1331. LOCALE_USE_CP_ACP,
  1332. "123456.789",
  1333. NULL,
  1334. pNumStrA,
  1335. BUFSIZE );
  1336. CheckReturnValidA( rc,
  1337. -1,
  1338. pNumStrA,
  1339. "123,456.79",
  1340. NULL,
  1341. "A version Use CP ACP, cchNumber = bufsize",
  1342. &NumErrors );
  1343. //
  1344. // lpFormat - pValue = 1234567.4444
  1345. //
  1346. NumFmtA.NumDigits = 3;
  1347. NumFmtA.LeadingZero = 1;
  1348. NumFmtA.Grouping = 3;
  1349. NumFmtA.lpDecimalSep = "/";
  1350. NumFmtA.lpThousandSep = NULL;
  1351. NumFmtA.NegativeOrder = 3;
  1352. // Variation 1 - lpFormat
  1353. rc = GetNumberFormatA( 0x0409,
  1354. 0,
  1355. "1234567.4444",
  1356. &NumFmtA,
  1357. pNumStrA,
  1358. BUFSIZE );
  1359. CheckReturnBadParam( rc,
  1360. 0,
  1361. ERROR_INVALID_PARAMETER,
  1362. "A version bad ThousandSep",
  1363. &NumErrors );
  1364. NumFmtA.NumDigits = 3;
  1365. NumFmtA.LeadingZero = 1;
  1366. NumFmtA.Grouping = 3;
  1367. NumFmtA.lpDecimalSep = "/";
  1368. NumFmtA.lpThousandSep = ";";
  1369. NumFmtA.NegativeOrder = 3;
  1370. // Variation 1 - lpFormat
  1371. rc = GetNumberFormatA( 0x0409,
  1372. 0,
  1373. "1234567.4444",
  1374. &NumFmtA,
  1375. pNumStrA,
  1376. BUFSIZE );
  1377. CheckReturnValidA( rc,
  1378. -1,
  1379. pNumStrA,
  1380. "1;234;567/444",
  1381. NULL,
  1382. "lpFormat (1;234;567/444)",
  1383. &NumErrors );
  1384. //
  1385. // Return total number of errors found.
  1386. //
  1387. return (NumErrors);
  1388. }