Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:33

0001 #include <cppunit/extensions/HelperMacros.h>
0002 #include "PhysicsTools/Utilities/interface/Simplify.h"
0003 #include "PhysicsTools/Utilities/interface/Fraction.h"
0004 #include "PhysicsTools/Utilities/interface/Variables.h"
0005 #include <type_traits>
0006 
0007 class testSimplifications : public CppUnit::TestFixture {
0008   CPPUNIT_TEST_SUITE(testSimplifications);
0009   CPPUNIT_TEST(checkAll);
0010   CPPUNIT_TEST_SUITE_END();
0011 
0012 public:
0013   void setUp() {}
0014   void tearDown() {}
0015   void checkAll();
0016 };
0017 
0018 CPPUNIT_TEST_SUITE_REGISTRATION(testSimplifications);
0019 
0020 void testSimplifications::checkAll() {
0021   using namespace funct;
0022   using namespace std;
0023   static_assert((is_same<Sum<Numerical<2>, Numerical<3> >::type, Numerical<5> >::value));
0024 
0025   static_assert((is_same<Difference<Numerical<2>, Numerical<3> >::type, Numerical<-1> >::value));
0026   static_assert((is_same<Product<Numerical<2>, Numerical<3> >::type, Numerical<6> >::value));
0027   static_assert((is_same<Minus<Numerical<6> >::type, Numerical<-6> >::value));
0028   static_assert((is_same<Fraction<2, 4>::type, Fraction<1, 2>::type>::value));
0029   static_assert((is_same<Fraction<-1, 2>::type, Fraction<1, -2>::type>::value));
0030   static_assert((is_same<Fraction<4, 2>::type, Numerical<2> >::value));
0031   static_assert((is_same<Fraction<3, 4>::type, Fraction<21, 28>::type>::value));
0032   static_assert((is_same<Fraction<3, 1>::type, Numerical<3> >::value));
0033   static_assert((is_same<Product<Minus<X>::type, Minus<Y>::type>::type, Product<X, Y>::type>::value));
0034   static_assert((!Parametric<Power<X, Y>::type>::value));
0035   static_assert((is_same<Product<Power<X, Y>::type, Power<X, Z>::type>::type, Power<X, Sum<Y, Z>::type>::type>::value));
0036   static_assert((!Parametric<Ratio<Sin<X>::type, Cos<X>::type>::type>::value));
0037   static_assert((is_same<Ratio<Sin<X>::type, Cos<X>::type>::type, Tan<X>::type>::value));
0038 }