test/polynomial_test.rb in polynomials-0.4.2 vs test/polynomial_test.rb in polynomials-0.4.3
- old
+ new
@@ -83,6 +83,16 @@
def test_grouped_pointset_omitting_inteval_through_start_out_of_range
polynomial = Polynomial.new(1,0,0)
assert_equal({ :jellyfish => [[[-0.005,0.005**2,],[0,0.0]]] , :peanut_butter => [[[0,0.0],[0.1,0.1**2],[0.2,0.2**2],[0.25,0.25**2]]]},
polynomial.grouped_pointset(-0.005,0.25,0.1, { :jellyfish => [[-0.01,0]], :peanut_butter => [[-Infinity,-0.1],[0,Infinity]] }))
end
+
+ def test_calculation_of_function_with_absolute_term
+ polynomial = Polynomial.parse('5x^2 + 5x + 2')
+ assert_equal 2, polynomial.(0)
+ end
+
+ def test_calculation_of_function_with_absolute_term_linear
+ polynomial = Polynomial.parse('5x + 2')
+ assert_equal 7, polynomial.(1)
+ end
end