Sha256: 7680947e91e52deb1a932480bde6ea5f5a0a382ae4b613e8e2bee8b38ad0f49a

Contents?: true

Size: 536 Bytes

Versions: 1

Compression:

Stored size: 536 Bytes

Contents

require 'test/unit'
require "#{File.dirname(__FILE__)}/../../lib/bencode.rb"

class BencodeIntegerTest < Test::Unit::TestCase
  def test_zero
    assert_equal 'i0e', 0.bencode
  end

  def test_single_digit
    (1..9).each do |digit|
      assert_equal "i#{digit}e", digit.bencode
    end
  end

  def test_multi_digit
    (1..10).each do |digit|
      assert_equal "i#{digit * 10}e", (digit * 10).bencode
    end
  end

  def test_negative
    (-9..-1).each do |digit|
      assert_equal "i#{digit}e", digit.bencode
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bencode-0.5.0 test/encode/test_integer.rb