2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-02 21:02:15 +00:00
Files
hana/test/comparable/record_mcd.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

56 lines
1.3 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/record/mcd.hpp>
#include <boost/hana/detail/assert.hpp>
#include <boost/hana/detail/constexpr.hpp>
#include <test/laws/comparable.hpp>
#include <test/injection.hpp>
#include <test/minimal_record.hpp>
using namespace boost::hana;
template <typename Mcd>
void tests() {
using test::x;
BOOST_HANA_CONSTEXPR_LAMBDA auto record = test::minimal_record<Mcd>;
// equal
{
BOOST_HANA_CONSTANT_ASSERT(equal(
record(x<0>, x<1>), record(x<0>, x<1>)
));
BOOST_HANA_CONSTANT_ASSERT(not_(equal(
record(x<1>, x<0>), record(x<0>, x<1>)
)));
BOOST_HANA_CONSTANT_ASSERT(not_(equal(
record(x<0>, x<99>), record(x<0>, x<1>)
)));
BOOST_HANA_CONSTANT_ASSERT(not_(equal(
record(x<99>, x<1>), record(x<0>, x<1>)
)));
}
// laws
{
BOOST_HANA_CONSTANT_ASSERT(Comparable_laws(
record(x<0>, x<1>),
record(x<1>, x<0>),
record(x<0>, x<2>),
record(x<2>, x<3>)
));
}
}
int main() {
tests<Record::mcd>();
}