Lines Matching refs:scale
100 static void roundTripTest(int64_t value, UDateTimeScale scale) in roundTripTest() argument
103 int64_t rt = utmscale_toInt64(utmscale_fromInt64(value, scale, &status), scale, &status); in roundTripTest()
106 …log_err("Round-trip error: time scale = %d, value = %lld, round-trip = %lld.\n", scale, value, rt); in roundTripTest()
110 static void toLimitTest(int64_t toLimit, int64_t fromLimit, UDateTimeScale scale) in toLimitTest() argument
113 int64_t result = utmscale_toInt64(toLimit, scale, &status); in toLimitTest()
117 scale, toLimit, result, fromLimit); in toLimitTest()
121 static void epochOffsetTest(int64_t epochOffset, int64_t units, UDateTimeScale scale) in epochOffsetTest() argument
126 int64_t local = utmscale_toInt64(universalEpoch, scale, &status); in epochOffsetTest()
129 …ffset, scale, &status): scale = %d epochOffset = %lld, result = %lld.\n", scale, epochOffset, loca… in epochOffsetTest()
132 local = utmscale_toInt64(0, scale, &status); in epochOffsetTest()
135 log_err("utmscale_toInt64(0, scale): scale = %d, result = %lld.\n", scale, local); in epochOffsetTest()
138 universal = utmscale_fromInt64(-epochOffset, scale, &status); in epochOffsetTest()
141 …(-epochOffest, scale): scale = %d, epochOffset = %lld, result = %lld.\n", scale, epochOffset, univ… in epochOffsetTest()
144 universal = utmscale_fromInt64(0, scale, &status); in epochOffsetTest()
147 log_err("utmscale_fromInt64(0, scale): scale = %d, result = %lld.\n", scale, universal); in epochOffsetTest()
154 int32_t scale; in TestEpochOffsets() local
156 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) { in TestEpochOffsets()
157 …int64_t units = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_UNITS_VALUE, &status); in TestEpochOffsets()
158 …int64_t epochOffset = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_EPOCH_OFFSET_VALUE, &… in TestEpochOffsets()
160 epochOffsetTest(epochOffset, units, (UDateTimeScale)scale); in TestEpochOffsets()
167 int32_t scale; in TestFromLimits() local
169 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) { in TestFromLimits()
170 … int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status); in TestFromLimits()
171 … int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status); in TestFromLimits()
173 roundTripTest(fromMin, (UDateTimeScale)scale); in TestFromLimits()
174 roundTripTest(fromMax, (UDateTimeScale)scale); in TestFromLimits()
181 int32_t scale; in TestToLimits() local
183 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) { in TestToLimits()
184 … int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status); in TestToLimits()
185 … int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status); in TestToLimits()
186 … int64_t toMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MIN_VALUE, &status); in TestToLimits()
187 … int64_t toMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MAX_VALUE, &status); in TestToLimits()
189 toLimitTest(toMin, fromMin, (UDateTimeScale)scale); in TestToLimits()
190 toLimitTest(toMax, fromMax, (UDateTimeScale)scale); in TestToLimits()
196 int32_t scale; in TestFromInt64() local
205 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) { in TestFromInt64()
209 fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status); in TestFromInt64()
210 fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status); in TestFromInt64()
213 result = utmscale_fromInt64(0, (UDateTimeScale)scale, &status); in TestFromInt64()
215 … log_err("utmscale_fromInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestFromInt64()
219 result = utmscale_fromInt64(fromMin, (UDateTimeScale)scale, &status); in TestFromInt64()
221 … log_err("utmscale_fromInt64(fromMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestFromInt64()
226 result = utmscale_fromInt64(fromMin - 1, (UDateTimeScale)scale, &status); in TestFromInt64()
228 …utmscale_fromInt64(fromMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestFromInt64()
233 result = utmscale_fromInt64(fromMax, (UDateTimeScale)scale, &status); in TestFromInt64()
235 … log_err("utmscale_fromInt64(fromMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestFromInt64()
240 result = utmscale_fromInt64(fromMax + 1, (UDateTimeScale)scale, &status); in TestFromInt64()
242 …"utmscale_fromInt64(fromMax + 1, %d, &status) didn't generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestFromInt64()
256 int32_t scale; in TestToInt64() local
265 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) { in TestToInt64()
269 toMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MIN_VALUE, &status); in TestToInt64()
270 toMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_TO_MAX_VALUE, &status); in TestToInt64()
273 result = utmscale_toInt64(0, (UDateTimeScale)scale, &status); in TestToInt64()
275 … log_err("utmscale_toInt64(0, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestToInt64()
279 result = utmscale_toInt64(toMin, (UDateTimeScale)scale, &status); in TestToInt64()
281 … log_err("utmscale_toInt64(toMin, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestToInt64()
286 result = utmscale_toInt64(toMin - 1, (UDateTimeScale)scale, &status); in TestToInt64()
288 …rr("utmscale_toInt64(toMin - 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestToInt64()
294 result = utmscale_toInt64(toMax, (UDateTimeScale)scale, &status); in TestToInt64()
296 … log_err("utmscale_toInt64(toMax, %d, &status) generated U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestToInt64()
301 result = utmscale_toInt64(toMax + 1, (UDateTimeScale)scale, &status); in TestToInt64()
303 …rr("utmscale_toInt64(toMax + 1, %d, &status) did not generate U_ILLEGAL_ARGUMENT_ERROR.\n", scale); in TestToInt64()
330 int32_t scale; in TestMonkey() local
333 for (scale = 0; scale < UDTS_MAX_SCALE; scale += 1) { in TestMonkey()
334 … int64_t fromMin = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MIN_VALUE, &status); in TestMonkey()
335 … int64_t fromMax = utmscale_getTimeScaleValue((UDateTimeScale)scale, UTSV_FROM_MAX_VALUE, &status); in TestMonkey()
343 roundTripTest(value, (UDateTimeScale)scale); in TestMonkey()