mirror of
https://github.com/boostorg/proto.git
synced 2026-07-21 13:33:35 +00:00
Use BOOST_AUTO_TEST_CASE in tests so that link=shared works
This commit is contained in:
+2
-2
@@ -18,8 +18,8 @@ project
|
||||
<toolset>msvc-11.0:<define>_SCL_SECURE_NO_WARNINGS
|
||||
<toolset>gcc:<cxxflags>-ftemplate-depth-1024
|
||||
<library>/boost/test//boost_unit_test_framework
|
||||
<link>static
|
||||
# <define>BOOST_PROTO_DONT_USE_PREPROCESSED_FILES
|
||||
#<link>static
|
||||
#<define>BOOST_PROTO_DONT_USE_PREPROCESSED_FILES
|
||||
;
|
||||
|
||||
run calculator.cpp ;
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/context.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@@ -86,7 +88,7 @@ functional<Fun, Expr> as(Expr const &expr)
|
||||
return functional<Fun, Expr>(expr);
|
||||
}
|
||||
|
||||
void test_calculator()
|
||||
BOOST_AUTO_TEST_CASE(test_calculator)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(10, proto::eval(((_1 + 42)-3)/4, calculator(1)));
|
||||
BOOST_CHECK_EQUAL(11, proto::eval(((_1 + 42)-3)/4, calculator(5)));
|
||||
@@ -94,16 +96,3 @@ void test_calculator()
|
||||
BOOST_CHECK_EQUAL(10, as<calculator>(((_1 + 42)-3)/4)(1));
|
||||
BOOST_CHECK_EQUAL(11, as<calculator>(((_1 + 42)-3)/4)(5));
|
||||
}
|
||||
|
||||
using namespace unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test immediate evaluation of proto parse trees");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_calculator));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
// 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)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/proto.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@@ -100,7 +102,7 @@ struct rhs_extension
|
||||
)
|
||||
};
|
||||
|
||||
void test_constrained_ops()
|
||||
BOOST_AUTO_TEST_CASE(test_constrained_ops)
|
||||
{
|
||||
lhs_extension<term> const i = {};
|
||||
rhs_extension<term> const j = {};
|
||||
@@ -118,14 +120,3 @@ void test_constrained_ops()
|
||||
proto::assert_matches<equation>(i + i == j); // true
|
||||
proto::assert_matches<equation>(i + i == j + j); // true
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test constrained EDSLs");
|
||||
test->add(BOOST_TEST_CASE(&test_constrained_ops));
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <vector>
|
||||
#include <boost/proto/proto.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@@ -59,22 +61,9 @@ static const int celems = 4;
|
||||
static int const value[celems] = {1,2,3,4};
|
||||
std::vector<int> A(value, value+celems), B(A);
|
||||
|
||||
void test1()
|
||||
BOOST_AUTO_TEST_CASE(test1)
|
||||
{
|
||||
using namespace linear_algebra;
|
||||
proto::_default<> eval;
|
||||
BOOST_CHECK_EQUAL(8, eval(Optimize()((A + B)[3])));
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test for a problem reported on the cpp-next.com blog");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test1));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
// Avoid a compile-time check inside the deduce_domain code.
|
||||
#define BOOST_PROTO_ASSERT_VALID_DOMAIN(DOM) typedef DOM DOM ## _
|
||||
|
||||
@@ -52,7 +54,7 @@ struct DD4 : proto::domain<proto::default_generator, _, DD2>
|
||||
{
|
||||
};
|
||||
|
||||
void test1()
|
||||
BOOST_AUTO_TEST_CASE(test1)
|
||||
{
|
||||
using boost::is_same;
|
||||
|
||||
@@ -127,16 +129,3 @@ void test1()
|
||||
BOOST_MPL_ASSERT((is_same<proto::detail::common_domain3<DD4, DD4, DD3>::type, DD2>));
|
||||
//*/
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test deducing domains from sub-domains");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test1));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/proto/core.hpp>
|
||||
@@ -14,7 +16,7 @@ using namespace boost;
|
||||
|
||||
void foo() {}
|
||||
|
||||
void test1()
|
||||
BOOST_AUTO_TEST_CASE(test1)
|
||||
{
|
||||
using namespace proto;
|
||||
|
||||
@@ -41,16 +43,3 @@ void test1()
|
||||
BOOST_CHECK_EQUAL(42, value(right(r5)));
|
||||
BOOST_CHECK_EQUAL(boost::addressof(std::cout), boost::addressof(value(left(r5))));
|
||||
}
|
||||
|
||||
using namespace unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test deep_copy of proto parse trees");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test1));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-12
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <sstream>
|
||||
#include <boost/proto/proto.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@@ -19,7 +21,7 @@ std::ostream& operator<<( std::ostream& out, const A& ) { return out << "this is
|
||||
|
||||
struct C {};
|
||||
|
||||
void test_display_expr()
|
||||
BOOST_AUTO_TEST_CASE(test_display_expr)
|
||||
{
|
||||
// https://svn.boost.org/trac/boost/ticket/4910
|
||||
proto::terminal<int>::type i = {0};
|
||||
@@ -55,14 +57,3 @@ void test_display_expr()
|
||||
")\n"));
|
||||
}
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test display_expr() function");
|
||||
test->add(BOOST_TEST_CASE(&test_display_expr));
|
||||
return test;
|
||||
}
|
||||
|
||||
+12
-20
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <boost/config.hpp>
|
||||
@@ -40,7 +42,7 @@ void assert_has_env_var_not(Env const &)
|
||||
BOOST_MPL_ASSERT_NOT((proto::result_of::has_env_var<Env, Tag>));
|
||||
}
|
||||
|
||||
void test_is_env()
|
||||
BOOST_AUTO_TEST_CASE(test_is_env)
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((proto::is_env<int>));
|
||||
BOOST_MPL_ASSERT_NOT((proto::is_env<int &>));
|
||||
@@ -91,7 +93,12 @@ void test_as_env()
|
||||
BOOST_CHECK_EQUAL(&e8[proto::data], &test_as_env);
|
||||
}
|
||||
|
||||
void test_comma()
|
||||
BOOST_AUTO_TEST_CASE(test_as_env_)
|
||||
{
|
||||
test_as_env();
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_comma)
|
||||
{
|
||||
proto::env<proto::data_type, int> e0 = (proto::data = 1);
|
||||
BOOST_CHECK_EQUAL(e0[proto::data], 1);
|
||||
@@ -186,7 +193,7 @@ void test_comma()
|
||||
BOOST_CHECK_EQUAL(0, std::strcmp(e16[proto::data], "hello"));
|
||||
}
|
||||
|
||||
void test_result_of_env_var()
|
||||
BOOST_AUTO_TEST_CASE(test_result_of_env_var)
|
||||
{
|
||||
typedef proto::empty_env env0_type;
|
||||
BOOST_MPL_ASSERT((boost::is_same<proto::result_of::env_var<env0_type, proto::data_type>::type, proto::key_not_found>));
|
||||
@@ -217,7 +224,7 @@ void test_result_of_env_var()
|
||||
BOOST_MPL_ASSERT((boost::is_same<proto::result_of::env_var<env4_type const &, tag0_type>::type, double>));
|
||||
}
|
||||
|
||||
void test_env_var()
|
||||
BOOST_AUTO_TEST_CASE(test_env_var)
|
||||
{
|
||||
proto::key_not_found x0 = proto::env_var<proto::data_type>(proto::empty_env());
|
||||
proto::key_not_found x1 = proto::env_var<proto::data_type>(tag0 = 42);
|
||||
@@ -245,7 +252,7 @@ void test_env_var()
|
||||
BOOST_CHECK_EQUAL(&x9, &a);
|
||||
}
|
||||
|
||||
void test_env_var_tfx()
|
||||
BOOST_AUTO_TEST_CASE(test_env_var_tfx)
|
||||
{
|
||||
typedef proto::terminal<int>::type int_;
|
||||
int_ i = {42};
|
||||
@@ -280,18 +287,3 @@ void test_env_var_tfx()
|
||||
proto::env<proto::data_type, int, proto::env<proto::data_type, int> > e3 = proto::_env()(i, 0, (42, proto::data = 43));
|
||||
BOOST_CHECK_EQUAL(e3[proto::data], 43);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test for environment variables");
|
||||
test->add(BOOST_TEST_CASE(&test_as_env));
|
||||
test->add(BOOST_TEST_CASE(&test_comma));
|
||||
test->add(BOOST_TEST_CASE(&test_result_of_env_var));
|
||||
test->add(BOOST_TEST_CASE(&test_env_var));
|
||||
test->add(BOOST_TEST_CASE(&test_env_var_tfx));
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/min_max.hpp>
|
||||
@@ -421,7 +423,7 @@ namespace lambda_transform
|
||||
//]
|
||||
}
|
||||
|
||||
void test_examples()
|
||||
BOOST_AUTO_TEST_CASE(test_examples)
|
||||
{
|
||||
//[ CalculatorArityTest
|
||||
int i = 0; // not used, dummy state and data parameter
|
||||
@@ -483,16 +485,3 @@ void test_examples()
|
||||
|
||||
lambda_transform::test_lambda();
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test examples from the documentation");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_examples));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
// that computes the result of an expression with either checked
|
||||
// or non-checked division.
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
@@ -171,15 +173,7 @@ void test_external_transforms()
|
||||
}
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
BOOST_AUTO_TEST_CASE(test_external_transforms_)
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test for external transforms");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_external_transforms));
|
||||
|
||||
return test;
|
||||
test_external_transforms();
|
||||
}
|
||||
|
||||
+4
-16
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/fusion.hpp>
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
@@ -76,7 +78,7 @@ private:
|
||||
std::ostream &sout_;
|
||||
};
|
||||
|
||||
void test1()
|
||||
BOOST_AUTO_TEST_CASE(test1)
|
||||
{
|
||||
using boost::proto::flatten;
|
||||
|
||||
@@ -144,7 +146,7 @@ struct My
|
||||
BOOST_PROTO_EXTENDS(Expr, My<Expr>, MyDomain)
|
||||
};
|
||||
|
||||
void test2()
|
||||
BOOST_AUTO_TEST_CASE(test2)
|
||||
{
|
||||
using boost::proto::flatten;
|
||||
|
||||
@@ -195,17 +197,3 @@ void test2()
|
||||
boost::fusion::for_each(flatten(a_(b_(c_ >> d_, e_ | f_), g_ >> h_)(i_)), to_string(sout));
|
||||
BOOST_CHECK_EQUAL("(a)(b)(c>>d)(e|f)(g>>h)(i)", sout.str());
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto and segmented fusion integration");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test1));
|
||||
test->add(BOOST_TEST_CASE(&test2));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <sstream>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/min_max.hpp>
|
||||
@@ -152,7 +154,7 @@ lambda<typename proto::terminal<T &>::type> const var(T &t)
|
||||
return that;
|
||||
}
|
||||
|
||||
void test_lambda()
|
||||
BOOST_AUTO_TEST_CASE(test_lambda)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(11, ( (_1 + 2) / 4 )(42));
|
||||
BOOST_CHECK_EQUAL(-11, ( (-(_1 + 2)) / 4 )(42));
|
||||
@@ -173,16 +175,3 @@ void test_lambda()
|
||||
BOOST_CHECK_EQUAL(2, integers[2]);
|
||||
BOOST_CHECK_EQUAL(3, integers[3]);
|
||||
}
|
||||
|
||||
using namespace unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test expression template domains");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_lambda));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+6
-20
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/transform/arg.hpp>
|
||||
#include <boost/proto/transform/make.hpp>
|
||||
@@ -36,7 +38,7 @@ struct MakeTest1
|
||||
: proto::make< type2type< careful<int> > >
|
||||
{};
|
||||
|
||||
void make_test1()
|
||||
BOOST_AUTO_TEST_CASE(make_test1)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
type2type< careful<int> > res = MakeTest1()(i);
|
||||
@@ -48,7 +50,7 @@ struct MakeTest2
|
||||
: proto::make< wrapper< proto::_value > >
|
||||
{};
|
||||
|
||||
void make_test2()
|
||||
BOOST_AUTO_TEST_CASE(make_test2)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
wrapper<int> res = MakeTest2()(i);
|
||||
@@ -61,7 +63,7 @@ struct MakeTest3
|
||||
: proto::make< wrapper< proto::_value >(proto::_value) >
|
||||
{};
|
||||
|
||||
void make_test3()
|
||||
BOOST_AUTO_TEST_CASE(make_test3)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
wrapper<int> res = MakeTest3()(i);
|
||||
@@ -74,25 +76,9 @@ struct MakeTest4
|
||||
: proto::make< mpl::identity< proto::_value >(proto::_value) >
|
||||
{};
|
||||
|
||||
void make_test4()
|
||||
BOOST_AUTO_TEST_CASE(make_test4)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
int res = MakeTest4()(i);
|
||||
BOOST_CHECK_EQUAL(res, 42);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test the make transform");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&make_test1));
|
||||
test->add(BOOST_TEST_CASE(&make_test2));
|
||||
test->add(BOOST_TEST_CASE(&make_test3));
|
||||
test->add(BOOST_TEST_CASE(&make_test4));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+10
-28
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <sstream>
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/transform.hpp>
|
||||
@@ -29,7 +31,7 @@ template<typename E> struct ewrap
|
||||
{}
|
||||
};
|
||||
|
||||
void test_make_expr()
|
||||
BOOST_AUTO_TEST_CASE(test_make_expr)
|
||||
{
|
||||
int i = 42;
|
||||
proto::terminal<int>::type t1 = proto::make_expr<proto::tag::terminal>(1);
|
||||
@@ -66,7 +68,7 @@ void test_make_expr()
|
||||
BOOST_CHECK_EQUAL(proto::value(proto::child(proto::left(p4))), 42);
|
||||
}
|
||||
|
||||
void test_make_expr_ref()
|
||||
BOOST_AUTO_TEST_CASE(test_make_expr_ref)
|
||||
{
|
||||
int i = 42;
|
||||
int const ci = 84;
|
||||
@@ -105,7 +107,7 @@ void test_make_expr_ref()
|
||||
BOOST_CHECK_EQUAL(proto::value(proto::child(proto::left(p4))), 42);
|
||||
}
|
||||
|
||||
void test_make_expr_functional()
|
||||
BOOST_AUTO_TEST_CASE(test_make_expr_functional)
|
||||
{
|
||||
int i = 42;
|
||||
proto::terminal<int>::type t1 = proto::functional::make_expr<proto::tag::terminal>()(1);
|
||||
@@ -141,7 +143,7 @@ void test_make_expr_functional()
|
||||
p4_type p4 = proto::functional::make_expr<proto::tag::plus>()(p3, 0);
|
||||
}
|
||||
|
||||
void test_make_expr_functional_ref()
|
||||
BOOST_AUTO_TEST_CASE(test_make_expr_functional_ref)
|
||||
{
|
||||
int i = 42;
|
||||
int const ci = 84;
|
||||
@@ -180,7 +182,7 @@ void test_make_expr_functional_ref()
|
||||
BOOST_CHECK_EQUAL(proto::value(proto::child(proto::left(p4))), 42);
|
||||
}
|
||||
|
||||
void test_unpack_expr()
|
||||
BOOST_AUTO_TEST_CASE(test_unpack_expr)
|
||||
{
|
||||
int i = 42;
|
||||
proto::terminal<int>::type t1 = proto::unpack_expr<proto::tag::terminal>(fusion::make_tuple(1));
|
||||
@@ -217,7 +219,7 @@ void test_unpack_expr()
|
||||
BOOST_CHECK_EQUAL(proto::value(proto::child(proto::left(p4))), 42);
|
||||
}
|
||||
|
||||
void test_unpack_expr_functional()
|
||||
BOOST_AUTO_TEST_CASE(test_unpack_expr_functional)
|
||||
{
|
||||
int i = 42;
|
||||
proto::terminal<int>::type t1 = proto::functional::unpack_expr<proto::tag::terminal>()(fusion::make_tuple(1));
|
||||
@@ -299,7 +301,7 @@ struct Square
|
||||
#undef Minus
|
||||
#endif
|
||||
|
||||
void test_make_expr_transform()
|
||||
BOOST_AUTO_TEST_CASE(test_make_expr_transform)
|
||||
{
|
||||
proto::plus<
|
||||
proto::terminal<int>::type
|
||||
@@ -372,7 +374,7 @@ void test_make_expr_transform2_test(Expr const &expr)
|
||||
BOOST_CHECK_EQUAL(1, proto::value(proto::child_c<1>(proto::child_c<0>(Convert()(expr)))));
|
||||
}
|
||||
|
||||
void test_make_expr_transform2()
|
||||
BOOST_AUTO_TEST_CASE(test_make_expr_transform2)
|
||||
{
|
||||
test_make_expr_transform2_test(length(1) < length(2));
|
||||
}
|
||||
@@ -385,23 +387,3 @@ void test_make_expr_transform2()
|
||||
#undef _make_function
|
||||
#undef dot_impl
|
||||
#endif
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto::make_expr, proto::unpack_expr and friends");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_make_expr));
|
||||
test->add(BOOST_TEST_CASE(&test_make_expr_ref));
|
||||
test->add(BOOST_TEST_CASE(&test_make_expr_functional));
|
||||
test->add(BOOST_TEST_CASE(&test_make_expr_functional_ref));
|
||||
test->add(BOOST_TEST_CASE(&test_unpack_expr));
|
||||
test->add(BOOST_TEST_CASE(&test_unpack_expr_functional));
|
||||
test->add(BOOST_TEST_CASE(&test_make_expr_transform));
|
||||
test->add(BOOST_TEST_CASE(&test_make_expr_transform2));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-15
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/config.hpp>
|
||||
@@ -116,7 +118,7 @@ struct my_expr
|
||||
BOOST_PROTO_BASIC_EXTENDS(Expr, my_expr, my_domain)
|
||||
};
|
||||
|
||||
void test_matches()
|
||||
BOOST_AUTO_TEST_CASE(test_matches)
|
||||
{
|
||||
proto::assert_matches< proto::_ >( proto::lit(1) );
|
||||
proto::assert_matches< proto::_ >( proto::as_child(1) );
|
||||
@@ -303,17 +305,3 @@ void test_matches()
|
||||
proto::assert_matches< proto::if_<boost::is_same<proto::domain_of<proto::_>, my_domain>()> >( e );
|
||||
}
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto::matches<>");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_matches));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
|
||||
+8
-28
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/mpl/print.hpp>
|
||||
#include <iostream>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -76,7 +78,7 @@ struct my_terminal
|
||||
my_terminal<int S::*> test1 = {{ &S::x }};
|
||||
|
||||
// Some tests with the default transform
|
||||
void test_refs_transform()
|
||||
BOOST_AUTO_TEST_CASE(test_refs_transform)
|
||||
{
|
||||
S s;
|
||||
BOOST_REQUIRE_EQUAL(s.x, -42);
|
||||
@@ -103,7 +105,7 @@ void test_refs_transform()
|
||||
}
|
||||
|
||||
// Some tests with the default context
|
||||
void test_refs_context()
|
||||
BOOST_AUTO_TEST_CASE(test_refs_context)
|
||||
{
|
||||
proto::default_context ctx;
|
||||
S s;
|
||||
@@ -130,7 +132,7 @@ void test_refs_context()
|
||||
BOOST_CHECK_EQUAL(&s.x, &s_x);
|
||||
}
|
||||
|
||||
void test_ptrs_transform()
|
||||
BOOST_AUTO_TEST_CASE(test_ptrs_transform)
|
||||
{
|
||||
S s;
|
||||
BOOST_REQUIRE_EQUAL(s.x, -42);
|
||||
@@ -177,7 +179,7 @@ void test_ptrs_transform()
|
||||
BOOST_CHECK_EQUAL(&spc->x, &s_x2);
|
||||
}
|
||||
|
||||
void test_ptrs_context()
|
||||
BOOST_AUTO_TEST_CASE(test_ptrs_context)
|
||||
{
|
||||
proto::default_context ctx;
|
||||
S s;
|
||||
@@ -238,7 +240,7 @@ int const *get_pointer(T const &t)
|
||||
return &t.x;
|
||||
}
|
||||
|
||||
void with_get_pointer_transform()
|
||||
BOOST_AUTO_TEST_CASE(with_get_pointer_transform)
|
||||
{
|
||||
T t;
|
||||
evaluator()(test2(t));
|
||||
@@ -267,7 +269,7 @@ struct U : dumb_ptr<U>
|
||||
my_terminal<U *dumb_ptr<U>::*> U_p = {{&U::p}};
|
||||
my_terminal<int U::*> U_x = {{&U::x}};
|
||||
|
||||
void potentially_ambiguous_transform()
|
||||
BOOST_AUTO_TEST_CASE(potentially_ambiguous_transform)
|
||||
{
|
||||
U u;
|
||||
|
||||
@@ -279,25 +281,3 @@ void potentially_ambiguous_transform()
|
||||
int &ux = evaluator()(U_x(u));
|
||||
BOOST_CHECK_EQUAL(&ux, &u.x);
|
||||
}
|
||||
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test handling of member pointers by the default transform and default contexts");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_refs_transform));
|
||||
test->add(BOOST_TEST_CASE(&test_refs_context));
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_ptrs_transform));
|
||||
test->add(BOOST_TEST_CASE(&test_ptrs_context));
|
||||
|
||||
test->add(BOOST_TEST_CASE(&with_get_pointer_transform));
|
||||
|
||||
test->add(BOOST_TEST_CASE(&potentially_ambiguous_transform));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/proto.hpp>
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#include <boost/mpl/pop_back.hpp>
|
||||
@@ -47,21 +49,8 @@ void test_impl(T const &)
|
||||
}
|
||||
|
||||
// Test that we can call mpl algorithms on proto expression types, and get proto expression types back
|
||||
void test_mpl()
|
||||
BOOST_AUTO_TEST_CASE(test_mpl)
|
||||
{
|
||||
my_expr<proto::terminal<int>::type> i;
|
||||
test_impl(i + i);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto mpl integration via fusion");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_mpl));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/transform/make.hpp>
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
@@ -69,7 +71,7 @@ struct Test3
|
||||
{};
|
||||
|
||||
|
||||
void test_noinvoke()
|
||||
BOOST_AUTO_TEST_CASE(test_noinvoke)
|
||||
{
|
||||
typedef proto::terminal<int>::type Int;
|
||||
Int i = {42};
|
||||
@@ -101,16 +103,3 @@ void test_noinvoke()
|
||||
|
||||
select2nd<void, Int *> t3 = Test3()(i);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto::noinvoke");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_noinvoke));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+4
-16
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/proto.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
@@ -74,7 +76,7 @@ struct eval2
|
||||
>
|
||||
{};
|
||||
|
||||
void test_call_pack()
|
||||
BOOST_AUTO_TEST_CASE(test_call_pack)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
int res = eval1()(i);
|
||||
@@ -101,24 +103,10 @@ struct make_pair
|
||||
>
|
||||
{};
|
||||
|
||||
void test_make_pack()
|
||||
BOOST_AUTO_TEST_CASE(test_make_pack)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
std::pair<int, int> p = make_pair()(i + 43);
|
||||
BOOST_CHECK_EQUAL(p.first, 42);
|
||||
BOOST_CHECK_EQUAL(p.second, 43);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test immediate evaluation of proto parse trees");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_call_pack));
|
||||
test->add(BOOST_TEST_CASE(&test_make_pack));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+4
-16
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/transform/make.hpp>
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
@@ -43,7 +45,7 @@ struct TestWithMake5
|
||||
: proto::make< identity<proto::protect<identity<identity<int> > > > >
|
||||
{};
|
||||
|
||||
void test_protect_with_make()
|
||||
BOOST_AUTO_TEST_CASE(test_protect_with_make)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
|
||||
@@ -79,7 +81,7 @@ struct TestWithWhen5
|
||||
: proto::when<_, identity<proto::protect<identity<identity<int> > > >() >
|
||||
{};
|
||||
|
||||
void test_protect_with_when()
|
||||
BOOST_AUTO_TEST_CASE(test_protect_with_when)
|
||||
{
|
||||
proto::terminal<int>::type i = {42};
|
||||
|
||||
@@ -90,17 +92,3 @@ void test_protect_with_when()
|
||||
identity<int> t4 = TestWithWhen4()(i);
|
||||
identity<identity<int> > t5 = TestWithWhen5()(i);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto::protect");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_protect_with_make));
|
||||
test->add(BOOST_TEST_CASE(&test_protect_with_when));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-15
@@ -7,6 +7,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/proto/core.hpp>
|
||||
#include <boost/proto/transform.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
@@ -63,7 +65,7 @@ struct ArityOf
|
||||
>
|
||||
{};
|
||||
|
||||
void test_switch()
|
||||
BOOST_AUTO_TEST_CASE(test_switch)
|
||||
{
|
||||
// Tests for backward compatibility
|
||||
proto::assert_matches<proto::switch_<MyCases> >(proto::lit(1) >> 'a');
|
||||
@@ -79,17 +81,3 @@ void test_switch()
|
||||
BOOST_CHECK_EQUAL(ar(!proto::lit(1)), false);
|
||||
BOOST_CHECK_EQUAL(ar(proto::lit(1) + 2), true);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite(int argc, char* argv[])
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto::switch_<>");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_switch));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
@@ -609,7 +611,7 @@ namespace boost { namespace spirit2
|
||||
using namespace boost;
|
||||
using namespace spirit2;
|
||||
|
||||
void test_toy_spirit()
|
||||
BOOST_AUTO_TEST_CASE(test_toy_spirit)
|
||||
{
|
||||
std::string str("abcd");
|
||||
|
||||
@@ -650,16 +652,3 @@ void test_toy_spirit()
|
||||
, char_('a') >> 'b' >> 'c' >> 'd', space >> space));
|
||||
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto and and toy spirit-2");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_toy_spirit));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
+3
-14
@@ -5,6 +5,8 @@
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
@@ -399,7 +401,7 @@ namespace boost { namespace spirit2
|
||||
|
||||
}}
|
||||
|
||||
void test_toy_spirit3()
|
||||
BOOST_AUTO_TEST_CASE(test_toy_spirit3)
|
||||
{
|
||||
using boost::spirit2::no_case;
|
||||
using boost::char_;
|
||||
@@ -451,16 +453,3 @@ void test_toy_spirit3()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
using namespace boost::unit_test;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// init_unit_test_suite
|
||||
//
|
||||
test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
test_suite *test = BOOST_TEST_SUITE("test proto, grammars and tree transforms");
|
||||
|
||||
test->add(BOOST_TEST_CASE(&test_toy_spirit3));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user