Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74252 - sandbox/SOC/2011/checks/libs/checks/test
From: pbristow_at_[hidden]
Date: 2011-09-06 05:11:01


Author: pbristow
Date: 2011-09-06 05:10:59 EDT (Tue, 06 Sep 2011)
New Revision: 74252
URL: http://svn.boost.org/trac/boost/changeset/74252

Log:
edits to ensure warning free run with bjam
Text files modified:
   sandbox/SOC/2011/checks/libs/checks/test/alteration_test.hpp | 8 ++++--
   sandbox/SOC/2011/checks/libs/checks/test/jamfile.v2 | 16 +++++++-------
   sandbox/SOC/2011/checks/libs/checks/test/testModulus.cpp | 12 ++++++----
   sandbox/SOC/2011/checks/libs/checks/test/test_checks.cpp | 44 ++++++++++++++++++++--------------------
   sandbox/SOC/2011/checks/libs/checks/test/test_checks_tools.cpp | 6 ++--
   sandbox/SOC/2011/checks/libs/checks/test/transposition_test.hpp | 4 +-
   6 files changed, 47 insertions(+), 43 deletions(-)

Modified: sandbox/SOC/2011/checks/libs/checks/test/alteration_test.hpp
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/test/alteration_test.hpp (original)
+++ sandbox/SOC/2011/checks/libs/checks/test/alteration_test.hpp 2011-09-06 05:10:59 EDT (Tue, 06 Sep 2011)
@@ -1,4 +1,5 @@
-//! \file alteration_test.hpp
+//! \file
+// alteration_test.hpp
 
 // Copyright Pierre Talbot 2011.
 
@@ -7,6 +8,7 @@
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
+//! \brief To test the efficiency of check algorithms in detecting alterations.
 
 #ifndef BOOST_CHECK_TEST_ALTERATION_HPP
 #define BOOST_CHECK_TEST_ALTERATION_HPP
@@ -21,7 +23,7 @@
   for(int i=0; i < number_of_position_to_test; ++i)
     sequence[i] = '1' ;
 
- std::string alterate_seq = std::string();
+ std::string alterate_seq = std::string();
   alterate_seq.resize(number_of_position_to_test) ;
 
   char checkdigit = compute_checkdigit( sequence );
@@ -42,4 +44,4 @@
   return alteration_failures ;
 }
 
-#endif // BOOST_CHECK_TEST_ALTERATION_HPP
\ No newline at end of file
+#endif // BOOST_CHECK_TEST_ALTERATION_HPP

Modified: sandbox/SOC/2011/checks/libs/checks/test/jamfile.v2
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/test/jamfile.v2 (original)
+++ sandbox/SOC/2011/checks/libs/checks/test/jamfile.v2 2011-09-06 05:10:59 EDT (Tue, 06 Sep 2011)
@@ -31,7 +31,7 @@
 project checks
     : requirements
       <include>$(boost-root)
- <include>. # .cpp files. Remove???
+ <include>. # .cpp files in checks/test.
       <include>../../.. # checks .hpp files.
       <library>$(boost-root)/boost/test//boost_unit_test_framework
       
@@ -44,13 +44,13 @@
       <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
 
       # Warning suppression:
- <toolset>msvc:<cxxflags>/wd4996 # 'putenv': The POSIX name for this item is deprecated.
- <toolset>msvc:<cxxflags>/wd4512 # assignment operator could not be generated.
- <toolset>msvc:<cxxflags>/wd4610 #
- <toolset>msvc:<cxxflags>/wd4510 #
- <toolset>msvc:<cxxflags>/wd4224 # nonstandard extension used : formal parameter 'arg' was previously defined as a type.
- <toolset>msvc:<cxxflags>/wd4127 # expression is constant.
- <toolset>msvc:<cxxflags>/wd4701 # needed for lexical cast - temporary.
+ #<toolset>msvc:<cxxflags>/wd4996 # 'putenv': The POSIX name for this item is deprecated.
+ #<toolset>msvc:<cxxflags>/wd4512 # assignment operator could not be generated.
+ #<toolset>msvc:<cxxflags>/wd4610 # object 'class' can never be instantiated - user-defined constructor required.
+ #<toolset>msvc:<cxxflags>/wd4510 # The compiler cannot generate a default constructor for the specified class and no user-defined constructor #was created. You will not be able to create objects of this type.
+ #<toolset>msvc:<cxxflags>/wd4224 # nonstandard extension used : formal parameter 'arg' was previously defined as a type.
+ #<toolset>msvc:<cxxflags>/wd4127 # expression is constant.
+ #<toolset>msvc:<cxxflags>/wd4701 # needed for lexical cast - temporary.
       #<toolset>msvc:<cxxflags>/wd4100 # unreferenced formal parameter.
 
       <toolset>msvc:<iterator_debugging>off

Modified: sandbox/SOC/2011/checks/libs/checks/test/testModulus.cpp
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/test/testModulus.cpp (original)
+++ sandbox/SOC/2011/checks/libs/checks/test/testModulus.cpp 2011-09-06 05:10:59 EDT (Tue, 06 Sep 2011)
@@ -1,4 +1,5 @@
-//! \file testModulus.cpp
+//! \file
+// testModulus.cpp
 
 // Copyright Pierre Talbot 2011.
 
@@ -7,7 +8,8 @@
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-// Boost test of various check 'digit' systems.
+//! \brief Boost.Test of various check 'digit' systems.
+//! \detail Tests check algorithms for alterations and transpositions.
 
 // See http://www.boost.org/doc/libs/1_46_1/libs/test/doc/html/utf/testing-tools/reference.html
 
@@ -20,7 +22,7 @@
 #include <iomanip>
 #include <list>
 
-#include <boost/test/unit_test.hpp> // Enhanced for unit_test framework autolink
+#include <boost/test/unit_test.hpp> // Enhanced for unit_test framework autolink.
 
 #include <boost/checks/luhn.hpp>
 #include <boost/checks/modulus10.hpp>
@@ -53,11 +55,11 @@
 BOOST_AUTO_TEST_CASE(luhn_test)
 {
   unsigned int transpositions_failures = transposition( luhn_functor() ) ;
- BOOST_CHECK_MESSAGE( transpositions_failures == 2, "" << transpositions_failures << " catched on 90.") ;
+ BOOST_CHECK_MESSAGE( transpositions_failures == 2, "" << transpositions_failures << " caught on 90.") ;
 }
 
 BOOST_AUTO_TEST_CASE(verhoeff_test)
 {
   unsigned int transpositions_failures = transposition( verhoeff_functor() ) ;
- BOOST_CHECK_MESSAGE( transpositions_failures == 0, "" << transpositions_failures << " catched on 90.") ;
+ BOOST_CHECK_MESSAGE( transpositions_failures == 0, "" << transpositions_failures << " caught on 90.") ;
 }
\ No newline at end of file

Modified: sandbox/SOC/2011/checks/libs/checks/test/test_checks.cpp
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/test/test_checks.cpp (original)
+++ sandbox/SOC/2011/checks/libs/checks/test/test_checks.cpp 2011-09-06 05:10:59 EDT (Tue, 06 Sep 2011)
@@ -50,8 +50,8 @@
 BOOST_AUTO_TEST_CASE(visa_tests)
 {
   std::string visa_valid = "4417 1234 5678 9113" ;
- std::string visa_low_size_failure = "417 1234 5678 9113" ;
- std::string visa_big_size_failure = "44417 1234 5678 9113" ;
+ std::string visa_low_size_failure = "417 1234 5678 9113" ; // A missing digit '4'.
+ std::string visa_big_size_failure = "44417 1234 5678 9113" ; // An extra '4' digit.
   std::string visa_mii_failure = "3417 1234 5678 9113" ;
 
   BOOST_CHECK ( boost::checks::check_visa (visa_valid) ) ;
@@ -121,7 +121,7 @@
   BOOST_CHECK_THROW ( boost::checks::check_ean13 (ean13_big_size_failure) , std::invalid_argument ) ;
 
   std::string ean13_valid_without_checkdigit = "5 412983 13002" ;
- BOOST_CHECK_EQUAL ( boost::checks::compute_ean13 (ean13_valid_without_checkdigit), '8' ) ;
+ BOOST_CHECK_EQUAL ( boost::checks::compute_ean13 (ean13_valid_without_checkdigit), '8' ) ;
 
   std::string ean8_valid = "5449 1472" ; // Bottle of Coke.
   std::string ean8_low_size_failure = "5449 472" ;
@@ -132,7 +132,7 @@
   BOOST_CHECK_THROW ( boost::checks::check_ean8 (ean8_big_size_failure) , std::invalid_argument ) ;
 
   std::string ean8_valid_without_checkdigit = "5449 147" ;
- BOOST_CHECK_EQUAL ( boost::checks::compute_ean8 (ean8_valid_without_checkdigit), '2' ) ;
+ BOOST_CHECK_EQUAL ( boost::checks::compute_ean8 (ean8_valid_without_checkdigit), '2' ) ;
 }
 
 BOOST_AUTO_TEST_CASE(upc_tests)
