2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-08 10:52:11 +00:00
Files
hana/test/integer_list/iterable.cpp
Louis Dionne 307d3d0ec8 Huge reorganization and refactoring.
- Split type class instances into separate files
- Instances provided automatically by a type class are actually MCDs
- Test each instance in a single file, not one file per method
- Refactor the operator system to fix the ADL-related bug.
2014-08-18 19:26:29 -04:00

60 lines
1.6 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>
#include <test/laws/iterable.hpp>
using namespace boost::hana;
int main() {
// head
{
BOOST_HANA_CONSTANT_ASSERT(equal(head(integer_list<int, 0>), int_<0>));
BOOST_HANA_CONSTANT_ASSERT(equal(head(integer_list<int, 0, 1>), int_<0>));
BOOST_HANA_CONSTANT_ASSERT(equal(head(integer_list<int, 0, 1, 2>), int_<0>));
}
// is_empty
{
BOOST_HANA_CONSTANT_ASSERT(is_empty(integer_list<int>));
BOOST_HANA_CONSTANT_ASSERT(not_(is_empty(integer_list<int, 0>)));
BOOST_HANA_CONSTANT_ASSERT(not_(is_empty(integer_list<int, 0, 1>)));
BOOST_HANA_CONSTANT_ASSERT(not_(is_empty(integer_list<int, 0, 1, 2>)));
}
// tail
{
BOOST_HANA_CONSTANT_ASSERT(equal(
tail(integer_list<int, 0>),
integer_list<int>
));
BOOST_HANA_CONSTANT_ASSERT(equal(
tail(integer_list<int, 0, 1>),
integer_list<int, 1>
));
BOOST_HANA_CONSTANT_ASSERT(equal(
tail(integer_list<int, 0, 1, 2>),
integer_list<int, 1, 2>
));
}
// laws
{
BOOST_HANA_CONSTANT_ASSERT(Iterable_laws(
integer_list<int>,
integer_list<int, 0>,
integer_list<int, 0, 1>,
integer_list<int, 0, 1, 2>
));
}
}