Jumping off of some of the side discussion in #239, and also what I've observed myself, some way to update and add test vectors would be handy.
What I've been doing is including my scripts in PRs like #238. But those scripts have to import existing tests and modify them in-place, then keep all the IDs and test counts updated. This is a bit tedious. Maybe we can build a tool that improves this.
Thinking aloud, now that we have the source field, perhaps the tool could work something like:
go run ./tools/vectormerge testvectors_v1/foo_test.json -import my_new_tests.json \
-source github/davidben/my-fancy-new-tests -version 0.1
The tool would:
- Check the schema of
my_new_tests.json and error if anything is wrong, but maybe be permissive about things like tcId, numberOfTests, source, undefined notes, etc., since we'll fix them anyway.
- Look for all existing tests whose source is
github/davidben/my-fancy-new-tests. If the version is greater than 0.1, return an error. Otherwise, delete them.
- Take all tests from
my_new_tests.json. Insert them at...
- The first position of the first deleted test, if any tests were removed
- The end if no existing tests were removed
- Set the
source of any inserted tests with the specified source and version
- Renumber
tcId and fix numberOfTests
- Merge the
notes fields, warn or error if there are any conflicts
- Format the resulting JSON canonically
Then a generator's job is to only output standalone JSON files, in whatever formatting is convenient, and the actual merge process is taken care of by a common script.
Thoughts?
Jumping off of some of the side discussion in #239, and also what I've observed myself, some way to update and add test vectors would be handy.
What I've been doing is including my scripts in PRs like #238. But those scripts have to import existing tests and modify them in-place, then keep all the IDs and test counts updated. This is a bit tedious. Maybe we can build a tool that improves this.
Thinking aloud, now that we have the
sourcefield, perhaps the tool could work something like:The tool would:
my_new_tests.jsonand error if anything is wrong, but maybe be permissive about things liketcId,numberOfTests,source, undefinednotes, etc., since we'll fix them anyway.github/davidben/my-fancy-new-tests. If the version is greater than 0.1, return an error. Otherwise, delete them.my_new_tests.json. Insert them at...sourceof any inserted tests with the specified source and versiontcIdand fixnumberOfTestsnotesfields, warn or error if there are any conflictsThen a generator's job is to only output standalone JSON files, in whatever formatting is convenient, and the actual merge process is taken care of by a common script.
Thoughts?