draperlaboratory / cbat_tools

Program analysis tools developed at Draper on the CBAT project.
MIT License
102 stars 14 forks source link

hash_function multiple solutions #237

Closed DieracDelta closed 4 years ago

DieracDelta commented 4 years ago

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:

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.

DieracDelta commented 4 years ago

closed by #253