ffi-geos 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class InterruptTests < MiniTest::Unit::TestCase
6
+ class InterruptTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  def interrupt_method
@@ -3,9 +3,14 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class LineStringTests < MiniTest::Unit::TestCase
6
+ class LineStringTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
+ def setup
10
+ super
11
+ writer.trim = true
12
+ end
13
+
9
14
  def test_default_srid
10
15
  geom = read('LINESTRING (0 0, 10 10)')
11
16
  assert_equal(0, geom.srid)
@@ -33,7 +38,6 @@ class LineStringTests < MiniTest::Unit::TestCase
33
38
  def test_line_string_array
34
39
  skip unless ENV['FORCE_TESTS'] || Geos::LineString.method_defined?(:[])
35
40
 
36
- writer.trim = true
37
41
  geom = read('LINESTRING(0 0, 1 1, 2 2, 3 3, 4 4)')
38
42
 
39
43
  assert_equal('POINT (0 0)', write(geom[0]))
@@ -55,7 +59,6 @@ class LineStringTests < MiniTest::Unit::TestCase
55
59
  def test_line_string_enumerable
56
60
  skip unless ENV['FORCE_TESTS'] || Geos::LineString.method_defined?(:select)
57
61
 
58
- writer.trim = true
59
62
  geom = read('LINESTRING(0 0, 1 1, 2 2, 3 3, 10 0, 2 2)')
60
63
 
61
64
  assert_equal(2, geom.select { |point| point == read('POINT(2 2)') }.length)
@@ -64,17 +67,9 @@ class LineStringTests < MiniTest::Unit::TestCase
64
67
  def test_offset_curve
65
68
  skip unless ENV['FORCE_TESTS'] || Geos::LineString.method_defined?(:offset_curve)
66
69
 
67
- tester = lambda { |expected, g, width, style|
68
- geom = read(g)
69
- buffered = geom.offset_curve(width, style)
70
-
71
- assert_equal(expected, write(buffered))
72
- }
73
-
74
- writer.rounding_precision = 0
75
-
76
70
  # straight left
77
- tester[
71
+ simple_tester(
72
+ :offset_curve,
78
73
  'LINESTRING (0 2, 10 2)',
79
74
  'LINESTRING (0 0, 10 0)',
80
75
  2, {
@@ -82,10 +77,11 @@ class LineStringTests < MiniTest::Unit::TestCase
82
77
  :join => :round,
83
78
  :mitre_limit => 2
84
79
  }
85
- ]
80
+ )
86
81
 
87
82
  # straight right
88
- tester[
83
+ simple_tester(
84
+ :offset_curve,
89
85
  'LINESTRING (10 -2, 0 -2)',
90
86
  'LINESTRING (0 0, 10 0)',
91
87
  -2, {
@@ -93,10 +89,11 @@ class LineStringTests < MiniTest::Unit::TestCase
93
89
  :join => :round,
94
90
  :mitre_limit => 2
95
91
  }
96
- ]
92
+ )
97
93
 
98
94
  # outside curve
99
- tester[
95
+ simple_tester(
96
+ :offset_curve,
100
97
  'LINESTRING (12 10, 12 0, 10 -2, 0 -2)',
101
98
  'LINESTRING (0 0, 10 0, 10 10)',
102
99
  -2, {
@@ -104,10 +101,11 @@ class LineStringTests < MiniTest::Unit::TestCase
104
101
  :join => :round,
105
102
  :mitre_limit => 2
106
103
  }
107
- ]
104
+ )
108
105
 
109
106
  # inside curve
110
- tester[
107
+ simple_tester(
108
+ :offset_curve,
111
109
  'LINESTRING (0 2, 8 2, 8 10)',
112
110
  'LINESTRING (0 0, 10 0, 10 10)',
113
111
  2, {
@@ -115,7 +113,7 @@ class LineStringTests < MiniTest::Unit::TestCase
115
113
  :join => :round,
116
114
  :mitre_limit => 2
117
115
  }
118
- ]
116
+ )
119
117
  end
120
118
 
121
119
  def test_closed
@@ -139,30 +137,60 @@ class LineStringTests < MiniTest::Unit::TestCase
139
137
  def test_point_n
140
138
  skip unless ENV['FORCE_TESTS'] || Geos::LineString.method_defined?(:point_n)
141
139
 
