check_less_than_comparable.hpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2005-2007 Adobe Systems Incorporated 00003 Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 00004 or a copy at http://stlab.adobe.com/licenses.html) 00005 */ 00006 00007 /*************************************************************************************************/ 00008 00009 #include <adobe/config.hpp> 00010 #include <boost/test/unit_test.hpp> 00011 #include <adobe/utility/ignore_unused.hpp> 00012 00013 00014 namespace adobe { 00015 00021 template <typename T, typename Op> 00022 void check_transitive(const T& x, const T& y, const T& z, Op op) 00023 { 00024 ignore_unused(y); 00025 assert(op(x,y) && op(y,z)); 00026 BOOST_CHECK_MESSAGE(op(x,z), "tranisitive"); 00027 } 00028 00029 template <typename T, typename Op> 00030 void check_irreflexive(const T& x, Op op) 00031 { 00032 BOOST_CHECK_MESSAGE(!op(x,x), "irreflexive"); 00033 } 00034 00035 template <typename T, typename Op> 00036 void check_antisymmetric(const T& x, const T& y, Op op) 00037 { 00038 BOOST_CHECK_MESSAGE(!(op(x,y) && op(y,x)), "anti-symmetric"); 00039 } 00040 00041 00042 template <typename T, typename Op> 00043 void check_less_than_comparable(const T& x, const T& y, const T& z, Op op) 00044 { 00045 check_irreflexive(x, op); 00046 check_antisymmetric(x, y, op); 00047 check_transitive(x, y, z, op); 00048 } 00049 00051 } 00052 |