2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-09 23:22:12 +00:00
Files
hana/test/integer_list/list.cpp
Louis Dionne 1d986e4c04 Refactor the unit tests and examples
In particular, merge some unit tests and examples to reduce compilation
times.
2014-08-10 15:42:03 -04:00

39 lines
1.2 KiB
C++

/*
@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/integer_list.hpp>
#include <boost/hana/detail/assert.hpp>
#include <boost/hana/integral.hpp>
using namespace boost::hana;
template <typename T, typename U>
void test() {
// cons
{
BOOST_HANA_CONSTANT_ASSERT(cons(integral<T, 0>, integer_list<U>) == integer_list<U, 0>);
BOOST_HANA_CONSTANT_ASSERT(cons(integral<T, 0>, integer_list<U, 1>) == integer_list<U, 0, 1>);
BOOST_HANA_CONSTANT_ASSERT(cons(integral<T, 0>, integer_list<U, 1, 2>) == integer_list<U, 0, 1, 2>);
BOOST_HANA_CONSTANT_ASSERT(cons(integral<T, 0>, integer_list<U, 1, 2, 3>) == integer_list<U, 0, 1, 2, 3>);
}
// nil
{
BOOST_HANA_CONSTANT_ASSERT(nil<IntegerList> == integer_list<int>);
BOOST_HANA_CONSTANT_ASSERT(nil<IntegerList> == integer_list<void>);
BOOST_HANA_CONSTANT_ASSERT(nil<IntegerList> == integer_list<char>);
}
}
int main() {
test<int, int>();
test<int, unsigned int>();
test<int, long>();
test<int, unsigned long>();
}