test/test_all.rb in interpolate-0.2.1 vs test/test_all.rb in interpolate-0.2.2
- old
+ new
@@ -19,20 +19,20 @@
6 => 0.6,
7 => 0.7,
8 => 0.8,
9 => 0.9,
10 => 1
- }
+ }.freeze
array_points = {
100 => [1, 10, 100],
200 => [5, 50, 500],
500 => [10, 100, 1000]
- }
+ }.freeze
- @dec_gradient = Interpolation.new(decimal_points)
- @array_gradient = Interpolation.new(array_points)
+ @dec_gradient = Interpolation.new(decimal_points).freeze
+ @array_gradient = Interpolation.new(array_points).freeze
end
def test_bad_points
bad_points = {
@@ -130,9 +130,18 @@
def test_array_values
assert_equal(@array_gradient.at(150), [3, 30, 300])
assert_equal(@array_gradient.at(200), [5, 50, 500])
assert_equal(@array_gradient.at(350), [7.5, 75, 750])
+ end
+
+ def test_frozen_points
+ a = @array_gradient.at(200)
+ assert_nothing_raised RuntimeError do
+ a[0] = 10
+ a[1] = 70
+ a[2] = 100
+ end
end
end