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

Go to the source code of this file.

Classes

class  RandomIntGenerator
 

Functions

Catch::Generators::GeneratorWrapper< int > random (int low, int high)
 
 TEST_CASE ("Generating random ints", "[example][generator]")
 

Function Documentation

◆ random()

◆ TEST_CASE()

TEST_CASE ( "Generating random ints" ,
"" [example][generator] )

Definition at line 46 of file 300-Gen-OwnGenerator.cpp.

46 {
47 SECTION("Nice UX") {
48 auto i = GENERATE(take(100, random(-100, 100)));
49 REQUIRE(i >= -100);
50 REQUIRE(i <= 100);
51 }
52 SECTION("Creating the random generator directly") {
53 auto i = GENERATE(take(100, GeneratorWrapper<int>(std::unique_ptr<IGenerator<int>>(new RandomIntGenerator(-100, 100)))));
54 REQUIRE(i >= -100);
55 REQUIRE(i <= 100);
56 }
57}
#define GENERATE(...)
#define SECTION(...)
Definition catch.hpp:226
#define REQUIRE(...)
Definition catch.hpp:185
GeneratorWrapper< T > take(size_t target, GeneratorWrapper< T > &&generator)
uint16_t random
Definition yubico_otp.c:47