Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68732 - sandbox/type_traits/libs/type_traits/test
From: frederic.bron_at_[hidden]
Date: 2011-02-08 15:44:55


Author: bronf
Date: 2011-02-08 15:44:54 EST (Tue, 08 Feb 2011)
New Revision: 68732
URL: http://svn.boost.org/trac/boost/changeset/68732

Log:
operator traits: more tests of cv-qualifiers and references; new target for bjam 'operators' to be able to run operator trait tests only
Text files modified:
   sandbox/type_traits/libs/type_traits/test/Jamfile.v2 | 24 ++++++++++++++++--------
   sandbox/type_traits/libs/type_traits/test/has_prefix_complement_operator_test.hpp | 26 +++++++++++++++++++++++++-
   sandbox/type_traits/libs/type_traits/test/has_prefix_increment_operator_test.hpp | 2 +-
   sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp | 26 +++++++++++++++++++++++++-
   sandbox/type_traits/libs/type_traits/test/has_prefix_plus_not_operator_test.hpp | 26 +++++++++++++++++++++++++-
   5 files changed, 92 insertions(+), 12 deletions(-)

Modified: sandbox/type_traits/libs/type_traits/test/Jamfile.v2
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/Jamfile.v2 (original)
+++ sandbox/type_traits/libs/type_traits/test/Jamfile.v2 2011-02-08 15:44:54 EST (Tue, 08 Feb 2011)
@@ -1,6 +1,6 @@
 # copyright John Maddock 2004
-# Use, modification and distribution are subject to the
-# Boost Software License, Version 1.0. (See accompanying file
+# Use, modification and distribution are subject to 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)
 
 # bring in the rules for testing
@@ -8,18 +8,26 @@
 
 # type_traits in V1 seem to have two modes: standalone, triggered
 # by a command line option, and a regular. For now, just imitate
-# regular
+# regular
 
-rule all-tests {
+rule non-operator-tests {
      local result ;
- for local source in [ glob *_test.cpp ] udt_specialisations.cpp
+ for local source in [ glob *_test.cpp : has_operator_*_test.cpp ] udt_specialisations.cpp
      {
          result += [ run $(source) ] ;
      }
- return $(result) ;
+ return $(result) ;
 }
-
-test-suite type_traits : [ all-tests ] ;
 
+rule operator-tests {
+ local result ;
+ for local source in [ glob has_operator_*_test.cpp ]
+ {
+ result += [ run $(source) ] ;
+ }
+ return $(result) ;
+}
 
+test-suite type_traits : [ non-operator-tests operator-tests ] ;
 
+test-suite operators : [ operator-tests ] ;

Modified: sandbox/type_traits/libs/type_traits/test/has_prefix_complement_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_prefix_complement_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_complement_operator_test.hpp 2011-02-08 15:44:54 EST (Tue, 08 Feb 2011)
@@ -69,8 +69,32 @@
    TEST_T(double, false);
    TEST_T(long double, false);
    TEST_T(void, false);
+# define CV(T) const T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), false);
+# define CV(T) volatile T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), false);
+# define CV(T) const volatile T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), false);
+# define CV(T) const T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), false);
+# define CV(T) volatile T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), false);
+# define CV(T) const volatile T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), false);
 
-// test with three template parameters
+ // test with three template parameters
    TEST_TR(bool, bool, true);
    TEST_TR(char, bool, true);
    TEST_TR(signed char, bool, true);

Modified: sandbox/type_traits/libs/type_traits/test/has_prefix_increment_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_prefix_increment_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_increment_operator_test.hpp 2011-02-08 15:44:54 EST (Tue, 08 Feb 2011)
@@ -94,7 +94,7 @@
    TEST_T(CV(int), false);
    TEST_T(CV(double), false);
 
-// test with three template parameters
+ // test with three template parameters
    TEST_TR(bool, bool, true);
    TEST_TR(char, bool, true);
    TEST_TR(signed char, bool, true);

Modified: sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp 2011-02-08 15:44:54 EST (Tue, 08 Feb 2011)
@@ -69,8 +69,32 @@
    TEST_T(double, true);
    TEST_T(long double, true);
    TEST_T(void, false);
+# define CV(T) const T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) volatile T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) const volatile T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) const T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) volatile T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) const volatile T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
 
-// test with three template parameters
+ // test with three template parameters
    TEST_TR(bool, bool, true);
    TEST_TR(char, bool, true);
    TEST_TR(signed char, bool, true);

Modified: sandbox/type_traits/libs/type_traits/test/has_prefix_plus_not_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_prefix_plus_not_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_plus_not_operator_test.hpp 2011-02-08 15:44:54 EST (Tue, 08 Feb 2011)
@@ -69,8 +69,32 @@
    TEST_T(double, true);
    TEST_T(long double, true);
    TEST_T(void, false);
+# define CV(T) const T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) volatile T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) const volatile T
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) const T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) volatile T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
+# define CV(T) const volatile T&
+ TEST_T(CV(bool), true);
+ TEST_T(CV(int), true);
+ TEST_T(CV(double), true);
 
-// test with three template parameters
+ // test with three template parameters
    TEST_TR(bool, bool, true);
    TEST_TR(char, bool, true);
    TEST_TR(signed char, bool, true);


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