/* Copyright (C) 2013 Tom Bachmann This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See . */ #include "flintxx/test/helpers.h" #include "flintxx/mp.h" using namespace flint; using namespace mp; void test_equal_types() { tassert((equal_types::val)); tassert((!equal_types::val)); } void test_logic() { tassert(not_::val == false); tassert(not_::val == true); tassert((and_::val == true)); tassert((and_::val == false)); tassert((and_::val == false)); tassert((and_v::val == true)); tassert((and_v::val == false)); tassert((and_v::val == false)); tassert((or_::val == true)); tassert((or_::val == true)); tassert((or_::val == false)); tassert((and_::val == true)); tassert((and_::val == false)); tassert((and_::val == false)); tassert((and_::val == false)); } template typename enable_if, int>::type test_enable_if_1(T) { return 0; } template typename disable_if, int>::type test_enable_if_1(T) { return 1; } template int test_enable_if_2(T, typename enable_if >::type* = 0) { return 0; } template int test_enable_if_2(T, typename disable_if >::type* = 0) { return 1; } void test_enable_if() { tassert(test_enable_if_1(int(1)) == 0); tassert(test_enable_if_1(unsigned(1)) == 1); tassert(test_enable_if_2(int(1)) == 0); tassert(test_enable_if_2(unsigned(1)) == 1); } void test_if() { tassert((equal_types::type, int>::val)); tassert((equal_types::type, slong>::val)); typedef mp::select s1; tassert((equal_types::val)); typedef mp::select s2; tassert((equal_types::val)); typedef mp::select s3; tassert((equal_types::val)); typedef mp::select s4; tassert((equal_types::val)); typedef mp::select s5; tassert((equal_types::val)); typedef mp::select s6; tassert((equal_types::val)); typedef mp::select s7; tassert((equal_types::val)); } int main() { std::cout << "mp...."; test_equal_types(); test_logic(); test_enable_if(); test_if(); std::cout << "PASS" << std::endl; return 0; }