The hash_function test has too many solutions to feasibly iterate through. An idea to get around this is to, for each test, provide a function that checks that the registers represent a correct solution and a list of registers to search for with regex.
Consider check_result. We can iterate through the provided stream and generate a map of observed registers to values. Then to check the result, for each test we can provide to check_result a function of the form:
that determines whether or not the test's solution is valid.
This will also make it easier to check solutions in sudoku and nqueens, since rather than enumerating through all possible solutions, we can simply check the solution.
The
hash_function
test has too many solutions to feasibly iterate through. An idea to get around this is to, for each test, provide a function that checks that the registers represent a correct solution and a list of registers to search for with regex.Consider
check_result
. We can iterate through the provided stream and generate a map of observed registers to values. Then to check the result, for each test we can provide tocheck_result
a function of the form:is_valid_solution: ( register_mapping : string Map.t ) -> bool
that determines whether or not the test's solution is valid.
This will also make it easier to check solutions in sudoku and nqueens, since rather than enumerating through all possible solutions, we can simply check the solution.