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.

3969 lines
118 KiB

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