OLD | NEW |
1 /************************************************************************ | 1 /************************************************************************ |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2014, International Business Machines Corporation | 3 * Copyright (c) 1997-2015, International Business Machines Corporation |
4 * and others. All Rights Reserved. | 4 * and others. All Rights Reserved. |
5 ************************************************************************/ | 5 ************************************************************************/ |
6 #include "unicode/utypes.h" | 6 #include "unicode/utypes.h" |
7 | 7 |
8 #if !UCONFIG_NO_FORMATTING | 8 #if !UCONFIG_NO_FORMATTING |
9 | 9 |
10 #include "caltest.h" | 10 #include "caltest.h" |
11 #include "unicode/dtfmtsym.h" | 11 #include "unicode/dtfmtsym.h" |
12 #include "unicode/gregocal.h" | 12 #include "unicode/gregocal.h" |
13 #include "unicode/localpointer.h" | 13 #include "unicode/localpointer.h" |
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2805 for(int32_t startDay = 1; startDay < 31; startDay++ ) {
| 2805 for(int32_t startDay = 1; startDay < 31; startDay++ ) {
|
2806 setAndTestCalendar(cal, startMonth, startDay, startYear, sta
tus); | 2806 setAndTestCalendar(cal, startMonth, startDay, startYear, sta
tus); |
2807 if(U_FAILURE(status) && startDay == 30) { | 2807 if(U_FAILURE(status) && startDay == 30) { |
2808 status = U_ZERO_ERROR; | 2808 status = U_ZERO_ERROR; |
2809 continue; | 2809 continue; |
2810 } | 2810 } |
2811 TEST_CHECK_STATUS; | 2811 TEST_CHECK_STATUS; |
2812 } | 2812 } |
2813 } | 2813 } |
2814 } | 2814 } |
| 2815 |
| 2816 // ===================================================================== |
2815 | 2817 |
2816 | 2818 typedef struct { |
| 2819 int16_t gYear; |
| 2820 int8_t gMon; |
| 2821 int8_t gDay; |
| 2822 int16_t uYear; |
| 2823 int8_t uMon; |
| 2824 int8_t uDay; |
| 2825 } GregoUmmAlQuraMap; |
| 2826 |
| 2827 // data from |
| 2828 // Official Umm-al-Qura calendar of SA: |
| 2829 // home, http://www.ummulqura.org.sa/default.aspx |
| 2830 // converter, http://www.ummulqura.org.sa/Index.aspx |
| 2831 static const GregoUmmAlQuraMap guMappings[] = { |
| 2832 // gregorian, ummAlQura |
| 2833 // year mo da, year mo da |
| 2834 // (using 1-based months here) |
| 2835 { 1882,11,12, 1300, 1, 1 }, |
| 2836 { 1892, 7,25, 1310, 1, 1 }, |
| 2837 { 1896, 6,12, 1314, 1, 1 }, |
| 2838 { 1898, 5,22, 1316, 1, 1 }, |
| 2839 { 1900, 4,30, 1318, 1, 1 }, |
| 2840 { 1901, 4,20, 1319, 1, 1 }, |
| 2841 { 1902, 4,10, 1320, 1, 1 }, |
| 2842 { 1903, 3,30, 1321, 1, 1 }, |
| 2843 { 1904, 3,19, 1322, 1, 1 }, |
| 2844 { 1905, 3, 8, 1323, 1, 1 }, |
| 2845 { 1906, 2,25, 1324, 1, 1 }, |
| 2846 { 1907, 2,14, 1325, 1, 1 }, |
| 2847 { 1908, 2, 4, 1326, 1, 1 }, |
| 2848 { 1909, 1,23, 1327, 1, 1 }, |
| 2849 { 1910, 1,13, 1328, 1, 1 }, |
| 2850 { 1911, 1, 2, 1329, 1, 1 }, |
| 2851 { 1911,12,22, 1330, 1, 1 }, |
| 2852 { 1912,12,10, 1331, 1, 1 }, |
| 2853 { 1913,11,30, 1332, 1, 1 }, |
| 2854 { 1914,11,19, 1333, 1, 1 }, |
| 2855 { 1915,11, 9, 1334, 1, 1 }, |
| 2856 { 1916,10,28, 1335, 1, 1 }, |
| 2857 { 1917,10,18, 1336, 1, 1 }, |
| 2858 { 1918,10, 7, 1337, 1, 1 }, |
| 2859 { 1919, 9,26, 1338, 1, 1 }, |
| 2860 { 1920, 9,14, 1339, 1, 1 }, |
| 2861 { 1921, 9, 4, 1340, 1, 1 }, |
| 2862 { 1922, 8,24, 1341, 1, 1 }, |
| 2863 { 1923, 8,14, 1342, 1, 1 }, |
| 2864 { 1924, 8, 2, 1343, 1, 1 }, |
| 2865 { 1925, 7,22, 1344, 1, 1 }, |
| 2866 { 1926, 7,11, 1345, 1, 1 }, |
| 2867 { 1927, 6,30, 1346, 1, 1 }, |
| 2868 { 1928, 6,19, 1347, 1, 1 }, |
| 2869 { 1929, 6, 9, 1348, 1, 1 }, |
| 2870 { 1930, 5,29, 1349, 1, 1 }, |
| 2871 { 1931, 5,19, 1350, 1, 1 }, |
| 2872 { 1932, 5, 7, 1351, 1, 1 }, |
| 2873 { 1933, 4,26, 1352, 1, 1 }, |
| 2874 { 1934, 4,15, 1353, 1, 1 }, |
| 2875 { 1935, 4, 5, 1354, 1, 1 }, |
| 2876 { 1936, 3,24, 1355, 1, 1 }, |
| 2877 { 1937, 3,14, 1356, 1, 1 }, |
| 2878 { 1938, 3, 4, 1357, 1, 1 }, |
| 2879 { 1939, 2,21, 1358, 1, 1 }, |
| 2880 { 1940, 2,10, 1359, 1, 1 }, |
| 2881 { 1941, 1,29, 1360, 1, 1 }, |
| 2882 { 1942, 1,18, 1361, 1, 1 }, |
| 2883 { 1943, 1, 8, 1362, 1, 1 }, |
| 2884 { 1943,12,28, 1363, 1, 1 }, |
| 2885 { 1944,12,17, 1364, 1, 1 }, |
| 2886 { 1945,12, 6, 1365, 1, 1 }, |
| 2887 { 1946,11,25, 1366, 1, 1 }, |
| 2888 { 1947,11,14, 1367, 1, 1 }, |
| 2889 { 1948,11, 3, 1368, 1, 1 }, |
| 2890 { 1949,10,23, 1369, 1, 1 }, |
| 2891 { 1950,10,13, 1370, 1, 1 }, |
| 2892 { 1951,10, 3, 1371, 1, 1 }, |
| 2893 { 1952, 9,21, 1372, 1, 1 }, |
| 2894 { 1953, 9,10, 1373, 1, 1 }, |
| 2895 { 1954, 8,30, 1374, 1, 1 }, |
| 2896 { 1955, 8,19, 1375, 1, 1 }, |
| 2897 { 1956, 8, 8, 1376, 1, 1 }, |
| 2898 { 1957, 7,29, 1377, 1, 1 }, |
| 2899 { 1958, 7,18, 1378, 1, 1 }, |
| 2900 { 1959, 7, 8, 1379, 1, 1 }, |
| 2901 { 1960, 6,26, 1380, 1, 1 }, |
| 2902 { 1961, 6,15, 1381, 1, 1 }, |
| 2903 { 1962, 6, 4, 1382, 1, 1 }, |
| 2904 { 1963, 5,24, 1383, 1, 1 }, |
| 2905 { 1964, 5,13, 1384, 1, 1 }, |
| 2906 { 1965, 5, 3, 1385, 1, 1 }, |
| 2907 { 1966, 4,22, 1386, 1, 1 }, |
| 2908 { 1967, 4,11, 1387, 1, 1 }, |
| 2909 { 1968, 3,30, 1388, 1, 1 }, |
| 2910 { 1969, 3,19, 1389, 1, 1 }, |
| 2911 { 1970, 3, 9, 1390, 1, 1 }, |
| 2912 { 1971, 2,27, 1391, 1, 1 }, |
| 2913 { 1972, 2,16, 1392, 1, 1 }, |
| 2914 { 1973, 2, 5, 1393, 1, 1 }, |
| 2915 { 1974, 1,25, 1394, 1, 1 }, |
| 2916 { 1975, 1,14, 1395, 1, 1 }, |
| 2917 { 1976, 1, 3, 1396, 1, 1 }, |
| 2918 { 1976,12,22, 1397, 1, 1 }, |
| 2919 { 1977,12,12, 1398, 1, 1 }, |
| 2920 { 1978,12, 1, 1399, 1, 1 }, |
| 2921 { 1979,11,21, 1400, 1, 1 }, |
| 2922 { 1980,11, 9, 1401, 1, 1 }, |
| 2923 { 1981,10,29, 1402, 1, 1 }, |
| 2924 { 1982,10,18, 1403, 1, 1 }, |
| 2925 { 1983,10, 8, 1404, 1, 1 }, |
| 2926 { 1984, 9,26, 1405, 1, 1 }, |
| 2927 { 1985, 9,16, 1406, 1, 1 }, |
| 2928 { 1986, 9, 6, 1407, 1, 1 }, |
| 2929 { 1987, 8,26, 1408, 1, 1 }, |
| 2930 { 1988, 8,14, 1409, 1, 1 }, |
| 2931 { 1989, 8, 3, 1410, 1, 1 }, |
| 2932 { 1990, 7,23, 1411, 1, 1 }, |
| 2933 { 1991, 7,13, 1412, 1, 1 }, |
| 2934 { 1992, 7, 2, 1413, 1, 1 }, |
| 2935 { 1993, 6,21, 1414, 1, 1 }, |
| 2936 { 1994, 6,11, 1415, 1, 1 }, |
| 2937 { 1995, 5,31, 1416, 1, 1 }, |
| 2938 { 1996, 5,19, 1417, 1, 1 }, |
| 2939 { 1997, 5, 8, 1418, 1, 1 }, |
| 2940 { 1998, 4,28, 1419, 1, 1 }, |
| 2941 { 1999, 4,17, 1420, 1, 1 }, |
| 2942 { 1999, 5,16, 1420, 2, 1 }, |
| 2943 { 1999, 6,15, 1420, 3, 1 }, |
| 2944 { 1999, 7,14, 1420, 4, 1 }, |
| 2945 { 1999, 8,12, 1420, 5, 1 }, |
| 2946 { 1999, 9,11, 1420, 6, 1 }, |
| 2947 { 1999,10,10, 1420, 7, 1 }, |
| 2948 { 1999,11, 9, 1420, 8, 1 }, |
| 2949 { 1999,12, 9, 1420, 9, 1 }, |
| 2950 { 2000, 1, 8, 1420,10, 1 }, |
| 2951 { 2000, 2, 7, 1420,11, 1 }, |
| 2952 { 2000, 3, 7, 1420,12, 1 }, |
| 2953 { 2000, 4, 6, 1421, 1, 1 }, |
| 2954 { 2000, 5, 5, 1421, 2, 1 }, |
| 2955 { 2000, 6, 3, 1421, 3, 1 }, |
| 2956 { 2000, 7, 3, 1421, 4, 1 }, |
| 2957 { 2000, 8, 1, 1421, 5, 1 }, |
| 2958 { 2000, 8,30, 1421, 6, 1 }, |
| 2959 { 2000, 9,28, 1421, 7, 1 }, |
| 2960 { 2000,10,28, 1421, 8, 1 }, |
| 2961 { 2000,11,27, 1421, 9, 1 }, |
| 2962 { 2000,12,27, 1421,10, 1 }, |
| 2963 { 2001, 1,26, 1421,11, 1 }, |
| 2964 { 2001, 2,24, 1421,12, 1 }, |
| 2965 { 2001, 3,26, 1422, 1, 1 }, |
| 2966 { 2001, 4,25, 1422, 2, 1 }, |
| 2967 { 2001, 5,24, 1422, 3, 1 }, |
| 2968 { 2001, 6,22, 1422, 4, 1 }, |
| 2969 { 2001, 7,22, 1422, 5, 1 }, |
| 2970 { 2001, 8,20, 1422, 6, 1 }, |
| 2971 { 2001, 9,18, 1422, 7, 1 }, |
| 2972 { 2001,10,17, 1422, 8, 1 }, |
| 2973 { 2001,11,16, 1422, 9, 1 }, |
| 2974 { 2001,12,16, 1422,10, 1 }, |
| 2975 { 2002, 1,15, 1422,11, 1 }, |
| 2976 { 2002, 2,13, 1422,12, 1 }, |
| 2977 { 2002, 3,15, 1423, 1, 1 }, |
| 2978 { 2002, 4,14, 1423, 2, 1 }, |
| 2979 { 2002, 5,13, 1423, 3, 1 }, |
| 2980 { 2002, 6,12, 1423, 4, 1 }, |
| 2981 { 2002, 7,11, 1423, 5, 1 }, |
| 2982 { 2002, 8,10, 1423, 6, 1 }, |
| 2983 { 2002, 9, 8, 1423, 7, 1 }, |
| 2984 { 2002,10, 7, 1423, 8, 1 }, |
| 2985 { 2002,11, 6, 1423, 9, 1 }, |
| 2986 { 2002,12, 5, 1423,10, 1 }, |
| 2987 { 2003, 1, 4, 1423,11, 1 }, |
| 2988 { 2003, 2, 2, 1423,12, 1 }, |
| 2989 { 2003, 3, 4, 1424, 1, 1 }, |
| 2990 { 2003, 4, 3, 1424, 2, 1 }, |
| 2991 { 2003, 5, 2, 1424, 3, 1 }, |
| 2992 { 2003, 6, 1, 1424, 4, 1 }, |
| 2993 { 2003, 7, 1, 1424, 5, 1 }, |
| 2994 { 2003, 7,30, 1424, 6, 1 }, |
| 2995 { 2003, 8,29, 1424, 7, 1 }, |
| 2996 { 2003, 9,27, 1424, 8, 1 }, |
| 2997 { 2003,10,26, 1424, 9, 1 }, |
| 2998 { 2003,11,25, 1424,10, 1 }, |
| 2999 { 2003,12,24, 1424,11, 1 }, |
| 3000 { 2004, 1,23, 1424,12, 1 }, |
| 3001 { 2004, 2,21, 1425, 1, 1 }, |
| 3002 { 2004, 3,22, 1425, 2, 1 }, |
| 3003 { 2004, 4,20, 1425, 3, 1 }, |
| 3004 { 2004, 5,20, 1425, 4, 1 }, |
| 3005 { 2004, 6,19, 1425, 5, 1 }, |
| 3006 { 2004, 7,18, 1425, 6, 1 }, |
| 3007 { 2004, 8,17, 1425, 7, 1 }, |
| 3008 { 2004, 9,15, 1425, 8, 1 }, |
| 3009 { 2004,10,15, 1425, 9, 1 }, |
| 3010 { 2004,11,14, 1425,10, 1 }, |
| 3011 { 2004,12,13, 1425,11, 1 }, |
| 3012 { 2005, 1,12, 1425,12, 1 }, |
| 3013 { 2005, 2,10, 1426, 1, 1 }, |
| 3014 { 2005, 3,11, 1426, 2, 1 }, |
| 3015 { 2005, 4,10, 1426, 3, 1 }, |
| 3016 { 2005, 5, 9, 1426, 4, 1 }, |
| 3017 { 2005, 6, 8, 1426, 5, 1 }, |
| 3018 { 2005, 7, 7, 1426, 6, 1 }, |
| 3019 { 2005, 8, 6, 1426, 7, 1 }, |
| 3020 { 2005, 9, 5, 1426, 8, 1 }, |
| 3021 { 2005,10, 4, 1426, 9, 1 }, |
| 3022 { 2005,11, 3, 1426,10, 1 }, |
| 3023 { 2005,12, 3, 1426,11, 1 }, |
| 3024 { 2006, 1, 1, 1426,12, 1 }, |
| 3025 { 2006, 1,31, 1427, 1, 1 }, |
| 3026 { 2006, 3, 1, 1427, 2, 1 }, |
| 3027 { 2006, 3,30, 1427, 3, 1 }, |
| 3028 { 2006, 4,29, 1427, 4, 1 }, |
| 3029 { 2006, 5,28, 1427, 5, 1 }, |
| 3030 { 2006, 6,27, 1427, 6, 1 }, |
| 3031 { 2006, 7,26, 1427, 7, 1 }, |
| 3032 { 2006, 8,25, 1427, 8, 1 }, |
| 3033 { 2006, 9,24, 1427, 9, 1 }, |
| 3034 { 2006,10,23, 1427,10, 1 }, |
| 3035 { 2006,11,22, 1427,11, 1 }, |
| 3036 { 2006,12,22, 1427,12, 1 }, |
| 3037 { 2007, 1,20, 1428, 1, 1 }, |
| 3038 { 2007, 2,19, 1428, 2, 1 }, |
| 3039 { 2007, 3,20, 1428, 3, 1 }, |
| 3040 { 2007, 4,18, 1428, 4, 1 }, |
| 3041 { 2007, 5,18, 1428, 5, 1 }, |
| 3042 { 2007, 6,16, 1428, 6, 1 }, |
| 3043 { 2007, 7,15, 1428, 7, 1 }, |
| 3044 { 2007, 8,14, 1428, 8, 1 }, |
| 3045 { 2007, 9,13, 1428, 9, 1 }, |
| 3046 { 2007,10,13, 1428,10, 1 }, |
| 3047 { 2007,11,11, 1428,11, 1 }, |
| 3048 { 2007,12,11, 1428,12, 1 }, |
| 3049 { 2008, 1,10, 1429, 1, 1 }, |
| 3050 { 2008, 2, 8, 1429, 2, 1 }, |
| 3051 { 2008, 3, 9, 1429, 3, 1 }, |
| 3052 { 2008, 4, 7, 1429, 4, 1 }, |
| 3053 { 2008, 5, 6, 1429, 5, 1 }, |
| 3054 { 2008, 6, 5, 1429, 6, 1 }, |
| 3055 { 2008, 7, 4, 1429, 7, 1 }, |
| 3056 { 2008, 8, 2, 1429, 8, 1 }, |
| 3057 { 2008, 9, 1, 1429, 9, 1 }, |
| 3058 { 2008,10, 1, 1429,10, 1 }, |
| 3059 { 2008,10,30, 1429,11, 1 }, |
| 3060 { 2008,11,29, 1429,12, 1 }, |
| 3061 { 2008,12,29, 1430, 1, 1 }, |
| 3062 { 2009, 1,27, 1430, 2, 1 }, |
| 3063 { 2009, 2,26, 1430, 3, 1 }, |
| 3064 { 2009, 3,28, 1430, 4, 1 }, |
| 3065 { 2009, 4,26, 1430, 5, 1 }, |
| 3066 { 2009, 5,25, 1430, 6, 1 }, |
| 3067 { 2009, 6,24, 1430, 7, 1 }, |
| 3068 { 2009, 7,23, 1430, 8, 1 }, |
| 3069 { 2009, 8,22, 1430, 9, 1 }, |
| 3070 { 2009, 9,20, 1430,10, 1 }, |
| 3071 { 2009,10,20, 1430,11, 1 }, |
| 3072 { 2009,11,18, 1430,12, 1 }, |
| 3073 { 2009,12,18, 1431, 1, 1 }, |
| 3074 { 2010, 1,16, 1431, 2, 1 }, |
| 3075 { 2010, 2,15, 1431, 3, 1 }, |
| 3076 { 2010, 3,17, 1431, 4, 1 }, |
| 3077 { 2010, 4,15, 1431, 5, 1 }, |
| 3078 { 2010, 5,15, 1431, 6, 1 }, |
| 3079 { 2010, 6,13, 1431, 7, 1 }, |
| 3080 { 2010, 7,13, 1431, 8, 1 }, |
| 3081 { 2010, 8,11, 1431, 9, 1 }, |
| 3082 { 2010, 9,10, 1431,10, 1 }, |
| 3083 { 2010,10, 9, 1431,11, 1 }, |
| 3084 { 2010,11, 7, 1431,12, 1 }, |
| 3085 { 2010,12, 7, 1432, 1, 1 }, |
| 3086 { 2011, 1, 5, 1432, 2, 1 }, |
| 3087 { 2011, 2, 4, 1432, 3, 1 }, |
| 3088 { 2011, 3, 6, 1432, 4, 1 }, |
| 3089 { 2011, 4, 5, 1432, 5, 1 }, |
| 3090 { 2011, 5, 4, 1432, 6, 1 }, |
| 3091 { 2011, 6, 3, 1432, 7, 1 }, |
| 3092 { 2011, 7, 2, 1432, 8, 1 }, |
| 3093 { 2011, 8, 1, 1432, 9, 1 }, |
| 3094 { 2011, 8,30, 1432,10, 1 }, |
| 3095 { 2011, 9,29, 1432,11, 1 }, |
| 3096 { 2011,10,28, 1432,12, 1 }, |
| 3097 { 2011,11,26, 1433, 1, 1 }, |
| 3098 { 2011,12,26, 1433, 2, 1 }, |
| 3099 { 2012, 1,24, 1433, 3, 1 }, |
| 3100 { 2012, 2,23, 1433, 4, 1 }, |
| 3101 { 2012, 3,24, 1433, 5, 1 }, |
| 3102 { 2012, 4,22, 1433, 6, 1 }, |
| 3103 { 2012, 5,22, 1433, 7, 1 }, |
| 3104 { 2012, 6,21, 1433, 8, 1 }, |
| 3105 { 2012, 7,20, 1433, 9, 1 }, |
| 3106 { 2012, 8,19, 1433,10, 1 }, |
| 3107 { 2012, 9,17, 1433,11, 1 }, |
| 3108 { 2012,10,17, 1433,12, 1 }, |
| 3109 { 2012,11,15, 1434, 1, 1 }, |
| 3110 { 2012,12,14, 1434, 2, 1 }, |
| 3111 { 2013, 1,13, 1434, 3, 1 }, |
| 3112 { 2013, 2,11, 1434, 4, 1 }, |
| 3113 { 2013, 3,13, 1434, 5, 1 }, |
| 3114 { 2013, 4,11, 1434, 6, 1 }, |
| 3115 { 2013, 5,11, 1434, 7, 1 }, |
| 3116 { 2013, 6,10, 1434, 8, 1 }, |
| 3117 { 2013, 7, 9, 1434, 9, 1 }, |
| 3118 { 2013, 8, 8, 1434,10, 1 }, |
| 3119 { 2013, 9, 7, 1434,11, 1 }, |
| 3120 { 2013,10, 6, 1434,12, 1 }, |
| 3121 { 2013,11, 4, 1435, 1, 1 }, |
| 3122 { 2013,12, 4, 1435, 2, 1 }, |
| 3123 { 2014, 1, 2, 1435, 3, 1 }, |
| 3124 { 2014, 2, 1, 1435, 4, 1 }, |
| 3125 { 2014, 3, 2, 1435, 5, 1 }, |
| 3126 { 2014, 4, 1, 1435, 6, 1 }, |
| 3127 { 2014, 4,30, 1435, 7, 1 }, |
| 3128 { 2014, 5,30, 1435, 8, 1 }, |
| 3129 { 2014, 6,28, 1435, 9, 1 }, |
| 3130 { 2014, 7,28, 1435,10, 1 }, |
| 3131 { 2014, 8,27, 1435,11, 1 }, |
| 3132 { 2014, 9,25, 1435,12, 1 }, |
| 3133 { 2014,10,25, 1436, 1, 1 }, |
| 3134 { 2014,11,23, 1436, 2, 1 }, |
| 3135 { 2014,12,23, 1436, 3, 1 }, |
| 3136 { 2015, 1,21, 1436, 4, 1 }, |
| 3137 { 2015, 2,20, 1436, 5, 1 }, |
| 3138 { 2015, 3,21, 1436, 6, 1 }, |
| 3139 { 2015, 4,20, 1436, 7, 1 }, |
| 3140 { 2015, 5,19, 1436, 8, 1 }, |
| 3141 { 2015, 6,18, 1436, 9, 1 }, |
| 3142 { 2015, 7,17, 1436,10, 1 }, |
| 3143 { 2015, 8,16, 1436,11, 1 }, |
| 3144 { 2015, 9,14, 1436,12, 1 }, |
| 3145 { 2015,10,14, 1437, 1, 1 }, |
| 3146 { 2015,11,13, 1437, 2, 1 }, |
| 3147 { 2015,12,12, 1437, 3, 1 }, |
| 3148 { 2016, 1,11, 1437, 4, 1 }, |
| 3149 { 2016, 2,10, 1437, 5, 1 }, |
| 3150 { 2016, 3,10, 1437, 6, 1 }, |
| 3151 { 2016, 4, 8, 1437, 7, 1 }, |
| 3152 { 2016, 5, 8, 1437, 8, 1 }, |
| 3153 { 2016, 6, 6, 1437, 9, 1 }, |
| 3154 { 2016, 7, 6, 1437,10, 1 }, |
| 3155 { 2016, 8, 4, 1437,11, 1 }, |
| 3156 { 2016, 9, 2, 1437,12, 1 }, |
| 3157 { 2016,10, 2, 1438, 1, 1 }, |
| 3158 { 2016,11, 1, 1438, 2, 1 }, |
| 3159 { 2016,11,30, 1438, 3, 1 }, |
| 3160 { 2016,12,30, 1438, 4, 1 }, |
| 3161 { 2017, 1,29, 1438, 5, 1 }, |
| 3162 { 2017, 2,28, 1438, 6, 1 }, |
| 3163 { 2017, 3,29, 1438, 7, 1 }, |
| 3164 { 2017, 4,27, 1438, 8, 1 }, |
| 3165 { 2017, 5,27, 1438, 9, 1 }, |
| 3166 { 2017, 6,25, 1438,10, 1 }, |
| 3167 { 2017, 7,24, 1438,11, 1 }, |
| 3168 { 2017, 8,23, 1438,12, 1 }, |
| 3169 { 2017, 9,21, 1439, 1, 1 }, |
| 3170 { 2017,10,21, 1439, 2, 1 }, |
| 3171 { 2017,11,19, 1439, 3, 1 }, |
| 3172 { 2017,12,19, 1439, 4, 1 }, |
| 3173 { 2018, 1,18, 1439, 5, 1 }, |
| 3174 { 2018, 2,17, 1439, 6, 1 }, |
| 3175 { 2018, 3,18, 1439, 7, 1 }, |
| 3176 { 2018, 4,17, 1439, 8, 1 }, |
| 3177 { 2018, 5,16, 1439, 9, 1 }, |
| 3178 { 2018, 6,15, 1439,10, 1 }, |
| 3179 { 2018, 7,14, 1439,11, 1 }, |
| 3180 { 2018, 8,12, 1439,12, 1 }, |
| 3181 { 2018, 9,11, 1440, 1, 1 }, |
| 3182 { 2019, 8,31, 1441, 1, 1 }, |
| 3183 { 2020, 8,20, 1442, 1, 1 }, |
| 3184 { 2021, 8, 9, 1443, 1, 1 }, |
| 3185 { 2022, 7,30, 1444, 1, 1 }, |
| 3186 { 2023, 7,19, 1445, 1, 1 }, |
| 3187 { 2024, 7, 7, 1446, 1, 1 }, |
| 3188 { 2025, 6,26, 1447, 1, 1 }, |
| 3189 { 2026, 6,16, 1448, 1, 1 }, |
| 3190 { 2027, 6, 6, 1449, 1, 1 }, |
| 3191 { 2028, 5,25, 1450, 1, 1 }, |
| 3192 { 2029, 5,14, 1451, 1, 1 }, |
| 3193 { 2030, 5, 4, 1452, 1, 1 }, |
| 3194 { 2031, 4,23, 1453, 1, 1 }, |
| 3195 { 2032, 4,11, 1454, 1, 1 }, |
| 3196 { 2033, 4, 1, 1455, 1, 1 }, |
| 3197 { 2034, 3,22, 1456, 1, 1 }, |
| 3198 { 2035, 3,11, 1457, 1, 1 }, |
| 3199 { 2036, 2,29, 1458, 1, 1 }, |
| 3200 { 2037, 2,17, 1459, 1, 1 }, |
| 3201 { 2038, 2, 6, 1460, 1, 1 }, |
| 3202 { 2039, 1,26, 1461, 1, 1 }, |
| 3203 { 2040, 1,15, 1462, 1, 1 }, |
| 3204 { 2041, 1, 4, 1463, 1, 1 }, |
| 3205 { 2041,12,25, 1464, 1, 1 }, |
| 3206 { 2042,12,14, 1465, 1, 1 }, |
| 3207 { 2043,12, 3, 1466, 1, 1 }, |
| 3208 { 2044,11,21, 1467, 1, 1 }, |
| 3209 { 2045,11,11, 1468, 1, 1 }, |
| 3210 { 2046,10,31, 1469, 1, 1 }, |
| 3211 { 2047,10,21, 1470, 1, 1 }, |
| 3212 { 2048,10, 9, 1471, 1, 1 }, |
| 3213 { 2049, 9,29, 1472, 1, 1 }, |
| 3214 { 2050, 9,18, 1473, 1, 1 }, |
| 3215 { 2051, 9, 7, 1474, 1, 1 }, |
| 3216 { 2052, 8,26, 1475, 1, 1 }, |
| 3217 { 2053, 8,15, 1476, 1, 1 }, |
| 3218 { 2054, 8, 5, 1477, 1, 1 }, |
| 3219 { 2055, 7,26, 1478, 1, 1 }, |
| 3220 { 2056, 7,14, 1479, 1, 1 }, |
| 3221 { 2057, 7, 3, 1480, 1, 1 }, |
| 3222 { 2058, 6,22, 1481, 1, 1 }, |
| 3223 { 2059, 6,11, 1482, 1, 1 }, |
| 3224 { 2061, 5,21, 1484, 1, 1 }, |
| 3225 { 2063, 4,30, 1486, 1, 1 }, |
| 3226 { 2065, 4, 7, 1488, 1, 1 }, |
| 3227 { 2067, 3,17, 1490, 1, 1 }, |
| 3228 { 2069, 2,23, 1492, 1, 1 }, |
| 3229 { 2071, 2, 2, 1494, 1, 1 }, |
| 3230 { 2073, 1,10, 1496, 1, 1 }, |
| 3231 { 2074,12,20, 1498, 1, 1 }, |
| 3232 { 2076,11,28, 1500, 1, 1 }, |
| 3233 { 0, 0, 0, 0, 0, 0 }, // terminator |
| 3234 }; |
| 3235 |
| 3236 static const UChar zoneSA[] = {0x41,0x73,0x69,0x61,0x2F,0x52,0x69,0x79,0x61,0x64
,0x68,0}; // "Asia/Riyadh" |
| 3237 |
2817 void CalendarTest::TestIslamicUmAlQura() { | 3238 void CalendarTest::TestIslamicUmAlQura() { |
2818 | 3239 |
2819 UErrorCode status = U_ZERO_ERROR; | 3240 UErrorCode status = U_ZERO_ERROR; |
2820 Locale islamicLoc("ar_SA@calendar=islamic-umalqura"); | 3241 Locale umalquraLoc("ar_SA@calendar=islamic-umalqura"); |
2821 Calendar* tstCal = Calendar::createInstance(islamicLoc, status); | 3242 Locale gregoLoc("ar_SA@calendar=gregorian"); |
| 3243 TimeZone* tzSA = TimeZone::createTimeZone(UnicodeString(TRUE, zoneSA, -1)); |
| 3244 Calendar* tstCal = Calendar::createInstance(*((const TimeZone *)tzSA), umalq
uraLoc, status); |
| 3245 Calendar* gregCal = Calendar::createInstance(*((const TimeZone *)tzSA), greg
oLoc, status); |
2822 | 3246 |
2823 IslamicCalendar* iCal = (IslamicCalendar*)tstCal; | 3247 IslamicCalendar* iCal = (IslamicCalendar*)tstCal; |
2824 if(strcmp(iCal->getType(), "islamic-umalqura") != 0) { | 3248 if(strcmp(iCal->getType(), "islamic-umalqura") != 0) { |
2825 errln("wrong type of calendar created - %s", iCal->getType()); | 3249 errln("wrong type of calendar created - %s", iCal->getType()); |
2826 } | 3250 } |
2827 | |
2828 | 3251 |
2829 int32_t firstYear = 1318; | 3252 int32_t firstYear = 1318; |
2830 int32_t lastYear = 1368; // just enough to be pretty sure | 3253 int32_t lastYear = 1368; // just enough to be pretty sure |
2831 //int32_t lastYear = 1480; // the whole shootin' match | 3254 //int32_t lastYear = 1480; // the whole shootin' match |
2832 | 3255 |
2833 tstCal->clear(); | 3256 tstCal->clear(); |
2834 tstCal->setLenient(FALSE); | 3257 tstCal->setLenient(FALSE); |
2835 | 3258 |
2836 int32_t day=0, month=0, year=0, initDay = 27, initMonth = IslamicCalendar::R
AJAB, initYear = 1434; | 3259 int32_t day=0, month=0, year=0, initDay = 27, initMonth = IslamicCalendar::R
AJAB, initYear = 1434; |
2837 | 3260 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2875 | 3298 |
2876 status = U_ZERO_ERROR; | 3299 status = U_ZERO_ERROR; |
2877 tstCal->clear(); | 3300 tstCal->clear(); |
2878 initMonth = 3; | 3301 initMonth = 3; |
2879 initDay = 30; | 3302 initDay = 30; |
2880 setAndTestCalendar( tstCal, initMonth, initDay, initYear, status); | 3303 setAndTestCalendar( tstCal, initMonth, initDay, initYear, status); |
2881 TEST_CHECK_STATUS; | 3304 TEST_CHECK_STATUS; |
2882 | 3305 |
2883 SimpleDateFormat* formatter = new SimpleDateFormat("yyyy-MM-dd", Locale::get
US(), status); | 3306 SimpleDateFormat* formatter = new SimpleDateFormat("yyyy-MM-dd", Locale::get
US(), status); |
2884 UDate date = formatter->parse("1975-05-06", status); | 3307 UDate date = formatter->parse("1975-05-06", status); |
2885 Calendar* is_cal = Calendar::createInstance(islamicLoc, status); | 3308 Calendar* is_cal = Calendar::createInstance(umalquraLoc, status); |
2886 is_cal->setTime(date, status); | 3309 is_cal->setTime(date, status); |
2887 int32_t is_day = is_cal->get(UCAL_DAY_OF_MONTH,status); | 3310 int32_t is_day = is_cal->get(UCAL_DAY_OF_MONTH,status); |
2888 int32_t is_month = is_cal->get(UCAL_MONTH,status); | 3311 int32_t is_month = is_cal->get(UCAL_MONTH,status); |
2889 int32_t is_year = is_cal->get(UCAL_YEAR,status); | 3312 int32_t is_year = is_cal->get(UCAL_YEAR,status); |
2890 TEST_CHECK_STATUS; | 3313 TEST_CHECK_STATUS; |
2891 if(is_day != 24 || is_month != IslamicCalendar::RABI_2 || is_year != 1395) | 3314 if(is_day != 24 || is_month != IslamicCalendar::RABI_2 || is_year != 1395) |
2892 errln("unexpected conversion date month %i not %i or day %i not 24 or ye
ar %i not 1395", is_month, IslamicCalendar::RABI_2, is_day, is_year); | 3315 errln("unexpected conversion date month %i not %i or day %i not 24 or ye
ar %i not 1395", is_month, IslamicCalendar::RABI_2, is_day, is_year); |
2893 | 3316 |
2894 UDate date2 = is_cal->getTime(status); | 3317 UDate date2 = is_cal->getTime(status); |
2895 TEST_CHECK_STATUS; | 3318 TEST_CHECK_STATUS; |
2896 if(date2 != date) { | 3319 if(date2 != date) { |
2897 errln("before(%f) and after(%f) dates don't match up!",date, date2); | 3320 errln("before(%f) and after(%f) dates don't match up!",date, date2); |
2898 } | 3321 } |
| 3322 |
| 3323 // check against data |
| 3324 const GregoUmmAlQuraMap* guMapPtr; |
| 3325 gregCal->clear(); |
| 3326 tstCal->clear(); |
| 3327 for (guMapPtr = guMappings; guMapPtr->gYear != 0; guMapPtr++) { |
| 3328 status = U_ZERO_ERROR; |
| 3329 gregCal->set(guMapPtr->gYear, guMapPtr->gMon - 1, guMapPtr->gDay, 12, 0)
; |
| 3330 date = gregCal->getTime(status); |
| 3331 tstCal->setTime(date, status); |
| 3332 int32_t uYear = tstCal->get(UCAL_YEAR, status); |
| 3333 int32_t uMon = tstCal->get(UCAL_MONTH, status) + 1; |
| 3334 int32_t uDay = tstCal->get(UCAL_DATE, status); |
| 3335 if(U_FAILURE(status)) { |
| 3336 errln("For gregorian %4d-%02d-%02d, get status %s", |
| 3337 guMapPtr->gYear, guMapPtr->gMon, guMapPtr->gDay, u_errorName
(status) ); |
| 3338 } else if (uYear != guMapPtr->uYear || uMon != guMapPtr->uMon || uDay !=
guMapPtr->uDay) { |
| 3339 errln("For gregorian %4d-%02d-%02d, expect umalqura %4d-%02d-%02d, g
et %4d-%02d-%02d", |
| 3340 guMapPtr->gYear, guMapPtr->gMon, guMapPtr->gDay, |
| 3341 guMapPtr->uYear, guMapPtr->uMon, guMapPtr->uDay, uYear, uMon
, uDay ); |
| 3342 } |
| 3343 } |
2899 | 3344 |
2900 delete is_cal; | 3345 delete is_cal; |
2901 delete formatter; | 3346 delete formatter; |
| 3347 delete gregCal; |
2902 delete tstCal; | 3348 delete tstCal; |
| 3349 delete tzSA; |
2903 } | 3350 } |
2904 | 3351 |
2905 void CalendarTest::TestIslamicTabularDates() { | 3352 void CalendarTest::TestIslamicTabularDates() { |
2906 UErrorCode status = U_ZERO_ERROR; | 3353 UErrorCode status = U_ZERO_ERROR; |
2907 Locale islamicLoc("ar_SA@calendar=islamic-civil"); | 3354 Locale islamicLoc("ar_SA@calendar=islamic-civil"); |
2908 Locale tblaLoc("ar_SA@calendar=islamic-tbla"); | 3355 Locale tblaLoc("ar_SA@calendar=islamic-tbla"); |
2909 SimpleDateFormat* formatter = new SimpleDateFormat("yyyy-MM-dd", Locale::get
US(), status); | 3356 SimpleDateFormat* formatter = new SimpleDateFormat("yyyy-MM-dd", Locale::get
US(), status); |
2910 UDate date = formatter->parse("1975-05-06", status); | 3357 UDate date = formatter->parse("1975-05-06", status); |
2911 | 3358 |
2912 Calendar* tstCal = Calendar::createInstance(islamicLoc, status); | 3359 Calendar* tstCal = Calendar::createInstance(islamicLoc, status); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3176 + ", delta:" + AAZTDATA[i].deltaDays + " day(s), opt:" +
optDisp | 3623 + ", delta:" + AAZTDATA[i].deltaDays + " day(s), opt:" +
optDisp |
3177 + ", result:" + res.toString(buf, sizeof(buf)) | 3624 + ", result:" + res.toString(buf, sizeof(buf)) |
3178 + " - expected:" + AAZTDATA[i].expected.toString(buf, si
zeof(buf))); | 3625 + " - expected:" + AAZTDATA[i].expected.toString(buf, si
zeof(buf))); |
3179 } | 3626 } |
3180 } | 3627 } |
3181 } | 3628 } |
3182 | 3629 |
3183 #endif /* #if !UCONFIG_NO_FORMATTING */ | 3630 #endif /* #if !UCONFIG_NO_FORMATTING */ |
3184 | 3631 |
3185 //eof | 3632 //eof |
OLD | NEW |