Skip to content

Commit

Permalink
libc: re-enable tests for floats
Browse files Browse the repository at this point in the history
Re-enable tests related to issues #703, #704, #634, #652, #681

JIRA: RTOS-868
  • Loading branch information
jmaksymowicz committed Nov 7, 2024
1 parent c510830 commit b44e0dd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 181 deletions.
150 changes: 0 additions & 150 deletions libc/scanf/stdio_scanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,7 @@
#include <string.h>
#include <unistd.h>
#include <limits.h>


/*
* All tests for floats are disabled in this test of
* issues #652 and #634 which cause problems with scanning these values.
* #652 https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
* #634 https://github.com/phoenix-rtos/phoenix-rtos-project/issues/634
*/


/* Disabled because of #656 issue */
#ifndef __phoenix__
#include <float.h>
#endif

#include <unity_fixture.h>

Expand Down Expand Up @@ -2638,18 +2625,6 @@ TEST_TEAR_DOWN(stdio_scanf_aefg)

TEST(stdio_scanf_aefg, f)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%f %f %f %f %f %f %f";
Expand Down Expand Up @@ -2691,18 +2666,6 @@ TEST(stdio_scanf_aefg, f)

TEST(stdio_scanf_aefg, F)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%F %F %F %F %F %F %F";
Expand Down Expand Up @@ -2744,18 +2707,6 @@ TEST(stdio_scanf_aefg, F)

TEST(stdio_scanf_aefg, a)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%a %a %a %a %a %a %a";
Expand Down Expand Up @@ -2792,18 +2743,6 @@ TEST(stdio_scanf_aefg, a)

TEST(stdio_scanf_aefg, A)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%A %A %A %A %A %A %A";
Expand Down Expand Up @@ -2840,18 +2779,6 @@ TEST(stdio_scanf_aefg, A)

TEST(stdio_scanf_aefg, e)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%e %e %e %e %e %e %e";
Expand Down Expand Up @@ -2888,18 +2815,6 @@ TEST(stdio_scanf_aefg, e)

TEST(stdio_scanf_aefg, E)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%E %E %E %E %E %E %E";
Expand Down Expand Up @@ -2936,18 +2851,6 @@ TEST(stdio_scanf_aefg, E)

TEST(stdio_scanf_aefg, g)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%g %g %g %g %g %g %g";
Expand Down Expand Up @@ -2984,18 +2887,6 @@ TEST(stdio_scanf_aefg, g)

