Skip to content

Instantly share code, notes, and snippets.

@jwo
Last active April 1, 2016 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwo/2054422371d2d0d1f908 to your computer and use it in GitHub Desktop.
Save jwo/2054422371d2d0d1f908 to your computer and use it in GitHub Desktop.
require 'minitest/autorun'
class AwesomeTest < Minitest::Test
def test_attitude_rules
assert value_for('attitude') > value_for('hardwork') and value_for('attitude') > value_for('knowledge')
end
def test_knowledge_96
assert_equal 96, value_for('knowledge')
end
def test_hardwork_98
assert_equal 98, value_for('hardwork')
end
def test_attitude_100
assert_equal 100, value_for('attitude')
end
def test_a_value_is_1
assert_equal 1, value_for('a')
end
def test_z_value
assert_equal 26, value_for('z')
end
def test_simple_word
assert_equal 3, value_for('aaa')
end
def test_capital_simple_word
assert_equal 3, value_for('AAA')
end
private
def value_for word
word.downcase.chars.map do |char|
index = letters.index(char)
numbers[index]
end.reduce(:+)
end
def letters
('a'..'z').to_a
end
def numbers
(1..26).to_a
end
end
@matthiasak
Copy link

++++++++++++++++

@mason-stewart
Copy link

Pro moves

@anyweez
Copy link

anyweez commented Dec 2, 2015

rad to the bone

@NicerHugs
Copy link

🌹

@theterminalguy
Copy link

One can simply learn minitest from this. Awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment