The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Classes | Typedefs | Functions
test_throw Namespace Reference

Namespaces

 implementation
 

Classes

struct  bad_lexical_cast
 Thrown when a lexical_cast fails. More...
 

Typedefs

typedef boost::mpl::vector
< bool, char, signed char,
unsigned char, short, int,
long, long long, unsigned
short, unsigned int, unsigned
long, unsigned long long > 
test_match_types
 
typedef boost::mpl::vector
< float, double, long double > 
test_nomatch_types
 
typedef boost::mpl::copy
< test_nomatch_types,
boost::mpl::back_inserter
< test_match_types > >::type 
test_types
 
typedef boost::mpl::vector
< signed char, short, int,
long > 
test_lexical_cast_signed_types
 
typedef boost::mpl::vector
< bool, unsigned char,
unsigned short, unsigned int,
unsigned long > 
test_lexical_cast_unsigned_types
 
typedef boost::mpl::vector
< float, double, long double > 
test_lexical_cast_floating_point_types
 

Functions

template<typename To , typename From >
To lexical_cast (From value)
 Lexical cast converts one type to another. More...
 
template<typename To , typename From >
To lexical_cast_default (From value, To fallback=To())
 Lexical cast converts one type to another with a fallback. More...
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (test_lexical_cast_throw, T, test_types)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (test_lexical_cast_signed, T, test_lexical_cast_signed_types)
 
 BOOST_AUTO_TEST_CASE (test_lexical_cast_long_long)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (test_lexical_cast_unsigned, T, test_lexical_cast_unsigned_types)
 
 BOOST_AUTO_TEST_CASE (test_lexical_cast_unsigned_long_long)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE (test_lexical_cast_floating_point, T, test_lexical_cast_floating_point_types)
 

Typedef Documentation

typedef boost::mpl::vector< float , double , long double> test_throw::test_lexical_cast_floating_point_types

Definition at line 202 of file test_lexical_cast.cpp.

typedef boost::mpl::vector< signed char , short , int , long> test_throw::test_lexical_cast_signed_types

Definition at line 123 of file test_lexical_cast.cpp.

typedef boost::mpl::vector< bool , unsigned char , unsigned short , unsigned int , unsigned long> test_throw::test_lexical_cast_unsigned_types

Definition at line 163 of file test_lexical_cast.cpp.

typedef boost::mpl::vector< bool, char, signed char, unsigned char, short, int, long, long long, unsigned short, unsigned int, unsigned long, unsigned long long > test_throw::test_match_types

Definition at line 56 of file test_lexical_cast.cpp.

typedef boost::mpl::vector< float, double, long double > test_throw::test_nomatch_types

Definition at line 60 of file test_lexical_cast.cpp.

typedef boost::mpl::copy< test_nomatch_types, boost::mpl::back_inserter<test_match_types> >::type test_throw::test_types

Definition at line 65 of file test_lexical_cast.cpp.

Function Documentation

test_throw::BOOST_AUTO_TEST_CASE ( test_lexical_cast_long_long  )

Definition at line 142 of file test_lexical_cast.cpp.

References validate().

test_throw::BOOST_AUTO_TEST_CASE ( test_lexical_cast_unsigned_long_long  )

Definition at line 183 of file test_lexical_cast.cpp.

test_throw::BOOST_AUTO_TEST_CASE_TEMPLATE ( test_lexical_cast_throw  ,
,
test_types   
)

Definition at line 93 of file test_lexical_cast.cpp.

test_throw::BOOST_AUTO_TEST_CASE_TEMPLATE ( test_lexical_cast_signed  ,
,
test_lexical_cast_signed_types   
)

Definition at line 125 of file test_lexical_cast.cpp.

References validate().

test_throw::BOOST_AUTO_TEST_CASE_TEMPLATE ( test_lexical_cast_unsigned  ,
,
test_lexical_cast_unsigned_types   
)

Definition at line 165 of file test_lexical_cast.cpp.

References validate().

test_throw::BOOST_AUTO_TEST_CASE_TEMPLATE ( test_lexical_cast_floating_point  ,
,
test_lexical_cast_floating_point_types   
)

Definition at line 204 of file test_lexical_cast.cpp.

template<typename To , typename From >
To test_throw::lexical_cast ( From  value)
inline

Lexical cast converts one type to another.

Template Parameters
ToThe type to convert to.
FromThe type to convert from.
Parameters
valueThe value to convert.
Returns
The converted value.
Exceptions
bad_lexical_castif the cast was unsuccessful.

Definition at line 95 of file test_lexical_cast.cpp.

template<typename To , typename From >
To test_throw::lexical_cast_default ( From  value,
To  fallback = To() 
)
inline

Lexical cast converts one type to another with a fallback.

Template Parameters
ToThe type to convert to.
FromThe type to convert from.
Parameters
valueThe value to convert.
fallbackThe fallback value to return if the cast fails.
Returns
The converted value.

Definition at line 112 of file test_lexical_cast.cpp.