test_envelope.rb

来自「在Linux下做的QuadTree的程序」· RB 代码 · 共 44 行

RB
44
字号
#!/usr/bin/env rubyrequire 'test/unit'require 'geos'# NOTE - These tests are no longer valid with the C-APIclass TestGeosEnvelope < Test::Unit::TestCase  def check(envelope)    assert_equal(5, envelope.get_min_x())    assert_equal(6, envelope.get_min_y())    assert_equal(10, envelope.get_max_x())    assert_equal(11, envelope.get_max_y())  end    def test_from_coords    min_coord = Geos::Coordinate.new(5,6)    max_coord = Geos::Coordinate.new(10, 11)    envelope = Geos::Envelope.new(min_coord, max_coord)    check(envelope)  end    def test_from_values    envelope = Geos::Envelope.new(5, 10, 6, 11)    check(envelope)  end    def test_serialize    out_envelope = Geos::Envelope.new(5, 10, 6, 11)    str = out_envelope.to_string()    in_envelope = Geos::Envelope.new(str)    check(in_envelope)    assert(out_envelope.equals(in_envelope))  end  def test_to_s    envelope = Geos::Envelope.new(5, 10, 6, 11)    string = envelope.to_s    assert_equal("<Geos::Envelope Env[5:10,6:11]>", string)  endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?