1/*
2 Copyright (c) Marshall Clow 2014.
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 For more information, see http://www.boost.org
8*/
9
10#include <iostream>
11
12#include <boost/config.hpp>
13#include <boost/algorithm/algorithm.hpp>
14
15#define BOOST_TEST_MAIN
16#include <boost/test/unit_test.hpp>
17
18namespace ba = boost::algorithm;
19
20BOOST_AUTO_TEST_CASE( test_main )
21{
22 BOOST_CHECK ( ba::power(0, 0) == 1);
23 BOOST_CHECK ( ba::power(5, 0) == 1);
24 BOOST_CHECK ( ba::power(1, 1) == 1);
25 BOOST_CHECK ( ba::power(1, 4) == 1);
26 BOOST_CHECK ( ba::power(3, 2) == 9);
27 BOOST_CHECK ( ba::power(2, 3) == 8);
28 BOOST_CHECK ( ba::power(3, 3) == 27);
29 BOOST_CHECK ( ba::power(2, 30) == 0x40000000);
30 BOOST_CHECK ( ba::power(5L, 10) == 3125*3125);
31 BOOST_CHECK ( ba::power(18, 3) == 18*18*18);
32
33 BOOST_CHECK ( ba::power(3,2) == ba::power(3,2, std::multiplies<int>()));
34 BOOST_CHECK ( ba::power(3,2, std::plus<int>()) == 6);
35}
36