Commit 965ff670 by Janis Johnson Committed by Janis Johnson

func-array.c: Support -DDBG to report individual failures.

	* gcc.dg/dfp/func-array.c: Support -DDBG to report individual failures.
	* gcc.dg/dfp/func-struct.c: Ditto.
	* gcc.dg/dfp/operator-assignment.c: Ditto.
	* gcc.dg/dfp/convert-bfp.c: Ditto.
	* gcc.dg/dfp/convert-int.c: Ditto.
	* gcc.dg/dfp/convert-int-max.c: Ditto.
	* gcc.dg/dfp/func-scalar.c: Ditto.
	* gcc.dg/dfp/cast.c: Ditto.
	* gcc.dg/dfp/func-mixed.c: Support -DDBG to report individual
	failures, and fix a typo in return type of arg1_128.
	* gcc.dg/dfp/convert-dfp.c: Support -DDBG to report individual
	failures, and fix a typo in a constant suffix.
	* gcc.dg/dfp/func-vararg-dfp.c: Return zero at the end.
	* gcc.dg/dfp/convert-complex.c: With -DDBG, abort for failures.

From-SVN: r124953
parent ba2f32a9
2007-05-22 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/dfp/func-array.c: Support -DDBG to report individual
failures.
* gcc.dg/dfp/func-struct.c: Ditto.
* gcc.dg/dfp/operator-assignment.c: Ditto.
* gcc.dg/dfp/convert-bfp.c: Ditto.
* gcc.dg/dfp/convert-int.c: Ditto.
* gcc.dg/dfp/convert-int-max.c: Ditto.
* gcc.dg/dfp/func-scalar.c: Ditto.
* gcc.dg/dfp/cast.c: Ditto.
* gcc.dg/dfp/func-mixed.c: Support -DDBG to report individual
failures, and fix a typo in return type of arg1_128.
* gcc.dg/dfp/convert-dfp.c: Support -DDBG to report individual
failures, and fix a typo in a constant suffix.
* gcc.dg/dfp/func-vararg-dfp.c: Return zero at the end.
* gcc.dg/dfp/convert-complex.c: With -DDBG, abort for failures.
2007-05-22 Janis Johnson <janis187@us.ibm.com>
Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* lib/gcc-dg.exp(process_message): New proc.
......@@ -4,6 +4,14 @@
Test valid casts involving decimal float. */
extern void abort (void);
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32;
_Decimal64 d64;
......@@ -21,19 +29,19 @@ main (void)
d128 = 1.2dl;
if (d32 != (_Decimal32) d64)
abort ();
FAILURE
if (d32 != (_Decimal32) d128)
abort ();
FAILURE
if (d64 != (_Decimal64) d32)
abort ();
FAILURE
if (d64 != (_Decimal64) d128)
abort ();
FAILURE
if (d128 != (_Decimal128) d32)
abort ();
FAILURE
if (d128 != (_Decimal128) d64)
abort ();
FAILURE
/* Casts between generic and decimal floating point types. Use a
value that we can assume can be represented exactly in all
......@@ -45,32 +53,35 @@ main (void)
/* To generic floating types. */
if ((float) d32 != 2.0f)
abort ();
FAILURE
if ((double) d32 != 2.0l)
abort ();
FAILURE
if ((float) d64 != 2.0f)
abort ();
FAILURE
if ((double) d64 != 2.0l)
abort ();
FAILURE
if ((float) d128 != 2.0f)
abort ();
FAILURE
if ((double) d128 != 2.0l)
abort ();
FAILURE
/* float to decimal floating types. */
if (d32 != (_Decimal32) f)
abort ();
FAILURE
if (d64 != (_Decimal64) f)
abort ();
FAILURE
if (d128 != (_Decimal128) f)
abort ();
FAILURE
/* double to decimal floating types. */
if (d32 != (_Decimal32) d)
abort ();
FAILURE
if (d64 != (_Decimal64) d)
abort ();
FAILURE
if (d128 != (_Decimal128) d)
FAILURE
if (failcnt != 0)
abort ();
return 0;
......
......@@ -7,6 +7,18 @@
/* Long double isn't supported yet at runtime, so disable those checks. */
#define SKIP_LONG_DOUBLE
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32;
volatile _Decimal64 d64;
volatile _Decimal128 d128;
......@@ -16,8 +28,6 @@ volatile double df;
volatile long double tf;
#endif
extern void abort (void);
int
main ()
{
......@@ -27,101 +37,104 @@ main ()
d32 = 2.0df;
sf = d32;
if (sf != 2.0f)
abort ();
FAILURE
df = d32;
if (df != 2.0)
abort ();
FAILURE
#ifndef SKIP_LONG_DOUBLE
tf = d32;
if (tf != 2.0l)
abort ();
FAILURE
#endif
/* Conversions from _Decimal64. */
d64 = -7.0dd;
sf = d64;
if (sf != -7.0f)
abort ();
FAILURE
df = d64;
if (df != -7.0)
abort ();
FAILURE
#ifndef SKIP_LONG_DOUBLE
tf = d64;
if (tf != -7.0l)
abort ();
FAILURE
#endif
/* Conversions from _Decimal128. */
d128 = 30.0dl;
sf = d128;
if (sf != 30.0f)
abort ();
FAILURE
df = d128;
if (df != 30.0)
abort ();
FAILURE
df = d128;
if (df != 30.0l)
abort ();
FAILURE
/* Conversions from binary float to decimal float. */
sf = 30.0f;
d32 = sf;
if (d32 != 30.0df)
abort ();
FAILURE
d64 = sf;
if (d64 != 30.0dd)
abort ();
FAILURE
df = -2.0;
d32 = df;
if (d32 != -2.0df)
abort ();
FAILURE
d64 = df;
if (d64 != -2.0dd)
abort ();
FAILURE
d128 = df;
if (d128 != -2.0dl)
abort ();
FAILURE
sf = 30.0f;
d128 = sf;
if (d128 != 30.0dl)
abort ();
FAILURE
#ifndef SKIP_LONG_DOUBLE
tf = -22.0l;
d32 = tf;
if (d32 != -22.0df)
abort ();
FAILURE
d64 = tf;
if (d64 != -22.0dd)
abort ();
FAILURE
d128 = tf;
if (d128 != -22.0dl)
abort ();
FAILURE
#endif
/* 2**(-11) = 0.00048828125. */
d128 = 0.000488281251dl;
sf = d128;
if (sf != 0.00048828125f)
abort ();
FAILURE
/* 2**(-25) = 0.298023223876953125E-7. */
d128 = 2.98023223876953125E-8dl;
df = d128;
if (df < (2.9802322387695312e-08 - 0.00000000001)
|| df > (2.9802322387695312e-08 + 0.00000000001))
FAILURE
if (failcnt != 0)
abort ();
return 0;
......
......@@ -5,7 +5,7 @@
extern void abort(void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
......@@ -124,5 +124,8 @@ main ()
if (d128 != 0.0625DL)
FAILURE
if (failcnt != 0)
abort ();
return 0;
}
......@@ -13,6 +13,16 @@
#include <float.h>
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32;
volatile _Decimal64 d64;
......@@ -25,29 +35,29 @@ main ()
d32 = 123.4df;
d64 = d32;
if (d64 != 123.4dd)
abort ();
FAILURE
d128 = d32;
if (d128 != 123.4dl)
abort ();
FAILURE
d64 = 345.678dd;
d128 = d64;
if (d128 != 345.678dl)
abort ();
FAILURE
/* Conversions to smaller types for which the value fits. */
d64 = 3456.789dd;
d32 = d64;
if (d32 != 3456.789df)
abort ();
FAILURE
d128 = 123.4567dl;
d32 = d128;
if (d32 != 123.4567dl)
abort ();
if (d32 != 123.4567df)
FAILURE
d128 = 1234567890.123456dl;
d64 = d128;
if (d64 != 1234567890.123456dd)
abort ();
FAILURE
/* Test demotion to non-representable decimal floating type. */
......@@ -59,37 +69,40 @@ main ()
d64 = 9.99999949E96DD;
d32 = d64;
if (d32 != DEC32_MAX)
abort();
FAILURE
/* Rounds to more than _Decimal32 can handle. */
d64 = 9.9999995E96DD;
d32 = d64;
if (d32 != __builtin_infd32())
abort();
FAILURE
/* Rounds to what _Decimal32 can handle. */
d128 = 9.99999949E96DD;
d32 = d128;
if (d32 != DEC32_MAX)
abort();
FAILURE
/* Rounds to more than _Decimal32 can handle. */
d128= 9.9999995E96DD;
d32 = d128;
if (d32 != __builtin_infd32())
abort();
FAILURE
/* Rounds to what _Decimal64 can handle. */
d128 = 9.99999999999999949E384DL;
d64 = d128;
if (d64 != DEC64_MAX)
abort();
FAILURE
/* Rounds to more than _Decimal64 can handle. */
d128 = 9.9999999999999995E384DL;
d64 = d128;
if (d64 != __builtin_infd64())
abort();
FAILURE
if (failcnt != 0)
abort ();
return 0;
}
......@@ -7,6 +7,14 @@
64-bit long long (there's a check for that below). */
extern void abort (void);
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32;
volatile _Decimal64 d64;
......@@ -24,112 +32,112 @@ doit ()
d32 = 2147483.E3DF;
si = d32;
if (si != 2147483000)
abort ();
FAILURE
d32 = -2147483.E3DF;
si = d32;
if (si != -2147483000)
abort ();
FAILURE
/* _Decimal32 to unsigned int. */
d32 = 4.294967E9DF;
ui = d32;
if (ui != 4294967000U)
abort ();
FAILURE
/* _Decimal32 to long long. */
d32 = 922.3372E16DF;
sll = d32;
if (sll != 9223372000000000000LL)
abort ();
FAILURE
d32 = -92233.72E14DF;
sll = d32;
if (sll != -9223372000000000000LL)
abort ();
FAILURE
/* _Decimal32 to unsigned long long. */
d32 = 0.1844674E20DF;
d32 = .1844674E20DF;
ull = d32;
if (ull != 18446740000000000000ULL)
abort ();
FAILURE
/* _Decimal64 to int. */
d64 = 2.147483647E9DD;
si = d64;
if (si != 2147483647)
abort ();
FAILURE
d64 = -2147483648.DD;
si = d64;
if (si != -2147483648)
abort ();
FAILURE
/* _Decimal64 to unsigned int. */
d64 = 42949.67295E5DD;
ui = d64;
if (ui != 4294967295)
abort ();
FAILURE
/* _Decimal64 to long long. */
d64 = 9.223372036854775E18DD;
sll = d64;
if (sll != 9223372036854775000LL)
abort ();
FAILURE
d64 = -92233720.36854775E11DD;
sll = d64;
if (sll != -9223372036854775000LL)
abort ();
FAILURE
/* _Decimal64 to unsigned long long. */
d64 = 1844674407370955.E4DD;
ull = d64;
if (ull != 18446744073709550000ULL)
abort ();
FAILURE
/* _Decimal128 to int. */
d128 = 2.147483647E9DL;
si = d128;
if (si != 2147483647)
abort ();
FAILURE
d128 = -2147483648.DL;
si = d128;
if (si != -2147483648)
abort ();
FAILURE
/* _Decimal128 to unsigned int. */
d128 = 4294.967295E6DL;
ui = d128;
if (ui != 4294967295)
abort ();
FAILURE
/* _Decimal128 to long long. */
d128 = 9223372036854775807.DL;
sll = d128;
if (sll != 9223372036854775807LL)
abort ();
FAILURE
d128 = -9.223372036854775808E19DL;
sll = d128;
if (sll != -9223372036854775807LL - 1LL)
abort ();
FAILURE
/* _Decimal128 to unsigned long long. */
d128 = 18446744073709551615.DL;
ull = d128;
if (ull != 18446744073709551615ULL)
abort ();
FAILURE
}
int
......@@ -141,5 +149,8 @@ main ()
return 0;
doit ();
if (failcnt != 0)
abort ();
return 0;
}
......@@ -4,6 +4,14 @@
C99 6.3.1.4(1a) New. */
extern void abort (void);
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32;
_Decimal64 d64;
......@@ -67,33 +75,33 @@ main ()
ui = d32;
if (ui != 456U)
abort ();
FAILURE
ul = d32;
if (ul != 456UL)
abort ();
FAILURE
ull = d32;
if (ull != 456ULL)
abort ();
FAILURE
ui = d64;
if (ui != 23U)
abort ();
FAILURE
ul = d64;
if (ul != 23UL)
abort ();
FAILURE
ull = d64;
if (ull != 23ULL)
abort ();
FAILURE
ui = d128;
if (ui != 1234U)
abort ();
FAILURE
ul = d128;
if (ul != 1234UL)
abort ();
FAILURE
ull = d128;
if (ull != 1234ULL)
abort ();
FAILURE
/* Decimal float to signed integer. */
......@@ -102,91 +110,94 @@ main ()
b = d32;
if (!b)
abort ();
FAILURE
b = d64;
if (!b)
abort ();
FAILURE
b = d128;
if (!b)
abort ();
FAILURE
/* Unsigned integer to decimal float. */
init_unsigned_int ();
d32 = ui;
if (d32 != 987.0df)
abort ();
FAILURE
d32 = ul;
if (d32 != 345678.0df)
abort ();
FAILURE
d32 = ull;
if (d32 != 1234567.df)
abort ();
FAILURE
d64 = ui;
if (d64 != 987.0dd)
abort ();
FAILURE
d64 = ul;
if (d64 != 345678.0dd)
abort ();
FAILURE
d64 = ull;
if (d64 != 1234567.dd)
abort ();
FAILURE
d128 = ui;
if (d128 != 987.0dl)
abort ();
FAILURE
d128 = ul;
if (d128 != 345678.0dl)
abort ();
FAILURE
d128 = ull;
if (d128 != 1234567.dl)
abort ();
FAILURE
/* Signed integer to decimal float. */
init_signed_int ();
d32 = si;
if (d32 != -987.0df)
abort ();
FAILURE
d32 = sl;
if (d32 != -345678.0df)
abort ();
FAILURE
d32 = sll;
if (d32 != -1234567.df)
abort ();
FAILURE
d64 = si;
if (d64 != -987.0dd)
abort ();
FAILURE
d64 = sl;
if (d64 != -345678.0dd)
abort ();
FAILURE
d64 = sll;
if (d64 != -1234567.dd)
abort ();
FAILURE
d128 = si;
if (d128 != -987.0dl)
abort ();
FAILURE
d128 = sl;
if (d128 != -345678.0dl)
abort ();
FAILURE
d128 = sll;
if (d128 != -1234567.dl)
abort ();
FAILURE
/* _Bool to decimal float. */
init_dfp_3 ();
b = d32;
if (b)
abort ();
FAILURE
b = d64;
if (b)
abort ();
FAILURE
b = d128;
if (b)
FAILURE
if (failcnt != 0)
abort ();
return 0;
......
......@@ -4,6 +4,16 @@
Test passing array elements involving decimal floating point types. */
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return the Nth _Decimal32 argument of
an incoming array. */
......@@ -132,28 +142,31 @@ int main()
_Decimal128 d128[] = { 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl };
/* _Decimal32 variants. */
if (arg0_32 (d32) != 0.0df) abort ();
if (arg1_32 (d32) != 1.0df) abort ();
if (arg2_32 (d32) != 2.0df) abort ();
if (arg3_32 (d32) != 3.0df) abort ();
if (arg4_32 (d32) != 4.0df) abort ();
if (arg5_32 (d32) != 5.0df) abort ();
if (arg0_32 (d32) != 0.0df) FAILURE
if (arg1_32 (d32) != 1.0df) FAILURE
if (arg2_32 (d32) != 2.0df) FAILURE
if (arg3_32 (d32) != 3.0df) FAILURE
if (arg4_32 (d32) != 4.0df) FAILURE
if (arg5_32 (d32) != 5.0df) FAILURE
/* _Decimal64 variants. */
if (arg0_64 (d64) != 0.0dd) abort ();
if (arg1_64 (d64) != 1.0dd) abort ();
if (arg2_64 (d64) != 2.0dd) abort ();
if (arg3_64 (d64) != 3.0dd) abort ();
if (arg4_64 (d64) != 4.0dd) abort ();
if (arg5_64 (d64) != 5.0dd) abort ();
if (arg0_64 (d64) != 0.0dd) FAILURE
if (arg1_64 (d64) != 1.0dd) FAILURE
if (arg2_64 (d64) != 2.0dd) FAILURE
if (arg3_64 (d64) != 3.0dd) FAILURE
if (arg4_64 (d64) != 4.0dd) FAILURE
if (arg5_64 (d64) != 5.0dd) FAILURE
/* _Decimal128 variants. */
if (arg0_128 (d128) != 0.0dl) abort ();
if (arg1_128 (d128) != 1.0dl) abort ();
if (arg2_128 (d128) != 2.0dl) abort ();
if (arg3_128 (d128) != 3.0dl) abort ();
if (arg4_128 (d128) != 4.0dl) abort ();
if (arg5_128 (d128) != 5.0dl) abort ();
if (arg0_128 (d128) != 0.0dl) FAILURE
if (arg1_128 (d128) != 1.0dl) FAILURE
if (arg2_128 (d128) != 2.0dl) FAILURE
if (arg3_128 (d128) != 3.0dl) FAILURE
if (arg4_128 (d128) != 4.0dl) FAILURE
if (arg5_128 (d128) != 5.0dl) FAILURE
if (failcnt != 0)
abort ();
return 0;
}
......@@ -5,6 +5,16 @@
point types. */
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth _Decimal32
argument with mixed types in parameter list. */
......@@ -106,7 +116,7 @@ arg0_128 (_Decimal128 arg0, int arg1, unsigned int arg2,
{
return arg0;
}
_Decimal32
_Decimal128
arg1_128 (int arg0, _Decimal128 arg1, unsigned int arg2,
float arg3, double arg4, long double arg5)
{
......@@ -147,28 +157,31 @@ int
main ()
{
/* _Decimal32 variants. */
if (arg0_32 (0.0df, -1, 2, 3.0f, 4.0, 5.0l) != 0.0df) abort ();
if (arg1_32 (0, 1.0df, 2, 3.0f, 4.0, 5.0l) != 1.0df) abort ();
if (arg2_32 (0, -1, 2.0df, 3.0f, 4.0, 5.0l) != 2.0df) abort ();
if (arg3_32 (0, -1, 2.0f, 3.0df, 4.0, 5.0l) != 3.0df) abort ();
if (arg4_32 (0, -1, 2.0f, 3.0, 4.0df, 5.0l) != 4.0df) abort ();
if (arg5_32 (0, -1, 2.0f, 3.0, 4.0l, 5.0df) != 5.0df) abort ();
if (arg0_32 (0.0df, -1, 2, 3.0f, 4.0, 5.0l) != 0.0df) FAILURE
if (arg1_32 (0, 1.0df, 2, 3.0f, 4.0, 5.0l) != 1.0df) FAILURE
if (arg2_32 (0, -1, 2.0df, 3.0f, 4.0, 5.0l) != 2.0df) FAILURE
if (arg3_32 (0, -1, 2.0f, 3.0df, 4.0, 5.0l) != 3.0df) FAILURE
if (arg4_32 (0, -1, 2.0f, 3.0, 4.0df, 5.0l) != 4.0df) FAILURE
if (arg5_32 (0, -1, 2.0f, 3.0, 4.0l, 5.0df) != 5.0df) FAILURE
/* _Decimal64 variants. */
if (arg0_64 (0.0dd, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dd) abort ();
if (arg1_64 (0, 1.0dd, 2, 3.0f, 4.0, 5.0l) != 1.0dd) abort ();
if (arg2_64 (0, -1, 2.0dd, 3.0f, 4.0, 5.0l) != 2.0dd) abort ();
if (arg3_64 (0, -1, 2.0f, 3.0dd, 4.0, 5.0l) != 3.0dd) abort ();
if (arg4_64 (0, -1, 2.0f, 3.0, 4.0dd, 5.0l) != 4.0dd) abort ();
if (arg5_64 (0, -1, 2.0f, 3.0, 4.0l, 5.0dd) != 5.0dd) abort ();
if (arg0_64 (0.0dd, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dd) FAILURE
if (arg1_64 (0, 1.0dd, 2, 3.0f, 4.0, 5.0l) != 1.0dd) FAILURE
if (arg2_64 (0, -1, 2.0dd, 3.0f, 4.0, 5.0l) != 2.0dd) FAILURE
if (arg3_64 (0, -1, 2.0f, 3.0dd, 4.0, 5.0l) != 3.0dd) FAILURE
if (arg4_64 (0, -1, 2.0f, 3.0, 4.0dd, 5.0l) != 4.0dd) FAILURE
if (arg5_64 (0, -1, 2.0f, 3.0, 4.0l, 5.0dd) != 5.0dd) FAILURE
/* _Decimal128 variants. */
if (arg0_128 (0.0dl, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dl) abort ();
if (arg1_128 (0, 1.0dl, 2, 3.0f, 4.0, 5.0l) != 1.0dl) abort ();
if (arg2_128 (0, -1, 2.0dl, 3.0f, 4.0, 5.0l) != 2.0dl) abort ();
if (arg3_128 (0, -1, 2.0f, 3.0dl, 4.0, 5.0l) != 3.0dl) abort ();
if (arg4_128 (0, -1, 2.0f, 3.0, 4.0dl, 5.0l) != 4.0dl) abort ();
if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) abort ();
if (arg0_128 (0.0dl, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dl) FAILURE
if (arg1_128 (0, 1.0dl, 2, 3.0f, 4.0, 5.0l) != 1.0dl) FAILURE
if (arg2_128 (0, -1, 2.0dl, 3.0f, 4.0, 5.0l) != 2.0dl) FAILURE
if (arg3_128 (0, -1, 2.0f, 3.0dl, 4.0, 5.0l) != 3.0dl) FAILURE
if (arg4_128 (0, -1, 2.0f, 3.0, 4.0dl, 5.0l) != 4.0dl) FAILURE
if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) FAILURE
if (failcnt != 0)
abort ();
return 0;
}
......@@ -5,6 +5,16 @@
point types. */
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth _Decimal32
argument. */
......@@ -150,44 +160,47 @@ main ()
{
/* _Decimal32 variants. */
if (arg0_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
abort ();
FAILURE
if (arg1_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
abort ();
FAILURE
if (arg2_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
abort ();
FAILURE
if (arg3_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
abort ();
FAILURE
if (arg4_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
abort ();
FAILURE
if (arg5_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
abort ();
FAILURE
/* _Decimal64 variants. */
if (arg0_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
abort ();
FAILURE
if (arg1_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
abort ();
FAILURE
if (arg2_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
abort ();
FAILURE
if (arg3_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
abort ();
FAILURE
if (arg4_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
abort ();
FAILURE
if (arg5_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
abort ();
FAILURE
/* _Decimal128 variants. */
if (arg0_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
abort ();
FAILURE
if (arg1_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
abort ();
FAILURE
if (arg2_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
abort ();
FAILURE
if (arg3_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
abort ();
FAILURE
if (arg4_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
abort ();
FAILURE
if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
FAILURE
if (failcnt != 0)
abort ();
return 0;
......
......@@ -5,6 +5,16 @@
point types. */
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
struct example
{
......@@ -79,17 +89,20 @@ ptr_dummy2_field (struct example *s)
int
main ()
{
if (d32_field (nums) != 3.0df) abort ();
if (d64_field (nums) != 2.0dd) abort ();
if (d128_field (nums) != 1.0dl) abort ();
if (dummy1_field (nums) != 'a') abort ();
if (dummy2_field (nums) != 'b') abort ();
if (ptr_d32_field (&nums) != 3.0df) abort ();
if (ptr_d64_field (&nums) != 2.0dd) abort ();
if (ptr_d128_field (&nums) != 1.0dl) abort ();
if (ptr_dummy1_field (&nums) != 'a') abort ();
if (ptr_dummy2_field (&nums) != 'b') abort ();
if (d32_field (nums) != 3.0df) FAILURE
if (d64_field (nums) != 2.0dd) FAILURE
if (d128_field (nums) != 1.0dl) FAILURE
if (dummy1_field (nums) != 'a') FAILURE
if (dummy2_field (nums) != 'b') FAILURE
if (ptr_d32_field (&nums) != 3.0df) FAILURE
if (ptr_d64_field (&nums) != 2.0dd) FAILURE
if (ptr_d128_field (&nums) != 1.0dl) FAILURE
if (ptr_dummy1_field (&nums) != 'a') FAILURE
if (ptr_dummy2_field (&nums) != 'b') FAILURE
if (failcnt != 0)
abort ();
return 0;
}
......@@ -106,4 +106,5 @@ int main()
if (failcnt != 0)
abort ();
return 0;
}
......@@ -6,10 +6,20 @@
float types cast to decimal float types. */
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
if (( OPRD1 OPRT OPRD2 )!= RLT) \
abort ();
FAILURE
#define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \
{ \
......@@ -54,5 +64,8 @@ main ()
DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
if (failcnt != 0)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment