mirror of https://github.com/CGAL/cgal
added missing operator()(NT a,b,c, bool s)
in default Root_of_traits_helper added test
This commit is contained in:
parent
8618db9fd2
commit
8fc7f3038d
|
|
@ -35,14 +35,23 @@ struct Root_of_traits_helper{
|
|||
typedef Root_of_2<NT> Root_of_2;
|
||||
struct Make_root_of_2{
|
||||
typedef Root_of_2 result_type;
|
||||
NT operator()(const NT& a, const NT& b, const NT& c){
|
||||
Root_of_2 operator()(const NT& a, const NT& b, const NT& c){
|
||||
return Root_of_2(a,b,c);
|
||||
}
|
||||
Root_of_1 operator()(const Root_of_1& a,
|
||||
Root_of_2 operator()(const NT& a, const NT& b, const NT& c, bool s){
|
||||
return Root_of_2(a,b,c,s);
|
||||
}
|
||||
Root_of_2 operator()(const Root_of_1& a,
|
||||
const Root_of_1& b,
|
||||
const Root_of_1& c){
|
||||
return Root_of_2(a,b,c);
|
||||
}
|
||||
Root_of_2 operator()(const Root_of_1& a,
|
||||
const Root_of_1& b,
|
||||
const Root_of_1& c,
|
||||
bool s){
|
||||
return Root_of_2(a,b,c,s);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,13 @@
|
|||
#include <CGAL/_test_real_embeddable.h>
|
||||
#include <CGAL/Arithmetic_kernel.h>
|
||||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Root_of_2.h>
|
||||
#include <CGAL/IO/io_tags.h>
|
||||
#include <CGAL/Lazy_exact_nt.h>
|
||||
|
||||
|
||||
|
||||
template <class T, class RootOf1, class RootOf2>
|
||||
void test_root_of_traits(){
|
||||
// pure type checking
|
||||
|
|
@ -26,6 +33,15 @@ void test_root_of_traits(){
|
|||
typedef typename RoT::Make_root_of_2 Make_root_of_2;
|
||||
typedef typename Make_root_of_2::result_type result_type;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<Root_of_2,result_type>::value));
|
||||
|
||||
Root_of_2 r = CGAL::make_root_of_2(T(0),T(-1),T(2)); //-sqrt(2)
|
||||
Root_of_2 rl = CGAL::make_root_of_2(T(1),T(0),T(-2),true); //-sqrt(2);
|
||||
Root_of_2 rr = CGAL::make_root_of_2(T(1),T(0),T(-2),false); //+sqrt(2)
|
||||
CGAL_test_assert(r == rl);
|
||||
CGAL_test_assert(rl != rr);
|
||||
|
||||
CGAL_test_assert( r * Root_of_1(2) == CGAL::make_root_of_2(T(0),T(-2),T(2)));
|
||||
CGAL_test_assert( r * T(2) == CGAL::make_root_of_2(T(0),T(-2),T(2)));
|
||||
}
|
||||
|
||||
int main(){
|
||||
|
|
|
|||
Loading…
Reference in New Issue