test(#37): create automated test loader #38
Merged
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.
Wow, what a PR. As described in #37, an automated test runner/loader would be excellent as I develop a full-blown testing suite to ensure things continue to work. Here's the general outline of what happened:
Changes
JSON testing data format
The new test data can be found at
test/data.json
. All matrices, with the exception of the insertion and removal arrays, are uchar one-dimensional arrays of size 36. This array can be parsed as a 6x6 matrix using one of OpenCV'scv::Mat
constructors.test/data.json
is an array of test objects where a test object has the following structure:Future testing implications
Adding test cases
As mentioned above, test matrices are 6x6. The data for these matrices aren't too interesting, nor are their seams, but it will do for now. In the future, if I want to expand this size, I can add new sheets to the Google Sheet linked above. However, larger test cases will still need to be generated by hand. I think in the future I will make the test matrices 10x10 to get some more interesting seams.
Using
test/data.json
The current way I'm envisioning the new test data being used is as follows:
test/data.json
Carver.FindOptimalVerticalSeam()
was being tested, then the test file would load all of the carver["find - vertical"] outputs from eachtest_id
.test/data.json
against the actual outputs from the function.This PR took about two weeks 🎉
Closes #37