diff --git a/.travis.yml b/.travis.yml
index 9665a6a..caf8a2d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,32 +3,26 @@ sudo: required
language: cpp
env:
- - CXX_STANDARD=c++98
-# - CXX_STANDARD=c++0x
-# - CXX_STANDARD=c++11
-# - CXX_STANDARD=c++14
+ - CXX_STANDARD=98
+ - CXX_STANDARD=11
+ - CXX_STANDARD=14
+ - CXX_STANDARD=17
compiler:
- gcc
- clang
before_install:
- - CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
- - mkdir cmake
- - travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
- - export PATH=${TRAVIS_BUILD_DIR}/cmake/bin:${PATH}
- - cmake --version
- sudo apt-get -qq update
- - sudo apt-get install libboost-all-dev
- - sudo apt-get install libxerces-c-dev
- - sudo apt-get install libxalan-c-dev
+ - sudo apt-get install cmake libboost-all-dev libxerces-c-dev libxalan-c-dev
+ - cmake --version
- travis_retry wget https://github.com/mat007/turtle/archive/master.zip
- unzip master.zip
- cp -r turtle-master/include/turtle src/libraries
script:
- - mkdir build/cmake
+ - mkdir -p build/cmake
- cd build/cmake
- - cmake ../..
- - make
- - ctest
+ - cmake ../.. -DCMAKE_CXX_STANDARD=${CXX_STANDARD}
+ - cmake --build .
+ - ctest --verbose
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..e5dc8f0
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,43 @@
+skip_branch_with_pr: true
+
+environment:
+ matrix:
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ BOOST: 1_59_0
+ MSVC: 14
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ BOOST: 1_64_0
+ MSVC: 15
+
+platform:
+ - x86
+ - x64
+
+configuration:
+ - Debug
+ - Release
+
+cache: c:\tools\vcpkg\installed\
+
+init:
+ - set BOOST_ROOT=C:\Libraries\boost_%BOOST%
+ - if "%PLATFORM%"=="x86" set BOOST_LIBRARYDIR=%BOOST_ROOT%\lib32-msvc-%MSVC%.0
+ - if "%PLATFORM%"=="x64" set BOOST_LIBRARYDIR=%BOOST_ROOT%\lib64-msvc-%MSVC%.0
+ - if "%PLATFORM%"=="x86" set CMAKE_GENERATOR_NAME=Visual Studio %MSVC%
+ - if "%PLATFORM%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio %MSVC% Win64
+ - if "%CONFIGURATION%"=="Release" set VCPKG_LIBRARYDIR=c:\tools\vcpkg\installed\%PLATFORM%-windows\lib
+ - if "%CONFIGURATION%"=="Debug" set VCPKG_LIBRARYDIR=c:\tools\vcpkg\installed\%PLATFORM%-windows\debug\lib
+ - set VCPKG_INCLUDEDIR=c:\tools\vcpkg\installed\%PLATFORM%-windows\include
+
+install:
+ - appveyor-retry vcpkg install xerces-c:%PLATFORM%-windows xalan-c:%PLATFORM%-windows
+ - appveyor-retry appveyor DownloadFile https://github.com/mat007/turtle/archive/master.zip -FileName turtle-master.zip
+ - 7z x turtle-master.zip
+ - mv turtle-master/include/turtle src/libraries/turtle
+
+build_script:
+ - mkdir %APPVEYOR_BUILD_FOLDER%\build\cmake
+ - cd %APPVEYOR_BUILD_FOLDER%\build\cmake
+ - cmake ../.. -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_INCLUDE_PATH=%VCPKG_INCLUDEDIR% -DCMAKE_LIBRARY_PATH=%VCPKG_LIBRARYDIR% -DBoost_USE_STATIC_LIBS=ON
+ - cmake --build . --config %CONFIGURATION%
+ - ctest -C %CONFIGURATION% --verbose
diff --git a/build/build.properties b/build/build.properties
deleted file mode 100644
index 0d8807b..0000000
--- a/build/build.properties
+++ /dev/null
@@ -1 +0,0 @@
-extensions = doxygen,cpd,cppncss,tests,svn
diff --git a/build/build.xml b/build/build.xml
deleted file mode 100644
index 2dc185b..0000000
--- a/build/build.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/libraries/xeumeuleu/bridges/xerces/data.hpp b/src/libraries/xeumeuleu/bridges/xerces/data.hpp
index 2f068fe..ffa4ab0 100644
--- a/src/libraries/xeumeuleu/bridges/xerces/data.hpp
+++ b/src/libraries/xeumeuleu/bridges/xerces/data.hpp
@@ -40,12 +40,13 @@
#include
#include
#include
-#include
-#include
+#include
#ifdef __GNUC__
#include
#include
#endif
+#include
+#include
namespace xml
{
@@ -74,17 +75,17 @@ class data
//@{
void to( std::string& v ) const { XEUMEULEU_TRY if( node_ ) v = translate( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
void to( bool& v ) const { XEUMEULEU_TRY if( node_ ) v = to_bool( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( short& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< short >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( int& v ) const { XEUMEULEU_TRY if( node_ ) v = to_int( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( long& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( long long& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< long long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( float& v ) const { XEUMEULEU_TRY if( node_ ) v = to_float( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( double& v ) const { XEUMEULEU_TRY if( node_ ) v = to_double( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( long double& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< long double >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( unsigned short& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< unsigned short >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( unsigned int& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< unsigned int >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( unsigned long& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< unsigned long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
- void to( unsigned long long& v ) const { XEUMEULEU_TRY if( node_ ) v = convert< unsigned long long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( short& v ) const { XEUMEULEU_TRY if( node_ ) v = to_signed< short >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( int& v ) const { XEUMEULEU_TRY if( node_ ) v = to_signed< int >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( long& v ) const { XEUMEULEU_TRY if( node_ ) v = to_signed< long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( long long& v ) const { XEUMEULEU_TRY if( node_ ) v = to_signed< long long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( float& v ) const { XEUMEULEU_TRY if( node_ ) v = to_float< float > ( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( double& v ) const { XEUMEULEU_TRY if( node_ ) v = to_float< double >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( long double& v ) const { XEUMEULEU_TRY if( node_ ) v = to_float< long double >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( unsigned short& v ) const { XEUMEULEU_TRY if( node_ ) v = to_unsigned< unsigned short >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( unsigned int& v ) const { XEUMEULEU_TRY if( node_ ) v = to_unsigned< unsigned int >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( unsigned long& v ) const { XEUMEULEU_TRY if( node_ ) v = to_unsigned< unsigned long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
+ void to( unsigned long long& v ) const { XEUMEULEU_TRY if( node_ ) v = to_unsigned< unsigned long long >( get_data() ); XEUMEULEU_CATCH_WITH_CONTEXT }
//@}
private:
@@ -109,51 +110,36 @@ class data
#endif
return name;
}
- template< typename T > T convert( const XMLCh* from ) const
+ template< typename T > T to_signed( const XMLCh* from ) const
{
- const double data = XERCES_CPP_NAMESPACE::XMLDouble( from ).getValue();
- const T result = static_cast< T >( data );
- if( static_cast< double >( result ) != data )
- throw exception( context() + "value of " + location() + " is not a " + name( typeid( T ) ) );
- return result;
+ return convert< T >( trim( translate( from ) ) );
}
- float to_float( const XMLCh* from ) const
+ template< typename T > T to_unsigned( const XMLCh* from ) const
{
- const XERCES_CPP_NAMESPACE::XMLFloat data( from );
- if( data.isDataOverflowed() )
- throw exception( context() + "value of " + location() + " overflowed (probably a double instead of a float)" );
- switch( data.getType() )
- {
- case XERCES_CPP_NAMESPACE::XMLDouble::NegINF :
- return - std::numeric_limits< float >::infinity();
- case XERCES_CPP_NAMESPACE::XMLDouble::PosINF :
- return std::numeric_limits< float >::infinity();
- case XERCES_CPP_NAMESPACE::XMLDouble::NaN :
- return std::numeric_limits< float >::quiet_NaN();
- default:
- return static_cast< float >( data.getValue() );
- }
+ const std::string data = trim( translate( from ) );
+ if( data.empty() || data[0] == '-' )
+ throw exception( context() + "value of " + location() + " is not a " + name( typeid( T ) ) + ": " + data );
+ return convert< T >( data );
}
- double to_double( const XMLCh* from ) const
+ template< typename T > T to_float( const XMLCh* from ) const
{
- const XERCES_CPP_NAMESPACE::XMLDouble data( from );
- if( data.isDataOverflowed() )
- throw exception( context() + "value of " + location() + " overflowed (probably more than a double)" );
- switch( data.getType() )
- {
- case XERCES_CPP_NAMESPACE::XMLDouble::NegINF :
- return - std::numeric_limits< double >::infinity();
- case XERCES_CPP_NAMESPACE::XMLDouble::PosINF :
- return std::numeric_limits< double >::infinity();
- case XERCES_CPP_NAMESPACE::XMLDouble::NaN :
- return std::numeric_limits< double >::quiet_NaN();
- default:
- return data.getValue();
- }
+ const std::string data = trim( translate( from ) );
+ if( data == "INF" )
+ return std::numeric_limits< T >::infinity();
+ if( data == "-INF" )
+ return - std::numeric_limits< T >::infinity();
+ if( data == "NaN" )
+ return - std::numeric_limits< T >::quiet_NaN();
+ return convert< T >( data );
}
- int to_int( const XMLCh* from ) const
+ template< typename T > T convert( const std::string& data ) const
{
- return XERCES_CPP_NAMESPACE::XMLString::parseInt( from );
+ std::stringstream stream( data );
+ T value;
+ stream >> value;
+ if( stream && stream.eof() )
+ return value;
+ throw exception( context() + "value of " + location() + " is not a " + name( typeid( T ) ) + ": " + data );
}
bool to_bool( const XMLCh* from ) const
{
@@ -162,7 +148,7 @@ class data
return true;
if( data == "false" || data == "0" )
return false;
- throw exception( context() + "value of " + location() + " is not a boolean" );
+ throw exception( context() + "value of " + location() + " is not a boolean: " + trim( translate( from ) ) );
}
std::string context() const
diff --git a/src/libraries/xeumeuleu/bridges/xerces/output.hpp b/src/libraries/xeumeuleu/bridges/xerces/output.hpp
index 1d2d896..42bc205 100644
--- a/src/libraries/xeumeuleu/bridges/xerces/output.hpp
+++ b/src/libraries/xeumeuleu/bridges/xerces/output.hpp
@@ -40,9 +40,10 @@
#include
#include
#include
-#include
+#include
#include
#include
+#include
namespace xml
{
@@ -277,7 +278,7 @@ class output : public output_base
# pragma warning( push )
# pragma warning( disable : 4996 )
#endif
- sprintf( buffer, format, max_digits< T >(), value );
+ std::sprintf( buffer, format, max_digits< T >(), value );
#ifdef _MSC_VER
# pragma warning( pop )
#endif
@@ -288,7 +289,7 @@ class output : public output_base
int max_digits() const
{
// actually std::numeric_limits< T >::max_digits10 in C++11
- return 2 + std::numeric_limits< T >::digits10;
+ return 2 + std::numeric_limits< T >::digits10;
}
XERCES_CPP_NAMESPACE::DOMAttr* create_attribute( XERCES_CPP_NAMESPACE::DOMNamedNodeMap& attributes, const std::string& ns, const std::string& name )
diff --git a/src/tests/xeumeuleu_test/CMakeLists.txt b/src/tests/xeumeuleu_test/CMakeLists.txt
index 548287f..82a5582 100644
--- a/src/tests/xeumeuleu_test/CMakeLists.txt
+++ b/src/tests/xeumeuleu_test/CMakeLists.txt
@@ -3,7 +3,12 @@ find_package(XercesC REQUIRED)
include_directories(${xeumeuleu_SOURCE_DIR}/src/libraries
${Boost_INCLUDE_DIRS}
${XercesC_INCLUDE_DIR})
-add_definitions(-DBOOST_TEST_DYN_LINK)
+if( MSVC )
+ link_directories(${Boost_LIBRARY_DIRS})
+else()
+ add_definitions(-DBOOST_TEST_DYN_LINK)
+endif()
+add_definitions(-DBoost_LIB_DIAGNOSTIC_DEFINITIONS)
add_executable(xeumeuleu_test attribute_test.cpp
attributes_test.cpp
call_test.cpp
@@ -41,4 +46,5 @@ target_link_libraries(xeumeuleu_test
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
${Boost_THREAD_LIBRARY}
${XercesC_LIBRARY})
-add_test(NAME xeumeuleu_test COMMAND xeumeuleu_test --result_code=no --report_level=no --log_level=warning --data_directory=../../data/tests/xeumeuleu_test)
\ No newline at end of file
+message( " --- PROJECT_SOURCE_DIR " ${PROJECT_SOURCE_DIR} )
+add_test(NAME xeumeuleu_test COMMAND xeumeuleu_test --log_level=warning WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/data/tests/xeumeuleu_test)
diff --git a/src/tests/xeumeuleu_test/attribute_test.cpp b/src/tests/xeumeuleu_test/attribute_test.cpp
index 14874de..458cac8 100644
--- a/src/tests/xeumeuleu_test/attribute_test.cpp
+++ b/src/tests/xeumeuleu_test/attribute_test.cpp
@@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE( read_invalid_type_attribute_throws_an_exception )
xml::xistringstream xis( "" );
unsigned int value;
xis >> xml::start( "element" );
- BOOST_CHECK_THROW_WHAT( xis >> xml::attribute( "attribute", value ),
+ BOOST_CHECK_THROW_WHAT_SUB( xis >> xml::attribute( "attribute", value ),
xml::exception,
"string_input (line 1, column 26) : value of 'attribute' is not a unsigned int" );
}
diff --git a/src/tests/xeumeuleu_test/content_test.cpp b/src/tests/xeumeuleu_test/content_test.cpp
index 53bf8c8..e1a0c3b 100644
--- a/src/tests/xeumeuleu_test/content_test.cpp
+++ b/src/tests/xeumeuleu_test/content_test.cpp
@@ -143,17 +143,17 @@ BOOST_AUTO_TEST_CASE( streaming_content_round_trips_node_content )
check_round_trip_numeric_limits< short >();
check_round_trip_numeric_limits< int >();
check_round_trip_numeric_limits< long >();
- //check_round_trip_numeric_limits< long long >();
+ check_round_trip_numeric_limits< long long >();
check_round_trip_numeric_limits< float >();
check_round_trip_numeric_limits< double >();
check_round_trip_numeric_limits< long double >();
check_round_trip_numeric_limits< unsigned short >();
check_round_trip_numeric_limits< unsigned int >();
check_round_trip_numeric_limits< unsigned long >();
- //check_round_trip_numeric_limits< unsigned long long >();
+ check_round_trip_numeric_limits< unsigned long long >();
check_read_special_values< float >();
check_read_special_values< double >();
- //check_read_special_values< long double >();
+ check_read_special_values< long double >();
}
namespace
@@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE( data_conversion_failure_provides_error_context )
{
short value;
xml::xistringstream xis( "300000" );
- BOOST_CHECK_THROW_WHAT( xis >> xml::content( "element", value ),
+ BOOST_CHECK_THROW_WHAT_SUB( xis >> xml::content( "element", value ),
xml::exception,
"string_input (line 1, column 10) : value of 'element' is not a short" );
}
diff --git a/src/tests/xeumeuleu_test/encoding_test.cpp b/src/tests/xeumeuleu_test/encoding_test.cpp
index ef5d2c2..6224222 100644
--- a/src/tests/xeumeuleu_test/encoding_test.cpp
+++ b/src/tests/xeumeuleu_test/encoding_test.cpp
@@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE( creating_an_input_stream_with_invalid_encoding_throws )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_an_output_stream_with_invalid_encoding_throws )
{
- BOOST_TODO;
+ BOOST_WARN_MESSAGE( 0, "TODO !" );
//BOOST_CHECK_THROW( xml::xostringstream( xml::encoding( "invalid_encoding" ) ), xml::exception );
}
@@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE( forcing_encoding_upon_write_overrides_prolog_encoding )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( reading_data_in_arabic_preserves_utf_8_characters )
{
- xml::xifstream xis( BOOST_RESOLVE( "arabic.xml" ) );
+ xml::xifstream xis( "arabic.xml" );
std::string name;
xis >> xml::start( "root" );
xis >> xml::attribute( "name", name );
@@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE( reading_data_in_arabic_preserves_utf_8_characters )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( reading_data_in_japanese_preserves_utf_8_characters )
{
- xml::xifstream xis( BOOST_RESOLVE( "japanese.xml" ) );
+ xml::xifstream xis( "japanese.xml" );
std::string name;
xis >> xml::start( "resource" );
xis >> xml::attribute( "name", name );
diff --git a/src/tests/xeumeuleu_test/validation_test.cpp b/src/tests/xeumeuleu_test/validation_test.cpp
index f5ae0f4..5ed9719 100644
--- a/src/tests/xeumeuleu_test/validation_test.cpp
+++ b/src/tests/xeumeuleu_test/validation_test.cpp
@@ -39,7 +39,7 @@
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_xml_not_validated_by_schema_throws_an_exception )
{
- BOOST_CHECK_THROW( xml::xistringstream( "", xml::external_grammar( BOOST_RESOLVE( "schema.xsd" ) ) ), xml::exception );
+ BOOST_CHECK_THROW( xml::xistringstream( "", xml::external_grammar( "schema.xsd" ) ), xml::exception );
}
namespace
@@ -59,7 +59,7 @@ namespace
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_xml_not_validated_by_in_memory_schema_throws_an_exception )
{
- const std::string grammar = load( BOOST_RESOLVE( "schema.xsd" ) );
+ const std::string grammar = load( "schema.xsd" );
BOOST_CHECK_THROW( xml::xistringstream( "", xml::memory_grammar( grammar ) ), xml::exception );
}
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( creating_stream_with_non_existing_schema_throws_a_meaningf
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_invalid_schema_throws_a_meaningful_exception )
{
- BOOST_CHECK_THROW_WHAT_SUB( xml::xistringstream( "", xml::external_grammar( BOOST_RESOLVE( "invalid.xsd" ) ) ),
+ BOOST_CHECK_THROW_WHAT_SUB( xml::xistringstream( "", xml::external_grammar( "invalid.xsd" ) ),
xml::exception,
"invalid content in 'schema' element" );
}
@@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE( creating_stream_with_invalid_schema_throws_a_meaningful_ex
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_xml_validated_by_schema_does_not_throw_an_exception )
{
- BOOST_CHECK_NO_THROW( xml::xistringstream( "", xml::external_grammar( BOOST_RESOLVE( "schema.xsd" ) ) ) );
+ BOOST_CHECK_NO_THROW( xml::xistringstream( "", xml::external_grammar( "schema.xsd" ) ) );
}
// -----------------------------------------------------------------------------
@@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE( creating_stream_with_xml_validated_by_schema_does_not_thro
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_xml_validated_by_internally_referenced_schema_does_not_throw_an_exception )
{
- const std::string schema = BOOST_RESOLVE( "schema.xsd" );
+ const std::string schema = "schema.xsd";
const std::string xml = "";
BOOST_CHECK_NO_THROW( xml::xistringstream xis( xml, xml::internal_grammar() ) );
}
@@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE( creating_stream_with_xml_validated_by_internally_reference
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_xml_not_validated_by_internally_referenced_schema_throws_an_exception )
{
- const std::string schema = BOOST_RESOLVE( "schema.xsd" );
+ const std::string schema = "schema.xsd";
const std::string xml = "";
BOOST_CHECK_THROW( xml::xistringstream xis( xml, xml::internal_grammar() ), xml::exception );
}
@@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE( creating_stream_with_xml_not_validated_by_internally_refer
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( internal_schema_is_used_only_if_specified )
{
- const std::string schema = BOOST_RESOLVE( "schema.xsd" );
+ const std::string schema = "schema.xsd";
const std::string xml = "";
BOOST_CHECK_NO_THROW( xml::xistringstream xis( xml ) );
}
@@ -156,8 +156,8 @@ BOOST_AUTO_TEST_CASE( including_a_non_existing_schema_throws )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( several_memory_grammars_can_be_combined )
{
- const std::string schema_1 = load( BOOST_RESOLVE( "schema_1.xsd" ) );
- const std::string schema_2 = load( BOOST_RESOLVE( "schema_2.xsd" ) );
+ const std::string schema_1 = load( "schema_1.xsd" );
+ const std::string schema_2 = load( "schema_2.xsd" );
xml::grammars composite;
xml::memory_grammar grammar_1( schema_1 );
xml::memory_grammar grammar_2( schema_2 );
@@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE( several_memory_grammars_can_be_combined )
BOOST_AUTO_TEST_CASE( several_external_grammars_can_be_combined )
{
BOOST_CHECK_NO_THROW( xml::xistringstream xis( "",
- xml::external_grammar( BOOST_RESOLVE( "schema_2.xsd" ) ) + xml::external_grammar( BOOST_RESOLVE( "schema_1.xsd" ) ) ) );
+ xml::external_grammar( "schema_2.xsd" ) + xml::external_grammar( "schema_1.xsd" ) ) );
}
// -----------------------------------------------------------------------------
@@ -182,9 +182,9 @@ BOOST_AUTO_TEST_CASE( several_external_grammars_can_be_combined )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( several_memory_and_external_grammars_can_be_combined )
{
- const std::string schema_2 = load( BOOST_RESOLVE( "schema_2.xsd" ) );
+ const std::string schema_2 = load( "schema_2.xsd" );
BOOST_CHECK_NO_THROW( xml::xistringstream xis( "",
- xml::memory_grammar( schema_2 ) + xml::external_grammar( BOOST_RESOLVE( "schema_1.xsd" ) ) ) );
+ xml::memory_grammar( schema_2 ) + xml::external_grammar( "schema_1.xsd" ) ) );
}
// -----------------------------------------------------------------------------
@@ -193,8 +193,8 @@ BOOST_AUTO_TEST_CASE( several_memory_and_external_grammars_can_be_combined )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( several_grammars_can_be_combined_using_operator_plus )
{
- const std::string schema_1 = load( BOOST_RESOLVE( "schema_1.xsd" ) );
- const std::string schema_2 = load( BOOST_RESOLVE( "schema_2.xsd" ) );
+ const std::string schema_1 = load( "schema_1.xsd" );
+ const std::string schema_2 = load( "schema_2.xsd" );
BOOST_CHECK_THROW( xml::xistringstream xis( "", xml::memory_grammar( schema_1 ) ), xml::exception );
BOOST_CHECK_THROW( xml::xistringstream xis( "", xml::memory_grammar( schema_1 ) + xml::memory_grammar( schema_2 ) ), xml::exception );
BOOST_CHECK_NO_THROW( xml::xistringstream xis( "", xml::memory_grammar( schema_2 ) + xml::memory_grammar( schema_1 ) ) );
@@ -229,7 +229,7 @@ BOOST_AUTO_TEST_CASE( several_grammars_with_the_same_target_namespace_can_be_com
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_xml_validated_by_internally_referenced_definition_does_not_throw_an_exception )
{
- const std::string definition = BOOST_RESOLVE( "document_type.dtd" );
+ const std::string definition = "document_type.dtd";
const std::string xml = ""
"";
BOOST_CHECK_NO_THROW( xml::xistringstream xis( xml, xml::internal_grammar() ) );
@@ -241,7 +241,7 @@ BOOST_AUTO_TEST_CASE( creating_stream_with_xml_validated_by_internally_reference
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( creating_stream_with_xml_not_validated_by_internally_referenced_definition_throws_an_exception )
{
- const std::string definition = BOOST_RESOLVE( "document_type.dtd" );
+ const std::string definition = "document_type.dtd";
const std::string xml = ""
"";
BOOST_CHECK_THROW( xml::xistringstream xis( xml, xml::internal_grammar() ), xml::exception );
@@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE( creating_stream_with_xml_not_validated_by_internally_refer
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( internal_definition_is_used_only_if_specified )
{
- const std::string definition = BOOST_RESOLVE( "document_type.dtd" );
+ const std::string definition = "document_type.dtd";
const std::string xml = ""
"";
BOOST_CHECK_NO_THROW( xml::xistringstream xis( xml ) );
diff --git a/src/tests/xeumeuleu_test/xeumeuleu_test_pch.cpp b/src/tests/xeumeuleu_test/xeumeuleu_test_pch.cpp
index 82b347d..b6a28dc 100644
--- a/src/tests/xeumeuleu_test/xeumeuleu_test_pch.cpp
+++ b/src/tests/xeumeuleu_test/xeumeuleu_test_pch.cpp
@@ -30,48 +30,5 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
-#endif
#include "xeumeuleu_test_pch.h"
-#include
-
-namespace
-{
- std::string data_directory;
-
- void set_data_directory( int argc, char* argv[] )
- {
- while( argc-- )
- {
- const std::string argument = argv[argc];
- const std::string::size_type n = argument.find( '=' );
- if( n != std::string::npos && argument.substr( 0, n ) == "--data_directory" )
- data_directory = argument.substr( n+1 );
- }
- }
- const std::string extract_name( const std::string& path )
- {
- const std::size_t separator = path.find_last_of( "/\\" );
- return path.substr( std::max( std::size_t(), separator ) );
- }
- void set_master_suite_name( const std::string& path )
- {
- const std::string name = path.substr( path.find_last_of( "/\\" ) + 1 );
- boost::unit_test::framework::master_test_suite().p_name.set( name );
- }
-}
-
-::boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
-{
- set_master_suite_name( argv[0] );
- set_data_directory( argc, argv );
- return 0;
-}
-
-const std::string BOOST_RESOLVE( const std::string& filename )
-{
- if( data_directory.empty() )
- return filename;
- return data_directory + '/' + filename;
-}
diff --git a/src/tests/xeumeuleu_test/xeumeuleu_test_pch.h b/src/tests/xeumeuleu_test/xeumeuleu_test_pch.h
index 98ea393..99fa4ff 100644
--- a/src/tests/xeumeuleu_test/xeumeuleu_test_pch.h
+++ b/src/tests/xeumeuleu_test/xeumeuleu_test_pch.h
@@ -47,11 +47,6 @@
#include
#include
-#define BOOST_LIB_NAME boost_unit_test_framework
-#include
-
-#define BOOST_TODO BOOST_WARN_MESSAGE( 0, "TODO !" )
-
#include
#undef min
#undef max
@@ -60,8 +55,6 @@
# pragma warning( pop )
#endif
-const std::string BOOST_RESOLVE( const std::string& filename );
-
#define BOOST_CHECK_THROW_WHAT( S, E, M ) \
BOOST_CHECK_EXCEPTION( S, E, \
[&]( const E& e ) { return std::string( e.what() ) == M; } )
diff --git a/src/tests/xeumeuleu_test/xifstream_test.cpp b/src/tests/xeumeuleu_test/xifstream_test.cpp
index d7da5c2..5edd59c 100644
--- a/src/tests/xeumeuleu_test/xifstream_test.cpp
+++ b/src/tests/xeumeuleu_test/xifstream_test.cpp
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE( creating_with_valid_file )
BOOST_AUTO_TEST_CASE( creating_file_with_unicode_name )
{
std::string filename;
- xml::xifstream( BOOST_RESOLVE( "arabic.xml" ) )
+ xml::xifstream( "arabic.xml" )
>> xml::start( "root" )
>> xml::attribute( "name", filename );
filename += ".xml";
diff --git a/src/tests/xeumeuleu_test/xostringstream_test.cpp b/src/tests/xeumeuleu_test/xostringstream_test.cpp
index edaa373..1def3f0 100644
--- a/src/tests/xeumeuleu_test/xostringstream_test.cpp
+++ b/src/tests/xeumeuleu_test/xostringstream_test.cpp
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE( streaming_value_at_root_level_throws_an_exception )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( streaming_text_node_value_mixed_with_sub_node )
{
- BOOST_TODO; // $$$$ MAT 2006-10-16: of course this test fails as we format the output : should it be considered a bug or a feature ?
+ BOOST_WARN_MESSAGE( 0, "TODO !" ); // $$$$ MAT 2006-10-16: of course this test fails as we format the output : should it be considered a bug or a feature ?
// xml::xostringstream xos;
// xos << xml::start( "element" ) << " \n text node content " << xml::start( "child" ) << xml::end << xml::end;
// BOOST_CHECK_EQUAL( "\n"
diff --git a/src/tests/xeuseuleu_test/CMakeLists.txt b/src/tests/xeuseuleu_test/CMakeLists.txt
index 186d7de..6dfce1a 100644
--- a/src/tests/xeuseuleu_test/CMakeLists.txt
+++ b/src/tests/xeuseuleu_test/CMakeLists.txt
@@ -5,7 +5,11 @@ include_directories(${xeumeuleu_SOURCE_DIR}/src/libraries
${Boost_INCLUDE_DIRS}
${XercesC_INCLUDE_DIR}
${XalanC_INCLUDE_DIR})
-add_definitions(-DBOOST_TEST_DYN_LINK)
+if( MSVC )
+ link_directories(${Boost_LIBRARY_DIRS})
+else()
+ add_definitions(-DBOOST_TEST_DYN_LINK)
+endif()
add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS)
add_executable(xeuseuleu_test parameter_test.cpp
xbuffertransform_test.cpp
@@ -13,6 +17,10 @@ add_executable(xeuseuleu_test parameter_test.cpp
xeuseuleu_test_pch.h
xftransform_test.cpp
xstringtransform_test.cpp)
+if( MSVC )
+ # decorated name length exceeded, name was truncated
+ target_compile_options(xeuseuleu_test PRIVATE "/wd4503")
+endif()
target_link_libraries(xeuseuleu_test
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
@@ -20,4 +28,4 @@ target_link_libraries(xeuseuleu_test
${Boost_THREAD_LIBRARY}
${XercesC_LIBRARY}
${XalanC_LIBRARY})
-add_test(NAME xeuseuleu_test COMMAND xeuseuleu_test --result_code=no --report_level=no --log_level=warning --data_directory=../../data/tests/xeuseuleu_test)
\ No newline at end of file
+add_test(NAME xeuseuleu_test COMMAND xeuseuleu_test --log_level=warning WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/data/tests/xeuseuleu_test)
diff --git a/src/tests/xeuseuleu_test/parameter_test.cpp b/src/tests/xeuseuleu_test/parameter_test.cpp
index 681a34a..40d182c 100644
--- a/src/tests/xeuseuleu_test/parameter_test.cpp
+++ b/src/tests/xeuseuleu_test/parameter_test.cpp
@@ -40,7 +40,7 @@
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( parameters_are_sent_to_the_stylesheet )
{
- xsl::xstringtransform xf( BOOST_RESOLVE( "parameters.xsl" ) );
+ xsl::xstringtransform xf( "parameters.xsl" );
xml::xistringstream xis( "" );
xf << xsl::parameter( "key1", "expression1" )
<< xsl::parameter( "key2", "expression2" )
@@ -55,10 +55,10 @@ BOOST_AUTO_TEST_CASE( parameters_are_sent_to_the_stylesheet )
BOOST_AUTO_TEST_CASE( unicode_parameters_are_sent_to_the_stylesheet )
{
std::string name;
- xml::xifstream( BOOST_RESOLVE( "japanese.xml" ) )
+ xml::xifstream( "japanese.xml" )
>> xml::start( "root" )
>> xml::attribute( "name", name );
- xsl::xstringtransform xf( BOOST_RESOLVE( "parameter.xsl" ) );
+ xsl::xstringtransform xf( "parameter.xsl" );
xf << xsl::parameter( "key", name )
<< xml::xistringstream( "" );
std::string attribute;
diff --git a/src/tests/xeuseuleu_test/xbuffertransform_test.cpp b/src/tests/xeuseuleu_test/xbuffertransform_test.cpp
index 5a57798..6fec6c1 100644
--- a/src/tests/xeuseuleu_test/xbuffertransform_test.cpp
+++ b/src/tests/xeuseuleu_test/xbuffertransform_test.cpp
@@ -39,8 +39,8 @@
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( xbuffertransform_can_be_serialized )
{
- xsl::xstringtransform xst( BOOST_RESOLVE( "buffer_test.xsl" ) );
- xsl::xbuffertransform xbt( BOOST_RESOLVE( "stylesheet.xsl" ) );
+ xsl::xstringtransform xst( "buffer_test.xsl" );
+ xsl::xbuffertransform xbt( "stylesheet.xsl" );
xml::xistringstream xis( "" );
xst << xbt << xis;
BOOST_CHECK_EQUAL( "", xst.str() );
@@ -52,8 +52,8 @@ BOOST_AUTO_TEST_CASE( xbuffertransform_can_be_serialized )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( xbuffertransform_can_be_inserted_in_the_serialization_flow )
{
- xsl::xstringtransform xst( BOOST_RESOLVE( "flow_test.xsl" ) );
- xsl::xbuffertransform xbt( BOOST_RESOLVE( "stylesheet.xsl" ) );
+ xsl::xstringtransform xst( "flow_test.xsl" );
+ xsl::xbuffertransform xbt( "stylesheet.xsl" );
xml::xistringstream xis( "" );
xst << xml::start( "root" )
<< xbt << xis
@@ -68,8 +68,8 @@ BOOST_AUTO_TEST_CASE( xbuffertransform_can_be_inserted_in_the_serialization_flow
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( xbuffertransform_can_have_parameters )
{
- xsl::xstringtransform xst( BOOST_RESOLVE( "stylesheet.xsl" ) );
- xsl::xbuffertransform xbt( BOOST_RESOLVE( "parameters.xsl" ) );
+ xsl::xstringtransform xst( "stylesheet.xsl" );
+ xsl::xbuffertransform xbt( "parameters.xsl" );
xml::xistringstream xis( "" );
xst << xbt << xsl::parameter( "key1", "expression1" )
<< xsl::parameter( "key2", "expression2" )
diff --git a/src/tests/xeuseuleu_test/xeuseuleu_test_pch.cpp b/src/tests/xeuseuleu_test/xeuseuleu_test_pch.cpp
index 1eb5e77..196a44b 100644
--- a/src/tests/xeuseuleu_test/xeuseuleu_test_pch.cpp
+++ b/src/tests/xeuseuleu_test/xeuseuleu_test_pch.cpp
@@ -30,48 +30,5 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
-#endif
#include "xeuseuleu_test_pch.h"
-#include
-
-namespace
-{
- std::string data_directory;
-
- void set_data_directory( int argc, char* argv[] )
- {
- while( argc-- )
- {
- const std::string argument = argv[argc];
- const std::string::size_type n = argument.find( '=' );
- if( n != std::string::npos && argument.substr( 0, n ) == "--data_directory" )
- data_directory = argument.substr( n+1 );
- }
- }
- const std::string extract_name( const std::string& path )
- {
- const std::size_t separator = path.find_last_of( "/\\" );
- return path.substr( std::max( std::size_t(), separator ) );
- }
- void set_master_suite_name( const std::string& path )
- {
- const std::string name = path.substr( path.find_last_of( "/\\" ) + 1 );
- boost::unit_test::framework::master_test_suite().p_name.set( name );
- }
-}
-
-::boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
-{
- set_master_suite_name( argv[0] );
- set_data_directory( argc, argv );
- return 0;
-}
-
-const std::string BOOST_RESOLVE( const std::string& filename )
-{
- if( data_directory.empty() )
- return filename;
- return data_directory + '/' + filename;
-}
diff --git a/src/tests/xeuseuleu_test/xeuseuleu_test_pch.h b/src/tests/xeuseuleu_test/xeuseuleu_test_pch.h
index c65df33..f49097a 100644
--- a/src/tests/xeuseuleu_test/xeuseuleu_test_pch.h
+++ b/src/tests/xeuseuleu_test/xeuseuleu_test_pch.h
@@ -48,15 +48,8 @@
#include
#include
-#define BOOST_LIB_NAME boost_unit_test_framework
-#include
-
-#define BOOST_TODO BOOST_WARN_MESSAGE( 0, "TODO !" )
-
#ifdef _MSC_VER
# pragma warning( pop )
#endif
-const std::string BOOST_RESOLVE( const std::string& filename );
-
#endif // xeuseuleu_test_pch_hpp
diff --git a/src/tests/xeuseuleu_test/xftransform_test.cpp b/src/tests/xeuseuleu_test/xftransform_test.cpp
index 1f69c48..c159e62 100644
--- a/src/tests/xeuseuleu_test/xftransform_test.cpp
+++ b/src/tests/xeuseuleu_test/xftransform_test.cpp
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE( tranformation_creates_a_file )
{
const std::string filename = "file";
{
- xsl::xftransform xf( BOOST_RESOLVE( "stylesheet.xsl" ), filename );
+ xsl::xftransform xf( "stylesheet.xsl", filename );
xf << xml::start( "root" )
<< xml::end;
}
@@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE( tranformation_creates_a_file )
BOOST_AUTO_TEST_CASE( tranformation_uses_a_stylesheet_with_unicode_name )
{
std::string stylesheet;
- xml::xifstream( BOOST_RESOLVE( "japanese.xml" ) )
+ xml::xifstream( "japanese.xml" )
>> xml::start( "root" )
>> xml::attribute( "name", stylesheet );
stylesheet += ".xsl";
@@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE( tranformation_uses_a_stylesheet_with_unicode_name )
stylesheet.c_str(),
boost::filesystem::detail::utf8_codecvt_facet() );
boost::filesystem::copy_file(
- BOOST_RESOLVE( "stylesheet.xsl" ),
+ "stylesheet.xsl",
path,
boost::filesystem::copy_option::overwrite_if_exists );
const std::string filename = "file";
@@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE( tranformation_uses_a_stylesheet_with_unicode_name )
BOOST_AUTO_TEST_CASE( tranformation_creates_a_file_with_unicode_name )
{
std::string filename;
- xml::xifstream( BOOST_RESOLVE( "japanese.xml" ) )
+ xml::xifstream( "japanese.xml" )
>> xml::start( "root" )
>> xml::attribute( "name", filename );
const boost::filesystem::path path(
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE( tranformation_creates_a_file_with_unicode_name )
boost::filesystem::detail::utf8_codecvt_facet() );
boost::filesystem::remove( path );
{
- xsl::xftransform xf( BOOST_RESOLVE( "stylesheet.xsl" ), filename );
+ xsl::xftransform xf( "stylesheet.xsl", filename );
xf << xml::start( "root" );
}
BOOST_CHECK( boost::filesystem::remove( path ) );
diff --git a/src/tests/xeuseuleu_test/xstringtransform_test.cpp b/src/tests/xeuseuleu_test/xstringtransform_test.cpp
index 3f1bc3b..d1b5b2b 100644
--- a/src/tests/xeuseuleu_test/xstringtransform_test.cpp
+++ b/src/tests/xeuseuleu_test/xstringtransform_test.cpp
@@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE( stylesheet_can_be_a_stream )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( transformation_is_applied_at_end_root_level )
{
- xsl::xstringtransform xst( BOOST_RESOLVE( "stylesheet.xsl" ) );
+ xsl::xstringtransform xst( "stylesheet.xsl" );
xst << xml::start( "root" )
<< xml::start( "element" )
<< xml::end
@@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE( transformation_is_applied_at_end_root_level )
// -----------------------------------------------------------------------------
BOOST_AUTO_TEST_CASE( transformation_from_an_xistream_is_valid )
{
- xsl::xstringtransform xst( BOOST_RESOLVE( "stylesheet.xsl" ) );
+ xsl::xstringtransform xst( "stylesheet.xsl" );
xml::xistringstream xis(
""
""