Skip to content

Conversation

@alexgarzao
Copy link
Collaborator

This PR introduces significant improvements and new features to the test generation system, focusing on better support for comparative benchmarking, function code unit tests, and more maintainable test configuration. The changes include new test generators, template files, and a refactored exclusion mechanism for test cases, as well as updates to validation tag mappings for better compatibility with go-playground/validator. The Makefile is also updated to handle the new test files and clean-up logic.

New test generation features:

  • Added generators for comparative performance tests (testgen/generate_cmp_perf_tests.go) and function code unit tests (testgen/generate_function_code_tests.go), along with their corresponding templates (testgen/cmp_perf_no_pointer_tests.tpl, testgen/cmp_perf_pointer_tests.tpl, testgen/function_code_test.tpl). These enable automated benchmarking and more thorough unit testing of generated validation code. [1] [2] [3] [4] [5]

Test case configuration and exclusion improvements:

  • Refactored test case exclusion logic by introducing the excludeIf bitmask in testgen/validations.go, replacing the previous generateFor string approach. This makes it easier to manage which tests are generated for pointer/non-pointer types and benchmarking. All relevant test generators now use this mechanism. [1] [2] [3] [4]

Validation tag mapping updates:

  • Updated validatorTag fields in typesValidation to ensure correct mapping to go-playground/validator tags for all supported validation operations (e.g., email, required, eq, ne, gt, gte, lt, lte, min, max, eq_ignore_case). This improves compatibility and accuracy of generated comparative tests. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

Makefile and test generation workflow updates:

  • Enhanced the Makefile to support new test files and clean-up logic for generated benchmarks and function code tests, ensuring the build system stays clean and up-to-date with the new generators. The main test generation entrypoint (testgen/generate_tests.go) is updated to invoke all new generators. [1] [2] [3]

These changes collectively improve the robustness, maintainability, and extensibility of the test generation framework, while enabling more thorough validation and benchmarking of generated code.

@alexgarzao alexgarzao requested a review from Copilot October 29, 2025 17:51
@alexgarzao alexgarzao self-assigned this Oct 29, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 9 out of 12 changed files in this pull request and generated 4 comments.

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.

4 participants