Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antvaset committed Jun 18, 2024
1 parent 01efdcf commit 74bf237
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ public static Object[][] dataMethod() {
"cql/CqlTypesTest/Time/TimeUpperBoundMillis",
"cql/ValueLiteralsAndSelectors/Boolean/BooleanFalse",
"cql/ValueLiteralsAndSelectors/Boolean/BooleanTrue",
"cql/ValueLiteralsAndSelectors/Decimal/Decimal10Pow28",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalNeg10Pow28",
"cql/ValueLiteralsAndSelectors/Decimal/Decimal10Pow20",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalNeg10Pow20",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalNegTenthStep",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalPos10Pow28",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalPos10Pow20",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalPosTenthStep",
"cql/ValueLiteralsAndSelectors/Decimal/DecimalTenthStep",
"cql/ValueLiteralsAndSelectors/Null/Null",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,30 +274,30 @@
<!-- EXPECT: Either some error saying the literal uses more
precision than the Decimal step size, or round to a whole step. -->
</test>
<test name="Decimal10Pow28ToZeroOneStepDecimalMaxValue">
<expression>9999999999999999999999999999.99999999</expression>
<output>10*1000000000000000000000000000.00000000-0.00000001</output>
<test name="Decimal10Pow20ToZeroOneStepDecimalMaxValue">
<expression>99999999999999999999.99999999</expression>
<output>10*10000000000000000000.00000000-0.00000001</output>
</test>
<test name="DecimalPos10Pow28ToZeroOneStepDecimalMaxValue">
<expression>+9999999999999999999999999999.99999999</expression>
<output>+10*1000000000000000000000000000.00000000-0.00000001</output>
<test name="DecimalPos10Pow20ToZeroOneStepDecimalMaxValue">
<expression>+99999999999999999999.99999999</expression>
<output>+10*10000000000000000000.00000000-0.00000001</output>
</test>
<test name="DecimalNeg10Pow28ToZeroOneStepDecimalMinValue">
<expression>-9999999999999999999999999999.99999999</expression>
<output>-10*1000000000000000000000000000.00000000+0.00000001</output>
<test name="DecimalNeg10Pow20ToZeroOneStepDecimalMinValue">
<expression>-99999999999999999999.99999999</expression>
<output>-10*10000000000000000000.00000000+0.00000001</output>
</test>
<test name="Decimal10Pow28">
<expression invalid="true">10000000000000000000000000000.00000000</expression>
<test name="Decimal10Pow20">
<expression invalid="true">100000000000000000000.00000000</expression>
<!-- TODO: Fix Engine to raise an error on this input. -->
<!-- EXPECT: Some error saying the literal is a greater magnitude than a Decimal supports. -->
</test>
<test name="DecimalPos10Pow28">
<expression invalid="true">+10000000000000000000000000000.00000000</expression>
<test name="DecimalPos10Pow20">
<expression invalid="true">+100000000000000000000.00000000</expression>
<!-- TODO: Fix Engine to raise an error on this input. -->
<!-- EXPECT: Some error saying the literal is a greater magnitude than a Decimal supports. -->
</test>
<test name="DecimalNeg10Pow28">
<expression invalid="true">-10000000000000000000000000000.00000000</expression>
<test name="DecimalNeg10Pow20">
<expression invalid="true">-100000000000000000000.00000000</expression>
<!-- TODO: Fix Engine to raise an error on this input. -->
<!-- EXPECT: Some error saying the literal is a greater magnitude than a Decimal supports. -->
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
The maximum operator is defined for the Integer, Long, Decimal, DateTime, and Time types.
For Integer, maximum returns the maximum signed 32-bit integer, 231 - 1.
For Long, maximum returns the maximum signed 64-bit Long, 263 - 1.
For Decimal, maximum returns the maximum representable decimal value, (1037 – 1) / 108 (9999999999999999999999999999.99999999).
For Decimal, maximum returns the maximum representable decimal value, (10^28 – 1) / 10^8 (99999999999999999999.99999999).
For DateTime, maximum returns the maximum representable date/time value, DateTime(9999, 12, 31, 23, 59, 59, 999).
For Time, maximum returns the maximum representable time value, Time(23, 59, 59, 999).
For any other type, attempting to invoke maximum results in an error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
The minimum operator is defined for the Integer, Long, Decimal, DateTime, and Time types.
For Integer, minimum returns the minimum signed 32-bit integer, -231.
For Long, minimum returns the minimum signed 32-bit integer, -263.
For Decimal, minimum returns the minimum representable decimal value, (-1037 – 1) / 108 (-9999999999999999999999999999.99999999).
For Decimal, minimum returns the minimum representable decimal value, (-10^28 + 1) / 10^8 (-99999999999999999999.99999999).
For DateTime, minimum returns the minimum representable date/time value, DateTime(1, 1, 1, 0, 0, 0, 0).
For Time, minimum returns the minimum representable time value, Time(0, 0, 0, 0).
For any other type, attempting to invoke minimum results in an error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,28 +152,28 @@ void all_value_literals_and_selectors() {
new BigDecimal(0).subtract(new BigDecimal(0.00000001).setScale(8, RoundingMode.HALF_EVEN))));
assertThat(((Quantity) value).getUnit(), is("mg"));

