diff options
Diffstat (limited to 'test/dl/test_c_struct_entry.rb')
-rw-r--r-- | test/dl/test_c_struct_entry.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/dl/test_c_struct_entry.rb b/test/dl/test_c_struct_entry.rb index b83cde85e0..aa49a99572 100644 --- a/test/dl/test_c_struct_entry.rb +++ b/test/dl/test_c_struct_entry.rb @@ -37,5 +37,17 @@ class DL::TestCStructEntity < DL::TestBase assert_equal expected, size end + + def test_set_ctypes + union = DL::CStructEntity.malloc [DL::TYPE_INT, DL::TYPE_LONG] + union.assign_names %w[int long] + + # this test is roundabout because the stored ctypes are not accessible + union['long'] = 1 + union['int'] = 2 + + assert_equal 1, union['long'] + assert_equal 2, union['int'] + end end |