Lines Matching refs:scale

100 static void roundTripTest(int64_t value, UDateTimeScale scale)
103 int64_t rt = utmscale_toInt64(utmscale_fromInt64(value, scale, &status), scale, &status);
106 log_err("Round-trip error: time scale = %d, value = %lld, round-trip = %lld.\n", scale, value, rt);
110 static void toLimitTest(int64_t toLimit, int64_t fromLimit, UDateTimeScale scale)
113 int64_t result = utmscale_toInt64(toLimit, scale, &status);
116 log_err("toLimit failure: scale = %d, toLimit = %lld , utmscale_toInt64(toLimit, scale, &status) = %lld, fromLimit = %lld.\n",
117 scale, toLimit, result, fromLimit);
121 static void epochOffsetTest(int64_t epochOffset, int64_t units, UDateTimeScale scale)
126 int64_t local = utmscale_toInt64(universalEpoch, scale, &status);
129 log_err("utmscale_toInt64(epochOffset, scale, &status): scale = %d epochOffset = %lld, result = %lld.\n", scale, epochOffset, local);
132 local = utmscale_toInt64(0, scale, &status);
135 log_err("utmscale_toInt64(0, scale): scale = %d, result = %lld.\n", scale, local);
138 universal = utmscale_fromInt64(-epochOffset, scale, &status);
141 log_err("from(-epochOffest, scale): scale = %d, epochOffset = %lld, result = %lld.\n", scale, epochOffset, universal);
144 universal = utmscale_fromInt64(0, scale, &status);
147 log_err("utmscale_fromInt64(0, scale): scale = %d, result = %lld.\n", scale, universal);
154 int32_t scale;
156 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
157 int64_t units = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_UNITS_VALUE, &status);
158 int64_t epochOffset = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_EPOCH_OFFSET_VALUE, &status);
160 epochOffsetTest(epochOffset, units, (UDateTimeScale)scale);
167 int32_t scale;
169 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
170 int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
171 int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
173 roundTripTest(fromMin, (UDateTimeScale)scale);
174 roundTripTest(fromMax, (UDateTimeScale)scale);
181 int32_t scale;
183 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
184 int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
185 int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
186 int64_t toMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MIN_VALUE, &status);
187 int64_t toMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MAX_VALUE, &status);
189 toLimitTest(toMin, fromMin, (UDateTimeScale)scale);
190 toLimitTest(toMax, fromMax, (UDateTimeScale)scale);
196 int32_t scale;
206 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
210 fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
211 fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
214 result = utmscale_fromInt64(0, (UDateTimeScale)scale, &status);
216 log_err("utmscale_fromInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
220 result = utmscale_fromInt64(fromMin, (UDateTimeScale)scale, &status);
222 log_err("utmscale_fromInt64(fromMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
227 result = utmscale_fromInt64(fromMin - 1, (UDateTimeScale)scale, &status);
229 log_err("utmscale_fromInt64(fromMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
234 result = utmscale_fromInt64(fromMax, (UDateTimeScale)scale, &status);
236 log_err("utmscale_fromInt64(fromMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
241 result = utmscale_fromInt64(fromMax + 1, (UDateTimeScale)scale, &status);
243 log_err("utmscale_fromInt64(fromMax + 1, %d, &status) didn't generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
257 int32_t scale;
267 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
271 toMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MIN_VALUE, &status);
272 toMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MAX_VALUE, &status);
275 result = utmscale_toInt64(0, (UDateTimeScale)scale, &status);
277 log_err("utmscale_toInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
281 result = utmscale_toInt64(toMin, (UDateTimeScale)scale, &status);
283 log_err("utmscale_toInt64(toMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
288 result = utmscale_toInt64(toMin - 1, (UDateTimeScale)scale, &status);
290 log_err("utmscale_toInt64(toMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
296 result = utmscale_toInt64(toMax, (UDateTimeScale)scale, &status);
298 log_err("utmscale_toInt64(toMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
303 result = utmscale_toInt64(toMax + 1, (UDateTimeScale)scale, &status);
305 log_err("utmscale_toInt64(toMax + 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale);
332 int32_t scale;
335 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) {
336 int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status);
337 int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status);
345 roundTripTest(value, (UDateTimeScale)scale);