Darjeeling.assertTrue(testBase+40, true);
}
// nullpointer test
try {
A a = null;
a.x = 10;
Darjeeling.assertTrue(testBase+50, false);
} catch (NullPointerException ex)
{
Darjeeling.assertTrue(testBase+50, true);
}
try {
A a = null;
int x = a.x;
Darjeeling.assertTrue(testBase+51, false);
} catch (NullPointerException ex)
{
Darjeeling.assertTrue(testBase+51, true);
}
// out of bounds tests
// test with negative index
try {
byte[] arr = new byte[0];
arr[-1] = 10;
Darjeeling.assertTrue(testBase+60, false);
} catch (IndexOutOfBoundsException ex)
{
Darjeeling.assertTrue(testBase+60, true);
}
// test with index 0 on empty array
try {
short[] arr = new short[0];
arr[0] = 10;
Darjeeling.assertTrue(testBase+61, false);
} catch (IndexOutOfBoundsException ex)
{
Darjeeling.assertTrue(testBase+61, true);
}
// test with index 0 on one-slot array
try {
int[] arr = new int[1];
arr[0] = 10;
Darjeeling.assertTrue(testBase+62, true);
} catch (IndexOutOfBoundsException ex)
{
Darjeeling.assertTrue(testBase+62, false);
}
// test with index beyond array size
try {
int[] arr = new int[10];
arr[10] = 10;
Darjeeling.assertTrue(testBase+63, false);
} catch (IndexOutOfBoundsException ex)
{
Darjeeling.assertTrue(testBase+63, true);
}
// hacky test
/*
try {
SinkList sinks = new SinkList();
sinks.add(new Sink((short)1));
int size = sinks.size();
Darjeeling.assertTrue(testBase+70, true);
} catch (Error err)
{
Darjeeling.assertTrue(testBase+70, false);
}
*/
// hacky test
try {
A a = new A();
a.x = 10;
Darjeeling.assertTrue(testBase+80, a.createInner().getX()==10);
} catch (Error err)
{
Darjeeling.assertTrue(testBase+80, false);
}