142
- writer.rounding_precision = 0
143
-
144
- tester = lambda { |expected, geom, n|
145
- assert_equal(expected, write(geom.point_n(n)))
146
- }
147
-
148
140
  geom = read('LINESTRING (10 10, 10 14, 14 14, 14 10)')
149
- tester['POINT (10 10)', geom, 0]
150
- tester['POINT (10 14)', geom, 1]
151
- tester['POINT (14 14)', geom, 2]
152
- tester['POINT (14 10)', geom, 3]
141
+ simple_tester(:point_n, 'POINT (10 10)', geom, 0)
142
+ simple_tester(:point_n, 'POINT (10 14)', geom, 1)
143
+ simple_tester(:point_n, 'POINT (14 14)', geom, 2)
144
+ simple_tester(:point_n, 'POINT (14 10)', geom, 3)
153
145
 
154
- assert_raises(RuntimeError) do
155
- tester['POINT (0 0)', geom, 4]
146
+ assert_raises(Geos::IndexBoundsError) do
147
+ geom.point_n(4)
156
148
  end
157
149
 
158
150
  geom = read('LINEARRING (11 11, 11 12, 12 11, 11 11)')
159
- tester['POINT (11 11)', geom, 0]
160
- tester['POINT (11 12)', geom, 1]
161
- tester['POINT (12 11)', geom, 2]
162
- tester['POINT (11 11)', geom, 3]
151
+ simple_tester(:point_n, 'POINT (11 11)', geom, 0)
152
+ simple_tester(:point_n, 'POINT (11 12)', geom, 1)
153
+ simple_tester(:point_n, 'POINT (12 11)', geom, 2)
154
+ simple_tester(:point_n, 'POINT (11 11)', geom, 3)
163
155
 
164
156
  assert_raises(NoMethodError) do
165
- tester[nil, read('POINT (0 0)'), 0]
157
+ read('POINT (0 0)').point_n(0)
166
158
  end
167
159
  end
160
+
161
+ def test_to_linear_ring
162
+ simple_tester(:to_linear_ring, 'LINEARRING (0 0, 0 5, 5 5, 5 0, 0 0)', 'LINESTRING (0 0, 0 5, 5 5, 5 0, 0 0)')
163
+ simple_tester(:to_linear_ring, 'LINEARRING (0 0, 0 5, 5 5, 5 0, 0 0)', 'LINESTRING (0 0, 0 5, 5 5, 5 0)')
164
+
165
+ writer.output_dimensions = 3
166
+ simple_tester(:to_linear_ring, 'LINEARRING Z (0 0 0, 0 5 0, 5 5 0, 5 0 0, 0 0 0)', 'LINESTRING Z (0 0 0, 0 5 0, 5 5 0, 5 0 0, 0 0 0)')
167
+ simple_tester(:to_linear_ring, 'LINEARRING Z (0 0 0, 0 5 0, 5 5 0, 5 0 0, 0 0 0)', 'LINESTRING Z (0 0 0, 0 5 0, 5 5 0, 5 0 0)')
168
+ end
169
+
170
+ def test_to_linear_ring_with_srid
171
+ wkt = 'LINESTRING (0 0, 5 0, 5 5, 0 5, 0 0)'
172
+ expected = 'LINEARRING (0 0, 5 0, 5 5, 0 5, 0 0)'
173
+
174
+ srid_copy_tester(:to_linear_ring, expected, 0, :zero, wkt)
175
+ srid_copy_tester(:to_linear_ring, expected, 4326, :lenient, wkt)
176
+ srid_copy_tester(:to_linear_ring, expected, 4326, :strict, wkt)
177
+ end
178
+
179
+ def test_to_polygon
180
+ simple_tester(:to_polygon, 'POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))', 'LINESTRING (0 0, 0 5, 5 5, 5 0, 0 0)')
181
+ simple_tester(:to_polygon, 'POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))', 'LINESTRING (0 0, 0 5, 5 5, 5 0)')
182
+
183
+ writer.output_dimensions = 3
184
+ simple_tester(:to_polygon, 'POLYGON Z ((0 0 0, 0 5 0, 5 5 0, 5 0 0, 0 0 0))', 'LINESTRING Z (0 0 0, 0 5 0, 5 5 0, 5 0 0, 0 0 0)')
185
+ simple_tester(:to_polygon, 'POLYGON Z ((0 0 0, 0 5 0, 5 5 0, 5 0 0, 0 0 0))', 'LINESTRING Z (0 0 0, 0 5 0, 5 5 0, 5 0 0)')
186
+ end
187
+
188
+ def test_to_polygon_with_srid
189
+ wkt = 'LINESTRING (0 0, 5 0, 5 5, 0 5, 0 0)'
190
+ expected = 'POLYGON ((0 0, 5 0, 5 5, 0 5, 0 0))'
191
+
192
+ srid_copy_tester(:to_polygon, expected, 0, :zero, wkt)
193
+ srid_copy_tester(:to_polygon, expected, 4326, :lenient, wkt)
194
+ srid_copy_tester(:to_polygon, expected, 4326, :strict, wkt)
195
+ end
168
196
  end
