Add Constants to all ERR STK checks

This commit is contained in:
Allen Byrne 2018-09-19 08:58:08 -05:00
parent fe418f6c23
commit cd290ddecb
2 changed files with 12 additions and 8 deletions

View File

@ -37,6 +37,10 @@ import org.junit.rules.TestName;
public class TestH5E {
@Rule public TestName testname = new TestName();
public static final int ERRSTACK_CNT = 3;
public static final int ERRSTACK_MTY_CNT = 0;
long hdf_java_classid = -1;
long current_stackid = -1;
@ -158,7 +162,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0);
assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT);
try {
num_msg = H5.H5Eget_num(current_stackid);
@ -168,7 +172,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3);
assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT);
try {
H5.H5Epop(current_stackid, 1);
@ -186,7 +190,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
assertTrue("H5.H5Epop", num_msg == 2);
assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1);
}
@Test
@ -227,7 +231,7 @@ public class TestH5E {
try {
num_msg = H5.H5Eget_num(estack_id);
assertTrue("testH5Epush #:" + num_msg, num_msg == 0);
assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT);
}
catch (Throwable err) {
err.printStackTrace();
@ -238,7 +242,7 @@ public class TestH5E {
try {
num_msg = H5.H5Eget_num(estack_id);
assertTrue("testH5Epush #:" + num_msg, num_msg == 1);
assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT + 1);
}
catch (Throwable err) {
err.printStackTrace();
@ -314,7 +318,7 @@ public class TestH5E {
err.printStackTrace();
fail("testH5Ewalk:H5Eget_num " + err);
}
assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3);
assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT);
try {
H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data);

View File

@ -27,12 +27,12 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Edefault {
@Rule public TestName testname = new TestName();
public static final int ERRSTACK_CNT = 3;
public static final int ERRSTACK_MTY_CNT = 0;
public static final int ERRSTACK_POP_CNT = 2;
@Rule public TestName testname = new TestName();
@Before
public void H5Eset_default_stack() {
assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);