Update tests

This commit is contained in:
Mael Rouxel-Labbé 2021-12-17 12:23:54 +01:00
parent 3a0a4a6067
commit 08f9cfb192
1 changed files with 19 additions and 22 deletions

View File

@ -26,45 +26,42 @@ int main()
CGAL::Cartesian_converter<SCI, EPICK> sci_to_epick;
CGAL::Cartesian_converter<SCLD, EPICK> scld_to_epick;
// CGAL::Cartesian_converter<SCI, EPECK> sci_to_epeck;
CGAL::Cartesian_converter<SCI, EPECK> sci_to_epeck;
CGAL::Cartesian_converter<EPECK, EPICK> epeck_to_epick;
CGAL::Homogeneous_converter<SHI, SHD> shi_to_shd;
CGAL::Homogeneous_converter<SHE, SHD> she_to_shd;
CGAL::Homogeneous_converter<SHE, SHE> she_to_she;
assert(sci_to_epick(SCI::FT(2)) == EPICK::FT(2));
// assert(sci_to_epick((long int)(2)) == EPICK::FT(2)); // static assertion expected
// assert(sci_to_epick(2.) == EPICK::FT(2)); // static assertion expected
assert(sci_to_epick(bool(2.)) == true);
assert(scld_to_epick((long double)(2.)) /*long double is FT*/ == EPICK::FT(2));
// fundamental type, but it's K1::FT so OK
assert(scld_to_epick((long double)(2.)) == EPICK::FT(2));
// fundamental types != FT
assert(sci_to_epick((long int)(2)) == (long int)(2));
assert(sci_to_epick(2.) == 2.);
assert(sci_to_epick(bool(2.)) == true);
assert(sci_to_epick(true) == true);
assert(sci_to_epick(false) == false);
assert(sci_to_epick(CGAL::ON_POSITIVE_SIDE) == CGAL::ON_POSITIVE_SIDE);
// int* is not a fundamental type, so this will (unfortunately) go through the bool path
int a = 123;
int* a_ptr = &a;
CGAL_USE(a_ptr);
assert(sci_to_epick(a_ptr) == 1);
#ifdef CGAL_USE_CORE
using SSCE = CGAL::Simple_cartesian<CORE::Expr>;
CGAL::Cartesian_converter<SSCE, EPICK> scce_to_epick;
// fundamental types, so static assertion failures
// assert(scce_to_epick(2.) == EPICK::FT(2));
// assert(scce_to_epick((signed long long int)(1)) == true);
assert(scce_to_epick(2.) == 2.);
assert(scce_to_epick((signed long long int)(1)) == 1);
scce_to_epick(CORE::Expr(2.) == EPICK::FT(2));
#endif
// int* is not a fundamental type, so this goes through Enum_converter(bool)
assert(sci_to_epick(true) == true);
assert(sci_to_epick(false) == false);
assert(sci_to_epick(CGAL::ON_POSITIVE_SIDE) == CGAL::ON_POSITIVE_SIDE);
int a = 123;
int* a_ptr = &a;
CGAL_USE(a_ptr);
// assert(sci_to_epick(a_ptr) == a_ptr); // unauthorized since 'int*' isn't a fundamental type
// fundamental type, static assertion failure
// assert(sci_to_epeck(2.) == EPECK::FT(2));
assert(sci_to_epeck((signed char)('a')) == (signed char)('a'));
assert(epeck_to_epick(EPECK::FT(2)) == EPICK::FT(2));
// assert(epeck_to_epick(2.) == EPICK::FT(2));
assert(epeck_to_epick(2.) == 2.);
// Homogeneous
assert(shi_to_shd(2.) == 2.);