stlab.adobe.com Adobe Systems Incorporated
check_less_than_comparable.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 */
6 
7 /*************************************************************************************************/
8 
9 #include <adobe/config.hpp>
10 #include <boost/test/unit_test.hpp>
12 
13 
14 namespace adobe {
15 
21 template <typename T, typename Op>
22 void check_transitive(const T& x, const T& y, const T& z, Op op)
23 {
24  ignore_unused(y);
25  assert(op(x,y) && op(y,z));
26  BOOST_CHECK_MESSAGE(op(x,z), "tranisitive");
27 }
28 
29 template <typename T, typename Op>
30 void check_irreflexive(const T& x, Op op)
31 {
32  BOOST_CHECK_MESSAGE(!op(x,x), "irreflexive");
33 }
34 
35 template <typename T, typename Op>
36 void check_antisymmetric(const T& x, const T& y, Op op)
37 {
38  BOOST_CHECK_MESSAGE(!(op(x,y) && op(y,x)), "anti-symmetric");
39 }
40 
41 
42 template <typename T, typename Op>
43 void check_less_than_comparable(const T& x, const T& y, const T& z, Op op)
44 {
45  check_irreflexive(x, op);
46  check_antisymmetric(x, y, op);
47  check_transitive(x, y, z, op);
48 }
49 
51 }
52 

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google