Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test type distance #39

Open
EmileTrotignon opened this issue Feb 20, 2024 · 0 comments
Open

Unit test type distance #39

EmileTrotignon opened this issue Feb 20, 2024 · 0 comments
Labels
good first issue Good for newcomers medium

Comments

@EmileTrotignon
Copy link
Collaborator

The query/type_distance.ml does complicated things that should be unit tested.

The unit test framework is alcotest. You can file examples of its uses in query/test, which is also the directory where you should write the new tests.

To test this, you should write by hand a few values of Db.Typexpr.t, compute their distance and write the value you get as the expected value.

Some of the types tested should be similar, so that the distance is small, because the type distance function is going to be used on similar types.

You should also test that the distance of a type with itself is 0.

You can also use Query.Private.Type_parser.of_string to get types from strings, instead of writing them as ocaml values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers medium
Projects
None yet
Development

No branches or pull requests

1 participant