diff --git a/test/common/point_tests.rb b/test/common/point_tests.rb index 05918ec7..f4d84072 100644 --- a/test/common/point_tests.rb +++ b/test/common/point_tests.rb @@ -62,7 +62,7 @@ def test_creation def test_wkt_creation - point1_ = @factory.parse_wkt('POINT(21 -22)') + point1_ = @factory.parse_wkt('Point (21 -22)') assert_equal(21, point1_.x) assert_equal(-22, point1_.y) end @@ -106,6 +106,12 @@ def test_envelope end + def test_as_text + point_ = @factory.point(11, 12) + assert_equal('POINT (11.0 12.0)', point_.as_text) + end + + def test_as_text_wkt_round_trip point1_ = @factory.point(11, 12) text_ = point1_.as_text diff --git a/test/geos/tc_parsing_unparsing.rb b/test/geos/tc_parsing_unparsing.rb index add73979..5d84c526 100644 --- a/test/geos/tc_parsing_unparsing.rb +++ b/test/geos/tc_parsing_unparsing.rb @@ -45,11 +45,6 @@ module Geos # :nodoc: class TestParsingUnparsing < ::Test::Unit::TestCase # :nodoc: - def setup - @factory = ::RGeo::Geos.factory - end - - def test_wkt_generator_default_floating_point # Bug report GH-4 factory_ = ::RGeo::Geos.factory @@ -72,6 +67,12 @@ def test_wkt_generator_geos end + def test_wkt_parser_default_with_non_geosable_input + factory_ = ::RGeo::Geos.factory + assert_not_nil(factory_.parse_wkt('Point (1 1)')) + end + + end end diff --git a/test/wkrep/tc_wkb_parser.rb b/test/wkrep/tc_wkb_parser.rb index f9298558..22a47c8c 100644 --- a/test/wkrep/tc_wkb_parser.rb +++ b/test/wkrep/tc_wkb_parser.rb @@ -45,7 +45,7 @@ module WKRep # :nodoc: class TestWKBParser < ::Test::Unit::TestCase # :nodoc: - def test_point_2d_xdr + def test_point_2d_xdr_hex parser_ = ::RGeo::WKRep::WKBParser.new obj_ = parser_.parse('00000000013ff00000000000004000000000000000') assert_equal(::RGeo::Feature::Point, obj_.geometry_type) @@ -54,6 +54,15 @@ def test_point_2d_xdr end + def test_point_2d_xdr_binary + parser_ = ::RGeo::WKRep::WKBParser.new + obj_ = parser_.parse(['00000000013ff00000000000004000000000000000'].pack('H*')) + assert_equal(::RGeo::Feature::Point, obj_.geometry_type) + assert_equal(1, obj_.x) + assert_equal(2, obj_.y) + end + + def test_point_2d_ndr parser_ = ::RGeo::WKRep::WKBParser.new obj_ = parser_.parse('0101000000000000000000f03f0000000000000040')