test/analyzable_test.rb in polynomials-0.4.3 vs test/analyzable_test.rb in polynomials-0.4.4

- old
+ new

@@ -1,7 +1,6 @@ require "#{File.dirname(File.expand_path(__FILE__))}/test_helper" -Infinity = 1.0/0 class TestAnalyzable < MiniTest::Unit::TestCase include Polynomials def test_local_extrema polynomial = Polynomial.parse('3x^2 + 2x + 1') @@ -58,22 +57,22 @@ assert_set_eql Set[InflectionPoint.new(-1/10,polynomial.(-1/10)),InflectionPoint.new(0,polynomial.(0))], polynomial.inflection_points end def test_strives_for polynomial = Polynomial.new(2,0,0) - assert_equal [Infinity,Infinity], polynomial.strives_for + assert_equal [Maximum.new(-Infinity,Infinity),Maximum.new(Infinity,Infinity)], polynomial.strives_for polynomial = Polynomial.new(-2,0,0) - assert_equal [-Infinity,-Infinity], polynomial.strives_for + assert_equal [Minimum.new(-Infinity,-Infinity),Minimum.new(Infinity,-Infinity)], polynomial.strives_for polynomial = Polynomial.new(2,0,0,0) - assert_equal [-Infinity,Infinity], polynomial.strives_for + assert_equal [Minimum.new(-Infinity,-Infinity),Maximum.new(Infinity,Infinity)], polynomial.strives_for polynomial = Polynomial.new(-2,0,0,0) - assert_equal [Infinity,-Infinity], polynomial.strives_for + assert_equal [Maximum.new(-Infinity,Infinity),Minimum.new(Infinity,-Infinity)], polynomial.strives_for polynomial = Polynomial.new(2) assert_equal nil, polynomial.strives_for polynomial = Polynomial.parse('+ 1.0 x^4 + 5.0 x^3 - 1.0 x^2 + 3.0 x + 5.0').derivative - assert_equal [-Infinity,Infinity], polynomial.strives_for + assert_equal [Minimum.new(-Infinity,-Infinity),Maximum.new(Infinity,Infinity)], polynomial.strives_for end def test_inflection_points_some_coefficients_of_derivative2_zero polynomial = Polynomial.parse('x^5 + x^1') assert_set_eql Set[], polynomial.inflection_points @@ -84,8 +83,8 @@ assert_equal({ :right => [[-Infinity,0.0]], :left => [[0.0, Infinity]] }, polynomial.curvature_behaviour) end def test_strives_for_no_roots polynomial = Polynomial.new(1,0,0,0,0) - assert_equal [Infinity,Infinity], polynomial.strives_for + assert_equal [Maximum.new(-Infinity,Infinity),Maximum.new(Infinity,Infinity)], polynomial.strives_for end end