@@ -3,7 +3,7 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class LinearRingTests < MiniTest::Unit::TestCase
6
+ class LinearRingTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  def setup
@@ -26,8 +26,6 @@ class LinearRingTests < MiniTest::Unit::TestCase
26
26
  end
27
27
 
28
28
  def test_to_polygon_with_srid
29
- writer.trim = true
30
-
31
29
  wkt = 'LINEARRING (0 0, 5 0, 5 5, 0 5, 0 0)'
32
30
  expected = 'POLYGON ((0 0, 5 0, 5 5, 0 5, 0 0))'
33
31
 
@@ -35,4 +33,13 @@ class LinearRingTests < MiniTest::Unit::TestCase
35
33
  srid_copy_tester(:to_polygon, expected, 4326, :lenient, wkt)
36
34
  srid_copy_tester(:to_polygon, expected, 4326, :strict, wkt)
37
35
  end
36
+
37
+ def test_to_line_string_with_srid
38
+ wkt = 'LINEARRING (0 0, 5 0, 5 5, 0 5, 0 0)'
39
+ expected = 'LINESTRING (0 0, 5 0, 5 5, 0 5, 0 0)'
40
+
41
+ srid_copy_tester(:to_line_string, expected, 0, :zero, wkt)
42
+ srid_copy_tester(:to_line_string, expected, 4326, :lenient, wkt)
43
+ srid_copy_tester(:to_line_string, expected, 4326, :strict, wkt)
44
+ end
38
45
  end
@@ -3,7 +3,7 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class MiscTests < MiniTest::Unit::TestCase
6
+ class MiscTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  def thread_tester(name, dims, byte_order, polygon, pause)
@@ -3,9 +3,14 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class PointTests < MiniTest::Unit::TestCase
6
+ class PointTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
+ def setup
10
+ super
11
+ writer.trim = true
12
+ end
13
+
9
14
  def test_default_srid
10
15
  geom = read('POINT(0 0)')
11
16
  assert_equal(0, geom.srid)
@@ -3,12 +3,12 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class PolygonTests < MiniTest::Unit::TestCase
6
+ class PolygonTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  def setup
10
10
  super
11
- writer.rounding_precision = 2
11
+ writer.trim = true
12
12
  end
13
13
 
14
14
  def test_default_srid
@@ -3,7 +3,7 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class PreparedGeometryTests < MiniTest::Unit::TestCase
6
+ class PreparedGeometryTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  POINT_A = 'POINT(0 0)'
@@ -3,7 +3,7 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class STRtreeTests < MiniTest::Unit::TestCase
6
+ class STRtreeTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  def setup_tree
@@ -28,7 +28,7 @@ class STRtreeTests < MiniTest::Unit::TestCase
28
28
 
29
29
  @tree.query(read('POINT(5 5)'))
30
30
 
31
- assert_raises(RuntimeError) do
31
+ assert_raises(Geos::STRtree::AlreadyBuiltError) do
32
32
  @tree.insert(read('POINT(0 0)'), 'test')
33
33
  end
34
34
  end
@@ -59,13 +59,19 @@ module TestHelper
59
59
  writer.write(*args)
60
60
  end
61
61
 
62
+ def geom_from_geom_or_wkt(geom_or_wkt)
63
+ if geom_or_wkt.is_a?(String)
64
+ read(geom_or_wkt)
65
+ else
66
+ geom_or_wkt
67
+ end
68
+ end
69
+
62
70
  def srid_copy_tester(method, expected, expected_srid, srid_policy, wkt, *args)
63
71
  geom = read(wkt)
64
72
  geom.srid = 4326
65
-
66
73
  Geos.srid_copy_policy = srid_policy
67
74
  geom_b = geom.send(method, *args)
68
-
69
75
  assert_equal(4326, geom.srid)
70
76
  assert_equal(expected_srid, geom_b.srid)
71
77
  assert_equal(expected, write(geom_b))
@@ -95,9 +101,56 @@ module TestHelper
95
101
  def assert_geom_eql_exact(geom, result, tolerance = TOLERANCE)
96
102
  assert(geom.eql_exact?(result, tolerance), "Expected geom.eql_exact? to be within #{tolerance}")
97
103
  end
104
+
105
+ def simple_tester(method, expected, geom, *args)
106
+ geom = geom_from_geom_or_wkt(geom)
107
+ result = geom.send(method, *args)
108
+
109
+ if result.is_a?(Geos::Geometry)
110
+ result = write(result)
111
+ end
112
+
113
+ assert_equal(expected, result)
114
+ end
115
+
116
+ def simple_bang_tester(method, expected, wkt, *args)
117
+ geom = read(wkt)
118
+ result = geom.send(method, *args)
119
+
120
+ assert_equal(wkt, write(geom))
121
+ assert_equal(expected, write(result))
122
+
123
+ geom = read(wkt)
124
+ geom.send("#{method}!", *args)
125
+
126
+ assert_equal(expected, write(geom))
127
+ end
128
+
129
+ def comparison_tester(method, expected, geom_a, geom_b, *args)
130
+ geom_a = geom_from_geom_or_wkt(geom_a)
131
+ geom_b = geom_from_geom_or_wkt(geom_b)
132
+
133
+ simple_tester(method, expected, geom_a, geom_b, *args)
134
+ end
135
+
136
+ def array_tester(method, expected, geom, *args)
137
+ geom = geom_from_geom_or_wkt(geom)
138
+ result = geom.send(method, *args)
139
+
140
+ case result
141
+ when Geos::Geometry
142
+ result = [ write(result) ]
143
+ when Array
144
+ result = result.collect { |r|
145
+ write(r)
146
+ }
147
+ end
148
+
149
+ assert_equal(expected, result)
150
+ end
98
151
  end
99
152
 
100
153
  if RUBY_VERSION >= '1.9'
101
- MiniTest::Reporters.use!(MiniTest::Reporters::SpecReporter.new)
154
+ Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)
102
155
  end
103
156
 
@@ -3,7 +3,7 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class ToolsTests < MiniTest::Unit::TestCase
6
+ class ToolsTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
9
  def test_check_geometry
@@ -16,7 +16,7 @@ class ToolsTests < MiniTest::Unit::TestCase
16
16
  assert(Geos::Tools.bool_result(1))
17
17
  refute(Geos::Tools.bool_result(0))
18
18
 
19
- assert_raises(RuntimeError) do
19
+ assert_raises(Geos::UnexpectedBooleanResultError) do
20
20
  Geos::Tools.bool_result(-1)
21
21
  end
22
22
  end
@@ -3,9 +3,14 @@
3
3
  $: << File.dirname(__FILE__)
4
4
  require 'test_helper'
5
5
 
6
- class UtilsTests < MiniTest::Unit::TestCase
6
+ class UtilsTests < Minitest::Test
7
7
  include TestHelper
8
8
 
9
+ def setup
10
+ super
11
+ writer.trim = true
12
+ end
13
+
9
14
  def test_orientation_index
10
15
  skip unless ENV['FORCE_TESTS'] || (defined?(Geos::Utils) && Geos::Utils.respond_to?(:orientation_index))
11
16
 
@@ -44,19 +49,16 @@ class UtilsTests < MiniTest::Unit::TestCase
44
49
  end
45
50
 
46
51
  def test_create_point
47
- cs = Geos::CoordinateSequence.new(1, 2)
48
- cs.set_x(0, 10)
49
- cs.set_y(0, 20)
50
-
51
- create_method_tester('POINT(10 20)', :create_point, cs, Geos::GEOS_POINT, Geos::Point)
52
+ cs = Geos::CoordinateSequence.new([[ 10, 20 ]])
53
+ create_method_tester('POINT (10 20)', :create_point, cs, Geos::GEOS_POINT, Geos::Point)
52
54
  end
53
55
 
54
56
  def test_create_point_with_x_and_y_arguments
55
- assert_equal('POINT (10 20)', write(Geos.create_point(10, 20), :trim => true))
57
+ assert_equal('POINT (10 20)', write(Geos.create_point(10, 20)))
56
58
  end
