~ubuntu-branches/ubuntu/saucy/dune-common/saucy-proposed

« back to all changes in this revision

Viewing changes to dune/common/test/gcdlcmtest.cc

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2012-03-17 17:15:13 UTC
  • Revision ID: package-import@ubuntu.com-20120317171513-l2eqm95mddmu2dj3
Tags: upstream-2.2~svn6573
ImportĀ upstreamĀ versionĀ 2.2~svn6573

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef HAVE_CONFIG_H
 
2
#include "config.h"
 
3
#endif
 
4
 
 
5
#include<iostream>
 
6
 
 
7
#include<dune/common/gcd.hh>
 
8
#include<dune/common/lcm.hh>
 
9
#include<dune/common/static_assert.hh>
 
10
 
 
11
void test()
 
12
{
 
13
    dune_static_assert((Dune::Gcd<2*2*2*5*5*5*11, 2*2*5*13>::value == 2*2*5), "gcd not working properly");
 
14
    dune_static_assert((Dune::Lcm<11,3>::value == 33), "lcm not working properly");
 
15
    dune_static_assert((Dune::Lcm<18,15>::value == 18*15/3), "lcm not working properly");
 
16
    dune_static_assert((Dune::Lcm<10800,Dune::Lcm<36000,7680>::value>::value==1728000), "lcm not working properly");
 
17
}
 
18
 
 
19
int main()
 
20
{
 
21
  std::cout<<" gcd(2,5)="<<Dune::Gcd<2,5>::value<<" gcd(3, 18)="
 
22
           <<Dune::Gcd<3,18>::value<<" gcd("<<2*2*2*5*5*5*11<<", "
 
23
           << 2*2*5*13<<")="<<Dune::Gcd<2*2*2*5*5*5*11, 2*2*5*13>::value
 
24
           <<std::endl;
 
25
  std::cout<<" lcm(18,15)="<<Dune::Lcm<18,15>::value
 
26
           <<" lcm(10800,36000,7680)="<<Dune::Lcm<10800,Dune::Lcm<36000,7680>::value>::value<<std::endl;
 
27
  
 
28
}