@@ -146,14 +146,14 @@
   BOOST_CHECK_THROW ( boost::checks::check_upca (upca_big_size_failure) , std::invalid_argument ) ;
 
   std::string upca_valid_without_checkdigit = "03600029145" ;
- BOOST_CHECK_EQUAL ( boost::checks::compute_upca (upca_valid_without_checkdigit), '2' ) ;
+ BOOST_CHECK_EQUAL ( boost::checks::compute_upca (upca_valid_without_checkdigit), '2' ) ;
 }
 
 BOOST_AUTO_TEST_CASE(isbn_tests)
 {
 
   std::string isbn13_valid = "978-0-13-235088-4" ; // Clean Code: a handbook of agile software craftsmanship, Robert C. Martin.
- std::string isbn13_not_valid = "979-0-13-235088-4" ;
+ std::string isbn13_not_valid = "979-0-13-235088-4" ;
   std::string isbn13_low_size_failure = "978--13-235088-4" ;
   std::string isbn13_big_size_failure = "978-00-13-235088-4" ;
   std::string isbn13_ean_id_failure = "977-0-13-235088-4" ;
@@ -169,9 +169,9 @@
   BOOST_CHECK_THROW ( boost::checks::check_isbn13 (isbn13_ean_id_failure3) , std::invalid_argument ) ;
 
   std::string isbn13_valid_without_checkdigit = "978-0-13-235088-" ;
- std::string isbn13_not_valid_without_checkdigit = "979-0-13-235088-" ;
- BOOST_CHECK_EQUAL ( boost::checks::compute_isbn13 (isbn13_valid_without_checkdigit), '4' ) ;
- BOOST_CHECK_NE ( boost::checks::compute_isbn13 (isbn13_not_valid_without_checkdigit), '4' ) ;
+ std::string isbn13_not_valid_without_checkdigit = "979-0-13-235088-" ;
+ BOOST_CHECK_EQUAL ( boost::checks::compute_isbn13 (isbn13_valid_without_checkdigit), '4' ) ;
+ BOOST_CHECK_NE ( boost::checks::compute_isbn13 (isbn13_not_valid_without_checkdigit), '4' ) ;
 
   std::string isbn10_valid = "0-201-70073-5" ; // The C++ Programming Language, Special Edition, Bjarne Stroustrup.
   std::string isbn10_low_size_failure = "00-201-70073-5" ;
@@ -182,13 +182,13 @@
   BOOST_CHECK_THROW ( boost::checks::check_isbn10 (isbn10_big_size_failure) , std::invalid_argument ) ;
 
   std::string isbn10_valid_without_checkdigit = "0-201-70073-" ;
- BOOST_CHECK_EQUAL ( boost::checks::compute_isbn10 (isbn10_valid_without_checkdigit), '5' ) ;
+ BOOST_CHECK_EQUAL ( boost::checks::compute_isbn10 (isbn10_valid_without_checkdigit), '5' ) ;
 }
 
 BOOST_AUTO_TEST_CASE(mod97_10_tests)
 {
   std::string mod97_10_valid = "510007547061111462" ; // From a Belgium IBAN
- std::string mod97_10_not_valid = "511007547061111462" ;
+ std::string mod97_10_not_valid = "511007547061111462" ;
   std::string mod97_10_low_size_failure = "51007547061111462" ;
   std::string mod97_10_big_size_failure = "5100007547061111462" ;
 
@@ -198,15 +198,15 @@
   BOOST_CHECK ( !boost::checks::check_mod97_10 (mod97_10_big_size_failure)) ;
 
   std::string mod97_10_valid_without_checkdigits = "5100075470611114" ;
- std::string mod97_10_not_valid_without_checkdigits = "5110075470611114" ;
-
+ std::string mod97_10_not_valid_without_checkdigits = "5110075470611114" ;
+
   std::string valid_check_digits = "00" ;
   boost::checks::compute_mod97_10 (mod97_10_valid_without_checkdigits, valid_check_digits.begin() );
- BOOST_CHECK_EQUAL ( valid_check_digits, "62" ) ;
-
+ BOOST_CHECK_EQUAL ( valid_check_digits, "62" ) ;
+
   std::string invalid_check_digits = "00";
   boost::checks::compute_mod97_10 (mod97_10_not_valid_without_checkdigits, invalid_check_digits.begin() );
- BOOST_CHECK_NE ( invalid_check_digits, "62" ) ;
+ BOOST_CHECK_NE ( invalid_check_digits, "62" ) ;
 }
 
 BOOST_AUTO_TEST_SUITE_END()
