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.

1445 lines
41 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. ecitest.c
  5. Abstract:
  6. Test module for NLS API EnumCalendarInfo.
  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. 08-02-93 JulieB Created.
  12. --*/
  13. //
  14. // Include Files.
  15. //
  16. #include "nlstest.h"
  17. //
  18. // Constant Declarations.
  19. //
  20. #define ECI_INVALID_FLAG 0x00000100
  21. //
  22. // Global Variables.
  23. //
  24. int CalendarCtr;
  25. CALTYPE pCalFlag[] =
  26. {
  27. CAL_ICALINTVALUE,
  28. CAL_SCALNAME,
  29. CAL_ITWODIGITYEARMAX,
  30. CAL_IYEAROFFSETRANGE,
  31. CAL_SERASTRING,
  32. CAL_SSHORTDATE,
  33. CAL_SLONGDATE,
  34. CAL_SYEARMONTH,
  35. CAL_SDAYNAME1,
  36. CAL_SMONTHNAME1,
  37. CAL_SMONTHNAME13
  38. };
  39. #define NUM_CAL_FLAGS ( sizeof(pCalFlag) / sizeof(CALTYPE) )
  40. //
  41. // pCalEnglish and pCalJapan_x must have the same number of entries
  42. // as pCalFlag.
  43. //
  44. int pCalEnglish[] =
  45. {
  46. 1,
  47. 1,
  48. 1,
  49. 0,
  50. 0,
  51. 7,
  52. 4,
  53. 1,
  54. 1,
  55. 1,
  56. 0
  57. };
  58. int pCalJapan_All[] =
  59. {
  60. 3,
  61. 3,
  62. 3,
  63. 4,
  64. 4,
  65. 20,
  66. 14,
  67. 3,
  68. 2,
  69. 2,
  70. 0
  71. };
  72. int pCalJapan_1[] =
  73. {
  74. 1,
  75. 1,
  76. 1,
  77. 0,
  78. 0,
  79. 8,
  80. 4,
  81. 1,
  82. 1,
  83. 1,
  84. 0
  85. };
  86. int pCalJapan_2[] =
  87. {
  88. 1,
  89. 1,
  90. 1,
  91. 0,
  92. 0,
  93. 4,
  94. 2,
  95. 1,
  96. 1,
  97. 1,
  98. 0
  99. };
  100. int pCalJapan_3[] =
  101. {
  102. 1,
  103. 1,
  104. 1,
  105. 4,
  106. 4,
  107. 8,
  108. 8,
  109. 1,
  110. 1,
  111. 1,
  112. 0
  113. };
  114. //
  115. // Forward Declarations.
  116. //
  117. BOOL
  118. InitEnumCalendarInfo();
  119. int
  120. ECI_BadParamCheck();
  121. int
  122. ECI_NormalCase();
  123. int
  124. ECI_Ansi();
  125. BOOL
  126. CALLBACK
  127. MyFuncCalendar(
  128. LPWSTR pStr);
  129. BOOL
  130. CALLBACK
  131. MyFuncCalendarA(
  132. LPSTR pStr);
  133. BOOL
  134. CALLBACK
  135. MyFuncCalendarEx(
  136. LPWSTR pStr,
  137. CALID CalId);
  138. BOOL
  139. CALLBACK
  140. MyFuncCalendarExA(
  141. LPSTR pStr,
  142. CALID CalId);
  143. //
  144. // Callback functions.
  145. //
  146. BOOL CALLBACK MyFuncCalendar(
  147. LPWSTR pStr)
  148. {
  149. if (Verbose)
  150. {
  151. while (*pStr)
  152. {
  153. printf((*pStr > 0xff) ? "(0x%x)" : "%wc", *pStr);
  154. pStr++;
  155. }
  156. printf("\n");
  157. }
  158. CalendarCtr++;
  159. return (TRUE);
  160. }
  161. BOOL CALLBACK MyFuncCalendarA(
  162. LPSTR pStr)
  163. {
  164. if (Verbose)
  165. {
  166. while (*pStr)
  167. {
  168. printf((*pStr > 0xff) ? "(0x%x)" : "%c", *pStr);
  169. pStr++;
  170. }
  171. printf("\n");
  172. }
  173. CalendarCtr++;
  174. return (TRUE);
  175. }
  176. //
  177. // Callback functions for EX version.
  178. //
  179. BOOL CALLBACK MyFuncCalendarEx(
  180. LPWSTR pStr,
  181. CALID CalId)
  182. {
  183. if (Verbose)
  184. {
  185. printf("CalId = %d\n", CalId);
  186. while (*pStr)
  187. {
  188. printf((*pStr > 0xff) ? "(0x%x)" : "%wc", *pStr);
  189. pStr++;
  190. }
  191. printf("\n");
  192. }
  193. CalendarCtr++;
  194. return (TRUE);
  195. }
  196. BOOL CALLBACK MyFuncCalendarExA(
  197. LPSTR pStr,
  198. CALID CalId)
  199. {
  200. if (Verbose)
  201. {
  202. printf("CalId = %d\n", CalId);
  203. while (*pStr)
  204. {
  205. printf((*pStr > 0xff) ? "(0x%x)" : "%c", *pStr);
  206. pStr++;
  207. }
  208. printf("\n");
  209. }
  210. CalendarCtr++;
  211. return (TRUE);
  212. }
  213. ////////////////////////////////////////////////////////////////////////////
  214. //
  215. // TestEnumCalendarInfo
  216. //
  217. // Test routine for EnumCalendarInfoW API.
  218. //
  219. // 08-02-93 JulieB Created.
  220. ////////////////////////////////////////////////////////////////////////////
  221. int TestEnumCalendarInfo()
  222. {
  223. int ErrCount = 0; // error count
  224. //
  225. // Print out what's being done.
  226. //
  227. printf("\n\nTESTING EnumCalendarInfoW...\n\n");
  228. //
  229. // Initialize global variables.
  230. //
  231. if (!InitEnumCalendarInfo())
  232. {
  233. printf("\nABORTED TestEnumCalendarInfo: Could not Initialize.\n");
  234. return (1);
  235. }
  236. //
  237. // Test bad parameters.
  238. //
  239. ErrCount += ECI_BadParamCheck();
  240. //
  241. // Test normal cases.
  242. //
  243. ErrCount += ECI_NormalCase();
  244. //
  245. // Test Ansi version.
  246. //
  247. ErrCount += ECI_Ansi();
  248. //
  249. // Print out result.
  250. //
  251. printf("\nEnumCalendarInfoW: ERRORS = %d\n", ErrCount);
  252. //
  253. // Return total number of errors found.
  254. //
  255. return (ErrCount);
  256. }
  257. ////////////////////////////////////////////////////////////////////////////
  258. //
  259. // InitEnumCalendarInfo
  260. //
  261. // This routine initializes the global variables. If no errors were
  262. // encountered, then it returns TRUE. Otherwise, it returns FALSE.
  263. //
  264. // 08-02-93 JulieB Created.
  265. ////////////////////////////////////////////////////////////////////////////
  266. BOOL InitEnumCalendarInfo()
  267. {
  268. //
  269. // Initialize date counter.
  270. //
  271. CalendarCtr = 0;
  272. //
  273. // Return success.
  274. //
  275. return (TRUE);
  276. }
  277. ////////////////////////////////////////////////////////////////////////////
  278. //
  279. // ECI_BadParamCheck
  280. //
  281. // This routine passes in bad parameters to the API routines and checks to
  282. // be sure they are handled properly. The number of errors encountered
  283. // is returned to the caller.
  284. //
  285. // 08-02-93 JulieB Created.
  286. ////////////////////////////////////////////////////////////////////////////
  287. int ECI_BadParamCheck()
  288. {
  289. int NumErrors = 0; // error count - to be returned
  290. int rc; // return code
  291. //
  292. // Bad Function.
  293. //
  294. // Variation 1 - bad function
  295. CalendarCtr = 0;
  296. rc = EnumCalendarInfoW( NULL,
  297. 0x0409,
  298. ENUM_ALL_CALENDARS,
  299. CAL_ICALINTVALUE );
  300. CheckReturnBadParamEnum( rc,
  301. FALSE,
  302. ERROR_INVALID_PARAMETER,
  303. "function invalid",
  304. &NumErrors,
  305. CalendarCtr,
  306. 0 );
  307. CalendarCtr = 0;
  308. rc = EnumCalendarInfoExW( NULL,
  309. 0x0409,
  310. ENUM_ALL_CALENDARS,
  311. CAL_ICALINTVALUE );
  312. CheckReturnBadParamEnum( rc,
  313. FALSE,
  314. ERROR_INVALID_PARAMETER,
  315. "Ex function invalid",
  316. &NumErrors,
  317. CalendarCtr,
  318. 0 );
  319. //
  320. // Bad Locale.
  321. //
  322. // Variation 1 - bad locale
  323. CalendarCtr = 0;
  324. rc = EnumCalendarInfoW( MyFuncCalendar,
  325. (LCID)333,
  326. ENUM_ALL_CALENDARS,
  327. CAL_ICALINTVALUE );
  328. CheckReturnBadParamEnum( rc,
  329. FALSE,
  330. ERROR_INVALID_PARAMETER,
  331. "Locale invalid",
  332. &NumErrors,
  333. CalendarCtr,
  334. 0 );
  335. CalendarCtr = 0;
  336. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  337. (LCID)333,
  338. ENUM_ALL_CALENDARS,
  339. CAL_ICALINTVALUE );
  340. CheckReturnBadParamEnum( rc,
  341. FALSE,
  342. ERROR_INVALID_PARAMETER,
  343. "Ex Locale invalid",
  344. &NumErrors,
  345. CalendarCtr,
  346. 0 );
  347. //
  348. // Invalid Flag.
  349. //
  350. // Variation 1 - dwFlags = invalid
  351. CalendarCtr = 0;
  352. rc = EnumCalendarInfoW( MyFuncCalendar,
  353. 0x0409,
  354. ENUM_ALL_CALENDARS,
  355. ECI_INVALID_FLAG );
  356. CheckReturnBadParamEnum( rc,
  357. FALSE,
  358. ERROR_INVALID_FLAGS,
  359. "Flag invalid",
  360. &NumErrors,
  361. CalendarCtr,
  362. 0 );
  363. CalendarCtr = 0;
  364. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  365. 0x0409,
  366. ENUM_ALL_CALENDARS,
  367. ECI_INVALID_FLAG );
  368. CheckReturnBadParamEnum( rc,
  369. FALSE,
  370. ERROR_INVALID_FLAGS,
  371. "Ex Flag invalid",
  372. &NumErrors,
  373. CalendarCtr,
  374. 0 );
  375. //
  376. // Return total number of errors found.
  377. //
  378. return (NumErrors);
  379. }
  380. ////////////////////////////////////////////////////////////////////////////
  381. //
  382. // ECI_NormalCase
  383. //
  384. // This routine tests the normal cases of the API routine.
  385. //
  386. // 08-02-93 JulieB Created.
  387. ////////////////////////////////////////////////////////////////////////////
  388. int ECI_NormalCase()
  389. {
  390. int NumErrors = 0; // error count - to be returned
  391. int rc; // return code
  392. int ctr; // loop counter
  393. if (Verbose)
  394. {
  395. printf("\n---- W version ----\n\n");
  396. }
  397. //
  398. // Single calendar id - English.
  399. //
  400. // Variation 1 - iCalIntValue - English
  401. CalendarCtr = 0;
  402. rc = EnumCalendarInfoW( MyFuncCalendar,
  403. 0x0409,
  404. 0,
  405. CAL_ICALINTVALUE );
  406. CheckReturnValidEnum( rc,
  407. FALSE,
  408. CalendarCtr,
  409. 0,
  410. "iCalIntValue English (cal 0)",
  411. &NumErrors );
  412. CalendarCtr = 0;
  413. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  414. 0x0409,
  415. 0,
  416. CAL_ICALINTVALUE );
  417. CheckReturnValidEnum( rc,
  418. FALSE,
  419. CalendarCtr,
  420. 0,
  421. "Ex iCalIntValue English (cal 0)",
  422. &NumErrors );
  423. // Variation 2 - iCalIntValue - English
  424. CalendarCtr = 0;
  425. rc = EnumCalendarInfoW( MyFuncCalendar,
  426. 0x0409,
  427. 2,
  428. CAL_ICALINTVALUE );
  429. CheckReturnValidEnum( rc,
  430. FALSE,
  431. CalendarCtr,
  432. 0,
  433. "iCalIntValue English (cal 2)",
  434. &NumErrors );
  435. CalendarCtr = 0;
  436. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  437. 0x0409,
  438. 2,
  439. CAL_ICALINTVALUE );
  440. CheckReturnValidEnum( rc,
  441. FALSE,
  442. CalendarCtr,
  443. 0,
  444. "Ex iCalIntValue English (cal 2)",
  445. &NumErrors );
  446. // Variation 3 - Use CP ACP
  447. CalendarCtr = 0;
  448. rc = EnumCalendarInfoW( MyFuncCalendar,
  449. 0x0409,
  450. 2,
  451. CAL_ICALINTVALUE | LOCALE_USE_CP_ACP );
  452. CheckReturnValidEnum( rc,
  453. FALSE,
  454. CalendarCtr,
  455. 0,
  456. "Use CP ACP",
  457. &NumErrors );
  458. CalendarCtr = 0;
  459. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  460. 0x0409,
  461. 2,
  462. CAL_ICALINTVALUE | LOCALE_USE_CP_ACP );
  463. CheckReturnValidEnum( rc,
  464. FALSE,
  465. CalendarCtr,
  466. 0,
  467. "Ex Use CP ACP",
  468. &NumErrors );
  469. //
  470. // CALTYPE values - English.
  471. //
  472. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  473. {
  474. CalendarCtr = 0;
  475. rc = EnumCalendarInfoW( MyFuncCalendar,
  476. 0x0409,
  477. 1,
  478. pCalFlag[ctr] );
  479. CheckReturnValidEnumLoop( rc,
  480. TRUE,
  481. CalendarCtr,
  482. pCalEnglish[ctr],
  483. "English (cal 1) Calendar Flag",
  484. pCalFlag[ctr],
  485. &NumErrors );
  486. }
  487. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  488. {
  489. CalendarCtr = 0;
  490. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  491. 0x0409,
  492. 1,
  493. pCalFlag[ctr] );
  494. CheckReturnValidEnumLoop( rc,
  495. TRUE,
  496. CalendarCtr,
  497. pCalEnglish[ctr],
  498. "Ex English (cal 1) Calendar Flag",
  499. pCalFlag[ctr],
  500. &NumErrors );
  501. }
  502. //
  503. // Single calendar id - Japan.
  504. //
  505. // Variation 1 - iCalIntValue - Japan
  506. CalendarCtr = 0;
  507. rc = EnumCalendarInfoW( MyFuncCalendar,
  508. 0x0411,
  509. 0,
  510. CAL_ICALINTVALUE );
  511. CheckReturnValidEnum( rc,
  512. FALSE,
  513. CalendarCtr,
  514. 0,
  515. "iCalIntValue Japan (cal 0)",
  516. &NumErrors );
  517. CalendarCtr = 0;
  518. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  519. 0x0411,
  520. 0,
  521. CAL_ICALINTVALUE );
  522. CheckReturnValidEnum( rc,
  523. FALSE,
  524. CalendarCtr,
  525. 0,
  526. "Ex iCalIntValue Japan (cal 0)",
  527. &NumErrors );
  528. //
  529. // CALTYPE values - Japan.
  530. //
  531. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  532. {
  533. CalendarCtr = 0;
  534. rc = EnumCalendarInfoW( MyFuncCalendar,
  535. 0x0411,
  536. 1,
  537. pCalFlag[ctr] );
  538. CheckReturnValidEnumLoop( rc,
  539. TRUE,
  540. CalendarCtr,
  541. pCalJapan_1[ctr],
  542. "Japan (cal 1) Calendar Flag",
  543. pCalFlag[ctr],
  544. &NumErrors );
  545. }
  546. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  547. {
  548. CalendarCtr = 0;
  549. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  550. 0x0411,
  551. 1,
  552. pCalFlag[ctr] );
  553. CheckReturnValidEnumLoop( rc,
  554. TRUE,
  555. CalendarCtr,
  556. pCalJapan_1[ctr],
  557. "Ex Japan (cal 1) Calendar Flag",
  558. pCalFlag[ctr],
  559. &NumErrors );
  560. }
  561. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  562. {
  563. CalendarCtr = 0;
  564. rc = EnumCalendarInfoW( MyFuncCalendar,
  565. 0x0411,
  566. 2,
  567. pCalFlag[ctr] );
  568. CheckReturnValidEnumLoop( rc,
  569. TRUE,
  570. CalendarCtr,
  571. pCalJapan_2[ctr],
  572. "Japan (cal 2) Calendar Flag",
  573. pCalFlag[ctr],
  574. &NumErrors );
  575. }
  576. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  577. {
  578. CalendarCtr = 0;
  579. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  580. 0x0411,
  581. 2,
  582. pCalFlag[ctr] );
  583. CheckReturnValidEnumLoop( rc,
  584. TRUE,
  585. CalendarCtr,
  586. pCalJapan_2[ctr],
  587. "Ex Japan (cal 2) Calendar Flag",
  588. pCalFlag[ctr],
  589. &NumErrors );
  590. }
  591. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  592. {
  593. CalendarCtr = 0;
  594. rc = EnumCalendarInfoW( MyFuncCalendar,
  595. 0x0411,
  596. 3,
  597. pCalFlag[ctr] );
  598. CheckReturnValidEnumLoop( rc,
  599. TRUE,
  600. CalendarCtr,
  601. pCalJapan_3[ctr],
  602. "Japan (cal 3) Calendar Flag",
  603. pCalFlag[ctr],
  604. &NumErrors );
  605. }
  606. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  607. {
  608. CalendarCtr = 0;
  609. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  610. 0x0411,
  611. 3,
  612. pCalFlag[ctr] );
  613. CheckReturnValidEnumLoop( rc,
  614. TRUE,
  615. CalendarCtr,
  616. pCalJapan_3[ctr],
  617. "Ex Japan (cal 3) Calendar Flag",
  618. pCalFlag[ctr],
  619. &NumErrors );
  620. }
  621. //
  622. // English - Enumerate ALL Calendars.
  623. //
  624. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  625. {
  626. CalendarCtr = 0;
  627. rc = EnumCalendarInfoW( MyFuncCalendar,
  628. 0x0409,
  629. ENUM_ALL_CALENDARS,
  630. pCalFlag[ctr] );
  631. CheckReturnValidEnumLoop( rc,
  632. TRUE,
  633. CalendarCtr,
  634. pCalEnglish[ctr],
  635. "English (all cal) Calendar Flag",
  636. pCalFlag[ctr],
  637. &NumErrors );
  638. }
  639. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  640. {
  641. CalendarCtr = 0;
  642. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  643. 0x0409,
  644. ENUM_ALL_CALENDARS,
  645. pCalFlag[ctr] );
  646. CheckReturnValidEnumLoop( rc,
  647. TRUE,
  648. CalendarCtr,
  649. pCalEnglish[ctr],
  650. "Ex English (all cal) Calendar Flag",
  651. pCalFlag[ctr],
  652. &NumErrors );
  653. }
  654. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  655. {
  656. CalendarCtr = 0;
  657. rc = EnumCalendarInfoW( MyFuncCalendar,
  658. 0x0409,
  659. ENUM_ALL_CALENDARS,
  660. ctr );
  661. CheckReturnValidEnumLoop( rc,
  662. TRUE,
  663. CalendarCtr,
  664. 1,
  665. "English (all cal) Day/Month Calendar Flag",
  666. ctr,
  667. &NumErrors );
  668. }
  669. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  670. {
  671. CalendarCtr = 0;
  672. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  673. 0x0409,
  674. ENUM_ALL_CALENDARS,
  675. ctr );
  676. CheckReturnValidEnumLoop( rc,
  677. TRUE,
  678. CalendarCtr,
  679. 1,
  680. "Ex English (all cal) Day/Month Calendar Flag",
  681. ctr,
  682. &NumErrors );
  683. }
  684. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  685. {
  686. CalendarCtr = 0;
  687. rc = EnumCalendarInfoW( MyFuncCalendar,
  688. 0x0409,
  689. ENUM_ALL_CALENDARS,
  690. ctr );
  691. CheckReturnValidEnumLoop( rc,
  692. TRUE,
  693. CalendarCtr,
  694. 1,
  695. "English (all cal) Day/Month Calendar Flag",
  696. ctr,
  697. &NumErrors );
  698. }
  699. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  700. {
  701. CalendarCtr = 0;
  702. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  703. 0x0409,
  704. ENUM_ALL_CALENDARS,
  705. ctr );
  706. CheckReturnValidEnumLoop( rc,
  707. TRUE,
  708. CalendarCtr,
  709. 1,
  710. "Ex English (all cal) Day/Month Calendar Flag",
  711. ctr,
  712. &NumErrors );
  713. }
  714. //
  715. // Japan - Enumerate ALL Calendars.
  716. //
  717. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  718. {
  719. CalendarCtr = 0;
  720. rc = EnumCalendarInfoW( MyFuncCalendar,
  721. 0x0411,
  722. ENUM_ALL_CALENDARS,
  723. pCalFlag[ctr] );
  724. CheckReturnValidEnumLoop( rc,
  725. TRUE,
  726. CalendarCtr,
  727. pCalJapan_All[ctr],
  728. "Japan (all cal) Calendar Flag",
  729. pCalFlag[ctr],
  730. &NumErrors );
  731. }
  732. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  733. {
  734. CalendarCtr = 0;
  735. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  736. 0x0411,
  737. ENUM_ALL_CALENDARS,
  738. pCalFlag[ctr] );
  739. CheckReturnValidEnumLoop( rc,
  740. TRUE,
  741. CalendarCtr,
  742. pCalJapan_All[ctr],
  743. "Ex Japan (all cal) Calendar Flag",
  744. pCalFlag[ctr],
  745. &NumErrors );
  746. }
  747. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  748. {
  749. CalendarCtr = 0;
  750. rc = EnumCalendarInfoW( MyFuncCalendar,
  751. 0x0411,
  752. ENUM_ALL_CALENDARS,
  753. ctr );
  754. CheckReturnValidEnumLoop( rc,
  755. TRUE,
  756. CalendarCtr,
  757. 2,
  758. "Japan (all cal) Day/Month Calendar Flag",
  759. ctr,
  760. &NumErrors );
  761. }
  762. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  763. {
  764. CalendarCtr = 0;
  765. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  766. 0x0411,
  767. ENUM_ALL_CALENDARS,
  768. ctr );
  769. CheckReturnValidEnumLoop( rc,
  770. TRUE,
  771. CalendarCtr,
  772. 2,
  773. "Ex Japan (all cal) Day/Month Calendar Flag",
  774. ctr,
  775. &NumErrors );
  776. }
  777. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  778. {
  779. CalendarCtr = 0;
  780. rc = EnumCalendarInfoW( MyFuncCalendar,
  781. 0x0411,
  782. ENUM_ALL_CALENDARS,
  783. ctr );
  784. CheckReturnValidEnumLoop( rc,
  785. TRUE,
  786. CalendarCtr,
  787. 2,
  788. "Japan (all cal) Day/Month Calendar Flag",
  789. ctr,
  790. &NumErrors );
  791. }
  792. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  793. {
  794. CalendarCtr = 0;
  795. rc = EnumCalendarInfoExW( MyFuncCalendarEx,
  796. 0x0411,
  797. ENUM_ALL_CALENDARS,
  798. ctr );
  799. CheckReturnValidEnumLoop( rc,
  800. TRUE,
  801. CalendarCtr,
  802. 2,
  803. "Ex Japan (all cal) Day/Month Calendar Flag",
  804. ctr,
  805. &NumErrors );
  806. }
  807. //
  808. // Return total number of errors found.
  809. //
  810. return (NumErrors);
  811. }
  812. ////////////////////////////////////////////////////////////////////////////
  813. //
  814. // ECI_Ansi
  815. //
  816. // This routine tests the normal cases of the API routine.
  817. //
  818. // 08-02-93 JulieB Created.
  819. ////////////////////////////////////////////////////////////////////////////
  820. int ECI_Ansi()
  821. {
  822. int NumErrors = 0; // error count - to be returned
  823. int rc; // return code
  824. int ctr; // loop counter
  825. if (Verbose)
  826. {
  827. printf("\n---- A version ----\n\n");
  828. }
  829. //
  830. // Single calendar id - English.
  831. //
  832. // Variation 1 - iCalIntValue - English
  833. CalendarCtr = 0;
  834. rc = EnumCalendarInfoA( MyFuncCalendarA,
  835. 0x0409,
  836. 0,
  837. CAL_ICALINTVALUE );
  838. CheckReturnValidEnum( rc,
  839. FALSE,
  840. CalendarCtr,
  841. 0,
  842. "A version iCalIntValue English (cal 0)",
  843. &NumErrors );
  844. CalendarCtr = 0;
  845. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  846. 0x0409,
  847. 0,
  848. CAL_ICALINTVALUE );
  849. CheckReturnValidEnum( rc,
  850. FALSE,
  851. CalendarCtr,
  852. 0,
  853. "Ex A version iCalIntValue English (cal 0)",
  854. &NumErrors );
  855. // Variation 2 - iCalIntValue - English
  856. CalendarCtr = 0;
  857. rc = EnumCalendarInfoA( MyFuncCalendarA,
  858. 0x0409,
  859. 2,
  860. CAL_ICALINTVALUE );
  861. CheckReturnValidEnum( rc,
  862. FALSE,
  863. CalendarCtr,
  864. 0,
  865. "A version iCalIntValue English (cal 2)",
  866. &NumErrors );
  867. CalendarCtr = 0;
  868. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  869. 0x0409,
  870. 2,
  871. CAL_ICALINTVALUE );
  872. CheckReturnValidEnum( rc,
  873. FALSE,
  874. CalendarCtr,
  875. 0,
  876. "Ex A version iCalIntValue English (cal 2)",
  877. &NumErrors );
  878. // Variation 3 - Use CP ACP
  879. CalendarCtr = 0;
  880. rc = EnumCalendarInfoA( MyFuncCalendarA,
  881. 0x0409,
  882. 0,
  883. CAL_ICALINTVALUE | LOCALE_USE_CP_ACP );
  884. CheckReturnValidEnum( rc,
  885. FALSE,
  886. CalendarCtr,
  887. 0,
  888. "A version Use CP ACP",
  889. &NumErrors );
  890. CalendarCtr = 0;
  891. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  892. 0x0409,
  893. 0,
  894. CAL_ICALINTVALUE | LOCALE_USE_CP_ACP );
  895. CheckReturnValidEnum( rc,
  896. FALSE,
  897. CalendarCtr,
  898. 0,
  899. "Ex A version Use CP ACP",
  900. &NumErrors );
  901. //
  902. // CALTYPE values - English.
  903. //
  904. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  905. {
  906. CalendarCtr = 0;
  907. rc = EnumCalendarInfoA( MyFuncCalendarA,
  908. 0x0409,
  909. 1,
  910. pCalFlag[ctr] );
  911. CheckReturnValidEnumLoop( rc,
  912. TRUE,
  913. CalendarCtr,
  914. pCalEnglish[ctr],
  915. "A version English (cal 1) Calendar Flag",
  916. pCalFlag[ctr],
  917. &NumErrors );
  918. }
  919. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  920. {
  921. CalendarCtr = 0;
  922. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  923. 0x0409,
  924. 1,
  925. pCalFlag[ctr] );
  926. CheckReturnValidEnumLoop( rc,
  927. TRUE,
  928. CalendarCtr,
  929. pCalEnglish[ctr],
  930. "Ex A version English (cal 1) Calendar Flag",
  931. pCalFlag[ctr],
  932. &NumErrors );
  933. }
  934. //
  935. // Single calendar id - Japan.
  936. //
  937. // Variation 1 - iCalIntValue - Japan
  938. CalendarCtr = 0;
  939. rc = EnumCalendarInfoA( MyFuncCalendarA,
  940. 0x0411,
  941. 0,
  942. CAL_ICALINTVALUE );
  943. CheckReturnValidEnum( rc,
  944. FALSE,
  945. CalendarCtr,
  946. 0,
  947. "A version iCalIntValue Japan (cal 0)",
  948. &NumErrors );
  949. CalendarCtr = 0;
  950. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  951. 0x0411,
  952. 0,
  953. CAL_ICALINTVALUE );
  954. CheckReturnValidEnum( rc,
  955. FALSE,
  956. CalendarCtr,
  957. 0,
  958. "Ex A version iCalIntValue Japan (cal 0)",
  959. &NumErrors );
  960. //
  961. // CALTYPE values - Japan.
  962. //
  963. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  964. {
  965. CalendarCtr = 0;
  966. rc = EnumCalendarInfoA( MyFuncCalendarA,
  967. 0x0411,
  968. 1,
  969. pCalFlag[ctr] );
  970. CheckReturnValidEnumLoop( rc,
  971. TRUE,
  972. CalendarCtr,
  973. pCalJapan_1[ctr],
  974. "A version Japan (cal 1) Calendar Flag",
  975. pCalFlag[ctr],
  976. &NumErrors );
  977. }
  978. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  979. {
  980. CalendarCtr = 0;
  981. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  982. 0x0411,
  983. 1,
  984. pCalFlag[ctr] );
  985. CheckReturnValidEnumLoop( rc,
  986. TRUE,
  987. CalendarCtr,
  988. pCalJapan_1[ctr],
  989. "Ex A version Japan (cal 1) Calendar Flag",
  990. pCalFlag[ctr],
  991. &NumErrors );
  992. }
  993. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  994. {
  995. CalendarCtr = 0;
  996. rc = EnumCalendarInfoA( MyFuncCalendarA,
  997. 0x0411,
  998. 2,
  999. pCalFlag[ctr] );
  1000. CheckReturnValidEnumLoop( rc,
  1001. TRUE,
  1002. CalendarCtr,
  1003. pCalJapan_2[ctr],
  1004. "A version Japan (cal 2) Calendar Flag",
  1005. pCalFlag[ctr],
  1006. &NumErrors );
  1007. }
  1008. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  1009. {
  1010. CalendarCtr = 0;
  1011. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1012. 0x0411,
  1013. 2,
  1014. pCalFlag[ctr] );
  1015. CheckReturnValidEnumLoop( rc,
  1016. TRUE,
  1017. CalendarCtr,
  1018. pCalJapan_2[ctr],
  1019. "Ex A version Japan (cal 2) Calendar Flag",
  1020. pCalFlag[ctr],
  1021. &NumErrors );
  1022. }
  1023. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  1024. {
  1025. CalendarCtr = 0;
  1026. rc = EnumCalendarInfoA( MyFuncCalendarA,
  1027. 0x0411,
  1028. 3,
  1029. pCalFlag[ctr] );
  1030. CheckReturnValidEnumLoop( rc,
  1031. TRUE,
  1032. CalendarCtr,
  1033. pCalJapan_3[ctr],
  1034. "A version Japan (cal 3) Calendar Flag",
  1035. pCalFlag[ctr],
  1036. &NumErrors );
  1037. }
  1038. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  1039. {
  1040. CalendarCtr = 0;
  1041. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1042. 0x0411,
  1043. 3,
  1044. pCalFlag[ctr] );
  1045. CheckReturnValidEnumLoop( rc,
  1046. TRUE,
  1047. CalendarCtr,
  1048. pCalJapan_3[ctr],
  1049. "Ex A version Japan (cal 3) Calendar Flag",
  1050. pCalFlag[ctr],
  1051. &NumErrors );
  1052. }
  1053. //
  1054. // English - Enumerate ALL Calendars.
  1055. //
  1056. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  1057. {
  1058. CalendarCtr = 0;
  1059. rc = EnumCalendarInfoA( MyFuncCalendarA,
  1060. 0x0409,
  1061. ENUM_ALL_CALENDARS,
  1062. pCalFlag[ctr] );
  1063. CheckReturnValidEnumLoop( rc,
  1064. TRUE,
  1065. CalendarCtr,
  1066. pCalEnglish[ctr],
  1067. "A version English (all cal) Calendar Flag",
  1068. pCalFlag[ctr],
  1069. &NumErrors );
  1070. }
  1071. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  1072. {
  1073. CalendarCtr = 0;
  1074. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1075. 0x0409,
  1076. ENUM_ALL_CALENDARS,
  1077. pCalFlag[ctr] );
  1078. CheckReturnValidEnumLoop( rc,
  1079. TRUE,
  1080. CalendarCtr,
  1081. pCalEnglish[ctr],
  1082. "Ex A version English (all cal) Calendar Flag",
  1083. pCalFlag[ctr],
  1084. &NumErrors );
  1085. }
  1086. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  1087. {
  1088. CalendarCtr = 0;
  1089. rc = EnumCalendarInfoA( MyFuncCalendarA,
  1090. 0x0409,
  1091. ENUM_ALL_CALENDARS,
  1092. ctr );
  1093. CheckReturnValidEnumLoop( rc,
  1094. TRUE,
  1095. CalendarCtr,
  1096. 1,
  1097. "A version English (all cal) Day/Month Calendar Flag",
  1098. ctr,
  1099. &NumErrors );
  1100. }
  1101. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  1102. {
  1103. CalendarCtr = 0;
  1104. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1105. 0x0409,
  1106. ENUM_ALL_CALENDARS,
  1107. ctr );
  1108. CheckReturnValidEnumLoop( rc,
  1109. TRUE,
  1110. CalendarCtr,
  1111. 1,
  1112. "Ex A version English (all cal) Day/Month Calendar Flag",
  1113. ctr,
  1114. &NumErrors );
  1115. }
  1116. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  1117. {
  1118. CalendarCtr = 0;
  1119. rc = EnumCalendarInfoA( MyFuncCalendarA,
  1120. 0x0409,
  1121. ENUM_ALL_CALENDARS,
  1122. ctr );
  1123. CheckReturnValidEnumLoop( rc,
  1124. TRUE,
  1125. CalendarCtr,
  1126. 1,
  1127. "A version English (all cal) Day/Month Calendar Flag",
  1128. ctr,
  1129. &NumErrors );
  1130. }
  1131. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  1132. {
  1133. CalendarCtr = 0;
  1134. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1135. 0x0409,
  1136. ENUM_ALL_CALENDARS,
  1137. ctr );
  1138. CheckReturnValidEnumLoop( rc,
  1139. TRUE,
  1140. CalendarCtr,
  1141. 1,
  1142. "Ex A version English (all cal) Day/Month Calendar Flag",
  1143. ctr,
  1144. &NumErrors );
  1145. }
  1146. //
  1147. // Japan - Enumerate ALL Calendars.
  1148. //
  1149. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  1150. {
  1151. CalendarCtr = 0;
  1152. rc = EnumCalendarInfoA( MyFuncCalendarA,
  1153. 0x0411,
  1154. ENUM_ALL_CALENDARS,
  1155. pCalFlag[ctr] );
  1156. CheckReturnValidEnumLoop( rc,
  1157. TRUE,
  1158. CalendarCtr,
  1159. pCalJapan_All[ctr],
  1160. "A version Japan (all cal) Calendar Flag",
  1161. pCalFlag[ctr],
  1162. &NumErrors );
  1163. }
  1164. for (ctr = 0; ctr < NUM_CAL_FLAGS; ctr++)
  1165. {
  1166. CalendarCtr = 0;
  1167. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1168. 0x0411,
  1169. ENUM_ALL_CALENDARS,
  1170. pCalFlag[ctr] );
  1171. CheckReturnValidEnumLoop( rc,
  1172. TRUE,
  1173. CalendarCtr,
  1174. pCalJapan_All[ctr],
  1175. "Ex A version Japan (all cal) Calendar Flag",
  1176. pCalFlag[ctr],
  1177. &NumErrors );
  1178. }
  1179. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  1180. {
  1181. CalendarCtr = 0;
  1182. rc = EnumCalendarInfoA( MyFuncCalendarA,
  1183. 0x0411,
  1184. ENUM_ALL_CALENDARS,
  1185. ctr );
  1186. CheckReturnValidEnumLoop( rc,
  1187. TRUE,
  1188. CalendarCtr,
  1189. 2,
  1190. "A version Japan (all cal) Day/Month Calendar Flag",
  1191. ctr,
  1192. &NumErrors );
  1193. }
  1194. for (ctr = CAL_SDAYNAME1; ctr <= CAL_SMONTHNAME12; ctr++)
  1195. {
  1196. CalendarCtr = 0;
  1197. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1198. 0x0411,
  1199. ENUM_ALL_CALENDARS,
  1200. ctr );
  1201. CheckReturnValidEnumLoop( rc,
  1202. TRUE,
  1203. CalendarCtr,
  1204. 2,
  1205. "Ex A version Japan (all cal) Day/Month Calendar Flag",
  1206. ctr,
  1207. &NumErrors );
  1208. }
  1209. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  1210. {
  1211. CalendarCtr = 0;
  1212. rc = EnumCalendarInfoA( MyFuncCalendarA,
  1213. 0x0411,
  1214. ENUM_ALL_CALENDARS,
  1215. ctr );
  1216. CheckReturnValidEnumLoop( rc,
  1217. TRUE,
  1218. CalendarCtr,
  1219. 2,
  1220. "A version Japan (all cal) Day/Month Calendar Flag",
  1221. ctr,
  1222. &NumErrors );
  1223. }
  1224. for (ctr = CAL_SABBREVMONTHNAME1; ctr <= CAL_SABBREVMONTHNAME12; ctr++)
  1225. {
  1226. CalendarCtr = 0;
  1227. rc = EnumCalendarInfoExA( MyFuncCalendarExA,
  1228. 0x0411,
  1229. ENUM_ALL_CALENDARS,
  1230. ctr );
  1231. CheckReturnValidEnumLoop( rc,
  1232. TRUE,
  1233. CalendarCtr,
  1234. 2,
  1235. "Ex A version Japan (all cal) Day/Month Calendar Flag",
  1236. ctr,
  1237. &NumErrors );
  1238. }
  1239. //
  1240. // Return total number of errors found.
  1241. //
  1242. return (NumErrors);
  1243. }