00001 00007 #pragma once 00008 00009 #include "basics/testcase.hh" 00010 #include "formula/elementFormulaContainer.hh" 00011 #include "space/element.hh" 00012 00013 namespace concepts { 00014 00015 // forward declarations 00016 template<class F, int dim> 00017 class Point; 00018 } 00019 00020 namespace test { 00021 00022 // ************************************************************** Container ** 00023 00024 template<class F = concepts::Real> 00025 class Container : public concepts::OutputOperator { 00026 public: 00027 Container(const concepts::ElementFormulaContainer<F> i) 00028 : i_(i) {} 00029 00030 const concepts::ElementFormula<F>& frm() const { 00031 return i_; 00032 } 00033 protected: 00034 virtual std::ostream& info(std::ostream& os) const { 00035 os << "Container("; 00036 if (!i_.empty()) 00037 os << i_; 00038 else os << "0"; 00039 return os << ")"; 00040 } 00041 private: 00042 const concepts::ElementFormulaContainer<F> i_; 00043 }; 00044 00045 00046 // ***************************************************** ElementFormulaTest ** 00047 00052 class ElementFormulaTest : public TestCase { 00053 public: 00054 virtual ~ElementFormulaTest() {} 00055 virtual void run(); 00056 00058 00059 00060 void testVectorElementFormula(); 00061 00063 void testSumElementFormula(); 00064 00066 void testProductElementFormula(); 00067 00069 void testVectorSumElementFormula(); 00070 00072 00073 template<class F> 00074 void testContainer(const char* s, 00075 const concepts::RCP<Container<F> > cnt, F ref); 00076 00077 template<class F> 00078 void testContainer(const char* s, 00079 const concepts::RCP<Container<concepts::Point<F,2> > > cnt, 00080 const concepts::Point<F,2> ref); 00081 }; 00082 00083 } // namespace test 00084 00085