<commit_before>require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "IO#ioctl" do
  it "raises IOError on closed stream" do
    lambda { IOSpecs.closed_io.ioctl(5, 5) }.should raise_error(IOError)
  end

  platform_is :os => :linux do
    platform_is "86" do # x86 / x86_64
      it "resizes an empty String to match the output size" do
        File.open(__FILE__, 'r') do |f|
          buffer = ''
          # FIONREAD in /usr/include/asm-generic/ioctls.h
          f.ioctl 0x541B, buffer
          buffer.unpack('I').first.should be_kind_of(Integer)
        end
      end
    end

    platform_is "powerpc64" do
      it "resizes an empty String to match the output size" do
        File.open(__FILE__, 'r') do |f|
          buffer = ''
          # FIONREAD in /usr/include/asm-generic/ioctls.h
          f.ioctl 0x8004667f, buffer
          buffer.unpack('I').first.should be_kind_of(Integer)
        end
      end
    end

    it "raises an Errno error when ioctl fails" do
      File.open(__FILE__, 'r') do |f|
        lambda {
          # TIOCGWINSZ in /usr/include/asm-generic/ioctls.h
          f.ioctl 0x5413, nil
        }.should raise_error(Errno::ENOTTY)
      end
    end
  end
end<commit_msg>remove because the value seems wrong<commit_after>require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "IO#ioctl" do
  it "raises IOError on closed stream" do
    lambda { IOSpecs.closed_io.ioctl(5, 5) }.should raise_error(IOError)
  end

  platform_is :os => :linux do
    platform_is "86" do # x86 / x86_64
      it "resizes an empty String to match the output size" do
        File.open(__FILE__, 'r') do |f|
          buffer = ''
          # FIONREAD in /usr/include/asm-generic/ioctls.h
          f.ioctl 0x541B, buffer
          buffer.unpack('I').first.should be_kind_of(Integer)
        end
      end
    end

    it "raises an Errno error when ioctl fails" do
      File.open(__FILE__, 'r') do |f|
        lambda {
          # TIOCGWINSZ in /usr/include/asm-generic/ioctls.h
          f.ioctl 0x5413, nil
        }.should raise_error(Errno::ENOTTY)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11121036176864672, 'fraction_numerical': 0.021438142027690933, 'mean_word_length': 2.279648609077599, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5356306', 'n_tokens_mistral': 785, 'n_tokens_neox': 754, 'n_words': 202}