General Purpose library for Freestanding C++ and POSIX systems
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

41 rinda
1.0 KiB

pirms 3 gadiem
  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{});