OKlibrary  0.2.1.6
ResultElements_Tests.hpp
Go to the documentation of this file.
00001 // Oliver Kullmann, 11.6.2005 (Swansea)
00002 /* Copyright 2005 - 2007 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00017 #ifndef RESULTELEMENTTESTS_40098Ujk
00018 #define RESULTELEMENTTESTS_40098Ujk
00019 
00020 #include <OKlib/TestSystem/TestBaseClass.hpp>
00021 #include <OKlib/TestSystem/TestExceptions.hpp>
00022 
00023 #include <OKlib/Concepts/LibraryBasics.hpp>
00024 #include <OKlib/Concepts/Basics_Tests.hpp>
00025 
00026 #include <OKlib/Concepts/ResultElements.hpp>
00027 
00028 namespace OKlib {
00029   namespace Concepts {
00030 
00036     template <typename Res>
00037     struct ResultElement_basic_test : OKlib::TestSystem::TestBase {
00038       typedef ResultElement_basic_test test_type;
00039       ResultElement_basic_test() {
00040         insert(this);
00041       }
00042     private :
00043       void perform_test_trivial() {
00044         OKLIB_MODELS_CONCEPT_REQUIRES(Res, ResultElement);
00045       }
00046     };
00047 
00048     // -----------------------------------------------------------------------------------------------------------------
00049 
00056     template <typename Res>
00057     struct ResultElementWithOrder_basic_test : OKlib::TestSystem::TestBase {
00058       typedef ResultElementWithOrder_basic_test test_type;
00059       ResultElementWithOrder_basic_test() {
00060         insert(this);
00061       }
00062     private :
00063       void perform_test_trivial() {
00064         OKLIB_MODELS_CONCEPT_REQUIRES(Res, ResultElementWithOrder);
00065         OKLIB_TESTTRIVIAL_RETHROW(LinearOrder_basic_test_one_object<Res>(Res()));
00066       }
00067     };
00068 
00069     // -----------------------------------------------------------------------------------------------------------------
00070 
00077     template <typename Res>
00078     struct ResultElementWithName_Axiom_name_equality : OKlib::TestSystem::Test {
00079       typedef ResultElementWithName_Axiom_name_equality test_type;
00080       ResultElementWithName_Axiom_name_equality(const Res& a, const Res& b) : a(a), b(b) {
00081         assert(a.name() == b.name());
00082       }
00083     private :
00084       const Res& a; const Res& b;
00085       void perform_test_trivial() {
00086         if (a != b)
00087           OKLIB_THROW("a != b");
00088       }
00089     };
00090 
00097     template <typename Res>
00098     struct ResultElementWithName_Axiom_name_lessthan : OKlib::TestSystem::Test {
00099       typedef ResultElementWithName_Axiom_name_lessthan test_type;
00100       ResultElementWithName_Axiom_name_lessthan(const Res& a, const Res& b) : a(a), b(b) {
00101         assert(a.name() < b.name());
00102       }
00103     private :
00104       const Res& a; const Res& b;
00105       void perform_test_trivial() {
00106         if (not (a < b))
00107           OKLIB_THROW("not a < b");
00108       }
00109     };
00110 
00121     template <typename Res>
00122     struct ResultElementWithName_basic_test : OKlib::TestSystem::TestBase {
00123       typedef ResultElementWithName_basic_test test_type;
00124       ResultElementWithName_basic_test() {
00125         insert(this);
00126       }
00127     private :
00128       void perform_test_trivial() {
00129         OKLIB_MODELS_CONCEPT_REQUIRES(Res, ResultElementWithName);
00130         // XXXXXXXXX
00131       }
00132     };
00133 
00134     // -----------------------------------------------------------------------------------------------------------------
00135    
00136   }
00137 
00138 }
00139 
00140 #endif