Sha256: 55ed124455baa0ea7a546b5cada1ea0c2e2e97d548fad8979267ebbb88613a6c

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require_relative './helper'

describe Terraformer::ConvexHull do

  EXAMPLES.reject {|k,v| k == :multi_line_string }.each do |key, geo|
    it "works on #{key}" do
      ch = Terraformer.parse(geo).convex_hull
      ch.dont_be_terrible_ok
      ch.must_be_valid_geojson
    end
  end

  it 'raises without enough points' do
    ->{ Terraformer.parse(EXAMPLES[:multi_line_string]).convex_hull }.must_raise ArgumentError
  end

  it 'works on feature collections' do
    fc = Terraformer::FeatureCollection.new
    fc << Terraformer.parse(EXAMPLES[:waldocanyon])
    fc << Terraformer.parse(EXAMPLES[:sf_county]).to_feature
    ch = fc.convex_hull
    ch.dont_be_terrible_ok
    ch.must_be_valid_geojson
  end

  it 'works on feature collections - jarvis march' do
    Terraformer::ConvexHull.impl = :jarvis_march

    fc = Terraformer::FeatureCollection.new
    fc << Terraformer.parse(EXAMPLES[:waldocanyon])
    fc << Terraformer.parse(EXAMPLES[:sf_county]).to_feature
    ch = fc.convex_hull
    ch.dont_be_terrible_ok
    ch.must_be_valid_geojson
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
terraformer-0.2.1 test/convex_hull_spec.rb
terraformer-0.2.0 test/convex_hull_spec.rb
terraformer-0.1.0 test/convex_hull_spec.rb