The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Namespaces | Macros | Typedefs | Functions
test_lexical_cast.cpp File Reference
#include "lexical_cast.hpp"
#include <boost/test/unit_test.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/copy.hpp>
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/test/test_case_template.hpp>
#include <iostream>
Include dependency graph for test_lexical_cast.cpp:

Go to the source code of this file.

Classes

struct  test_throw::implementation::tlexical_cast< To, From, ToEnable, FromEnable >
 Base class for the conversion. More...
 
struct  test_throw::bad_lexical_cast
 Thrown when a lexical_cast fails. More...
 
struct  test_throw::implementation::tlexical_cast< To, From, ToEnable, FromEnable >
 Base class for the conversion. More...
 
struct  test_throw::implementation::tlexical_cast< std::string, From, void, typename boost::enable_if< boost::is_integral< typename boost::remove_pointer< From >::type > >::type >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< long long, From, void, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< long long, std::string >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< To, From, typename boost::enable_if< boost::is_signed< To > >::type, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< To, std::string, typename boost::enable_if< boost::is_signed< To > >::type >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< unsigned long long, From, void, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< unsigned long long, std::string >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< To, From, typename boost::enable_if< boost::is_unsigned< To > >::type, typename boost::enable_if< boost::mpl::has_key< boost::mpl::set< char *, const char * >, From > >::type >
 Specialized conversion class. More...
 
struct  test_throw::implementation::tlexical_cast< To, std::string, typename boost::enable_if< boost::is_unsigned< To > >::type >
 Specialized conversion class. More...
 

Namespaces

 test_throw
 
 implementation
 Contains the implementation details for lexical_cast and shouldn't be used directly.
 
 test_throw::implementation
 

Macros

#define GETTEXT_DOMAIN   "wesnoth-test"
 
#define LEXICAL_CAST_DEBUG
 
#define TEST_CASE(type_send, initializer)
 

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_throw::test_match_types
 
typedef boost::mpl::vector
< float, double, long double > 
test_throw::test_nomatch_types
 
typedef boost::mpl::copy
< test_nomatch_types,
boost::mpl::back_inserter
< test_match_types > >::type 
test_throw::test_types
 
typedef boost::mpl::vector
< signed char, short, int,
long > 
test_throw::test_lexical_cast_signed_types
 
typedef boost::mpl::vector
< bool, unsigned char,
unsigned short, unsigned int,
unsigned long > 
test_throw::test_lexical_cast_unsigned_types
 

Functions

template<typename To , typename From >
To test_throw::lexical_cast (From value)
 Lexical cast converts one type to another. More...
 
 test_throw::BOOST_AUTO_TEST_CASE_TEMPLATE (test_lexical_cast_throw, T, test_types)
 
 test_throw::BOOST_AUTO_TEST_CASE_TEMPLATE (test_lexical_cast_signed, T, test_lexical_cast_signed_types)
 
 test_throw::BOOST_AUTO_TEST_CASE (test_lexical_cast_long_long)
 
 test_throw::BOOST_AUTO_TEST_CASE_TEMPLATE (test_lexical_cast_unsigned, T, test_lexical_cast_unsigned_types)
 
 test_throw::BOOST_AUTO_TEST_CASE (test_lexical_cast_unsigned_long_long)
 
 BOOST_AUTO_TEST_CASE (test_lexical_cast_result)
 

Macro Definition Documentation

#define GETTEXT_DOMAIN   "wesnoth-test"

Definition at line 15 of file test_lexical_cast.cpp.

#define LEXICAL_CAST_DEBUG

Definition at line 36 of file test_lexical_cast.cpp.

#define TEST_CASE (   type_send,
  initializer 
)
Value:
{ \
type_send val = initializer value; \
\
BOOST_CHECK_EXCEPTION( \
lexical_cast<std::string>(val), const char*, validate); \
}
GLuint const GLfloat * val
Definition: glew.h:2614
GLsizei const GLfloat * value
Definition: glew.h:1817
static void validate(boost::any &v, const std::vector< std::string > &values, two_strings *, int)

Definition at line 85 of file test_lexical_cast.cpp.

Function Documentation

BOOST_AUTO_TEST_CASE ( test_lexical_cast_result  )

Definition at line 201 of file test_lexical_cast.cpp.