提交 b6a85a07 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix TestValueMemory

上级 e2c2fc78
......@@ -2112,9 +2112,12 @@ public class DateTimeUtils {
default:
throw DbException.getInvalidValueException("interval", qualifier);
}
if (leading < 0L || leading >= 1_000_000_000_000_000_000L || remaining < 0L || remaining >= bound) {
if (leading < 0L || leading >= 1_000_000_000_000_000_000L) {
throw DbException.getInvalidValueException("interval", Long.toString(leading));
}
if (remaining < 0L || remaining >= bound) {
throw DbException.getInvalidValueException("interval", Long.toString(remaining));
}
return negative;
}
......
......@@ -238,15 +238,17 @@ public class TestValueMemory extends TestBase implements DataHandler {
return ValueInterval.from(IntervalQualifier.valueOf(type - Value.INTERVAL_YEAR),
random.nextBoolean(), random.nextInt(Integer.MAX_VALUE), 0);
case Value.INTERVAL_SECOND:
case Value.INTERVAL_DAY_TO_SECOND:
case Value.INTERVAL_HOUR_TO_SECOND:
case Value.INTERVAL_MINUTE_TO_SECOND:
return ValueInterval.from(IntervalQualifier.valueOf(type - Value.INTERVAL_YEAR),
random.nextBoolean(), random.nextInt(Integer.MAX_VALUE), random.nextInt(1_000_000_000));
case Value.INTERVAL_YEAR_TO_MONTH:
case Value.INTERVAL_DAY_TO_HOUR:
case Value.INTERVAL_DAY_TO_MINUTE:
case Value.INTERVAL_DAY_TO_SECOND:
case Value.INTERVAL_HOUR_TO_MINUTE:
case Value.INTERVAL_HOUR_TO_SECOND:
case Value.INTERVAL_MINUTE_TO_SECOND:
return ValueInterval.from(IntervalQualifier.valueOf(type - Value.INTERVAL_YEAR),
random.nextBoolean(), random.nextInt(Integer.MAX_VALUE), random.nextInt(24));
random.nextBoolean(), random.nextInt(Integer.MAX_VALUE), random.nextInt(12));
default:
throw new AssertionError("type=" + type);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论