6
6
7
7
Test (TEST_SUITE , availableCanonicalCalendarsIsSorted )
8
8
{
9
- const char * * calendars ;
10
- int calendarsLength ;
11
-
12
- calendars = malloc (sizeof (char * ) * ECMA402_CALENDAR_CAPACITY );
13
- calendarsLength = ecma402_availableCanonicalCalendars (calendars );
9
+ const char * * calendars = (const char * * )malloc (sizeof (char * ) * ECMA402_CALENDAR_CAPACITY );
10
+ const int calendarsLength = ecma402_availableCanonicalCalendars (calendars );
14
11
15
12
cr_expect (gt (int , calendarsLength , 0 ));
16
13
@@ -22,16 +19,13 @@ Test(TEST_SUITE, availableCanonicalCalendarsIsSorted)
22
19
previous = calendars [i ];
23
20
}
24
21
25
- free (calendars );
22
+ free (( void * ) calendars );
26
23
}
27
24
28
25
Test (TEST_SUITE , availableCanonicalCalendarsReturnsOnlyBcp47Values )
29
26
{
30
- const char * * calendars ;
31
- int calendarsLength ;
32
-
33
- calendars = malloc (sizeof (char * ) * ECMA402_CALENDAR_CAPACITY );
34
- calendarsLength = ecma402_availableCanonicalCalendars (calendars );
27
+ const char * * calendars = (const char * * )malloc (sizeof (char * ) * ECMA402_CALENDAR_CAPACITY );
28
+ const int calendarsLength = ecma402_availableCanonicalCalendars (calendars );
35
29
36
30
cr_expect (gt (int , calendarsLength , 0 ));
37
31
@@ -41,23 +35,19 @@ Test(TEST_SUITE, availableCanonicalCalendarsReturnsOnlyBcp47Values)
41
35
cr_expect (ne (str , (char * )calendars [i ], "islamicc" ));
42
36
}
43
37
44
- free (calendars );
38
+ free (( void * ) calendars );
45
39
}
46
40
47
41
Test (TEST_SUITE , calendarsOfLocaleReturnsPreferredCalendar )
48
42
{
49
- ecma402_locale * locale ;
50
- const char * * calendars ;
51
- int calendarsLength ;
52
-
53
- locale = ecma402_initLocale ("en-US-u-ca-buddhist" );
54
- calendars = (const char * * )malloc (sizeof (char * ) * ECMA402_LOCALE_CALENDAR_CAPACITY );
55
- calendarsLength = ecma402_calendarsOfLocale (locale , calendars );
43
+ ecma402_locale * locale = ecma402_initLocale ("en-US-u-ca-buddhist" );
44
+ const char * * calendars = (const char * * )malloc (sizeof (char * ) * ECMA402_LOCALE_CALENDAR_CAPACITY );
45
+ const int calendarsLength = ecma402_calendarsOfLocale (locale , calendars );
56
46
57
47
cr_assert (eq (int , calendarsLength , 1 ));
58
48
cr_expect (eq (str , (char * )calendars [0 ], "buddhist" ));
59
49
60
- free (calendars );
50
+ free (( void * ) calendars );
61
51
ecma402_freeLocale (locale );
62
52
}
63
53
@@ -73,7 +63,7 @@ Test(TEST_SUITE, calendarsOfLocaleReturnsExpectedCalendars)
73
63
calendarsLength = ecma402_calendarsOfLocale (locale , calendars );
74
64
cr_assert (eq (int , calendarsLength , 1 ));
75
65
cr_expect (eq (str , (char * )calendars [0 ], "gregory" ));
76
- free (calendars );
66
+ free (( void * ) calendars );
77
67
ecma402_freeLocale (locale );
78
68
79
69
// "und" has calendars of ["gregory"]
@@ -82,7 +72,7 @@ Test(TEST_SUITE, calendarsOfLocaleReturnsExpectedCalendars)
82
72
calendarsLength = ecma402_calendarsOfLocale (locale , calendars );
83
73
cr_assert (eq (int , calendarsLength , 1 ));
84
74
cr_expect (eq (str , (char * )calendars [0 ], "gregory" ));
85
- free (calendars );
75
+ free (( void * ) calendars );
86
76
ecma402_freeLocale (locale );
87
77
88
78
// "zh" has calendars of ["gregory", "chinese"]
@@ -92,7 +82,7 @@ Test(TEST_SUITE, calendarsOfLocaleReturnsExpectedCalendars)
92
82
cr_assert (eq (int , calendarsLength , 2 ));
93
83
cr_expect (eq (str , (char * )calendars [0 ], "gregory" ));
94
84
cr_expect (eq (str , (char * )calendars [1 ], "chinese" ));
95
- free (calendars );
85
+ free (( void * ) calendars );
96
86
ecma402_freeLocale (locale );
97
87
98
88
// "jp" has calendars of ["gregory"]
@@ -101,7 +91,7 @@ Test(TEST_SUITE, calendarsOfLocaleReturnsExpectedCalendars)
101
91
calendarsLength = ecma402_calendarsOfLocale (locale , calendars );
102
92
cr_assert (eq (int , calendarsLength , 1 ));
103
93
cr_expect (eq (str , (char * )calendars [0 ], "gregory" ));
104
- free (calendars );
94
+ free (( void * ) calendars );
105
95
ecma402_freeLocale (locale );
106
96
107
97
// "jp-JP" has calendars of ["gregory", "japanese"]
@@ -111,7 +101,7 @@ Test(TEST_SUITE, calendarsOfLocaleReturnsExpectedCalendars)
111
101
cr_assert (eq (int , calendarsLength , 2 ));
112
102
cr_expect (eq (str , (char * )calendars [0 ], "gregory" ));
113
103
cr_expect (eq (str , (char * )calendars [1 ], "japanese" ));
114
- free (calendars );
104
+ free (( void * ) calendars );
115
105
ecma402_freeLocale (locale );
116
106
117
107
// "und-Thai" has calendars of ["buddhist", "gregory"]
@@ -121,22 +111,18 @@ Test(TEST_SUITE, calendarsOfLocaleReturnsExpectedCalendars)
121
111
cr_assert (eq (int , calendarsLength , 2 ));
122
112
cr_expect (eq (str , (char * )calendars [0 ], "buddhist" ));
123
113
cr_expect (eq (str , (char * )calendars [1 ], "gregory" ));
124
- free (calendars );
114
+ free (( void * ) calendars );
125
115
ecma402_freeLocale (locale );
126
116
}
127
117
128
118
Test (TEST_SUITE , calendarsOfLocaleReturnsNoCalendarsForInvalidLocaleId )
129
119
{
130
- ecma402_locale * locale ;
131
- const char * * calendars ;
132
- int calendarsLength ;
133
-
134
- locale = ecma402_initLocale ("foobar-baz" );
135
- calendars = (const char * * )malloc (sizeof (char * ) * ECMA402_LOCALE_CALENDAR_CAPACITY );
136
- calendarsLength = ecma402_calendarsOfLocale (locale , calendars );
120
+ ecma402_locale * locale = ecma402_initLocale ("foobar-baz" );
121
+ const char * * calendars = (const char * * )malloc (sizeof (char * ) * ECMA402_LOCALE_CALENDAR_CAPACITY );
122
+ const int calendarsLength = ecma402_calendarsOfLocale (locale , calendars );
137
123
138
124
cr_assert (eq (int , calendarsLength , 0 ));
139
125
140
- free (calendars );
126
+ free (( void * ) calendars );
141
127
ecma402_freeLocale (locale );
142
128
}
0 commit comments