Skip to content

Comments

Add some generative FsCheck tests for ImmMap#4

Open
isaksky wants to merge 1 commit intoGregRos:masterfrom
isaksky:master
Open

Add some generative FsCheck tests for ImmMap#4
isaksky wants to merge 1 commit intoGregRos:masterfrom
isaksky:master

Conversation

@isaksky
Copy link

@isaksky isaksky commented Aug 19, 2016

Hey, not sure if this is useful, or if you already got this covered with other tests, but I made a function to test persistent maps for another project so I thought I'd try on ImmMap too.

It generates a random FSharp.Core.Map, then a random set of actions to do on it (Add | Remove), maintains both an ImmMap and FSharp Map, and then after all the actions are completed, checks that all the intermediate ImmMaps and FSharp Maps are equal.

You can see the input it generates if you change Property to Property(Verbose=True) and then click output in the visual studio test runner. Both ImmMap and ImmSortedMap pass this test.

I had to add some dependencies to the test project, not sure if that is an issue. I also had to drop some references to FSharp.Core to get things to compile on my machine.

If you are open to this kind of thing, I can make some tests for ImmList too.

@GregRos
Copy link
Owner

GregRos commented Nov 29, 2016

Thanks. Once I get back to working on the project (not sure when exactly) I'll look into building the existing tests into some kind of framework too. Right now it's all custom.

Thanks for the tip about FSharp.Core. I'll have to look into that too.

I've written this kind of test code already. You can see it here. The comparison step happens after the tests.

I wrap each collection in a wrapper that also performs unit tests after every operation (like checking that Length grows by 1 after an addition when appropriate).

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

Successfully merging this pull request may close these issues.

2 participants