d06 change test output again

This commit is contained in:
Hugo LAMY
2022-03-17 15:03:39 +01:00
parent a7386b882e
commit f4566f828b
4 changed files with 100 additions and 13 deletions

Binary file not shown.

View File

@@ -28,7 +28,6 @@ template <typename T> void toDouble(T value);
#define MAX_INT "2147483647"
#define MIN_INT "-2147483648"
#define MAX_INT_1 "2147483648"
#define MIN_INT_1 "-2147483649"
#define INT_MAX_LENGTH 10
#define MAX_FLOAT_INT_PRECISION "16777216"
#define MAX_FLOAT "340282346638528859811704183484516925440"
@@ -38,6 +37,27 @@ template <typename T> void toDouble(T value);
#define DOUBLE_MAX_LENGTH 309
// for tests
#define MAX_I__5 "2147483642"
#define MAX_I__4 "2147483643"
#define MAX_I__3 "2147483644"
#define MAX_I__2 "2147483645"
#define MAX_I__1 "2147483646"
#define MAX_I_2 "2147483649"
#define MAX_I_3 "2147483650"
#define MAX_I_4 "2147483651"
#define MAX_I_5 "2147483652"
#define MIN_I__5 "-2147483643"
#define MIN_I__4 "-2147483644"
#define MIN_I__3 "-2147483645"
#define MIN_I__2 "-2147483646"
#define MIN_I__1 "-2147483647"
#define MIN_I_1 "-2147483649"
#define MIN_I_2 "-2147483650"
#define MIN_I_3 "-2147483651"
#define MIN_I_4 "-2147483652"
#define MIN_I_5 "-2147483653"
#define MAX_FLOAT_INT_PREC__1 "16777215"
#define MAX_FLOAT_INT_PREC__2 "16777214"
#define MAX_FLOAT_INT_PREC__3 "16777213"

View File

@@ -137,10 +137,33 @@ int main(int ac, char **av) {
convert("256");
convert("257");
convert("258");
convert(MAX_INT);
std::cout << "\n\n" B_PURPLE "[min - max int]" RESET "\n";
convert(MIN_I_5);
convert(MIN_I_4);
convert(MIN_I_3);
convert(MIN_I_2);
convert(MIN_I_1);
convert(MIN_INT);
convert(MIN_I__1);
convert(MIN_I__2);
convert(MIN_I__3);
convert(MIN_I__4);
convert(MIN_I__5);
convert(MAX_I__5);
convert(MAX_I__4);
convert(MAX_I__3);
convert(MAX_I__2);
convert(MAX_I__1);
convert(MAX_INT);
convert(MAX_INT_1);
convert(MIN_INT_1);
convert(MAX_I_2);
convert(MAX_I_3);
convert(MAX_I_4);
convert(MAX_I_5);
std::cout << "\n" B_PURPLE "[END min - max int]" RESET "\n\n";
convert(MAX_FLOAT_INT_PRECISION);
convert(MAX_FLOAT_INT_PREC__1);
convert(MAX_FLOAT_INT_PREC__2);
@@ -162,10 +185,33 @@ int main(int ac, char **av) {
convert("-inff");
convert("+inff");
convert("nanf");
convert(MAX_INT".0f");
convert(MIN_INT".0f");
convert(MAX_INT_1".0f");
convert(MIN_INT_1".0f");
std::cout << "\n\n" B_PURPLE "[min - max int]" RESET "\n";
convert(MIN_I_5 ".0f");
convert(MIN_I_4 ".0f");
convert(MIN_I_3 ".0f");
convert(MIN_I_2 ".0f");
convert(MIN_I_1 ".0f");
convert(MIN_INT ".0f");
convert(MIN_I__1 ".0f");
convert(MIN_I__2 ".0f");
convert(MIN_I__3 ".0f");
convert(MIN_I__4 ".0f");
convert(MIN_I__5 ".0f");
convert(MAX_I__5 ".0f");
convert(MAX_I__4 ".0f");
convert(MAX_I__3 ".0f");
convert(MAX_I__2 ".0f");
convert(MAX_I__1 ".0f");
convert(MAX_INT ".0f");
convert(MAX_INT_1 ".0f");
convert(MAX_I_2 ".0f");
convert(MAX_I_3 ".0f");
convert(MAX_I_4 ".0f");
convert(MAX_I_5 ".0f");
std::cout << "\n" B_PURPLE "[END min - max int]" RESET "\n\n";
convert(MAX_FLOAT_INT_PRECISION".0f");
convert(MAX_FLOAT_INT_PREC__1".0f");
convert(MAX_FLOAT_INT_PREC__2".0f");
@@ -199,10 +245,33 @@ int main(int ac, char **av) {
convert("-inf");
convert("+inf");
convert("nan");
convert(MAX_INT".0");
convert(MIN_INT".0");
convert(MAX_INT_1".0");
convert(MIN_INT_1".0");
std::cout << "\n\n" B_PURPLE "[min - max int]" RESET "\n";
convert(MIN_I_5 ".0");
convert(MIN_I_4 ".0");
convert(MIN_I_3 ".0");
convert(MIN_I_2 ".0");
convert(MIN_I_1 ".0");
convert(MIN_INT ".0");
convert(MIN_I__1 ".0");
convert(MIN_I__2 ".0");
convert(MIN_I__3 ".0");
convert(MIN_I__4 ".0");
convert(MIN_I__5 ".0");
convert(MAX_I__5 ".0");
convert(MAX_I__4 ".0");
convert(MAX_I__3 ".0");
convert(MAX_I__2 ".0");
convert(MAX_I__1 ".0");
convert(MAX_INT ".0");
convert(MAX_INT_1 ".0");
convert(MAX_I_2 ".0");
convert(MAX_I_3 ".0");
convert(MAX_I_4 ".0");
convert(MAX_I_5 ".0");
std::cout << "\n" B_PURPLE "[END min - max int]" RESET "\n\n";
convert(MAX_FLOAT_INT_PRECISION".0");
convert(MAX_FLOAT_INT_PREC__1".0");
convert(MAX_FLOAT_INT_PREC__2".0");

View File

@@ -22,8 +22,6 @@ void toChar(T value) {
template <typename T>
void toInt(T value) {
std::cout << std::setw(7) << std::left << "int";
// if (value < std::numeric_limits<int>::min()
// || value > std::numeric_limits<int>::max() )
if (! (value <= std::numeric_limits<int>::max()
&& value >= std::numeric_limits<int>::min()) )
{