open Fuchu
let clo f () =
printfn "Initializing..."
let mem = 2 // Allocate some unmanaged resources (like GPU memory for example.)
f mem
printfn "Freeing..."
/// Applies a function to a value
let inline testFixture' setup (name, partialTest) =
testCase name (setup partialTest)
let test1 x = printfn "Doing something with that memory..."
let test2 x = printfn "Doing something else with that memory..."
let test3 x = printfn "Third test that uses the memory..."
let testCombined x = test1 x; test2 x; test3 x // How do I get this to count as 3 tests instead of 1?
let tests = testFixture' clo ("3 tests",testCombined)
run tests
Alternatively, just using testFixture, is it possible to use the setup only once, pass the resulting parameters to the tests and dispose of it afterwards? To be honest this is quite a puzzler, and I have no idea how to deal with this. In XUnit or NUnit (assuming there weren't bugs making the adapter unable to find the tests) I would just use a fixture class.
With the example I found on the blog, the setup would have to be triggered each time for every test. I think there should be a middle ground between loading the thing every time and loading it only once outside of the test suite.
Alternatively, just using
testFixture
, is it possible to use the setup only once, pass the resulting parameters to the tests and dispose of it afterwards? To be honest this is quite a puzzler, and I have no idea how to deal with this. In XUnit or NUnit (assuming there weren't bugs making the adapter unable to find the tests) I would just use a fixture class.With the example I found on the blog, the setup would have to be triggered each time for every test. I think there should be a middle ground between loading the thing every time and loading it only once outside of the test suite.
Any idea how?