Sha256: 5da730e46acb1ca78d6bc53b7f0110c9b9bedf6ce8a34e2ab5240340cb9e0e4e

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'setup_tests'

class ArrayTest < Test::Unit::TestCase
  context 'the Array class' do
    should 'return the product key for a microsoft product via #to_ms_product_key' do
      product_key_binary = [164, 1, 1, 0, 3, 0, 0, 0, 53, 53, 48, 52, 49, 45, 49, 56, 54, 45, 48, 49, 51, 51, 48,
        51, 53, 45, 55, 53, 55, 54, 51, 0, 151, 0, 0, 0, 88, 49, 52, 45, 50, 51, 56, 57, 54, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

      assert_equal('BBBBB-BBBBB-BBBBB-BBBBB-BBBBB', product_key_binary.to_ms_product_key)
    end

    should 'return each item of an array as a nil-values key-value pair via #to_nil_hash' do
      assert_equal({:value_one=>nil, :value_two=>nil}, ['value_one', 'value_two'].to_nil_hash)
    end

    should 'return the wwn of an array via #to_wwn' do
      assert_equal('00000000aaaaaaaa', [0, 0, 0, 0, 170, 170, 170, 170].to_wwn)
    end

    should 'recursively strip the string values within an array via #strip_string_values_in_array' do
      assert_equal([1, 'a', 'c', ['x', 'y']], [1, 'a ', ' c ', [' x ', ' y ']].strip_string_values_in_array)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
boris-1.0.0.beta.1 ./test/helper_tests/test_array.rb