| 140 | } // anonymous namespace |
| 141 | |
| 142 | TEST(TestMemAlloc, Reserve) { |
| 143 | constexpr size_t TOT = 2048; |
| 144 | |
| 145 | using StreamKey = DevMemAlloc::StreamKey; |
| 146 | auto raw_alloc = std::make_shared<DummyAllocator>(TOT); |
| 147 | auto runtime_policy = std::make_shared<DummyRuntimePolicy>(0); |
| 148 | auto dev_alloc = DevMemAlloc::make(0, TOT, raw_alloc, runtime_policy); |
| 149 | |
| 150 | StreamKey stream_key = nullptr; |
| 151 | auto strm_alloc = dev_alloc->add_stream(static_cast<StreamKey>(&stream_key)); |
| 152 | EXPECT_EQ(0u, strm_alloc->get_free_memory().tot); |
| 153 | EXPECT_EQ(2048u, dev_alloc->get_free_memory().tot); |
| 154 | } |
| 155 | |
| 156 | TEST(TestMemAlloc, ReserveOutOfMemory) { |
| 157 | constexpr size_t TOT = 2048; |
nothing calls this directly
no test coverage detected