|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73926 - sandbox/SOC/2011/checks/libs/checks/test
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-19 13:30:18
Author: trademark
Date: 2011-08-19 13:30:17 EDT (Fri, 19 Aug 2011)
New Revision: 73926
URL: http://svn.boost.org/trac/boost/changeset/73926
Log:
Add modulus 97-10 tests.
Text files modified:
sandbox/SOC/2011/checks/libs/checks/test/test_checks.cpp | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
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-08-19 13:30:17 EDT (Fri, 19 Aug 2011)
@@ -185,6 +185,30 @@
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_low_size_failure = "51007547061111462" ;
+ std::string mod97_10_big_size_failure = "5100007547061111462" ;
+
+ BOOST_CHECK ( boost::checks::check_mod97_10 (mod97_10_valid) ) ;
+ BOOST_CHECK ( !boost::checks::check_mod97_10 (mod97_10_not_valid) ) ;
+ BOOST_CHECK ( !boost::checks::check_mod97_10 (mod97_10_low_size_failure)) ;
+ 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 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" ) ;
+
+ 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_AUTO_TEST_SUITE_END()
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