// define QuantityMax: 9999999999999999999999999999.99999999 'mg'
// define QuantityMax: 99999999999999999999.99999999 'mg'
value = results.forExpression("QuantityMax").value();
assertThat(value, instanceOf(Quantity.class));
assertThat(
((Quantity) value).getValue(),
comparesEqualTo(new BigDecimal("9999999999999999999999999999.99999999")));
comparesEqualTo(new BigDecimal("99999999999999999999.99999999")));
assertThat(((Quantity) value).getUnit(), is("mg"));

// define QuantityPosMax: +9999999999999999999999999999.99999999 'mg'
// define QuantityPosMax: +99999999999999999999.99999999 'mg'
value = results.forExpression("QuantityPosMax").value();
assertThat(value, instanceOf(Quantity.class));
assertThat(
((Quantity) value).getValue(),
comparesEqualTo(new BigDecimal("9999999999999999999999999999.99999999")));
comparesEqualTo(new BigDecimal("99999999999999999999.99999999")));
assertThat(((Quantity) value).getUnit(), is("mg"));

// define QuantityMin: -9999999999999999999999999999.99999999 'mg'
// define QuantityMin: -99999999999999999999.99999999 'mg'
value = results.forExpression("QuantityMin").value();
assertThat(value, instanceOf(Quantity.class));
assertThat(
((Quantity) value).getValue(),
comparesEqualTo(new BigDecimal("-9999999999999999999999999999.99999999")));
comparesEqualTo(new BigDecimal("-99999999999999999999.99999999")));
assertThat(((Quantity) value).getUnit(), is("mg"));

value = results.forExpression("DecimalZero").value();
Expand Down Expand Up @@ -330,14 +330,14 @@ void all_value_literals_and_selectors() {
// assertThat(((BigDecimal)result).setScale(7, RoundingMode.HALF_EVEN), comparesEqualTo(new
// BigDecimal(-1*Math.pow(10.0,-7)).setScale(7,RoundingMode.HALF_EVEN)));

// define DecimalMaxValue : 9999999999999999999999999999.99999999
// define DecimalMaxValue : 99999999999999999999.99999999
value = results.forExpression("DecimalMaxValue").value();
assertThat(((BigDecimal) value), comparesEqualTo(new BigDecimal("9999999999999999999999999999.99999999")));
// define DecimalPosMaxValue : +9999999999999999999999999999.99999999
assertThat(((BigDecimal) value), comparesEqualTo(new BigDecimal("99999999999999999999.99999999")));
// define DecimalPosMaxValue : +99999999999999999999.99999999
value = results.forExpression("DecimalPosMaxValue").value();
assertThat(((BigDecimal) value), comparesEqualTo(new BigDecimal("9999999999999999999999999999.99999999")));
// define DecimalMinValue: -9999999999999999999999999999.99999999
assertThat(((BigDecimal) value), comparesEqualTo(new BigDecimal("99999999999999999999.99999999")));
// define DecimalMinValue: -99999999999999999999.99999999
value = results.forExpression("DecimalMinValue").value();
assertThat(((BigDecimal) value), comparesEqualTo(new BigDecimal("-9999999999999999999999999999.99999999")));
assertThat(((BigDecimal) value), comparesEqualTo(new BigDecimal("-99999999999999999999.99999999")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ define MinDateTime: minimum DateTime
define MinTime: minimum Time

define test_MinInteger: TestMessage(MinInteger = -2147483648, 'MinInteger', toString(-2147483648), toString(MinInteger))
define test_MinDecimal: TestMessage(MinDecimal = -9999999999999999999999999999.99999999, 'MinDecimal', toString(-9999999999999999999999999999.99999999), toString(MinDecimal))
define test_MinDecimal: TestMessage(MinDecimal = -99999999999999999999.99999999, 'MinDecimal', toString(-99999999999999999999.99999999), toString(MinDecimal))
define test_MinDate: TestMessage(MinDate = @0001-01-01, 'MinDate', toString(@0001-01-01), toString(MinDate))
define test_MinDateTime: TestMessage(MinDateTime = @0001-01-01T00:00:00.000Z, 'MinDateTime', toString(@0001-01-01T00:00:00.000Z), toString(MinDateTime))
define test_MinTime: TestMessage(MinTime = @T00:00:00.000, 'MinTime', toString(@T00:00:00.000), toString(MinTime))
Expand All @@ -495,7 +495,7 @@ define MaxDateTime: maximum DateTime
define MaxTime: maximum Time

define test_MaxInteger: TestMessage(MaxInteger = 2147483647, 'MaxInteger', toString(2147483647), toString(MaxInteger))
define test_MaxDecimal: TestMessage(MaxDecimal = 9999999999999999999999999999.99999999, 'MaxDecimal', toString(9999999999999999999999999999.99999999), toString(MaxDecimal))
define test_MaxDecimal: TestMessage(MaxDecimal = 99999999999999999999.99999999, 'MaxDecimal', toString(99999999999999999999.99999999), toString(MaxDecimal))
define test_MaxDate: TestMessage(MaxDate = @9999-12-31, 'MaxDate', toString(@9999-12-31), toString(MaxDate))
define test_MaxDateTime: TestMessage(MaxDateTime = @9999-12-31T23:59:59.999Z, 'MaxDateTime', toString(@9999-12-31T23:59:59.999Z), toString(MaxDateTime))
define test_MaxTime: TestMessage(MaxTime = @T23:59:59.999, 'MaxTime', toString(@T23:59:59.999), toString(MaxTime))
Expand Down Expand Up @@ -3818,7 +3818,7 @@ define QuantityMeterNullHighIntervalList: { Interval[ToQuantity('1 \'m\''),ToQua
define CollapseQuantityNullHighUnitsWithinPerExpected : { Interval[ToQuantity('1 \'m\''), null] }
define QuantityIntervalListWithNulls: { Interval[ToQuantity(4), ToQuantity(8)], Interval[null, ToQuantity(2)], Interval[ToQuantity(1), ToQuantity(4)], Interval[ToQuantity(7), null] }
// TODO: should be { Interval[(null as Quantity), (null as Quantity)] } but that currently evaluates to null in the engine
define CollapseQuantityIntervalListWithNullsExpected: { Interval[null, 9999999999999999999999999999.99999999 '1'] }
define CollapseQuantityIntervalListWithNullsExpected: { Interval[null, 99999999999999999999.99999999 '1'] }
define QuantityIntervalListWithNullLowNoOverlap: { Interval[ToQuantity(4), ToQuantity(8)], Interval[null, ToQuantity(2)] }
define CollapseQuantityIntervalListWithNullLowNoOverlapExpected: { Interval[null, ToQuantity(2)], Interval[ToQuantity(4), ToQuantity(8)]}
define QuantityIntervalListWithNullHighNoOverlap: { Interval[ToQuantity(4), null], Interval[ToQuantity(1), ToQuantity(2)] }
Expand Down Expand Up @@ -4658,7 +4658,7 @@ define test_IndexOf_IndexOfThirdTuple: TestMessage(IndexOf_IndexOfThirdTuple = 2
define test_IndexOf_MultipleMatches: TestMessage(IndexOf_MultipleMatches = 3, 'IndexOf_MultipleMatches', toString(3), toString(IndexOf_MultipleMatches))
define test_IndexOf_ItemNotFound: TestMessage(IndexOf_ItemNotFound = -1, 'IndexOf_ItemNotFound', toString(-1), toString(IndexOf_ItemNotFound))
define test_IndexOf_NullList: TestMessage(IndexOf_NullList is null, 'IndexOf_NullList', 'null', toString(IndexOf_NullList))
define test_IndexOf_NullItem: TestMessage(IndexOf_NullItem = -1, 'IndexOf_NullItem', toString(-1), toString(IndexOf_NullItem))
define test_IndexOf_NullItem: TestMessage(IndexOf_NullItem is null, 'IndexOf_NullItem', 'null', toString(IndexOf_NullItem))
define test_IndexOf_ListCode: TestMessage(IndexOf_ListCode = 0, 'IndexOf_ListCode', toString(0), toString(IndexOf_ListCode))
define test_IndexOf_ListCodeUndefined: TestMessage(IndexOf_ListCodeUndefined = 0, 'IndexOf_ListCodeUndefined', toString(0), toString(IndexOf_ListCodeUndefined))
define test_IndexOf_ListWrongCode: TestMessage(IndexOf_ListWrongCode = -1, 'IndexOf_ListWrongCode', toString(-1), toString(IndexOf_ListWrongCode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ define MinDateTime: minimum DateTime
define MinTime: minimum Time

define test_MinInteger: TestMessage(MinInteger = -2147483648, 'MinInteger', toString(-2147483648), toString(MinInteger))
define test_MinDecimal: TestMessage(MinDecimal = -9999999999999999999999999999.99999999, 'MinDecimal', toString(-9999999999999999999999999999.99999999), toString(MinDecimal))
define test_MinDecimal: TestMessage(MinDecimal = -99999999999999999999.99999999, 'MinDecimal', toString(-99999999999999999999.99999999), toString(MinDecimal))
define test_MinDate: TestMessage(MinDate = @0001-01-01, 'MinDate', toString(@0001-01-01), toString(MinDate))
define test_MinDateTime: TestMessage(MinDateTime = @0001-01-01T00:00:00.000Z, 'MinDateTime', toString(@0001-01-01T00:00:00.000Z), toString(MinDateTime))
define test_MinTime: TestMessage(MinTime = @T00:00:00.000, 'MinTime', toString(@T00:00:00.000), toString(MinTime))
Expand All @@ -495,7 +495,7 @@ define MaxDateTime: maximum DateTime
define MaxTime: maximum Time

define test_MaxInteger: TestMessage(MaxInteger = 2147483647, 'MaxInteger', toString(2147483647), toString(MaxInteger))
define test_MaxDecimal: TestMessage(MaxDecimal = 9999999999999999999999999999.99999999, 'MaxDecimal', toString(9999999999999999999999999999.99999999), toString(MaxDecimal))
define test_MaxDecimal: TestMessage(MaxDecimal = 99999999999999999999.99999999, 'MaxDecimal', toString(99999999999999999999.99999999), toString(MaxDecimal))
define test_MaxDate: TestMessage(MaxDate = @9999-12-31, 'MaxDate', toString(@9999-12-31), toString(MaxDate))
define test_MaxDateTime: TestMessage(MaxDateTime = @9999-12-31T23:59:59.999Z, 'MaxDateTime', toString(@9999-12-31T23:59:59.999Z), toString(MaxDateTime))
define test_MaxTime: TestMessage(MaxTime = @T23:59:59.999, 'MaxTime', toString(@T23:59:59.999), toString(MaxTime))
Expand Down Expand Up @@ -3818,7 +3818,7 @@ define QuantityMeterNullHighIntervalList: { Interval[ToQuantity('1 \'m\''),ToQua
define CollapseQuantityNullHighUnitsWithinPerExpected : { Interval[ToQuantity('1 \'m\''), null] }
define QuantityIntervalListWithNulls: { Interval[ToQuantity(4), ToQuantity(8)], Interval[null, ToQuantity(2)], Interval[ToQuantity(1), ToQuantity(4)], Interval[ToQuantity(7), null] }
// TODO: should be { Interval[(null as Quantity), (null as Quantity)] } but that currently evaluates to null in the engine
define CollapseQuantityIntervalListWithNullsExpected: { Interval[null, 9999999999999999999999999999.99999999 '1'] }
define CollapseQuantityIntervalListWithNullsExpected: { Interval[null, 99999999999999999999.99999999 '1'] }
define QuantityIntervalListWithNullLowNoOverlap: { Interval[ToQuantity(4), ToQuantity(8)], Interval[null, ToQuantity(2)] }
define CollapseQuantityIntervalListWithNullLowNoOverlapExpected: { Interval[null, ToQuantity(2)], Interval[ToQuantity(4), ToQuantity(8)]}
define QuantityIntervalListWithNullHighNoOverlap: { Interval[ToQuantity(4), null], Interval[ToQuantity(1), ToQuantity(2)] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ define DecimalNegTenStep : -0.0000001
define DecimalTenthStep : 0.000000001
define DecimalPosTenthStep : +0.000000001
define DecimalNegTenthStep : -0.000000001
define DecimalMaxValue : 9999999999999999999999999999.99999999
define DecimalPosMaxValue : +9999999999999999999999999999.99999999
define DecimalMinValue: -9999999999999999999999999999.99999999
define DecimalMaxValue : 99999999999999999999.99999999
define DecimalPosMaxValue : +99999999999999999999.99999999
define DecimalMinValue: -99999999999999999999.99999999

define QuantityZero: 0 'g'
define QuantityPosZero: +0 'g'
Expand All @@ -85,7 +85,7 @@ define QuantityNegSmall: -0.05 'mg'
define QuantityStep: 0.00000001 'mg'
define QuantityPosStep: +0.00000001 'mg'
define QuantityNegStep: -0.00000001 'mg'
define QuantityMax: 9999999999999999999999999999.99999999 'mg'
define QuantityPosMax: +9999999999999999999999999999.99999999 'mg'
define QuantityMin: -9999999999999999999999999999.99999999 'mg'
define QuantityMax: 99999999999999999999.99999999 'mg'
define QuantityPosMax: +99999999999999999999.99999999 'mg'
define QuantityMin: -99999999999999999999.99999999 'mg'

0 comments on commit 74bf237

Please sign in to comment.