Improve testing infrastructure with dynamic discovery and validation #20

Merged
mvhutz merged 4 commits from style/lambda-iterator into main 2026-01-13 01:20:47 +00:00
Owner

Summary

This PR enhances the testing infrastructure with dynamic test discovery, automated validation, and improved error handling.

Changes

Testing Infrastructure

  • Added TestSamplesValidity integration test that validates all test files against their expected output.
  • Implemented dynamic test discovery using filepath.Glob to automatically find all .test files.
  • Renamed benchmark_test.go to lambda_test.go for better naming consistency.
  • Consolidated helper functions into a single runSample function.
  • Replaced all error handling with assert for consistent and clear test output.
  • Required all .test files to have corresponding .expected files.

Iterator Improvements

  • Added Swap method to iterator for better reduction algorithm.
  • Improved reduction algorithm with LIFO-based iterator implementation.

Build System

  • Added make test target to run tests without benchmarks.
  • Updated Makefile help text to include the new test target.

Test Cases

  • Added new test cases with expected outputs: church_5^5, church_6^6, fast_list_2^30, list_2^30.
  • Added validation files for all test cases.

Test plan

  • Run tests with expected output validation.
  • Run benchmarks to ensure performance is maintained.
  • Verify make targets work correctly.
## Summary This PR enhances the testing infrastructure with dynamic test discovery, automated validation, and improved error handling. ## Changes ### Testing Infrastructure - Added `TestSamplesValidity` integration test that validates all test files against their expected output. - Implemented dynamic test discovery using `filepath.Glob` to automatically find all `.test` files. - Renamed `benchmark_test.go` to `lambda_test.go` for better naming consistency. - Consolidated helper functions into a single `runSample` function. - Replaced all error handling with `assert` for consistent and clear test output. - Required all `.test` files to have corresponding `.expected` files. ### Iterator Improvements - Added `Swap` method to iterator for better reduction algorithm. - Improved reduction algorithm with LIFO-based iterator implementation. ### Build System - Added `make test` target to run tests without benchmarks. - Updated Makefile help text to include the new test target. ### Test Cases - Added new test cases with expected outputs: `church_5^5`, `church_6^6`, `fast_list_2^30`, `list_2^30`. - Added validation files for all test cases. ## Test plan - Run tests with expected output validation. - Run benchmarks to ensure performance is maintained. - Verify make targets work correctly.
mvhutz added 4 commits 2026-01-13 01:19:13 +00:00
Modified benchmark_test.go to dynamically discover all .test files in the
tests directory instead of using hardcoded paths.
Added TestSamplesValidity integration test that validates each test file
against its corresponding .expected file.
Added runSampleWithOutput helper function to capture interpreter output.
Added new test cases with expected outputs for validation.
Renamed benchmark_test.go to lambda_test.go.
Consolidated helper functions to use single runSample function.
Replaced all error handling with assert for consistency.
Removed optional expected file check to require all test files have corresponding expected files.
Added make test directive that runs tests without benchmarks.
Updated help text to include the new test target.
mvhutz merged commit dbc3c5a8d4 into main 2026-01-13 01:20:47 +00:00
mvhutz deleted branch style/lambda-iterator 2026-01-13 01:20:47 +00:00
Sign in to join this conversation.