Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
311-Gen-CustomCapture.cpp File Reference
#include <catch2/catch.hpp>
Include dependency graph for 311-Gen-CustomCapture.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("Generate random doubles across different ranges", "[generator][example][advanced]")
 

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "Generate random doubles across different ranges" ,
"" [generator][example][advanced] )

Definition at line 14 of file 311-Gen-CustomCapture.cpp.

15 {
16 // Workaround for old libstdc++
17 using record = std::tuple<double, double>;
18 // Set up 3 ranges to generate numbers from
19 auto r1 = GENERATE(table<double, double>({
20 record{3, 4},
21 record{-4, -3},
22 record{10, 1000}
23 }));
24
25 auto r2(r1);
26
27 // This will take r1 by reference and r2 by value.
28 // Note that there are no advantages for doing so in this example,
29 // it is done only for expository purposes.
31 [&r1, r2]{
32 using namespace Catch::Generators;
33 return makeGenerators(take(50, random(std::get<0>(r1), std::get<1>(r2))));
34 }
35 );
36
37 REQUIRE(std::abs(number) > 0);
38}
#define CATCH_INTERNAL_LINEINFO
#define GENERATE(...)
#define REQUIRE(...)
Definition catch.hpp:185
auto makeGenerators(GeneratorWrapper< T > &&generator, Gs... moreGenerators) -> Generators< T >
auto generate(SourceLineInfo const &lineInfo, L const &generatorExpression) -> decltype(std::declval< decltype(generatorExpression())>().get())
GeneratorWrapper< T > take(size_t target, GeneratorWrapper< T > &&generator)
uint16_t random
Definition yubico_otp.c:47
Here is the call graph for this function: