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 regels
725 B

  1. #include "test_scaffold.h"
  2. #include <random>
  3. #include <string>
  4. #include "gp/pair.hpp"
  5. typedef std::mt19937_64 cheap_rand;
  6. struct pair_test : public test_scaffold {
  7. uint32_t seed;
  8. pair_test() {
  9. seed = std::random_device{}();
  10. name = __FILE__ ":1_seed";
  11. name += std::to_string(seed);
  12. }
  13. virtual int run() {
  14. cheap_rand setter(seed);
  15. cheap_rand getter(seed);
  16. gp::pair<double, std::string> v{0, "zero"};
  17. bool result = true;
  18. for(int i = 0 ; i < 100; i++)
  19. {
  20. auto a = setter();
  21. auto b = setter();
  22. v = gp::pair(a, std::to_string(a));
  23. result = gp::pair<double, std::string>(b, std::to_string(b)) == v ? result : false;
  24. }
  25. return !result;
  26. }
  27. };
  28. append_test dummy_rsly21r43(new pair_test{});