minmax_macro v0.1

[SVN r3105]
This commit is contained in:
Eric Niebler
2006-07-24 20:31:01 +00:00
parent b683dba9be
commit e82315742a
9 changed files with 801 additions and 0 deletions

37
minmax_macro/test/eval_once.cpp Executable file
View File

@ -0,0 +1,37 @@
///////////////////////////////////////////////////////////////////////////////
// eval_once.hpp test file
//
// Copyright 2006 Eric Niebler.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/minmax_macro.hpp>
void test_eval_once()
{
int i = 0;
int j = 1;
int k = BOOST_MIN(i++,j);
BOOST_CHECK_EQUAL(1, i);
BOOST_CHECK_EQUAL(0, k);
k = BOOST_MAX(i,++j);
BOOST_CHECK_EQUAL(2, j);
BOOST_CHECK_EQUAL(2, k);
}
///////////////////////////////////////////////////////////////////////////////
// init_unit_test_suite
//
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
{
boost::unit_test::test_suite *test = BOOST_TEST_SUITE("eval_once min/max test");
test->add(BOOST_TEST_CASE(&test_eval_once));
return test;
}