From: <den...@us...> - 2010-11-30 21:30:01
|
Revision: 164 http://dsim.svn.sourceforge.net/dsim/?rev=164&view=rev Author: denis_arnaud Date: 2010-11-30 21:29:54 +0000 (Tue, 30 Nov 2010) Log Message: ----------- [Test-Boost] Updated the Boost.Filesystem tests to support Boost-1.44.0. Modified Paths: -------------- trunk/dsim/test/boost/filesystem/Makefile.am trunk/dsim/test/boost/filesystem/lpath.hpp trunk/dsim/test/boost/filesystem/operations_test.cpp trunk/dsim/test/boost/filesystem/path_test.cpp trunk/dsim/test/boost/filesystem/wide_test.cpp Modified: trunk/dsim/test/boost/filesystem/Makefile.am =================================================================== --- trunk/dsim/test/boost/filesystem/Makefile.am 2010-11-23 14:03:33 UTC (rev 163) +++ trunk/dsim/test/boost/filesystem/Makefile.am 2010-11-30 21:29:54 UTC (rev 164) @@ -39,7 +39,7 @@ path_test_LDFLAGS = $(BOOST_LIBS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) # -wide_test_SOURCES = wide_test.cpp +wide_test_SOURCES = wide_test.cpp utf8_codecvt_facet.cpp wide_test_CXXFLAGS = $(BOOST_CFLAGS) wide_test_LDADD = wide_test_LDFLAGS = $(BOOST_LIBS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) @@ -52,9 +52,8 @@ $(BOOST_LIBS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) # -fstream_test_SOURCES = fstream_test.cpp +fstream_test_SOURCES = fstream_test.cpp utf8_codecvt_facet.cpp fstream_test_CXXFLAGS = $(BOOST_CFLAGS) fstream_test_LDADD = fstream_test_LDFLAGS = \ $(BOOST_LIBS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) - Modified: trunk/dsim/test/boost/filesystem/lpath.hpp =================================================================== --- trunk/dsim/test/boost/filesystem/lpath.hpp 2010-11-23 14:03:33 UTC (rev 163) +++ trunk/dsim/test/boost/filesystem/lpath.hpp 2010-11-30 21:29:54 UTC (rev 164) @@ -8,11 +8,20 @@ // See library home page at http://www.boost.org/libs/filesystem +// Boost +#include <boost/version.hpp> // To check whether which version API is needed + +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 +#include <boost/filesystem/v2/path.hpp> +#else // BOOST_VERSION #include <boost/filesystem/path.hpp> +#endif // BOOST_VERSION + #include <cwchar> // for std::mbstate_t #include <string> #include <ios> // for std::streamoff + namespace std { // Note well: this specialization is meant only to support wide_test.cpp. @@ -93,7 +102,11 @@ namespace boost { +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 + namespace filesystem2 +#else // BOOST_VERSION namespace filesystem +#endif // BOOST_VERSION { template<> struct is_basic_path<user::lpath> { static const bool value = true; }; Modified: trunk/dsim/test/boost/filesystem/operations_test.cpp =================================================================== --- trunk/dsim/test/boost/filesystem/operations_test.cpp 2010-11-23 14:03:33 UTC (rev 163) +++ trunk/dsim/test/boost/filesystem/operations_test.cpp 2010-11-30 21:29:54 UTC (rev 164) @@ -10,10 +10,14 @@ #include <cstring> // for strncmp, etc. #include <ctime> #include <cstdlib> // for system() + // Boost +#include <boost/version.hpp> // To check whether which version API is needed #include <boost/config/warning_disable.hpp> + // See deprecated_test for tests of deprecated features #define BOOST_FILESYSTEM_NO_DEPRECATED + #include <boost/filesystem/operations.hpp> #include <boost/filesystem/convenience.hpp> #include <boost/cerrno.hpp> @@ -68,7 +72,11 @@ std::ofstream f( ph.file_string().c_str() ); if ( !f ) throw fs::filesystem_error( "operations_test create_file", +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 + ph, error_code(errno, system_category()) ); +#else // BOOST_VERSION ph, error_code(errno, system_category) ); +#endif // BOOST_VERSION if ( !contents.empty() ) f << contents; } @@ -77,7 +85,11 @@ std::ifstream f( ph.file_string().c_str() ); if ( !f ) throw fs::filesystem_error( "operations_test verify_file", - ph, error_code(errno, system_category) ); +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 + ph, error_code(errno, system_category()) ); +#else // BOOST_VERSION + ph, error_code(errno, system_category) ); +#endif // BOOST_VERSION std::string contents; f >> contents; if ( contents != expected ) Modified: trunk/dsim/test/boost/filesystem/path_test.cpp =================================================================== --- trunk/dsim/test/boost/filesystem/path_test.cpp 2010-11-23 14:03:33 UTC (rev 163) +++ trunk/dsim/test/boost/filesystem/path_test.cpp 2010-11-30 21:29:54 UTC (rev 164) @@ -18,6 +18,7 @@ #include <cstring> #include <cassert> // Boost +#include <boost/version.hpp> // To check whether which version API is needed #include <boost/filesystem/operations.hpp> #include <boost/utility.hpp> @@ -77,7 +78,13 @@ void exception_tests() { const std::string str_1("string-1"); + +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 + boost::system::error_code ec( 12345, boost::system::system_category()); +#else // BOOST_VERSION boost::system::error_code ec( 12345, boost::system::system_category); +#endif // BOOST_VERSION + try { throw fs::filesystem_error( str_1, ec ); } catch ( const fs::filesystem_error & ex ) { Modified: trunk/dsim/test/boost/filesystem/wide_test.cpp =================================================================== --- trunk/dsim/test/boost/filesystem/wide_test.cpp 2010-11-23 14:03:33 UTC (rev 163) +++ trunk/dsim/test/boost/filesystem/wide_test.cpp 2010-11-30 21:29:54 UTC (rev 164) @@ -4,31 +4,51 @@ // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See library home page at http://www.boost.org/libs/filesystem -// STL -#include <iostream> -#include <iomanip> -#include <ios> -#include <string> -#include <cerrno> + // Boost +#include <boost/version.hpp> // To check whether which version API is needed #include <boost/config/warning_disable.hpp> + // See deprecated_test for tests of deprecated features -#define BOOST_FILESYSTEM_NO_DEPRECATED +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +# define BOOST_FILESYSTEM_NO_DEPRECATED +#endif +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + #include <boost/filesystem/config.hpp> +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 +# ifdef BOOST_FILESYSTEM2_NARROW_ONLY +# error This compiler or standard library does not support wide-character strings or paths +# endif +#else // BOOST_VERSION # ifdef BOOST_FILESYSTEM_NARROW_ONLY # error This compiler or standard library does not support wide-character strings or paths # endif +#endif // BOOST_VERSION #include <boost/filesystem/operations.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/scoped_array.hpp> #include <boost/detail/lightweight_test.hpp> -#include "utf8_codecvt_facet.hpp" +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 +# include <boost/filesystem/detail/utf8_codecvt_facet.hpp> +#else // BOOST_VERSION +# include "utf8_codecvt_facet.hpp" +#endif // BOOST_VERSION namespace fs = boost::filesystem; +// STL +#include <iostream> +#include <iomanip> +#include <ios> +#include <string> +#include <cerrno> + #include "lpath.hpp" namespace { @@ -47,7 +67,11 @@ if ( !f ) throw fs::basic_filesystem_error<Path>( "wide_test create_file", ph, - boost::system::error_code( errno, boost::system::errno_ecat ) ); +#if defined(BOOST_VERSION) && BOOST_VERSION >= 104400 + boost::system::error_code( errno, boost::system::generic_category() ) ); +#else // BOOST_VERSION + boost::system::error_code( errno, boost::system::errno_ecat ) ); +#endif // BOOST_VERSION if ( !contents.empty() ) f << contents; } @@ -105,8 +129,8 @@ const wchar_t * from_next; char * to_next; if ( convertor.out( - state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), - work.get()+work_size, to_next ) != std::codecvt_base::ok ) + state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), + work.get()+work_size, to_next ) != std::codecvt_base::ok ) boost::throw_exception( std::runtime_error("to_external conversion error") ); *to_next = '\0'; return std::string( work.get() ); @@ -114,7 +138,7 @@ } // unnamed namespace -// main ------------------------------------------------------------------------------// +// main --------------------------------------------------------------------// int main( int argc, char * /*argv*/[] ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |