General Purpose library for Freestanding C++ and POSIX systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 regels
725 B

#include "test_scaffold.h"
#include <random>
#include <string>
#include "gp/pair.hpp"
typedef std::mt19937_64 cheap_rand;
struct pair_test : public test_scaffold {
uint32_t seed;
pair_test() {
seed = std::random_device{}();
name = __FILE__ ":1_seed";
name += std::to_string(seed);
}
virtual int run() {
cheap_rand setter(seed);
cheap_rand getter(seed);
gp::pair<double, std::string> v{0, "zero"};
bool result = true;
for(int i = 0 ; i < 100; i++)
{
auto a = setter();
auto b = setter();
v = gp::pair(a, std::to_string(a));
result = gp::pair<double, std::string>(b, std::to_string(b)) == v ? result : false;
}
return !result;
}
};
append_test dummy_rsly21r43(new pair_test{});