Add tests

This commit is contained in:
Andreas Fabri 2024-02-14 11:43:34 +00:00
parent e3ee999024
commit 4b574dca8e
5 changed files with 50 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include "_test_cls_plane_3.h"
#include "_test_cls_line_3.h"
#include "_test_cls_segment_3.h"
#include "_test_fct_segment_3.h"
#include "_test_cls_sphere_3.h"
#include "_test_cls_ray_3.h"
#include "_test_cls_triangle_3.h"
@ -51,6 +52,7 @@ _test_3(const R& r)
&& _test_fct_point_3(r)
&& _test_fct_weighted_point_3(r)
&& _test_fct_plane_3(r)
&& _test_fct_segment_3(r)
&& _test_further_fct_point_plane_3(r)
&& _test_cls_direction_3(r)
&& _test_cls_plane_3( r )

View File

@ -111,6 +111,9 @@ _test_fct_segment_2(const R& )
assert( CGAL::compare_slope(l6, l9) == CGAL::LARGER );
assert( CGAL::compare_slope(l9, l7) == CGAL::SMALLER );
std::cout <<'.';
assert( CGAL::squared_distance(l9.source(), l9.target()) == CGAL::squared_length(l9) );
std::cout << "done" << std::endl;
return true;
}

View File

@ -0,0 +1,43 @@
// Copyright (c) 1999
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later
//
//
// Author(s) : Susan Hert
#ifndef CGAL__TEST_FCT_SEGMENT_3_H
#define CGAL__TEST_FCT_SEGMENT_3_H
template <class R>
bool
_test_fct_segment_3(const R& )
{
std::cout << "Testing functions Segment_3" ;
typedef typename R::RT RT;
typedef typename R::Point_3 Point_3;
typedef typename R::Segment_3 Segment_3;
Point_3 p1 ( RT(0), RT(0), RT(0), RT(1) );
Point_3 p2 ( RT(1), RT(1), RT(1), RT(1) );
Segment_3 l1(p1, p2);
assert( CGAL::squared_distance(l1.source(), l1.target()) == CGAL::squared_length(l1) );
std::cout << "done" << std::endl;
return true;
}
#endif // CGAL__TEST_FCT_SEGMENT_3_H

View File

@ -87,6 +87,7 @@ _test_fct_vector_2(const R& )
assert( CGAL::scalar_product(v1, v2) == FT(30) );
assert( v1 * v0 == FT(0) );
assert( v1.squared_length() == FT(40) );
assert( v1.squared_length() == CGAL::squared_length(v1) );
assert( CGAL::Vector_2<R>( n1, n2) == v1 * RT(2));
assert( CGAL::Vector_2<R>( n5, n6) == v2 * RT(3));
assert( CGAL::Vector_2<R>( n1, n2) == RT(2) * v1);

View File

@ -101,6 +101,7 @@ _test_fct_vector_3(const R& )
std::cout << '.';
assert( v1.squared_length() == CGAL::squared_length(v1) );
assert( v1.squared_length() == FT(49) );
assert( v1 * v2 == FT(66) );
assert( v1 * v0 == FT(0) );