From 99b6357a39bc85252e4fd5f9bbe36b1b16925226 Mon Sep 17 00:00:00 2001 From: marehr Date: Thu, 7 Dec 2017 23:49:30 +0100 Subject: [PATCH] [FIX] Add container/concept.hpp test cases --- include/seqan3/range/container/concept.hpp | 23 ----- test/range/container/CMakeLists.txt | 1 + .../container/container_concept_test.cpp | 92 +++++++++++++++++++ 3 files changed, 93 insertions(+), 23 deletions(-) create mode 100644 test/range/container/container_concept_test.cpp diff --git a/include/seqan3/range/container/concept.hpp b/include/seqan3/range/container/concept.hpp index f11afec58e..ef2566b0ef 100644 --- a/include/seqan3/range/container/concept.hpp +++ b/include/seqan3/range/container/concept.hpp @@ -202,26 +202,3 @@ concept bool reservable_sequence_concept = requires (type val) //!\} } // namespace seqan3 - -#ifndef NDEBUG -/* Check the STL containers */ - -#include -#include -#include -#include -#include -#include - -static_assert(seqan3::container_concept>); -static_assert(seqan3::sequence_concept>); -static_assert(seqan3::random_access_sequence_concept>); -static_assert(seqan3::random_access_sequence_concept>); -static_assert(seqan3::random_access_sequence_concept); - -/* Check the SDSL containers */ -//TODO - -/* Check our containers */ -//TODO -#endif diff --git a/test/range/container/CMakeLists.txt b/test/range/container/CMakeLists.txt index 75a789569d..ba655277d7 100644 --- a/test/range/container/CMakeLists.txt +++ b/test/range/container/CMakeLists.txt @@ -1 +1,2 @@ +seqan3_test(container_concept_test.cpp) seqan3_test(container_of_container_test.cpp) diff --git a/test/range/container/container_concept_test.cpp b/test/range/container/container_concept_test.cpp new file mode 100644 index 0000000000..7469c693b0 --- /dev/null +++ b/test/range/container/container_concept_test.cpp @@ -0,0 +1,92 @@ +// ========================================================================== +// SeqAn - The Library for Sequence Analysis +// ========================================================================== +// +// Copyright (c) 2006-2017, Knut Reinert, FU Berlin +// Copyright (c) 2016-2017, Knut Reinert & MPI Molekulare Genetik +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of Knut Reinert or the FU Berlin nor the names of +// its contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. +// +// ========================================================================== + +#include + +#include +#include +#include +#include +#include +#include + +#include + +using namespace seqan3; + +TEST(container_concept, container_concept) +{ + EXPECT_TRUE((seqan3::container_concept>)); + EXPECT_TRUE((seqan3::container_concept>)); + EXPECT_FALSE((seqan3::container_concept>)); // `.size()` missing + EXPECT_TRUE((seqan3::container_concept>)); + EXPECT_TRUE((seqan3::container_concept>)); + EXPECT_TRUE((seqan3::container_concept)); +} + +TEST(container_concept, sequence_concept) +{ + EXPECT_FALSE((seqan3::sequence_concept>)); + EXPECT_TRUE((seqan3::sequence_concept>)); + EXPECT_FALSE((seqan3::sequence_concept>)); + EXPECT_TRUE((seqan3::sequence_concept>)); + EXPECT_TRUE((seqan3::sequence_concept>)); + EXPECT_TRUE((seqan3::sequence_concept)); +} + +TEST(container_concept, random_access_sequence_concept) +{ + EXPECT_FALSE((seqan3::random_access_sequence_concept>)); + EXPECT_FALSE((seqan3::random_access_sequence_concept>)); + EXPECT_FALSE((seqan3::random_access_sequence_concept>)); + EXPECT_TRUE((seqan3::random_access_sequence_concept>)); + EXPECT_TRUE((seqan3::random_access_sequence_concept>)); + EXPECT_TRUE((seqan3::random_access_sequence_concept)); +} + +TEST(container_concept, reservable_sequence_concept) +{ + EXPECT_FALSE((seqan3::reservable_sequence_concept>)); + EXPECT_FALSE((seqan3::reservable_sequence_concept>)); + EXPECT_FALSE((seqan3::reservable_sequence_concept>)); + EXPECT_TRUE((seqan3::reservable_sequence_concept>)); + EXPECT_FALSE((seqan3::reservable_sequence_concept>)); + EXPECT_TRUE((seqan3::reservable_sequence_concept)); +} + +/* Check the SDSL containers */ +//TODO + +/* Check our containers */ +//TODO