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.

4176 lines
131 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. mstest.c
  5. Abstract:
  6. Test module for NLS API LCMapString.
  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. 06-14-91 JulieB Created.
  12. --*/
  13. //
  14. // Include Files.
  15. //
  16. #include "nlstest.h"
  17. //
  18. // Constant Declarations.
  19. //
  20. #define BUFSIZE 50
  21. #define LCMS_INVALID_FLAGS \
  22. ((DWORD)(~( LCMAP_LOWERCASE | LCMAP_UPPERCASE | \
  23. LCMAP_SORTKEY | LCMAP_BYTEREV | \
  24. LCMAP_HIRAGANA | LCMAP_KATAKANA | \
  25. LCMAP_HALFWIDTH | LCMAP_FULLWIDTH | \
  26. LCMAP_TRADITIONAL_CHINESE | \
  27. LCMAP_SIMPLIFIED_CHINESE | \
  28. NORM_IGNORECASE | NORM_IGNORENONSPACE | \
  29. NORM_IGNORESYMBOLS | NORM_IGNOREKANATYPE | \
  30. NORM_IGNOREWIDTH )))
  31. //
  32. // Global Variables.
  33. //
  34. LCID Locale;
  35. #define MapSrc1 L"This Is A String"
  36. #define MapSrc2 L"This Is$ A S-tr,in'g"
  37. #define MapNoSymbols L"ThisIsAString"
  38. WCHAR MapDest[BUFSIZE];
  39. BYTE SortDest[BUFSIZE];
  40. BYTE MapDestA[BUFSIZE];
  41. #define MapUpper L"THIS IS A STRING"
  42. #define MapLower L"this is a string"
  43. #define MapLower2 L"this is$ a str,ing"
  44. // Sharp S
  45. #define wcSharpS L"\x0074\x00df\x0074"
  46. // Nonspace
  47. #define MapNS1 L"\x0074\x00e1\x0061\x0301"
  48. #define MapNS2 L"\x0074\x0301\x00e1\x0061\x0301"
  49. #define MapNoNS1 L"\x0074\x0061\x0061"
  50. #define MapUpperNS L"\x0054\x00c1\x0041\x0301"
  51. // Sortkey
  52. #define SortPunctPre L"\x00e1\x002d" // a-acute, -
  53. #define SortPunctComp L"\x0061\x0301\x002d" // a, acute, -
  54. #define SortPunctExp1 L"\x00e6\x002d" // ae, -
  55. #define SortPunctExp2 L"\x0061\x0065\x002d" // a, e, -
  56. #define SortPunctUnsort L"\x00e6\xffff\x002d" // ae, unsort, -
  57. #define SortSymbolPre L"\x00e1\x002a" // a-acute, *
  58. #define SortSymbolComp L"\x0061\x0301\x002a" // a, acute, *
  59. #define SortSymbolExp1 L"\x00e6\x002a" // ae, *
  60. #define SortSymbolExp2 L"\x0061\x0065\x002a" // a, e, *
  61. #define SortSymbolUnsort L"\x00e6\xffff\x002a" // ae, unsort, *
  62. //
  63. // Forward Declarations.
  64. //
  65. BOOL
  66. InitLCMapStr();
  67. int
  68. LCMS_BadParamCheck();
  69. int
  70. LCMS_NormalCase();
  71. int
  72. LCMS_Ansi();
  73. void
  74. CheckReturnValidSortKey(
  75. int CurrentReturn,
  76. int ExpectedReturn,
  77. LPBYTE pCurrentString,
  78. LPBYTE pExpectedString,
  79. LPBYTE pErrString,
  80. int *pNumErrors);
  81. ////////////////////////////////////////////////////////////////////////////
  82. //
  83. // TestLCMapString
  84. //
  85. // Test routine for LCMapStringW API.
  86. //
  87. // 06-14-91 JulieB Created.
  88. ////////////////////////////////////////////////////////////////////////////
  89. int TestLCMapString()
  90. {
  91. int ErrCount = 0; // error count
  92. //
  93. // Print out what's being done.
  94. //
  95. printf("\n\nTESTING LCMapStringW...\n\n");
  96. //
  97. // Initialize global variables.
  98. //
  99. if (!InitLCMapStr())
  100. {
  101. printf("\nABORTED TestLCMapString: Could not Initialize.\n");
  102. return (1);
  103. }
  104. //
  105. // Test bad parameters.
  106. //
  107. ErrCount += LCMS_BadParamCheck();
  108. //
  109. // Test normal cases.
  110. //
  111. ErrCount += LCMS_NormalCase();
  112. //
  113. // Test Ansi version.
  114. //
  115. ErrCount += LCMS_Ansi();
  116. //
  117. // Print out result.
  118. //
  119. printf("\nLCMapStringW: ERRORS = %d\n", ErrCount);
  120. //
  121. // Return total number of errors found.
  122. //
  123. return (ErrCount);
  124. }
  125. ////////////////////////////////////////////////////////////////////////////
  126. //
  127. // InitLCMapStr
  128. //
  129. // This routine initializes the global variables. If no errors were
  130. // encountered, then it returns TRUE. Otherwise, it returns FALSE.
  131. //
  132. // 06-14-91 JulieB Created.
  133. ////////////////////////////////////////////////////////////////////////////
  134. BOOL InitLCMapStr()
  135. {
  136. int size = BUFSIZE; // size of string
  137. //
  138. // Make a Locale.
  139. //
  140. Locale = MAKELCID(0x0409, 0);
  141. //
  142. // Return success.
  143. //
  144. return (TRUE);
  145. }
  146. ////////////////////////////////////////////////////////////////////////////
  147. //
  148. // LCMS_BadParamCheck
  149. //
  150. // This routine passes in bad parameters to the API routines and checks to
  151. // be sure they are handled properly. The number of errors encountered
  152. // is returned to the caller.
  153. //
  154. // 06-14-91 JulieB Created.
  155. ////////////////////////////////////////////////////////////////////////////
  156. int LCMS_BadParamCheck()
  157. {
  158. int NumErrors = 0; // error count - to be returned
  159. int rc; // return code
  160. //
  161. // Bad Locale.
  162. //
  163. // Variation 1 - Bad Locale
  164. rc = LCMapStringW( (LCID)333,
  165. LCMAP_LOWERCASE,
  166. MapSrc1,
  167. -1,
  168. MapDest,
  169. BUFSIZE );
  170. CheckReturnBadParam( rc,
  171. 0,
  172. ERROR_INVALID_PARAMETER,
  173. "Bad Locale",
  174. &NumErrors );
  175. //
  176. // Null Pointers.
  177. //
  178. // Variation 1 - lpSrcStr = NULL
  179. rc = LCMapStringW( Locale,
  180. LCMAP_LOWERCASE,
  181. NULL,
  182. -1,
  183. MapDest,
  184. BUFSIZE );
  185. CheckReturnBadParam( rc,
  186. 0,
  187. ERROR_INVALID_PARAMETER,
  188. "lpSrcStr NULL",
  189. &NumErrors );
  190. // Variation 2 - lpDestStr = NULL
  191. rc = LCMapStringW( Locale,
  192. LCMAP_LOWERCASE,
  193. MapSrc1,
  194. -1,
  195. NULL,
  196. BUFSIZE );
  197. CheckReturnBadParam( rc,
  198. 0,
  199. ERROR_INVALID_PARAMETER,
  200. "lpDestStr NULL",
  201. &NumErrors );
  202. //
  203. // Bad Counts.
  204. //
  205. // Variation 1 - cbSrc = 0
  206. rc = LCMapStringW( Locale,
  207. LCMAP_LOWERCASE,
  208. MapSrc1,
  209. 0,
  210. MapDest,
  211. BUFSIZE );
  212. CheckReturnBadParam( rc,
  213. 0,
  214. ERROR_INVALID_PARAMETER,
  215. "cbSrc = 0",
  216. &NumErrors );
  217. // Variation 2 - cbDest < 0
  218. rc = LCMapStringW( Locale,
  219. LCMAP_LOWERCASE,
  220. MapSrc1,
  221. -1,
  222. MapDest,
  223. -1 );
  224. CheckReturnBadParam( rc,
  225. 0,
  226. ERROR_INVALID_PARAMETER,
  227. "cbDest < 0",
  228. &NumErrors );
  229. //
  230. // Zero or Invalid Flag Values.
  231. //
  232. // Variation 0 - Use CP ACP
  233. rc = LCMapStringW( Locale,
  234. LOCALE_USE_CP_ACP,
  235. L"Th",
  236. 2,
  237. MapDest,
  238. BUFSIZE );
  239. CheckReturnBadParam( rc,
  240. 0,
  241. ERROR_INVALID_FLAGS,
  242. "Use CP ACP",
  243. &NumErrors );
  244. // Variation 0.1 - byterev, ignore case
  245. rc = LCMapStringW( Locale,
  246. LCMAP_BYTEREV | NORM_IGNORECASE,
  247. L"Th",
  248. 2,
  249. MapDest,
  250. BUFSIZE );
  251. CheckReturnBadParam( rc,
  252. 0,
  253. ERROR_INVALID_FLAGS,
  254. "byterev, ignore case",
  255. &NumErrors );
  256. // Variation 1 - dwMapFlags = invalid
  257. rc = LCMapStringW( Locale,
  258. LCMS_INVALID_FLAGS,
  259. MapSrc1,
  260. -1,
  261. MapDest,
  262. BUFSIZE );
  263. CheckReturnBadParam( rc,
  264. 0,
  265. ERROR_INVALID_FLAGS,
  266. "dwMapFlags invalid",
  267. &NumErrors );
  268. // Variation 2 - dwMapFlags = 0
  269. rc = LCMapStringW( Locale,
  270. 0,
  271. MapSrc1,
  272. -1,
  273. MapDest,
  274. BUFSIZE );
  275. CheckReturnBadParam( rc,
  276. 0,
  277. ERROR_INVALID_FLAGS,
  278. "dwMapFlags zero",
  279. &NumErrors );
  280. // Variation 3 - illegal combo case
  281. rc = LCMapStringW( Locale,
  282. LCMAP_LOWERCASE | LCMAP_UPPERCASE,
  283. MapSrc1,
  284. -1,
  285. MapDest,
  286. BUFSIZE );
  287. CheckReturnBadParam( rc,
  288. 0,
  289. ERROR_INVALID_FLAGS,
  290. "illegal combo case",
  291. &NumErrors );
  292. // Variation 4 - illegal combo sortkey
  293. rc = LCMapStringW( Locale,
  294. LCMAP_LOWERCASE | LCMAP_SORTKEY,
  295. MapSrc1,
  296. -1,
  297. MapDest,
  298. BUFSIZE );
  299. CheckReturnBadParam( rc,
  300. 0,
  301. ERROR_INVALID_FLAGS,
  302. "illegal combo sortkey",
  303. &NumErrors );
  304. // Variation 5 - legal combo byterev
  305. rc = LCMapStringW( Locale,
  306. LCMAP_LOWERCASE | LCMAP_BYTEREV,
  307. MapSrc1,
  308. -1,
  309. MapDest,
  310. BUFSIZE );
  311. CheckReturnValidW( rc,
  312. -1,
  313. NULL,
  314. MapSrc1,
  315. "legal combo byterev",
  316. &NumErrors );
  317. // Variation 6 - illegal flag ignorecase
  318. rc = LCMapStringW( Locale,
  319. NORM_IGNORECASE,
  320. MapSrc1,
  321. -1,
  322. MapDest,
  323. BUFSIZE );
  324. CheckReturnBadParam( rc,
  325. 0,
  326. ERROR_INVALID_FLAGS,
  327. "illegal flag ignorecase",
  328. &NumErrors );
  329. // Variation 7 - illegal combo kana
  330. rc = LCMapStringW( Locale,
  331. LCMAP_HIRAGANA | LCMAP_KATAKANA,
  332. MapSrc1,
  333. -1,
  334. MapDest,
  335. BUFSIZE );
  336. CheckReturnBadParam( rc,
  337. 0,
  338. ERROR_INVALID_FLAGS,
  339. "illegal combo kana",
  340. &NumErrors );
  341. // Variation 8 - illegal combo width
  342. rc = LCMapStringW( Locale,
  343. LCMAP_HALFWIDTH | LCMAP_FULLWIDTH,
  344. MapSrc1,
  345. -1,
  346. MapDest,
  347. BUFSIZE );
  348. CheckReturnBadParam( rc,
  349. 0,
  350. ERROR_INVALID_FLAGS,
  351. "illegal combo width",
  352. &NumErrors );
  353. // Variation 9 - illegal combo sortkey, hiragana
  354. rc = LCMapStringW( Locale,
  355. LCMAP_SORTKEY | LCMAP_HIRAGANA,
  356. MapSrc1,
  357. -1,
  358. MapDest,
  359. BUFSIZE );
  360. CheckReturnBadParam( rc,
  361. 0,
  362. ERROR_INVALID_FLAGS,
  363. "illegal combo sortkey, hiragana",
  364. &NumErrors );
  365. // Variation 10 - illegal combo sortkey, katakana
  366. rc = LCMapStringW( Locale,
  367. LCMAP_SORTKEY | LCMAP_KATAKANA,
  368. MapSrc1,
  369. -1,
  370. MapDest,
  371. BUFSIZE );
  372. CheckReturnBadParam( rc,
  373. 0,
  374. ERROR_INVALID_FLAGS,
  375. "illegal combo sortkey, katakana",
  376. &NumErrors );
  377. // Variation 11 - illegal combo sortkey, half width
  378. rc = LCMapStringW( Locale,
  379. LCMAP_SORTKEY | LCMAP_HALFWIDTH,
  380. MapSrc1,
  381. -1,
  382. MapDest,
  383. BUFSIZE );
  384. CheckReturnBadParam( rc,
  385. 0,
  386. ERROR_INVALID_FLAGS,
  387. "illegal combo sortkey, half width",
  388. &NumErrors );
  389. // Variation 12 - illegal combo sortkey, full width
  390. rc = LCMapStringW( Locale,
  391. LCMAP_SORTKEY | LCMAP_FULLWIDTH,
  392. MapSrc1,
  393. -1,
  394. MapDest,
  395. BUFSIZE );
  396. CheckReturnBadParam( rc,
  397. 0,
  398. ERROR_INVALID_FLAGS,
  399. "illegal combo sortkey, full width",
  400. &NumErrors );
  401. // Variation 13 - illegal combo kana, ignore symbols
  402. rc = LCMapStringW( Locale,
  403. LCMAP_HIRAGANA | NORM_IGNORESYMBOLS,
  404. MapSrc1,
  405. -1,
  406. MapDest,
  407. BUFSIZE );
  408. CheckReturnBadParam( rc,
  409. 0,
  410. ERROR_INVALID_FLAGS,
  411. "illegal combo kana, symbols",
  412. &NumErrors );
  413. // Variation 14 - illegal combo width, ignore symbols
  414. rc = LCMapStringW( Locale,
  415. LCMAP_HALFWIDTH | NORM_IGNORESYMBOLS,
  416. MapSrc1,
  417. -1,
  418. MapDest,
  419. BUFSIZE );
  420. CheckReturnBadParam( rc,
  421. 0,
  422. ERROR_INVALID_FLAGS,
  423. "illegal combo width, symbols",
  424. &NumErrors );
  425. // Variation 15 - illegal combo kana, ignore nonspace
  426. rc = LCMapStringW( Locale,
  427. LCMAP_HIRAGANA | NORM_IGNORENONSPACE,
  428. MapSrc1,
  429. -1,
  430. MapDest,
  431. BUFSIZE );
  432. CheckReturnBadParam( rc,
  433. 0,
  434. ERROR_INVALID_FLAGS,
  435. "illegal combo kana, nonspace",
  436. &NumErrors );
  437. // Variation 16 - illegal combo width, ignore nonspace
  438. rc = LCMapStringW( Locale,
  439. LCMAP_HALFWIDTH | NORM_IGNORENONSPACE,
  440. MapSrc1,
  441. -1,
  442. MapDest,
  443. BUFSIZE );
  444. CheckReturnBadParam( rc,
  445. 0,
  446. ERROR_INVALID_FLAGS,
  447. "illegal combo width, nonspace",
  448. &NumErrors );
  449. // Variation 17 - illegal combo kana, ignore kana
  450. rc = LCMapStringW( Locale,
  451. LCMAP_HIRAGANA | NORM_IGNOREKANATYPE,
  452. MapSrc1,
  453. -1,
  454. MapDest,
  455. BUFSIZE );
  456. CheckReturnBadParam( rc,
  457. 0,
  458. ERROR_INVALID_FLAGS,
  459. "illegal combo kana, ignore kana",
  460. &NumErrors );
  461. // Variation 18 - illegal combo width, ignore kana
  462. rc = LCMapStringW( Locale,
  463. LCMAP_HALFWIDTH | NORM_IGNOREKANATYPE,
  464. MapSrc1,
  465. -1,
  466. MapDest,
  467. BUFSIZE );
  468. CheckReturnBadParam( rc,
  469. 0,
  470. ERROR_INVALID_FLAGS,
  471. "illegal combo width, ignore kana",
  472. &NumErrors );
  473. // Variation 19 - illegal combo kana, ignore width
  474. rc = LCMapStringW( Locale,
  475. LCMAP_HIRAGANA | NORM_IGNOREWIDTH,
  476. MapSrc1,
  477. -1,
  478. MapDest,
  479. BUFSIZE );
  480. CheckReturnBadParam( rc,
  481. 0,
  482. ERROR_INVALID_FLAGS,
  483. "illegal combo kana, ignore width",
  484. &NumErrors );
  485. // Variation 20 - illegal combo width, ignore width
  486. rc = LCMapStringW( Locale,
  487. LCMAP_HALFWIDTH | NORM_IGNOREWIDTH,
  488. MapSrc1,
  489. -1,
  490. MapDest,
  491. BUFSIZE );
  492. CheckReturnBadParam( rc,
  493. 0,
  494. ERROR_INVALID_FLAGS,
  495. "illegal combo width, ignore width",
  496. &NumErrors );
  497. // Variation 21 - illegal combo linguistic
  498. rc = LCMapStringW( Locale,
  499. LCMAP_LINGUISTIC_CASING,
  500. MapSrc1,
  501. -1,
  502. MapDest,
  503. BUFSIZE );
  504. CheckReturnBadParam( rc,
  505. 0,
  506. ERROR_INVALID_FLAGS,
  507. "illegal combo linguistic",
  508. &NumErrors );
  509. // Variation 22 - illegal combo linguistic, kana
  510. rc = LCMapStringW( Locale,
  511. LCMAP_LINGUISTIC_CASING | LCMAP_HIRAGANA,
  512. MapSrc1,
  513. -1,
  514. MapDest,
  515. BUFSIZE );
  516. CheckReturnBadParam( rc,
  517. 0,
  518. ERROR_INVALID_FLAGS,
  519. "illegal combo linguistic, kana",
  520. &NumErrors );
  521. // Variation 23 - illegal combo linguistic, sortkey
  522. rc = LCMapStringW( Locale,
  523. LCMAP_LINGUISTIC_CASING | LCMAP_SORTKEY,
  524. MapSrc1,
  525. -1,
  526. MapDest,
  527. BUFSIZE );
  528. CheckReturnBadParam( rc,
  529. 0,
  530. ERROR_INVALID_FLAGS,
  531. "illegal combo linguistic, sortkey",
  532. &NumErrors );
  533. // Variation 24 - illegal combo linguistic, norm
  534. rc = LCMapStringW( Locale,
  535. LCMAP_LINGUISTIC_CASING | NORM_IGNORENONSPACE,
  536. MapSrc1,
  537. -1,
  538. MapDest,
  539. BUFSIZE );
  540. CheckReturnBadParam( rc,
  541. 0,
  542. ERROR_INVALID_FLAGS,
  543. "illegal combo linguistic, norm",
  544. &NumErrors );
  545. // Variation 25 - illegal combo traditional, kana
  546. rc = LCMapStringW( Locale,
  547. LCMAP_TRADITIONAL_CHINESE | LCMAP_HIRAGANA,
  548. MapSrc1,
  549. -1,
  550. MapDest,
  551. BUFSIZE );
  552. CheckReturnBadParam( rc,
  553. 0,
  554. ERROR_INVALID_FLAGS,
  555. "illegal combo traditional, kana",
  556. &NumErrors );
  557. // Variation 26 - illegal combo traditional, width
  558. rc = LCMapStringW( Locale,
  559. LCMAP_TRADITIONAL_CHINESE | LCMAP_HALFWIDTH,
  560. MapSrc1,
  561. -1,
  562. MapDest,
  563. BUFSIZE );
  564. CheckReturnBadParam( rc,
  565. 0,
  566. ERROR_INVALID_FLAGS,
  567. "illegal combo traditional, width",
  568. &NumErrors );
  569. // Variation 27 - illegal combo traditional, sortkey
  570. rc = LCMapStringW( Locale,
  571. LCMAP_TRADITIONAL_CHINESE | LCMAP_SORTKEY,
  572. MapSrc1,
  573. -1,
  574. MapDest,
  575. BUFSIZE );
  576. CheckReturnBadParam( rc,
  577. 0,
  578. ERROR_INVALID_FLAGS,
  579. "illegal combo traditional, sortkey",
  580. &NumErrors );
  581. // Variation 28 - illegal combo simplified, kana
  582. rc = LCMapStringW( Locale,
  583. LCMAP_SIMPLIFIED_CHINESE | LCMAP_HIRAGANA,
  584. MapSrc1,
  585. -1,
  586. MapDest,
  587. BUFSIZE );
  588. CheckReturnBadParam( rc,
  589. 0,
  590. ERROR_INVALID_FLAGS,
  591. "illegal combo simplified, kana",
  592. &NumErrors );
  593. // Variation 29 - illegal combo simplified, width
  594. rc = LCMapStringW( Locale,
  595. LCMAP_SIMPLIFIED_CHINESE | LCMAP_HALFWIDTH,
  596. MapSrc1,
  597. -1,
  598. MapDest,
  599. BUFSIZE );
  600. CheckReturnBadParam( rc,
  601. 0,
  602. ERROR_INVALID_FLAGS,
  603. "illegal combo simplified, width",
  604. &NumErrors );
  605. // Variation 30 - illegal combo simplified, sortkey
  606. rc = LCMapStringW( Locale,
  607. LCMAP_SIMPLIFIED_CHINESE | LCMAP_SORTKEY,
  608. MapSrc1,
  609. -1,
  610. MapDest,
  611. BUFSIZE );
  612. CheckReturnBadParam( rc,
  613. 0,
  614. ERROR_INVALID_FLAGS,
  615. "illegal combo simplified, sortkey",
  616. &NumErrors );
  617. //
  618. // Check the error returns for A and W version.
  619. //
  620. // Variation 1 - NULL destination
  621. SetLastError(0);
  622. rc = LCMapStringW( 0x0409,
  623. 0,
  624. L"xxx",
  625. -1,
  626. NULL,
  627. 100 );
  628. CheckReturnBadParam( rc,
  629. 0,
  630. ERROR_INVALID_PARAMETER,
  631. "A and W errors same - NULL Dest - W version",
  632. &NumErrors );
  633. SetLastError(0);
  634. rc = LCMapStringA( 0x0409,
  635. 0,
  636. "xxx",
  637. -1,
  638. NULL,
  639. 100 );
  640. CheckReturnBadParam( rc,
  641. 0,
  642. ERROR_INVALID_PARAMETER,
  643. "A and W errors same - NULL Dest - A version",
  644. &NumErrors );
  645. // Variation 2 - Pointers equal
  646. SetLastError(0);
  647. rc = LCMapStringW( 0x0409,
  648. 0,
  649. MapDest,
  650. -1,
  651. MapDest,
  652. 100 );
  653. CheckReturnBadParam( rc,
  654. 0,
  655. ERROR_INVALID_PARAMETER,
  656. "A and W errors same - Pointers Equal - W version",
  657. &NumErrors );
  658. SetLastError(0);
  659. rc = LCMapStringA( 0x0409,
  660. 0,
  661. MapDestA,
  662. -1,
  663. MapDestA,
  664. 100 );
  665. CheckReturnBadParam( rc,
  666. 0,
  667. ERROR_INVALID_PARAMETER,
  668. "A and W errors same - Pointers Equal - A version",
  669. &NumErrors );
  670. //
  671. // Check src = dest - W Version.
  672. //
  673. // Variation 0
  674. SetLastError(0);
  675. MapDest[0] = L'x';
  676. MapDest[1] = 0;
  677. rc = LCMapStringW( 0x0409,
  678. LCMAP_UPPERCASE | LCMAP_HIRAGANA,
  679. MapDest,
  680. -1,
  681. MapDest,
  682. BUFSIZE );
  683. CheckReturnBadParam( rc,
  684. 0,
  685. ERROR_INVALID_PARAMETER,
  686. "src = dest - uppercase and hiragana",
  687. &NumErrors );
  688. // Variation 1
  689. SetLastError(0);
  690. MapDest[0] = L'x';
  691. MapDest[1] = 0;
  692. rc = LCMapStringW( 0x0409,
  693. LCMAP_LOWERCASE | LCMAP_HIRAGANA,
  694. MapDest,
  695. -1,
  696. MapDest,
  697. BUFSIZE );
  698. CheckReturnBadParam( rc,
  699. 0,
  700. ERROR_INVALID_PARAMETER,
  701. "src = dest - lowercase and hiragana",
  702. &NumErrors );
  703. // Variation 2
  704. SetLastError(0);
  705. MapDest[0] = L'x';
  706. MapDest[1] = 0;
  707. rc = LCMapStringW( 0x0409,
  708. LCMAP_LOWERCASE | LCMAP_KATAKANA,
  709. MapDest,
  710. -1,
  711. MapDest,
  712. BUFSIZE );
  713. CheckReturnBadParam( rc,
  714. 0,
  715. ERROR_INVALID_PARAMETER,
  716. "src = dest - lowercase and katakana",
  717. &NumErrors );
  718. // Variation 3
  719. SetLastError(0);
  720. MapDest[0] = L'x';
  721. MapDest[1] = 0;
  722. rc = LCMapStringW( 0x0409,
  723. LCMAP_LOWERCASE | LCMAP_HALFWIDTH,
  724. MapDest,
  725. -1,
  726. MapDest,
  727. BUFSIZE );
  728. CheckReturnBadParam( rc,
  729. 0,
  730. ERROR_INVALID_PARAMETER,
  731. "src = dest - lowercase and halfwidth",
  732. &NumErrors );
  733. // Variation 4
  734. SetLastError(0);
  735. MapDest[0] = L'x';
  736. MapDest[1] = 0;
  737. rc = LCMapStringW( 0x0409,
  738. LCMAP_LOWERCASE | LCMAP_FULLWIDTH,
  739. MapDest,
  740. -1,
  741. MapDest,
  742. BUFSIZE );
  743. CheckReturnBadParam( rc,
  744. 0,
  745. ERROR_INVALID_PARAMETER,
  746. "src = dest - lowercase and fullwidth",
  747. &NumErrors );
  748. // Variation 5
  749. SetLastError(0);
  750. MapDest[0] = L'x';
  751. MapDest[1] = 0;
  752. rc = LCMapStringW( 0x0409,
  753. LCMAP_LOWERCASE | LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  754. MapDest,
  755. -1,
  756. MapDest,
  757. BUFSIZE );
  758. CheckReturnBadParam( rc,
  759. 0,
  760. ERROR_INVALID_PARAMETER,
  761. "src = dest - lowercase and fullwidth and hiragana",
  762. &NumErrors );
  763. // Variation 6
  764. MapDest[0] = L'x';
  765. MapDest[1] = L'y';
  766. MapDest[2] = 0;
  767. rc = LCMapStringW( Locale,
  768. LCMAP_UPPERCASE,
  769. MapDest,
  770. -1,
  771. MapDest,
  772. 2 );
  773. CheckReturnBadParam( rc,
  774. 0,
  775. ERROR_INSUFFICIENT_BUFFER,
  776. "src = dest - uppercase, size - buffer too small",
  777. &NumErrors );
  778. //
  779. // Check src = dest - A Version.
  780. //
  781. // Variation 0
  782. SetLastError(0);
  783. MapDestA[0] = 'x';
  784. MapDestA[1] = 0;
  785. rc = LCMapStringA( 0x0409,
  786. LCMAP_UPPERCASE | LCMAP_HIRAGANA,
  787. MapDestA,
  788. -1,
  789. MapDestA,
  790. BUFSIZE );
  791. CheckReturnBadParam( rc,
  792. 0,
  793. ERROR_INVALID_PARAMETER,
  794. "src = dest - uppercase and hiragana (A Version)",
  795. &NumErrors );
  796. // Variation 1
  797. SetLastError(0);
  798. MapDestA[0] = 'x';
  799. MapDestA[1] = 0;
  800. rc = LCMapStringA( 0x0409,
  801. LCMAP_LOWERCASE | LCMAP_HIRAGANA,
  802. MapDestA,
  803. -1,
  804. MapDestA,
  805. BUFSIZE );
  806. CheckReturnBadParam( rc,
  807. 0,
  808. ERROR_INVALID_PARAMETER,
  809. "src = dest - lowercase and hiragana (A Version)",
  810. &NumErrors );
  811. // Variation 2
  812. SetLastError(0);
  813. MapDestA[0] = 'x';
  814. MapDestA[1] = 0;
  815. rc = LCMapStringA( 0x0409,
  816. LCMAP_LOWERCASE | LCMAP_KATAKANA,
  817. MapDestA,
  818. -1,
  819. MapDestA,
  820. BUFSIZE );
  821. CheckReturnBadParam( rc,
  822. 0,
  823. ERROR_INVALID_PARAMETER,
  824. "src = dest - lowercase and katakana (A Version)",
  825. &NumErrors );
  826. // Variation 3
  827. SetLastError(0);
  828. MapDestA[0] = 'x';
  829. MapDestA[1] = 0;
  830. rc = LCMapStringA( 0x0409,
  831. LCMAP_LOWERCASE | LCMAP_HALFWIDTH,
  832. MapDestA,
  833. -1,
  834. MapDestA,
  835. BUFSIZE );
  836. CheckReturnBadParam( rc,
  837. 0,
  838. ERROR_INVALID_PARAMETER,
  839. "src = dest - lowercase and halfwidth (A Version)",
  840. &NumErrors );
  841. // Variation 4
  842. SetLastError(0);
  843. MapDestA[0] = 'x';
  844. MapDestA[1] = 0;
  845. rc = LCMapStringA( 0x0409,
  846. LCMAP_LOWERCASE | LCMAP_FULLWIDTH,
  847. MapDestA,
  848. -1,
  849. MapDestA,
  850. BUFSIZE );
  851. CheckReturnBadParam( rc,
  852. 0,
  853. ERROR_INVALID_PARAMETER,
  854. "src = dest - lowercase and fullwidth (A Version)",
  855. &NumErrors );
  856. // Variation 5
  857. SetLastError(0);
  858. MapDestA[0] = 'x';
  859. MapDestA[1] = 0;
  860. rc = LCMapStringA( 0x0409,
  861. LCMAP_LOWERCASE | LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  862. MapDestA,
  863. -1,
  864. MapDestA,
  865. BUFSIZE );
  866. CheckReturnBadParam( rc,
  867. 0,
  868. ERROR_INVALID_PARAMETER,
  869. "src = dest - lowercase and fullwidth and hiragana (A Version)",
  870. &NumErrors );
  871. // Variation 6
  872. MapDestA[0] = 'x';
  873. MapDestA[1] = 'y';
  874. MapDestA[2] = 0;
  875. rc = LCMapStringA( Locale,
  876. LCMAP_UPPERCASE,
  877. MapDestA,
  878. -1,
  879. MapDestA,
  880. 2 );
  881. CheckReturnBadParam( rc,
  882. 0,
  883. ERROR_INSUFFICIENT_BUFFER,
  884. "src = dest - uppercase, size - buffer too small (A Version)",
  885. &NumErrors );
  886. //
  887. // Return total number of errors found.
  888. //
  889. return (NumErrors);
  890. }
  891. ////////////////////////////////////////////////////////////////////////////
  892. //
  893. // LCMS_NormalCase
  894. //
  895. // This routine tests the normal cases of the API routine.
  896. //
  897. // 06-14-91 JulieB Created.
  898. ////////////////////////////////////////////////////////////////////////////
  899. int LCMS_NormalCase()
  900. {
  901. int NumErrors = 0; // error count - to be returned
  902. int rc; // return code
  903. #ifdef PERF
  904. DbgBreakPoint();
  905. #endif
  906. //
  907. // Locales.
  908. //
  909. // Variation 1 - System Default Locale
  910. rc = LCMapStringW( LOCALE_SYSTEM_DEFAULT,
  911. LCMAP_LOWERCASE,
  912. MapSrc1,
  913. -1,
  914. MapDest,
  915. BUFSIZE );
  916. CheckReturnValidW( rc,
  917. -1,
  918. MapDest,
  919. MapLower,
  920. "system default locale",
  921. &NumErrors );
  922. // Variation 2 - Current User Locale
  923. rc = LCMapStringW( LOCALE_USER_DEFAULT,
  924. LCMAP_LOWERCASE,
  925. MapSrc1,
  926. -1,
  927. MapDest,
  928. BUFSIZE );
  929. CheckReturnValidW( rc,
  930. -1,
  931. MapDest,
  932. MapLower,
  933. "current user locale",
  934. &NumErrors );
  935. //
  936. // cbDest = 0.
  937. //
  938. // Variation 1 - cbSrc = -1
  939. rc = LCMapStringW( Locale,
  940. LCMAP_LOWERCASE,
  941. MapSrc1,
  942. -1,
  943. MapDest,
  944. 0 );
  945. CheckReturnValidW( rc,
  946. -1,
  947. NULL,
  948. MapLower,
  949. "cbDest (0) cbSrc (-1)",
  950. &NumErrors );
  951. // Variation 2 - cbSrc = value
  952. rc = LCMapStringW( Locale,
  953. LCMAP_LOWERCASE,
  954. MapSrc1,
  955. WC_STRING_LEN_NULL(MapSrc1),
  956. MapDest,
  957. 0 );
  958. CheckReturnValidW( rc,
  959. -1,
  960. NULL,
  961. MapLower,
  962. "cbDest (0) cbSrc (value)",
  963. &NumErrors );
  964. // Variation 3 - lpDestStr = NULL
  965. rc = LCMapStringW( Locale,
  966. LCMAP_LOWERCASE,
  967. MapSrc1,
  968. -1,
  969. NULL,
  970. 0 );
  971. CheckReturnValidW( rc,
  972. -1,
  973. NULL,
  974. MapLower,
  975. "cbDest (0) lpDestStr NULL",
  976. &NumErrors );
  977. //
  978. // cbSrc.
  979. //
  980. // Variation 1 - cbSrc = -1
  981. rc = LCMapStringW( Locale,
  982. LCMAP_LOWERCASE,
  983. MapSrc1,
  984. -1,
  985. MapDest,
  986. BUFSIZE );
  987. CheckReturnValidW( rc,
  988. -1,
  989. MapDest,
  990. MapLower,
  991. "cbSrc (-1)",
  992. &NumErrors );
  993. // Variation 2 - cbSrc = value
  994. rc = LCMapStringW( Locale,
  995. LCMAP_LOWERCASE,
  996. MapSrc1,
  997. WC_STRING_LEN(MapSrc1),
  998. MapDest,
  999. BUFSIZE );
  1000. CheckReturnValidW( rc,
  1001. WC_STRING_LEN(MapSrc1),
  1002. MapDest,
  1003. MapLower,
  1004. "cbSrc (value)",
  1005. &NumErrors );
  1006. // Variation 3 - cbSrc = -1, no DestStr
  1007. rc = LCMapStringW( Locale,
  1008. LCMAP_LOWERCASE,
  1009. MapSrc1,
  1010. -1,
  1011. NULL,
  1012. 0 );
  1013. CheckReturnValidW( rc,
  1014. -1,
  1015. NULL,
  1016. MapLower,
  1017. "cbSrc (-1), no DestStr",
  1018. &NumErrors );
  1019. // Variation 4 - cbSrc = value, no DestStr
  1020. rc = LCMapStringW( Locale,
  1021. LCMAP_LOWERCASE,
  1022. MapSrc1,
  1023. WC_STRING_LEN(MapSrc1),
  1024. NULL,
  1025. 0 );
  1026. CheckReturnValidW( rc,
  1027. WC_STRING_LEN(MapSrc1),
  1028. NULL,
  1029. MapLower,
  1030. "cbSrc (value), no DestStr",
  1031. &NumErrors );
  1032. //
  1033. // LOCALE_USE_CP_ACP Flag.
  1034. //
  1035. // Variation 1 - Use CP ACP
  1036. rc = LCMapStringW( Locale,
  1037. LOCALE_USE_CP_ACP | LCMAP_LOWERCASE,
  1038. MapSrc1,
  1039. -1,
  1040. MapDest,
  1041. BUFSIZE );
  1042. CheckReturnValidW( rc,
  1043. -1,
  1044. MapDest,
  1045. MapLower,
  1046. "Use CP ACP",
  1047. &NumErrors );
  1048. //
  1049. // LCMAP_LOWERCASE Flag.
  1050. //
  1051. // Variation 1 - lowercase
  1052. rc = LCMapStringW( Locale,
  1053. LCMAP_LOWERCASE,
  1054. MapSrc1,
  1055. -1,
  1056. MapDest,
  1057. BUFSIZE );
  1058. CheckReturnValidW( rc,
  1059. -1,
  1060. MapDest,
  1061. MapLower,
  1062. "lowercase",
  1063. &NumErrors );
  1064. // Variation 2 - lowercase, no DestStr
  1065. rc = LCMapStringW( Locale,
  1066. LCMAP_LOWERCASE,
  1067. MapSrc1,
  1068. -1,
  1069. NULL,
  1070. 0 );
  1071. CheckReturnValidW( rc,
  1072. -1,
  1073. NULL,
  1074. MapLower,
  1075. "lowercase, no DestStr",
  1076. &NumErrors );
  1077. //
  1078. // LCMAP_UPPERCASE Flag.
  1079. //
  1080. // Variation 1 - uppercase
  1081. rc = LCMapStringW( Locale,
  1082. LCMAP_UPPERCASE,
  1083. MapSrc1,
  1084. -1,
  1085. MapDest,
  1086. BUFSIZE );
  1087. CheckReturnValidW( rc,
  1088. -1,
  1089. MapDest,
  1090. MapUpper,
  1091. "uppercase",
  1092. &NumErrors );
  1093. // Variation 2 - uppercase, no DestStr
  1094. rc = LCMapStringW( Locale,
  1095. LCMAP_UPPERCASE,
  1096. MapSrc1,
  1097. -1,
  1098. NULL,
  1099. 0 );
  1100. CheckReturnValidW( rc,
  1101. -1,
  1102. NULL,
  1103. MapUpper,
  1104. "uppercase, no DestStr",
  1105. &NumErrors );
  1106. // Variation 3 - uppercase, sharp S
  1107. rc = LCMapStringW( Locale,
  1108. LCMAP_UPPERCASE,
  1109. wcSharpS,
  1110. -1,
  1111. MapDest,
  1112. BUFSIZE );
  1113. CheckReturnValidW( rc,
  1114. -1,
  1115. MapDest,
  1116. L"\x0054\x00df\x0054",
  1117. "uppercase, sharp S",
  1118. &NumErrors );
  1119. // Variation 4 - upper case nonspace
  1120. rc = LCMapStringW( Locale,
  1121. LCMAP_UPPERCASE,
  1122. MapNS1,
  1123. -1,
  1124. MapDest,
  1125. BUFSIZE );
  1126. CheckReturnValidW( rc,
  1127. -1,
  1128. MapDest,
  1129. MapUpperNS,
  1130. "uppercase, nonspace",
  1131. &NumErrors );
  1132. // Variation 5 - upper case, no DestStr, nonspace
  1133. rc = LCMapStringW( Locale,
  1134. LCMAP_UPPERCASE,
  1135. MapNS1,
  1136. -1,
  1137. NULL,
  1138. 0 );
  1139. CheckReturnValidW( rc,
  1140. -1,
  1141. NULL,
  1142. MapUpperNS,
  1143. "uppercase, nonspace, no DestStr",
  1144. &NumErrors );
  1145. // Variation 6 - uppercase Korean
  1146. MapDest[0] = L'a';
  1147. MapDest[1] = L'b';
  1148. MapDest[2] = 0;
  1149. rc = LCMapStringW( MAKELCID(MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN), SORT_DEFAULT),
  1150. LCMAP_UPPERCASE,
  1151. MapDest,
  1152. 3,
  1153. MapDest,
  1154. 3 );
  1155. CheckReturnValidW( rc,
  1156. -1,
  1157. MapDest,
  1158. L"AB",
  1159. "Korean uppercase",
  1160. &NumErrors );
  1161. //
  1162. // LCMAP_LINGUISTIC_CASING Flag.
  1163. //
  1164. // Variation 1 - linguistic uppercase
  1165. rc = LCMapStringW( Locale,
  1166. LCMAP_UPPERCASE | LCMAP_LINGUISTIC_CASING,
  1167. MapSrc1,
  1168. -1,
  1169. MapDest,
  1170. BUFSIZE );
  1171. CheckReturnValidW( rc,
  1172. -1,
  1173. MapDest,
  1174. MapUpper,
  1175. "linguistic uppercase",
  1176. &NumErrors );
  1177. // Variation 2 - linguistic uppercase
  1178. rc = LCMapStringW( Locale,
  1179. LCMAP_UPPERCASE | LCMAP_LINGUISTIC_CASING,
  1180. L"\xff41\xff5a\xff21",
  1181. -1,
  1182. MapDest,
  1183. BUFSIZE );
  1184. CheckReturnValidW( rc,
  1185. -1,
  1186. MapDest,
  1187. L"\xff21\xff3a\xff21",
  1188. "linguistic uppercase (AZ)",
  1189. &NumErrors );
  1190. // Variation 3 - linguistic uppercase
  1191. rc = LCMapStringW( 0x041f,
  1192. LCMAP_UPPERCASE | LCMAP_LINGUISTIC_CASING,
  1193. L"\xff41\xff5a\x0069\x0131",
  1194. -1,
  1195. MapDest,
  1196. BUFSIZE );
  1197. CheckReturnValidW( rc,
  1198. -1,
  1199. MapDest,
  1200. L"\xff21\xff3a\x0130\x0049",
  1201. "linguistic uppercase (Turkish)",
  1202. &NumErrors );
  1203. // Variation 4 - linguistic lowercase
  1204. rc = LCMapStringW( Locale,
  1205. LCMAP_LOWERCASE | LCMAP_LINGUISTIC_CASING,
  1206. MapSrc1,
  1207. -1,
  1208. MapDest,
  1209. BUFSIZE );
  1210. CheckReturnValidW( rc,
  1211. -1,
  1212. MapDest,
  1213. MapLower,
  1214. "linguistic lowercase",
  1215. &NumErrors );
  1216. // Variation 5 - linguistic lowercase
  1217. rc = LCMapStringW( Locale,
  1218. LCMAP_LOWERCASE | LCMAP_LINGUISTIC_CASING,
  1219. L"\xff21\xff3a\xff41",
  1220. -1,
  1221. MapDest,
  1222. BUFSIZE );
  1223. CheckReturnValidW( rc,
  1224. -1,
  1225. MapDest,
  1226. L"\xff41\xff5a\xff41",
  1227. "linguistic lowercase (az)",
  1228. &NumErrors );
  1229. // Variation 6 - linguistic lowercase
  1230. rc = LCMapStringW( 0x041f,
  1231. LCMAP_LOWERCASE | LCMAP_LINGUISTIC_CASING,
  1232. L"\xff21\xff3a\x0049\x0130",
  1233. -1,
  1234. MapDest,
  1235. BUFSIZE );
  1236. CheckReturnValidW( rc,
  1237. -1,
  1238. MapDest,
  1239. L"\xff41\xff5a\x0131\x0069",
  1240. "linguistic lowercase (Turkish)",
  1241. &NumErrors );
  1242. //
  1243. // NORM_IGNORESYMBOLS Flag.
  1244. //
  1245. // Variation 1 - ignoresymbols
  1246. rc = LCMapStringW( Locale,
  1247. NORM_IGNORESYMBOLS,
  1248. MapSrc2,
  1249. -1,
  1250. MapDest,
  1251. BUFSIZE );
  1252. CheckReturnValidW( rc,
  1253. -1,
  1254. MapDest,
  1255. MapNoSymbols,
  1256. "ignore symbols",
  1257. &NumErrors );
  1258. // Variation 2 - ignoresymbols, no DestStr
  1259. rc = LCMapStringW( Locale,
  1260. NORM_IGNORESYMBOLS,
  1261. MapSrc2,
  1262. -1,
  1263. NULL,
  1264. 0 );
  1265. CheckReturnValidW( rc,
  1266. -1,
  1267. NULL,
  1268. MapNoSymbols,
  1269. "ignore symbols, no DestStr",
  1270. &NumErrors );
  1271. //
  1272. // NORM_IGNORENONSPACE Flag.
  1273. //
  1274. // Variation 1 - ignore nonspace
  1275. rc = LCMapStringW( Locale,
  1276. NORM_IGNORENONSPACE,
  1277. MapNS1,
  1278. -1,
  1279. MapDest,
  1280. BUFSIZE );
  1281. CheckReturnValidW( rc,
  1282. -1,
  1283. MapDest,
  1284. MapNoNS1,
  1285. "ignore nonspace",
  1286. &NumErrors );
  1287. // Variation 2 - ignore nonspace, no translation
  1288. rc = LCMapStringW( Locale,
  1289. NORM_IGNORENONSPACE,
  1290. MapNS2,
  1291. -1,
  1292. MapDest,
  1293. BUFSIZE );
  1294. CheckReturnValidW( rc,
  1295. -1,
  1296. MapDest,
  1297. MapNoNS1,
  1298. "ignore nonspace, no trans",
  1299. &NumErrors );
  1300. // Variation 3 - ignore nonspace, no DestStr
  1301. rc = LCMapStringW( Locale,
  1302. NORM_IGNORENONSPACE,
  1303. MapNS1,
  1304. -1,
  1305. NULL,
  1306. 0 );
  1307. CheckReturnValidW( rc,
  1308. -1,
  1309. NULL,
  1310. MapNoNS1,
  1311. "ignore nonspace, no DestStr",
  1312. &NumErrors );
  1313. // Variation 4 - ignore nonspace, no translation, no DestStr
  1314. rc = LCMapStringW( Locale,
  1315. NORM_IGNORENONSPACE,
  1316. MapNS2,
  1317. -1,
  1318. NULL,
  1319. 0 );
  1320. CheckReturnValidW( rc,
  1321. -1,
  1322. NULL,
  1323. MapNoNS1,
  1324. "ignore nonspace, no trans, no DestStr",
  1325. &NumErrors );
  1326. //
  1327. // LCMAP_SORTKEY Flag.
  1328. //
  1329. // Variation 1 - sortkey
  1330. rc = LCMapStringW( Locale,
  1331. LCMAP_SORTKEY,
  1332. L"Th",
  1333. -1,
  1334. (LPWSTR)SortDest,
  1335. BUFSIZE );
  1336. CheckReturnValidSortKey( rc,
  1337. -1,
  1338. SortDest,
  1339. "\x0e\x99\x0e\x2c\x01\x01\x12\x01\x01",
  1340. "sortkey",
  1341. &NumErrors );
  1342. // Variation 2 - sortkey, no DestStr
  1343. rc = LCMapStringW( Locale,
  1344. LCMAP_SORTKEY,
  1345. L"Th",
  1346. -1,
  1347. NULL,
  1348. 0 );
  1349. CheckReturnValidSortKey( rc,
  1350. -1,
  1351. NULL,
  1352. "\x0e\x99\x0e\x2c\x01\x01\x12\x01\x01",
  1353. "sortkey, no DestStr",
  1354. &NumErrors );
  1355. // Variation 3 - sortkey (case)
  1356. rc = LCMapStringW( Locale,
  1357. LCMAP_SORTKEY | NORM_IGNORECASE,
  1358. L"Th",
  1359. -1,
  1360. (LPWSTR)SortDest,
  1361. BUFSIZE );
  1362. CheckReturnValidSortKey( rc,
  1363. -1,
  1364. SortDest,
  1365. "\x0e\x99\x0e\x2c\x01\x01\x01\x01",
  1366. "sortkey (case)",
  1367. &NumErrors );
  1368. // Variation 4 - sortkey, no DestStr (case)
  1369. rc = LCMapStringW( Locale,
  1370. LCMAP_SORTKEY | NORM_IGNORECASE,
  1371. L"Th",
  1372. -1,
  1373. NULL,
  1374. 0 );
  1375. CheckReturnValidSortKey( rc,
  1376. -1,
  1377. NULL,
  1378. "\x0e\x99\x0e\x2c\x01\x01\x01\x01",
  1379. "sortkey (case), no DestStr",
  1380. &NumErrors );
  1381. //
  1382. // Check for punctuation position using nonspace chars.
  1383. // Make sure:
  1384. // a-acute, punct is the same as
  1385. // a, acute, punct
  1386. //
  1387. // Variation 5 - sortkey (precomp punct position)
  1388. rc = LCMapStringW( Locale,
  1389. LCMAP_SORTKEY,
  1390. SortPunctPre,
  1391. -1,
  1392. (LPWSTR)SortDest,
  1393. BUFSIZE );
  1394. CheckReturnValidSortKey( rc,
  1395. -1,
  1396. SortDest,
  1397. "\x0e\x02\x01\x0e\x01\x01\x01\x80\x0b\x06\x82",
  1398. "sortkey (precomp punct position)",
  1399. &NumErrors );
  1400. // Variation 6 - sortkey (comp punct position)
  1401. rc = LCMapStringW( Locale,
  1402. LCMAP_SORTKEY,
  1403. SortPunctComp,
  1404. -1,
  1405. (LPWSTR)SortDest,
  1406. BUFSIZE );
  1407. CheckReturnValidSortKey( rc,
  1408. -1,
  1409. SortDest,
  1410. "\x0e\x02\x01\x0e\x01\x01\x01\x80\x0b\x06\x82",
  1411. "sortkey (comp punct position)",
  1412. &NumErrors );
  1413. //
  1414. // Check for punctuation position using expansion chars.
  1415. // Make sure:
  1416. // ae, punct is the same as
  1417. // a, e, punct
  1418. //
  1419. // Variation 7 - sortkey (expansion 1 punct position)
  1420. rc = LCMapStringW( Locale,
  1421. LCMAP_SORTKEY,
  1422. SortPunctExp1,
  1423. -1,
  1424. (LPWSTR)SortDest,
  1425. BUFSIZE );
  1426. CheckReturnValidSortKey( rc,
  1427. -1,
  1428. SortDest,
  1429. "\x0e\x02\x0e\x21\x01\x01\x01\x01\x80\x0f\x06\x82",
  1430. "sortkey (expansion 1 punct position)",
  1431. &NumErrors );
  1432. // Variation 8 - sortkey (expansion 2 punct position)
  1433. rc = LCMapStringW( Locale,
  1434. LCMAP_SORTKEY,
  1435. SortPunctExp2,
  1436. -1,
  1437. (LPWSTR)SortDest,
  1438. BUFSIZE );
  1439. CheckReturnValidSortKey( rc,
  1440. -1,
  1441. SortDest,
  1442. "\x0e\x02\x0e\x21\x01\x01\x01\x01\x80\x0f\x06\x82",
  1443. "sortkey (expansion 2 punct position)",
  1444. &NumErrors );
  1445. //
  1446. // Check for punctuation position using unsortable chars.
  1447. // Make sure:
  1448. // ae, unsort, punct is the same as
  1449. // a, e, punct
  1450. //
  1451. // Variation 9 - sortkey (unsortable punct position)
  1452. rc = LCMapStringW( Locale,
  1453. LCMAP_SORTKEY,
  1454. SortPunctUnsort,
  1455. -1,
  1456. (LPWSTR)SortDest,
  1457. BUFSIZE );
  1458. CheckReturnValidSortKey( rc,
  1459. -1,
  1460. SortDest,
  1461. "\x0e\x02\x0e\x21\x01\x01\x01\x01\x80\x0f\x06\x82",
  1462. "sortkey (unsortable punct position)",
  1463. &NumErrors );
  1464. //
  1465. // Check symbol and nonspace chars.
  1466. // Make sure:
  1467. // a-acute, symbol is the same as
  1468. // a, acute, symbol
  1469. //
  1470. // Variation 5 - sortkey (precomp symbol)
  1471. rc = LCMapStringW( Locale,
  1472. LCMAP_SORTKEY,
  1473. SortSymbolPre,
  1474. -1,
  1475. (LPWSTR)SortDest,
  1476. BUFSIZE );
  1477. CheckReturnValidSortKey( rc,
  1478. -1,
  1479. SortDest,
  1480. "\x0e\x02\x07\x2d\x01\x0e\x01\x01\x01",
  1481. "sortkey (precomp symbol)",
  1482. &NumErrors );
  1483. // Variation 6 - sortkey (comp symbol)
  1484. rc = LCMapStringW( Locale,
  1485. LCMAP_SORTKEY,
  1486. SortSymbolComp,
  1487. -1,
  1488. (LPWSTR)SortDest,
  1489. BUFSIZE );
  1490. CheckReturnValidSortKey( rc,
  1491. -1,
  1492. SortDest,
  1493. "\x0e\x02\x07\x2d\x01\x0e\x01\x01\x01",
  1494. "sortkey (comp symbol)",
  1495. &NumErrors );
  1496. //
  1497. // Check symbol and expansion char.
  1498. // Make sure:
  1499. // ae, symbol is the same as
  1500. // a, e, symbol
  1501. //
  1502. // Variation 7 - sortkey (expansion 1 symbol)
  1503. rc = LCMapStringW( Locale,
  1504. LCMAP_SORTKEY,
  1505. SortSymbolExp1,
  1506. -1,
  1507. (LPWSTR)SortDest,
  1508. BUFSIZE );
  1509. CheckReturnValidSortKey( rc,
  1510. -1,
  1511. SortDest,
  1512. "\x0e\x02\x0e\x21\x07\x2d\x01\x01\x01\x01",
  1513. "sortkey (expansion 1 symbol)",
  1514. &NumErrors );
  1515. // Variation 8 - sortkey (expansion 2 symbol)
  1516. rc = LCMapStringW( Locale,
  1517. LCMAP_SORTKEY,
  1518. SortSymbolExp2,
  1519. -1,
  1520. (LPWSTR)SortDest,
  1521. BUFSIZE );
  1522. CheckReturnValidSortKey( rc,
  1523. -1,
  1524. SortDest,
  1525. "\x0e\x02\x0e\x21\x07\x2d\x01\x01\x01\x01",
  1526. "sortkey (expansion 2 symbol)",
  1527. &NumErrors );
  1528. //
  1529. // Check symbol and unsortable char.
  1530. // Make sure:
  1531. // ae, unsort, symbol is the same as
  1532. // a, e, symbol
  1533. //
  1534. // Variation 9 - sortkey (unsortable symbol)
  1535. rc = LCMapStringW( Locale,
  1536. LCMAP_SORTKEY,
  1537. SortSymbolUnsort,
  1538. -1,
  1539. (LPWSTR)SortDest,
  1540. BUFSIZE );
  1541. CheckReturnValidSortKey( rc,
  1542. -1,
  1543. SortDest,
  1544. "\x0e\x02\x0e\x21\x07\x2d\x01\x01\x01\x01",
  1545. "sortkey (unsortable symbol)",
  1546. &NumErrors );
  1547. //
  1548. // Check Hungarian compression.
  1549. // Make sure: ccs is the same as cs+cs
  1550. //
  1551. // Variation 10 - sortkey (Hungarian compression)
  1552. rc = LCMapStringW( MAKELCID(0x040e, 0),
  1553. LCMAP_SORTKEY,
  1554. L"ccsddzs",
  1555. -1,
  1556. (LPWSTR)SortDest,
  1557. BUFSIZE );
  1558. CheckReturnValidSortKey( rc,
  1559. -1,
  1560. SortDest,
  1561. "\x0e\x0e\x0e\x0e\x0e\x1e\x0e\x1e\x01\x01\x01\x01",
  1562. "sortkey (hungarian compression)",
  1563. &NumErrors );
  1564. //
  1565. // Check expansion (1 to 3).
  1566. //
  1567. // Variation 11 - sortkey (expansion 1 to 3)
  1568. rc = LCMapStringW( Locale,
  1569. LCMAP_SORTKEY,
  1570. L"\xfb03",
  1571. -1,
  1572. (LPWSTR)SortDest,
  1573. BUFSIZE );
  1574. CheckReturnValidSortKey( rc,
  1575. -1,
  1576. SortDest,
  1577. "\x0e\x23\x0e\x23\x0e\x32\x01\x01\x01\x01",
  1578. "sortkey (expansion 1 to 3)",
  1579. &NumErrors );
  1580. // Variation 12 - sortkey (expansion 1 to 3)
  1581. rc = LCMapStringW( Locale,
  1582. LCMAP_SORTKEY,
  1583. L"ffi",
  1584. -1,
  1585. (LPWSTR)SortDest,
  1586. BUFSIZE );
  1587. CheckReturnValidSortKey( rc,
  1588. -1,
  1589. SortDest,
  1590. "\x0e\x23\x0e\x23\x0e\x32\x01\x01\x01\x01",
  1591. "sortkey (expansion 1 to 3) 2",
  1592. &NumErrors );
  1593. //
  1594. // Check WORD sort versus STRING sort.
  1595. //
  1596. // Variation 1 - sortkey (WORD SORT)
  1597. rc = LCMapStringW( MAKELCID(0x040e, 0),
  1598. LCMAP_SORTKEY,
  1599. L"co-op",
  1600. -1,
  1601. (LPWSTR)SortDest,
  1602. BUFSIZE );
  1603. CheckReturnValidSortKey( rc,
  1604. -1,
  1605. SortDest,
  1606. "\x0e\x0a\x0e\x7c\x0e\x7c\x0e\x7e\x01\x01\x01\x01\x80\x0f\x06\x82",
  1607. "sortkey (WORD SORT)",
  1608. &NumErrors );
  1609. // Variation 2 - sortkey (STRING SORT)
  1610. rc = LCMapStringW( MAKELCID(0x040e, 0),
  1611. LCMAP_SORTKEY | SORT_STRINGSORT,
  1612. L"co-op",
  1613. -1,
  1614. (LPWSTR)SortDest,
  1615. BUFSIZE );
  1616. CheckReturnValidSortKey( rc,
  1617. -1,
  1618. SortDest,
  1619. "\x0e\x0a\x0e\x7c\x06\x82\x0e\x7c\x0e\x7e\x01\x01\x01\x01",
  1620. "sortkey (STRING SORT)",
  1621. &NumErrors );
  1622. //
  1623. // LCMAP_BYTEREV Flag.
  1624. //
  1625. // Variation 1 - byterev
  1626. rc = LCMapStringW( Locale,
  1627. LCMAP_BYTEREV,
  1628. L"Th",
  1629. 2,
  1630. MapDest,
  1631. BUFSIZE );
  1632. CheckReturnValidW( rc,
  1633. 2,
  1634. MapDest,
  1635. L"\x5400\x6800",
  1636. "byterev",
  1637. &NumErrors );
  1638. // Variation 2 - byterev, no DestStr
  1639. rc = LCMapStringW( Locale,
  1640. LCMAP_BYTEREV,
  1641. L"Th",
  1642. 2,
  1643. NULL,
  1644. 0 );
  1645. CheckReturnValidW( rc,
  1646. 2,
  1647. NULL,
  1648. L"\x5400\x6800",
  1649. "byterev, no DestStr",
  1650. &NumErrors );
  1651. // Variation 3 - sortkey, byterev
  1652. rc = LCMapStringW( Locale,
  1653. LCMAP_BYTEREV | LCMAP_SORTKEY,
  1654. L"Th",
  1655. 2,
  1656. (LPWSTR)SortDest,
  1657. BUFSIZE );
  1658. CheckReturnValidSortKey( rc,
  1659. 10,
  1660. SortDest,
  1661. "\x99\x0e\x2c\x0e\x01\x01\x01\x12\x00\x01",
  1662. "sortkey, byterev",
  1663. &NumErrors );
  1664. // Variation 4 - sortkey, byterev (-1)
  1665. rc = LCMapStringW( Locale,
  1666. LCMAP_BYTEREV | LCMAP_SORTKEY,
  1667. L"Th",
  1668. -1,
  1669. (LPWSTR)SortDest,
  1670. BUFSIZE );
  1671. CheckReturnValidSortKey( rc,
  1672. 10,
  1673. SortDest,
  1674. "\x99\x0e\x2c\x0e\x01\x01\x01\x12\x00\x01",
  1675. "sortkey, byterev (-1)",
  1676. &NumErrors );
  1677. // Variation 5 - byterev, ignore nonspace
  1678. rc = LCMapStringW( Locale,
  1679. LCMAP_BYTEREV | NORM_IGNORENONSPACE,
  1680. L"T\x0300h",
  1681. 3,
  1682. MapDest,
  1683. BUFSIZE );
  1684. CheckReturnValidW( rc,
  1685. 2,
  1686. MapDest,
  1687. L"\x5400\x6800",
  1688. "byterev, ignore nonspace",
  1689. &NumErrors );
  1690. // Variation 6 - byterev, ignore symbols
  1691. rc = LCMapStringW( Locale,
  1692. LCMAP_BYTEREV | NORM_IGNORESYMBOLS,
  1693. L"T*h",
  1694. 3,
  1695. MapDest,
  1696. BUFSIZE );
  1697. CheckReturnValidW( rc,
  1698. 2,
  1699. MapDest,
  1700. L"\x5400\x6800",
  1701. "byterev, ignore symbols",
  1702. &NumErrors );
  1703. // Variation 7 - byterev, ignore nonspace and symbols
  1704. rc = LCMapStringW( Locale,
  1705. LCMAP_BYTEREV | NORM_IGNORENONSPACE | NORM_IGNORESYMBOLS,
  1706. L"*T\x0300h@",
  1707. 5,
  1708. MapDest,
  1709. BUFSIZE );
  1710. CheckReturnValidW( rc,
  1711. 2,
  1712. MapDest,
  1713. L"\x5400\x6800",
  1714. "byterev, ignore nonspace and symbols",
  1715. &NumErrors );
  1716. // Variation 8 - byterev, no DestStr, cchDest 0
  1717. rc = LCMapStringW( 0x0409,
  1718. LCMAP_BYTEREV,
  1719. L"Th",
  1720. 2,
  1721. NULL,
  1722. 0 );
  1723. CheckReturnValidW( rc,
  1724. 2,
  1725. NULL,
  1726. L"\x5400\x6800",
  1727. "byterev, no DestStr",
  1728. &NumErrors );
  1729. // Variation 9 - sortkey | byterev, no DestStr, cchDest 0
  1730. rc = LCMapStringW( 0x0409,
  1731. LCMAP_SORTKEY | LCMAP_BYTEREV,
  1732. L"Th",
  1733. 2,
  1734. NULL,
  1735. 0 );
  1736. CheckReturnValidSortKey( rc,
  1737. 10,
  1738. NULL,
  1739. "\x99\x0e\x2c\x0e\x01\x01\x01\x12\x00\x01",
  1740. "sortkey, byterev (-1), no DestStr",
  1741. &NumErrors );
  1742. //
  1743. // LCMAP_HIRAGANA, LCMAP_KATAKANA, LCMAP_HALFWIDTH, LCMAP_FULLWIDTH Flags.
  1744. //
  1745. // Variation 1 - hiragana
  1746. rc = LCMapStringW( Locale,
  1747. LCMAP_HIRAGANA,
  1748. L"\x30a1Th\x30aa",
  1749. 4,
  1750. MapDest,
  1751. BUFSIZE );
  1752. CheckReturnValidW( rc,
  1753. 4,
  1754. MapDest,
  1755. L"\x3041Th\x304a",
  1756. "hiragana",
  1757. &NumErrors );
  1758. // Variation 2 - katakana
  1759. rc = LCMapStringW( Locale,
  1760. LCMAP_KATAKANA,
  1761. L"\x3041Th\x304a",
  1762. 4,
  1763. MapDest,
  1764. BUFSIZE );
  1765. CheckReturnValidW( rc,
  1766. 4,
  1767. MapDest,
  1768. L"\x30a1Th\x30aa",
  1769. "katakana",
  1770. &NumErrors );
  1771. // Variation 3 - halfwidth
  1772. rc = LCMapStringW( Locale,
  1773. LCMAP_HALFWIDTH,
  1774. L"\x30a6Th\x3131",
  1775. 4,
  1776. MapDest,
  1777. BUFSIZE );
  1778. CheckReturnValidW( rc,
  1779. 4,
  1780. MapDest,
  1781. L"\xff73Th\xffa1",
  1782. "half width",
  1783. &NumErrors );
  1784. // Variation 4 - fullwidth
  1785. rc = LCMapStringW( Locale,
  1786. LCMAP_FULLWIDTH,
  1787. L"\xff61Th\xffca",
  1788. 4,
  1789. MapDest,
  1790. BUFSIZE );
  1791. CheckReturnValidW( rc,
  1792. 4,
  1793. MapDest,
  1794. L"\x3002\xff34\xff48\x3155",
  1795. "full width",
  1796. &NumErrors );
  1797. // Variation 5 - hiragana, half width
  1798. rc = LCMapStringW( Locale,
  1799. LCMAP_HIRAGANA | LCMAP_HALFWIDTH,
  1800. L"\x30a1Th\x30aa",
  1801. 4,
  1802. MapDest,
  1803. BUFSIZE );
  1804. CheckReturnValidW( rc,
  1805. 4,
  1806. MapDest,
  1807. L"\x3041Th\x304a",
  1808. "hiragana, half width",
  1809. &NumErrors );
  1810. // Variation 6 - hiragana, full width
  1811. rc = LCMapStringW( Locale,
  1812. LCMAP_HIRAGANA | LCMAP_FULLWIDTH,
  1813. L"\x30a1Th\x30aa",
  1814. 4,
  1815. MapDest,
  1816. BUFSIZE );
  1817. CheckReturnValidW( rc,
  1818. 4,
  1819. MapDest,
  1820. L"\x3041\xff34\xff48\x304a",
  1821. "hiragana, full width",
  1822. &NumErrors );
  1823. // Variation 7 - katakana, half width
  1824. rc = LCMapStringW( Locale,
  1825. LCMAP_KATAKANA | LCMAP_HALFWIDTH,
  1826. L"\x3041Th\x304a",
  1827. 4,
  1828. MapDest,
  1829. BUFSIZE );
  1830. CheckReturnValidW( rc,
  1831. 4,
  1832. MapDest,
  1833. L"\xff67Th\xff75",
  1834. "katakana, half width",
  1835. &NumErrors );
  1836. // Variation 8 - katakana, full width
  1837. rc = LCMapStringW( Locale,
  1838. LCMAP_KATAKANA | LCMAP_FULLWIDTH,
  1839. L"\x3041Th\x304a",
  1840. 4,
  1841. MapDest,
  1842. BUFSIZE );
  1843. CheckReturnValidW( rc,
  1844. 4,
  1845. MapDest,
  1846. L"\x30a1\xff34\xff48\x30aa",
  1847. "katakana, full width",
  1848. &NumErrors );
  1849. // Variation 9 - byterev, hiragana, full width
  1850. rc = LCMapStringW( Locale,
  1851. LCMAP_BYTEREV | LCMAP_HIRAGANA | LCMAP_FULLWIDTH,
  1852. L"\x30a1Th\x30aa",
  1853. 4,
  1854. MapDest,
  1855. BUFSIZE );
  1856. CheckReturnValidW( rc,
  1857. 4,
  1858. MapDest,
  1859. L"\x4130\x34ff\x48ff\x4a30",
  1860. "byterev, hiragana, full width",
  1861. &NumErrors );
  1862. // Variation 10 - byterev, katakana, full width
  1863. rc = LCMapStringW( Locale,
  1864. LCMAP_BYTEREV | LCMAP_KATAKANA | LCMAP_FULLWIDTH,
  1865. L"\x3041Th\x304a",
  1866. 4,
  1867. MapDest,
  1868. BUFSIZE );
  1869. CheckReturnValidW( rc,
  1870. 4,
  1871. MapDest,
  1872. L"\xa130\x34ff\x48ff\xaa30",
  1873. "byterev, katakana, full width",
  1874. &NumErrors );
  1875. // Variation 11 - uppercase, katakana
  1876. rc = LCMapStringW( Locale,
  1877. LCMAP_UPPERCASE | LCMAP_KATAKANA,
  1878. MapSrc1,
  1879. -1,
  1880. MapDest,
  1881. BUFSIZE );
  1882. CheckReturnValidW( rc,
  1883. -1,
  1884. MapDest,
  1885. MapUpper,
  1886. "uppercase, katakana",
  1887. &NumErrors );
  1888. // Variation 12 - uppercase, half width
  1889. rc = LCMapStringW( Locale,
  1890. LCMAP_UPPERCASE | LCMAP_HALFWIDTH,
  1891. MapSrc1,
  1892. -1,
  1893. MapDest,
  1894. BUFSIZE );
  1895. CheckReturnValidW( rc,
  1896. -1,
  1897. MapDest,
  1898. MapUpper,
  1899. "uppercase, half width",
  1900. &NumErrors );
  1901. //
  1902. // LCMAP_HIRAGANA, LCMAP_KATAKANA, LCMAP_HALFWIDTH, LCMAP_FULLWIDTH Flags.
  1903. // cchDest == 0
  1904. //
  1905. // Variation 1 - hiragana
  1906. rc = LCMapStringW( Locale,
  1907. LCMAP_HIRAGANA,
  1908. L"\x30a1Th\x30aa",
  1909. 4,
  1910. MapDest,
  1911. 0 );
  1912. CheckReturnValidW( rc,
  1913. 4,
  1914. NULL,
  1915. L"\x3041Th\x304a",
  1916. "hiragana (cchDest = 0)",
  1917. &NumErrors );
  1918. // Variation 2 - katakana
  1919. rc = LCMapStringW( Locale,
  1920. LCMAP_KATAKANA,
  1921. L"\x3041Th\x304a",
  1922. 4,
  1923. MapDest,
  1924. 0 );
  1925. CheckReturnValidW( rc,
  1926. 4,
  1927. NULL,
  1928. L"\x30a1Th\x30aa",
  1929. "katakana (cchDest = 0)",
  1930. &NumErrors );
  1931. // Variation 3 - halfwidth
  1932. rc = LCMapStringW( Locale,
  1933. LCMAP_HALFWIDTH,
  1934. L"\x30a6Th\x3131",
  1935. 4,
  1936. MapDest,
  1937. 0 );
  1938. CheckReturnValidW( rc,
  1939. 4,
  1940. NULL,
  1941. L"\xff73Th\xffa1",
  1942. "half width (cchDest = 0)",
  1943. &NumErrors );
  1944. // Variation 4 - fullwidth
  1945. rc = LCMapStringW( Locale,
  1946. LCMAP_FULLWIDTH,
  1947. L"\xff61Th\xffca",
  1948. 4,
  1949. MapDest,
  1950. 0 );
  1951. CheckReturnValidW( rc,
  1952. 4,
  1953. NULL,
  1954. L"\x3002\xff34\xff48\x3155",
  1955. "full width (cchDest = 0)",
  1956. &NumErrors );
  1957. // Variation 5 - hiragana, half width
  1958. rc = LCMapStringW( Locale,
  1959. LCMAP_HIRAGANA | LCMAP_HALFWIDTH,
  1960. L"\x30a1Th\x30aa",
  1961. 4,
  1962. MapDest,
  1963. 0 );
  1964. CheckReturnValidW( rc,
  1965. 4,
  1966. NULL,
  1967. L"\x3041Th\x304a",
  1968. "hiragana, half width (cchDest = 0)",
  1969. &NumErrors );
  1970. // Variation 6 - hiragana, full width
  1971. rc = LCMapStringW( Locale,
  1972. LCMAP_HIRAGANA | LCMAP_FULLWIDTH,
  1973. L"\x30a1Th\x30aa",
  1974. 4,
  1975. MapDest,
  1976. 0 );
  1977. CheckReturnValidW( rc,
  1978. 4,
  1979. NULL,
  1980. L"\x3041\xff34\xff48\x304a",
  1981. "hiragana, full width (cchDest = 0)",
  1982. &NumErrors );
  1983. // Variation 7 - katakana, half width
  1984. rc = LCMapStringW( Locale,
  1985. LCMAP_KATAKANA | LCMAP_HALFWIDTH,
  1986. L"\x3041Th\x304a",
  1987. 4,
  1988. MapDest,
  1989. 0 );
  1990. CheckReturnValidW( rc,
  1991. 4,
  1992. NULL,
  1993. L"\xff67Th\xff75",
  1994. "katakana, half width (cchDest = 0)",
  1995. &NumErrors );
  1996. // Variation 8 - katakana, full width
  1997. rc = LCMapStringW( Locale,
  1998. LCMAP_KATAKANA | LCMAP_FULLWIDTH,
  1999. L"\x3041Th\x304a",
  2000. 4,
  2001. MapDest,
  2002. 0 );
  2003. CheckReturnValidW( rc,
  2004. 4,
  2005. NULL,
  2006. L"\x30a1\xff34\xff48\x30aa",
  2007. "katakana, full width (cchDest = 0)",
  2008. &NumErrors );
  2009. // Variation 9 - byterev, hiragana, full width
  2010. rc = LCMapStringW( Locale,
  2011. LCMAP_BYTEREV | LCMAP_HIRAGANA | LCMAP_FULLWIDTH,
  2012. L"\x30a1Th\x30aa",
  2013. 4,
  2014. MapDest,
  2015. 0 );
  2016. CheckReturnValidW( rc,
  2017. 4,
  2018. NULL,
  2019. L"\x4130\x34ff\x48ff\x4a30",
  2020. "byterev, hiragana, full width (cchDest = 0)",
  2021. &NumErrors );
  2022. // Variation 10 - byterev, katakana, full width
  2023. rc = LCMapStringW( Locale,
  2024. LCMAP_BYTEREV | LCMAP_KATAKANA | LCMAP_FULLWIDTH,
  2025. L"\x3041Th\x304a",
  2026. 4,
  2027. MapDest,
  2028. 0 );
  2029. CheckReturnValidW( rc,
  2030. 4,
  2031. NULL,
  2032. L"\xa130\x34ff\x48ff\xaa30",
  2033. "byterev, katakana, full width (cchDest = 0)",
  2034. &NumErrors );
  2035. // Variation 11 - uppercase, katakana
  2036. rc = LCMapStringW( Locale,
  2037. LCMAP_UPPERCASE | LCMAP_KATAKANA,
  2038. MapSrc1,
  2039. -1,
  2040. MapDest,
  2041. 0 );
  2042. CheckReturnValidW( rc,
  2043. -1,
  2044. MapDest,
  2045. MapUpper,
  2046. "uppercase, katakana (cchDest = 0)",
  2047. &NumErrors );
  2048. // Variation 12 - uppercase, half width
  2049. rc = LCMapStringW( Locale,
  2050. LCMAP_UPPERCASE | LCMAP_HALFWIDTH,
  2051. MapSrc1,
  2052. -1,
  2053. MapDest,
  2054. 0 );
  2055. CheckReturnValidW( rc,
  2056. -1,
  2057. MapDest,
  2058. MapUpper,
  2059. "uppercase, half width (cchDest = 0)",
  2060. &NumErrors );
  2061. //
  2062. // Kana and Width - precomposed forms.
  2063. //
  2064. // Variation 1 - half width
  2065. rc = LCMapStringW( Locale,
  2066. LCMAP_HALFWIDTH,
  2067. L"\x30d0\x30d1",
  2068. 2,
  2069. MapDest,
  2070. BUFSIZE );
  2071. CheckReturnValidW( rc,
  2072. 4,
  2073. MapDest,
  2074. L"\xff8a\xff9e\xff8a\xff9f",
  2075. "half precomp",
  2076. &NumErrors );
  2077. // Variation 2 - half width, hiragana
  2078. rc = LCMapStringW( Locale,
  2079. LCMAP_HALFWIDTH | LCMAP_HIRAGANA,
  2080. L"\x30d0\x30d1",
  2081. 2,
  2082. MapDest,
  2083. BUFSIZE );
  2084. CheckReturnValidW( rc,
  2085. 2,
  2086. MapDest,
  2087. L"\x3070\x3071",
  2088. "half, hiragana precomp",
  2089. &NumErrors );
  2090. // Variation 3 - half width, katakana
  2091. rc = LCMapStringW( Locale,
  2092. LCMAP_HALFWIDTH | LCMAP_KATAKANA,
  2093. L"\x30d0\x30d1",
  2094. 2,
  2095. MapDest,
  2096. BUFSIZE );
  2097. CheckReturnValidW( rc,
  2098. 4,
  2099. MapDest,
  2100. L"\xff8a\xff9e\xff8a\xff9f",
  2101. "half, katakana precomp",
  2102. &NumErrors );
  2103. // Variation 4 - case, half width, katakana
  2104. rc = LCMapStringW( Locale,
  2105. LCMAP_HALFWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2106. L"\xff2a\x30d0\xff2a\x30d1J",
  2107. 5,
  2108. MapDest,
  2109. BUFSIZE );
  2110. CheckReturnValidW( rc,
  2111. 7,
  2112. MapDest,
  2113. L"j\xff8a\xff9ej\xff8a\xff9fj",
  2114. "case, half, katakana precomp",
  2115. &NumErrors );
  2116. // Variation 5 - full width
  2117. rc = LCMapStringW( Locale,
  2118. LCMAP_FULLWIDTH,
  2119. L"\x30d0\x30d1",
  2120. 2,
  2121. MapDest,
  2122. BUFSIZE );
  2123. CheckReturnValidW( rc,
  2124. 2,
  2125. MapDest,
  2126. L"\x30d0\x30d1",
  2127. "full precomp",
  2128. &NumErrors );
  2129. // Variation 6 - full width, hiragana
  2130. rc = LCMapStringW( Locale,
  2131. LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  2132. L"\x30d0\x30d1",
  2133. 2,
  2134. MapDest,
  2135. BUFSIZE );
  2136. CheckReturnValidW( rc,
  2137. 2,
  2138. MapDest,
  2139. L"\x3070\x3071",
  2140. "full, hiragana precomp",
  2141. &NumErrors );
  2142. // Variation 7 - full width, katakana
  2143. rc = LCMapStringW( Locale,
  2144. LCMAP_FULLWIDTH | LCMAP_KATAKANA,
  2145. L"\x30d0\x30d1",
  2146. 2,
  2147. MapDest,
  2148. BUFSIZE );
  2149. CheckReturnValidW( rc,
  2150. 2,
  2151. MapDest,
  2152. L"\x30d0\x30d1",
  2153. "full, katakana precomp",
  2154. &NumErrors );
  2155. //
  2156. // Kana and Width - precomposed forms.
  2157. // cchDest = 0
  2158. //
  2159. // Variation 1 - half width
  2160. rc = LCMapStringW( Locale,
  2161. LCMAP_HALFWIDTH,
  2162. L"\x30d0\x30d1",
  2163. 2,
  2164. MapDest,
  2165. 0 );
  2166. CheckReturnValidW( rc,
  2167. 4,
  2168. NULL,
  2169. L"\xff8a\xff9e\xff8a\xff9f",
  2170. "half precomp (cchDest = 0)",
  2171. &NumErrors );
  2172. // Variation 2 - half width, hiragana
  2173. rc = LCMapStringW( Locale,
  2174. LCMAP_HALFWIDTH | LCMAP_HIRAGANA,
  2175. L"\x30d0\x30d1",
  2176. 2,
  2177. MapDest,
  2178. 0 );
  2179. CheckReturnValidW( rc,
  2180. 2,
  2181. NULL,
  2182. L"\x3070\x3071",
  2183. "half, hiragana precomp (cchDest = 0)",
  2184. &NumErrors );
  2185. // Variation 3 - half width, katakana
  2186. rc = LCMapStringW( Locale,
  2187. LCMAP_HALFWIDTH | LCMAP_KATAKANA,
  2188. L"\x30d0\x30d1",
  2189. 2,
  2190. MapDest,
  2191. 0 );
  2192. CheckReturnValidW( rc,
  2193. 4,
  2194. NULL,
  2195. L"\xff8a\xff9e\xff8a\xff9f",
  2196. "half, katakana precomp (cchDest = 0)",
  2197. &NumErrors );
  2198. // Variation 4 - case, half width, katakana
  2199. rc = LCMapStringW( Locale,
  2200. LCMAP_HALFWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2201. L"\xff2a\x30d0\xff2a\x30d1J",
  2202. 5,
  2203. MapDest,
  2204. 0 );
  2205. CheckReturnValidW( rc,
  2206. 7,
  2207. NULL,
  2208. L"j\xff8a\xff9ej\xff8a\xff9fj",
  2209. "case, half, katakana precomp (cchDest = 0)",
  2210. &NumErrors );
  2211. // Variation 5 - full width
  2212. rc = LCMapStringW( Locale,
  2213. LCMAP_FULLWIDTH,
  2214. L"\x30d0\x30d1",
  2215. 2,
  2216. MapDest,
  2217. 0 );
  2218. CheckReturnValidW( rc,
  2219. 2,
  2220. NULL,
  2221. L"\x30d0\x30d1",
  2222. "full precomp",
  2223. &NumErrors );
  2224. // Variation 6 - full width, hiragana
  2225. rc = LCMapStringW( Locale,
  2226. LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  2227. L"\x30d0\x30d1",
  2228. 2,
  2229. MapDest,
  2230. 0 );
  2231. CheckReturnValidW( rc,
  2232. 2,
  2233. NULL,
  2234. L"\x3070\x3071",
  2235. "full, hiragana precomp (cchDest = 0)",
  2236. &NumErrors );
  2237. // Variation 7 - full width, katakana
  2238. rc = LCMapStringW( Locale,
  2239. LCMAP_FULLWIDTH | LCMAP_KATAKANA,
  2240. L"\x30d0\x30d1",
  2241. 2,
  2242. MapDest,
  2243. 0 );
  2244. CheckReturnValidW( rc,
  2245. 2,
  2246. NULL,
  2247. L"\x30d0\x30d1",
  2248. "full, katakana precomp (cchDest = 0)",
  2249. &NumErrors );
  2250. //
  2251. // Kana and Width - composite forms.
  2252. //
  2253. // Variation 1 - half width
  2254. rc = LCMapStringW( Locale,
  2255. LCMAP_HALFWIDTH,
  2256. L"\x30cf\x309b\x30cf\x309c",
  2257. 4,
  2258. MapDest,
  2259. BUFSIZE );
  2260. CheckReturnValidW( rc,
  2261. 4,
  2262. MapDest,
  2263. L"\xff8a\xff9e\xff8a\xff9f",
  2264. "half comp",
  2265. &NumErrors );
  2266. // Variation 2 - half width, hiragana
  2267. rc = LCMapStringW( Locale,
  2268. LCMAP_HALFWIDTH | LCMAP_HIRAGANA,
  2269. L"\x30cf\x309b\x30cf\x309c",
  2270. 4,
  2271. MapDest,
  2272. BUFSIZE );
  2273. CheckReturnValidW( rc,
  2274. 4,
  2275. MapDest,
  2276. L"\x306f\xff9e\x306f\xff9f",
  2277. "half, hiragana comp",
  2278. &NumErrors );
  2279. // Variation 3 - half width, katakana
  2280. rc = LCMapStringW( Locale,
  2281. LCMAP_HALFWIDTH | LCMAP_KATAKANA,
  2282. L"\x30cf\x309b\x30cf\x309c",
  2283. 4,
  2284. MapDest,
  2285. BUFSIZE );
  2286. CheckReturnValidW( rc,
  2287. 4,
  2288. MapDest,
  2289. L"\xff8a\xff9e\xff8a\xff9f",
  2290. "half, katakana comp",
  2291. &NumErrors );
  2292. // Variation 4 - case, half width, katakana
  2293. rc = LCMapStringW( Locale,
  2294. LCMAP_HALFWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2295. L"\xff2a\x30cf\x309b\xff2a\x30cf\x309cJ",
  2296. 7,
  2297. MapDest,
  2298. BUFSIZE );
  2299. CheckReturnValidW( rc,
  2300. 7,
  2301. MapDest,
  2302. L"j\xff8a\xff9ej\xff8a\xff9fj",
  2303. "case, half, katakana comp",
  2304. &NumErrors );
  2305. // Variation 5 - full width
  2306. rc = LCMapStringW( Locale,
  2307. LCMAP_FULLWIDTH,
  2308. L"\x30cf\x309b\x30cf\x309c",
  2309. 4,
  2310. MapDest,
  2311. BUFSIZE );
  2312. CheckReturnValidW( rc,
  2313. 2,
  2314. MapDest,
  2315. L"\x30d0\x30d1",
  2316. "full comp",
  2317. &NumErrors );
  2318. // Variation 6 - full width, hiragana
  2319. rc = LCMapStringW( Locale,
  2320. LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  2321. L"\x30cf\x309b\x30cf\x309c",
  2322. 4,
  2323. MapDest,
  2324. BUFSIZE );
  2325. CheckReturnValidW( rc,
  2326. 2,
  2327. MapDest,
  2328. L"\x3070\x3071",
  2329. "full, hiragana comp",
  2330. &NumErrors );
  2331. // Variation 7 - full width, katakana
  2332. rc = LCMapStringW( Locale,
  2333. LCMAP_FULLWIDTH | LCMAP_KATAKANA,
  2334. L"\x30cf\x309b\x30cf\x309c",
  2335. 4,
  2336. MapDest,
  2337. BUFSIZE );
  2338. CheckReturnValidW( rc,
  2339. 2,
  2340. MapDest,
  2341. L"\x30d0\x30d1",
  2342. "full, katakana comp",
  2343. &NumErrors );
  2344. // Variation 8 - case, full width, katakana
  2345. rc = LCMapStringW( Locale,
  2346. LCMAP_FULLWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2347. L"\xff2a\x30cf\x309bJ\x30cf\x309cJ",
  2348. 7,
  2349. MapDest,
  2350. BUFSIZE );
  2351. CheckReturnValidW( rc,
  2352. 5,
  2353. MapDest,
  2354. L"\xff4a\x30d0\xff4a\x30d1\xff4a",
  2355. "case, full, katakana comp",
  2356. &NumErrors );
  2357. //
  2358. // Kana and Width - composite forms.
  2359. // cchDest == 0
  2360. //
  2361. // Variation 1 - half width
  2362. rc = LCMapStringW( Locale,
  2363. LCMAP_HALFWIDTH,
  2364. L"\x30cf\x309b\x30cf\x309c",
  2365. 4,
  2366. MapDest,
  2367. 0 );
  2368. CheckReturnValidW( rc,
  2369. 4,
  2370. NULL,
  2371. L"\xff8a\xff9e\xff8a\xff9f",
  2372. "half comp (cchDest = 0)",
  2373. &NumErrors );
  2374. // Variation 2 - half width, hiragana
  2375. rc = LCMapStringW( Locale,
  2376. LCMAP_HALFWIDTH | LCMAP_HIRAGANA,
  2377. L"\x30cf\x309b\x30cf\x309c",
  2378. 4,
  2379. MapDest,
  2380. 0 );
  2381. CheckReturnValidW( rc,
  2382. 4,
  2383. NULL,
  2384. L"\x306f\xff9e\x306f\xff9f",
  2385. "half, hiragana comp (cchDest = 0)",
  2386. &NumErrors );
  2387. // Variation 3 - half width, katakana
  2388. rc = LCMapStringW( Locale,
  2389. LCMAP_HALFWIDTH | LCMAP_KATAKANA,
  2390. L"\x30cf\x309b\x30cf\x309c",
  2391. 4,
  2392. MapDest,
  2393. 0 );
  2394. CheckReturnValidW( rc,
  2395. 4,
  2396. NULL,
  2397. L"\xff8a\xff9e\xff8a\xff9f",
  2398. "half, katakana comp (cchDest = 0)",
  2399. &NumErrors );
  2400. // Variation 4 - case, half width, katakana
  2401. rc = LCMapStringW( Locale,
  2402. LCMAP_HALFWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2403. L"\xff2a\x30cf\x309b\xff2a\x30cf\x309cJ",
  2404. 7,
  2405. MapDest,
  2406. 0 );
  2407. CheckReturnValidW( rc,
  2408. 7,
  2409. NULL,
  2410. L"j\xff8a\xff9ej\xff8a\xff9fj",
  2411. "case, half, katakana comp (cchDest = 0)",
  2412. &NumErrors );
  2413. // Variation 5 - full width
  2414. rc = LCMapStringW( Locale,
  2415. LCMAP_FULLWIDTH,
  2416. L"\x30cf\x309b\x30cf\x309c",
  2417. 4,
  2418. MapDest,
  2419. 0 );
  2420. CheckReturnValidW( rc,
  2421. 2,
  2422. NULL,
  2423. L"\x30d0\x30d1",
  2424. "full comp (cchDest = 0)",
  2425. &NumErrors );
  2426. // Variation 6 - full width, hiragana
  2427. rc = LCMapStringW( Locale,
  2428. LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  2429. L"\x30cf\x309b\x30cf\x309c",
  2430. 4,
  2431. MapDest,
  2432. 0 );
  2433. CheckReturnValidW( rc,
  2434. 2,
  2435. NULL,
  2436. L"\x3070\x3071",
  2437. "full, hiragana comp (cchDest = 0)",
  2438. &NumErrors );
  2439. // Variation 7 - full width, katakana
  2440. rc = LCMapStringW( Locale,
  2441. LCMAP_FULLWIDTH | LCMAP_KATAKANA,
  2442. L"\x30cf\x309b\x30cf\x309c",
  2443. 4,
  2444. MapDest,
  2445. 0 );
  2446. CheckReturnValidW( rc,
  2447. 2,
  2448. NULL,
  2449. L"\x30d0\x30d1",
  2450. "full, katakana comp (cchDest = 0)",
  2451. &NumErrors );
  2452. // Variation 8 - case, full width, katakana
  2453. rc = LCMapStringW( Locale,
  2454. LCMAP_FULLWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2455. L"\xff2a\x30cf\x309bJ\x30cf\x309cJ",
  2456. 7,
  2457. MapDest,
  2458. 0 );
  2459. CheckReturnValidW( rc,
  2460. 5,
  2461. NULL,
  2462. L"\xff4a\x30d0\xff4a\x30d1\xff4a",
  2463. "case, full, katakana comp (cchDest = 0)",
  2464. &NumErrors );
  2465. //
  2466. // Kana and Width - half width composite forms.
  2467. //
  2468. // Variation 1 - half width
  2469. rc = LCMapStringW( Locale,
  2470. LCMAP_HALFWIDTH,
  2471. L"\xff8a\xff9e\xff8a\xff9f",
  2472. 4,
  2473. MapDest,
  2474. BUFSIZE );
  2475. CheckReturnValidW( rc,
  2476. 4,
  2477. MapDest,
  2478. L"\xff8a\xff9e\xff8a\xff9f",
  2479. "half comp (half)",
  2480. &NumErrors );
  2481. // Variation 2 - half width, hiragana
  2482. rc = LCMapStringW( Locale,
  2483. LCMAP_HALFWIDTH | LCMAP_HIRAGANA,
  2484. L"\xff8a\xff9e\xff8a\xff9f",
  2485. 4,
  2486. MapDest,
  2487. BUFSIZE );
  2488. CheckReturnValidW( rc,
  2489. 4,
  2490. MapDest,
  2491. L"\xff8a\xff9e\xff8a\xff9f",
  2492. "half, hiragana comp (half)",
  2493. &NumErrors );
  2494. // Variation 3 - half width, katakana
  2495. rc = LCMapStringW( Locale,
  2496. LCMAP_HALFWIDTH | LCMAP_KATAKANA,
  2497. L"\xff8a\xff9e\xff8a\xff9f",
  2498. 4,
  2499. MapDest,
  2500. BUFSIZE );
  2501. CheckReturnValidW( rc,
  2502. 4,
  2503. MapDest,
  2504. L"\xff8a\xff9e\xff8a\xff9f",
  2505. "half, katakana comp (half)",
  2506. &NumErrors );
  2507. // Variation 4 - full width
  2508. rc = LCMapStringW( Locale,
  2509. LCMAP_FULLWIDTH,
  2510. L"\xff8a\xff9e\xff8a\xff9f",
  2511. 4,
  2512. MapDest,
  2513. BUFSIZE );
  2514. CheckReturnValidW( rc,
  2515. 2,
  2516. MapDest,
  2517. L"\x30d0\x30d1",
  2518. "full comp (half)",
  2519. &NumErrors );
  2520. // Variation 5 - full width, hiragana
  2521. rc = LCMapStringW( Locale,
  2522. LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  2523. L"\xff8a\xff9e\xff8a\xff9f",
  2524. 4,
  2525. MapDest,
  2526. BUFSIZE );
  2527. CheckReturnValidW( rc,
  2528. 2,
  2529. MapDest,
  2530. L"\x3070\x3071",
  2531. "full, hiragana comp (half)",
  2532. &NumErrors );
  2533. // Variation 6 - full width, katakana
  2534. rc = LCMapStringW( Locale,
  2535. LCMAP_FULLWIDTH | LCMAP_KATAKANA,
  2536. L"\xff8a\xff9e\xff8a\xff9f",
  2537. 4,
  2538. MapDest,
  2539. BUFSIZE );
  2540. CheckReturnValidW( rc,
  2541. 2,
  2542. MapDest,
  2543. L"\x30d0\x30d1",
  2544. "full, katakana comp (half)",
  2545. &NumErrors );
  2546. // Variation 7 - case, full width, katakana
  2547. rc = LCMapStringW( Locale,
  2548. LCMAP_FULLWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2549. L"\xff2a\xff8a\xff9eJ\xff8a\xff9fJ",
  2550. 7,
  2551. MapDest,
  2552. BUFSIZE );
  2553. CheckReturnValidW( rc,
  2554. 5,
  2555. MapDest,
  2556. L"\xff4a\x30d0\xff4a\x30d1\xff4a",
  2557. "case, full, katakana comp (half)",
  2558. &NumErrors );
  2559. //
  2560. // Kana and Width - half width composite forms.
  2561. // cchDest == 0
  2562. //
  2563. // Variation 1 - half width
  2564. rc = LCMapStringW( Locale,
  2565. LCMAP_HALFWIDTH,
  2566. L"\xff8a\xff9e\xff8a\xff9f",
  2567. 4,
  2568. MapDest,
  2569. 0 );
  2570. CheckReturnValidW( rc,
  2571. 4,
  2572. NULL,
  2573. L"\xff8a\xff9e\xff8a\xff9f",
  2574. "half comp (half) (cchDest = 0)",
  2575. &NumErrors );
  2576. // Variation 2 - half width, hiragana
  2577. rc = LCMapStringW( Locale,
  2578. LCMAP_HALFWIDTH | LCMAP_HIRAGANA,
  2579. L"\xff8a\xff9e\xff8a\xff9f",
  2580. 4,
  2581. MapDest,
  2582. 0 );
  2583. CheckReturnValidW( rc,
  2584. 4,
  2585. NULL,
  2586. L"\xff8a\xff9e\xff8a\xff9f",
  2587. "half, hiragana comp (half) (cchDest = 0)",
  2588. &NumErrors );
  2589. // Variation 3 - half width, katakana
  2590. rc = LCMapStringW( Locale,
  2591. LCMAP_HALFWIDTH | LCMAP_KATAKANA,
  2592. L"\xff8a\xff9e\xff8a\xff9f",
  2593. 4,
  2594. MapDest,
  2595. 0 );
  2596. CheckReturnValidW( rc,
  2597. 4,
  2598. NULL,
  2599. L"\xff8a\xff9e\xff8a\xff9f",
  2600. "half, katakana comp (half) (cchDest = 0)",
  2601. &NumErrors );
  2602. // Variation 4 - full width
  2603. rc = LCMapStringW( Locale,
  2604. LCMAP_FULLWIDTH,
  2605. L"\xff8a\xff9e\xff8a\xff9f",
  2606. 4,
  2607. MapDest,
  2608. 0 );
  2609. CheckReturnValidW( rc,
  2610. 2,
  2611. NULL,
  2612. L"\x30d0\x30d1",
  2613. "full comp (half) (cchDest = 0)",
  2614. &NumErrors );
  2615. // Variation 5 - full width, hiragana
  2616. rc = LCMapStringW( Locale,
  2617. LCMAP_FULLWIDTH | LCMAP_HIRAGANA,
  2618. L"\xff8a\xff9e\xff8a\xff9f",
  2619. 4,
  2620. MapDest,
  2621. 0 );
  2622. CheckReturnValidW( rc,
  2623. 2,
  2624. NULL,
  2625. L"\x3070\x3071",
  2626. "full, hiragana comp (half) (cchDest = 0)",
  2627. &NumErrors );
  2628. // Variation 6 - full width, katakana
  2629. rc = LCMapStringW( Locale,
  2630. LCMAP_FULLWIDTH | LCMAP_KATAKANA,
  2631. L"\xff8a\xff9e\xff8a\xff9f",
  2632. 4,
  2633. MapDest,
  2634. 0 );
  2635. CheckReturnValidW( rc,
  2636. 2,
  2637. NULL,
  2638. L"\x30d0\x30d1",
  2639. "full, katakana comp (half) (cchDest = 0)",
  2640. &NumErrors );
  2641. // Variation 7 - case, full width, katakana
  2642. rc = LCMapStringW( Locale,
  2643. LCMAP_FULLWIDTH | LCMAP_KATAKANA | LCMAP_LOWERCASE,
  2644. L"\xff2a\xff8a\xff9eJ\xff8a\xff9fJ",
  2645. 7,
  2646. MapDest,
  2647. 0 );
  2648. CheckReturnValidW( rc,
  2649. 5,
  2650. NULL,
  2651. L"\xff4a\x30d0\xff4a\x30d1\xff4a",
  2652. "case, full, katakana comp (half) (cchDest = 0)",
  2653. &NumErrors );
  2654. //
  2655. // LCMAP_TRADITIONAL_CHINESE Flag.
  2656. //
  2657. // Variation 1 - map simplified to traditional
  2658. rc = LCMapStringW( Locale,
  2659. LCMAP_TRADITIONAL_CHINESE,
  2660. L"\x4e07\x4e0e\x9f95\x9f9f",
  2661. -1,
  2662. MapDest,
  2663. BUFSIZE );
  2664. CheckReturnValidW( rc,
  2665. -1,
  2666. MapDest,
  2667. L"\x842c\x8207\x9f95\x9f9c",
  2668. "traditional",
  2669. &NumErrors );
  2670. // Variation 2 - map simplified to traditional
  2671. rc = LCMapStringW( Locale,
  2672. LCMAP_TRADITIONAL_CHINESE | LCMAP_LOWERCASE,
  2673. L"\x4e07\x4e0e\x9f95\x9f9f",
  2674. -1,
  2675. MapDest,
  2676. BUFSIZE );
  2677. CheckReturnValidW( rc,
  2678. -1,
  2679. MapDest,
  2680. L"\x842c\x8207\x9f95\x9f9c",
  2681. "traditional, lowercase",
  2682. &NumErrors );
  2683. // Variation 3 - map simplified to traditional
  2684. rc = LCMapStringW( Locale,
  2685. LCMAP_TRADITIONAL_CHINESE | LCMAP_LOWERCASE,
  2686. L"YYz\x4e07\x4e0e\x9f95\x9f9fYzY",
  2687. -1,
  2688. MapDest,
  2689. BUFSIZE );
  2690. CheckReturnValidW( rc,
  2691. -1,
  2692. MapDest,
  2693. L"yyz\x842c\x8207\x9f95\x9f9cyzy",
  2694. "traditional, lowercase 2",
  2695. &NumErrors );
  2696. // Variation 4 - map simplified to traditional
  2697. rc = LCMapStringW( Locale,
  2698. LCMAP_TRADITIONAL_CHINESE | LCMAP_UPPERCASE,
  2699. L"\x4e07\x4e0e\x9f95\x9f9f",
  2700. -1,
  2701. MapDest,
  2702. BUFSIZE );
  2703. CheckReturnValidW( rc,
  2704. -1,
  2705. MapDest,
  2706. L"\x842c\x8207\x9f95\x9f9c",
  2707. "traditional, uppercase",
  2708. &NumErrors );
  2709. // Variation 5 - map simplified to traditional
  2710. rc = LCMapStringW( Locale,
  2711. LCMAP_TRADITIONAL_CHINESE | LCMAP_UPPERCASE,
  2712. L"Yyz\x4e07\x4e0e\x9f95\x9f9fyzY",
  2713. -1,
  2714. MapDest,
  2715. BUFSIZE );
  2716. CheckReturnValidW( rc,
  2717. -1,
  2718. MapDest,
  2719. L"YYZ\x842c\x8207\x9f95\x9f9cYZY",
  2720. "traditional, uppercase 2",
  2721. &NumErrors );
  2722. //
  2723. // LCMAP_SIMPLIFIED_CHINESE Flag.
  2724. //
  2725. // Variation 1 - map traditional to simplified
  2726. rc = LCMapStringW( Locale,
  2727. LCMAP_SIMPLIFIED_CHINESE,
  2728. L"\x4e1f\xfa26\x9038",
  2729. -1,
  2730. MapDest,
  2731. BUFSIZE );
  2732. CheckReturnValidW( rc,
  2733. -1,
  2734. MapDest,
  2735. L"\x4e22\x90fd\x9038",
  2736. "simplified",
  2737. &NumErrors );
  2738. // Variation 2 - map traditional to simplified
  2739. rc = LCMapStringW( Locale,
  2740. LCMAP_SIMPLIFIED_CHINESE | LCMAP_LOWERCASE,
  2741. L"\x4e1f\xfa26\x9038",
  2742. -1,
  2743. MapDest,
  2744. BUFSIZE );
  2745. CheckReturnValidW( rc,
  2746. -1,
  2747. MapDest,
  2748. L"\x4e22\x90fd\x9038",
  2749. "simplified, lowercase",
  2750. &NumErrors );
  2751. // Variation 3 - map traditional to simplified
  2752. rc = LCMapStringW( Locale,
  2753. LCMAP_SIMPLIFIED_CHINESE | LCMAP_LOWERCASE,
  2754. L"YYz\x4e1f\xfa26\x9038YzY",
  2755. -1,
  2756. MapDest,
  2757. BUFSIZE );
  2758. CheckReturnValidW( rc,
  2759. -1,
  2760. MapDest,
  2761. L"yyz\x4e22\x90fd\x9038yzy",
  2762. "simplified, lowercase 2",
  2763. &NumErrors );
  2764. // Variation 4 - map traditional to simplified
  2765. rc = LCMapStringW( Locale,
  2766. LCMAP_SIMPLIFIED_CHINESE | LCMAP_UPPERCASE,
  2767. L"\x4e1f\xfa26\x9038",
  2768. -1,
  2769. MapDest,
  2770. BUFSIZE );
  2771. CheckReturnValidW( rc,
  2772. -1,
  2773. MapDest,
  2774. L"\x4e22\x90fd\x9038",
  2775. "simplified, uppercase",
  2776. &NumErrors );
  2777. // Variation 5 - map traditional to simplified
  2778. rc = LCMapStringW( Locale,
  2779. LCMAP_SIMPLIFIED_CHINESE | LCMAP_UPPERCASE,
  2780. L"Yyz\x4e1f\xfa26\x9038yzY",
  2781. -1,
  2782. MapDest,
  2783. BUFSIZE );
  2784. CheckReturnValidW( rc,
  2785. -1,
  2786. MapDest,
  2787. L"YYZ\x4e22\x90fd\x9038YZY",
  2788. "simplified, uppercase 2",
  2789. &NumErrors );
  2790. //
  2791. // Japanese sortkey tests - CHO-ON.
  2792. //
  2793. // Variation 1 - cho-on
  2794. rc = LCMapStringW( 0x0409,
  2795. LCMAP_SORTKEY,
  2796. L"\x30f6\x30fc",
  2797. 2,
  2798. (LPWSTR)SortDest,
  2799. BUFSIZE );
  2800. CheckReturnValidSortKey( rc,
  2801. -1,
  2802. SortDest,
  2803. "\x22\x0d\x22\x05\x01\x01\x01\xc4\xc4\xff\x03\x05\x02\xc4\xc4\xff\xff\x01",
  2804. "cho-on",
  2805. &NumErrors );
  2806. // Variation 2 - cho-on first char
  2807. rc = LCMapStringW( 0x0409,
  2808. LCMAP_SORTKEY,
  2809. L"\x30fc\x30f6\x30fc",
  2810. 3,
  2811. (LPWSTR)SortDest,
  2812. BUFSIZE );
  2813. CheckReturnValidSortKey( rc,
  2814. -1,
  2815. SortDest,
  2816. "\xff\xff\x22\x0d\x22\x05\x01\x01\x01\xc4\xc4\xff\x03\x05\x02\xc4\xc4\xff\xff\x01",
  2817. "cho-on first char",
  2818. &NumErrors );
  2819. // Variation 3 - cho-on first and second char
  2820. rc = LCMapStringW( 0x0409,
  2821. LCMAP_SORTKEY,
  2822. L"\x30fc\x30fc\x30f6\x30fc",
  2823. 4,
  2824. (LPWSTR)SortDest,
  2825. BUFSIZE );
  2826. CheckReturnValidSortKey( rc,
  2827. -1,
  2828. SortDest,
  2829. "\xff\xff\xff\xff\x22\x0d\x22\x05\x01\x01\x01\xc4\xc4\xff\x03\x05\x02\xc4\xc4\xff\xff\x01",
  2830. "cho-on first and second char",
  2831. &NumErrors );
  2832. // Variation 4 - cho-on with ignore nonspace flag
  2833. rc = LCMapStringW( 0x0411,
  2834. LCMAP_SORTKEY | NORM_IGNORENONSPACE,
  2835. L"\xff76\xff9e\xff70",
  2836. -1,
  2837. (LPWSTR)SortDest,
  2838. BUFSIZE );
  2839. CheckReturnValidSortKey( rc,
  2840. -1,
  2841. SortDest,
  2842. "\x22\x0a\x22\x02\x01\x01\x01\xff\x02\xc4\xc4\xff\xc4\xc4\xff\x01",
  2843. "cho-on with ignore nonspace flag",
  2844. &NumErrors );
  2845. // Variation 5 - cho-on without ignore nonspace flag
  2846. rc = LCMapStringW( 0x0411,
  2847. LCMAP_SORTKEY,
  2848. L"\xff76\xff9e\xff70",
  2849. -1,
  2850. (LPWSTR)SortDest,
  2851. BUFSIZE );
  2852. CheckReturnValidSortKey( rc,
  2853. -1,
  2854. SortDest,
  2855. "\x22\x0a\x22\x02\x01\x03\x01\x01\xff\x03\x05\x02\xc4\xc4\xff\xc4\xc4\xff\x01",
  2856. "cho-on without ignore nonspace flag",
  2857. &NumErrors );
  2858. // Variation 6 - cho-on with ignore nonspace flag
  2859. rc = LCMapStringW( 0x0411,
  2860. LCMAP_SORTKEY | NORM_IGNORENONSPACE,
  2861. L"\xff76\xff9e\xff71",
  2862. -1,
  2863. (LPWSTR)SortDest,
  2864. BUFSIZE );
  2865. CheckReturnValidSortKey( rc,
  2866. -1,
  2867. SortDest,
  2868. "\x22\x0a\x22\x02\x01\x01\x01\xff\x02\xc4\xc4\xff\xc4\xc4\xff\x01",
  2869. "cho-on with ignore nonspace flag 2",
  2870. &NumErrors );
  2871. // Variation 7 - cho-on without ignore nonspace flag
  2872. rc = LCMapStringW( 0x0411,
  2873. LCMAP_SORTKEY,
  2874. L"\xff76\xff9e\xff71",
  2875. -1,
  2876. (LPWSTR)SortDest,
  2877. BUFSIZE );
  2878. CheckReturnValidSortKey( rc,
  2879. -1,
  2880. SortDest,
  2881. "\x22\x0a\x22\x02\x01\x03\x01\x01\xff\x02\xc4\xc4\xff\xc4\xc4\xff\x01",
  2882. "cho-on without ignore nonspace flag 2",
  2883. &NumErrors );
  2884. //
  2885. // Japanese sortkey tests - REPEAT.
  2886. //
  2887. // Variation 1 - repeat
  2888. rc = LCMapStringW( 0x0409,
  2889. LCMAP_SORTKEY,
  2890. L"\x30f6\x30fd",
  2891. 2,
  2892. (LPWSTR)SortDest,
  2893. BUFSIZE );
  2894. CheckReturnValidSortKey( rc,
  2895. -1,
  2896. SortDest,
  2897. "\x22\x0d\x22\x0d\x01\x01\x01\xc4\xc4\xff\x03\x04\x02\xc4\xc4\xff\xff\x01",
  2898. "repeat",
  2899. &NumErrors );
  2900. rc = LCMapStringW( 0x0409,
  2901. LCMAP_SORTKEY,
  2902. L"\x30f6\x30f6",
  2903. 2,
  2904. (LPWSTR)SortDest,
  2905. BUFSIZE );
  2906. CheckReturnValidSortKey( rc,
  2907. -1,
  2908. SortDest,
  2909. "\x22\x0d\x22\x0d\x01\x01\x01\xc4\xc4\xff\x02\xc4\xc4\xff\xff\x01",
  2910. "repeat (actual)",
  2911. &NumErrors );
  2912. // Variation 2 - repeat first char
  2913. rc = LCMapStringW( 0x0409,
  2914. LCMAP_SORTKEY,
  2915. L"\x30fd\x30f6\x30fd",
  2916. 3,
  2917. (LPWSTR)SortDest,
  2918. BUFSIZE );
  2919. CheckReturnValidSortKey( rc,
  2920. -1,
  2921. SortDest,
  2922. "\xff\xff\x22\x0d\x22\x0d\x01\x01\x01\xc4\xc4\xff\x03\x04\x02\xc4\xc4\xff\xff\x01",
  2923. "repeat first char",
  2924. &NumErrors );
  2925. // Variation 3 - repeat first and second char
  2926. rc = LCMapStringW( 0x0409,
  2927. LCMAP_SORTKEY,
  2928. L"\x30fd\x30fd\x30f6\x30fd",
  2929. 4,
  2930. (LPWSTR)SortDest,
  2931. BUFSIZE );
  2932. CheckReturnValidSortKey( rc,
  2933. -1,
  2934. SortDest,
  2935. "\xff\xff\xff\xff\x22\x0d\x22\x0d\x01\x01\x01\xc4\xc4\xff\x03\x04\x02\xc4\xc4\xff\xff\x01",
  2936. "repeat first and second char",
  2937. &NumErrors );
  2938. // Variation 4 - repeat (0x30fb)
  2939. rc = LCMapStringW( 0x0409,
  2940. LCMAP_SORTKEY,
  2941. L"\x30fb\x30fd",
  2942. 2,
  2943. (LPWSTR)SortDest,
  2944. BUFSIZE );
  2945. CheckReturnValidSortKey( rc,
  2946. -1,
  2947. SortDest,
  2948. "\x0a\x0e\x0a\x0e\x01\x01\x03\x01\x01",
  2949. "repeat (0x30fb)",
  2950. &NumErrors );
  2951. // Variation 5 - repeat alone
  2952. rc = LCMapStringW( 0x0409,
  2953. LCMAP_SORTKEY,
  2954. L"\x3094\x309d",
  2955. 2,
  2956. (LPWSTR)SortDest,
  2957. BUFSIZE );
  2958. CheckReturnValidSortKey( rc,
  2959. -1,
  2960. SortDest,
  2961. "\x22\x04\x22\x04\x01\x03\x01\x01\xff\x03\x04\x02\xff\xff\x01",
  2962. "repeat alone",
  2963. &NumErrors );
  2964. // Variation 6 - repeat, ignore kana
  2965. rc = LCMapStringW( 0x0409,
  2966. LCMAP_SORTKEY | NORM_IGNOREKANATYPE,
  2967. L"\x3094\x309d",
  2968. 2,
  2969. (LPWSTR)SortDest,
  2970. BUFSIZE );
  2971. CheckReturnValidSortKey( rc,
  2972. -1,
  2973. SortDest,
  2974. "\x22\x04\x22\x04\x01\x03\x01\x01\xff\x03\x04\x02\xc4\xc4\xff\xff\x01",
  2975. "repeat, ignore kana",
  2976. &NumErrors );
  2977. // Variation 7 - repeat, ignore width
  2978. rc = LCMapStringW( 0x0409,
  2979. LCMAP_SORTKEY | NORM_IGNOREWIDTH,
  2980. L"\x3094\x309d",
  2981. 2,
  2982. (LPWSTR)SortDest,
  2983. BUFSIZE );
  2984. CheckReturnValidSortKey( rc,
  2985. -1,
  2986. SortDest,
  2987. "\x22\x04\x22\x04\x01\x03\x01\x01\xff\x03\x04\x02\xff\xc4\xc4\xff\x01",
  2988. "repeat, ignore width",
  2989. &NumErrors );
  2990. // Variation 8 - repeat, ignore kana and width
  2991. rc = LCMapStringW( 0x0409,
  2992. LCMAP_SORTKEY | NORM_IGNOREKANATYPE | NORM_IGNOREWIDTH,
  2993. L"\x3094\x309d",
  2994. 2,
  2995. (LPWSTR)SortDest,
  2996. BUFSIZE );
  2997. CheckReturnValidSortKey( rc,
  2998. -1,
  2999. SortDest,
  3000. "\x22\x04\x22\x04\x01\x03\x01\x01\xff\x03\x04\x02\xc4\xc4\xff\xc4\xc4\xff\x01",
  3001. "repeat, ignore kana and width",
  3002. &NumErrors );
  3003. //
  3004. // Test for upper case.
  3005. //
  3006. // Variation 1 - uppercase
  3007. rc = LCMapStringW( 0x0409,
  3008. LCMAP_UPPERCASE,
  3009. L"\x00e7",
  3010. -1,
  3011. MapDest,
  3012. BUFSIZE );
  3013. CheckReturnValidW( rc,
  3014. -1,
  3015. MapDest,
  3016. L"\x00c7",
  3017. "uppercase check",
  3018. &NumErrors );
  3019. //
  3020. // More Japanese Tests.
  3021. //
  3022. rc = LCMapStringW( 0x0411,
  3023. LCMAP_FULLWIDTH,
  3024. L"\x0020",
  3025. -1,
  3026. MapDest,
  3027. BUFSIZE );
  3028. CheckReturnValidW( rc,
  3029. -1,
  3030. MapDest,
  3031. L"\x3000",
  3032. "Japanese Test 1",
  3033. &NumErrors );
  3034. rc = LCMapStringW( 0x0411,
  3035. LCMAP_FULLWIDTH,
  3036. L"\x0022",
  3037. -1,
  3038. MapDest,
  3039. BUFSIZE );
  3040. CheckReturnValidW( rc,
  3041. -1,
  3042. MapDest,
  3043. L"\xff02",
  3044. "Japanese Test 2",
  3045. &NumErrors );
  3046. rc = LCMapStringW( 0x0411,
  3047. LCMAP_FULLWIDTH,
  3048. L"\x0027",
  3049. -1,
  3050. MapDest,
  3051. BUFSIZE );
  3052. CheckReturnValidW( rc,
  3053. -1,
  3054. MapDest,
  3055. L"\xff07",
  3056. "Japanese Test 3",
  3057. &NumErrors );
  3058. rc = LCMapStringW( 0x0411,
  3059. LCMAP_FULLWIDTH,
  3060. L"\x005c",
  3061. -1,
  3062. MapDest,
  3063. BUFSIZE );
  3064. CheckReturnValidW( rc,
  3065. -1,
  3066. MapDest,
  3067. L"\x005c",
  3068. "Japanese Test 4",
  3069. &NumErrors );
  3070. rc = LCMapStringW( 0x0411,
  3071. LCMAP_FULLWIDTH,
  3072. L"\x007e",
  3073. -1,
  3074. MapDest,
  3075. BUFSIZE );
  3076. CheckReturnValidW( rc,
  3077. -1,
  3078. MapDest,
  3079. L"\xff5e",
  3080. "Japanese Test 5",
  3081. &NumErrors );
  3082. rc = LCMapStringW( 0x0411,
  3083. LCMAP_FULLWIDTH,
  3084. L"\x30fb",
  3085. -1,
  3086. MapDest,
  3087. BUFSIZE );
  3088. CheckReturnValidW( rc,
  3089. -1,
  3090. MapDest,
  3091. L"\x30fb",
  3092. "Japanese Test 6",
  3093. &NumErrors );
  3094. rc = LCMapStringW( 0x0411,
  3095. LCMAP_FULLWIDTH,
  3096. L"\x3046\xff9e",
  3097. -1,
  3098. MapDest,
  3099. BUFSIZE );
  3100. CheckReturnValidW( rc,
  3101. -1,
  3102. MapDest,
  3103. L"\x3094",
  3104. "Japanese Test 7",
  3105. &NumErrors );
  3106. rc = LCMapStringW( 0x0411,
  3107. LCMAP_FULLWIDTH,
  3108. L"\x3046\x309b",
  3109. -1,
  3110. MapDest,
  3111. BUFSIZE );
  3112. CheckReturnValidW( rc,
  3113. -1,
  3114. MapDest,
  3115. L"\x3094",
  3116. "Japanese Test 8",
  3117. &NumErrors );
  3118. rc = LCMapStringW( 0x0411,
  3119. LCMAP_FULLWIDTH,
  3120. L"\x304b\xff9e",
  3121. -1,
  3122. MapDest,
  3123. BUFSIZE );
  3124. CheckReturnValidW( rc,
  3125. -1,
  3126. MapDest,
  3127. L"\x304c",
  3128. "Japanese Test 9",
  3129. &NumErrors );
  3130. rc = LCMapStringW( 0x0411,
  3131. LCMAP_FULLWIDTH,
  3132. L"\x306f\xff9f",
  3133. -1,
  3134. MapDest,
  3135. BUFSIZE );
  3136. CheckReturnValidW( rc,
  3137. -1,
  3138. MapDest,
  3139. L"\x3071",
  3140. "Japanese Test 10",
  3141. &NumErrors );
  3142. rc = LCMapStringW( 0x0411,
  3143. LCMAP_HALFWIDTH,
  3144. L"\x3000",
  3145. -1,
  3146. MapDest,
  3147. BUFSIZE );
  3148. CheckReturnValidW( rc,
  3149. -1,
  3150. MapDest,
  3151. L"\x0020",
  3152. "Japanese Test 11",
  3153. &NumErrors );
  3154. rc = LCMapStringW( 0x0411,
  3155. LCMAP_HALFWIDTH,
  3156. L"\xffe3",
  3157. -1,
  3158. MapDest,
  3159. BUFSIZE );
  3160. CheckReturnValidW( rc,
  3161. -1,
  3162. MapDest,
  3163. L"\x00af",
  3164. "Japanese Test 12",
  3165. &NumErrors );
  3166. rc = LCMapStringW( 0x0411,
  3167. LCMAP_HALFWIDTH,
  3168. L"\x2015",
  3169. -1,
  3170. MapDest,
  3171. BUFSIZE );
  3172. CheckReturnValidW( rc,
  3173. -1,
  3174. MapDest,
  3175. L"\x2015",
  3176. "Japanese Test 13",
  3177. &NumErrors );
  3178. rc = LCMapStringW( 0x0411,
  3179. LCMAP_HALFWIDTH,
  3180. L"\xff3c",
  3181. -1,
  3182. MapDest,
  3183. BUFSIZE );
  3184. CheckReturnValidW( rc,
  3185. -1,
  3186. MapDest,
  3187. L"\xff3c",
  3188. "Japanese Test 14",
  3189. &NumErrors );
  3190. rc = LCMapStringW( 0x0411,
  3191. LCMAP_HALFWIDTH,
  3192. L"\xff5e",
  3193. -1,
  3194. MapDest,
  3195. BUFSIZE );
  3196. CheckReturnValidW( rc,
  3197. -1,
  3198. MapDest,
  3199. L"\x007e",
  3200. "Japanese Test 15",
  3201. &NumErrors );
  3202. rc = LCMapStringW( 0x0411,
  3203. LCMAP_HALFWIDTH,
  3204. L"\x2018",
  3205. -1,
  3206. MapDest,
  3207. BUFSIZE );
  3208. CheckReturnValidW( rc,
  3209. -1,
  3210. MapDest,
  3211. L"'",
  3212. "Japanese Test 16",
  3213. &NumErrors );
  3214. rc = LCMapStringW( 0x0411,
  3215. LCMAP_HALFWIDTH,
  3216. L"\x2019",
  3217. -1,
  3218. MapDest,
  3219. BUFSIZE );
  3220. CheckReturnValidW( rc,
  3221. -1,
  3222. MapDest,
  3223. L"'",
  3224. "Japanese Test 17",
  3225. &NumErrors );
  3226. rc = LCMapStringW( 0x0411,
  3227. LCMAP_HALFWIDTH,
  3228. L"\x201c",
  3229. -1,
  3230. MapDest,
  3231. BUFSIZE );
  3232. CheckReturnValidW( rc,
  3233. -1,
  3234. MapDest,
  3235. L"\"",
  3236. "Japanese Test 18",
  3237. &NumErrors );
  3238. rc = LCMapStringW( 0x0411,
  3239. LCMAP_HALFWIDTH,
  3240. L"\x201d",
  3241. -1,
  3242. MapDest,
  3243. BUFSIZE );
  3244. CheckReturnValidW( rc,
  3245. -1,
  3246. MapDest,
  3247. L"\"",
  3248. "Japanese Test 19",
  3249. &NumErrors );
  3250. rc = LCMapStringW( 0x0411,
  3251. LCMAP_HALFWIDTH,
  3252. L"\x30fb",
  3253. -1,
  3254. MapDest,
  3255. BUFSIZE );
  3256. CheckReturnValidW( rc,
  3257. -1,
  3258. MapDest,
  3259. L"\xff65",
  3260. "Japanese Test 20",
  3261. &NumErrors );
  3262. rc = LCMapStringW( 0x0411,
  3263. LCMAP_HALFWIDTH,
  3264. L"\xffe5",
  3265. -1,
  3266. MapDest,
  3267. BUFSIZE );
  3268. CheckReturnValidW( rc,
  3269. -1,
  3270. MapDest,
  3271. L"\x00a5",
  3272. "Japanese Test 21",
  3273. &NumErrors );
  3274. rc = LCMapStringW( 0x0411,
  3275. LCMAP_HIRAGANA | LCMAP_LOWERCASE,
  3276. L"\x30fb",
  3277. -1,
  3278. MapDest,
  3279. BUFSIZE );
  3280. CheckReturnValidW( rc,
  3281. -1,
  3282. MapDest,
  3283. L"\x30fb",
  3284. "Japanese Test 22",
  3285. &NumErrors );
  3286. rc = LCMapStringW( 0x0411,
  3287. LCMAP_HIRAGANA,
  3288. L"\x30f4",
  3289. -1,
  3290. MapDest,
  3291. BUFSIZE );
  3292. CheckReturnValidW( rc,
  3293. -1,
  3294. MapDest,
  3295. L"\x3094",
  3296. "Japanese Test 23",
  3297. &NumErrors );
  3298. rc = LCMapStringW( 0x0411,
  3299. LCMAP_HIRAGANA,
  3300. L"\x30f4\xff9e",
  3301. -1,
  3302. MapDest,
  3303. BUFSIZE );
  3304. CheckReturnValidW( rc,
  3305. -1,
  3306. MapDest,
  3307. L"\x3094\xff9e",
  3308. "Japanese Test 24",
  3309. &NumErrors );
  3310. rc = LCMapStringW( 0x0411,
  3311. LCMAP_UPPERCASE,
  3312. L"\x3046\xff9e",
  3313. -1,
  3314. MapDest,
  3315. BUFSIZE );
  3316. CheckReturnValidW( rc,
  3317. -1,
  3318. MapDest,
  3319. L"\x3046\xff9e",
  3320. "Japanese Test 25",
  3321. &NumErrors );
  3322. rc = LCMapStringW( 0x0411,
  3323. LCMAP_UPPERCASE,
  3324. L"\x304b\xff9e",
  3325. -1,
  3326. MapDest,
  3327. BUFSIZE );
  3328. CheckReturnValidW( rc,
  3329. -1,
  3330. MapDest,
  3331. L"\x304b\xff9e",
  3332. "Japanese Test 26",
  3333. &NumErrors );
  3334. rc = LCMapStringW( 0x0411,
  3335. LCMAP_UPPERCASE,
  3336. L"\x304b\x309b",
  3337. -1,
  3338. MapDest,
  3339. BUFSIZE );
  3340. CheckReturnValidW( rc,
  3341. -1,
  3342. MapDest,
  3343. L"\x304b\x309b",
  3344. "Japanese Test 27",
  3345. &NumErrors );
  3346. rc = LCMapStringW( 0x0411,
  3347. LCMAP_KATAKANA,
  3348. L"\x304f\x309b",
  3349. -1,
  3350. MapDest,
  3351. BUFSIZE );
  3352. CheckReturnValidW( rc,
  3353. -1,
  3354. MapDest,
  3355. L"\x30af\x309b",
  3356. "Japanese Test 28",
  3357. &NumErrors );
  3358. rc = LCMapStringW( 0x0411,
  3359. LCMAP_KATAKANA | LCMAP_UPPERCASE,
  3360. L"a\x304f",
  3361. -1,
  3362. MapDest,
  3363. BUFSIZE );
  3364. CheckReturnValidW( rc,
  3365. -1,
  3366. MapDest,
  3367. L"A\x30af",
  3368. "Japanese Test 29",
  3369. &NumErrors );
  3370. rc = LCMapStringW( 0x0411,
  3371. LCMAP_KATAKANA | LCMAP_LOWERCASE,
  3372. L"A\x304f",
  3373. -1,
  3374. MapDest,
  3375. BUFSIZE );
  3376. CheckReturnValidW( rc,
  3377. -1,
  3378. MapDest,
  3379. L"a\x30af",
  3380. "Japanese Test 30",
  3381. &NumErrors );
  3382. rc = LCMapStringW( 0x0411,
  3383. LCMAP_SORTKEY,
  3384. L"\x005c",
  3385. -1,
  3386. (LPWSTR)SortDest,
  3387. BUFSIZE );
  3388. CheckReturnValidSortKey( rc,
  3389. -1,
  3390. SortDest,
  3391. "\x0a\x05\x01\x01\x01\x01",
  3392. "Japanese 0x005c",
  3393. &NumErrors );
  3394. //
  3395. // Ideograph LCMAP_SORTKEY Tests.
  3396. //
  3397. // Variation 1 - ideograph sortkey
  3398. rc = LCMapStringW( 0x0411,
  3399. LCMAP_SORTKEY,
  3400. L"\x99d5",
  3401. -1,
  3402. (LPWSTR)SortDest,
  3403. BUFSIZE );
  3404. CheckReturnValidSortKey( rc,
  3405. -1,
  3406. SortDest,
  3407. "\x81\x22\x01\x01\x01\x01",
  3408. "ideograph sortkey Japanese",
  3409. &NumErrors );
  3410. // Variation 2 - ideograph sortkey, no DestStr
  3411. rc = LCMapStringW( 0x0411,
  3412. LCMAP_SORTKEY,
  3413. L"\x99d5",
  3414. -1,
  3415. NULL,
  3416. 0 );
  3417. CheckReturnValidSortKey( rc,
  3418. -1,
  3419. NULL,
  3420. "\x81\x22\x01\x01\x01\x01",
  3421. "ideograph sortkey Japanese, no DestStr",
  3422. &NumErrors );
  3423. // Variation 3 - ideograph sortkey
  3424. rc = LCMapStringW( 0x0412,
  3425. LCMAP_SORTKEY,
  3426. L"\x99d5",
  3427. -1,
  3428. (LPWSTR)SortDest,
  3429. BUFSIZE );
  3430. CheckReturnValidSortKey( rc,
  3431. -1,
  3432. SortDest,
  3433. "\x0e\x03\x01\x79\x01\x01\x01",
  3434. "ideograph sortkey Korean",
  3435. &NumErrors );
  3436. // Variation 4 - ideograph sortkey, no DestStr
  3437. rc = LCMapStringW( 0x0412,
  3438. LCMAP_SORTKEY,
  3439. L"\x99d5",
  3440. -1,
  3441. NULL,
  3442. 0 );
  3443. CheckReturnValidSortKey( rc,
  3444. -1,
  3445. NULL,
  3446. "\x80\x03\x01\x79\x01\x01\x01",
  3447. "ideograph sortkey Korean, no DestStr",
  3448. &NumErrors );
  3449. //
  3450. // Src = Dest - W Version.
  3451. //
  3452. // Variation 1 - lowercase
  3453. MapDest[0] = L'X';
  3454. MapDest[1] = L'Y';
  3455. MapDest[2] = 0;
  3456. rc = LCMapStringW( Locale,
  3457. LCMAP_LOWERCASE,
  3458. MapDest,
  3459. -1,
  3460. MapDest,
  3461. BUFSIZE );
  3462. CheckReturnValidW( rc,
  3463. -1,
  3464. MapDest,
  3465. L"xy",
  3466. "src = dest - lowercase",
  3467. &NumErrors );
  3468. // Variation 2 - uppercase
  3469. MapDest[0] = L'x';
  3470. MapDest[1] = L'y';
  3471. MapDest[2] = 0;
  3472. rc = LCMapStringW( Locale,
  3473. LCMAP_UPPERCASE,
  3474. MapDest,
  3475. -1,
  3476. MapDest,
  3477. BUFSIZE );
  3478. CheckReturnValidW( rc,
  3479. -1,
  3480. MapDest,
  3481. L"XY",
  3482. "src = dest - uppercase",
  3483. &NumErrors );
  3484. // Variation 3 - uppercase
  3485. MapDest[0] = L'x';
  3486. MapDest[1] = L'y';
  3487. MapDest[2] = 0;
  3488. rc = LCMapStringW( Locale,
  3489. LCMAP_UPPERCASE,
  3490. MapDest,
  3491. 2,
  3492. MapDest,
  3493. 2 );
  3494. CheckReturnValidW( rc,
  3495. 2,
  3496. MapDest,
  3497. L"XY",
  3498. "src = dest - uppercase, size",
  3499. &NumErrors );
  3500. //
  3501. // Src = Dest - A Version.
  3502. //
  3503. // Variation 1 - lowercase
  3504. MapDestA[0] = 'X';
  3505. MapDestA[1] = 'Y';
  3506. MapDestA[2] = 0;
  3507. rc = LCMapStringA( Locale,
  3508. LCMAP_LOWERCASE,
  3509. MapDestA,
  3510. -1,
  3511. MapDestA,
  3512. BUFSIZE );
  3513. CheckReturnValidA( rc,
  3514. -1,
  3515. MapDestA,
  3516. "xy",
  3517. NULL,
  3518. "src = dest - lowercase (A Version)",
  3519. &NumErrors );
  3520. // Variation 2 - uppercase
  3521. MapDestA[0] = 'x';
  3522. MapDestA[1] = 'y';
  3523. MapDestA[2] = 0;
  3524. rc = LCMapStringA( Locale,
  3525. LCMAP_UPPERCASE,
  3526. MapDestA,
  3527. -1,
  3528. MapDestA,
  3529. BUFSIZE );
  3530. CheckReturnValidA( rc,
  3531. -1,
  3532. MapDestA,
  3533. "XY",
  3534. NULL,
  3535. "src = dest - uppercase (A Version)",
  3536. &NumErrors );
  3537. // Variation 3 - uppercase
  3538. MapDestA[0] = 'x';
  3539. MapDestA[1] = 'y';
  3540. MapDestA[2] = 0;
  3541. rc = LCMapStringA( Locale,
  3542. LCMAP_UPPERCASE,
  3543. MapDestA,
  3544. 2,
  3545. MapDestA,
  3546. 2 );
  3547. CheckReturnValidA( rc,
  3548. 2,
  3549. MapDestA,
  3550. "XY",
  3551. NULL,
  3552. "src = dest - uppercase, size (A Version)",
  3553. &NumErrors );
  3554. //
  3555. // Return total number of errors found.
  3556. //
  3557. return (NumErrors);
  3558. }
  3559. ////////////////////////////////////////////////////////////////////////////
  3560. //
  3561. // LCMS_Ansi
  3562. //
  3563. // This routine tests the Ansi version of the API routine.
  3564. //
  3565. // 06-14-91 JulieB Created.
  3566. ////////////////////////////////////////////////////////////////////////////
  3567. int LCMS_Ansi()
  3568. {
  3569. int NumErrors = 0; // error count - to be returned
  3570. int rc; // return code
  3571. //
  3572. // LCMapStringA - USE CP ACP.
  3573. //
  3574. // Variation 1 - Use CP ACP
  3575. rc = LCMapStringA( 0x0409,
  3576. LOCALE_USE_CP_ACP | LCMAP_LOWERCASE,
  3577. "ABCD",
  3578. -1,
  3579. MapDestA,
  3580. BUFSIZE );
  3581. CheckReturnValidA( rc,
  3582. -1,
  3583. MapDestA,
  3584. "abcd",
  3585. NULL,
  3586. "A Version Use CP ACP",
  3587. &NumErrors );
  3588. //
  3589. // LCMapStringA - LOWER case.
  3590. //
  3591. // Variation 1 - Lower case
  3592. rc = LCMapStringA( 0x0409,
  3593. LCMAP_LOWERCASE,
  3594. "ABCD",
  3595. -1,
  3596. MapDestA,
  3597. BUFSIZE );
  3598. CheckReturnValidA( rc,
  3599. -1,
  3600. MapDestA,
  3601. "abcd",
  3602. NULL,
  3603. "A version lower",
  3604. &NumErrors );
  3605. // Variation 2 - Lower case
  3606. rc = LCMapStringA( 0x0409,
  3607. LCMAP_LOWERCASE,
  3608. "ABCD",
  3609. -1,
  3610. NULL,
  3611. 0 );
  3612. CheckReturnValidA( rc,
  3613. -1,
  3614. NULL,
  3615. "abcd",
  3616. NULL,
  3617. "A version lower (cchDest = 0)",
  3618. &NumErrors );
  3619. // Variation 3 - Lower case
  3620. rc = LCMapStringA( 0x0409,
  3621. LCMAP_LOWERCASE,
  3622. "ABCD",
  3623. 4,
  3624. MapDestA,
  3625. BUFSIZE );
  3626. CheckReturnValidA( rc,
  3627. 4,
  3628. MapDestA,
  3629. "abcd",
  3630. NULL,
  3631. "A version lower size",
  3632. &NumErrors );
  3633. // Variation 4 - Lower case
  3634. rc = LCMapStringA( 0x0409,
  3635. LCMAP_LOWERCASE,
  3636. "ABCD",
  3637. 4,
  3638. NULL,
  3639. 0 );
  3640. CheckReturnValidA( rc,
  3641. 4,
  3642. NULL,
  3643. "abcd",
  3644. NULL,
  3645. "A version lower size (cchDest = 0)",
  3646. &NumErrors );
  3647. //
  3648. // LCMapStringA - SORTKEY.
  3649. //
  3650. // Variation 1 - sortkey
  3651. rc = LCMapStringA( Locale,
  3652. LCMAP_SORTKEY,
  3653. "Th",
  3654. -1,
  3655. SortDest,
  3656. BUFSIZE );
  3657. CheckReturnValidSortKey( rc,
  3658. -1,
  3659. SortDest,
  3660. "\x0e\x99\x0e\x2c\x01\x01\x12\x01\x01",
  3661. "A version sortkey",
  3662. &NumErrors );
  3663. // Variation 2 - sortkey, no DestStr
  3664. rc = LCMapStringA( Locale,
  3665. LCMAP_SORTKEY,
  3666. "Th",
  3667. -1,
  3668. NULL,
  3669. 0 );
  3670. CheckReturnValidSortKey( rc,
  3671. -1,
  3672. NULL,
  3673. "\x0e\x99\x0e\x2c\x01\x01\x12\x01\x01",
  3674. "A version sortkey (cchDest = 0)",
  3675. &NumErrors );
  3676. //
  3677. // Return total number of errors found.
  3678. //
  3679. return (NumErrors);
  3680. }
  3681. ////////////////////////////////////////////////////////////////////////////
  3682. //
  3683. // CheckReturnValidSortKey
  3684. //
  3685. // Checks the return code from the valid LCMapString[A|W] call with the
  3686. // LCMAP_SOTRKEY flag set. It prints out the appropriate error if the
  3687. // incorrect result is found.
  3688. //
  3689. // 06-14-91 JulieB Created.
  3690. ////////////////////////////////////////////////////////////////////////////
  3691. void CheckReturnValidSortKey(
  3692. int CurrentReturn,
  3693. int ExpectedReturn,
  3694. LPBYTE pCurrentString,
  3695. LPBYTE pExpectedString,
  3696. LPBYTE pErrString,
  3697. int *pNumErrors)
  3698. {
  3699. int ctr; // loop counter
  3700. if (ExpectedReturn == -1)
  3701. {
  3702. ExpectedReturn = MB_STRING_LEN_NULL(pExpectedString);
  3703. }
  3704. if ( (CurrentReturn != ExpectedReturn) ||
  3705. ( (pCurrentString != NULL) &&
  3706. (CompStringsA(pCurrentString, pExpectedString, CurrentReturn)) ) )
  3707. {
  3708. printf("ERROR: %s - \n", pErrString);
  3709. printf(" Return = %d, Expected = %d\n", CurrentReturn, ExpectedReturn);
  3710. if (pCurrentString != NULL)
  3711. {
  3712. printf(" ");
  3713. for (ctr = 0; ctr < CurrentReturn; ctr++)
  3714. {
  3715. printf("%x ", pCurrentString[ctr]);
  3716. }
  3717. printf("\n");
  3718. }
  3719. (*pNumErrors)++;
  3720. }
  3721. }