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

Handle in-test definitions #4

Open
newsch opened this issue Dec 3, 2018 · 0 comments
Open

Handle in-test definitions #4

newsch opened this issue Dec 3, 2018 · 0 comments

Comments

@newsch
Copy link
Member

newsch commented Dec 3, 2018

A common pattern is defining a function while testing and using it in further tests. Right now each test is evaluated in it's own environment, so any inline definitions are unknown to successive tests.
One potential approach is to naively use the same ocaml terminal for each suite, and either only parsing and returning the outputs at the end of the suite or communicating/parsing with the program and returning results while running them.
Another is to find any let statements in suites and run them with any following tests in a suite (or parsing following tests to determine if they use the defined statements).

For example, this test defines the function sqrt to be used in following tests:

val sqrt : float -> float network = 

- : float list =
[1.; 2.5; 2.05; 2.00060975609756087; 2.00000009292229475;
 2.00000000000000222; 2.; 2.; 2.; 2.]
- : float list =
[1.; 5.; 3.4; 3.0235294117647058; 3.00009155413138; 3.00000000139698386; 3.;
 3.; 3.; 3.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant