Files
hdf5/java/test/TestH5Tparams.java
Allen Byrne 216bff5778 #386 copyright corrections for java folder (#389)
* OESS-98 convert plugin option to FetchContent, add tests

* Fixes for pkcfg files because of plugin option

* OESS-98 fix tools test for plugins

* Keep doxygen comments under 100 chars long - format hint

* Whitespace

* HDFFV-11144 - Reclassify CMake messages

* HDFFV-11099/11100 added help text

* Reworked switch statement to compare string instead

* Fix typo

* Update CDash mode

* Correct name of threadsafe

* Correct option name

* Undo accidental commit

* Note LLVM 10 to 11 format default changes

* Update format plugin

* Undo clang-format version 11 changes

* One more correction

* Update supported platforms

* Revert whitespace changes

* Correct whitespace

* Changes from PR#3

* HDFFV-11213 added option to control gcc10 warnings diagnostics

* HDFFV-11212 Use the new references correctly in JNI utility and tests

* format source

* Fix typo

* Add new test file

* HDFFV-11212 - update test and remove unused arg

* Minor non-space formatting changes

* Use H5I_INVALID_ID instead of "-1"

* source formatting

* add missing testfile, update jni function

* Undo commit of debug code

* remove mislocated file

* Fix h5repack test for handling of fapls and id close

* Update h5diff test files usage text

* HDFFV-11212 add new ref tests for JNI export dataset

* src format update

* Remove blank line typo

* src format typo

* long double requires %Lg

* Another long double foramt specifer S.B. %Lg

* issue with t128bit test

* Windows issue with h5dump and type.

* Fix review issues

* refactor function nesting and fix error checks

* format fixes

* Remove untested functions and javadoc quiet comments

* Restore TRY block.

* Change string append errors to memory exception

* revert to H5_JNI_FATAL_ERROR - support functions need work

* Add assertion error for h5util functions

* remove duplicate function

* format fix

* Revert HD function error handling

* Update copyright comments

* GH #386 java folder copyright corrections

* Whitespace
2021-02-26 09:27:15 -06:00

