]>
git.saurik.com Git - apple/xnu.git/blob - tests/safe_allocation_src/data.cpp
   4 //      T const* data() const; 
   7 #include <libkern/c++/safe_allocation.h> 
   8 #include <darwintest.h> 
   9 #include "test_utils.h" 
  20                 test_safe_allocation
<T
> array(10, libkern::allocate_memory
); 
  21                 CHECK(array
.data() != nullptr); 
  24                 T
* memory 
= reinterpret_cast<T
*>(malloc_allocator::allocate(10 * sizeof(T
))); 
  25                 test_safe_allocation
<T
> array(memory
, 10, libkern::adopt_memory
); 
  26                 T
* data 
= array
.data(); 
  27                 CHECK(data 
== memory
); 
  30                 T
* memory 
= reinterpret_cast<T
*>(malloc_allocator::allocate(10 * sizeof(T
))); 
  31                 test_safe_allocation
<T
> const array(memory
, 10, libkern::adopt_memory
); 
  32                 T 
const* data 
= array
.data(); 
  33                 CHECK(data 
== memory
); 
  37 T_DECL(data
, "safe_allocation.data") {