32 #include "DGtal/kernel/PointVector.h"
33 #include "DGtal/kernel/IntegerConverter.h"
34 #include "DGtalCatch.h"
38 using namespace DGtal;
45 SCENARIO(
"Integer types sizes",
"[integer_conversions]" )
47 WHEN(
"Checking integral types" ) {
48 THEN(
"Integral types are progressive" ) {
53 REQUIRE(
sizeof(
int ) <=
sizeof(
long ) );
54 REQUIRE(
sizeof(
long ) <=
sizeof(
long long ) );
55 REQUIRE(
sizeof(
long long ) == 8 );
59 SCENARIO(
"IntegerConverter< 1, int32 >",
"[integer_conversions]" )
64 #ifdef WITH_BIGINTEGER
67 WHEN(
"Converting small integers" ) {
70 #ifdef WITH_BIGINTEGER
73 THEN(
"Their values are all identical" ) {
76 #ifdef WITH_BIGINTEGER
81 WHEN(
"Converting medium integers" ) {
84 THEN(
"The value is lost with a warning" ) {
90 SCENARIO(
"IntegerConverter< 1, int64 >",
"[integer_conversions]" )
95 #ifdef WITH_BIGINTEGER
98 WHEN(
"Converting 64bits integers" ) {
101 #ifdef WITH_BIGINTEGER
104 THEN(
"Only bigger integers are identical" ) {
108 #ifdef WITH_BIGINTEGER
112 THEN(
"It gives the same results with NumberTraits" ) {
115 #ifdef WITH_BIGINTEGER
120 #ifdef WITH_BIGINTEGER
128 #ifdef WITH_BIGINTEGER
129 SCENARIO(
"IntegerConverter< 1, BigInteger >",
"[integer_conversions]" )
135 big_int32 *= big_int32;
136 big_int64 *= big_int64;
137 big_bigint *= big_bigint;
138 WHEN(
"Converting big integers" ) {
143 detail::mpz_set_sll( b_prime.get_mpz_t(), big_int64 );
144 THEN(
"Only bigger integers are identical" ) {
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int64_t int64_t
signed 94-bit integer.
boost::int32_t int32_t
signed 32-bit integer.
mpz_class BigInteger
Multi-precision integer with GMP implementation.
----------— INTEGER/POINT CONVERSION SERVICES -----------------—
Aim: The traits class for all models of Cinteger.
SCENARIO("Integer types sizes", "[integer_conversions]")
REQUIRE(domain.isInside(aPoint))