Sha256: cf5517d1c70d99c8237a93dbe11f111ec55878596662b06437de6471f794807c
Contents?: true
Size: 1.85 KB
Versions: 20
Compression:
Stored size: 1.85 KB
Contents
# This file is part of Libusb for Ruby. # # Libusb for Ruby is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Libusb for Ruby is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with Libusb for Ruby. If not, see <http://www.gnu.org/licenses/>. require "minitest/autorun" require "libusb" class TestLibusbStructs < Minitest::Test def test_struct_Timeval s = LIBUSB::Call::Timeval.new assert_equal 0, s.in_ms s.in_ms = 12345678 assert_equal 12345, s[:tv_sec] assert_equal 678000, s[:tv_usec] assert_equal 12345678, s.in_ms s.in_s = 1234.5678 assert_equal 1234, s[:tv_sec] assert_equal 567800, s[:tv_usec] assert_equal 1234.5678, s.in_s end def test_struct_CompletionFlag s = LIBUSB::Context::CompletionFlag.new assert_equal 0, s[:completed] assert_equal false, s.completed? s.completed = true assert_equal 1, s[:completed] assert_equal true, s.completed? s.completed = false assert_equal false, s.completed? assert_equal 0, s[:completed] end def test_Transfer t = LIBUSB::InterruptTransfer.new allow_device_memory: true assert_equal :TRANSFER_COMPLETED, t.status assert_equal true, t.allow_device_memory assert_equal nil, t.memory_type t.alloc_buffer(10) assert_equal :user_space, t.memory_type, "no device assigned -> should use memory from user space" t.free_buffer assert_equal nil, t.memory_type end end
Version data entries
20 entries across 20 versions & 1 rubygems