Lines Matching refs:scale

101 static void roundTripTest(int64_t value, UDateTimeScale scale)
104 int64_t rt = utmscale_toInt64(utmscale_fromInt64(value, scale, &status), scale, &status);
107 log_err("Round-trip error: time scale = %d, value = %lld, round-trip = %lld.\n", scale, value, rt);
111 static void toLimitTest(int64_t toLimit, int64_t fromLimit, UDateTimeScale scale)
114 int64_t result = utmscale_toInt64(toLimit, scale, &status);
117 log_err("toLimit failure: scale = %d, toLimit = %lld , utmscale_toInt64(toLimit, scale, &status) = %lld, fromLimit = %lld.\n",
118 scale, toLimit, result, fromLimit);
122 static void epochOffsetTest(int64_t epochOffset, int64_t units, UDateTimeScale scale)
127 int64_t local = utmscale_toInt64(universalEpoch, scale, &status);
130 log_err("utmscale_toInt64(epochOffset, scale, &status): scale = %d epochOffset = %lld, result = %lld.\n", scale, epochOffset, local);
133 local = utmscale_toInt64(0, scale, &status);
136 log_err("utmscale_toInt64(0, scale): scale = %d, result = %lld.\n", scale, local);
139 universal = utmscale_fromInt64(-epochOffset, scale, &status);
142 log_err("from(-epochOffest, scale): scale = %d, epochOffset = %lld, result = %lld.\n", scale, epochOffset, universal);
145 universal = utmscale_fromInt64(0, scale, &status);
148 log_err("utmscale_fromInt64(0, scale): scale = %d, result = %lld.\n", scale, universal);
155 int32_t scale;
157 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
158 int64_t units = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_UNITS_VALUE, &status);
159 int64_t epochOffset = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_EPOCH_OFFSET_VALUE, &status);
161 epochOffsetTest(epochOffset, units, (UDateTimeScale)scale);
168 int32_t scale;
170 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
171 int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
172 int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
174 roundTripTest(fromMin, (UDateTimeScale)scale);
175 roundTripTest(fromMax, (UDateTimeScale)scale);
182 int32_t scale;
184 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
185 int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
186 int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
187 int64_t toMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MIN_VALUE, &status);
188 int64_t toMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MAX_VALUE, &status);
190 toLimitTest(toMin, fromMin, (UDateTimeScale)scale);
191 toLimitTest(toMax, fromMax, (UDateTimeScale)scale);
197 int32_t scale;
207 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
211 fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
212 fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
215 result = utmscale_fromInt64(0, (UDateTimeScale)scale, &status);
217 log_err("utmscale_fromInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
221 result = utmscale_fromInt64(fromMin, (UDateTimeScale)scale, &status);
223 log_err("utmscale_fromInt64(fromMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
228 result = utmscale_fromInt64(fromMin - 1, (UDateTimeScale)scale, &status);
230 log_err("utmscale_fromInt64(fromMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
235 result = utmscale_fromInt64(fromMax, (UDateTimeScale)scale, &status);
237 log_err("utmscale_fromInt64(fromMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
242 result = utmscale_fromInt64(fromMax + 1, (UDateTimeScale)scale, &status);
244 log_err("utmscale_fromInt64(fromMax + 1, %d, &status) didn't generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
258 int32_t scale;
268 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
272 toMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MIN_VALUE, &status);
273 toMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MAX_VALUE, &status);
276 result = utmscale_toInt64(0, (UDateTimeScale)scale, &status);
278 log_err("utmscale_toInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
282 result = utmscale_toInt64(toMin, (UDateTimeScale)scale, &status);
284 log_err("utmscale_toInt64(toMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
289 result = utmscale_toInt64(toMin - 1, (UDateTimeScale)scale, &status);
291 log_err("utmscale_toInt64(toMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
297 result = utmscale_toInt64(toMax, (UDateTimeScale)scale, &status);
299 log_err("utmscale_toInt64(toMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
304 result = utmscale_toInt64(toMax + 1, (UDateTimeScale)scale, &status);
306 log_err("utmscale_toInt64(toMax + 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
333 int32_t scale;
336 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
337 int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
338 int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
346 roundTripTest(value, (UDateTimeScale)scale);