TEST(stdio_scanf_aefg, G)
{
/*
* <posix incmpliance> Scanf doesn't support longer floating-point numbers
* Problems occur when scanf needs to read big numbers after coma.
* example: 0.234234345345 scanf will read
* example 2.212121e-100 scanf won't read because this is along float after a coma.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/652
*/

#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
float fltMax, fltMaxH, zero, fltMin, negFltMax, negFltMaxH, negFltMin;
const char *format = "%G %G %G %G %G %G %G";
Expand Down Expand Up @@ -3032,15 +2923,6 @@ TEST(stdio_scanf_aefg, G)

TEST(stdio_scanf_aefg, inf_nan_f)
{
/*
* <posix incmpliance> Scanf Inf and Nan handling problem
* There is a problem with Scanf where it is unable to read any representation of valInf or valNan.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/634
*/
#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
double valInf, valNan, valNegInf;
const char *format = "%lf %lf %lf";
Expand Down Expand Up @@ -3088,15 +2970,6 @@ TEST(stdio_scanf_aefg, inf_nan_f)

TEST(stdio_scanf_aefg, inf_nan_a)
{
/*
* <posix incmpliance> Scanf Inf and Nan handling problem
* There is a problem with Scanf where it is unable to read any representation of valInf or valNan.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/634
*/
#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
double valInf, valNan, valNegInf;
const char *format = "%la %la %la";
Expand Down Expand Up @@ -3144,15 +3017,6 @@ TEST(stdio_scanf_aefg, inf_nan_a)

TEST(stdio_scanf_aefg, inf_nan_e)
{
/*
* <posix incmpliance> Scanf Inf and Nan handling problem
* There is a problem with Scanf where it is unable to read any representation of valInf or valNan.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/634
*/
#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
double valInf, valNan, valNegInf;
const char *format = "%le %le %le";
Expand Down Expand Up @@ -3200,15 +3064,6 @@ TEST(stdio_scanf_aefg, inf_nan_e)

TEST(stdio_scanf_aefg, inf_nan_g)
{
/*
* <posix incmpliance> Scanf Inf and Nan handling problem
* There is a problem with Scanf where it is unable to read any representation of valInf or valNan.
* Issue link: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/634
*/
#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN] = { 0 };
double valInf, valNan, valNegInf;
const char *format = "%lg %lg %lg";
Expand Down Expand Up @@ -4538,11 +4393,6 @@ TEST(stdio_scanf_rest, star)

TEST(stdio_scanf_rest, field_width)
{
/* Test ignored because of issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/681 */
#ifdef __phoenix__
TEST_IGNORE();
#endif

char buff[BUFF_LEN], valStr[BUFF_LEN], str[] = "LoreIpsumDolorSitAmet";
int intMax = 2147483647, intMin = -2147483647, valIntMin, valIntMax;
float fltMax = 3.40282347e+7F, fltMin = 3.40282347e-4F, valFltMin, valFltMax;
Expand Down
31 changes: 0 additions & 31 deletions libc/stdlib/stdlib_strto.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ TEST(stdlib_strto, strtod_basic)

TEST(stdlib_strto, strtod_basic_hex)
{
/* Disabled because of #703 issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/703 */
#ifdef __phoenix__
TEST_IGNORE_MESSAGE("#703 issue");
#endif
char *end;
const char *str[] = { "0X0.0P+0", "0X1.0P+0", "-0X1.0P+0", "0X1.0P-126", "0X1.FFFFFEP+127", "-0X1.0P-126", "-0X1.FFFFFEP+127" };
const double expected[] = { 0.0, 1, -1, FLT_MIN, FLT_MAX, -FLT_MIN, -FLT_MAX };
Expand All @@ -92,11 +88,6 @@ TEST(stdlib_strto, strtod_min_max)
TEST_ASSERT_EQUAL_DOUBLE(DBL_MAX, strtod("1.797693134862315e+308", NULL));
TEST_ASSERT_EQUAL_INT(0, errno);

/* Disabled because of #703 issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/703 */
#ifdef __phoenix__
TEST_IGNORE_MESSAGE("#703 issue");
#endif

errno = 0;
TEST_ASSERT_EQUAL_DOUBLE(DBL_MIN, strtod("0x1p-1022", NULL));
TEST_ASSERT_EQUAL_INT(0, errno);
Expand Down Expand Up @@ -127,10 +118,6 @@ TEST(stdlib_strto, strtof_basic)

TEST(stdlib_strto, strtof_basic_hex)
{
/* Disabled because of #703 issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/703 */
#ifdef __phoenix__
TEST_IGNORE_MESSAGE("#703 issue");
#endif
char *end;
const char *str[] = { "0X0.0P+0", "0X1.0P+0", "-0X1.0P+0", "0x1.81cd6e631f8a1p+13", "-0x1.81cd6e631f8a1p+13" };
const float expected[] = { 0.0, 1, -1, 12345.67890, -12345.67890 };
Expand All @@ -155,11 +142,6 @@ TEST(stdlib_strto, strtof_min_max)
TEST_ASSERT_EQUAL_FLOAT(FLT_MAX, strtof("3.40282347e+38", NULL));
TEST_ASSERT_EQUAL_INT(0, errno);

/* Disabled because of #703 issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/703 */
#ifdef __phoenix__
TEST_IGNORE_MESSAGE("#703 issue");
#endif

errno = 0;
TEST_ASSERT_EQUAL_FLOAT(FLT_MIN, strtof("0X1.0P-126", NULL));
TEST_ASSERT_EQUAL_INT(0, errno);
Expand Down Expand Up @@ -190,10 +172,6 @@ TEST(stdlib_strto, strtold_basic)

TEST(stdlib_strto, strtold_basic_hex)
{
/* Disabled because of #703 issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/703 */
#ifdef __phoenix__
TEST_IGNORE_MESSAGE("#703 issue");
#endif
char *end;
const char *str[] = { "0X0.0P+0", "0X1.0P+0", "-0X1.0P+0", "0X1.0P-126", "0X1.FFFFFEP+127", "-0X1.0P-126", "-0X1.FFFFFEP+127", "0x1p-1022", "0x1.fffffffffffffp+1023" };
const long double expected[] = { 0.0, 1, -1, FLT_MIN, FLT_MAX, -FLT_MIN, -FLT_MAX, DBL_MIN, DBL_MAX };
Expand Down Expand Up @@ -223,11 +201,6 @@ TEST(stdlib_strto, strtold_min_max)
TEST_ASSERT_EQUAL_DOUBLE(DBL_MAX, strtold("1.797693134862315e+308", NULL));
TEST_ASSERT_EQUAL_INT(0, errno);

/* Disabled because of #703 issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/703 */
#ifdef __phoenix__
TEST_IGNORE_MESSAGE("#703 issue");
#endif

errno = 0;
TEST_ASSERT_EQUAL_DOUBLE(DBL_MIN, strtold("0x1p-1022", NULL));
TEST_ASSERT_EQUAL_INT(0, errno);
Expand Down Expand Up @@ -697,10 +670,6 @@ TEST(stdlib_strto, strtoull_min_max)

TEST(stdlib_strto, inf_nan)
{
/* Disabled because of #704 issue: https://github.com/phoenix-rtos/phoenix-rtos-project/issues/704 */
#ifdef __phoenix__
TEST_IGNORE_MESSAGE("#704 issue");
#endif
char *end;
const char *str[] = { "Inf", "-Inf", "INF", "-INF", "NaN", "-NaN", "NAN", "-NAN" };
const double exp_double[] = { INFINITY, -INFINITY, INFINITY, -INFINITY, NAN, -NAN, NAN, -NAN };
Expand Down

0 comments on commit b44e0dd

Please sign in to comment.