File: word_hash_test.rb

package info (click to toggle)
ruby-classifier 1.3.4-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 224 kB
  • sloc: ruby: 739; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 881 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require File.dirname(__FILE__) + '/../test_helper'
class StringExtensionsTest < Test::Unit::TestCase
	def test_word_hash
		hash = {:good=>1, :"!"=>1, :hope=>1, :"'"=>1, :"."=>1, :love=>1, :word=>1, :them=>1, :test=>1}
		assert_equal hash, "here are some good words of test's. I hope you love them!".word_hash
	end

   	
	def test_clean_word_hash
	   hash = {:good=>1, :word=>1, :hope=>1, :love=>1, :them=>1, :test=>1}
	   assert_equal hash, "here are some good words of test's. I hope you love them!".clean_word_hash
	end

end


class ArrayExtensionsTest < Test::Unit::TestCase

  def test_plays_nicely_with_any_array
    assert_equal [Array].sum, Array
  end

  def test_monkey_path_array_sum
    assert_equal [1,2,3].sum, 6
  end

  def test_summing_an_empty_array
    assert_equal [nil].sum, 0
  end

  def test_summing_an_empty_array
    assert_equal Array[].sum, 0
  end

end