Improve testing infrastructure with dynamic discovery and validation (#20)
## 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. Reviewed-on: #20 Co-authored-by: M.V. Hutz <git@maximhutz.me> Co-committed-by: M.V. Hutz <git@maximhutz.me>
This commit was merged in pull request #20.
This commit is contained in:
52
tests/list_2^30.test
Normal file
52
tests/list_2^30.test
Normal file
@@ -0,0 +1,52 @@
|
||||
T x y := x
|
||||
F x y := y
|
||||
if b t e := (b t e)
|
||||
|
||||
pair a b := \c.(c a b)
|
||||
left p := (p T)
|
||||
right p := (p F)
|
||||
|
||||
print n := (n 0 1 end)
|
||||
|
||||
fix f := (\x.(f (x x)) \x.(f (x x)))
|
||||
|
||||
some x := (pair T x)
|
||||
none := \.F
|
||||
isfull := left
|
||||
unwrap := right
|
||||
|
||||
nil := none
|
||||
push i l := (some (pair i l))
|
||||
peek l := (left (unwrap l))
|
||||
pop l := (right (unwrap l))
|
||||
|
||||
inc := (fix \self l.{
|
||||
(if (isfull l)
|
||||
(if (peek l)
|
||||
(push F (self (pop l)))
|
||||
(push T (pop l))
|
||||
)
|
||||
(push T nil)
|
||||
)
|
||||
})
|
||||
|
||||
print := (fix \self l.{
|
||||
(if (isfull l)
|
||||
((if (peek l) 1 0) (self (pop l)))
|
||||
END
|
||||
)
|
||||
})
|
||||
|
||||
one := (push T nil)
|
||||
double N := (push F N)
|
||||
|
||||
N :=
|
||||
(double (double (double (double (double
|
||||
(double (double (double (double (double
|
||||
(double (double (double (double (double
|
||||
(double (double (double (double (double
|
||||
(double (double (double (double (double
|
||||
(double (double (double (double (double
|
||||
one))))))))))))))))))))))))))))))
|
||||
|
||||
(print N)
|
||||
Reference in New Issue
Block a user