|
Boost-Commit : |
From: mconsoni_at_[hidden]
Date: 2007-06-26 19:18:32
Author: mconsoni
Date: 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
New Revision: 7184
URL: http://svn.boost.org/trac/boost/changeset/7184
Log:
- style for each of the files (license, "latest version" notice, 80 columns, identation and file summary).
- fixed some warnings in the files because now it compiles on Linux (some modifictions on Jamfile where done).
Text files modified:
sandbox/libs/extension/test/Jamfile.v2 | 12 ++
sandbox/libs/extension/test/construction.cpp | 7 +
sandbox/libs/extension/test/counted_factory_test.cpp | 17 ++-
sandbox/libs/extension/test/extension_test.cpp | 9 +
sandbox/libs/extension/test/factory_test.cpp | 29 ++++-
sandbox/libs/extension/test/fruit.hpp | 11 +
sandbox/libs/extension/test/hello_world_test.cpp | 17 ++
sandbox/libs/extension/test/lib_caching_test.cpp | 204 ++++++++++++++++++++++-----------------
sandbox/libs/extension/test/multiple_inheritance_test.cpp | 81 ++++++++++-----
sandbox/libs/extension/test/parameters_test.cpp | 27 +++-
sandbox/libs/extension/test/registry_test.cpp | 24 +++-
sandbox/libs/extension/test/versions_test.cpp | 150 ++++++++++++++++-------------
sandbox/libs/extension/test/zone_test.cpp | 25 +++-
13 files changed, 380 insertions(+), 233 deletions(-)
Modified: sandbox/libs/extension/test/Jamfile.v2
==============================================================================
--- sandbox/libs/extension/test/Jamfile.v2 (original)
+++ sandbox/libs/extension/test/Jamfile.v2 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,3 +1,13 @@
+# Boost.Extension - tests Jamfile
+#
+# Copyright 2007 Jeremy Pack
+# 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)
+#
+# See http://www.boost.org/ for latest version.
+#
+
using testing ;
import os ;
local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
@@ -9,6 +19,8 @@
<include>$(BOOST_ROOT)
<define>BOOST_TEST_NO_AUTO_LINK=1
<toolset>gcc:<define>BOOST_TEST_DYN_LINK
+ <toolset>gcc:<find-static-library>boost_filesystem
+ <toolset>gcc:<find-static-library>boost_unit_test_framework
<toolset>gcc:<find-static-library>dl
:
;
Modified: sandbox/libs/extension/test/construction.cpp
==============================================================================
--- sandbox/libs/extension/test/construction.cpp (original)
+++ sandbox/libs/extension/test/construction.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
+/*
+ * Boost.Extension / construction test case
+ *
+ * (C) Copyright Jeremy Pack 2007
* 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
Modified: sandbox/libs/extension/test/counted_factory_test.cpp
==============================================================================
--- sandbox/libs/extension/test/counted_factory_test.cpp (original)
+++ sandbox/libs/extension/test/counted_factory_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,8 +1,13 @@
-/* (C) Copyright Jeremy Pack 2007
-* 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)
-*/
+/*
+ * Boost.Extension / counted factory test case
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
#include <boost/extension/counted_factory_map.hpp>
@@ -14,4 +19,4 @@
BOOST_AUTO_TEST_CASE(counted_factory_map_construction)
{
counted_factory_map fm;
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/test/extension_test.cpp
==============================================================================
--- sandbox/libs/extension/test/extension_test.cpp (original)
+++ sandbox/libs/extension/test/extension_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / extensions unit test
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
Modified: sandbox/libs/extension/test/factory_test.cpp
==============================================================================
--- sandbox/libs/extension/test/factory_test.cpp (original)
+++ sandbox/libs/extension/test/factory_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / factory unit test
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -24,8 +29,13 @@
{
factory_map z;
setup_zone(z);
- std::vector<factory<fruit, std::string, int, int> > f1(z.get<fruit, std::string, int, int>().begin(), z.get<fruit, std::string, int, int>().end());
- std::list<factory<fruit, std::string, int, int> > f2(z.get<fruit, std::string, int, int>().begin(), z.get<fruit, std::string, int, int>().end());
+ std::vector<factory<fruit, std::string, int, int> >
+ f1(z.get<fruit, std::string, int, int>().begin(),
+ z.get<fruit, std::string, int, int>().end());
+
+ std::list<factory<fruit, std::string, int, int> >
+ f2(z.get<fruit, std::string, int, int>().begin(),
+ z.get<fruit, std::string, int, int>().end());
std::list<factory<fruit, std::string, int, int> > f3(z);
std::list<factory<fruit, std::string, int, int> > f4 = z;
BOOST_CHECK_EQUAL(f1.size(), f2.size());
@@ -37,15 +47,20 @@
{
factory_map z;
setup_zone(z);
- std::vector<factory<fruit, std::string, int, int> > f1(z.get<fruit, std::string, int, int>().begin(), z.get<fruit, std::string, int, int>().end());
- std::vector<factory<fruit, std::string, int, int> >::iterator it = f1.begin();
+ std::vector<factory<fruit, std::string, int, int> >
+ f1(z.get<fruit, std::string, int, int>().begin(),
+ z.get<fruit, std::string, int, int>().end());
+ std::vector<factory<fruit, std::string, int, int> >::iterator
+ it = f1.begin();
+
std::auto_ptr<fruit> first(it->create(0, 1));
std::auto_ptr<fruit> second((++it)->create(0, 1));
std::auto_ptr<fruit> third((++it)->create(0, 1));
BOOST_CHECK_EQUAL((first->get_cost()), 21);
BOOST_CHECK_EQUAL((second->get_cost()), 7);
BOOST_CHECK_EQUAL((third->get_cost()), 18);
- BOOST_CHECK_EQUAL(typeid(*first.get()).name(), typeid(apple).name());
+ BOOST_CHECK_EQUAL(typeid(*first.get()).name(),
+ typeid(apple).name());
BOOST_CHECK_EQUAL(typeid(*second.get()).name(), typeid(banana).name());
BOOST_CHECK_EQUAL(typeid(*third.get()).name(), typeid(nectarine).name());
BOOST_CHECK(typeid(*third.get()).name() != typeid(banana).name());
Modified: sandbox/libs/extension/test/fruit.hpp
==============================================================================
--- sandbox/libs/extension/test/fruit.hpp (original)
+++ sandbox/libs/extension/test/fruit.hpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / fruit interface
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#ifndef BOOST_EXTENSION_TEST_FRUIT_HPP
@@ -69,4 +74,4 @@
const char * get_name(){return name_.c_str();}
};
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/libs/extension/test/hello_world_test.cpp
==============================================================================
--- sandbox/libs/extension/test/hello_world_test.cpp (original)
+++ sandbox/libs/extension/test/hello_world_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / hello world unit test
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -24,16 +29,18 @@
// check if the factory can return the functor
factory_map fm;
- functor<void, factory_map &> load_func = l.get_functor<void, factory_map &>("extension_export_word");
+ functor<void, factory_map &> load_func =
+ l.get_functor<void, factory_map &>("extension_export_word");
BOOST_CHECK_EQUAL( load_func.is_valid(), true );
load_func(fm);
// check if we can get the word list
std::list<factory<word, int> > & factory_list = fm.get<word, int>();
- BOOST_CHECK_EQUAL( factory_list.size(), 2 );
+ BOOST_CHECK_EQUAL( factory_list.size(), 2U );
- // iterate trough the classes and execute get_val method to obtain the correct words
+ // iterate trough the classes and execute get_val method
+ // to obtain the correct words
std::list<factory<word, int> >::iterator current_word = factory_list.begin();
std::auto_ptr<word> hello_word_ptr(current_word->create());
Modified: sandbox/libs/extension/test/lib_caching_test.cpp
==============================================================================
--- sandbox/libs/extension/test/lib_caching_test.cpp (original)
+++ sandbox/libs/extension/test/lib_caching_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / hello world unit test
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -26,128 +31,147 @@
BOOST_AUTO_TEST_CASE(lib_caching_test)
{
- if(boost::filesystem::exists(BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldCache.extension")) {
- boost::filesystem::remove(BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldCache.extension");
+ if(boost::filesystem::exists(BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldCache.extension")) {
+ boost::filesystem::remove(BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldCache.extension");
}
- boost::filesystem::copy_file(BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldLib.extension",
- BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldCache.extension");
+ boost::filesystem::copy_file(BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldLib.extension",
+ BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldCache.extension");
{
- // load the first version
- shared_library l((std::string("libHelloWorldCache") + ".extension").c_str());
- BOOST_CHECK_EQUAL( l.open(), true );
- {
-
- // check if the factory can return the functor
- factory_map fm;
- functor<void, factory_map &> load_func = l.get_functor<void, factory_map &>("extension_export_word");
- BOOST_CHECK_EQUAL( load_func.is_valid(), true );
+ // load the first version
+ shared_library l((std::string("libHelloWorldCache")
+ + ".extension").c_str());
+ BOOST_CHECK_EQUAL( l.open(), true );
+ {
+
+ // check if the factory can return the functor
+ factory_map fm;
+ functor<void, factory_map &> load_func = l.get_functor<void,
+ factory_map &>("extension_export_word");
+ BOOST_CHECK_EQUAL( load_func.is_valid(), true );
- load_func(fm);
+ load_func(fm);
- std::list<factory<word, int> > & factory_list = fm.get<word, int>();
- BOOST_CHECK_EQUAL( factory_list.size(), 2 );
+ std::list<factory<word, int> > & factory_list = fm.get<word, int>();
+ BOOST_CHECK_EQUAL( factory_list.size(), 2U );
- std::list<factory<word, int> >::iterator current_word = factory_list.begin();
+ std::list<factory<word, int> >::iterator current_word =
+ factory_list.begin();
- std::auto_ptr<word> hello_word_ptr(current_word->create());
- BOOST_CHECK_EQUAL( !hello_word_ptr.get(), 0 );
+ std::auto_ptr<word> hello_word_ptr(current_word->create());
+ BOOST_CHECK_EQUAL( !hello_word_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( hello_word_ptr->get_val(), "hello");
- std::cerr << hello_word_ptr->get_val() << " " << std::endl;
+ BOOST_CHECK_EQUAL( hello_word_ptr->get_val(), "hello");
+ std::cerr << hello_word_ptr->get_val() << " " << std::endl;
- ++current_word;
+ ++current_word;
- std::auto_ptr<word> world_word_ptr(current_word->create());
- BOOST_CHECK_EQUAL( !world_word_ptr.get(), 0 );
+ std::auto_ptr<word> world_word_ptr(current_word->create());
+ BOOST_CHECK_EQUAL( !world_word_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( world_word_ptr->get_val(), "world!");
- std::cerr << world_word_ptr->get_val() << std::endl << std::endl;
- }
- l.close();
+ BOOST_CHECK_EQUAL( world_word_ptr->get_val(), "world!");
+ std::cerr << world_word_ptr->get_val() << std::endl << std::endl;
+ }
+ l.close();
}
// replace the loaded library and try to reload
- boost::filesystem::remove(BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldCache.extension");
- boost::filesystem::copy_file(BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldLibv2.extension",
- BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldCache.extension");
+ boost::filesystem::remove(BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldCache.extension");
+ boost::filesystem::copy_file(BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldLibv2.extension",
+ BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldCache.extension");
{
- // load the second version
- shared_library l((std::string("libHelloWorldCache") + ".extension").c_str());
- BOOST_CHECK_EQUAL( l.open(), true );
-
- {
- // check if the factory can return the functor
- factory_map fm;
- functor<void, factory_map &> load_func = l.get_functor<void, factory_map &>("extension_export_word");
- BOOST_CHECK_EQUAL( load_func.is_valid(), true );
-
- load_func(fm);
-
- // check if we can get the word list
- std::list<factory<word, int> > & factory_list = fm.get<word, int>();
- BOOST_CHECK_EQUAL( factory_list.size(), 2 );
+ // load the second version
+ shared_library l((std::string("libHelloWorldCache")
+ + ".extension").c_str());
+ BOOST_CHECK_EQUAL( l.open(), true );
+
+ {
+ // check if the factory can return the functor
+ factory_map fm;
+ functor<void, factory_map &> load_func = l.get_functor<void,
+ factory_map &>("extension_export_word");
+ BOOST_CHECK_EQUAL( load_func.is_valid(), true );
+
+ load_func(fm);
+
+ // check if we can get the word list
+ std::list<factory<word, int> > & factory_list = fm.get<word, int>();
+ BOOST_CHECK_EQUAL( factory_list.size(), 2U );
- // iterate trough the classes and execute get_val method to obtain the correct words
- std::list<factory<word, int> >::iterator current_word = factory_list.begin();
+ // iterate trough the classes and execute get_val method
+ // to obtain the correct words
+ std::list<factory<word, int> >::iterator current_word =
+ factory_list.begin();
- std::auto_ptr<word> hello_word_ptr(current_word->create());
- BOOST_CHECK_EQUAL( !hello_word_ptr.get(), 0 );
+ std::auto_ptr<word> hello_word_ptr(current_word->create());
+ BOOST_CHECK_EQUAL( !hello_word_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( hello_word_ptr->get_val(), "| v2 hello");
- std::cerr << hello_word_ptr->get_val() << " " << std::endl;
+ BOOST_CHECK_EQUAL( hello_word_ptr->get_val(), "| v2 hello");
+ std::cerr << hello_word_ptr->get_val() << " " << std::endl;
- ++current_word;
+ ++current_word;
- std::auto_ptr<word> world_word_ptr(current_word->create());
- BOOST_CHECK_EQUAL( !world_word_ptr.get(), 0 );
+ std::auto_ptr<word> world_word_ptr(current_word->create());
+ BOOST_CHECK_EQUAL( !world_word_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( world_word_ptr->get_val(), "world! v2");
- std::cerr << world_word_ptr->get_val() << " " << std::endl;
- }
- l.close();
+ BOOST_CHECK_EQUAL( world_word_ptr->get_val(), "world! v2");
+ std::cerr << world_word_ptr->get_val() << " " << std::endl;
+ }
+ l.close();
}
{
- // load the library again and remove it when loaded
- shared_library l((std::string("libHelloWorldCache") + ".extension").c_str());
- BOOST_CHECK_EQUAL( l.open(), true );
-
- {
- // check if the factory can return the functor
- factory_map fm;
- functor<void, factory_map &> load_func = l.get_functor<void, factory_map &>("extension_export_word");
- BOOST_CHECK_EQUAL( load_func.is_valid(), true );
-
- load_func(fm);
-
- // check if we can get the word list
- std::list<factory<word, int> > & factory_list = fm.get<word, int>();
- BOOST_CHECK_EQUAL( factory_list.size(), 2 );
+ // load the library again and remove it when loaded
+ shared_library l((std::string("libHelloWorldCache")
+ + ".extension").c_str());
+ BOOST_CHECK_EQUAL( l.open(), true );
+
+ {
+ // check if the factory can return the functor
+ factory_map fm;
+ functor<void, factory_map &> load_func = l.get_functor<void,
+ factory_map &>("extension_export_word");
+ BOOST_CHECK_EQUAL( load_func.is_valid(), true );
+
+ load_func(fm);
+
+ // check if we can get the word list
+ std::list<factory<word, int> > & factory_list = fm.get<word, int>();
+ BOOST_CHECK_EQUAL( factory_list.size(), 2U );
- // iterate trough the classes and execute get_val method to obtain the correct words
- std::list<factory<word, int> >::iterator current_word = factory_list.begin();
+ // iterate trough the classes and execute get_val method
+ // to obtain the correct words
+ std::list<factory<word, int> >::iterator current_word =
+ factory_list.begin();
- std::auto_ptr<word> hello_word_ptr(current_word->create());
- BOOST_CHECK_EQUAL( !hello_word_ptr.get(), 0 );
+ std::auto_ptr<word> hello_word_ptr(current_word->create());
+ BOOST_CHECK_EQUAL( !hello_word_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( hello_word_ptr->get_val(), "| v2 hello");
- std::cerr << hello_word_ptr->get_val() << " " << std::endl;
+ BOOST_CHECK_EQUAL( hello_word_ptr->get_val(), "| v2 hello");
+ std::cerr << hello_word_ptr->get_val() << " " << std::endl;
- ++current_word;
+ ++current_word;
- boost::filesystem::remove(BOOST_EXTENSION_LIBS_DIRECTORY "libHelloWorldCache.extension");
+ boost::filesystem::remove(BOOST_EXTENSION_LIBS_DIRECTORY
+ "libHelloWorldCache.extension");
- std::auto_ptr<word> world_word_ptr(current_word->create());
- BOOST_CHECK_EQUAL( !world_word_ptr.get(), 0 );
+ std::auto_ptr<word> world_word_ptr(current_word->create());
+ BOOST_CHECK_EQUAL( !world_word_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( world_word_ptr->get_val(), "world! v2");
- std::cerr << world_word_ptr->get_val() << " " << std::endl;
+ BOOST_CHECK_EQUAL( world_word_ptr->get_val(), "world! v2");
+ std::cerr << world_word_ptr->get_val() << " " << std::endl;
- }
- l.close();
+ }
+ l.close();
}
}
Modified: sandbox/libs/extension/test/multiple_inheritance_test.cpp
==============================================================================
--- sandbox/libs/extension/test/multiple_inheritance_test.cpp (original)
+++ sandbox/libs/extension/test/multiple_inheritance_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / multiple inheritance unit test
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -32,17 +37,22 @@
// constructors. Multiple zones can be constructed.
factory_map twilight;
- // check if each library loads correct. It could be done with a helper function but I think that
- // it is clear this way because we are in a unit test, and the output for the helper function version
- // will be less descriptive
+ // check if each library loads correct. It could be done with a helper
+ // function but I think that it is clear this way because we are in a
+ // unit test, and the output for the helper function version will be
+ // less descriptive
// check if the libraries can be loaded
- shared_library libVehicle((std::string("libVehicle") + ".extension").c_str());
+ shared_library libVehicle((std::string("libVehicle")
+ + ".extension").c_str());
shared_library libCar((std::string("libCar") + ".extension").c_str());
- shared_library libComputer((std::string("libComputer") + ".extension").c_str());
+ shared_library libComputer((std::string("libComputer")
+ + ".extension").c_str());
shared_library libBoat((std::string("libBoat") + ".extension").c_str());
- shared_library libFlyingCar((std::string("libFlyingCar") + ".extension").c_str());
- shared_library libCarOfTheFuture((std::string("libCarOfTheFuture") + ".extension").c_str());
+ shared_library libFlyingCar((std::string("libFlyingCar")
+ + ".extension").c_str());
+ shared_library libCarOfTheFuture((std::string("libCarOfTheFuture")
+ + ".extension").c_str());
shared_library libPlane((std::string("libPlane") + ".extension").c_str());
BOOST_CHECK_EQUAL( libVehicle.open(), true );
BOOST_CHECK_EQUAL( libCar.open(), true );
@@ -53,13 +63,20 @@
BOOST_CHECK_EQUAL( libPlane.open(), true );
// check if the factory can return the functor for each library
- functor<void, factory_map &> load_func_vehicle = libVehicle.get_functor<void, factory_map &>("extension_export");
- functor<void, factory_map &> load_func_car = libCar.get_functor<void, factory_map &>("extension_export");
- functor<void, factory_map &> load_func_computer = libComputer.get_functor<void, factory_map &>("extension_export");
- functor<void, factory_map &> load_func_boat = libBoat.get_functor<void, factory_map &>("extension_export");
- functor<void, factory_map &> load_func_flyingcar = libFlyingCar.get_functor<void, factory_map &>("extension_export");
- functor<void, factory_map &> load_func_carofthefuture = libCarOfTheFuture.get_functor<void, factory_map &>("extension_export");
- functor<void, factory_map &> load_func_plane = libPlane.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func_vehicle =
+ libVehicle.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func_car =
+ libCar.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func_computer =
+ libComputer.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func_boat =
+ libBoat.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func_flyingcar =
+ libFlyingCar.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func_carofthefuture =
+ libCarOfTheFuture.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func_plane =
+ libPlane.get_functor<void, factory_map &>("extension_export");
BOOST_CHECK_EQUAL( load_func_vehicle.is_valid(), true );
BOOST_CHECK_EQUAL( load_func_car.is_valid(), true );
BOOST_CHECK_EQUAL( load_func_computer.is_valid(), true );
@@ -77,10 +94,12 @@
// Computer test: we test if we obtain the computer implementation
- std::list<factory<computer, std::string> > & factory_list = twilight.get<computer, std::string>();
- BOOST_CHECK_EQUAL( factory_list.size(), 2 );
+ std::list<factory<computer, std::string> > & factory_list =
+ twilight.get<computer, std::string>();
+ BOOST_CHECK_EQUAL( factory_list.size(), 2U );
- std::list<factory<computer, std::string> >::iterator comp = factory_list.begin();
+ std::list<factory<computer, std::string> >::iterator comp =
+ factory_list.begin();
std::auto_ptr<computer> computer_ptr(comp->create());
BOOST_CHECK_EQUAL( !computer_ptr.get(), 0 );
@@ -89,15 +108,18 @@
BOOST_CHECK_EQUAL( computer_ptr->list_capabilities(), "\nIt computes.");
// Vehicles test: we test if we obtain the different vehicles implementation
- std::list<factory<vehicle, std::string> > & factory_list2 = twilight.get<vehicle, std::string>();
- BOOST_CHECK_EQUAL( factory_list2.size(), 6 );
+ std::list<factory<vehicle, std::string> > & factory_list2 =
+ twilight.get<vehicle, std::string>();
+ BOOST_CHECK_EQUAL( factory_list2.size(), 6U );
- std::list<factory<vehicle, std::string> >::iterator v = factory_list2.begin();
+ std::list<factory<vehicle, std::string> >::iterator v =
+ factory_list2.begin();
// vehicle as a vehicle
std::auto_ptr<vehicle> v1_ptr(v->create());
BOOST_CHECK_EQUAL( v->get_info(), "A vehicle exported as a vehicle" );
- BOOST_CHECK_EQUAL( v1_ptr->list_capabilities(), "\nIt is some sort of vehicle." );
+ BOOST_CHECK_EQUAL( v1_ptr->list_capabilities(),
+ "\nIt is some sort of vehicle." );
++v;
@@ -118,15 +140,20 @@
// flying car as a vehicle
std::auto_ptr<vehicle> v4_ptr(v->create());
BOOST_CHECK_EQUAL( v->get_info(), "A flying car exported as a vehicle");
- BOOST_CHECK_EQUAL( v4_ptr->list_capabilities(), "\nIt travels on roads.\nIt flies in the air.\nIt takes off from your driveway" );
+ BOOST_CHECK_EQUAL( v4_ptr->list_capabilities(),
+ "\nIt travels on roads.\nIt flies in the air.\n"
+ "It takes off from your driveway" );
++v;
// a car of the future as a vehicle
std::auto_ptr<vehicle> v5_ptr(v->create());
- BOOST_CHECK_EQUAL( v->get_info(), "A car of the future exported as a vehicle" );
- BOOST_CHECK_EQUAL( v5_ptr->list_capabilities(), "\nIt floats on water.\nIt travels on roads.\nIt flies in the air.\n"
- "It takes off from your driveway\nIt computes.\nCosts an arm and a leg" );
+ BOOST_CHECK_EQUAL( v->get_info(), "A car of the future exported as "
+ "a vehicle" );
+ BOOST_CHECK_EQUAL( v5_ptr->list_capabilities(), "\nIt floats on water.\n"
+ "It travels on roads.\nIt flies in the air.\n"
+ "It takes off from your driveway\nIt computes.\n"
+ "Costs an arm and a leg" );
++v;
Modified: sandbox/libs/extension/test/parameters_test.cpp
==============================================================================
--- sandbox/libs/extension/test/parameters_test.cpp (original)
+++ sandbox/libs/extension/test/parameters_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / lots of parameters unit test
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -24,21 +29,27 @@
// check if the factory can return the functor
factory_map fm;
- functor<void, factory_map &> load_func = l.get_functor<void, factory_map &>("extension_export");
+ functor<void, factory_map &> load_func = l.get_functor<void,
+ factory_map &>("extension_export");
BOOST_CHECK_EQUAL( load_func.is_valid(), true );
load_func(fm);
// check if we can get the parameter list
- std::list<factory<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> > > & factory_list =
- fm.get<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> >();
- BOOST_CHECK_EQUAL( factory_list.size(), 1 );
+ std::list<factory<lots_of_parameters_interface, int, bool, unsigned int,
+ char, std::string, A, boost::shared_ptr<A> > > & factory_list =
+ fm.get<lots_of_parameters_interface, int, bool, unsigned int, char,
+ std::string, A, boost::shared_ptr<A> >();
+ BOOST_CHECK_EQUAL( factory_list.size(), 1U );
// get the interface and construct it
- std::list<factory<lots_of_parameters_interface, int, bool, unsigned int, char, std::string, A, boost::shared_ptr<A> > >::iterator params =
+ std::list<factory<lots_of_parameters_interface, int, bool, unsigned int,
+ char, std::string, A, boost::shared_ptr<A> > >::iterator params =
factory_list.begin();
- std::auto_ptr<lots_of_parameters_interface> params_ptr(params->create(true, 4, 'c', "test", A(2), boost::shared_ptr<A>(new A(15))));
+ std::auto_ptr<lots_of_parameters_interface>
+ params_ptr(params->create(true, 4, 'c', "test", A(2),
+ boost::shared_ptr<A>(new A(15))));
BOOST_CHECK_EQUAL( !params_ptr.get(), 0 );
}
Modified: sandbox/libs/extension/test/registry_test.cpp
==============================================================================
--- sandbox/libs/extension/test/registry_test.cpp (original)
+++ sandbox/libs/extension/test/registry_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,8 +1,14 @@
-/* (C) Copyright Jeremy Pack 2007
-* 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)
-*/
+/*
+ * Boost.Extension / registry unit test
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
+ */
+
#include <string>
#include <boost/extension/registry.hpp>
@@ -28,7 +34,8 @@
registry reg;
BOOST_ASSERT(reg.open("../bin/libRegistryLibrary.extension"));
{
- std::list<counted_factory<word, int> > & factory_list = reg.get<word, int>();
+ std::list<counted_factory<word, int> > & factory_list =
+ reg.get<word, int>();
BOOST_CHECK_EQUAL(factory_list.size(), size_t(1));
{
std::auto_ptr<word> w(factory_list.begin()->create());
@@ -39,7 +46,8 @@
BOOST_CHECK(reg.clear());
BOOST_ASSERT(reg.open("../bin/libRegistryLibrary.extension"));
{
- std::list<counted_factory<word, int> > & factory_list = reg.get<word, int>();
+ std::list<counted_factory<word, int> > & factory_list =
+ reg.get<word, int>();
BOOST_CHECK_EQUAL(factory_list.size(), size_t(1));
{
std::auto_ptr<word> w(factory_list.begin()->create());
@@ -49,4 +57,4 @@
}
BOOST_CHECK(reg.clear());
BOOST_CHECK_EQUAL(reg.num_libraries(), size_t(0));
-}
\ No newline at end of file
+}
Modified: sandbox/libs/extension/test/versions_test.cpp
==============================================================================
--- sandbox/libs/extension/test/versions_test.cpp (original)
+++ sandbox/libs/extension/test/versions_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Mariano G. Consoni 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / implementations versions test
+ *
+ * (C) Copyright Mariano G. Consoni 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -21,72 +26,81 @@
BOOST_AUTO_TEST_CASE(versions_test)
{
- using namespace boost::extensions;
+ using namespace boost::extensions;
- // Create the factory_map object - it will hold all of the available
- // constructors. Multiple factory_maps can be constructed.
- factory_map fm;
-
- // load hello world first version
- load_single_library(fm, "libHelloWorldLib.extension", "extension_export_word");
-
- // load hello world second version
- load_single_library(fm, "libHelloWorldLibv2.extension", "extension_export_word");
-
- // load hello world second version again
- load_single_library(fm, "libHelloWorldLibv2.extension", "extension_export_word");
-
- // load salute library (with hello included)
- load_single_library(fm, "libSaluteLib.extension", "extension_export_salute");
-
- // Get a reference to the list of constructors for words.
- std::list<factory<word, int> > & factory_list = fm.get<word, int>();
-
- // the point here is to check if six classes were loaded (two for each one of the first three libraries)
- BOOST_CHECK_EQUAL( factory_list.size(), 6 );
-
- // these are the expected strings
- std::vector<std::string> words;
- words.push_back("hello");
- words.push_back("world!");
- words.push_back("| v2 hello");
- words.push_back("world! v2");
- words.push_back("| v2 hello");
- words.push_back("world! v2");
-
- std::vector<std::string>::const_iterator expected_word = words.begin();
- for (std::list<factory<word, int> >::iterator current_word = factory_list.begin();
- current_word != factory_list.end(); ++current_word)
- {
- /// check that the pointer is OK and the word is the one that we're expecting
- std::auto_ptr<word> word_ptr(current_word->create());
- BOOST_CHECK_EQUAL( !word_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( word_ptr->get_val(), *expected_word);
- ++expected_word;
- }
-
- // Get a reference to the list of constructors for salutes.
- std::list<factory<salute, int> > & salute_factory_list = fm.get<salute, int>();
-
- // the point here is to check if only two classes were loaded
- BOOST_CHECK_EQUAL( salute_factory_list.size(), 2 );
-
- // these are the expected strings
- std::vector<std::string> salutes;
- salutes.push_back("hello");
- salutes.push_back("bye!");
-
- std::vector<std::string>::const_iterator expected_salute = salutes.begin();
-
- for (std::list<factory<salute, int> >::iterator current_salute = salute_factory_list.begin();
- current_salute != salute_factory_list.end(); ++current_salute)
- {
- /// check that the pointer is OK and the salute is the one that we're expecting
- std::auto_ptr<salute> salute_ptr(current_salute->create());
- BOOST_CHECK_EQUAL( !salute_ptr.get(), 0 );
- BOOST_CHECK_EQUAL( salute_ptr->say(), *expected_salute);
- ++expected_salute;
- }
+ // Create the factory_map object - it will hold all of the available
+ // constructors. Multiple factory_maps can be constructed.
+ factory_map fm;
+
+ // load hello world first version
+ load_single_library(fm, "libHelloWorldLib.extension",
+ "extension_export_word");
+
+ // load hello world second version
+ load_single_library(fm, "libHelloWorldLibv2.extension",
+ "extension_export_word");
+
+ // load hello world second version again
+ load_single_library(fm, "libHelloWorldLibv2.extension",
+ "extension_export_word");
+
+ // load salute library (with hello included)
+ load_single_library(fm, "libSaluteLib.extension", "extension_export_salute");
+
+ // Get a reference to the list of constructors for words.
+ std::list<factory<word, int> > & factory_list = fm.get<word, int>();
+
+ // the point here is to check if six classes were loaded
+ // (two for each one of the first three libraries)
+ BOOST_CHECK_EQUAL( factory_list.size(), 6U );
+
+ // these are the expected strings
+ std::vector<std::string> words;
+ words.push_back("hello");
+ words.push_back("world!");
+ words.push_back("| v2 hello");
+ words.push_back("world! v2");
+ words.push_back("| v2 hello");
+ words.push_back("world! v2");
+
+ std::vector<std::string>::const_iterator expected_word = words.begin();
+ for (std::list<factory<word, int> >::iterator current_word =
+ factory_list.begin(); current_word != factory_list.end();
+ ++current_word)
+ {
+ /// check that the pointer is OK and the word is the one that
+ /// we're expecting
+ std::auto_ptr<word> word_ptr(current_word->create());
+ BOOST_CHECK_EQUAL( !word_ptr.get(), 0 );
+ BOOST_CHECK_EQUAL( word_ptr->get_val(), *expected_word);
+ ++expected_word;
+ }
+
+ // Get a reference to the list of constructors for salutes.
+ std::list<factory<salute, int> > & salute_factory_list = fm.get<salute,
+ int>();
+
+ // the point here is to check if only two classes were loaded
+ BOOST_CHECK_EQUAL( salute_factory_list.size(), 2U );
+
+ // these are the expected strings
+ std::vector<std::string> salutes;
+ salutes.push_back("hello");
+ salutes.push_back("bye!");
+
+ std::vector<std::string>::const_iterator expected_salute = salutes.begin();
+
+ for (std::list<factory<salute, int> >::iterator current_salute =
+ salute_factory_list.begin();
+ current_salute != salute_factory_list.end(); ++current_salute)
+ {
+ /// check that the pointer is OK and the salute is the one that
+ /// we're expecting
+ std::auto_ptr<salute> salute_ptr(current_salute->create());
+ BOOST_CHECK_EQUAL( !salute_ptr.get(), 0 );
+ BOOST_CHECK_EQUAL( salute_ptr->say(), *expected_salute);
+ ++expected_salute;
+ }
- // all ok
+ // all ok
}
Modified: sandbox/libs/extension/test/zone_test.cpp
==============================================================================
--- sandbox/libs/extension/test/zone_test.cpp (original)
+++ sandbox/libs/extension/test/zone_test.cpp 2007-06-26 19:18:31 EDT (Tue, 26 Jun 2007)
@@ -1,7 +1,12 @@
-/* (C) Copyright Jeremy Pack 2007
- * Distributed under the Boost Software License, Version 1.0. (See
+/*
+ * Boost.Extension / zone test
+ *
+ * (C) Copyright Jeremy Pack 2007
+ * 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)
+ *
+ * See http://www.boost.org/ for latest version.
*/
#include <boost/extension/factory_map.hpp>
@@ -54,13 +59,17 @@
BOOST_AUTO_TEST_CASE(different_base)
{
factory_map z;
- BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().size()), size_t(0));
+ BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().size()),
+ size_t(0));
z.add<apple, fruit, std::string, int, int>("A round fruit");
- z.add<tomato, fruit, std::string, int, int>("A round fruit that isn't very sweet");
- z.add<tomato, vegetable, vegetable_info, float>(vegetable_info("Tomato", 112));
+ z.add<tomato, fruit, std::string, int,
+ int>("A round fruit that isn't very sweet");
+ z.add<tomato, vegetable, vegetable_info, float>(vegetable_info("Tomato",
+ 112));
BOOST_CHECK_EQUAL((z.get<fruit, std::string, int, int>().size()), size_t(2));
- BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().size()), size_t(1));
- BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().begin()->get_info().get_calories()),
- 112);
+ BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info, float>().size()),
+ size_t(1));
+ BOOST_CHECK_EQUAL((z.get<vegetable, vegetable_info,
+ float>().begin()->get_info().get_calories()), 112);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk