Skip to content

Commit

Permalink
Update tests for constant expr with math operands
Browse files Browse the repository at this point in the history
  • Loading branch information
prakanth97 committed Sep 14, 2022
1 parent a85e1f1 commit 526aee5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,16 @@ public void testNegative() {
322, 22);
BAssertUtil.validateError(compileResult, index++, "incompatible types: expected 'Infinityf', found 'float'",
323, 27);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason 'long overflow'",
329, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason '/ by zero'",
330, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason 'long overflow'",
332, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason 'long overflow'",
333, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason '/ by zero'",
335, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason 'long overflow'",
336, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason 'long overflow'",
338, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason 'long overflow'",
339, 18);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 332, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason '/ by zero'", 333, 18);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 335, 18);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 336, 18);
BAssertUtil.validateError(compileResult, index++, "invalid constant expression, reason '/ by zero'", 338, 18);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 339, 18);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 341, 18);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 342, 18);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 344, 19);
BAssertUtil.validateError(compileResult, index++, "int range overflow", 345, 19);
Assert.assertEquals(compileResult.getErrorCount(), index);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ float:Infinity floatInf = 1.0;
const NUM1 = -1;
const int NUM2 = -9223372036854775807 - 1;
const int NUM3 = 0;
const int NUM4 = 9223372036854775807;
const int NUM5 = 10;

const int ANS1 = NUM2 / NUM1; // error
const int ANS2 = NUM2 / NUM3; // error

Expand All @@ -336,4 +339,7 @@ const int ANS5 = NUM2 % NUM3; // error
const int ANS6 = -NUM2; // error

const int ANS7 = NUM2 + NUM1; // error
const int ANS8 = NUM2 - 1; // error
const int ANS8 = NUM4 + NUM5; // error

const int ANS10 = NUM2 - NUM5; // error
const int ANS11 = NUM4 - NUM1; // error

0 comments on commit 526aee5

Please sign in to comment.