Skip to content

Commit

Permalink
Added more tests to the test module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elisha Lai committed Jun 12, 2015
1 parent 6cfb3cd commit d996f86
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/test_joules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@

EPSILON = 0.00001

# Unit tests for circular motion module
class CircularMotionTests < Test::Unit::TestCase
def test_angular_velocity_v1_extreme_1
assert_in_epsilon(0, angular_velocity_v1(0,0.001), EPSILON)
end

def test_angular_velocity_v1_extreme_2
assert_in_epsilon(1.03010, angular_velocity_v1(928476103, 901348726), EPSILON)
end

def test_angular_velocity_v1_big_divisor
assert_in_epsilon(6.32386e-09, angular_velocity_v1(5.7, 901348726), EPSILON)
end

def test_angular_velocity_v1_zero_division
assert_raise(ZeroDivisionError) do
angular_velocity_v1(1, 0)
end
end

def test_angular_velocity_v1_example
assert_in_epsilon(3, angular_velocity_v1(9, 3), EPSILON)
end
end

# Unit tests for kinematics module
class KinematicsTests < Test::Unit::TestCase
def test_avg_speed_extreme_1
Expand All @@ -27,4 +52,10 @@ def test_avg_speed_extreme_2
def test_avg_speed_big_divisor
assert_in_epsilon(6.32386e-09, avg_speed(5.7, 901348726), EPSILON)
end

def test_avg_speed_zero_division
assert_raise(ZeroDivisionError) do
avg_speed(1, 0)
end
end
end

0 comments on commit d996f86

Please sign in to comment.