-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72aa34b
commit c5e6bf0
Showing
2 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
#include "mkn/gpu.hpp" | ||
|
||
static constexpr uint32_t NUM = 10; | ||
|
||
template <typename T> | ||
using ManagedVector = std::vector<T, mkn::gpu::ManagedAllocator<T>>; | ||
|
||
template <typename T> | ||
using ManagedMemory = std::vector<T, mkn::gpu::NoConstructAllocator<T>>; | ||
|
||
std::size_t alloced = 0; | ||
struct S { | ||
S() { ++alloced; } | ||
}; | ||
|
||
std::uint32_t test_does_construct_on_resize() { | ||
alloced = 0; | ||
ManagedVector<S> mem{NUM}; | ||
mem.resize(NUM + NUM); | ||
return alloced != NUM + NUM; | ||
} | ||
|
||
std::uint32_t test_does_not_construct_on_resize() { | ||
alloced = 0; | ||
ManagedMemory<S> mem{NUM}; | ||
mem.resize(NUM + NUM); | ||
return alloced != 0; | ||
} | ||
|
||
int main() { | ||
KOUT(NON) << __FILE__; | ||
|
||
return test_does_construct_on_resize() + test_does_not_construct_on_resize(); | ||
} |