408 lines
13 KiB
Java

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package test;
import static org.junit.Assert.assertTrue;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5Tparams {
@Rule public TestName testname = new TestName();
@Before
public void checkOpenIDs() {
assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
System.out.print(testname.getMethodName());
}
@After
public void nextTestName() {
System.out.println();
}
@Test//(expected = HDF5LibraryException.class)
public void testH5Tclose_invalid() throws Throwable {
long tid = H5.H5Tclose(-1);
assertTrue(tid == 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tcopy_invalid() throws Throwable {
H5.H5Tcopy(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tequal_invalid() throws Throwable {
H5.H5Tequal(-1, -1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tlock_invalid() throws Throwable {
H5.H5Tlock(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_class_invalid() throws Throwable {
H5.H5Tget_class(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_size_invalid() throws Throwable {
H5.H5Tget_size(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_size_invalid() throws Throwable {
H5.H5Tset_size(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_order_invalid() throws Throwable {
H5.H5Tget_order(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_order_invalid() throws Throwable {
H5.H5Tset_order(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_precision_invalid() throws Throwable {
H5.H5Tget_precision(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_precision_long_invalid() throws Throwable {
H5.H5Tget_precision_long(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_precision_invalid() throws Throwable {
H5.H5Tset_precision(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_offset_invalid() throws Throwable {
H5.H5Tget_offset(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_offset_invalid() throws Throwable {
H5.H5Tset_offset(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tcreate_invalid() throws Throwable {
H5.H5Tcreate(-1, (long)0);
}
@Test(expected = NullPointerException.class)
public void testH5Topen_null() throws Throwable {
H5.H5Topen(-1, null, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Topen_invalid() throws Throwable {
H5.H5Topen(-1, "Bogus", 0);
}
@Test(expected = NullPointerException.class)
public void testH5Tcommit_null() throws Throwable {
H5.H5Tcommit(-1, null, 0, -1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tcommit_invalid() throws Throwable {
H5.H5Tcommit(-1, "Bogus", -1, -1, -1, -1);
}
@Test(expected = NullPointerException.class)
public void testH5Tget_pad_null() throws Throwable {
H5.H5Tget_pad(-1, null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_pad_invalid() throws Throwable {
int[] pad = new int[2];
H5.H5Tget_pad(-1, pad);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_pad_invalid() throws Throwable {
H5.H5Tset_pad(-1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_sign_invalid() throws Throwable {
H5.H5Tget_sign(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_sign_invalid() throws Throwable {
H5.H5Tset_sign(-1, 0);
}
@Test(expected = NullPointerException.class)
public void testH5Tget_fields_null() throws Throwable {
H5.H5Tget_fields(-1, (long[])null);
}
@Test(expected = IllegalArgumentException.class)
public void testH5Tget_fields_length_invalid() throws Throwable {
long[] fields = new long[2];
H5.H5Tget_fields(-1, fields);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_fields_invalid() throws Throwable {
long[] fields = new long[5];
H5.H5Tget_fields(-1, fields);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_fields_invalid() throws Throwable {
H5.H5Tset_fields(-1, -1, -1, -1, -1, -1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_ebias_invalid() throws Throwable {
H5.H5Tget_ebias(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_ebias_long_invalid() throws Throwable {
H5.H5Tget_ebias_long(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_ebias_invalid() throws Throwable {
H5.H5Tset_ebias(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_norm_invalid() throws Throwable {
H5.H5Tget_norm(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_norm_invalid() throws Throwable {
H5.H5Tset_norm(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_inpad_invalid() throws Throwable {
H5.H5Tget_inpad(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_inpad_invalid() throws Throwable {
H5.H5Tset_inpad(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_cset_invalid() throws Throwable {
H5.H5Tget_cset(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_cset_invalid() throws Throwable {
H5.H5Tset_cset(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_strpad_invalid() throws Throwable {
H5.H5Tget_strpad(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_strpad_invalid() throws Throwable {
H5.H5Tset_strpad(-1, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_nmembers_invalid() throws Throwable {
H5.H5Tget_nmembers(-1);
}
@Test(expected = NullPointerException.class)
public void testH5Tget_member_index_null() throws Throwable {
H5.H5Tget_member_index(-1, null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_member_index_invalid() throws Throwable {
H5.H5Tget_member_index(-1, "Bogus");
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_member_type_invalid() throws Throwable {
H5.H5Tget_member_type(-1, -1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_member_class_invalid() throws Throwable {
H5.H5Tget_member_class(-1, -1);
}
@Test(expected = NullPointerException.class)
public void testH5Tinsert_null() throws Throwable {
H5.H5Tinsert(-1, null, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tinsert_invalid() throws Throwable {
H5.H5Tinsert(-1, "Bogus", 0, 0);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tpack_invalid() throws Throwable {
H5.H5Tpack(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Treclaim_invalid() throws Throwable {
byte[] buf = new byte[2];
H5.H5Treclaim(-1, -1, -1, buf);
}
@Test(expected = NullPointerException.class)
public void testH5Treclaim_null() throws Throwable {
H5.H5Treclaim(-1, -1, -1, null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tvlen_create_invalid() throws Throwable {
H5.H5Tvlen_create(-1);
}
@Test(expected = NullPointerException.class)
public void testH5Tset_tag_null() throws Throwable {
H5.H5Tset_tag(-1, null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tset_tag_invalid() throws Throwable {
H5.H5Tset_tag(-1, "Bogus");
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_super_invalid() throws Throwable {
H5.H5Tget_super(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tenum_create_invalid() throws Throwable {
H5.H5Tenum_create(-1);
}
@Test(expected = NullPointerException.class)
public void testH5Tenum_insert_name_null() throws Throwable {
H5.H5Tenum_insert(-1, null, (byte[])null);
}
@Test(expected = NullPointerException.class)
public void testH5Tenum_insert_null() throws Throwable {
H5.H5Tenum_insert(-1, "bogus", (byte[])null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tenum_insert_invalid() throws Throwable {
byte[] enumtype = new byte[2];
H5.H5Tenum_insert(-1, "bogus", enumtype);
}
@Test(expected = IllegalArgumentException.class)
public void testH5Tenum_nameof_invalid_size() throws Throwable {
H5.H5Tenum_nameof(-1, null, -1);
}
@Test(expected = NullPointerException.class)
public void testH5Tenum_nameof_value_null() throws Throwable {
H5.H5Tenum_nameof(-1, null, 1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tenum_nameof_invalid() throws Throwable {
byte[] btype = new byte[2];
H5.H5Tenum_nameof(-1, btype, 1);
}
@Test(expected = NullPointerException.class)
public void testH5Tenum_valueof_name_null() throws Throwable {
H5.H5Tenum_valueof(-1, null, (byte[])null);
}
@Test(expected = NullPointerException.class)
public void testH5Tenum_valueof_null() throws Throwable {
H5.H5Tenum_valueof(-1, "bogus", (byte[])null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tenum_valueof_invalid() throws Throwable {
byte[] btype = new byte[2];
H5.H5Tenum_valueof(-1, "bogus", btype);
}
@Test(expected = NullPointerException.class)
public void testH5Tget_member_value_null() throws Throwable {
H5.H5Tget_member_value(-1, -1, (byte[])null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_member_value_invalid() throws Throwable {
byte[] btype = new byte[2];
H5.H5Tget_member_value(-1, -1, btype);
}
@Test(expected = IllegalArgumentException.class)
public void testH5Tarray_create_invalid() throws Throwable {
H5.H5Tarray_create(-1, -1, null);
}
@Test(expected = NullPointerException.class)
public void testH5Tarray_create_value_null() throws Throwable {
H5.H5Tarray_create(-1, 1, null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_array_ndims_invalid() throws Throwable {
H5.H5Tget_array_ndims(-1);
}
@Test(expected = NullPointerException.class)
public void testH5Tget_array_dims_null() throws Throwable {
H5.H5Tget_array_dims(-1, null);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tget_native_type_invalid() throws Throwable {
H5.H5Tget_native_type(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Tflush_invalid() throws Throwable {
H5.H5Tflush(-1);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Trefresh_invalid() throws Throwable {
H5.H5Trefresh(-1);
}
}