Commit 9e63c593 authored by Armin Sobhani's avatar Armin Sobhani
Browse files

fix problem with boost.compute unit test

parent d57cba45
......@@ -62,9 +62,17 @@ public:
self_type::insert(self_type::begin(), s, s + count);
}
sequence_host(
const CharT* s)
: ContainerT<CharT, AllocatorT<CharT>>()
{
size_t count = std::char_traits<CharT>::length(s);
self_type::insert(self_type::begin(), s, s + count);
}
sequence_host(
const CharT* s
, const AllocatorT<CharT>& alloc = AllocatorT<CharT>() )
, const AllocatorT<CharT>& alloc)
: ContainerT<CharT, AllocatorT<CharT>>(alloc)
{
size_t count = std::char_traits<CharT>::length(s);
......
......@@ -48,7 +48,7 @@ function(add_bioseq_test TEST_NAME TEST_SOURCE)
endfunction()
add_bioseq_test("sequence" test_sequence.cpp)
#add_bioseq_test("boost.compute.sequence" test_bc_sequence.cpp)
add_bioseq_test("boost.compute.sequence" test_bc_sequence.cpp)
add_bioseq_test("name.component" test_name_component.cpp)
add_bioseq_test("description.component" test_description_component.cpp)
add_bioseq_test("io.fasta" test_io_fasta.cpp)
......@@ -23,14 +23,7 @@
namespace bsq = boost::bioseq;
namespace bc = boost::compute;
template<class CharT, class Allocator> using bs_string
= bc::basic_string<CharT, std::char_traits<CharT>>;
typedef bsq::sequence_host<char, std::allocator, bs_string> str_seq;
typedef bsq::sequence_host<char, std::allocator, bc::vector> vec_seq;
// typedef boost::mpl::list<vec_seq> seq_types;
typedef boost::mpl::list<vec_seq, str_seq> seq_types;
typedef bsq::sequence_host<char, bc::buffer_allocator, bc::vector> seq;
struct Context
{
......@@ -47,31 +40,33 @@ struct Context
BOOST_FIXTURE_TEST_SUITE(compute_test, Context)
BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_char_pointer_n, T, seq_types)
BOOST_AUTO_TEST_CASE(constructor_char_pointer_n)
{
T seq("ATCGN", 4);
std::cout << "device: " << device.name() << std::endl;
seq s("ATCGN", 4);
auto b = seq.cbegin();
auto b = s.cbegin();
BOOST_CHECK_EQUAL( *b , 'A');
BOOST_CHECK_EQUAL(*(++b), 'T');
BOOST_CHECK_EQUAL(*(++b), 'C');
BOOST_CHECK_EQUAL(*(++b), 'G');
BOOST_CHECK_EQUAL(seq.size(), 4);
BOOST_CHECK(++b == seq.end());
BOOST_CHECK_EQUAL(s.size(), 4);
BOOST_CHECK(++b == s.end());
}
// BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_char_pointer, T, seq_types)
// {
// T seq("ATCG");
BOOST_AUTO_TEST_CASE(constructor_char_pointer)
{
seq s("ATCG");
// auto b = seq.cbegin();
// BOOST_CHECK_EQUAL( *b , 'A');
// BOOST_CHECK_EQUAL(*(++b), 'T');
// BOOST_CHECK_EQUAL(*(++b), 'C');
// BOOST_CHECK_EQUAL(*(++b), 'G');
// BOOST_CHECK_EQUAL(seq.size(), 4);
// BOOST_CHECK(++b == seq.end());
// }
auto b = s.cbegin();
BOOST_CHECK_EQUAL( *b , 'A');
BOOST_CHECK_EQUAL(*(++b), 'T');
BOOST_CHECK_EQUAL(*(++b), 'C');
BOOST_CHECK_EQUAL(*(++b), 'G');
BOOST_CHECK_EQUAL(s.size(), 4);
BOOST_CHECK(++b == s.end());
}
// BOOST_AUTO_TEST_CASE_TEMPLATE(copy_constructor, T, seq_types)
// {
......@@ -113,3 +108,5 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(constructor_char_pointer_n, T, seq_types)
// BOOST_CHECK_EQUAL(*(++b), 'G');
// BOOST_CHECK_EQUAL(seq.size(), 4);
// }
BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment