   return false;
 }
 
+
 template<typename T>
 bool are_same_type(const T &, const T &)
 {
   return true;
 }
+
 
 void TestSelectSystemCudaToCpp()
 {

#include <unittest/unittest.h>
#include <thrust/system/cuda/memory.h>
#include <thrust/system/cpp/memory.h>

template<typename T1, typename T2>
bool are_same_type(const T1 &, const T2 &)

}
DECLARE_UNITTEST(TestSelectSystemCudaToCpp);


template<typename Iterator>
__global__ void get_temporary_buffer_kernel(size_t n, Iterator result)
{
  *result = thrust::get_temporary_buffer<int>(thrust::seq, n);
}


template<typename Pointer>
__global__ void return_temporary_buffer_kernel(Pointer ptr)
{
  thrust::return_temporary_buffer(thrust::seq, ptr);
}


void TestGetTemporaryBufferDeviceSeq()
{
  const size_t n = 9001;

  typedef thrust::pointer<int, thrust::detail::seq_t> pointer;
  typedef thrust::pair<pointer, std::ptrdiff_t> ptr_and_sz_type;
  thrust::device_vector<ptr_and_sz_type> d_result(1);
  
  get_temporary_buffer_kernel<<<1,1>>>(n, d_result.begin());

  ptr_and_sz_type ptr_and_sz = d_result[0];

  if(ptr_and_sz.second > 0)
  {
    ASSERT_EQUAL(ptr_and_sz.second, n);

    const int ref_val = 13;
    thrust::device_vector<int> ref(n, ref_val);

    thrust::fill_n(thrust::device, ptr_and_sz.first, n, ref_val);

    ASSERT_EQUAL(true, thrust::all_of(thrust::device, ptr_and_sz.first, ptr_and_sz.first + n, thrust::placeholders::_1 == ref_val));

    return_temporary_buffer_kernel<<<1,1>>>(ptr_and_sz.first);
  }
}
DECLARE_UNITTEST(TestGetTemporaryBufferDeviceSeq);


template<typename Iterator>
__global__ void malloc_kernel(size_t n, Iterator result)
{
  *result = static_cast<int*>(thrust::malloc(thrust::seq, sizeof(int) * n).get());
}


template<typename Pointer>
__global__ void free_kernel(Pointer ptr)
{
  thrust::free(thrust::seq, ptr);
}


void TestMallocDeviceSeq()
{
  const size_t n = 9001;

  typedef thrust::pointer<int, thrust::detail::seq_t> pointer;
  thrust::device_vector<pointer> d_result(1);
  
  malloc_kernel<<<1,1>>>(n, d_result.begin());

  pointer ptr = d_result[0];

  if(ptr.get() != 0)
  {
    const int ref_val = 13;
    thrust::device_vector<int> ref(n, ref_val);

    thrust::fill_n(thrust::device, ptr, n, ref_val);

    ASSERT_EQUAL(true, thrust::all_of(thrust::device, ptr, ptr + n, thrust::placeholders::_1 == ref_val));

    free_kernel<<<1,1>>>(ptr);
  }
}
DECLARE_UNITTEST(TestMallocDeviceSeq);

