Skip to content

C++: slightly tweak KST generator to generate more automatic tests#110

Open
Mingun wants to merge 6 commits intokaitai-io:masterfrom
Mingun:cpp-kst-fixes
Open

C++: slightly tweak KST generator to generate more automatic tests#110
Mingun wants to merge 6 commits intokaitai-io:masterfrom
Mingun:cpp-kst-fixes

Conversation

@Mingun
Copy link
Copy Markdown
Contributor

@Mingun Mingun commented Apr 6, 2024

While working on #108 I decided to split out a couple of fixes for the C++ generator in its own PR, because the one of commits are discussional.

The 5th commit tweaks the generator to generate correct tests for checking _parent and _root for nulls, thus the test nested_types_import no longer to be manual. The 6th commit makes another two tests KST adopted and fixes situation for several tests that was manually changed, but marked as automatically generated..

The second commit makes tests switch_manual_enum_invalid and switch_manual_enum_invalid_else automatically generated, similar to the tests enum_invalid and enum_to_i_invalid. If you think, that instead enum_invalid and enum_to_i_invalid needs to be fixed, I already implemented such logic in the generator, just say and I'll replace the second commit.

Mingun added 6 commits April 12, 2026 22:03
…e scenarios

C++: to add check for value of pointer and do not add it for primitives
The test was initially introduced with that logic in 3bdfb59,
however the similar tests `enum_invalid` and `enum_to_i_invalid` uses the numerical values
and passes successfully, which means that such manual edits in tests are not required.

Tests regenerated using this command and manually cleaned up from unnecessary changes:
./spec_kst_to_all -t cpp_stl_98 -t cpp_stl_11 --all-specs -f
Changes probably related to several commints, most notable is
kaitai-io/kaitai_struct_compiler@762cda5

Tests regenerated using this command and manually cleaned up from unnecessary changes:
./spec_kst_to_all -t cpp_stl_98 -t cpp_stl_11 --all-specs -f
`at()` is always used since implementing index operator for C++ in
kaitai-io/kaitai_struct_compiler@e59eb56

Tests regenerated using this command and manually cleaned up from unnecessary changes:
./spec_kst_to_all -t cpp_stl_98 -t cpp_stl_11 --all-specs -f
…_parent`

Tests regenerated using this command and manually cleaned up from unnecessary changes:
./spec_kst_to_all -t cpp_stl_98 -t cpp_stl_11 --all-specs -f
… commit

Tests regenerated using this command and manually cleaned up from unnecessary changes:
./spec_kst_to_all -t cpp_stl_98 -t cpp_stl_11 --all-specs -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant