1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * All rights reserved. * 4 * * 5 * This file is part of HDF Products. The full HDF copyright * 6 * notice, including terms governing use, modification, and redistribution, * 7 * is contained in the file, COPYING. COPYING can be found at the root of * 8 * the source code distribution tree. You can also access it online at * 9 * http://www.hdfgroup.org/products/licenses.html. If you do not have * 10 * access to the file, you may request a copy from help@hdfgroup.org. * 11 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 12 13 package test; 14 15 import static org.junit.Assert.assertEquals; 16 import static org.junit.Assert.assertFalse; 17 import static org.junit.Assert.assertTrue; 18 import static org.junit.Assert.fail; 19 20 import java.io.File; 21 22 import hdf.hdflib.HDFLibrary; 23 import hdf.hdflib.HDFException; 24 import hdf.hdflib.HDFChunkInfo; 25 import hdf.hdflib.HDFConstants; 26 27 import org.junit.After; 28 import org.junit.Before; 29 import org.junit.Ignore; 30 import org.junit.Rule; 31 import org.junit.Test; 32 import org.junit.rules.TestName; 33 34 public class TestH4Vparams { 35 @Rule public TestName testname = new TestName(); 36 37 @Before showTestName()38 public void showTestName() { 39 System.out.print(testname.getMethodName()); 40 } 41 42 @After nextTestName()43 public void nextTestName() { 44 System.out.println(); 45 } 46 47 // @Test(expected = HDFException.class) 48 // public void testVQueryrefIllegalVKey() throws Throwable { 49 // HDFLibrary.VQueryref(-1); 50 // } 51 52 // @Test(expected = HDFException.class) 53 // public void testVQuerytagIllegalVKey() throws Throwable { 54 // HDFLibrary.VQuerytag(-1); 55 // } 56 57 // @Test(expected = HDFException.class) 58 // public void testVstartIllegalId() throws Throwable { 59 // HDFLibrary.Vstart(-1); 60 // } 61 62 @Test(expected = NullPointerException.class) testVattachNullAccess()63 public void testVattachNullAccess() throws Throwable { 64 HDFLibrary.Vattach(0, 0, null); 65 } 66 67 @Test(expected = HDFException.class) testVattachIllegalId()68 public void testVattachIllegalId() throws Throwable { 69 String str = ""; 70 HDFLibrary.Vattach(-1, 0, str); 71 } 72 73 // @Test(expected = HDFException.class) 74 // public void testVdetachIllegalId() throws Throwable { 75 // HDFLibrary.Vdetach(-1); 76 // } 77 78 // @Test(expected = HDFException.class) 79 // public void testVendIllegalId() throws Throwable { 80 // HDFLibrary.Vend(-1); 81 // } 82 83 // @Test(expected = HDFException.class) 84 // public void testVgetidIllegalId() throws Throwable { 85 // HDFLibrary.Vgetid(-1, 0); 86 // } 87 88 @Test(expected = NullPointerException.class) testVgetclassNullClassName()89 public void testVgetclassNullClassName() throws Throwable { 90 HDFLibrary.Vgetclass(0, null); 91 } 92 93 @Test(expected = IllegalArgumentException.class) testVgetclassIllegalArgument()94 public void testVgetclassIllegalArgument() throws Throwable { 95 HDFLibrary.Vgetclass(0, new String[0]); 96 } 97 98 @Test(expected = HDFException.class) testVgetclassIllegalId()99 public void testVgetclassIllegalId() throws Throwable { 100 HDFLibrary.Vgetclass(-1, new String[1]); 101 } 102 103 @Test(expected = NullPointerException.class) testVgetnameNullName()104 public void testVgetnameNullName() throws Throwable { 105 HDFLibrary.Vgetname(0, null); 106 } 107 108 @Test(expected = IllegalArgumentException.class) testVgetnameIllegalArgument()109 public void testVgetnameIllegalArgument() throws Throwable { 110 HDFLibrary.Vgetname(0, new String[0]); 111 } 112 113 @Test(expected = HDFException.class) testVgetnameIllegalId()114 public void testVgetnameIllegalId() throws Throwable { 115 HDFLibrary.Vgetname(-1, new String[1]); 116 } 117 118 @Test(expected = HDFException.class) testVisvgIllegalId()119 public void testVisvgIllegalId() throws Throwable { 120 HDFLibrary.Visvg(-1, 0); 121 } 122 123 @Test(expected = HDFException.class) testVisvsIllegalId()124 public void testVisvsIllegalId() throws Throwable { 125 HDFLibrary.Visvs(-1, 0); 126 } 127 128 @Test(expected = NullPointerException.class) testVgettagrefsNullTags()129 public void testVgettagrefsNullTags() throws Throwable { 130 int arraySize = 10; 131 HDFLibrary.Vgettagrefs(0, null, new int[arraySize], arraySize); 132 } 133 134 @Test(expected = NullPointerException.class) testVgettagrefsNullRefs()135 public void testVgettagrefsNullRefs() throws Throwable { 136 int arraySize = 10; 137 HDFLibrary.Vgettagrefs(0, new int[arraySize], null, arraySize); 138 } 139 140 @Test(expected = IllegalArgumentException.class) testVgettagrefsIllegalTagsArgument()141 public void testVgettagrefsIllegalTagsArgument() throws Throwable { 142 int arraySize = 10; 143 HDFLibrary.Vgettagrefs(0, new int[1], new int[arraySize], arraySize); 144 } 145 146 @Test(expected = IllegalArgumentException.class) testVgettagrefsIllegalRefsArgument()147 public void testVgettagrefsIllegalRefsArgument() throws Throwable { 148 int arraySize = 10; 149 HDFLibrary.Vgettagrefs(0, new int[arraySize], new int[1], arraySize); 150 } 151 152 @Test(expected = HDFException.class) testVgettagrefsIllegalId()153 public void testVgettagrefsIllegalId() throws Throwable { 154 int arraySize = 10; 155 HDFLibrary.Vgettagrefs(-1, new int[arraySize], new int[arraySize], arraySize); 156 } 157 158 @Test(expected = NullPointerException.class) testVgettagrefNullTagRef()159 public void testVgettagrefNullTagRef() throws Throwable { 160 HDFLibrary.Vgettagref(0, 0, null); 161 } 162 163 @Test(expected = IllegalArgumentException.class) testVgettagrefIllegalTagRefArgument()164 public void testVgettagrefIllegalTagRefArgument() throws Throwable { 165 HDFLibrary.Vgettagref(0, 0, new int[1]); 166 } 167 168 @Test(expected = HDFException.class) testVgettagrefIllegalId()169 public void testVgettagrefIllegalId() throws Throwable { 170 HDFLibrary.Vgettagref(-1, 0, new int[2]); 171 } 172 173 // @Test(expected = HDFException.class) 174 // public void testVntagrefsIllegalId() throws Throwable { 175 // HDFLibrary.Vntagrefs(-1); 176 // } 177 178 // @Test(expected = HDFException.class) 179 // public void testVinqtagrefIllegalId() throws Throwable { 180 // HDFLibrary.Vinqtagref(-1, 0, 0); 181 // } 182 183 @Test(expected = NullPointerException.class) testVloneNullRefArray()184 public void testVloneNullRefArray() throws Throwable { 185 HDFLibrary.Vlone(0, null, 0); 186 } 187 188 @Test(expected = IllegalArgumentException.class) testVloneIllegalSizeRefArray()189 public void testVloneIllegalSizeRefArray() throws Throwable { 190 int arraySize = 10; 191 HDFLibrary.Vlone(0, new int[arraySize - 1], arraySize); 192 } 193 194 // @Test(expected = HDFException.class) 195 // public void testVloneIllegalId() throws Throwable { 196 // HDFLibrary.Vlone(-1, new int[10], 10); 197 // } 198 199 // @Test(expected = HDFException.class) 200 // public void testVaddtagrefIllegalId() throws Throwable { 201 // HDFLibrary.Vaddtagref(-1, 0, 0); 202 // } 203 204 // @Test(expected = HDFException.class) 205 // public void testVdeletetagrefIllegalId() throws Throwable { 206 // HDFLibrary.Vdeletetagref(-1, 0, 0); 207 // } 208 209 @Test(expected = NullPointerException.class) testVfindNullVGroupName()210 public void testVfindNullVGroupName() throws Throwable { 211 HDFLibrary.Vfind(0, null); 212 } 213 214 // @Test(expected = HDFException.class) 215 // public void testVfindIllegalId() throws Throwable { 216 // String str = ""; 217 // HDFLibrary.Vfind(-1, str); 218 // } 219 220 @Test(expected = NullPointerException.class) testVfindclassNullClassName()221 public void testVfindclassNullClassName() throws Throwable { 222 HDFLibrary.Vfindclass(0, null); 223 } 224 225 // @Test(expected = HDFException.class) 226 // public void testVfindclassIllegalId() throws Throwable { 227 // String str = ""; 228 // HDFLibrary.Vfindclass(-1, str); 229 // } 230 231 @Test(expected = NullPointerException.class) testVflocateNullClassName()232 public void testVflocateNullClassName() throws Throwable { 233 HDFLibrary.Vflocate(0, null); 234 } 235 236 @Test(expected = HDFException.class) testVflocateIllegalKey()237 public void testVflocateIllegalKey() throws Throwable { 238 String str = ""; 239 HDFLibrary.Vflocate(-1, str); 240 } 241 242 // @Test(expected = HDFException.class) 243 // public void testVgetnextIllegalKey() throws Throwable { 244 // HDFLibrary.Vgetnext(-1, 0); 245 // } 246 247 @Test(expected = NullPointerException.class) testVinquireNullNEntries()248 public void testVinquireNullNEntries() throws Throwable { 249 HDFLibrary.Vinquire(0, null, new String[1]); 250 } 251 252 @Test(expected = NullPointerException.class) testVinquireNullVGroupName()253 public void testVinquireNullVGroupName() throws Throwable { 254 HDFLibrary.Vinquire(0, new int[1], null); 255 } 256 257 @Test(expected = IllegalArgumentException.class) testVinquireIllegalNEntriesArgument()258 public void testVinquireIllegalNEntriesArgument() throws Throwable { 259 HDFLibrary.Vinquire(0, new int[0], new String[1]); 260 } 261 262 @Test(expected = IllegalArgumentException.class) testVinquireIllegalVGroupNameArgument()263 public void testVinquireIllegalVGroupNameArgument() throws Throwable { 264 HDFLibrary.Vinquire(0, new int[1], new String[0]); 265 } 266 267 @Test(expected = HDFException.class) testVinquireIllegalId()268 public void testVinquireIllegalId() throws Throwable { 269 HDFLibrary.Vinquire(-1, new int[1], new String[1]); 270 } 271 272 // @Test(expected = HDFException.class) 273 // public void testVinsertIllegalVGroupId() throws Throwable { 274 // HDFLibrary.Vinsert(-1, 0); 275 // } 276 277 // @Test(expected = HDFException.class) 278 // public void testVinsertIllegalVId() throws Throwable { 279 // HDFLibrary.Vinsert(0, -1); 280 // } 281 282 // @Test(expected = HDFException.class) 283 // public void testVnrefsIllegalKey() throws Throwable { 284 // HDFLibrary.Vnrefs(-1, 0); 285 // } 286 287 @Test(expected = NullPointerException.class) testVsetclassNullClassName()288 public void testVsetclassNullClassName() throws Throwable { 289 HDFLibrary.Vsetclass(0, null); 290 } 291 292 @Test(expected = HDFException.class) testVsetclassIllegalId()293 public void testVsetclassIllegalId() throws Throwable { 294 String str = ""; 295 HDFLibrary.Vsetclass(-1, str); 296 } 297 298 @Test(expected = NullPointerException.class) testVsetnameNullName()299 public void testVsetnameNullName() throws Throwable { 300 HDFLibrary.Vsetname(0, null); 301 } 302 303 @Test(expected = HDFException.class) testVsetnameIllegalId()304 public void testVsetnameIllegalId() throws Throwable { 305 String str = ""; 306 HDFLibrary.Vsetname(-1, str); 307 } 308 309 @Test(expected = NullPointerException.class) testVattrinfoNullName()310 public void testVattrinfoNullName() throws Throwable { 311 HDFLibrary.Vattrinfo(0, 0, null, new int[5]); 312 } 313 314 @Test(expected = NullPointerException.class) testVattrinfoNullArgv()315 public void testVattrinfoNullArgv() throws Throwable { 316 HDFLibrary.Vattrinfo(0, 0, new String[1], null); 317 } 318 319 @Test(expected = IllegalArgumentException.class) testVattrinfoIllegalNameArgument()320 public void testVattrinfoIllegalNameArgument() throws Throwable { 321 HDFLibrary.Vattrinfo(0, 0, new String[0], new int[5]); 322 } 323 324 @Test(expected = IllegalArgumentException.class) testVattrinfoIllegalArgvArgument()325 public void testVattrinfoIllegalArgvArgument() throws Throwable { 326 HDFLibrary.Vattrinfo(0, 0, new String[1], new int[1]); 327 } 328 329 @Test(expected = HDFException.class) testVattrinfoIllegalId()330 public void testVattrinfoIllegalId() throws Throwable { 331 HDFLibrary.Vattrinfo(-1, 0, new String[1], new int[5]); 332 } 333 334 @Test(expected = NullPointerException.class) testVfindattrNullName()335 public void testVfindattrNullName() throws Throwable { 336 HDFLibrary.Vfindattr(0, null); 337 } 338 339 @Test(expected = HDFException.class) testVfindattrIllegalId()340 public void testVfindattrIllegalId() throws Throwable { 341 String str = ""; 342 HDFLibrary.Vfindattr(-1, str); 343 } 344 345 @Test(expected = NullPointerException.class) testVgetattrNullData()346 public void testVgetattrNullData() throws Throwable { 347 byte[] byteArray = null; 348 HDFLibrary.Vgetattr(0, 0, byteArray); 349 } 350 351 @Test(expected = HDFException.class) testVgetattrIllegalId()352 public void testVgetattrIllegalId() throws Throwable { 353 byte[] byteArray = new byte[10]; 354 HDFLibrary.Vgetattr(-1, 0, byteArray); 355 } 356 357 // @Test(expected = HDFException.class) 358 // public void testVgetversionIllegalId() throws Throwable { 359 // HDFLibrary.Vgetversion(-1); 360 // } 361 362 // @Test(expected = HDFException.class) 363 // public void testVnattrsIllegalId() throws Throwable { 364 // HDFLibrary.Vnattrs(-1); 365 // } 366 367 @Test(expected = NullPointerException.class) testVsetattrNullName()368 public void testVsetattrNullName() throws Throwable { 369 String values = ""; 370 HDFLibrary.Vsetattr(0, null, 0, 0, values); 371 } 372 373 @Test(expected = NullPointerException.class) testVsetattrNullName2()374 public void testVsetattrNullName2() throws Throwable { 375 HDFLibrary.Vsetattr(0, null, 0, 0, new byte[10]); 376 } 377 378 @Test(expected = NullPointerException.class) testVsetattrNullValuesString()379 public void testVsetattrNullValuesString() throws Throwable { 380 String str = ""; 381 String values = null; 382 HDFLibrary.Vsetattr(0, str, 0, 0, values); 383 } 384 385 @Test(expected = NullPointerException.class) testVsetattrNullDataByteArray()386 public void testVsetattrNullDataByteArray() throws Throwable { 387 String str = ""; 388 byte[] data = null; 389 HDFLibrary.Vsetattr(0, str, 0, 0, data); 390 } 391 392 @Test(expected = HDFException.class) testVsetattrIllegalId()393 public void testVsetattrIllegalId() throws Throwable { 394 String str = ""; 395 String values = ""; 396 HDFLibrary.Vsetattr(-1, str, 0, 0, values); 397 } 398 399 @Test(expected = HDFException.class) testVsetattrIllegalId2()400 public void testVsetattrIllegalId2() throws Throwable { 401 String str = ""; 402 HDFLibrary.Vsetattr(-1, str, 0, 0, new byte[10]); 403 } 404 } 405