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.

1475 lines
48 KiB

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