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.

2013 lines
63 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. slitest.c
  5. Abstract:
  6. Test module for NLS API SetLocaleInfo.
  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-14-93 JulieB Created.
  12. --*/
  13. //
  14. // Include Files.
  15. //
  16. #include "nlstest.h"
  17. //
  18. // Constant Declarations.
  19. //
  20. #define BUFSIZE 100 // buffer size in wide chars
  21. #define LCTYPE_INVALID 0x0000002 // invalid LCTYPE
  22. //
  23. // Global Variables.
  24. //
  25. LCID Locale;
  26. WCHAR lpLCData[BUFSIZE];
  27. WCHAR pTemp[BUFSIZE];
  28. WCHAR pSList[BUFSIZE];
  29. WCHAR pSTimeFormat[BUFSIZE];
  30. WCHAR pSTime[BUFSIZE];
  31. WCHAR pITime[BUFSIZE];
  32. WCHAR pSShortDate[BUFSIZE];
  33. WCHAR pSDate[BUFSIZE];
  34. //
  35. // Forward Declarations.
  36. //
  37. BOOL
  38. InitSetLocInfo();
  39. int
  40. SLI_BadParamCheck();
  41. int
  42. SLI_NormalCase();
  43. int
  44. SLI_Ansi();
  45. ////////////////////////////////////////////////////////////////////////////
  46. //
  47. // TestSetLocaleInfo
  48. //
  49. // Test routine for SetLocaleInfoW API.
  50. //
  51. // 07-14-93 JulieB Created.
  52. ////////////////////////////////////////////////////////////////////////////
  53. int TestSetLocaleInfo()
  54. {
  55. int ErrCount = 0; // error count
  56. //
  57. // Print out what's being done.
  58. //
  59. printf("\n\nTESTING SetLocaleInfoW...\n\n");
  60. //
  61. // Initialize global variables.
  62. //
  63. if (!InitSetLocInfo())
  64. {
  65. printf("\nABORTED TestSetLocaleInfo: Could not Initialize.\n");
  66. return (1);
  67. }
  68. //
  69. // Test bad parameters.
  70. //
  71. ErrCount += SLI_BadParamCheck();
  72. //
  73. // Test normal cases.
  74. //
  75. ErrCount += SLI_NormalCase();
  76. //
  77. // Test Ansi version.
  78. //
  79. ErrCount += SLI_Ansi();
  80. //
  81. // Print out result.
  82. //
  83. printf("\nSetLocaleInfoW: ERRORS = %d\n", ErrCount);
  84. //
  85. // Return total number of errors found.
  86. //
  87. return (ErrCount);
  88. }
  89. ////////////////////////////////////////////////////////////////////////////
  90. //
  91. // InitSetLocInfo
  92. //
  93. // This routine initializes the global variables. If no errors were
  94. // encountered, then it returns TRUE. Otherwise, it returns FALSE.
  95. //
  96. // 07-14-93 JulieB Created.
  97. ////////////////////////////////////////////////////////////////////////////
  98. BOOL InitSetLocInfo()
  99. {
  100. //
  101. // Make a Locale.
  102. //
  103. Locale = MAKELCID(0x0409, 0);
  104. //
  105. // Save the SLIST value to be restored later.
  106. //
  107. if ( !GetLocaleInfoW( Locale,
  108. LOCALE_SLIST,
  109. pSList,
  110. BUFSIZE ) )
  111. {
  112. printf("ERROR: Initialization SLIST - error = %d\n", GetLastError());
  113. return (FALSE);
  114. }
  115. if ( !GetLocaleInfoW( Locale,
  116. LOCALE_STIMEFORMAT,
  117. pSTimeFormat,
  118. BUFSIZE ) )
  119. {
  120. printf("ERROR: Initialization STIMEFORMAT - error = %d\n", GetLastError());
  121. return (FALSE);
  122. }
  123. if ( !GetLocaleInfoW( Locale,
  124. LOCALE_STIME,
  125. pSTime,
  126. BUFSIZE ) )
  127. {
  128. printf("ERROR: Initialization STIME - error = %d\n", GetLastError());
  129. return (FALSE);
  130. }
  131. if ( !GetLocaleInfoW( Locale,
  132. LOCALE_ITIME,
  133. pITime,
  134. BUFSIZE ) )
  135. {
  136. printf("ERROR: Initialization ITIME - error = %d\n", GetLastError());
  137. return (FALSE);
  138. }
  139. if ( !GetLocaleInfoW( Locale,
  140. LOCALE_SSHORTDATE,
  141. pSShortDate,
  142. BUFSIZE ) )
  143. {
  144. printf("ERROR: Initialization SSHORTDATE - error = %d\n", GetLastError());
  145. return (FALSE);
  146. }
  147. if ( !GetLocaleInfoW( Locale,
  148. LOCALE_SDATE,
  149. pSDate,
  150. BUFSIZE ) )
  151. {
  152. printf("ERROR: Initialization SDATE - error = %d\n", GetLastError());
  153. return (FALSE);
  154. }
  155. //
  156. // Return success.
  157. //
  158. return (TRUE);
  159. }
  160. ////////////////////////////////////////////////////////////////////////////
  161. //
  162. // SLI_BadParamCheck
  163. //
  164. // This routine passes in bad parameters to the API routines and checks to
  165. // be sure they are handled properly. The number of errors encountered
  166. // is returned to the caller.
  167. //
  168. // 07-14-93 JulieB Created.
  169. ////////////////////////////////////////////////////////////////////////////
  170. int SLI_BadParamCheck()
  171. {
  172. int NumErrors = 0; // error count - to be returned
  173. int rc; // return code
  174. //
  175. // Bad Locale.
  176. //
  177. // Variation 1 - Bad Locale
  178. rc = SetLocaleInfoW( (LCID)333,
  179. LOCALE_SLIST,
  180. L"," );
  181. CheckReturnBadParam( rc,
  182. 0,
  183. ERROR_INVALID_PARAMETER,
  184. "Bad Locale",
  185. &NumErrors );
  186. //
  187. // Null Pointers.
  188. //
  189. // Variation 1 - lpLCData = NULL
  190. rc = SetLocaleInfoW( Locale,
  191. LOCALE_SLIST,
  192. NULL );
  193. CheckReturnBadParam( rc,
  194. 0,
  195. ERROR_INVALID_PARAMETER,
  196. "lpLCData NULL",
  197. &NumErrors );
  198. //
  199. // Zero or Invalid Type.
  200. //
  201. // Variation 1 - LCType = invalid
  202. rc = SetLocaleInfoW( Locale,
  203. LCTYPE_INVALID,
  204. L"," );
  205. CheckReturnBadParam( rc,
  206. 0,
  207. ERROR_INVALID_FLAGS,
  208. "LCType invalid",
  209. &NumErrors );
  210. // Variation 2 - LCType = 0
  211. rc = SetLocaleInfoW( Locale,
  212. 0,
  213. L"," );
  214. CheckReturnBadParam( rc,
  215. 0,
  216. ERROR_INVALID_FLAGS,
  217. "LCType zero",
  218. &NumErrors );
  219. // Variation 1 - Use CP ACP, LCType = invalid
  220. rc = SetLocaleInfoW( Locale,
  221. LOCALE_USE_CP_ACP | LCTYPE_INVALID,
  222. L"," );
  223. CheckReturnBadParam( rc,
  224. 0,
  225. ERROR_INVALID_FLAGS,
  226. "Use CP ACP, LCType invalid",
  227. &NumErrors );
  228. //
  229. // Return total number of errors found.
  230. //
  231. return (NumErrors);
  232. }
  233. ////////////////////////////////////////////////////////////////////////////
  234. //
  235. // SLI_NormalCase
  236. //
  237. // This routine tests the normal cases of the API routine.
  238. //
  239. // 07-14-93 JulieB Created.
  240. ////////////////////////////////////////////////////////////////////////////
  241. int SLI_NormalCase()
  242. {
  243. int NumErrors = 0; // error count - to be returned
  244. int rc; // return code
  245. #ifdef PERF
  246. DbgBreakPoint();
  247. #endif
  248. //
  249. // Locales.
  250. //
  251. // Variation 1 - System Default Locale
  252. rc = SetLocaleInfoW( LOCALE_SYSTEM_DEFAULT,
  253. LOCALE_SLIST,
  254. L"::" );
  255. CheckReturnEqual( rc,
  256. FALSE,
  257. "SET - system default locale",
  258. &NumErrors );
  259. rc = GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT,
  260. LOCALE_SLIST,
  261. lpLCData,
  262. BUFSIZE );
  263. CheckReturnValidW( rc,
  264. -1,
  265. lpLCData,
  266. L"::",
  267. "GET - system default locale",
  268. &NumErrors );
  269. // Variation 2 - Current User Locale
  270. rc = SetLocaleInfoW( LOCALE_USER_DEFAULT,
  271. LOCALE_SLIST,
  272. L";;" );
  273. CheckReturnEqual( rc,
  274. FALSE,
  275. "SET - current user locale",
  276. &NumErrors );
  277. rc = GetLocaleInfoW( LOCALE_USER_DEFAULT,
  278. LOCALE_SLIST,
  279. lpLCData,
  280. BUFSIZE );
  281. CheckReturnValidW( rc,
  282. -1,
  283. lpLCData,
  284. L";;",
  285. "GET - current user locale",
  286. &NumErrors );
  287. //
  288. // Use CP ACP.
  289. //
  290. // Variation 1 - Use CP ACP, System Default Locale
  291. rc = SetLocaleInfoW( LOCALE_SYSTEM_DEFAULT,
  292. LOCALE_USE_CP_ACP | LOCALE_SLIST,
  293. L".." );
  294. CheckReturnEqual( rc,
  295. FALSE,
  296. "SET - Use CP ACP, system default locale",
  297. &NumErrors );
  298. rc = GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT,
  299. LOCALE_USE_CP_ACP | LOCALE_SLIST,
  300. lpLCData,
  301. BUFSIZE );
  302. CheckReturnValidW( rc,
  303. -1,
  304. lpLCData,
  305. L"..",
  306. "GET - Use CP ACP, system default locale",
  307. &NumErrors );
  308. //
  309. // LCTYPE values.
  310. //
  311. // Variation 1 - SLIST
  312. rc = SetLocaleInfoW( Locale,
  313. LOCALE_SLIST,
  314. L"::::" );
  315. CheckReturnEqual( rc,
  316. TRUE,
  317. "SET - MAX SLIST",
  318. &NumErrors );
  319. rc = SetLocaleInfoW( Locale,
  320. LOCALE_SLIST,
  321. L"''" );
  322. CheckReturnEqual( rc,
  323. FALSE,
  324. "SET - SLIST",
  325. &NumErrors );
  326. rc = GetLocaleInfoW( Locale,
  327. LOCALE_SLIST,
  328. lpLCData,
  329. BUFSIZE );
  330. CheckReturnValidW( rc,
  331. -1,
  332. lpLCData,
  333. L"''",
  334. "GET - SLIST",
  335. &NumErrors );
  336. rc = SetLocaleInfoW( Locale,
  337. LOCALE_SLIST,
  338. pSList );
  339. CheckReturnEqual( rc,
  340. FALSE,
  341. "ReSET - SLIST",
  342. &NumErrors );
  343. // Variation 2 - IMEASURE
  344. rc = GetLocaleInfoW( Locale,
  345. LOCALE_IMEASURE,
  346. pTemp,
  347. BUFSIZE );
  348. CheckReturnEqual( rc,
  349. 0,
  350. "GET - current IMEASURE",
  351. &NumErrors );
  352. rc = SetLocaleInfoW( Locale,
  353. LOCALE_IMEASURE,
  354. L"2" );
  355. CheckReturnEqual( rc,
  356. TRUE,
  357. "SET - invalid IMEASURE",
  358. &NumErrors );
  359. rc = SetLocaleInfoW( Locale,
  360. LOCALE_IMEASURE,
  361. L"0" );
  362. CheckReturnEqual( rc,
  363. FALSE,
  364. "SET - IMEASURE",
  365. &NumErrors );
  366. rc = GetLocaleInfoW( Locale,
  367. LOCALE_IMEASURE,
  368. lpLCData,
  369. BUFSIZE );
  370. CheckReturnValidW( rc,
  371. -1,
  372. lpLCData,
  373. L"0",
  374. "GET - IMEASURE",
  375. &NumErrors );
  376. rc = SetLocaleInfoW( Locale,
  377. LOCALE_IMEASURE,
  378. pTemp );
  379. CheckReturnEqual( rc,
  380. FALSE,
  381. "ReSET - IMEASURE",
  382. &NumErrors );
  383. // Variation 3 - SDECIMAL
  384. rc = GetLocaleInfoW( Locale,
  385. LOCALE_SDECIMAL,
  386. pTemp,
  387. BUFSIZE );
  388. CheckReturnEqual( rc,
  389. 0,
  390. "GET - current SDECIMAL",
  391. &NumErrors );
  392. rc = SetLocaleInfoW( Locale,
  393. LOCALE_SDECIMAL,
  394. L"[][]" );
  395. CheckReturnEqual( rc,
  396. TRUE,
  397. "SET - invalid SDECIMAL",
  398. &NumErrors );
  399. rc = SetLocaleInfoW( Locale,
  400. LOCALE_SDECIMAL,
  401. L"6" );
  402. CheckReturnEqual( rc,
  403. TRUE,
  404. "SET - invalid SDECIMAL (6)",
  405. &NumErrors );
  406. rc = SetLocaleInfoW( Locale,
  407. LOCALE_SDECIMAL,
  408. L"{" );
  409. CheckReturnEqual( rc,
  410. FALSE,
  411. "SET - SDECIMAL",
  412. &NumErrors );
  413. rc = GetLocaleInfoW( Locale,
  414. LOCALE_SDECIMAL,
  415. lpLCData,
  416. BUFSIZE );
  417. CheckReturnValidW( rc,
  418. -1,
  419. lpLCData,
  420. L"{",
  421. "GET - SDECIMAL",
  422. &NumErrors );
  423. rc = SetLocaleInfoW( Locale,
  424. LOCALE_SDECIMAL,
  425. pTemp );
  426. CheckReturnEqual( rc,
  427. FALSE,
  428. "ReSET - SDECIMAL",
  429. &NumErrors );
  430. // Variation 4 - STHOUSAND
  431. rc = GetLocaleInfoW( Locale,
  432. LOCALE_STHOUSAND,
  433. pTemp,
  434. BUFSIZE );
  435. CheckReturnEqual( rc,
  436. 0,
  437. "GET - current STHOUSAND",
  438. &NumErrors );
  439. rc = SetLocaleInfoW( Locale,
  440. LOCALE_STHOUSAND,
  441. L"[][]" );
  442. CheckReturnEqual( rc,
  443. TRUE,
  444. "SET - invalid STHOUSAND",
  445. &NumErrors );
  446. rc = SetLocaleInfoW( Locale,
  447. LOCALE_STHOUSAND,
  448. L"6" );
  449. CheckReturnEqual( rc,
  450. TRUE,
  451. "SET - invalid STHOUSAND (6)",
  452. &NumErrors );
  453. rc = SetLocaleInfoW( Locale,
  454. LOCALE_STHOUSAND,
  455. L"{" );
  456. CheckReturnEqual( rc,
  457. FALSE,
  458. "SET - STHOUSAND",
  459. &NumErrors );
  460. rc = GetLocaleInfoW( Locale,
  461. LOCALE_STHOUSAND,
  462. lpLCData,
  463. BUFSIZE );
  464. CheckReturnValidW( rc,
  465. -1,
  466. lpLCData,
  467. L"{",
  468. "GET - STHOUSAND",
  469. &NumErrors );
  470. rc = SetLocaleInfoW( Locale,
  471. LOCALE_STHOUSAND,
  472. pTemp );
  473. CheckReturnEqual( rc,
  474. FALSE,
  475. "ReSET - STHOUSAND",
  476. &NumErrors );
  477. // Variation 5 - SGROUPING
  478. rc = GetLocaleInfoW( Locale,
  479. LOCALE_SGROUPING,
  480. pTemp,
  481. BUFSIZE );
  482. CheckReturnEqual( rc,
  483. 0,
  484. "GET - current SGROUPING",
  485. &NumErrors );
  486. rc = SetLocaleInfoW( Locale,
  487. LOCALE_SGROUPING,
  488. L"3;" );
  489. CheckReturnEqual( rc,
  490. TRUE,
  491. "SET - invalid SGROUPING 1",
  492. &NumErrors );
  493. rc = SetLocaleInfoW( Locale,
  494. LOCALE_SGROUPING,
  495. L"3;2;" );
  496. CheckReturnEqual( rc,
  497. TRUE,
  498. "SET - invalid SGROUPING 2",
  499. &NumErrors );
  500. rc = SetLocaleInfoW( Locale,
  501. LOCALE_SGROUPING,
  502. L"10;0" );
  503. CheckReturnEqual( rc,
  504. TRUE,
  505. "SET - invalid SGROUPING 3",
  506. &NumErrors );
  507. rc = SetLocaleInfoW( Locale,
  508. LOCALE_SGROUPING,
  509. L"3:0" );
  510. CheckReturnEqual( rc,
  511. TRUE,
  512. "SET - invalid SGROUPING 4",
  513. &NumErrors );
  514. rc = SetLocaleInfoW( Locale,
  515. LOCALE_SGROUPING,
  516. L"5;0" );
  517. CheckReturnEqual( rc,
  518. FALSE,
  519. "SET - SGROUPING",
  520. &NumErrors );
  521. rc = GetLocaleInfoW( Locale,
  522. LOCALE_SGROUPING,
  523. lpLCData,
  524. BUFSIZE );
  525. CheckReturnValidW( rc,
  526. -1,
  527. lpLCData,
  528. L"5;0",
  529. "GET - SGROUPING",
  530. &NumErrors );
  531. rc = SetLocaleInfoW( Locale,
  532. LOCALE_SGROUPING,
  533. L"3;2;0" );
  534. CheckReturnEqual( rc,
  535. FALSE,
  536. "SET - SGROUPING",
  537. &NumErrors );
  538. rc = GetLocaleInfoW( Locale,
  539. LOCALE_SGROUPING,
  540. lpLCData,
  541. BUFSIZE );
  542. CheckReturnValidW( rc,
  543. -1,
  544. lpLCData,
  545. L"3;2;0",
  546. "GET - SGROUPING",
  547. &NumErrors );
  548. rc = SetLocaleInfoW( Locale,
  549. LOCALE_SGROUPING,
  550. pTemp );
  551. CheckReturnEqual( rc,
  552. FALSE,
  553. "ReSET - SGROUPING",
  554. &NumErrors );
  555. // Variation 6 - IDIGITS
  556. rc = GetLocaleInfoW( Locale,
  557. LOCALE_IDIGITS,
  558. pTemp,
  559. BUFSIZE );
  560. CheckReturnEqual( rc,
  561. 0,
  562. "GET - current IDIGITS",
  563. &NumErrors );
  564. rc = SetLocaleInfoW( Locale,
  565. LOCALE_IDIGITS,
  566. L"a" );
  567. CheckReturnEqual( rc,
  568. TRUE,
  569. "SET - invalid IDIGITS",
  570. &NumErrors );
  571. rc = SetLocaleInfoW( Locale,
  572. LOCALE_IDIGITS,
  573. L"5" );
  574. CheckReturnEqual( rc,
  575. FALSE,
  576. "SET - IDIGITS",
  577. &NumErrors );
  578. rc = GetLocaleInfoW( Locale,
  579. LOCALE_IDIGITS,
  580. lpLCData,
  581. BUFSIZE );
  582. CheckReturnValidW( rc,
  583. -1,
  584. lpLCData,
  585. L"5",
  586. "GET - IDIGITS",
  587. &NumErrors );
  588. rc = SetLocaleInfoW( Locale,
  589. LOCALE_IDIGITS,
  590. pTemp );
  591. CheckReturnEqual( rc,
  592. FALSE,
  593. "ReSET - IDIGITS",
  594. &NumErrors );
  595. // Variation 7 - ILZERO
  596. rc = GetLocaleInfoW( Locale,
  597. LOCALE_ILZERO,
  598. pTemp,
  599. BUFSIZE );
  600. CheckReturnEqual( rc,
  601. 0,
  602. "GET - current ILZERO",
  603. &NumErrors );
  604. rc = SetLocaleInfoW( Locale,
  605. LOCALE_ILZERO,
  606. L"2" );
  607. CheckReturnEqual( rc,
  608. TRUE,
  609. "SET - invalid ILZERO",
  610. &NumErrors );
  611. rc = SetLocaleInfoW( Locale,
  612. LOCALE_ILZERO,
  613. L"1" );
  614. CheckReturnEqual( rc,
  615. FALSE,
  616. "SET - ILZERO",
  617. &NumErrors );
  618. rc = GetLocaleInfoW( Locale,
  619. LOCALE_ILZERO,
  620. lpLCData,
  621. BUFSIZE );
  622. CheckReturnValidW( rc,
  623. -1,
  624. lpLCData,
  625. L"1",
  626. "GET - ILZERO",
  627. &NumErrors );
  628. rc = SetLocaleInfoW( Locale,
  629. LOCALE_ILZERO,
  630. pTemp );
  631. CheckReturnEqual( rc,
  632. FALSE,
  633. "ReSET - ILZERO",
  634. &NumErrors );
  635. // Variation 8 - SCURRENCY
  636. rc = GetLocaleInfoW( Locale,
  637. LOCALE_SCURRENCY,
  638. pTemp,
  639. BUFSIZE );
  640. CheckReturnEqual( rc,
  641. 0,
  642. "GET - current SCURRENCY",
  643. &NumErrors );
  644. rc = SetLocaleInfoW( Locale,
  645. LOCALE_SCURRENCY,
  646. L"[][][]" );
  647. CheckReturnEqual( rc,
  648. TRUE,
  649. "SET - invalid SCURRENCY",
  650. &NumErrors );
  651. rc = SetLocaleInfoW( Locale,
  652. LOCALE_SCURRENCY,
  653. L"x5" );
  654. CheckReturnEqual( rc,
  655. TRUE,
  656. "SET - invalid SCURRENCY (x5)",
  657. &NumErrors );
  658. rc = SetLocaleInfoW( Locale,
  659. LOCALE_SCURRENCY,
  660. L"%@%" );
  661. CheckReturnEqual( rc,
  662. FALSE,
  663. "SET - SCURRENCY",
  664. &NumErrors );
  665. rc = GetLocaleInfoW( Locale,
  666. LOCALE_SCURRENCY,
  667. lpLCData,
  668. BUFSIZE );
  669. CheckReturnValidW( rc,
  670. -1,
  671. lpLCData,
  672. L"%@%",
  673. "GET - SCURRENCY",
  674. &NumErrors );
  675. rc = SetLocaleInfoW( Locale,
  676. LOCALE_SCURRENCY,
  677. pTemp );
  678. CheckReturnEqual( rc,
  679. FALSE,
  680. "ReSET - SCURRENCY",
  681. &NumErrors );
  682. // Variation 9 - SMONDECIMALSEP
  683. rc = GetLocaleInfoW( Locale,
  684. LOCALE_SMONDECIMALSEP,
  685. pTemp,
  686. BUFSIZE );
  687. CheckReturnEqual( rc,
  688. 0,
  689. "GET - current SMONDECIMALSEP",
  690. &NumErrors );
  691. rc = SetLocaleInfoW( Locale,
  692. LOCALE_SMONDECIMALSEP,
  693. L"{}{}" );
  694. CheckReturnEqual( rc,
  695. TRUE,
  696. "SET - invalid SMONDECIMALSEP",
  697. &NumErrors );
  698. rc = SetLocaleInfoW( Locale,
  699. LOCALE_SMONDECIMALSEP,
  700. L"6" );
  701. CheckReturnEqual( rc,
  702. TRUE,
  703. "SET - invalid SMONDECIMALSEP (6)",
  704. &NumErrors );
  705. rc = SetLocaleInfoW( Locale,
  706. LOCALE_SMONDECIMALSEP,
  707. L"%" );
  708. CheckReturnEqual( rc,
  709. FALSE,
  710. "SET - SMONDECIMALSEP",
  711. &NumErrors );
  712. rc = GetLocaleInfoW( Locale,
  713. LOCALE_SMONDECIMALSEP,
  714. lpLCData,
  715. BUFSIZE );
  716. CheckReturnValidW( rc,
  717. -1,
  718. lpLCData,
  719. L"%",
  720. "GET - SMONDECIMALSEP",
  721. &NumErrors );
  722. rc = SetLocaleInfoW( Locale,
  723. LOCALE_SMONDECIMALSEP,
  724. pTemp );
  725. CheckReturnEqual( rc,
  726. FALSE,
  727. "ReSET - SMONDECIMALSEP",
  728. &NumErrors );
  729. // Variation 10 - SMONTHOUSANDSEP
  730. rc = GetLocaleInfoW( Locale,
  731. LOCALE_SMONTHOUSANDSEP,
  732. pTemp,
  733. BUFSIZE );
  734. CheckReturnEqual( rc,
  735. 0,
  736. "GET - current SMONTHOUSANDSEP",
  737. &NumErrors );
  738. rc = SetLocaleInfoW( Locale,
  739. LOCALE_SMONTHOUSANDSEP,
  740. L"{}{}" );
  741. CheckReturnEqual( rc,
  742. TRUE,
  743. "SET - invalid SMONTHOUSANDSEP",
  744. &NumErrors );
  745. rc = SetLocaleInfoW( Locale,
  746. LOCALE_SMONTHOUSANDSEP,
  747. L"6" );
  748. CheckReturnEqual( rc,
  749. TRUE,
  750. "SET - invalid SMONTHOUSANDSEP (6)",
  751. &NumErrors );
  752. rc = SetLocaleInfoW( Locale,
  753. LOCALE_SMONTHOUSANDSEP,
  754. L"%" );
  755. CheckReturnEqual( rc,
  756. FALSE,
  757. "SET - SMONTHOUSANDSEP",
  758. &NumErrors );
  759. rc = GetLocaleInfoW( Locale,
  760. LOCALE_SMONTHOUSANDSEP,
  761. lpLCData,
  762. BUFSIZE );
  763. CheckReturnValidW( rc,
  764. -1,
  765. lpLCData,
  766. L"%",
  767. "GET - SMONTHOUSANDSEP",
  768. &NumErrors );
  769. rc = SetLocaleInfoW( Locale,
  770. LOCALE_SMONTHOUSANDSEP,
  771. pTemp );
  772. CheckReturnEqual( rc,
  773. FALSE,
  774. "ReSET - SMONTHOUSANDSEP",
  775. &NumErrors );
  776. // Variation 11 - SMONGROUPING
  777. rc = GetLocaleInfoW( Locale,
  778. LOCALE_SMONGROUPING,
  779. pTemp,
  780. BUFSIZE );
  781. CheckReturnEqual( rc,
  782. 0,
  783. "GET - current SMONGROUPING",
  784. &NumErrors );
  785. rc = SetLocaleInfoW( Locale,
  786. LOCALE_SMONGROUPING,
  787. L"3;" );
  788. CheckReturnEqual( rc,
  789. TRUE,
  790. "SET - invalid SMONGROUPING 1",
  791. &NumErrors );
  792. rc = SetLocaleInfoW( Locale,
  793. LOCALE_SMONGROUPING,
  794. L"3;2;" );
  795. CheckReturnEqual( rc,
  796. TRUE,
  797. "SET - invalid SMONGROUPING 2",
  798. &NumErrors );
  799. rc = SetLocaleInfoW( Locale,
  800. LOCALE_SMONGROUPING,
  801. L"10;0" );
  802. CheckReturnEqual( rc,
  803. TRUE,
  804. "SET - invalid SMONGROUPING 3",
  805. &NumErrors );
  806. rc = SetLocaleInfoW( Locale,
  807. LOCALE_SMONGROUPING,
  808. L"3:0" );
  809. CheckReturnEqual( rc,
  810. TRUE,
  811. "SET - invalid SMONGROUPING 4",
  812. &NumErrors );
  813. rc = SetLocaleInfoW( Locale,
  814. LOCALE_SMONGROUPING,
  815. L"5;0" );
  816. CheckReturnEqual( rc,
  817. FALSE,
  818. "SET - SMONGROUPING",
  819. &NumErrors );
  820. rc = GetLocaleInfoW( Locale,
  821. LOCALE_SMONGROUPING,
  822. lpLCData,
  823. BUFSIZE );
  824. CheckReturnValidW( rc,
  825. -1,
  826. lpLCData,
  827. L"5;0",
  828. "GET - SMONGROUPING",
  829. &NumErrors );
  830. rc = SetLocaleInfoW( Locale,
  831. LOCALE_SMONGROUPING,
  832. L"3;2;0" );
  833. CheckReturnEqual( rc,
  834. FALSE,
  835. "SET - SMONGROUPING",
  836. &NumErrors );
  837. rc = GetLocaleInfoW( Locale,
  838. LOCALE_SMONGROUPING,
  839. lpLCData,
  840. BUFSIZE );
  841. CheckReturnValidW( rc,
  842. -1,
  843. lpLCData,
  844. L"3;2;0",
  845. "GET - SMONGROUPING",
  846. &NumErrors );
  847. rc = SetLocaleInfoW( Locale,
  848. LOCALE_SMONGROUPING,
  849. pTemp );
  850. CheckReturnEqual( rc,
  851. FALSE,
  852. "ReSET - SMONGROUPING",
  853. &NumErrors );
  854. // Variation 12 - ICURRDIGITS
  855. rc = GetLocaleInfoW( Locale,
  856. LOCALE_ICURRDIGITS,
  857. pTemp,
  858. BUFSIZE );
  859. CheckReturnEqual( rc,
  860. 0,
  861. "GET - current ICURRDIGITS",
  862. &NumErrors );
  863. rc = SetLocaleInfoW( Locale,
  864. LOCALE_ICURRDIGITS,
  865. L"aa" );
  866. CheckReturnEqual( rc,
  867. TRUE,
  868. "SET - invalid ICURRDIGITS",
  869. &NumErrors );
  870. rc = SetLocaleInfoW( Locale,
  871. LOCALE_ICURRDIGITS,
  872. L"85" );
  873. CheckReturnEqual( rc,
  874. FALSE,
  875. "SET - ICURRDIGITS",
  876. &NumErrors );
  877. rc = GetLocaleInfoW( Locale,
  878. LOCALE_ICURRDIGITS,
  879. lpLCData,
  880. BUFSIZE );
  881. CheckReturnValidW( rc,
  882. -1,
  883. lpLCData,
  884. L"85",
  885. "GET - ICURRDIGITS",
  886. &NumErrors );
  887. rc = SetLocaleInfoW( Locale,
  888. LOCALE_ICURRDIGITS,
  889. pTemp );
  890. CheckReturnEqual( rc,
  891. FALSE,
  892. "ReSET - ICURRDIGITS",
  893. &NumErrors );
  894. // Variation 13 - ICURRENCY
  895. rc = GetLocaleInfoW( Locale,
  896. LOCALE_ICURRENCY,
  897. pTemp,
  898. BUFSIZE );
  899. CheckReturnEqual( rc,
  900. 0,
  901. "GET - current ICURRENCY",
  902. &NumErrors );
  903. rc = SetLocaleInfoW( Locale,
  904. LOCALE_ICURRENCY,
  905. L"4" );
  906. CheckReturnEqual( rc,
  907. TRUE,
  908. "SET - invalid ICURRENCY",
  909. &NumErrors );
  910. rc = SetLocaleInfoW( Locale,
  911. LOCALE_ICURRENCY,
  912. L"3" );
  913. CheckReturnEqual( rc,
  914. FALSE,
  915. "SET - ICURRENCY",
  916. &NumErrors );
  917. rc = GetLocaleInfoW( Locale,
  918. LOCALE_ICURRENCY,
  919. lpLCData,
  920. BUFSIZE );
  921. CheckReturnValidW( rc,
  922. -1,
  923. lpLCData,
  924. L"3",
  925. "GET - ICURRENCY",
  926. &NumErrors );
  927. rc = SetLocaleInfoW( Locale,
  928. LOCALE_ICURRENCY,
  929. pTemp );
  930. CheckReturnEqual( rc,
  931. FALSE,
  932. "ReSET - ICURRENCY",
  933. &NumErrors );
  934. // Variation 14 - INEGCURR
  935. rc = GetLocaleInfoW( Locale,
  936. LOCALE_INEGCURR,
  937. pTemp,
  938. BUFSIZE );
  939. CheckReturnEqual( rc,
  940. 0,
  941. "GET - current INEGCURR",
  942. &NumErrors );
  943. rc = SetLocaleInfoW( Locale,
  944. LOCALE_INEGCURR,
  945. L"16" );
  946. CheckReturnEqual( rc,
  947. TRUE,
  948. "SET - invalid INEGCURR",
  949. &NumErrors );
  950. rc = SetLocaleInfoW( Locale,
  951. LOCALE_INEGCURR,
  952. L"13" );
  953. CheckReturnEqual( rc,
  954. FALSE,
  955. "SET - INEGCURR",
  956. &NumErrors );
  957. rc = GetLocaleInfoW( Locale,
  958. LOCALE_INEGCURR,
  959. lpLCData,
  960. BUFSIZE );
  961. CheckReturnValidW( rc,
  962. -1,
  963. lpLCData,
  964. L"13",
  965. "GET - INEGCURR",
  966. &NumErrors );
  967. rc = SetLocaleInfoW( Locale,
  968. LOCALE_INEGCURR,
  969. pTemp );
  970. CheckReturnEqual( rc,
  971. FALSE,
  972. "ReSET - INEGCURR",
  973. &NumErrors );
  974. // Variation 15 - SPOSITIVESIGN
  975. rc = GetLocaleInfoW( Locale,
  976. LOCALE_SPOSITIVESIGN,
  977. pTemp,
  978. BUFSIZE );
  979. CheckReturnEqual( rc,
  980. 0,
  981. "GET - current SPOSITIVESIGN",
  982. &NumErrors );
  983. rc = SetLocaleInfoW( Locale,
  984. LOCALE_SPOSITIVESIGN,
  985. L"{}{}{" );
  986. CheckReturnEqual( rc,
  987. TRUE,
  988. "SET - invalid SPOSITIVESIGN",
  989. &NumErrors );
  990. rc = SetLocaleInfoW( Locale,
  991. LOCALE_SPOSITIVESIGN,
  992. L"x5" );
  993. CheckReturnEqual( rc,
  994. TRUE,
  995. "SET - invalid SPOSITIVESIGN (x5)",
  996. &NumErrors );
  997. rc = SetLocaleInfoW( Locale,
  998. LOCALE_SPOSITIVESIGN,
  999. L"[]" );
  1000. CheckReturnEqual( rc,
  1001. FALSE,
  1002. "SET - SPOSITIVESIGN",
  1003. &NumErrors );
  1004. rc = GetLocaleInfoW( Locale,
  1005. LOCALE_SPOSITIVESIGN,
  1006. lpLCData,
  1007. BUFSIZE );
  1008. CheckReturnValidW( rc,
  1009. -1,
  1010. lpLCData,
  1011. L"[]",
  1012. "GET - SPOSITIVESIGN",
  1013. &NumErrors );
  1014. rc = SetLocaleInfoW( Locale,
  1015. LOCALE_SPOSITIVESIGN,
  1016. pTemp );
  1017. CheckReturnEqual( rc,
  1018. FALSE,
  1019. "ReSET - SPOSITIVESIGN",
  1020. &NumErrors );
  1021. // Variation 16 - SNEGATIVESIGN
  1022. rc = GetLocaleInfoW( Locale,
  1023. LOCALE_SNEGATIVESIGN,
  1024. pTemp,
  1025. BUFSIZE );
  1026. CheckReturnEqual( rc,
  1027. 0,
  1028. "GET - SNEGATIVESIGN",
  1029. &NumErrors );
  1030. rc = SetLocaleInfoW( Locale,
  1031. LOCALE_SNEGATIVESIGN,
  1032. L"{}{}{" );
  1033. CheckReturnEqual( rc,
  1034. TRUE,
  1035. "SET - invalid SNEGATIVESIGN",
  1036. &NumErrors );
  1037. rc = SetLocaleInfoW( Locale,
  1038. LOCALE_SNEGATIVESIGN,
  1039. L"x5" );
  1040. CheckReturnEqual( rc,
  1041. TRUE,
  1042. "SET - invalid SNEGATIVESIGN (x5)",
  1043. &NumErrors );
  1044. rc = SetLocaleInfoW( Locale,
  1045. LOCALE_SNEGATIVESIGN,
  1046. L"[]" );
  1047. CheckReturnEqual( rc,
  1048. FALSE,
  1049. "SET - SNEGATIVESIGN",
  1050. &NumErrors );
  1051. rc = GetLocaleInfoW( Locale,
  1052. LOCALE_SNEGATIVESIGN,
  1053. lpLCData,
  1054. BUFSIZE );
  1055. CheckReturnValidW( rc,
  1056. -1,
  1057. lpLCData,
  1058. L"[]",
  1059. "GET - SNEGATIVESIGN",
  1060. &NumErrors );
  1061. rc = SetLocaleInfoW( Locale,
  1062. LOCALE_SNEGATIVESIGN,
  1063. pTemp );
  1064. CheckReturnEqual( rc,
  1065. FALSE,
  1066. "ReSET - SNEGATIVESIGN",
  1067. &NumErrors );
  1068. // Variation 17 - STIMEFORMAT
  1069. rc = SetLocaleInfoW( Locale,
  1070. LOCALE_STIMEFORMAT,
  1071. L"HHHHHmmmmmsssssHHHHHmmmmmsssssHHHHHmmmmmsssssHHHHHmmmmmsssssHHHHHmmmmmsssssHHHHH" );
  1072. CheckReturnEqual( rc,
  1073. TRUE,
  1074. "SET - invalid STIMEFORMAT",
  1075. &NumErrors );
  1076. rc = SetLocaleInfoW( Locale,
  1077. LOCALE_STIMEFORMAT,
  1078. L"tt HH/mm/ss" );
  1079. CheckReturnEqual( rc,
  1080. FALSE,
  1081. "SET - STIMEFORMAT",
  1082. &NumErrors );
  1083. rc = GetLocaleInfoW( Locale,
  1084. LOCALE_STIMEFORMAT,
  1085. lpLCData,
  1086. BUFSIZE );
  1087. CheckReturnValidW( rc,
  1088. -1,
  1089. lpLCData,
  1090. L"tt HH/mm/ss",
  1091. "GET - STIMEFORMAT",
  1092. &NumErrors );
  1093. rc = GetLocaleInfoW( Locale,
  1094. LOCALE_STIME,
  1095. lpLCData,
  1096. BUFSIZE );
  1097. CheckReturnValidW( rc,
  1098. -1,
  1099. lpLCData,
  1100. L"/",
  1101. "GET - STIME from STIMEFORMAT",
  1102. &NumErrors );
  1103. rc = GetLocaleInfoW( Locale,
  1104. LOCALE_ITIME,
  1105. lpLCData,
  1106. BUFSIZE );
  1107. CheckReturnValidW( rc,
  1108. -1,
  1109. lpLCData,
  1110. L"1",
  1111. "GET - ITIME from STIMEFORMAT",
  1112. &NumErrors );
  1113. rc = GetLocaleInfoW( Locale,
  1114. LOCALE_ITLZERO,
  1115. lpLCData,
  1116. BUFSIZE );
  1117. CheckReturnValidW( rc,
  1118. -1,
  1119. lpLCData,
  1120. L"1",
  1121. "GET - ITLZERO from STIMEFORMAT",
  1122. &NumErrors );
  1123. rc = GetLocaleInfoW( Locale,
  1124. LOCALE_ITIMEMARKPOSN,
  1125. lpLCData,
  1126. BUFSIZE );
  1127. CheckReturnValidW( rc,
  1128. -1,
  1129. lpLCData,
  1130. L"1",
  1131. "GET - ITIMEMARKPOSN from STIMEFORMAT",
  1132. &NumErrors );
  1133. rc = SetLocaleInfoW( Locale,
  1134. LOCALE_STIMEFORMAT,
  1135. pSTimeFormat );
  1136. CheckReturnEqual( rc,
  1137. FALSE,
  1138. "ReSET - STIMEFORMAT",
  1139. &NumErrors );
  1140. rc = SetLocaleInfoW( Locale,
  1141. LOCALE_STIME,
  1142. pSTime );
  1143. CheckReturnEqual( rc,
  1144. FALSE,
  1145. "ReSET - STIME from STIMEFORMAT",
  1146. &NumErrors );
  1147. rc = SetLocaleInfoW( Locale,
  1148. LOCALE_ITIME,
  1149. pITime );
  1150. CheckReturnEqual( rc,
  1151. FALSE,
  1152. "ReSET - ITIME from STIMEFORMAT",
  1153. &NumErrors );
  1154. // Variation 18 - STIME
  1155. rc = SetLocaleInfoW( Locale,
  1156. LOCALE_STIME,
  1157. L"{**}" );
  1158. CheckReturnEqual( rc,
  1159. TRUE,
  1160. "SET - invalid STIME",
  1161. &NumErrors );
  1162. rc = SetLocaleInfoW( Locale,
  1163. LOCALE_STIME,
  1164. L"x5" );
  1165. CheckReturnEqual( rc,
  1166. TRUE,
  1167. "SET - invalid STIME (x5)",
  1168. &NumErrors );
  1169. rc = SetLocaleInfoW( Locale,
  1170. LOCALE_STIMEFORMAT,
  1171. L"HH/mm/ss" );
  1172. CheckReturnEqual( rc,
  1173. FALSE,
  1174. "SET - STIMEFORMAT from STIME",
  1175. &NumErrors );
  1176. rc = SetLocaleInfoW( Locale,
  1177. LOCALE_STIME,
  1178. L"[]" );
  1179. CheckReturnEqual( rc,
  1180. FALSE,
  1181. "SET - STIME",
  1182. &NumErrors );
  1183. rc = GetLocaleInfoW( Locale,
  1184. LOCALE_STIME,
  1185. lpLCData,
  1186. BUFSIZE );
  1187. CheckReturnValidW( rc,
  1188. -1,
  1189. lpLCData,
  1190. L"[]",
  1191. "GET - STIME",
  1192. &NumErrors );
  1193. rc = GetLocaleInfoW( Locale,
  1194. LOCALE_STIMEFORMAT,
  1195. lpLCData,
  1196. BUFSIZE );
  1197. CheckReturnValidW( rc,
  1198. -1,
  1199. lpLCData,
  1200. L"HH[]mm[]ss",
  1201. "GET - STIMEFORMAT from STIME",
  1202. &NumErrors );
  1203. rc = SetLocaleInfoW( Locale,
  1204. LOCALE_STIME,
  1205. pSTime );
  1206. CheckReturnEqual( rc,
  1207. FALSE,
  1208. "ReSET - STIME",
  1209. &NumErrors );
  1210. rc = SetLocaleInfoW( Locale,
  1211. LOCALE_STIMEFORMAT,
  1212. pSTimeFormat );
  1213. CheckReturnEqual( rc,
  1214. FALSE,
  1215. "ReSET - STIMEFORMAT from STIME",
  1216. &NumErrors );
  1217. // Variation 18.1 - STIME
  1218. rc = SetLocaleInfoW( Locale,
  1219. LOCALE_STIMEFORMAT,
  1220. L"HH/mm/ss' ('hh' oclock)'" );
  1221. CheckReturnEqual( rc,
  1222. FALSE,
  1223. "SET - STIMEFORMAT from STIME",
  1224. &NumErrors );
  1225. rc = SetLocaleInfoW( Locale,
  1226. LOCALE_STIME,
  1227. L"[]" );
  1228. CheckReturnEqual( rc,
  1229. FALSE,
  1230. "SET - STIME",
  1231. &NumErrors );
  1232. rc = GetLocaleInfoW( Locale,
  1233. LOCALE_STIME,
  1234. lpLCData,
  1235. BUFSIZE );
  1236. CheckReturnValidW( rc,
  1237. -1,
  1238. lpLCData,
  1239. L"[]",
  1240. "GET - STIME",
  1241. &NumErrors );
  1242. rc = GetLocaleInfoW( Locale,
  1243. LOCALE_STIMEFORMAT,
  1244. lpLCData,
  1245. BUFSIZE );
  1246. CheckReturnValidW( rc,
  1247. -1,
  1248. lpLCData,
  1249. L"HH[]mm[]ss' ('hh' oclock)'",
  1250. "GET - STIMEFORMAT from STIME",
  1251. &NumErrors );
  1252. rc = SetLocaleInfoW( Locale,
  1253. LOCALE_STIME,
  1254. pSTime );
  1255. CheckReturnEqual( rc,
  1256. FALSE,
  1257. "ReSET - STIME",
  1258. &NumErrors );
  1259. rc = SetLocaleInfoW( Locale,
  1260. LOCALE_STIMEFORMAT,
  1261. pSTimeFormat );
  1262. CheckReturnEqual( rc,
  1263. FALSE,
  1264. "ReSET - STIMEFORMAT from STIME",
  1265. &NumErrors );
  1266. // Variation 19 - ITIME
  1267. rc = SetLocaleInfoW( Locale,
  1268. LOCALE_ITIME,
  1269. L"2" );
  1270. CheckReturnEqual( rc,
  1271. TRUE,
  1272. "SET - invalid ITIME",
  1273. &NumErrors );
  1274. rc = SetLocaleInfoW( Locale,
  1275. LOCALE_STIMEFORMAT,
  1276. L"hh/mm/ss" );
  1277. CheckReturnEqual( rc,
  1278. FALSE,
  1279. "SET - STIMEFORMAT from ITIME",
  1280. &NumErrors );
  1281. rc = SetLocaleInfoW( Locale,
  1282. LOCALE_ITIME,
  1283. L"1" );
  1284. CheckReturnEqual( rc,
  1285. FALSE,
  1286. "SET - ITIME",
  1287. &NumErrors );
  1288. rc = GetLocaleInfoW( Locale,
  1289. LOCALE_ITIME,
  1290. lpLCData,
  1291. BUFSIZE );
  1292. CheckReturnValidW( rc,
  1293. -1,
  1294. lpLCData,
  1295. L"1",
  1296. "GET - ITIME",
  1297. &NumErrors );
  1298. rc = GetLocaleInfoW( Locale,
  1299. LOCALE_STIMEFORMAT,
  1300. lpLCData,
  1301. BUFSIZE );
  1302. CheckReturnValidW( rc,
  1303. -1,
  1304. lpLCData,
  1305. L"HH/mm/ss",
  1306. "GET - STIMEFORMAT from ITIME",
  1307. &NumErrors );
  1308. rc = SetLocaleInfoW( Locale,
  1309. LOCALE_ITIME,
  1310. pITime );
  1311. CheckReturnEqual( rc,
  1312. FALSE,
  1313. "ReSET - ITIME",
  1314. &NumErrors );
  1315. rc = SetLocaleInfoW( Locale,
  1316. LOCALE_STIMEFORMAT,
  1317. pSTimeFormat );
  1318. CheckReturnEqual( rc,
  1319. FALSE,
  1320. "ReSET - STIMEFORMAT from ITIME",
  1321. &NumErrors );
  1322. // Variation 20 - S1159
  1323. rc = GetLocaleInfoW( Locale,
  1324. LOCALE_S1159,
  1325. pTemp,
  1326. BUFSIZE );
  1327. CheckReturnEqual( rc,
  1328. 0,
  1329. "GET - current S1159",
  1330. &NumErrors );
  1331. rc = SetLocaleInfoW( Locale,
  1332. LOCALE_S1159,
  1333. L"123456789012345" );
  1334. CheckReturnEqual( rc,
  1335. TRUE,
  1336. "SET - invalid S1159",
  1337. &NumErrors );
  1338. rc = SetLocaleInfoW( Locale,
  1339. LOCALE_S1159,
  1340. L"DAWN" );
  1341. CheckReturnEqual( rc,
  1342. FALSE,
  1343. "SET - S1159",
  1344. &NumErrors );
  1345. rc = GetLocaleInfoW( Locale,
  1346. LOCALE_S1159,
  1347. lpLCData,
  1348. BUFSIZE );
  1349. CheckReturnValidW( rc,
  1350. -1,
  1351. lpLCData,
  1352. L"DAWN",
  1353. "GET - S1159",
  1354. &NumErrors );
  1355. rc = SetLocaleInfoW( Locale,
  1356. LOCALE_S1159,
  1357. pTemp );
  1358. CheckReturnEqual( rc,
  1359. FALSE,
  1360. "ReSET - S1159",
  1361. &NumErrors );
  1362. // Variation 21 - S2359
  1363. rc = GetLocaleInfoW( Locale,
  1364. LOCALE_S2359,
  1365. pTemp,
  1366. BUFSIZE );
  1367. CheckReturnEqual( rc,
  1368. 0,
  1369. "GET - S2359",
  1370. &NumErrors );
  1371. rc = SetLocaleInfoW( Locale,
  1372. LOCALE_S2359,
  1373. L"123456789012345" );
  1374. CheckReturnEqual( rc,
  1375. TRUE,
  1376. "SET - invalid S2359",
  1377. &NumErrors );
  1378. rc = SetLocaleInfoW( Locale,
  1379. LOCALE_S2359,
  1380. L"DUSK" );
  1381. CheckReturnEqual( rc,
  1382. FALSE,
  1383. "SET - S2359",
  1384. &NumErrors );
  1385. rc = GetLocaleInfoW( Locale,
  1386. LOCALE_S2359,
  1387. lpLCData,
  1388. BUFSIZE );
  1389. CheckReturnValidW( rc,
  1390. -1,
  1391. lpLCData,
  1392. L"DUSK",
  1393. "GET - S2359",
  1394. &NumErrors );
  1395. rc = SetLocaleInfoW( Locale,
  1396. LOCALE_S2359,
  1397. pTemp );
  1398. CheckReturnEqual( rc,
  1399. FALSE,
  1400. "ReSET - S2359",
  1401. &NumErrors );
  1402. // Variation 22 - SSHORTDATE
  1403. rc = SetLocaleInfoW( Locale,
  1404. LOCALE_SSHORTDATE,
  1405. L"dddddMMMMMyyyyydddddMMMMMyyyyydddddMMMMMyyyyydddddMMMMMyyyyydddddMMMMMyyyyyddddd" );
  1406. CheckReturnEqual( rc,
  1407. TRUE,
  1408. "SET - invalid SSHORTDATE",
  1409. &NumErrors );
  1410. rc = SetLocaleInfoW( Locale,
  1411. LOCALE_SSHORTDATE,
  1412. L"yyyy:MM:dd" );
  1413. CheckReturnEqual( rc,
  1414. FALSE,
  1415. "SET - SSHORTDATE",
  1416. &NumErrors );
  1417. rc = GetLocaleInfoW( Locale,
  1418. LOCALE_SSHORTDATE,
  1419. lpLCData,
  1420. BUFSIZE );
  1421. CheckReturnValidW( rc,
  1422. -1,
  1423. lpLCData,
  1424. L"yyyy:MM:dd",
  1425. "GET - SSHORTDATE",
  1426. &NumErrors );
  1427. rc = GetLocaleInfoW( Locale,
  1428. LOCALE_SDATE,
  1429. lpLCData,
  1430. BUFSIZE );
  1431. CheckReturnValidW( rc,
  1432. -1,
  1433. lpLCData,
  1434. L":",
  1435. "GET - SDATE from SSHORTDATE",
  1436. &NumErrors );
  1437. rc = GetLocaleInfoW( Locale,
  1438. LOCALE_IDATE,
  1439. lpLCData,
  1440. BUFSIZE );
  1441. CheckReturnValidW( rc,
  1442. -1,
  1443. lpLCData,
  1444. L"2",
  1445. "GET - IDATE from SSHORTDATE",
  1446. &NumErrors );
  1447. rc = GetLocaleInfoW( Locale,
  1448. LOCALE_IMONLZERO,
  1449. lpLCData,
  1450. BUFSIZE );
  1451. CheckReturnValidW( rc,
  1452. -1,
  1453. lpLCData,
  1454. L"1",
  1455. "GET - IMONLZERO from SSHORTDATE",
  1456. &NumErrors );
  1457. rc = GetLocaleInfoW( Locale,
  1458. LOCALE_IDAYLZERO,
  1459. lpLCData,
  1460. BUFSIZE );
  1461. CheckReturnValidW( rc,
  1462. -1,
  1463. lpLCData,
  1464. L"1",
  1465. "GET - IDAYLZERO from SSHORTDATE",
  1466. &NumErrors );
  1467. rc = GetLocaleInfoW( Locale,
  1468. LOCALE_ICENTURY,
  1469. lpLCData,
  1470. BUFSIZE );
  1471. CheckReturnValidW( rc,
  1472. -1,
  1473. lpLCData,
  1474. L"1",
  1475. "GET - ICENTURY from SSHORTDATE",
  1476. &NumErrors );
  1477. rc = SetLocaleInfoW( Locale,
  1478. LOCALE_SSHORTDATE,
  1479. pSShortDate );
  1480. CheckReturnEqual( rc,
  1481. FALSE,
  1482. "ReSET - SSHORTDATE",
  1483. &NumErrors );
  1484. rc = SetLocaleInfoW( Locale,
  1485. LOCALE_SDATE,
  1486. pSDate );
  1487. CheckReturnEqual( rc,
  1488. FALSE,
  1489. "ReSET - SDATE from SSHORTDATE",
  1490. &NumErrors );
  1491. // Variation 23 - SDATE
  1492. rc = SetLocaleInfoW( Locale,
  1493. LOCALE_SDATE,
  1494. L"{}{}" );
  1495. CheckReturnEqual( rc,
  1496. TRUE,
  1497. "SET - invalid SDATE",
  1498. &NumErrors );
  1499. rc = SetLocaleInfoW( Locale,
  1500. LOCALE_SDATE,
  1501. L"6" );
  1502. CheckReturnEqual( rc,
  1503. TRUE,
  1504. "SET - invalid SDATE (6)",
  1505. &NumErrors );
  1506. rc = SetLocaleInfoW( Locale,
  1507. LOCALE_SSHORTDATE,
  1508. L"yy:MM:dd" );
  1509. CheckReturnEqual( rc,
  1510. FALSE,
  1511. "SET - SSHORTDATE from SDATE",
  1512. &NumErrors );
  1513. rc = SetLocaleInfoW( Locale,
  1514. LOCALE_SDATE,
  1515. L"+" );
  1516. CheckReturnEqual( rc,
  1517. FALSE,
  1518. "SET - SDATE",
  1519. &NumErrors );
  1520. rc = GetLocaleInfoW( Locale,
  1521. LOCALE_SDATE,
  1522. lpLCData,
  1523. BUFSIZE );
  1524. CheckReturnValidW( rc,
  1525. -1,
  1526. lpLCData,
  1527. L"+",
  1528. "GET - SDATE",
  1529. &NumErrors );
  1530. rc = GetLocaleInfoW( Locale,
  1531. LOCALE_SSHORTDATE,
  1532. lpLCData,
  1533. BUFSIZE );
  1534. CheckReturnValidW( rc,
  1535. -1,
  1536. lpLCData,
  1537. L"yy+MM+dd",
  1538. "GET - SSHORTDATE from SDATE",
  1539. &NumErrors );
  1540. rc = SetLocaleInfoW( Locale,
  1541. LOCALE_SDATE,
  1542. pSDate );
  1543. CheckReturnEqual( rc,
  1544. FALSE,
  1545. "ReSET - SDATE",
  1546. &NumErrors );
  1547. rc = SetLocaleInfoW( Locale,
  1548. LOCALE_SSHORTDATE,
  1549. pSShortDate );
  1550. CheckReturnEqual( rc,
  1551. FALSE,
  1552. "ReSET - SSHORTDATE from SDATE",
  1553. &NumErrors );
  1554. // Variation 23.1 - SDATE
  1555. rc = SetLocaleInfoW( Locale,
  1556. LOCALE_SSHORTDATE,
  1557. L"yy:MM:dd' ('ddd')'" );
  1558. CheckReturnEqual( rc,
  1559. FALSE,
  1560. "SET - SSHORTDATE from SDATE",
  1561. &NumErrors );
  1562. rc = SetLocaleInfoW( Locale,
  1563. LOCALE_SDATE,
  1564. L"+" );
  1565. CheckReturnEqual( rc,
  1566. FALSE,
  1567. "SET - SDATE",
  1568. &NumErrors );
  1569. rc = GetLocaleInfoW( Locale,
  1570. LOCALE_SDATE,
  1571. lpLCData,
  1572. BUFSIZE );
  1573. CheckReturnValidW( rc,
  1574. -1,
  1575. lpLCData,
  1576. L"+",
  1577. "GET - SDATE",
  1578. &NumErrors );
  1579. rc = GetLocaleInfoW( Locale,
  1580. LOCALE_SSHORTDATE,
  1581. lpLCData,
  1582. BUFSIZE );
  1583. CheckReturnValidW( rc,
  1584. -1,
  1585. lpLCData,
  1586. L"yy+MM+dd' ('ddd')'",
  1587. "GET - SSHORTDATE from SDATE",
  1588. &NumErrors );
  1589. rc = SetLocaleInfoW( Locale,
  1590. LOCALE_SDATE,
  1591. pSDate );
  1592. CheckReturnEqual( rc,
  1593. FALSE,
  1594. "ReSET - SDATE",
  1595. &NumErrors );
  1596. rc = SetLocaleInfoW( Locale,
  1597. LOCALE_SSHORTDATE,
  1598. pSShortDate );
  1599. CheckReturnEqual( rc,
  1600. FALSE,
  1601. "ReSET - SSHORTDATE from SDATE",
  1602. &NumErrors );
  1603. // Variation 24 - SLONGDATE
  1604. rc = GetLocaleInfoW( Locale,
  1605. LOCALE_SLONGDATE,
  1606. pTemp,
  1607. BUFSIZE );
  1608. CheckReturnEqual( rc,
  1609. 0,
  1610. "GET - current SLONGDATE",
  1611. &NumErrors );
  1612. rc = SetLocaleInfoW( Locale,
  1613. LOCALE_SLONGDATE,
  1614. L"dddddMMMMMyyyyydddddMMMMMyyyyydddddMMMMMyyyyydddddMMMMMyyyyydddddMMMMMyyyyyddddd" );
  1615. CheckReturnEqual( rc,
  1616. TRUE,
  1617. "SET - invalid SLONGDATE",
  1618. &NumErrors );
  1619. rc = SetLocaleInfoW( Locale,
  1620. LOCALE_SLONGDATE,
  1621. L"yy, MMMM dd, dddd" );
  1622. CheckReturnEqual( rc,
  1623. FALSE,
  1624. "SET - SLONGDATE",
  1625. &NumErrors );
  1626. rc = GetLocaleInfoW( Locale,
  1627. LOCALE_SLONGDATE,
  1628. lpLCData,
  1629. BUFSIZE );
  1630. CheckReturnValidW( rc,
  1631. -1,
  1632. lpLCData,
  1633. L"yy, MMMM dd, dddd",
  1634. "GET - SLONGDATE",
  1635. &NumErrors );
  1636. rc = SetLocaleInfoW( Locale,
  1637. LOCALE_SLONGDATE,
  1638. pTemp );
  1639. CheckReturnEqual( rc,
  1640. FALSE,
  1641. "ReSET - SLONGDATE",
  1642. &NumErrors );
  1643. // Variation 25 - ICALENDARTYPE
  1644. rc = GetLocaleInfoW( Locale,
  1645. LOCALE_ICALENDARTYPE,
  1646. pTemp,
  1647. BUFSIZE );
  1648. CheckReturnEqual( rc,
  1649. 0,
  1650. "GET - current ICALENDARTYPE",
  1651. &NumErrors );
  1652. rc = SetLocaleInfoW( Locale,
  1653. LOCALE_ICALENDARTYPE,
  1654. L"0" );
  1655. CheckReturnEqual( rc,
  1656. TRUE,
  1657. "SET - invalid ICALENDARTYPE 0",
  1658. &NumErrors );
  1659. rc = SetLocaleInfoW( Locale,
  1660. LOCALE_ICALENDARTYPE,
  1661. L"8" );
  1662. CheckReturnEqual( rc,
  1663. TRUE,
  1664. "SET - invalid ICALENDARTYPE 8",
  1665. &NumErrors );
  1666. rc = SetLocaleInfoW( 0x0411,
  1667. LOCALE_ICALENDARTYPE,
  1668. L"3" );
  1669. CheckReturnEqual( rc,
  1670. FALSE,
  1671. "SET - ICALENDARTYPE",
  1672. &NumErrors );
  1673. rc = GetLocaleInfoW( Locale,
  1674. LOCALE_ICALENDARTYPE,
  1675. lpLCData,
  1676. BUFSIZE );
  1677. CheckReturnValidW( rc,
  1678. -1,
  1679. lpLCData,
  1680. L"3",
  1681. "GET - ICALENDARTYPE",
  1682. &NumErrors );
  1683. rc = SetLocaleInfoW( Locale,
  1684. LOCALE_ICALENDARTYPE,
  1685. pTemp );
  1686. CheckReturnEqual( rc,
  1687. FALSE,
  1688. "ReSET - ICALENDARTYPE",
  1689. &NumErrors );
  1690. // Variation 26 - IFIRSTDAYOFWEEK
  1691. rc = GetLocaleInfoW( Locale,
  1692. LOCALE_IFIRSTDAYOFWEEK,
  1693. pTemp,
  1694. BUFSIZE );
  1695. CheckReturnEqual( rc,
  1696. 0,
  1697. "GET - current IFIRSTDAYOFWEEK",
  1698. &NumErrors );
  1699. rc = SetLocaleInfoW( Locale,
  1700. LOCALE_IFIRSTDAYOFWEEK,
  1701. L"7" );
  1702. CheckReturnEqual( rc,
  1703. TRUE,
  1704. "SET - invalid IFIRSTDAYOFWEEK",
  1705. &NumErrors );
  1706. rc = SetLocaleInfoW( Locale,
  1707. LOCALE_IFIRSTDAYOFWEEK,
  1708. L"3" );
  1709. CheckReturnEqual( rc,
  1710. FALSE,
  1711. "SET - IFIRSTDAYOFWEEK",
  1712. &NumErrors );
  1713. rc = GetLocaleInfoW( Locale,
  1714. LOCALE_IFIRSTDAYOFWEEK,
  1715. lpLCData,
  1716. BUFSIZE );
  1717. CheckReturnValidW( rc,
  1718. -1,
  1719. lpLCData,
  1720. L"3",
  1721. "GET - IFIRSTDAYOFWEEK",
  1722. &NumErrors );
  1723. rc = SetLocaleInfoW( Locale,
  1724. LOCALE_IFIRSTDAYOFWEEK,
  1725. pTemp );
  1726. CheckReturnEqual( rc,
  1727. FALSE,
  1728. "ReSET - IFIRSTDAYOFWEEK",
  1729. &NumErrors );
  1730. // Variation 27 - IFIRSTWEEKOFYEAR
  1731. rc = GetLocaleInfoW( Locale,
  1732. LOCALE_IFIRSTWEEKOFYEAR,
  1733. pTemp,
  1734. BUFSIZE );
  1735. CheckReturnEqual( rc,
  1736. 0,
  1737. "GET - current IFIRSTWEEKOFYEAR",
  1738. &NumErrors );
  1739. rc = SetLocaleInfoW( Locale,
  1740. LOCALE_IFIRSTWEEKOFYEAR,
  1741. L"3" );
  1742. CheckReturnEqual( rc,
  1743. TRUE,
  1744. "SET - invalid IFIRSTWEEKOFYEAR",
  1745. &NumErrors );
  1746. rc = SetLocaleInfoW( Locale,
  1747. LOCALE_IFIRSTWEEKOFYEAR,
  1748. L"1" );
  1749. CheckReturnEqual( rc,
  1750. FALSE,
  1751. "SET - IFIRSTWEEKOFYEAR",
  1752. &NumErrors );
  1753. rc = GetLocaleInfoW( Locale,
  1754. LOCALE_IFIRSTWEEKOFYEAR,
  1755. lpLCData,
  1756. BUFSIZE );
  1757. CheckReturnValidW( rc,
  1758. -1,
  1759. lpLCData,
  1760. L"1",
  1761. "GET - IFIRSTWEEKOFYEAR",
  1762. &NumErrors );
  1763. rc = SetLocaleInfoW( Locale,
  1764. LOCALE_IFIRSTWEEKOFYEAR,
  1765. L"2" );
  1766. CheckReturnEqual( rc,
  1767. FALSE,
  1768. "SET - IFIRSTWEEKOFYEAR 2",
  1769. &NumErrors );
  1770. rc = GetLocaleInfoW( Locale,
  1771. LOCALE_IFIRSTWEEKOFYEAR,
  1772. lpLCData,
  1773. BUFSIZE );
  1774. CheckReturnValidW( rc,
  1775. -1,
  1776. lpLCData,
  1777. L"2",
  1778. "GET - IFIRSTWEEKOFYEAR 2",
  1779. &NumErrors );
  1780. rc = SetLocaleInfoW( Locale,
  1781. LOCALE_IFIRSTWEEKOFYEAR,
  1782. pTemp );
  1783. CheckReturnEqual( rc,
  1784. FALSE,
  1785. "ReSET - IFIRSTWEEKOFYEAR",
  1786. &NumErrors );
  1787. //
  1788. // Return total number of errors found.
  1789. //
  1790. return (NumErrors);
  1791. }
  1792. ////////////////////////////////////////////////////////////////////////////
  1793. //
  1794. // SLI_Ansi
  1795. //
  1796. // This routine tests the Ansi version of the API routine.
  1797. //
  1798. // 07-14-93 JulieB Created.
  1799. ////////////////////////////////////////////////////////////////////////////
  1800. int SLI_Ansi()
  1801. {
  1802. int NumErrors = 0; // error count - to be returned
  1803. int rc; // return code
  1804. //
  1805. // SetLocaleInfoA.
  1806. //
  1807. // Variation 1 - SList
  1808. rc = SetLocaleInfoA( 0x0409,
  1809. LOCALE_SLIST,
  1810. "::" );
  1811. CheckReturnEqual( rc,
  1812. FALSE,
  1813. "SET - system default locale",
  1814. &NumErrors );
  1815. rc = GetLocaleInfoW( 0x0409,
  1816. LOCALE_SLIST,
  1817. lpLCData,
  1818. BUFSIZE );
  1819. CheckReturnValidW( rc,
  1820. -1,
  1821. lpLCData,
  1822. L"::",
  1823. "GET - system default locale",
  1824. &NumErrors );
  1825. // Variation 2 - Use CP ACP, SList
  1826. rc = SetLocaleInfoA( 0x0409,
  1827. LOCALE_USE_CP_ACP | LOCALE_SLIST,
  1828. ".." );
  1829. CheckReturnEqual( rc,
  1830. FALSE,
  1831. "SET - Use CP ACP, system default locale",
  1832. &NumErrors );
  1833. rc = GetLocaleInfoW( 0x0409,
  1834. LOCALE_USE_CP_ACP | LOCALE_SLIST,
  1835. lpLCData,
  1836. BUFSIZE );
  1837. CheckReturnValidW( rc,
  1838. -1,
  1839. lpLCData,
  1840. L"..",
  1841. "GET - Use CP ACP, system default locale",
  1842. &NumErrors );
  1843. //
  1844. // Reset the slist value.
  1845. //
  1846. rc = SetLocaleInfoW( Locale,
  1847. LOCALE_SLIST,
  1848. pSList );
  1849. CheckReturnEqual( rc,
  1850. FALSE,
  1851. "ReSET - SLIST",
  1852. &NumErrors );
  1853. //
  1854. // Return total number of errors found.
  1855. //
  1856. return (NumErrors);
  1857. }