Skip to content

Commit

Permalink
A few more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma committed Apr 25, 2011
1 parent bfd3e40 commit ca74f14
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
8 changes: 7 additions & 1 deletion test/common/point_tests.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions test/geos/tc_parsing_unparsing.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 10 additions & 1 deletion test/wkrep/tc_wkb_parser.rb
Expand Up @@ -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)
Expand All @@ -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')
Expand Down

0 comments on commit ca74f14

Please sign in to comment.