Sha256: d19c1b5ea5660972b8c976b8a6463d76babb9bba64bfff990cc612f30c3c95fa

Contents?: true

Size: 1.71 KB

Versions: 143

Compression:

Stored size: 1.71 KB

Contents

#!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require_relative 'accumulate'

class ArrayTest < Minitest::Test
  def test_empty_accumulation
    assert_equal [], [].accumulate { |e| e * e }
  end

  def test_accumulate_squares
    skip
    result = [1, 2, 3].accumulate do |number|
      number * number
    end
    assert_equal [1, 4, 9], result
  end

  def test_accumulate_upcases
    skip
    result = %w(hello world).accumulate(&:upcase)
    assert_equal %w(HELLO WORLD), result
  end

  def test_accumulate_reversed_strings
    skip
    result = %w(the quick brown fox etc).accumulate(&:reverse)
    assert_equal %w(eht kciuq nworb xof cte), result
  end

  def test_accumulate_recursively
    skip
    result = %w(a b c).accumulate do |char|
      %w(1 2 3).accumulate do |digit|
        "#{char}#{digit}"
      end
    end
    assert_equal [%w(a1 a2 a3), %w(b1 b2 b3), %w(c1 c2 c3)], result
  end

  def test_do_not_change_in_place
    skip
    original = [1, 2, 3]
    copy = original.dup
    original.accumulate { |n| n * n }
    assert_equal copy, original
  end

  # Problems in exercism evolve over time, as we find better ways to ask
  # questions.
  # The version number refers to the version of the problem you solved,
  # not your solution.
  #
  # Define a constant named VERSION inside of the top level BookKeeping
  # module.
  #  In your file, it will look like this:
  #
  # module BookKeeping
  #   VERSION = 1 # Where the version number matches the one in the test.
  # end
  #
  # If you are curious, read more about constants on RubyDoc:
  # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html

  def test_bookkeeping
    skip
    assert_equal 1, BookKeeping::VERSION
  end
end

Version data entries

143 entries across 143 versions & 1 rubygems

Version Path
trackler-2.1.0.7 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.1.0.6 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.1.0.5 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.1.0.4 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.1.0.3 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.1.0.2 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.1.0.1 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.1.0.0 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.55 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.54 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.53 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.52 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.51 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.50 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.49 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.48 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.47 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.46 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.45 tracks/ruby/exercises/accumulate/accumulate_test.rb
trackler-2.0.8.44 tracks/ruby/exercises/accumulate/accumulate_test.rb