@@ -246,28 +246,28 @@
 BOOST_AUTO_TEST_CASE(luhn_test)
 {
   unsigned int transpositions_failures = transposition( luhn_functor() ) ;
- BOOST_CHECK_MESSAGE( transpositions_failures == 2, "" << (90-transpositions_failures) << " catched on 90.") ;
+ BOOST_CHECK_MESSAGE( transpositions_failures == 2, "" << (90-transpositions_failures) << " caught on 90.") ;
 
   unsigned int alterations_failures = alteration( luhn_functor() , 2) ;
- BOOST_CHECK_MESSAGE( alterations_failures == 0, "" << (18-alterations_failures) << " catched on 18.") ;
+ BOOST_CHECK_MESSAGE( alterations_failures == 0, "" << (18-alterations_failures) << " caught on 18.") ;
 }
 
 BOOST_AUTO_TEST_CASE(verhoeff_test)
 {
   unsigned int transpositions_failures = transposition( verhoeff_functor() ) ;
- BOOST_CHECK_MESSAGE( transpositions_failures == 0, "" << (90-transpositions_failures) << " catched on 90.") ;
+ BOOST_CHECK_MESSAGE( transpositions_failures == 0, "" << (90-transpositions_failures) << " caught on 90.") ;
 
   unsigned int alterations_failures = alteration( verhoeff_functor() , 20) ;
- BOOST_CHECK_MESSAGE( alterations_failures == 0, "" << (180-alterations_failures) << " catched on 180.") ;
+ BOOST_CHECK_MESSAGE( alterations_failures == 0, "" << (180-alterations_failures) << " caught on 180.") ;
 }
 
 BOOST_AUTO_TEST_CASE(modulus11_test)
 {
   unsigned int transpositions_failures = transposition( modulus11_functor() ) ;
- BOOST_CHECK_MESSAGE( transpositions_failures == 0, "" << (90-transpositions_failures) << " catched on 90.") ;
+ BOOST_CHECK_MESSAGE( transpositions_failures == 0, "" << (90-transpositions_failures) << " caught on 90.") ;
 
   unsigned int alterations_failures = alteration( modulus11_functor() , 10) ;
- BOOST_CHECK_MESSAGE( alterations_failures == 0, "" << (90-alterations_failures) << " catched on 90.") ;
+ BOOST_CHECK_MESSAGE( alterations_failures == 0, "" << (90-alterations_failures) << " caught on 90.") ;
 }
 
 BOOST_AUTO_TEST_SUITE_END()

Modified: sandbox/SOC/2011/checks/libs/checks/test/test_checks_tools.cpp
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/test/test_checks_tools.cpp (original)
+++ sandbox/SOC/2011/checks/libs/checks/test/test_checks_tools.cpp 2011-09-06 05:10:59 EDT (Tue, 06 Sep 2011)
@@ -9,7 +9,7 @@
 
 // Boost test of tools used by the Boost::checks library.
 
-// See http://www.boost.org/doc/libs/1_46_1/libs/test/doc/html/utf/testing-tools/reference.html
+// See http://www.boost.org/doc/libs/1_47_1/libs/test/doc/html/utf/testing-tools/reference.html
 
 #define BOOST_TEST_MAIN
 #define BOOST_TEST_MODULE "Check Tools Test Suite"
@@ -19,7 +19,7 @@
 #include <iostream>
 #include <iomanip>
 
-#include <boost/test/unit_test.hpp> // Enhanced for unit_test framework autolink
+#include <boost/test/unit_test.hpp> // Enhanced for unit_test framework autolink.
 
 #include <boost/checks/weight.hpp>
 #include <boost/checks/iteration_sense.hpp>
@@ -83,5 +83,5 @@
   }
   BOOST_CHECK ( size_expected::reach_one_past_the_end(6) );
   BOOST_CHECK ( !no_size_expected::reach_one_past_the_end(6) );
-
+
 }
\ No newline at end of file

Modified: sandbox/SOC/2011/checks/libs/checks/test/transposition_test.hpp
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/test/transposition_test.hpp (original)
+++ sandbox/SOC/2011/checks/libs/checks/test/transposition_test.hpp 2011-09-06 05:10:59 EDT (Tue, 06 Sep 2011)
@@ -27,8 +27,8 @@
     {
       if(i != j)
       {
- sequence[0] = i | '0' ;
- sequence[1] = j | '0' ;
+ sequence[0] = static_cast<char>(i | '0') ;
+ sequence[1] = static_cast<char>(j | '0') ;
 
         transpose_seq[0] = sequence[1] ;
         transpose_seq[1] = sequence[0] ;


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