File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#pragma once
22
3+ #include < complex>
4+
35#include " rapidcheck/detail/BitStream.h"
46#include " rapidcheck/shrinkable/Create.h"
57#include " rapidcheck/shrink/Shrink.h"
68#include " rapidcheck/gen/Transform.h"
9+ #include " rapidcheck/gen/Tuple.h"
710#include " rapidcheck/gen/detail/ScaleInteger.h"
811
912namespace rc {
@@ -80,6 +83,18 @@ struct DefaultArbitrary<long double> {
8083 static Gen<long double > arbitrary () { return real<long double >; }
8184};
8285
86+ template <typename T>
87+ struct DefaultArbitrary <std::complex <T>> {
88+ static Gen<std::complex <T>> arbitrary () {
89+ return gen::map (
90+ gen::pair (
91+ DefaultArbitrary<T>::arbitrary (),
92+ DefaultArbitrary<T>::arbitrary ()),
93+ [](std::pair<T, T> pair) { return std::complex <T> (pair.first , pair.second ); }
94+ );
95+ }
96+ };
97+
8398template <>
8499struct DefaultArbitrary <bool > {
85100 static Gen<bool > arbitrary () { return boolean; }
You can’t perform that action at this time.
0 commit comments