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.HDFCompInfo; 26 import hdf.hdflib.HDFConstants; 27 28 import org.junit.After; 29 import org.junit.Before; 30 import org.junit.Ignore; 31 import org.junit.Rule; 32 import org.junit.Test; 33 import org.junit.rules.TestName; 34 35 /** 36 * 37 */ 38 public class TestH4SDparams { 39 @Rule public TestName testname = new TestName(); 40 41 @Before showTestName()42 public void showTestName() { 43 System.out.print(testname.getMethodName()); 44 } 45 46 @After nextTestName()47 public void nextTestName() { 48 System.out.println(); 49 } 50 51 @Test(expected = NullPointerException.class) testSDstartNull()52 public void testSDstartNull() throws Throwable { 53 HDFLibrary.SDstart(null, 0); 54 } 55 56 @Test(expected = HDFException.class) testSDendIllegalId()57 public void testSDendIllegalId() throws Throwable { 58 HDFLibrary.SDend(-1); 59 } 60 61 @Test(expected = HDFException.class) testSDfileinfoIllegalId()62 public void testSDfileinfoIllegalId() throws Throwable { 63 int[] args = {0, 0}; 64 HDFLibrary.SDfileinfo(-1, args); 65 } 66 67 @Test(expected = NullPointerException.class) testSDfileinfoNull()68 public void testSDfileinfoNull() throws Throwable { 69 HDFLibrary.SDfileinfo(0, null); 70 } 71 72 @Test(expected = IllegalArgumentException.class) testSDfileinfoArgument()73 public void testSDfileinfoArgument() throws Throwable { 74 int[] args = {0}; 75 HDFLibrary.SDfileinfo(0, args); 76 } 77 78 @Test(expected = HDFException.class) testSDselectIllegalId()79 public void testSDselectIllegalId() throws Throwable { 80 HDFLibrary.SDselect(-1, 0); 81 } 82 83 @Test(expected = HDFException.class) testSDnametoindexIllegalId()84 public void testSDnametoindexIllegalId() throws Throwable { 85 HDFLibrary.SDnametoindex(-1, ""); 86 } 87 88 @Test(expected = NullPointerException.class) testSDnametoindexNull()89 public void testSDnametoindexNull() throws Throwable { 90 HDFLibrary.SDnametoindex(0, null); 91 } 92 93 @Test(expected = HDFException.class) testSDgetinfoIllegalId()94 public void testSDgetinfoIllegalId() throws Throwable { 95 String[] name = {""}; 96 int[] args = {0, 0, 0}; 97 int[] dim_sizes = {0, 0}; 98 HDFLibrary.SDgetinfo(-1, name, dim_sizes, args); 99 } 100 101 @Test(expected = NullPointerException.class) testSDgetinfoNullName()102 public void testSDgetinfoNullName() throws Throwable { 103 int[] args = {0, 0, 0}; 104 int[] dim_sizes = {0, 0}; 105 HDFLibrary.SDgetinfo(0, null, dim_sizes, args); 106 } 107 108 @Test(expected = NullPointerException.class) testSDgetinfoNullArgs()109 public void testSDgetinfoNullArgs() throws Throwable { 110 String[] name = {""}; 111 int[] dim_sizes = {0, 0}; 112 HDFLibrary.SDgetinfo(0, name, dim_sizes, null); 113 } 114 115 @Test(expected = IllegalArgumentException.class) testSDgetinfoArgumentArgs()116 public void testSDgetinfoArgumentArgs() throws Throwable { 117 String[] name = {""}; 118 int[] args = {0}; 119 int[] dim_sizes = {0, 0}; 120 HDFLibrary.SDgetinfo(0, name, dim_sizes, args); 121 } 122 123 @Test(expected = NullPointerException.class) testSDgetinfoNullDims()124 public void testSDgetinfoNullDims() throws Throwable { 125 String[] name = {""}; 126 int[] args = {0, 0, 0}; 127 HDFLibrary.SDgetinfo(0, name, null, args); 128 } 129 130 @Test(expected = HDFException.class) testSDcheckemptyIllegalId()131 public void testSDcheckemptyIllegalId() throws Throwable { 132 int[] emptySDS = {0}; 133 HDFLibrary.SDcheckempty(-1, emptySDS); 134 } 135 136 @Test(expected = NullPointerException.class) testSDcheckemptyNull()137 public void testSDcheckemptyNull() throws Throwable { 138 HDFLibrary.SDcheckempty(0, null); 139 } 140 141 @Test(expected = HDFException.class) testSDreaddataIllegalId()142 public void testSDreaddataIllegalId() throws Throwable { 143 int[] start = {0, 0}; 144 int[] stride = {0, 0}; 145 int[] count = {0, 0}; 146 byte[] data = {0}; 147 HDFLibrary.SDreaddata(-1, start, stride, count, data); 148 } 149 150 @Test(expected = NullPointerException.class) testSDreaddataNullData()151 public void testSDreaddataNullData() throws Throwable { 152 int[] start = {0, 0}; 153 int[] stride = {0, 0}; 154 int[] count = {0, 0}; 155 HDFLibrary.SDreaddata(0, start, stride, count, null); 156 } 157 158 @Test(expected = NullPointerException.class) testSDreaddataNullStart()159 public void testSDreaddataNullStart() throws Throwable { 160 int[] stride = {0, 0}; 161 int[] count = {0, 0}; 162 byte[] data = {0}; 163 HDFLibrary.SDreaddata(0, null, stride, count, data); 164 } 165 166 @Test(expected = NullPointerException.class) testSDreaddataNullCount()167 public void testSDreaddataNullCount() throws Throwable { 168 int[] start = {0, 0}; 169 int[] stride = {0, 0}; 170 byte[] data = {0}; 171 HDFLibrary.SDreaddata(0, start, stride, null, data); 172 } 173 174 @Test(expected = HDFException.class) testSDreaddata_shortIllegalId()175 public void testSDreaddata_shortIllegalId() throws Throwable { 176 int[] start = {0, 0}; 177 int[] stride = {0, 0}; 178 int[] count = {0, 0}; 179 short[] data = {0}; 180 HDFLibrary.SDreaddata_short(-1, start, stride, count, data); 181 } 182 183 @Test(expected = HDFException.class) testSDreaddata_intIllegalId()184 public void testSDreaddata_intIllegalId() throws Throwable { 185 int[] start = {0, 0}; 186 int[] stride = {0, 0}; 187 int[] count = {0, 0}; 188 int[] data = {0}; 189 HDFLibrary.SDreaddata_int(-1, start, stride, count, data); 190 } 191 192 @Test(expected = HDFException.class) testSDreaddata_longIllegalId()193 public void testSDreaddata_longIllegalId() throws Throwable { 194 int[] start = {0, 0}; 195 int[] stride = {0, 0}; 196 int[] count = {0, 0}; 197 long[] data = {0}; 198 HDFLibrary.SDreaddata_long(-1, start, stride, count, data); 199 } 200 201 @Test(expected = HDFException.class) testSDreaddata_floatIllegalId()202 public void testSDreaddata_floatIllegalId() throws Throwable { 203 int[] start = {0, 0}; 204 int[] stride = {0, 0}; 205 int[] count = {0, 0}; 206 float[] data = {0}; 207 HDFLibrary.SDreaddata_float(-1, start, stride, count, data); 208 } 209 210 @Test(expected = HDFException.class) testSDreaddata_doubleIllegalId()211 public void testSDreaddata_doubleIllegalId() throws Throwable { 212 int[] start = {0, 0}; 213 int[] stride = {0, 0}; 214 int[] count = {0, 0}; 215 double[] data = {0}; 216 HDFLibrary.SDreaddata_double(-1, start, stride, count, data); 217 } 218 219 @Test(expected = HDFException.class) testSDendaccessIllegalId()220 public void testSDendaccessIllegalId() throws Throwable { 221 HDFLibrary.SDendaccess(-1); 222 } 223 224 @Test(expected = HDFException.class) testSDgetdimidIllegalId()225 public void testSDgetdimidIllegalId() throws Throwable { 226 HDFLibrary.SDgetdimid(-1, 0); 227 } 228 229 @Test(expected = HDFException.class) testSDdiminfoIllegalId()230 public void testSDdiminfoIllegalId() throws Throwable { 231 String[] name = {""}; 232 int[] argv = {0, 0, 0}; 233 HDFLibrary.SDdiminfo(-1, name, argv); 234 } 235 236 @Test(expected = NullPointerException.class) testSDdiminfoNullName()237 public void testSDdiminfoNullName() throws Throwable { 238 int[] argv = {0, 0, 0}; 239 HDFLibrary.SDdiminfo(0, null, argv); 240 } 241 242 @Test(expected = NullPointerException.class) testSDdiminfoNullArgs()243 public void testSDdiminfoNullArgs() throws Throwable { 244 String[] name = {""}; 245 HDFLibrary.SDdiminfo(0, name, null); 246 } 247 248 @Test(expected = IllegalArgumentException.class) testSDdiminfoArgumentArgs()249 public void testSDdiminfoArgumentArgs() throws Throwable { 250 String[] name = {""}; 251 int[] argv = {0}; 252 HDFLibrary.SDdiminfo(0, name, argv); 253 } 254 255 @Test(expected = HDFException.class) testSDidtorefIllegalId()256 public void testSDidtorefIllegalId() throws Throwable { 257 HDFLibrary.SDidtoref(-1); 258 } 259 260 @Test(expected = HDFException.class) testSDreftoindexIllegalId()261 public void testSDreftoindexIllegalId() throws Throwable { 262 short ref = 0; 263 HDFLibrary.SDreftoindex(-1, ref); 264 } 265 266 @Test(expected = HDFException.class) testSDattrinfoIllegalId()267 public void testSDattrinfoIllegalId() throws Throwable { 268 String[] name = {""}; 269 int index = 0; 270 int[] argv = {0, 0}; 271 HDFLibrary.SDattrinfo(-1, index, name, argv); 272 } 273 274 @Test(expected = NullPointerException.class) testSDattrinfoNullName()275 public void testSDattrinfoNullName() throws Throwable { 276 int index = 0; 277 int[] argv = {0, 0}; 278 HDFLibrary.SDattrinfo(0, index, null, argv); 279 } 280 281 @Test(expected = NullPointerException.class) testSDattrinfoNullArgs()282 public void testSDattrinfoNullArgs() throws Throwable { 283 String[] name = {""}; 284 int index = 0; 285 HDFLibrary.SDattrinfo(0, index, name, null); 286 } 287 288 @Test(expected = IllegalArgumentException.class) testSDattrinfoArgumentArgs()289 public void testSDattrinfoArgumentArgs() throws Throwable { 290 String[] name = {""}; 291 int index = 0; 292 int[] argv = {0}; 293 HDFLibrary.SDattrinfo(0, index, name, argv); 294 } 295 296 @Test(expected = HDFException.class) testSDreadattrIllegalId()297 public void testSDreadattrIllegalId() throws Throwable { 298 int index = 0; 299 byte[] data = {0}; 300 HDFLibrary.SDreadattr(-1, index, data); 301 } 302 303 @Test(expected = NullPointerException.class) testSDreadattrNull()304 public void testSDreadattrNull() throws Throwable { 305 int index = 0; 306 HDFLibrary.SDreadattr(0, index, null); 307 } 308 309 @Test(expected = HDFException.class) testSDfindattrIllegalId()310 public void testSDfindattrIllegalId() throws Throwable { 311 String str = ""; 312 HDFLibrary.SDfindattr(-1, str); 313 } 314 315 @Test(expected = NullPointerException.class) testSDfindattrNull()316 public void testSDfindattrNull() throws Throwable { 317 HDFLibrary.SDfindattr(0, null); 318 } 319 320 @Test(expected = HDFException.class) testSDiscoordvarIllegalId()321 public void testSDiscoordvarIllegalId() throws Throwable { 322 HDFLibrary.SDiscoordvar(-1); 323 } 324 325 @Test(expected = HDFException.class) testSDgetcalIllegalId()326 public void testSDgetcalIllegalId() throws Throwable { 327 double[] args = {0, 0, 0, 0}; 328 int[] NT = {0}; 329 HDFLibrary.SDgetcal(-1, args, NT); 330 } 331 332 @Test(expected = NullPointerException.class) testSDgetcalNull()333 public void testSDgetcalNull() throws Throwable { 334 double[] args = {0, 0, 0, 0}; 335 HDFLibrary.SDgetcal(0, args, null); 336 } 337 338 @Test(expected = IllegalArgumentException.class) testSSDgetcalArgument()339 public void testSSDgetcalArgument() throws Throwable { 340 double[] args = {0}; 341 int[] NT = {0}; 342 HDFLibrary.SDgetcal(0, args, NT); 343 } 344 345 @Test(expected = NullPointerException.class) testSDgetcalNullArgument()346 public void testSDgetcalNullArgument() throws Throwable { 347 int[] NT = {0}; 348 HDFLibrary.SDgetcal(0, null, NT); 349 } 350 351 @Test(expected = HDFException.class) testSDgetdatastrsIllegalId()352 public void testSDgetdatastrsIllegalId() throws Throwable { 353 String[] str = {"", "", "", ""}; 354 int len = 0; 355 HDFLibrary.SDgetdatastrs(-1, str, len); 356 } 357 358 @Test(expected = NullPointerException.class) testSDgetdatastrsNull()359 public void testSDgetdatastrsNull() throws Throwable { 360 int len = 0; 361 HDFLibrary.SDgetdatastrs(0, null, len); 362 } 363 364 @Test(expected = IllegalArgumentException.class) testSDgetdatastrsArgument()365 public void testSDgetdatastrsArgument() throws Throwable { 366 String[] str = {""}; 367 int len = 0; 368 HDFLibrary.SDgetdatastrs(-1, str, len); 369 } 370 371 @Test(expected = HDFException.class) testSDgetdimstrsIllegalId()372 public void testSDgetdimstrsIllegalId() throws Throwable { 373 String[] str = {"", "", "", ""}; 374 int len = 0; 375 HDFLibrary.SDgetdimstrs(-1, str, len); 376 } 377 378 @Test(expected = NullPointerException.class) testSDgetdimstrsNull()379 public void testSDgetdimstrsNull() throws Throwable { 380 int len = 0; 381 HDFLibrary.SDgetdimstrs(0, null, len); 382 } 383 384 @Test(expected = IllegalArgumentException.class) testSDgetdimstrsArgument()385 public void testSDgetdimstrsArgument() throws Throwable { 386 String[] str = {""}; 387 int len = 0; 388 HDFLibrary.SDgetdimstrs(-1, str, len); 389 } 390 391 @Test(expected = HDFException.class) testSDgetdimscaleIllegalId()392 public void testSDgetdimscaleIllegalId() throws Throwable { 393 byte[] data = {0}; 394 HDFLibrary.SDgetdimscale(-1, data); 395 } 396 397 @Test(expected = NullPointerException.class) testSDgetdimscaleNull()398 public void testSDgetdimscaleNull() throws Throwable { 399 HDFLibrary.SDgetdimscale(0, null); 400 } 401 402 @Test(expected = HDFException.class) testSDgetfillvalueIllegalId()403 public void testSDgetfillvalueIllegalId() throws Throwable { 404 byte[] data = {0}; 405 HDFLibrary.SDgetfillvalue(-1, data); 406 } 407 408 @Test(expected = NullPointerException.class) testSDgetfillvalueNull()409 public void testSDgetfillvalueNull() throws Throwable { 410 byte[] data = null; 411 HDFLibrary.SDgetfillvalue(0, data); 412 } 413 414 @Test(expected = HDFException.class) testSDgetrangeIllegalId()415 public void testSDgetrangeIllegalId() throws Throwable { 416 byte[] min = {0}; 417 byte[] max = {0}; 418 HDFLibrary.SDgetrange(-1, max, min); 419 } 420 421 @Test(expected = NullPointerException.class) testSDgetrangeNullMin()422 public void testSDgetrangeNullMin() throws Throwable { 423 byte[] min = null; 424 byte[] max = {0}; 425 HDFLibrary.SDgetrange(0, max, min); 426 } 427 428 @Test(expected = NullPointerException.class) testSDgetrangeNullMax()429 public void testSDgetrangeNullMax() throws Throwable { 430 byte[] min = {0}; 431 byte[] max = null; 432 HDFLibrary.SDgetrange(0, max, min); 433 } 434 435 @Test(expected = HDFException.class) testSDcreateIllegalId()436 public void testSDcreateIllegalId() throws Throwable { 437 String name = ""; 438 long num_type = 0; 439 int rank = 0; 440 int[] dim_sizes = {0}; 441 HDFLibrary.SDcreate(-1, name, num_type, rank, dim_sizes); 442 } 443 444 @Test(expected = NullPointerException.class) testSDcreateNullName()445 public void testSDcreateNullName() throws Throwable { 446 long num_type = 0; 447 int rank = 0; 448 int[] dim_sizes = {0, 0}; 449 HDFLibrary.SDcreate(0, null, num_type, rank, dim_sizes); 450 } 451 452 @Test(expected = NullPointerException.class) testSDcreateNullDims()453 public void testSDcreateNullDims() throws Throwable { 454 String name = ""; 455 long num_type = 0; 456 int rank = 0; 457 HDFLibrary.SDcreate(0, name, num_type, rank, null); 458 } 459 460 // this API call returns false for not record and for failures 461 // maybe failures should return a negative? 462 @Ignore//(expected = HDFException.class) testSDisrecordIllegalId()463 public void testSDisrecordIllegalId() throws Throwable { 464 HDFLibrary.SDisrecord(-1); 465 } 466 467 @Test(expected = HDFException.class) testSDsetattrIllegalId()468 public void testSDsetattrIllegalId() throws Throwable { 469 String name = ""; 470 long num_type = 0; 471 int count = 0; 472 byte[] data = {0}; 473 HDFLibrary.SDsetattr(-1, name, num_type, count, data); 474 } 475 476 @Test(expected = NullPointerException.class) testSDsetattrNullName()477 public void testSDsetattrNullName() throws Throwable { 478 long num_type = 0; 479 int count = 0; 480 byte[] data = {0}; 481 HDFLibrary.SDsetattr(0, null, num_type, count, data); 482 } 483 484 @Test(expected = NullPointerException.class) testSDsetattrNullVals()485 public void testSDsetattrNullVals() throws Throwable { 486 String name = ""; 487 long num_type = 0; 488 int count = 0; 489 byte[] data = null; 490 HDFLibrary.SDsetattr(0, name, num_type, count, data); 491 } 492 493 @Test(expected = HDFException.class) testSDsetcalIllegalId()494 public void testSDsetcalIllegalId() throws Throwable { 495 double val = 0; 496 int num_type = 0; 497 HDFLibrary.SDsetcal(-1, val, val, val, val, num_type); 498 } 499 500 @Test(expected = HDFException.class) testSDsetdatastrsIllegalId()501 public void testSDsetdatastrsIllegalId() throws Throwable { 502 String[] str = {"", "", "", ""}; 503 HDFLibrary.SDsetdatastrs(-1, str[0], str[1], str[2], str[3]); 504 } 505 506 @Test(expected = HDFException.class) testSDsetdimnameIllegalId()507 public void testSDsetdimnameIllegalId() throws Throwable { 508 String str = ""; 509 HDFLibrary.SDsetdimname(-1, str); 510 } 511 512 @Test(expected = NullPointerException.class) testSDsetdimnameNull()513 public void testSDsetdimnameNull() throws Throwable { 514 String str = null; 515 HDFLibrary.SDsetdimname(-1, str); 516 } 517 518 @Test(expected = HDFException.class) testSDsetdimscaleIllegalId()519 public void testSDsetdimscaleIllegalId() throws Throwable { 520 int num_type = 0; 521 int count = 0; 522 byte[] data = {0}; 523 HDFLibrary.SDsetdimscale(-1, count, num_type, data); 524 } 525 526 @Test(expected = NullPointerException.class) testSDsetdimscaleNull()527 public void testSDsetdimscaleNull() throws Throwable { 528 int num_type = 0; 529 int count = 0; 530 byte[] data = null; 531 HDFLibrary.SDsetdimscale(0, count, num_type, data); 532 } 533 534 @Test(expected = HDFException.class) testSDsetdimstrsIllegalId()535 public void testSDsetdimstrsIllegalId() throws Throwable { 536 String[] str = {"", "", ""}; 537 HDFLibrary.SDsetdimstrs(-1, str[0], str[1], str[2]); 538 } 539 540 @Test(expected = HDFException.class) testSDsetexternalfileIllegalId()541 public void testSDsetexternalfileIllegalId() throws Throwable { 542 String str = ""; 543 int offset = 0; 544 HDFLibrary.SDsetexternalfile(-1, str, offset); 545 } 546 547 @Test(expected = NullPointerException.class) testSDsetexternalfileNull()548 public void testSDsetexternalfileNull() throws Throwable { 549 String str = null; 550 int offset = 0; 551 HDFLibrary.SDsetexternalfile(-1, str, offset); 552 } 553 554 @Test(expected = HDFException.class) testSDsetfillvalueIllegalId()555 public void testSDsetfillvalueIllegalId() throws Throwable { 556 byte[] data = {0}; 557 HDFLibrary.SDsetfillvalue(-1, data); 558 } 559 560 @Test(expected = NullPointerException.class) testSDsetfillvalueNull()561 public void testSDsetfillvalueNull() throws Throwable { 562 byte[] data = null; 563 HDFLibrary.SDsetfillvalue(0, data); 564 } 565 566 @Test(expected = HDFException.class) testSDsetrangeIllegalId()567 public void testSDsetrangeIllegalId() throws Throwable { 568 byte[] min = {0}; 569 byte[] max = {0}; 570 HDFLibrary.SDsetrange(-1, max, min); 571 } 572 573 @Test(expected = NullPointerException.class) testSDsetrangeNullMin()574 public void testSDsetrangeNullMin() throws Throwable { 575 byte[] min = null; 576 byte[] max = {0}; 577 HDFLibrary.SDsetrange(0, max, min); 578 } 579 580 @Test(expected = NullPointerException.class) testSDsetrangeNullMax()581 public void testSDsetrangeNullMax() throws Throwable { 582 byte[] min = {0}; 583 byte[] max = null; 584 HDFLibrary.SDsetrange(0, max, min); 585 } 586 587 @Test(expected = HDFException.class) testSDwritedataIllegalId()588 public void testSDwritedataIllegalId() throws Throwable { 589 int[] start = {0, 0}; 590 int[] stride = {0, 0}; 591 int[] count = {0, 0}; 592 byte[] data = {0}; 593 HDFLibrary.SDwritedata(-1, start, stride, count, data); 594 } 595 596 @Test(expected = NullPointerException.class) testSDwritedataNullData()597 public void testSDwritedataNullData() throws Throwable { 598 int[] start = {0, 0}; 599 int[] stride = {0, 0}; 600 int[] count = {0, 0}; 601 HDFLibrary.SDwritedata(0, start, stride, count, null); 602 } 603 604 @Test(expected = NullPointerException.class) testSDwritedataNullStart()605 public void testSDwritedataNullStart() throws Throwable { 606 int[] stride = {0, 0}; 607 int[] count = {0, 0}; 608 byte[] data = {0}; 609 HDFLibrary.SDwritedata(0, null, stride, count, data); 610 } 611 612 @Test(expected = NullPointerException.class) testSDwritedataNullCount()613 public void testSDwritedataNullCount() throws Throwable { 614 int[] start = {0, 0}; 615 int[] stride = {0, 0}; 616 byte[] data = {0}; 617 HDFLibrary.SDwritedata(0, start, stride, null, data); 618 } 619 620 @Test(expected = HDFException.class) testSDsetnbitdatasetIllegalId()621 public void testSDsetnbitdatasetIllegalId() throws Throwable { 622 int start_bit = 0; 623 int bit_len = 0; 624 int sign_ext = 0; 625 int fill_one = 0; 626 HDFLibrary.SDsetnbitdataset(-1, start_bit, bit_len, sign_ext, fill_one); 627 } 628 629 @Test(expected = HDFException.class) testSDsetcompressIllegalId()630 public void testSDsetcompressIllegalId() throws Throwable { 631 int type = 0; 632 HDFCompInfo comp_info = new HDFCompInfo(); 633 HDFLibrary.SDsetcompress(-1, type, comp_info); 634 } 635 636 @Test(expected = NullPointerException.class) testSDsetcompressNull()637 public void testSDsetcompressNull() throws Throwable { 638 int type = 0; 639 HDFCompInfo comp_info = null; 640 HDFLibrary.SDsetcompress(0, type, null); 641 } 642 643 @Test(expected = HDFException.class) testSDgetcompinfoIllegalId()644 public void testSDgetcompinfoIllegalId() throws Throwable { 645 HDFCompInfo comp_info = new HDFCompInfo(); 646 HDFLibrary.SDgetcompinfo(-1, comp_info); 647 } 648 649 @Test(expected = NullPointerException.class) testSDgetcompinfoNull()650 public void testSDgetcompinfoNull() throws Throwable { 651 HDFCompInfo comp_info = null; 652 HDFLibrary.SDgetcompinfo(0, null); 653 } 654 655 @Test(expected = HDFException.class) testSDsetaccesstypeIllegalId()656 public void testSDsetaccesstypeIllegalId() throws Throwable { 657 int index = 0; 658 HDFLibrary.SDsetaccesstype(-1, index); 659 } 660 661 @Test(expected = HDFException.class) testSDsetblocksizeIllegalId()662 public void testSDsetblocksizeIllegalId() throws Throwable { 663 int block_size = 0; 664 HDFLibrary.SDsetblocksize(-1, block_size); 665 } 666 667 @Test(expected = HDFException.class) testSDsetfillmodeIllegalId()668 public void testSDsetfillmodeIllegalId() throws Throwable { 669 boolean fill_enable = false; 670 HDFLibrary.SDsetfillmode(-1, fill_enable); 671 } 672 673 @Test(expected = HDFException.class) testSDsetdimval_compIllegalId()674 public void testSDsetdimval_compIllegalId() throws Throwable { 675 int comp_mode = 0; 676 HDFLibrary.SDsetdimval_comp(-1, comp_mode); 677 } 678 679 @Test(expected = HDFException.class) testSDisdimval_bwcompIllegalId()680 public void testSDisdimval_bwcompIllegalId() throws Throwable { 681 HDFLibrary.SDisdimval_bwcomp(-1); 682 } 683 684 @Test(expected = HDFException.class) testSDsetchunkIllegalId()685 public void testSDsetchunkIllegalId() throws Throwable { 686 int flags = 0; 687 HDFChunkInfo chunk_def = new HDFChunkInfo(); 688 HDFLibrary.SDsetchunk(-1, chunk_def, flags); 689 } 690 691 @Test(expected = NullPointerException.class) testSDsetchunkNull()692 public void testSDsetchunkNull() throws Throwable { 693 int flags = 0; 694 HDFChunkInfo chunk_def = null; 695 HDFLibrary.SDsetchunk(0, null, flags); 696 } 697 698 //Library routine check of ID will not fail - it will just crash 699 @Ignore//(expected = HDFException.class) testSDreadchunkIllegalId()700 public void testSDreadchunkIllegalId() throws Throwable { 701 int[] args = {0, 0}; 702 byte[] data = {0}; 703 HDFLibrary.SDreadchunk(-1, args, data); 704 } 705 706 @Test(expected = NullPointerException.class) testSDreadchunkNull()707 public void testSDreadchunkNull() throws Throwable { 708 int[] args = {0, 0}; 709 byte[] data = null; 710 HDFLibrary.SDreadchunk(0, args, data); 711 } 712 713 @Test(expected = NullPointerException.class) testSDreadchunkNullArgument()714 public void testSDreadchunkNullArgument() throws Throwable { 715 byte[] data = {0}; 716 HDFLibrary.SDreadchunk(0, null, data); 717 } 718 719 @Test(expected = HDFException.class) testSDsetchunkcacheIllegalId()720 public void testSDsetchunkcacheIllegalId() throws Throwable { 721 int maxcache = 0; 722 int flags = 0; 723 HDFLibrary.SDsetchunkcache(-1, maxcache, flags); 724 } 725 726 //Library routine check of ID will not fail - it will just crash 727 @Ignore//(expected = HDFException.class) testSDwritechunkIllegalId()728 public void testSDwritechunkIllegalId() throws Throwable { 729 int[] args = {0, 0}; 730 byte[] data = {0}; 731 HDFLibrary.SDwritechunk(-1, args, data); 732 } 733 734 @Test(expected = NullPointerException.class) testSDwritechunkNull()735 public void testSDwritechunkNull() throws Throwable { 736 int[] args = {0, 0}; 737 byte[] data = null; 738 HDFLibrary.SDwritechunk(0, args, data); 739 } 740 741 @Test(expected = NullPointerException.class) testSDwritechunkNullArgument()742 public void testSDwritechunkNullArgument() throws Throwable { 743 byte[] data = {0}; 744 HDFLibrary.SDwritechunk(0, null, data); 745 } 746 } 747