title: Can we unit test memory allocation?
body: <p>I have to test a library that provides its own memory allocation routine:</p>
  
  <pre><code>void* allocation_routine(size_t size) throw();
  </code></pre>
  
  <p>Documentation states that this function allocates at least size bytes of memory (it's allowed to allocate more). By the way the function uses posix_memalign internally, but the implementation may change.</p>
  
  <p>I'm wondering if it's possible to write a unit test for that kind of functions? How can we test whether the required amount of memory was allocated?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>If we can't write a unit test then what is the closest solution?</p>