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.
 
 

36 lines
677 B

#include "gp/pair.hpp"
#include "test_scaffold.h"
#include <random>
#include <string>
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);
gp::pair<double, std::string> v{0, "zero"};
bool result = true;
for(int i = 0 ; i < 100; i++)
{
auto a = setter();
v = gp::pair(a, std::to_string(a));
result = gp::pair<double, std::string>(a, std::to_string(a)) == v ? result : false;
}
return !result;
}
};
append_test dummy_rsly21r43(new pair_test{});