Sha256: c348c5557d05a354504ad0794ade728dc86d39d5f5d7b72ef676f885255606d8
Contents?: true
Size: 1.5 KB
Versions: 12
Compression:
Stored size: 1.5 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 TestLibusbIsoTransfer < Minitest::Test include LIBUSB def setup c = Context.new begin @dev = c.devices.first.open rescue LIBUSB::ERROR_ACCESS @dev = nil skip "error opening device" end end def teardown @dev.close if @dev end def test_iso_transfer tr = IsochronousTransfer.new 10, :dev_handle=>@dev assert_equal 10, tr.num_packets, "number of packets should match" tr.buffer = " "*130 tr.packet_lengths = 13 tr[7].length = 12 assert_equal 12, tr[7].length, "packet length should be set" assert_equal 13, tr[8].length, "packet length should be set" assert_raises(LIBUSB::ERROR_IO, "the randomly choosen device will probably not handle iso transfer") do tr.submit! end end end
Version data entries
12 entries across 12 versions & 1 rubygems