Repository navigation
Expand file tree
/
Copy pathTestH5.java
More file actions
184 lines (161 loc) · 4.99 KB
/
Copy pathTestH5.java
File metadata and controls
184 lines (161 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/**
*
*/
package test.h5;
import junit.framework.TestCase;
import hdf.h5.H5;
import hdf.h5.constants.H5Fconstant;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* @author xcao
*
*/
public class TestH5 extends TestCase {
/**
* @throws java.lang.Exception
*/
@Override
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@Override
@After
public void tearDown() throws Exception {
}
/**
* Test method for {@link hdf.h5.H5#J2C(int)}.
*/
@Test
public void testJ2C() {
int H5F_ACC_RDONLY = 0x0000;
int H5F_ACC_RDWR = 0x0001;
int H5F_ACC_TRUNC = 0x0002;
int H5F_ACC_EXCL = 0x0004;
int H5F_ACC_DEBUG = 0x0008;
int H5F_ACC_CREAT = 0x0010;
int H5F_OBJ_FILE = 0x0001;
int H5F_OBJ_DATASET = 0x0002;
int H5F_OBJ_GROUP = 0x0004;
int H5F_OBJ_DATATYPE = 0x0008;
int H5F_OBJ_ATTR = 0x0010;
int H5F_OBJ_ALL = H5F_OBJ_FILE|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR;
int H5F_OBJ_LOCAL = 0x0020;
int definedValues[] = {
H5F_ACC_RDONLY,
H5F_ACC_RDWR,
H5F_ACC_TRUNC,
H5F_ACC_EXCL,
H5F_ACC_DEBUG,
H5F_ACC_CREAT,
H5F_OBJ_FILE,
H5F_OBJ_DATASET,
H5F_OBJ_GROUP,
H5F_OBJ_DATATYPE,
H5F_OBJ_ATTR,
H5F_OBJ_ALL,
H5F_OBJ_LOCAL
};
int j2cValues[] = {
H5Fconstant.H5F_ACC_RDONLY,
H5Fconstant.H5F_ACC_RDWR,
H5Fconstant.H5F_ACC_TRUNC,
H5Fconstant.H5F_ACC_EXCL,
H5Fconstant.H5F_ACC_DEBUG,
H5Fconstant.H5F_ACC_CREAT,
H5Fconstant.H5F_OBJ_FILE,
H5Fconstant.H5F_OBJ_DATASET,
H5Fconstant.H5F_OBJ_GROUP,
H5Fconstant.H5F_OBJ_DATATYPE,
H5Fconstant.H5F_OBJ_ATTR,
H5Fconstant.H5F_OBJ_ALL,
H5Fconstant.H5F_OBJ_LOCAL
};
for (int i=0; i<definedValues.length; i++) {
assertEquals(definedValues[i], j2cValues[i]);
}
assertFalse(H5F_ACC_RDONLY == H5Fconstant.H5F_ACC_RDWR);
assertFalse(H5F_OBJ_FILE == H5Fconstant.H5F_OBJ_GROUP);
}
/**
* Test method for {@link hdf.h5.H5#H5error_off()}.
*/
@Test
public void testH5error_off() {
try { H5.H5error_off(); }
catch (Throwable err) {
fail("H5.H5error_off failed: "+err);
}
}
/**
* Test method for {@link hdf.h5.H5#H5open()}.
*/
@Test
public void testH5open() {
try { H5.H5open(); }
catch (Throwable err) {
fail("H5.H5open failed: "+err);
}
}
/**
* Test method for {@link hdf.h5.H5#H5garbage_collect()}.
*/
@Test
public void testH5garbage_collect() {
try { H5.H5garbage_collect(); }
catch (Throwable err) {
fail("H5.H5garbage_collect failed: "+err);
}
}
/**
* Test method for {@link hdf.h5.H5#H5set_free_list_limits(int, int, int, int, int, int)}.
*/
@Test
public void testH5set_free_list_limits() {
int reg_global_lim = 1;
int reg_list_lim = 1;
int arr_global_lim = 1;
int arr_list_lim = 1;
int blk_global_lim = 1;
int blk_list_lim = 1;
try { H5.H5set_free_list_limits(reg_global_lim, reg_list_lim,
arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim); }
catch (Throwable err) {
fail("H5.H5set_free_list_limits failed: "+err);
}
}
/**
* Test method for {@link hdf.h5.H5#H5get_libversion(int[])}.
*/
@Test
public void testH5get_libversion() {
int libversion[] = {0,0,0};
try { H5.H5get_libversion(libversion); }
catch (Throwable err) {
fail("H5.H5get_libversion: "+err);
}
for (int i=0; i<3; i++)
assertEquals(libversion[i], H5.LIB_VERSION[i]);
for (int i=0; i<3; i++)
assertFalse(libversion[i] == 0);
}
/**
* Test method for {@link hdf.h5.H5#H5check_version(int, int, int)}.
*/
@Test
public void testH5check_version() {
int majnum=1, minnum=8, relnum=2;
try { H5.H5check_version(majnum, minnum, relnum); }
catch (Throwable err) {
fail("H5.H5check_version failed: "+err);
}
try { H5.H5check_version(-1, 0, 0); }
catch (Throwable err) {
fail("H5.H5check_version failed: "+err);
}
}
}