rapidcheck icon indicating copy to clipboard operation
rapidcheck copied to clipboard

Adding example creating/using a generator with boost_test

Open Christewart opened this issue 9 years ago • 1 comments

I was wondering if you could add an example of creating your own generator and then using that generator with boost_test. Inside of generators.md you have a great example of how to create this generator for a Person but when I copy this code verbatim and try to use it with boost_test I get an error like this:

> test/key_properties.cpp:41:8: error: ‘Arbitrary’ is not a class template
>  struct Arbitrary<Person> {
>         ^
> test/key_properties.cpp:41:26: error: explicit specialization of non-template ‘key_properties::rc::Arbitrary’
>  struct Arbitrary<Person> {
>                           ^
> test/key_properties.cpp:42:12: error: ‘Gen’ does not name a type
>      static Gen<Person> arbitrary() {
>             ^
> make[1]: *** [test/test_test_bitcoin-key_properties.o] Error 1
> make[1]: Leaving directory `/home/chris/dev/bitcoin/src'
> make: *** [all] Error 2

Christewart avatar Aug 02 '16 01:08 Christewart

It seems like you are declaring your Arbitrary specialization in the namespace ::key_properties::rc, it needs to be ::rc.

emil-e avatar Aug 02 '16 09:08 emil-e