Skip to content

Commit c654a93

Browse files
committed
Add simple testing
1 parent 0e1e4c2 commit c654a93

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

test/fixtures/example.h5

4.64 KB
Binary file not shown.

test/hdf5_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,19 @@ class HDF5Test < Test::Unit::TestCase
1818
assert_equal(10, minor.read_int)
1919
assert_kind_of(Integer, release.read_int)
2020
end
21+
22+
test 'example' do
23+
f = HDF5::File.new(File.join(__dir__, 'fixtures', 'example.h5'))
24+
assert_equal(%w[foo], f.list_entries)
25+
g = f['foo']
26+
assert_equal(%w[bar_float bar_int], g.list_datasets)
27+
d = g['bar_float']
28+
assert_equal([10], d.shape)
29+
assert_equal(:H5T_FLOAT, d.dtype)
30+
assert_equal([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], d.read)
31+
d = g['bar_int']
32+
assert_equal([10], d.shape)
33+
assert_equal(:H5T_INTEGER, d.dtype)
34+
assert_equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], d.read)
35+
end
2136
end

0 commit comments

Comments
 (0)