diff --git a/include/rapidcheck/gen/Numeric.hpp b/include/rapidcheck/gen/Numeric.hpp index 6954c973..ed89c186 100644 --- a/include/rapidcheck/gen/Numeric.hpp +++ b/include/rapidcheck/gen/Numeric.hpp @@ -1,9 +1,12 @@ #pragma once +#include + #include "rapidcheck/detail/BitStream.h" #include "rapidcheck/shrinkable/Create.h" #include "rapidcheck/shrink/Shrink.h" #include "rapidcheck/gen/Transform.h" +#include "rapidcheck/gen/Tuple.h" #include "rapidcheck/gen/detail/ScaleInteger.h" namespace rc { @@ -80,6 +83,18 @@ struct DefaultArbitrary { static Gen arbitrary() { return real; } }; +template +struct DefaultArbitrary> { + static Gen> arbitrary() { + return gen::map( + gen::pair( + DefaultArbitrary::arbitrary(), + DefaultArbitrary::arbitrary()), + [](std::pair pair) { return std::complex (pair.first, pair.second); } + ); + } +}; + template <> struct DefaultArbitrary { static Gen arbitrary() { return boolean; }