57
59
 
58
60
  def test_create_point_with_x_y_and_z_arguments
59
- assert_equal('POINT Z (10 20 30)', write(Geos.create_point(10, 20, 30), :trim => true, :output_dimensions => 3))
61
+ assert_equal('POINT Z (10 20 30)', write(Geos.create_point(10, 20, 30), :output_dimensions => 3))
60
62
  end
61
63
 
62
64
  def test_create_point_with_too_many_arguments
@@ -67,22 +69,21 @@ class UtilsTests < MiniTest::Unit::TestCase
67
69
 
68
70
  def test_bad_create_point
69
71
  cs = Geos::CoordinateSequence.new(0, 0)
70
- assert_raises(RuntimeError) do
72
+ assert_raises(ArgumentError) do
71
73
  Geos.create_point(cs)
72
74
  end
73
75
  end
74
76
 
75
77
  def test_create_line_string
76
- cs = Geos::CoordinateSequence.new(2, 3)
77
- cs.set_x(0, 10)
78
- cs.set_y(0, 20)
79
- cs.set_z(0, 30)
80
- cs.set_x(1, 30)
81
- cs.set_y(1, 20)
82
- cs.set_z(1, 10)
78
+ cs = Geos::CoordinateSequence.new([
79
+ [ 10, 20, 30 ],
80
+ [ 30, 20, 10 ]
81
+ ])
82
+
83
+ writer.output_dimensions = 3
83
84
 
