void
rebind_interleaved(
  Domain<Dim> const& dom,
  BlockT&            block,
  int                k)
{
  length_type const size = block.size();

  T* data = new T[2*size];
  T* ptr;

  fill_interleaved_array<Order>(data, dom, CFiller<T>(k, 0, 1));

  block.rebind(data);
  
  test_assert(block.admitted()     == false);
  test_assert(block.user_storage() == interleaved_format);

  block.find(ptr);
  test_assert(ptr == data);

  block.admit(true);
  test_assert(block.admitted() == true);

  test_assert(check_block<Order>(block, dom, CFiller<T>(k, 0, 1)));
  fill_block<Order>(block, dom, CFiller<T>(k+1, 0, 1));

  block.release(true);
  test_assert(block.admitted() == false);

  test_assert(check_interleaved_array<Order>(data, dom, CFiller<T>(k+1, 0, 1)));

  delete[] data;
}
void
rebind_split(
  Domain<Dim> const& dom,
  BlockT&            block,
  int                k)
{
  length_type const size = block.size();

  T* real = new T[size];
  T* imag = new T[size];

  T* real_ptr;
  T* imag_ptr;

  fill_split_array<Order>(real, imag, dom, CFiller<T>(k, 0, 1));

  block.rebind(real, imag);

  test_assert(block.admitted()     == false);
  test_assert(block.user_storage() == split_format); // rebind could change format

  block.find(real_ptr, imag_ptr);
  test_assert(real_ptr == real);
  test_assert(imag_ptr == imag);

  block.admit(true);
  test_assert(block.admitted() == true);

  test_assert(check_block<Order>(block, dom, CFiller<T>(k, 0, 1)));
  fill_block<Order>(block, dom, CFiller<T>(k+1, 0, 1));

  block.release(true);
  test_assert(block.admitted() == false);

  test_assert(check_split_array<Order>(real, imag, dom, CFiller<T>(k+1, 0, 1)));

  delete[] real;
  delete[] imag;
}