Sha256: 66bd9ab64c83986ce1e9baa4abf4ce45d6275f47b4dcadb306c6ac9811a4389e

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

require "test_helper"

class SungemmTest < MiniTest::Unit::TestCase
  def test_fibo_finder
    assert_equal 0, Sungemm.fibo_finder(0)
    assert_equal 1, Sungemm.fibo_finder(1)
    assert_equal 3, Sungemm.fibo_finder(4)
    assert_equal 13, Sungemm.fibo_finder(7)
    assert_equal 55, Sungemm.fibo_finder(10)
  end

  def test_stack
    stack = Sungemm::Stack.new([5, 6, 7, 8])

    assert_equal stack.pop, 8
    assert_equal stack.pop, 7
    assert_equal stack.push([4, 2]), true
    assert_equal stack.pop(3), [2, 4, 6]
    assert_equal stack.to_a, [5]
  end

  def test_queue
    queue = Sungemm::Queue.new([5, 6, 7, 8])

    assert_equal queue.pop, 5
    assert_equal queue.pop, 6
    assert_equal queue.push([4, 2]), true
    assert_equal queue.pop(2), [7, 8]
    assert_equal queue.to_a, [4, 2]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sungemm-0.0.2 test/lib/sungemm_test.rb
sungemm-0.0.1 test/lib/sungemm_test.rb