84
85
  create_method_tester(
85
- 'LINESTRING (10 20 30, 30 20 10)',
86
+ 'LINESTRING Z (10 20 30, 30 20 10)',
86
87
  :create_line_string,
87
88
  cs,
88
89
  Geos::GEOS_LINESTRING,
@@ -118,28 +119,23 @@ class UtilsTests < MiniTest::Unit::TestCase
118
119
 
119
120
  def test_create_bad_line_string
120
121
  cs = Geos::CoordinateSequence.new(1, 0)
121
- assert_raises(RuntimeError) do
122
+ assert_raises(ArgumentError) do
122
123
  Geos::create_line_string(cs)
123
124
  end
124
125
  end
125
126
 
126
127
  def test_create_linear_ring
127
- cs = Geos::CoordinateSequence.new(4,3)
128
- cs.set_x(0, 7)
129
- cs.set_y(0, 8)
130
- cs.set_z(0, 9)
131
- cs.set_x(1, 3)
132
- cs.set_y(1, 3)
133
- cs.set_z(1, 3)
134
- cs.set_x(2, 11)
135
- cs.set_y(2, 15.2)
136
- cs.set_z(2, 2)
137
- cs.set_x(3, 7)
138
- cs.set_y(3, 8)
139
- cs.set_z(3, 9)
128
+ cs = Geos::CoordinateSequence.new([
129
+ [ 7, 8, 9 ],
130
+ [ 3, 3, 3 ],
131
+ [ 11, 15.2, 2 ],
132
+ [ 7, 8, 9 ]
133
+ ])
134
+
135
+ writer.output_dimensions = 3
140
136
 
141
137
  create_method_tester(
142
- 'LINEARRING (7 8 9, 3 3 3, 11 15.2 2, 7 8 9)',
138
+ 'LINEARRING Z (7 8 9, 3 3 3, 11 15.2 2, 7 8 9)',
143
139
  :create_linear_ring,
144
140
  cs,
145
141
  Geos::GEOS_LINEARRING,
@@ -176,7 +172,7 @@ class UtilsTests < MiniTest::Unit::TestCase
176
172
  def test_bad_create_linear_ring
177
173
  cs = Geos::CoordinateSequence.new(1, 0)
178
174
 
179
- assert_raises(RuntimeError) do
175
+ assert_raises(ArgumentError) do
180
176
  Geos::create_linear_ring(cs)
181
177
  end
182
178
  end
@@ -196,7 +192,7 @@ class UtilsTests < MiniTest::Unit::TestCase
196
192
  assert_instance_of(Geos::Polygon, geom)
197
193
  assert_equal('Polygon', geom.geom_type)
198
194
  assert_equal(Geos::GEOS_POLYGON, geom.type_id)
199
- assert_equal('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))', write(geom, :trim => true))
195
+ assert_equal('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))', write(geom))
200
196
  end
201
197
 
202
198
  def test_create_polygon_with_coordinate_sequences
@@ -220,7 +216,7 @@ class UtilsTests < MiniTest::Unit::TestCase
220
216
  assert_instance_of(Geos::Polygon, geom)
221
217
  assert_equal('Polygon', geom.geom_type)
222
218
  assert_equal(Geos::GEOS_POLYGON, geom.type_id)
223
- assert_equal('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0), (2 2, 2 4, 4 4, 4 2, 2 2))', write(geom, :trim => true))
219
+ assert_equal('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0), (2 2, 2 4, 4 4, 4 2, 2 2))', write(geom))
224
220
  end
225
221
 
226
222
  def test_create_polygon_with_holes
@@ -265,7 +261,6 @@ class UtilsTests < MiniTest::Unit::TestCase
265
261
  def test_create_multi_point
266
262
  skip unless ENV['FORCE_TESTS'] || Geos.respond_to?(:create_multi_point)
267
263
 
268
- writer.rounding_precision = 0
269
264
  assert_equal('MULTIPOINT EMPTY', write(Geos.create_multi_point))
270
265
  assert_equal('MULTIPOINT (0 0, 10 10)', write(Geos.create_multi_point(
271
266
  read('POINT(0 0)'),
@@ -287,7 +282,6 @@ class UtilsTests < MiniTest::Unit::TestCase
287
282
  def test_create_multi_line_string
288
283
  skip unless ENV['FORCE_TESTS'] || Geos.respond_to?(:create_multi_line_string)
289
284
 
290
- writer.rounding_precision = 0
291
285
  assert_equal('MULTILINESTRING EMPTY', write(Geos.create_multi_line_string))
292
286
  assert_equal('MULTILINESTRING ((0 0, 10 10), (10 10, 20 20))', write(Geos.create_multi_line_string(
293
287
  read('LINESTRING(0 0, 10 10)'),
@@ -309,7 +303,6 @@ class UtilsTests < MiniTest::Unit::TestCase
309
303
  def test_create_multi_polygon
310
304
  skip unless ENV['FORCE_TESTS'] || Geos.respond_to?(:create_multi_polygon)
311
305
 
312
- writer.rounding_precision = 0
313
306
  assert_equal('MULTIPOLYGON EMPTY', write(Geos.create_multi_polygon))
314
307
  assert_equal('MULTIPOLYGON (((0 0, 0 5, 5 5, 5 0, 0 0)), ((10 10, 10 15, 15 15, 15 10, 10 10)))', write(Geos.create_multi_polygon(
315
308
  read('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'),
@@ -331,7 +324,6 @@ class UtilsTests < MiniTest::Unit::TestCase
331
324
  def test_create_geometry_collection
332
325
  skip unless ENV['FORCE_TESTS'] || Geos.respond_to?(:create_geometry_collection)
333
326
 
334
- writer.rounding_precision = 0
335
327
  assert_equal('GEOMETRYCOLLECTION EMPTY', write(Geos.create_geometry_collection))
336
328
  assert_equal('GEOMETRYCOLLECTION (POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0)), POLYGON ((10 10, 10 15, 15 15, 15 10, 10 10)))',
337
329
  write(Geos.create_geometry_collection(
@@ -423,25 +415,25 @@ class UtilsTests < MiniTest::Unit::TestCase
423
415
  # GEOS taking ownership of CoordinateSequences and deleting them out from
424
416
  # under us and GC blowing up.
425
417
 
426
- assert_raises(RuntimeError) do
418
+ assert_raises(ArgumentError) do
427
419
  cs = Geos::CoordinateSequence.new(0, 2)
428
420
  Geos.create_point(cs)
429
421
  GC.start
430
422
  end
431
423
 
432
- assert_raises(RuntimeError) do
424
+ assert_raises(ArgumentError) do
433
425
  cs = Geos::CoordinateSequence.new(1, 2)
434
426
  Geos.create_line_string(cs)
435
427
  GC.start
436
428
  end
437
429
 
438
- assert_raises(RuntimeError) do
430
+ assert_raises(ArgumentError) do
439
431
  cs = Geos::CoordinateSequence.new(1, 2)
440
432
  Geos.create_linear_ring(cs)
441
433
  GC.start
442
434
  end
443
435
 
444
- assert_raises(RuntimeError) do
436
+ assert_raises(Geos::GEOSException) do
445
437
  cs = Geos::CoordinateSequence.new([
446
438
  [0, 0],
447
439
  [0, 5],