Sha256: 9aa1fa3cebe9149d4fd111e96780f8b1548cefd518c0a25ed0970baedde245b7

Contents?: true

Size: 1.18 KB

Versions: 26

Compression:

Stored size: 1.18 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/>.
#
# These tests should be started with valgrind to check for
# invalid memmory access.

require "test/unit"
require "libusb"

class TestLibusbGc < Test::Unit::TestCase
  include LIBUSB

  def get_some_endpoint
    Context.new.devices.each do |dev|
      return dev.endpoints.last unless dev.endpoints.empty?
    end
  end

  def test_descriptors
    ep = get_some_endpoint
    ps = ep.wMaxPacketSize
    GC.start
    assert_equal ps, ep.wMaxPacketSize, "GC should not free EndpointDescriptor"
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
libusb-0.3.4-x86-mingw32 test/test_libusb_gc.rb
libusb-0.3.4-x64-mingw32 test/test_libusb_gc.rb
libusb-0.3.4 test/test_libusb_gc.rb
libusb-0.3.3-x86-mingw32 test/test_libusb_gc.rb
libusb-0.3.3-x64-mingw32 test/test_libusb_gc.rb
libusb-0.3.3 test/test_libusb_gc.rb
libusb-0.3.2-x86-mingw32 test/test_libusb_gc.rb
libusb-0.3.2 test/test_libusb_gc.rb
libusb-0.3.1-x86-mingw32 test/test_libusb_gc.rb
libusb-0.3.1 test/test_libusb_gc.rb
libusb-0.3.0-x86-mingw32 test/test_libusb_gc.rb
libusb-0.3.0 test/test_libusb_gc.rb
libusb-0.2.2-x86-mingw32 test/test_libusb_gc.rb
libusb-0.2.2 test/test_libusb_gc.rb
libusb-0.2.1-x86-mingw32 test/test_libusb_gc.rb
libusb-0.2.1 test/test_libusb_gc.rb
libusb-0.2.0-x86-mingw32 test/test_libusb_gc.rb
libusb-0.2.0 test/test_libusb_gc.rb
libusb-0.1.3-x86-mingw32 test/test_libusb_gc.rb
libusb-0.1.3 test/test_libusb_gc.rb