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.

41 lines
1.0 KiB

  1. #include "gp/utils/pointers.hpp"
  2. #include "gp/utils/allocators/arena.hpp"
  3. #include "test_scaffold.h"
  4. #include "allocator.hpp"
  5. #include <memory>
  6. struct unique_ptr_test : public test_scaffold {
  7. uint32_t seed;
  8. unique_ptr_test() {
  9. name = __FILE__ ":1";
  10. }
  11. virtual int run() {
  12. std::unique_ptr<gp::array<char, 4096*4>> store = std::make_unique<gp::array<char, 4096*4>>();
  13. gp::arena alloc{&*store->begin(), store->size()};
  14. auto v = gp::unique_ptr<uint64_t>::make(alloc, 1024);
  15. return !v;
  16. }
  17. };
  18. append_test dummy_45sdf543(new unique_ptr_test{});
  19. struct unique_ptr2_test : public test_scaffold {
  20. uint32_t seed;
  21. unique_ptr2_test() {
  22. name = __FILE__ ":2";
  23. }
  24. virtual int run() {
  25. std::unique_ptr<gp::array<char, 4096*4>> store = std::make_unique<gp::array<char, 4096*4>>();
  26. gp::arena alloc{&*store->begin(), store->size()};
  27. auto v = gp::unique_ptr<std::string>::make(alloc, "1024");
  28. return !(*(v->begin()) == '1' && v);
  29. }
  30. };
  31. append_test dummy_aguhdff543(new unique_ptr2_test{});