diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2018-11-12 21:31:10 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2018-11-12 21:31:10 (GMT) |
commit | ef29549f0d66612fcdeefc763785c6826c67ad8b (patch) | |
tree | 31762fcc3becf3d162ef1dfd9fc4cf53b9e9acf7 /java/test/TestH5E.java | |
parent | 6a2e97bead3c4d366f28b6a1e4e338fc07014954 (diff) | |
download | hdf5-ef29549f0d66612fcdeefc763785c6826c67ad8b.zip hdf5-ef29549f0d66612fcdeefc763785c6826c67ad8b.tar.gz hdf5-ef29549f0d66612fcdeefc763785c6826c67ad8b.tar.bz2 |
Updated the Java tests so that they don't fail when the
error stack changes.
Diffstat (limited to 'java/test/TestH5E.java')
-rw-r--r-- | java/test/TestH5E.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 542a092..fd015c0 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -38,9 +38,6 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); - public static final int ERRSTACK_CNT = 6; - public static final int ERRSTACK_MTY_CNT = 0; - long hdf_java_classid = -1; long current_stackid = -1; @@ -130,6 +127,10 @@ public class TestH5E { @Test public void testH5Epop() { + + long num_msg = -1; + long saved_num_msg = -1; + try { H5.H5Eset_current_stack(current_stackid); } @@ -144,7 +145,7 @@ public class TestH5E { catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -153,7 +154,6 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - long num_msg = -1; try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -162,7 +162,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0); try { num_msg = H5.H5Eget_num(current_stackid); @@ -172,8 +172,9 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); + assertTrue("H5.H5Epop #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(current_stackid, 1); } @@ -190,7 +191,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1); + assertTrue("H5.H5Epop", num_msg == saved_num_msg - 1); } @Test @@ -231,7 +232,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); + assertTrue("testH5Epush #:" + num_msg, num_msg == 0); } catch (Throwable err) { err.printStackTrace(); @@ -242,7 +243,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT + 1); + assertTrue("testH5Epush #:" + num_msg, num_msg == 1); } catch (Throwable err) { err.printStackTrace(); @@ -302,7 +303,7 @@ public class TestH5E { catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -318,7 +319,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); + assertTrue("testH5Ewalk #:" + num_msg, num_msg > 0); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); @@ -328,7 +329,8 @@ public class TestH5E { fail("testH5Ewalk:H5Ewalk2 " + err); } assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); - assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==TestH5E.ERRSTACK_CNT); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0); } } + |