Sha256: 91391fccf730c79f1483a5ca3c61082aa44d5217f8a1867d3ddff95d229b40a2

Contents?: true

Size: 598 Bytes

Versions: 5

Compression:

Stored size: 598 Bytes

Contents

require 'test/unit'
require_relative '../../lib/array_logic'

module ArrayLogic
  class ThingTest < Test::Unit::TestCase
    def test_make
      number = 10
      things = Thing.make(number)
      assert_equal(number, things.length)
      assert_equal((1..number).to_a, things.values.collect(&:id))
      assert_equal((1..number).to_a, things.keys)
    end
    
    def test_cost
      thing = Thing.new(1)
      assert_equal(2, thing.cost)
    end
    
    def test_id_odd
      things = Thing.make(4)
      assert_equal([true, nil, true, nil], things.values.collect(&:id_odd?))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
array_logic-0.2.4 test/array_logic/thing_test.rb
array_logic-0.2.3 test/array_logic/thing_test.rb
array_logic-0.2.2 test/array_logic/thing_test.rb
array_logic-0.2.1 test/array_logic/thing_test.rb
array_logic-0.2.0 test/array_logic/thing_test.rb