public void H5Ovisit_by_nameTest2() { string path = String.Join("/", m_utf8strings); Assert.IsTrue(H5G.create(m_v0_test_file, Encoding.UTF8.GetBytes(path), m_lcpl_utf8) >= 0); Assert.IsTrue(H5G.create(m_v2_test_file, Encoding.UTF8.GetBytes(path), m_lcpl_utf8) >= 0); ArrayList al = new ArrayList(); GCHandle hnd = GCHandle.Alloc(al); IntPtr op_data = (IntPtr)hnd; // the callback is defined in H5LTest.cs H5O.iterate_t cb = DelegateMethod; Assert.IsTrue(H5O.visit_by_name(m_v0_test_file, Encoding.UTF8.GetBytes(m_utf8strings[0]), H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 5 elements in the array list Assert.IsTrue(al.Count == 5); Assert.IsTrue(H5O.visit_by_name(m_v2_test_file, Encoding.UTF8.GetBytes(m_utf8strings[0]), H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 10 (5 + 5) elements in the array list Assert.IsTrue(al.Count == 10); hnd.Free(); }
public void H5Ovisit_by_nameTest1() { Assert.IsTrue(H5G.create(m_v0_test_file, "A/B/C/D", m_lcpl) >= 0); Assert.IsTrue( H5L.create_hard(m_v0_test_file, "A/B/C/D", m_v0_test_file, "shortcut") >= 0); Assert.IsTrue(H5G.create(m_v2_test_file, "A/B/C/D", m_lcpl) >= 0); Assert.IsTrue( H5L.create_hard(m_v2_test_file, "A/B/C/D", m_v2_test_file, "shortcut") >= 0); ArrayList al = new ArrayList(); GCHandle hnd = GCHandle.Alloc(al); IntPtr op_data = (IntPtr)hnd; // the callback is defined in H5LTest.cs H5O.iterate_t cb = DelegateMethod; Assert.IsTrue(H5O.visit_by_name(m_v0_test_file, "A", H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 4 elements in the array list Assert.IsTrue(al.Count == 4); Assert.IsTrue(H5O.visit_by_name(m_v2_test_file, "A", H5.index_t.NAME, H5.iter_order_t.NATIVE, cb, op_data) >= 0); // we should have 8 (4 + 4) elements in the array list Assert.IsTrue(al.Count == 8); hnd.Free(); }