File: TestH4ANparams.java

package info (click to toggle)
libhdf4 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 29,892 kB
  • sloc: ansic: 128,688; sh: 14,969; fortran: 12,444; java: 5,864; xml: 1,305; makefile: 900; yacc: 678; pascal: 418; perl: 360; javascript: 203; lex: 163; csh: 41
file content (223 lines) | stat: -rw-r--r-- 6,069 bytes parent folder | download | duplicates (3)
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF Products. The full HDF copyright                 *
 * notice, including terms governing use, modification, and redistribution,  *
 * is contained in the file, COPYING.  COPYING can be found at the root of   *
 * the source code distribution tree. You can also access it online  at      *
 * https://www.hdfgroup.org/licenses.  If you do not have access to the      *
 * file, you may request a copy from help@hdfgroup.org.                      *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

package test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.File;

import hdf.hdflib.HDFConstants;
import hdf.hdflib.HDFException;
import hdf.hdflib.HDFLibrary;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;

/**
 *
 */
public class TestH4ANparams {
    @Rule
    public TestName testname = new TestName();

    @Before
    public void showTestName()
    {
        System.out.print(testname.getMethodName());
    }

    @After
    public void nextTestName()
    {
        System.out.println();
    }

    @Test(expected = HDFException.class)
    public void testANstartIllegalId() throws Throwable
    {
        HDFLibrary.ANstart(-1);
    }

    @Test(expected = HDFException.class)
    public void testANendIllegalId() throws Throwable
    {
        HDFLibrary.ANend(-1);
    }

    @Test
    public void testANendaccessIllegalId() throws Throwable
    {
        // function does nothing
        assertTrue(HDFLibrary.ANendaccess(-1));
    }

    @Test(expected = HDFException.class)
    public void testANfileinfoIllegalId() throws Throwable
    {
        int[] ids = {0, 0, 0, 0};
        HDFLibrary.ANfileinfo(-1, ids);
    }

    @Test(expected = NullPointerException.class)
    public void testANfileinfoNull() throws Throwable
    {
        HDFLibrary.ANfileinfo(0, null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testANfileinfoArgument() throws Throwable
    {
        int[] ids = {0, 0};
        HDFLibrary.ANfileinfo(0, ids);
    }

    @Test(expected = HDFException.class)
    public void testANselectIllegalId() throws Throwable
    {
        HDFLibrary.ANselect(-1, 0, 0);
    }

    @Test(expected = HDFException.class)
    public void testANnumannIllegalId() throws Throwable
    {
        short tag = 0;
        short ref = 0;
        HDFLibrary.ANnumann(-1, 0, tag, ref);
    }

    @Test
    public void testANatype2tagIllegalId() throws Throwable
    {
        assertEquals(HDFLibrary.ANatype2tag(-1), HDFConstants.DFTAG_NULL);
    }

    @Test(expected = HDFException.class)
    public void testANtag2atypeIllegalId() throws Throwable
    {
        short anttype = -1;
        HDFLibrary.ANtag2atype(anttype);
    }

    @Test(expected = HDFException.class)
    public void testANannlistIllegalId() throws Throwable
    {
        short tag = 0;
        short ref = 0;
        int[] ids = {0, 0, 0, 0};
        HDFLibrary.ANannlist(-1, 0, tag, ref, ids);
    }

    @Test(expected = NullPointerException.class)
    public void testANannlistNull() throws Throwable
    {
        short tag = 0;
        short ref = 0;

        HDFLibrary.ANannlist(0, 0, tag, ref, null);
    }

    @Test(expected = HDFException.class)
    public void testANannlenIllegalId() throws Throwable
    {
        HDFLibrary.ANannlen(-1);
    }

    @Test(expected = HDFException.class)
    public void testANreadannIllegalId() throws Throwable
    {
        String[] str = {""};
        HDFLibrary.ANreadann(-1, str, 0);
    }

    @Test(expected = HDFException.class)
    public void testANcreateIllegalId() throws Throwable
    {
        short tag = 0;
        short ref = 0;
        HDFLibrary.ANcreate(-1, tag, ref, 0);
    }

    @Test(expected = HDFException.class)
    public void testANcreatefIllegalId() throws Throwable
    {
        HDFLibrary.ANcreatef(-1, 0);
    }

    @Test(expected = HDFException.class)
    public void testANget_tagrefIllegalId() throws Throwable
    {
        short[] ref = {0, 0};
        HDFLibrary.ANget_tagref(-1, 0, 0, ref);
    }

    @Test(expected = NullPointerException.class)
    public void testANget_tagrefNull() throws Throwable
    {
        HDFLibrary.ANget_tagref(0, 0, 0, null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testANget_tagrefArgument() throws Throwable
    {
        short[] ref = {0};
        HDFLibrary.ANget_tagref(0, 0, 0, ref);
    }

    @Test(expected = HDFException.class)
    public void testANid2tagrefIllegalId() throws Throwable
    {
        short[] tag = {0, 0};
        HDFLibrary.ANid2tagref(-1, tag);
    }

    @Test(expected = NullPointerException.class)
    public void testANid2tagrefNull() throws Throwable
    {
        HDFLibrary.ANid2tagref(0, null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testANid2tagrefArgument() throws Throwable
    {
        short[] tag = {0};
        HDFLibrary.ANid2tagref(0, tag);
    }

    @Test(expected = HDFException.class)
    public void testANtagref2idIllegalId() throws Throwable
    {
        short tag = 0;
        short ref = 0;
        HDFLibrary.ANtagref2id(-1, tag, ref);
    }

    @Test(expected = HDFException.class)
    public void testANwriteannIllegalId() throws Throwable
    {
        String str = "";
        HDFLibrary.ANwriteann(-1, str, 0);
    }

    @Test(expected = NullPointerException.class)
    public void testANwriteannNull() throws Throwable
    {
        HDFLibrary.ANwriteann(0, null, 0);
    }
}