Repository navigation
Load a JSON fixture written by simplify_export_inputs in SimplifyTest - #146
Merged
Merged
Conversation
simplify_export_inputs writes the inputs of simplify to a JSON file, but no test read this format: SimplifyTest only took a single shape, with one copy and the default parameters. SimplifyTest now takes the full inputs of simplify (several shapes with their copies, and all the parameters), and gets a read_json for the format of simplify_export_inputs. It checks that each simplified shape contains its shape, and that the areas added, counted once for each copy, sum up to at most the maximum approximation area. A first fixture, generated with simplify_export_inputs, checks that the copies weigh in this budget, with two notched shapes, one of them with a hole.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
simplify_export_inputswrites the inputs ofsimplifyto a JSON file, so that a failing case can be added as a regression test, but no test read this format:SimplifyTestonly took a single shape, with one copy and the default parameters.Change
SimplifyTestnow takes the full inputs ofsimplify: several shapes with their copies,maximum_approximation_area,minimum_number_of_verticesandminimum_average_number_of_elements, plus optional expected numbers of elements of the simplified outlines.read_json, reading the format ofsimplify_export_inputs(and the optionalexpected_numbers_of_elements).maximum_approximation_area.data/tests/simplification/simplify/0.json, generated withsimplify_export_inputs: two notched shapes, the first one with 3 copies. Filling one of its notches of area 1 would cost 3, more than the budget of 2.5, so it is unchanged, while both notches of area 0.5 of the second one, which has a hole, are filled for a cost of 1.simplify_export_inputsnames the fixture directory.The two existing cases are unchanged, written with the new parameters.
Tests
The full suite passes (673 tests).