mirror of
https://github.com/boostorg/hana.git
synced 2026-02-14 12:52:10 +00:00
Refactor the unit tests and examples
In particular, merge some unit tests and examples to reduce compilation times.
This commit is contained in:
60
test/ext/std/integer_sequence/comparable.cpp
Normal file
60
test/ext/std/integer_sequence/comparable.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
@copyright Louis Dionne 2014
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#include <boost/hana/ext/std/integer_sequence.hpp>
|
||||
|
||||
#include <boost/hana/comparable/detail/laws.hpp>
|
||||
#include <boost/hana/detail/assert.hpp>
|
||||
#include <boost/hana/list/instance.hpp>
|
||||
|
||||
#include <utility>
|
||||
using namespace boost::hana;
|
||||
|
||||
|
||||
template <typename T, typename U>
|
||||
void test() {
|
||||
// equal
|
||||
{
|
||||
BOOST_HANA_CONSTANT_ASSERT(equal(std::integer_sequence<T>{}, std::integer_sequence<U>{}));
|
||||
BOOST_HANA_CONSTANT_ASSERT(!equal(std::integer_sequence<T, 0>{}, std::integer_sequence<U>{}));
|
||||
BOOST_HANA_CONSTANT_ASSERT(!equal(std::integer_sequence<T>{}, std::integer_sequence<U, 0>{}));
|
||||
|
||||
BOOST_HANA_CONSTANT_ASSERT(equal(std::integer_sequence<T, 0>{}, std::integer_sequence<U, 0>{}));
|
||||
BOOST_HANA_CONSTANT_ASSERT(!equal(std::integer_sequence<T, 0>{}, std::integer_sequence<U, 0, 1>{}));
|
||||
BOOST_HANA_CONSTANT_ASSERT(!equal(std::integer_sequence<T, 0, 2>{}, std::integer_sequence<U, 0, 1>{}));
|
||||
|
||||
BOOST_HANA_CONSTANT_ASSERT(equal(std::integer_sequence<T, 0, 1, 2, 3>{}, std::integer_sequence<U, 0, 1, 2, 3>{}));
|
||||
BOOST_HANA_CONSTANT_ASSERT(!equal(std::integer_sequence<T, 0, 1, 2, 3, 5>{}, std::integer_sequence<U, 0, 1, 2, 3>{}));
|
||||
}
|
||||
|
||||
// laws
|
||||
{
|
||||
BOOST_HANA_CONSTANT_ASSERT(
|
||||
Comparable::laws::check(
|
||||
list(
|
||||
std::integer_sequence<T>{},
|
||||
std::integer_sequence<U>{},
|
||||
|
||||
std::integer_sequence<T, 0>{},
|
||||
std::integer_sequence<U, 0>{},
|
||||
|
||||
std::integer_sequence<T, 0, 1>{},
|
||||
std::integer_sequence<U, 0, 1>{},
|
||||
|
||||
std::integer_sequence<T, 1, 0, 2>{},
|
||||
std::integer_sequence<U, 1, 0, 2>{}
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
test<int, char>();
|
||||
test<int, int>();
|
||||
test<int, long>();
|
||||
test<int, unsigned long>();
|
||||
}
|
||||
Reference in New Issue
Block a user