summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-09-19 13:06:05 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-09-19 13:06:05 (GMT)
commitfe418f6c2389122bbab2404046513fac9d6dab7e (patch)
treea46acd97641a8e550052de42b62e623cc0b59e9d /java
parentec53237fb849042b4a5b276a3e66a98ebb3710ee (diff)
downloadhdf5-fe418f6c2389122bbab2404046513fac9d6dab7e.zip
hdf5-fe418f6c2389122bbab2404046513fac9d6dab7e.tar.gz
hdf5-fe418f6c2389122bbab2404046513fac9d6dab7e.tar.bz2
Use constants for test comparisons
Diffstat (limited to 'java')
-rw-r--r--java/test/TestH5E.java6
-rw-r--r--java/test/TestH5Edefault.java44
2 files changed, 27 insertions, 23 deletions
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index 656069a..7810c74 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -168,7 +168,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3);
try {
H5.H5Epop(current_stackid, 1);
@@ -186,7 +186,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop", num_msg == 3);
+ assertTrue("H5.H5Epop", num_msg == 2);
}
@Test
@@ -314,7 +314,7 @@ public class TestH5E {
err.printStackTrace();
fail("testH5Ewalk:H5Eget_num " + err);
}
- assertTrue("testH5Ewalk #:" + num_msg, num_msg == 4);
+ assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3);
try {
H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data);
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 5324d3a..e6ac7fa 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -27,6 +27,10 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Edefault {
+ 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
@@ -91,7 +95,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack and clears the current stack
try {
@@ -122,7 +126,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eclose_stack(stack_id);
@@ -153,7 +157,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack and clears the current stack
try {
@@ -174,7 +178,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_MTY_CNT);
//Verify the copy has the correct number of messages
try {
@@ -184,7 +188,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Generate errors on default stack
try {
@@ -202,7 +206,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Remove one message from the current stack
try {
@@ -213,7 +217,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == 3);
+ assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_POP_CNT);
//Verify the copy still has the correct number of messages
try {
@@ -223,7 +227,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -293,7 +297,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack
try {
@@ -314,7 +318,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Generate errors on default stack
try {
@@ -332,7 +336,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Remove one message from the current stack
try {
@@ -343,7 +347,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT);
//Verify the copy still has the correct number of messages
try {
@@ -353,7 +357,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eset_current_stack(stack_id);
@@ -363,7 +367,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -386,7 +390,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Epop before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -395,7 +399,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_POP_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -471,7 +475,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eclear2(HDF5Constants.H5E_DEFAULT);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -480,7 +484,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -516,7 +520,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_num: " + err);
}
- assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT);
}
@Test
@@ -534,7 +538,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_num_with_msg: " + err);
}
- assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
+ assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > TestH5Edefault.ERRSTACK_MTY_CNT);
}
}