ffi-gdal 1.0.0.beta16 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +17 -0
- data/.github/workflows/codacy.yml +61 -0
- data/.github/workflows/codeql.yml +74 -0
- data/.github/workflows/continuous-integration.yml +36 -0
- data/.github/workflows/dependency-review.yml +20 -0
- data/.github/workflows/specs-in-docker.yml +27 -0
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/.rubocop.yml +10 -80
- data/.rubocop_todo.yml +23 -40
- data/.ruby-version +1 -1
- data/Changelog-0.x.md +512 -0
- data/Changelog.md +12 -0
- data/Dockerfile.gdal2 +110 -0
- data/Dockerfile.gdal3 +73 -0
- data/README.md +25 -14
- data/Rakefile +0 -8
- data/Tiltfile +91 -0
- data/bin/bundle +123 -0
- data/bin/docker-clean +8 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/docker-compose.yml +25 -0
- data/examples/extract_and_colorize.rb +0 -13
- data/examples/geometries.rb +14 -14
- data/examples/ogr_layer_to_layer.rb +1 -3
- data/examples/raster_erasing.rb +1 -0
- data/examples/remove_small_polygons.rb +1 -1
- data/examples/testing_gdal.rb +20 -17
- data/examples/warping.rb +9 -7
- data/ffi-gdal.gemspec +12 -6
- data/lib/ext/ffi_library_function_checks.rb +2 -2
- data/lib/ext/to_bool.rb +5 -3
- data/lib/ffi/cpl/conv.rb +27 -25
- data/lib/ffi/cpl/error.rb +19 -20
- data/lib/ffi/cpl/hash_set.rb +4 -4
- data/lib/ffi/cpl/http.rb +3 -3
- data/lib/ffi/cpl/http_result.rb +8 -8
- data/lib/ffi/cpl/list.rb +1 -1
- data/lib/ffi/cpl/mime_part.rb +2 -2
- data/lib/ffi/cpl/minixml.rb +7 -7
- data/lib/ffi/cpl/progress.rb +8 -8
- data/lib/ffi/cpl/quad_tree.rb +14 -14
- data/lib/ffi/cpl/rect_obj.rb +3 -3
- data/lib/ffi/cpl/string.rb +17 -20
- data/lib/ffi/cpl/vsi.rb +13 -13
- data/lib/ffi/cpl/xml_node.rb +3 -3
- data/lib/ffi/extensions/gdal/extensions/all.rb +4 -0
- data/lib/ffi/extensions/gdal/extensions/version.rb +9 -0
- data/lib/ffi/extensions/gdal/extensions.rb +12 -0
- data/lib/ffi/extensions/rttopo/gbox.rb +19 -0
- data/lib/ffi/extensions/rttopo/geom.rb +16 -0
- data/lib/ffi/extensions/rttopo.rb +41 -0
- data/lib/ffi/gdal/alg.rb +277 -277
- data/lib/ffi/gdal/color_entry.rb +3 -3
- data/lib/ffi/gdal/gcp.rb +6 -6
- data/lib/ffi/gdal/gdal.rb +349 -349
- data/lib/ffi/gdal/grid.rb +134 -134
- data/lib/ffi/gdal/grid_data_metrics_options.rb +4 -4
- data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +9 -9
- data/lib/ffi/gdal/grid_moving_average_options.rb +4 -4
- data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +3 -3
- data/lib/ffi/gdal/matching.rb +3 -3
- data/lib/ffi/gdal/rpc_info.rb +17 -17
- data/lib/ffi/gdal/transformer_info.rb +4 -4
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal/vrt.rb +39 -39
- data/lib/ffi/gdal/warp_options.rb +34 -34
- data/lib/ffi/gdal/warper.rb +90 -90
- data/lib/ffi/gdal.rb +2 -31
- data/lib/ffi/ogr/api.rb +175 -167
- data/lib/ffi/ogr/contour_writer_info.rb +4 -4
- data/lib/ffi/ogr/core.rb +107 -107
- data/lib/ffi/ogr/envelope.rb +3 -3
- data/lib/ffi/ogr/envelope_3d.rb +5 -5
- data/lib/ffi/ogr/featurestyle.rb +3 -3
- data/lib/ffi/ogr/field.rb +22 -22
- data/lib/ffi/ogr/geocoding.rb +4 -4
- data/lib/ffi/ogr/srs_api.rb +154 -155
- data/lib/ffi/ogr/style_param.rb +3 -3
- data/lib/ffi/ogr/style_value.rb +4 -4
- data/lib/gdal/color_entry.rb +1 -5
- data/lib/gdal/color_interpretation.rb +7 -3
- data/lib/gdal/color_table.rb +46 -27
- data/lib/gdal/cpl_error_handler.rb +26 -6
- data/lib/gdal/data_type.rb +10 -3
- data/lib/gdal/dataset.rb +171 -85
- data/lib/gdal/dataset_mixins/algorithm_methods.rb +44 -44
- data/lib/gdal/dataset_mixins/matching.rb +1 -1
- data/lib/gdal/dataset_mixins/warp_methods.rb +4 -2
- data/lib/gdal/driver.rb +38 -21
- data/lib/gdal/environment_methods.rb +6 -6
- data/lib/gdal/extensions/all.rb +3 -0
- data/lib/gdal/{color_entry_mixins → extensions/color_entry}/extensions.rb +4 -1
- data/lib/gdal/{color_table_mixins → extensions/color_table}/extensions.rb +3 -0
- data/lib/gdal/extensions/dataset/extensions.rb +205 -0
- data/lib/gdal/{driver_mixins → extensions/driver}/extensions.rb +6 -2
- data/lib/gdal/{geo_transform_mixins → extensions/geo_transform}/extensions.rb +10 -8
- data/lib/gdal/{gridder → extensions/gridder}/point_extracting.rb +7 -5
- data/lib/gdal/{gridder.rb → extensions/gridder.rb} +33 -33
- data/lib/gdal/{gridder_options.rb → extensions/gridder_options.rb} +13 -14
- data/lib/gdal/{raster_attribute_table_mixins → extensions/raster_attribute_table}/extensions.rb +8 -6
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/algorithm_extensions.rb +8 -6
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/coloring_extensions.rb +6 -4
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/extensions.rb +9 -5
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/io_extensions.rb +18 -14
- data/lib/gdal/{raster_band_classifier.rb → extensions/raster_band_classifier.rb} +3 -5
- data/lib/gdal/geo_transform.rb +1 -6
- data/lib/gdal/grid.rb +3 -2
- data/lib/gdal/grid_algorithms.rb +9 -9
- data/lib/gdal/internal_helpers.rb +46 -9
- data/lib/gdal/major_object.rb +11 -3
- data/lib/gdal/options.rb +26 -32
- data/lib/gdal/raster_attribute_table.rb +63 -37
- data/lib/gdal/raster_band.rb +164 -116
- data/lib/gdal/raster_band_mixins/algorithm_methods.rb +26 -25
- data/lib/gdal/rpc_info.rb +3 -2
- data/lib/gdal/transformers/approximate_transformer.rb +12 -3
- data/lib/gdal/transformers/base_general_image_projection_transformer.rb +15 -2
- data/lib/gdal/transformers/gcp_transformer.rb +27 -19
- data/lib/gdal/transformers/general_image_projection_transformer.rb +8 -6
- data/lib/gdal/transformers/general_image_projection_transformer2.rb +9 -6
- data/lib/gdal/transformers/general_image_projection_transformer3.rb +6 -2
- data/lib/gdal/transformers/geolocation_transformer.rb +12 -4
- data/lib/gdal/transformers/reprojection_transformer.rb +11 -3
- data/lib/gdal/transformers/rpc_transformer.rb +11 -2
- data/lib/gdal/transformers/tps_transformer.rb +12 -4
- data/lib/gdal/version_info.rb +2 -2
- data/lib/gdal/virtual_dataset.rb +2 -0
- data/lib/gdal/warp_operation.rb +65 -54
- data/lib/gdal/warp_options.rb +9 -11
- data/lib/ogr/coordinate_transformation.rb +23 -9
- data/lib/ogr/data_source.rb +68 -37
- data/lib/ogr/driver.rb +18 -17
- data/lib/ogr/envelope.rb +0 -3
- data/lib/ogr/error_handling.rb +22 -24
- data/lib/ogr/extensions/all.rb +3 -0
- data/lib/ogr/{data_source_mixins → extensions/data_source}/capability_methods.rb +2 -0
- data/lib/ogr/extensions/data_source/data_source_extensions.rb +16 -0
- data/lib/ogr/{driver_mixins → extensions/driver}/capability_methods.rb +5 -1
- data/lib/ogr/extensions/envelope/extensions.rb +114 -0
- data/lib/ogr/extensions/feature/extensions.rb +87 -0
- data/lib/ogr/extensions/feature_definition/extensions.rb +43 -0
- data/lib/ogr/extensions/geometries/point/extensions.rb +19 -0
- data/lib/ogr/extensions/geometry/container_mixins.rb +56 -0
- data/lib/ogr/extensions/geometry/ewkb_io_extensions.rb +44 -0
- data/lib/ogr/extensions/geometry/ewkb_record.rb +94 -0
- data/lib/ogr/{geometry_mixins → extensions/geometry}/extensions.rb +16 -9
- data/lib/ogr/extensions/geometry/rttopo_extensions.rb +48 -0
- data/lib/ogr/extensions/geometry/wkb_record.rb +63 -0
- data/lib/ogr/extensions/geometry_types/curve/extensions.rb +68 -0
- data/lib/ogr/{layer_mixins → extensions/layer}/capability_methods.rb +4 -0
- data/lib/ogr/{layer_mixins → extensions/layer}/extensions.rb +11 -6
- data/lib/ogr/extensions/spatial_reference/extensions.rb +38 -0
- data/lib/ogr/extensions/spatial_reference/initializers.rb +138 -0
- data/lib/ogr/extensions/style_table/extensions.rb +31 -0
- data/lib/ogr/feature.rb +173 -88
- data/lib/ogr/feature_definition.rb +53 -45
- data/lib/ogr/field.rb +17 -19
- data/lib/ogr/field_definition.rb +30 -18
- data/lib/ogr/geocoder.rb +11 -4
- data/lib/ogr/geometries/line_string.rb +1 -0
- data/lib/ogr/geometries/line_string_25d.rb +0 -9
- data/lib/ogr/geometries/linear_ring.rb +2 -2
- data/lib/ogr/geometries/point.rb +0 -9
- data/lib/ogr/geometry.rb +116 -49
- data/lib/ogr/geometry_field_definition.rb +31 -15
- data/lib/ogr/geometry_types/container.rb +26 -28
- data/lib/ogr/geometry_types/curve.rb +5 -61
- data/lib/ogr/geometry_types/surface.rb +1 -1
- data/lib/ogr/internal_helpers.rb +2 -2
- data/lib/ogr/layer.rb +12 -10
- data/lib/ogr/layer_mixins/ogr_feature_methods.rb +39 -27
- data/lib/ogr/layer_mixins/ogr_field_methods.rb +66 -50
- data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +17 -8
- data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +7 -6
- data/lib/ogr/layer_mixins/ogr_sql_methods.rb +15 -7
- data/lib/ogr/spatial_reference.rb +79 -42
- data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +149 -118
- data/lib/ogr/spatial_reference_mixins/exporters.rb +87 -51
- data/lib/ogr/spatial_reference_mixins/importers.rb +88 -43
- data/lib/ogr/spatial_reference_mixins/morphers.rb +12 -8
- data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +27 -13
- data/lib/ogr/style_table.rb +15 -5
- data/lib/ogr/style_tool.rb +29 -15
- data/lib/ogr.rb +1 -0
- data/rakelib/docker.rake +10 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +21790 -0
- data/tilt/gdal2.yml +22 -0
- data/tilt/gdal3.yml +22 -0
- metadata +116 -280
- data/History.md +0 -360
- data/lib/ext/error_symbols.rb +0 -7
- data/lib/gdal/dataset_mixins/extensions.rb +0 -380
- data/lib/gdal/merger.rb +0 -132
- data/lib/ogr/data_source_extensions.rb +0 -10
- data/lib/ogr/envelope_extensions.rb +0 -110
- data/lib/ogr/feature_definition_extensions.rb +0 -39
- data/lib/ogr/feature_extensions.rb +0 -87
- data/lib/ogr/geometry_mixins/container_mixins.rb +0 -25
- data/lib/ogr/spatial_reference_extensions.rb +0 -34
- data/lib/ogr/style_table_extensions.rb +0 -26
- data/spec/ffi-gdal_spec.rb +0 -24
- data/spec/integration/gdal/color_table_info_spec.rb +0 -78
- data/spec/integration/gdal/dataset_info_spec.rb +0 -342
- data/spec/integration/gdal/driver_info_spec.rb +0 -170
- data/spec/integration/gdal/geo_transform_info_spec.rb +0 -226
- data/spec/integration/gdal/gridder_spec.rb +0 -331
- data/spec/integration/gdal/raster_attribute_table_info_spec.rb +0 -229
- data/spec/integration/gdal/raster_band_algorithms_spec.rb +0 -35
- data/spec/integration/gdal/raster_band_info_spec.rb +0 -320
- data/spec/integration/ogr/layer_spec.rb +0 -95
- data/spec/spec_helper.rb +0 -116
- data/spec/support/images/123.tiff +0 -0
- data/spec/support/images/osgeo/gdal/data/hfa/float-rle.img +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.lgo +0 -31
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif.msk +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.txt +0 -10
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.tif +0 -0
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.txt +0 -84
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.lgo +0 -45
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.tif +0 -0
- data/spec/support/integration_help.rb +0 -34
- data/spec/support/shapefiles/states_21basic/states.dbf +0 -0
- data/spec/support/shapefiles/states_21basic/states.prj +0 -1
- data/spec/support/shapefiles/states_21basic/states.sbn +0 -0
- data/spec/support/shapefiles/states_21basic/states.sbx +0 -0
- data/spec/support/shapefiles/states_21basic/states.shp +0 -0
- data/spec/support/shapefiles/states_21basic/states.shp.xml +0 -3
- data/spec/support/shapefiles/states_21basic/states.shx +0 -0
- data/spec/support/shared_contexts.rb +0 -28
- data/spec/support/shared_examples/gdal/major_object_examples.rb +0 -55
- data/spec/support/shared_examples/ogr/a_25d_geometry.rb +0 -9
- data/spec/support/shared_examples/ogr/a_container_geometry.rb +0 -49
- data/spec/support/shared_examples/ogr/a_geometry.rb +0 -406
- data/spec/support/shared_examples/ogr/a_line_string.rb +0 -18
- data/spec/support/test_style_table.txt +0 -3
- data/spec/support/worldfiles/SR_50M/SR_50M.VERSION.txt +0 -1
- data/spec/support/worldfiles/SR_50M/SR_50M.prj +0 -1
- data/spec/support/worldfiles/SR_50M/SR_50M.tfw +0 -6
- data/spec/support/worldfiles/SR_50M/SR_50M.tif +0 -0
- data/spec/unit/ext/error_symbols_spec.rb +0 -69
- data/spec/unit/ext/numeric_as_data_type_spec.rb +0 -115
- data/spec/unit/ffi/gdal_spec.rb +0 -73
- data/spec/unit/gdal/color_entry_spec.rb +0 -8
- data/spec/unit/gdal/color_interpretation_spec.rb +0 -8
- data/spec/unit/gdal/color_table_mixins/extensions_spec.rb +0 -62
- data/spec/unit/gdal/color_table_spec.rb +0 -146
- data/spec/unit/gdal/data_type_spec.rb +0 -74
- data/spec/unit/gdal/dataset_mixins/warp_methods_spec.rb +0 -55
- data/spec/unit/gdal/dataset_spec.rb +0 -148
- data/spec/unit/gdal/driver_mixins/extensions_spec.rb +0 -24
- data/spec/unit/gdal/driver_spec.rb +0 -51
- data/spec/unit/gdal/environment_methods_spec.rb +0 -8
- data/spec/unit/gdal/geo_transform_mixins/extensions_spec.rb +0 -69
- data/spec/unit/gdal/geo_transform_spec.rb +0 -265
- data/spec/unit/gdal/grid_spec.rb +0 -98
- data/spec/unit/gdal/gridder/point_extracting_spec.rb +0 -101
- data/spec/unit/gdal/gridder_options_spec.rb +0 -185
- data/spec/unit/gdal/gridder_spec.rb +0 -182
- data/spec/unit/gdal/internal_helpers_spec.rb +0 -278
- data/spec/unit/gdal/major_object_spec.rb +0 -10
- data/spec/unit/gdal/options_spec.rb +0 -33
- data/spec/unit/gdal/raster_attribute_table_spec.rb +0 -7
- data/spec/unit/gdal/raster_band_classifier_spec.rb +0 -260
- data/spec/unit/gdal/raster_band_mixins/extensions_spec.rb +0 -73
- data/spec/unit/gdal/raster_band_mixins/io_extensions_spec.rb +0 -135
- data/spec/unit/gdal/raster_band_spec.rb +0 -8
- data/spec/unit/gdal/rpc_info_spec.rb +0 -8
- data/spec/unit/gdal/version_info_spec.rb +0 -10
- data/spec/unit/gdal/virtual_dataset_spec.rb +0 -34
- data/spec/unit/gdal/warp_operation_spec.rb +0 -8
- data/spec/unit/gdal/warp_options_spec.rb +0 -338
- data/spec/unit/ogr/coordinate_transformation_spec.rb +0 -104
- data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +0 -32
- data/spec/unit/ogr/data_source_spec.rb +0 -223
- data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +0 -20
- data/spec/unit/ogr/driver_spec.rb +0 -152
- data/spec/unit/ogr/envelope_spec.rb +0 -324
- data/spec/unit/ogr/feature_definition_spec.rb +0 -296
- data/spec/unit/ogr/feature_extensions_spec.rb +0 -90
- data/spec/unit/ogr/feature_spec.rb +0 -363
- data/spec/unit/ogr/field_definition_spec.rb +0 -118
- data/spec/unit/ogr/field_spec.rb +0 -195
- data/spec/unit/ogr/geometries/geometry_collection_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/geometry_collection_spec.rb +0 -188
- data/spec/unit/ogr/geometries/line_string_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/line_string_spec.rb +0 -107
- data/spec/unit/ogr/geometries/linear_ring_spec.rb +0 -92
- data/spec/unit/ogr/geometries/multi_line_string_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_line_string_spec.rb +0 -16
- data/spec/unit/ogr/geometries/multi_point_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_point_spec.rb +0 -16
- data/spec/unit/ogr/geometries/multi_polygon_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_polygon_spec.rb +0 -43
- data/spec/unit/ogr/geometries/none_geometry_spec.rb +0 -14
- data/spec/unit/ogr/geometries/point_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/point_spec.rb +0 -307
- data/spec/unit/ogr/geometries/polygon_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/polygon_spec.rb +0 -19
- data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +0 -12
- data/spec/unit/ogr/geometry_field_definition_spec.rb +0 -73
- data/spec/unit/ogr/geometry_spec.rb +0 -711
- data/spec/unit/ogr/internal_helpers_spec.rb +0 -70
- data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +0 -90
- data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +0 -155
- data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +0 -434
- data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +0 -22
- data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +0 -44
- data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +0 -14
- data/spec/unit/ogr/layer_spec.rb +0 -98
- data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +0 -48
- data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +0 -151
- data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +0 -40
- data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +0 -38
- data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +0 -105
- data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +0 -159
- data/spec/unit/ogr/spatial_reference_spec.rb +0 -44
- data/spec/unit/ogr/style_table_spec.rb +0 -108
- data/spec/unit/ogr/style_tool_spec.rb +0 -159
- data/spec/unit/version_info_spec.rb +0 -50
@@ -1,363 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'date'
|
5
|
-
require 'ogr/feature'
|
6
|
-
require 'ogr/field'
|
7
|
-
|
8
|
-
RSpec.describe OGR::Feature do
|
9
|
-
let(:integer_field_def) { OGR::FieldDefinition.new('test integer field', :OFTInteger) }
|
10
|
-
let(:integer_list_field_def) { OGR::FieldDefinition.new('test integer list field', :OFTIntegerList) }
|
11
|
-
let(:real_field_def) { OGR::FieldDefinition.new('test real field', :OFTReal) }
|
12
|
-
let(:real_list_field_def) { OGR::FieldDefinition.new('test real list field', :OFTRealList) }
|
13
|
-
let(:string_field_def) { OGR::FieldDefinition.new('test string field', :OFTString) }
|
14
|
-
let(:string_list_field_def) { OGR::FieldDefinition.new('test string list field', :OFTStringList) }
|
15
|
-
let(:binary_field_def) { OGR::FieldDefinition.new('test binary field', :OFTBinary) }
|
16
|
-
let(:date_field_def) { OGR::FieldDefinition.new('test date field', :OFTDate) }
|
17
|
-
|
18
|
-
let(:feature_definition) do
|
19
|
-
fd = OGR::FeatureDefinition.new('test FD')
|
20
|
-
|
21
|
-
fd.add_field_definition(integer_field_def) # 0
|
22
|
-
fd.add_field_definition(integer_list_field_def) # 1
|
23
|
-
fd.add_field_definition(real_field_def) # 2
|
24
|
-
fd.add_field_definition(real_list_field_def) # 3
|
25
|
-
fd.add_field_definition(string_field_def) # 4
|
26
|
-
fd.add_field_definition(string_list_field_def) # 5
|
27
|
-
fd.add_field_definition(binary_field_def) # 6
|
28
|
-
fd.add_field_definition(date_field_def) # 7
|
29
|
-
|
30
|
-
gfd = fd.geometry_field_definition(0)
|
31
|
-
gfd.type = :wkbPoint
|
32
|
-
gfd.name = 'test point'
|
33
|
-
|
34
|
-
fd
|
35
|
-
end
|
36
|
-
|
37
|
-
let(:empty_feature_definition) do
|
38
|
-
OGR::FeatureDefinition.new('empty test FD')
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '.new' do
|
42
|
-
context 'param is not a FeatureDefinition or pointer to a FeatureDefinition' do
|
43
|
-
it 'raises an OGR::InvalidFeature' do
|
44
|
-
expect do
|
45
|
-
described_class.new('not a pointer')
|
46
|
-
end.to raise_exception OGR::InvalidFeature
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
subject(:feature) { described_class.new(feature_definition) }
|
52
|
-
|
53
|
-
describe '#clone' do
|
54
|
-
it 'returns a new Feature' do
|
55
|
-
expect(subject.clone).to be_a OGR::Feature
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#field_count' do
|
60
|
-
context 'no fields' do
|
61
|
-
subject { empty_feature_definition.field_count }
|
62
|
-
it { is_expected.to be_zero }
|
63
|
-
end
|
64
|
-
|
65
|
-
context 'with fields' do
|
66
|
-
it 'returns the number of fields that have been added' do
|
67
|
-
expect(subject.field_count).to eq 8
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe '#set_field_integer + #field_as_integer' do
|
73
|
-
context 'to a valid index' do
|
74
|
-
it 'adds the field' do
|
75
|
-
subject.set_field_integer(0, 123)
|
76
|
-
expect(subject.field_as_integer(0)).to eq 123
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'to an invalid valid index' do
|
81
|
-
it 'adds the field' do
|
82
|
-
expect do
|
83
|
-
subject.set_field_integer(100, 123)
|
84
|
-
end.to raise_exception GDAL::Error
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'value is not an integer' do
|
89
|
-
it 'raises a TypeError' do
|
90
|
-
expect do
|
91
|
-
subject.set_field_integer(0, 'meow')
|
92
|
-
end.to raise_exception TypeError
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe '#set_field_integer_list + #field_as_integer_list' do
|
98
|
-
context 'to a valid index' do
|
99
|
-
it 'adds the integer list' do
|
100
|
-
subject.set_field_integer_list(1, [1, 2, 3])
|
101
|
-
expect(subject.field_as_integer_list(1)).to eq [1, 2, 3]
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'to an invalid valid index' do
|
106
|
-
it 'adds the field' do
|
107
|
-
expect do
|
108
|
-
subject.set_field_integer_list(100, [1, 2, 3])
|
109
|
-
end.to raise_exception GDAL::Error
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'value is not an array of integers' do
|
114
|
-
it 'raises a TypeError' do
|
115
|
-
expect do
|
116
|
-
subject.set_field_integer_list(1, ['meow'])
|
117
|
-
end.to raise_exception TypeError
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe '#set_field_double + #field_as_double' do
|
123
|
-
context 'to a valid index' do
|
124
|
-
it 'adds the field' do
|
125
|
-
subject.set_field_double(2, 123.123)
|
126
|
-
expect(subject.field_as_double(2)).to eq 123.123
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
context 'to an invalid valid index' do
|
131
|
-
it 'adds the field' do
|
132
|
-
expect do
|
133
|
-
subject.set_field_double(100, 123.123)
|
134
|
-
end.to raise_exception GDAL::Error
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
context 'value is not a float' do
|
139
|
-
it 'raises a TypeError' do
|
140
|
-
expect do
|
141
|
-
subject.set_field_double(2, 'meow')
|
142
|
-
end.to raise_exception TypeError
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
describe '#set_field_double_list + #field_as_double_list' do
|
148
|
-
context 'to a valid index' do
|
149
|
-
it 'adds the double list' do
|
150
|
-
subject.set_field_double_list(3, [1.1, 2.1, 3.1])
|
151
|
-
expect(subject.field_as_double_list(3)).to eq [1.1, 2.1, 3.1]
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
context 'to an invalid valid index' do
|
156
|
-
it 'adds the field' do
|
157
|
-
expect do
|
158
|
-
subject.set_field_double_list(100, [1.1, 2.1, 3.1])
|
159
|
-
end.to raise_exception GDAL::Error
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
context 'value is not an array of doubles' do
|
164
|
-
it 'raises a TypeError' do
|
165
|
-
expect do
|
166
|
-
subject.set_field_double_list(3, ['meow'])
|
167
|
-
end.to raise_exception TypeError
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
describe '#set_field_string + #field_as_string' do
|
173
|
-
context 'to a valid index' do
|
174
|
-
it 'adds the field' do
|
175
|
-
subject.set_field_string(4, 'test string')
|
176
|
-
expect(subject.field_as_string(4)).to eq 'test string'
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
context 'to an invalid valid index' do
|
181
|
-
it 'raises a GDAL::Error' do
|
182
|
-
expect do
|
183
|
-
subject.set_field_string(100, 'test string')
|
184
|
-
end.to raise_exception GDAL::Error
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
context 'value is not a string' do
|
189
|
-
it 'raises a TypeError' do
|
190
|
-
expect do
|
191
|
-
subject.set_field_string(4, 123)
|
192
|
-
end.to raise_exception TypeError
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
describe '#set_field_string_list' do
|
198
|
-
context 'to a valid index' do
|
199
|
-
it 'adds the string list' do
|
200
|
-
subject.set_field_string_list(5, %w[one two three])
|
201
|
-
expect(subject.field_as_string_list(5)).to eq %w[one two three]
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
context 'to an invalid valid index' do
|
206
|
-
it 'raises a GDAL::Error' do
|
207
|
-
expect do
|
208
|
-
subject.set_field_string_list(100, [1, 2, 3])
|
209
|
-
end.to raise_exception GDAL::Error, 'Invalid index : 100'
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
context 'value is an Array of Integers' do
|
214
|
-
it 'returns an Array of Strings' do
|
215
|
-
subject.set_field_string_list(5, [1, 2, 3])
|
216
|
-
expect(subject.field_as_string_list(5)).to eq %w[1 2 3]
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
describe '#set_field_raw + #field_as_raw' do
|
222
|
-
let(:integer_field) do
|
223
|
-
f = OGR::Field.new
|
224
|
-
f.integer = 1
|
225
|
-
|
226
|
-
f
|
227
|
-
end
|
228
|
-
|
229
|
-
let(:integer_list_field) do
|
230
|
-
f = OGR::Field.new
|
231
|
-
f.integer_list = [1, 2, 3]
|
232
|
-
|
233
|
-
f
|
234
|
-
end
|
235
|
-
|
236
|
-
context 'to a valid index' do
|
237
|
-
it 'adds the field' do
|
238
|
-
subject.set_field_raw(0, integer_field)
|
239
|
-
expect(subject.field_as_integer(0)).to eq 1
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
context 'to an invalid valid index' do
|
244
|
-
it 'adds the field' do
|
245
|
-
expect do
|
246
|
-
subject.set_field_raw(100, integer_field)
|
247
|
-
end.to raise_exception GDAL::Error
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
describe '#set_field_binary + #field_as_binary' do
|
253
|
-
context 'to a valid index' do
|
254
|
-
it 'adds the field' do
|
255
|
-
subject.set_field_binary(6, [65, 66, 67, 68, 69].pack('C*'))
|
256
|
-
expect(subject.field_as_binary(6)).to eq [65, 66, 67, 68, 69]
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
context 'to an invalid valid index' do
|
261
|
-
it 'adds the field' do
|
262
|
-
expect do
|
263
|
-
subject.set_field_binary(100, 123)
|
264
|
-
end.to raise_exception TypeError
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
|
-
context 'value is not binary' do
|
269
|
-
it 'raises a TypeError' do
|
270
|
-
expect do
|
271
|
-
subject.set_field_binary(6, 123)
|
272
|
-
end.to raise_exception TypeError
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
describe '#set_field_date_time + #field_as_date_time' do
|
278
|
-
let(:date_time) { DateTime.now } # rubocop:disable Style/DateTime
|
279
|
-
|
280
|
-
context 'to a valid index' do
|
281
|
-
it 'adds the field' do
|
282
|
-
subject.set_field_date_time(7, date_time)
|
283
|
-
expect(subject.field_as_date_time(7).httpdate).to eq date_time.httpdate
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
context 'to an invalid valid index' do
|
288
|
-
it 'adds the field' do
|
289
|
-
expect do
|
290
|
-
subject.set_field_binary(100, 123)
|
291
|
-
end.to raise_exception TypeError
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
context 'value is not binary' do
|
296
|
-
it 'raises a TypeError' do
|
297
|
-
expect do
|
298
|
-
subject.set_field_binary(6, 123)
|
299
|
-
end.to raise_exception TypeError
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
303
|
-
describe '#field_definition' do
|
304
|
-
context 'field exists at the given index' do
|
305
|
-
it 'returns the FieldDefinition' do
|
306
|
-
expect(subject.field_definition(0)).to be_a OGR::FieldDefinition
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
context 'field does not exist at the given index' do
|
311
|
-
it 'raises a GDAL::Error' do
|
312
|
-
expect { subject.field_definition(123) }.to raise_exception GDAL::Error
|
313
|
-
end
|
314
|
-
end
|
315
|
-
end
|
316
|
-
|
317
|
-
describe 'field_index' do
|
318
|
-
context 'field exists with the given name' do
|
319
|
-
it "returns the FieldDefinition's index" do
|
320
|
-
expect(subject.field_index('test binary field')).to eq 6
|
321
|
-
end
|
322
|
-
end
|
323
|
-
|
324
|
-
context 'field does not exist with the given name' do
|
325
|
-
it 'returns nil' do
|
326
|
-
expect(subject.field_index('asdfadsasd')).to be_nil
|
327
|
-
end
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
describe '#field_set?' do
|
332
|
-
context 'field at the given index is not set' do
|
333
|
-
it 'returns false' do
|
334
|
-
expect(subject.field_set?(0)).to eq false
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
context 'field at the given index is set' do
|
339
|
-
before do
|
340
|
-
subject.set_field_string(0, 'Pants')
|
341
|
-
end
|
342
|
-
|
343
|
-
it 'returns true' do
|
344
|
-
expect(subject.field_set?(0)).to eq true
|
345
|
-
end
|
346
|
-
end
|
347
|
-
end
|
348
|
-
|
349
|
-
describe '#unset_field + #field_set?' do
|
350
|
-
context 'field is set' do
|
351
|
-
it 'removes the field' do
|
352
|
-
subject.unset_field(0)
|
353
|
-
expect(subject.field_set?(0)).to eq false
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
context 'field is not set' do
|
358
|
-
it 'raises a GDAL::Error' do
|
359
|
-
expect { subject.unset_field(100) }.to raise_exception GDAL::Error
|
360
|
-
end
|
361
|
-
end
|
362
|
-
end
|
363
|
-
end
|
@@ -1,118 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'ogr/field_definition'
|
5
|
-
|
6
|
-
RSpec.describe OGR::FieldDefinition do
|
7
|
-
subject(:field) { described_class.new('test field', :OFTInteger) }
|
8
|
-
|
9
|
-
describe '#set' do
|
10
|
-
before do
|
11
|
-
subject.set('new name', :OFTString, 5, 2, :OJRight)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'sets the name' do
|
15
|
-
expect(subject.name).to eq 'new name'
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'sets the width' do
|
19
|
-
expect(subject.width).to eq 5
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'sets the precision' do
|
23
|
-
expect(subject.precision).to eq 2
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'sets the justification' do
|
27
|
-
expect(subject.justification).to eq :OJRight
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#name' do
|
32
|
-
it 'returns the name given during creation' do
|
33
|
-
expect(subject.name).to eq 'test field'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '#name= + #name' do
|
38
|
-
it 'assigns the name' do
|
39
|
-
subject.name = 'new test name'
|
40
|
-
expect(subject.name).to eq 'new test name'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#justification' do
|
45
|
-
context 'default' do
|
46
|
-
it 'returns :OJUndefined' do
|
47
|
-
expect(subject.justification).to eq :OJUndefined
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe '#justification= + #justification' do
|
53
|
-
it 'assigns the justification' do
|
54
|
-
subject.justification = :OJLeft
|
55
|
-
expect(subject.justification).to eq :OJLeft
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#precision' do
|
60
|
-
context 'default' do
|
61
|
-
it 'returns 0' do
|
62
|
-
expect(subject.precision).to be_zero
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '#precision= + #precision' do
|
68
|
-
it 'assigns the precision' do
|
69
|
-
subject.precision = 1
|
70
|
-
expect(subject.precision).to eq 1
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe '#type' do
|
75
|
-
context 'default' do
|
76
|
-
it 'returns the value it was created with' do
|
77
|
-
expect(subject.type).to eq :OFTInteger
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe '#type= + #type' do
|
83
|
-
it 'assigns the type' do
|
84
|
-
subject.type = :OFTString
|
85
|
-
expect(subject.type).to eq :OFTString
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe '#width' do
|
90
|
-
context 'default' do
|
91
|
-
it 'returns 0' do
|
92
|
-
expect(subject.width).to be_zero
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe '#width= + #width' do
|
98
|
-
it 'assigns the width' do
|
99
|
-
subject.width = 1
|
100
|
-
expect(subject.width).to eq 1
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe '#ignored?' do
|
105
|
-
context 'default' do
|
106
|
-
it 'returns false' do
|
107
|
-
expect(subject).to_not be_ignored
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe '#ignore= + #ignored?' do
|
113
|
-
it 'assigns the value' do
|
114
|
-
subject.ignore = true
|
115
|
-
expect(subject).to be_ignored
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
data/spec/unit/ogr/field_spec.rb
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'ogr/field'
|
5
|
-
|
6
|
-
RSpec.describe OGR::Field do
|
7
|
-
describe '#integer' do
|
8
|
-
context 'not set' do
|
9
|
-
it 'returns 0.0' do
|
10
|
-
expect(subject.integer).to eql 0
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#integer= + #integer' do
|
16
|
-
context 'valid int' do
|
17
|
-
it 'sets the value' do
|
18
|
-
subject.integer = 1
|
19
|
-
expect(subject.integer).to eq 1
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#integer64' do
|
25
|
-
context 'not set' do
|
26
|
-
it 'returns 0.0' do
|
27
|
-
expect(subject.integer64).to eql 0
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#integer64= + #integer64' do
|
33
|
-
context 'valid int64' do
|
34
|
-
it 'sets the value' do
|
35
|
-
subject.integer64 = 2**32 + 1
|
36
|
-
expect(subject.integer64).to eq 2**32 + 1
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#real' do
|
42
|
-
context 'not set' do
|
43
|
-
it 'returns 0.0' do
|
44
|
-
expect(subject.real).to eql 0.0
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '#real= + #real' do
|
50
|
-
context 'valid float' do
|
51
|
-
it 'sets the value' do
|
52
|
-
subject.real = 1.23
|
53
|
-
expect(subject.real).to eq 1.23
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '#string' do
|
59
|
-
context 'not set' do
|
60
|
-
it 'returns an empty string' do
|
61
|
-
expect(subject.string).to eq ''
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#string= + #string' do
|
67
|
-
context 'valid string' do
|
68
|
-
it 'sets the value' do
|
69
|
-
subject.string = 'meow'
|
70
|
-
expect(subject.string).to eq 'meow'
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe '#integer_list' do
|
76
|
-
context 'not set' do
|
77
|
-
it 'returns an empty array' do
|
78
|
-
expect(subject.integer_list).to eq []
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe '#integer_list= + #integer_list' do
|
84
|
-
context 'valid int array' do
|
85
|
-
it 'sets the value' do
|
86
|
-
subject.integer_list = [1, 2]
|
87
|
-
expect(subject.integer_list).to eq [1, 2]
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe '#integer64_list' do
|
93
|
-
context 'not set' do
|
94
|
-
it 'returns an empty array' do
|
95
|
-
expect(subject.integer64_list).to eq []
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe '#integer64_list= + #integer64_list' do
|
101
|
-
context 'valid int64 array' do
|
102
|
-
it 'sets the value' do
|
103
|
-
subject.integer64_list = [2**32 + 1, 2**32 + 2]
|
104
|
-
expect(subject.integer64_list).to eq [2**32 + 1, 2**32 + 2]
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe '#real_list' do
|
110
|
-
context 'not set' do
|
111
|
-
it 'returns an empty array' do
|
112
|
-
expect(subject.real_list).to eq []
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe '#real_list= + #real_list' do
|
118
|
-
context 'valid float array' do
|
119
|
-
it 'sets the value' do
|
120
|
-
subject.real_list = [1.5, 6.9]
|
121
|
-
expect(subject.real_list).to eq [1.5, 6.9]
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
describe '#string_list' do
|
127
|
-
context 'not set' do
|
128
|
-
it 'returns an empty array' do
|
129
|
-
expect(subject.string_list).to eq []
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe '#string_list= + #string_list' do
|
135
|
-
context 'valid string array' do
|
136
|
-
it 'sets the value' do
|
137
|
-
subject.string_list = %w[one two]
|
138
|
-
expect(subject.string_list).to eq %w[one two]
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe '#binary' do
|
144
|
-
context 'not set' do
|
145
|
-
it 'returns an empty string' do
|
146
|
-
expect(subject.binary).to eq ''
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe '#binary= + #binary' do
|
152
|
-
context 'valid binary' do
|
153
|
-
it 'sets the value' do
|
154
|
-
subject.binary = [1, 2, 3].pack('C*')
|
155
|
-
expect(subject.binary).to eq [1, 2, 3].pack('C*')
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
describe '#set' do
|
161
|
-
context 'not set' do
|
162
|
-
it 'returns a Hash with markers set to 0' do
|
163
|
-
expect(subject.set).to eq(marker1: 0, marker2: 0)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe '#set= + #set' do
|
169
|
-
context 'valid set hash' do
|
170
|
-
it 'sets the value' do
|
171
|
-
subject.set = { marker1: 1, marker2: 200 }
|
172
|
-
expect(subject.set).to eq(marker1: 1.0, marker2: 200)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
describe '#date' do
|
178
|
-
context 'not set' do
|
179
|
-
it 'returns nil' do
|
180
|
-
expect(subject.date).to be_nil
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
describe '#date= + #date' do
|
186
|
-
context 'valid date' do
|
187
|
-
let(:now) { DateTime.now } # rubocop:disable Style/DateTime
|
188
|
-
|
189
|
-
it 'sets the date' do
|
190
|
-
subject.date = now
|
191
|
-
expect(subject.date.httpdate).to eq now.httpdate
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'ogr'
|
5
|
-
|
6
|
-
RSpec.describe OGR::GeometryCollection25D do
|
7
|
-
describe '#type' do
|
8
|
-
context 'when created with data' do
|
9
|
-
subject { OGR::Geometry.create_from_wkt(wkt) }
|
10
|
-
let(:wkt) { 'GEOMETRYCOLLECTION(POINT(4 6 8),LINESTRING(4 6 8,7 10 11))' }
|
11
|
-
|
12
|
-
it 'returns :wkbGeometryCollection25D' do
|
13
|
-
expect(subject.type).to eq :wkbGeometryCollection25D
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when created without data' do
|
18
|
-
subject { described_class.new }
|
19
|
-
|
20
|
-
it 'returns :wkbGeometryCollection' do
|
21
|
-
expect(subject.type).to eq :wkbGeometryCollection
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|