Sha256: 942989ddc4e1132261c8ff32537b55cc317efab54369cc5267d66c0edea78461

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 Bytes

Contents

require 'test_helper'
require 'stringio'

describe XXhash do
  it 'returns hash' do
    assert_equal 2758658570, XXhash.xxh32('test', 123)
  end

  describe 'StreamingHash' do
    it 'rises ArgumentError if forst argument is not IO object' do
      assert_raises(ArgumentError) do
        XXhash.xxh32_stream('test', 123)
      end
    end

    it 'returns the hash for streamed strings' do
      assert_equal 2758658570, XXhash.xxh32_stream(StringIO.new('test'), 123)
    end

    it 'returns the hash for streamed files' do
      h1 = XXhash.xxh32(File.read(__FILE__), 123)
      h2 = XXhash.xxh32_stream(File.open(__FILE__), 123)
      assert_equal h1, h2
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xxhash-0.2.0 test/xxhash_test.rb