Feat: throw an exception instead on testInteger & testLong by SharmaNishchay · Pull Request #1194 · sqlancer/sqlancer
SharmaNishchay
changed the title
TODO: throw an exception instead on testInteger
TODO: throw an exception instead on testInteger & testLong
SharmaNishchay
changed the title
TODO: throw an exception instead on testInteger & testLong
Feat: throw an exception instead on testInteger & testLong
@mrigger The checks are passing. Please review the changes. Thanks!
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@test
public void testIntegerValidRange() {
Randomly r = new Randomly();
for (int i = 0; i < 100; i++) {
int val = r.getInteger(5, 10);
assertTrue(val >= 5 && val <= 10);
}
}
Add input validation for getInteger() and update corresponding test
- Added a check in Randomly.getInteger(left, right) to throw IllegalArgumentException when left > right
- Updated testInteger() in TestRandomly.java to assert this exception
- Ensures safer and more predictable behavior for invalid input ranges
Add input validation for getInteger() and update corresponding test
- Added a check in Randomly.getInteger(left, right) to throw IllegalArgumentException when left > right
- Updated testInteger() in TestRandomly.java to assert this exception
- Ensures safer and more predictable behavior for invalid input ranges
I think the testLong2() method already handles that scenario.