summaryrefslogtreecommitdiff
path: root/tests/cxx
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2007-09-24 17:19:27 +0200
committertege <tege@gmplib.org>2007-09-24 17:19:27 +0200
commit7f6e0a4930a18e221ea2d45d621bea82c9c9c34e (patch)
tree13f6076dca2ab33d5e59b8847b03226cc30a7be5 /tests/cxx
parent4c893cee7bc42b6f874b4729f7afc767512e8f34 (diff)
downloadgmp-7f6e0a4930a18e221ea2d45d621bea82c9c9c34e.tar.gz
Clean up spacing.
Diffstat (limited to 'tests/cxx')
-rw-r--r--tests/cxx/t-ostream.cc156
1 files changed, 78 insertions, 78 deletions
diff --git a/tests/cxx/t-ostream.cc b/tests/cxx/t-ostream.cc
index e27c3642b..0eeb7be62 100644
--- a/tests/cxx/t-ostream.cc
+++ b/tests/cxx/t-ostream.cc
@@ -30,27 +30,27 @@ using namespace std;
int option_check_standard = 0;
-#define CALL(expr) \
- do { \
- got.flags (data[i].flags); \
- got.width (data[i].width); \
- got.precision (data[i].precision); \
- if (data[i].fill == '\0') \
- got.fill (' '); \
- else \
- got.fill (data[i].fill); \
- \
- if (! (expr)) \
- { \
- cout << "\"got\" output error\n"; \
- abort (); \
- } \
- if (got.width() != 0) \
- { \
- cout << "\"got\" width not reset to 0\n"; \
- abort (); \
- } \
- \
+#define CALL(expr) \
+ do { \
+ got.flags (data[i].flags); \
+ got.width (data[i].width); \
+ got.precision (data[i].precision); \
+ if (data[i].fill == '\0') \
+ got.fill (' '); \
+ else \
+ got.fill (data[i].fill); \
+ \
+ if (! (expr)) \
+ { \
+ cout << "\"got\" output error\n"; \
+ abort (); \
+ } \
+ if (got.width() != 0) \
+ { \
+ cout << "\"got\" width not reset to 0\n"; \
+ abort (); \
+ } \
+ \
} while (0)
@@ -144,15 +144,15 @@ check_mpz (void)
: 1)
)
{
- ostringstream got;
- long n = mpz_get_si (z);
+ ostringstream got;
+ long n = mpz_get_si (z);
CALL (got << n);
if (got.str().compare (data[i].want) != 0)
{
cout << "check_mpz data[" << i
<< "] doesn't match standard ostream output\n";
- cout << " z: " << data[i].z << "\n";
- cout << " n: " << n << "\n";
+ cout << " z: " << data[i].z << "\n";
+ cout << " n: " << n << "\n";
DUMP ();
}
}
@@ -176,12 +176,12 @@ void
check_mpq (void)
{
static const struct {
- const char *q;
- const char *want;
+ const char *q;
+ const char *want;
ios::fmtflags flags;
- int width;
- int precision;
- char fill;
+ int width;
+ int precision;
+ char fill;
} data[] = {
@@ -208,7 +208,7 @@ check_mpq (void)
};
size_t i;
- mpq_t q;
+ mpq_t q;
mpq_init (q);
@@ -224,15 +224,15 @@ check_mpq (void)
&& mpz_fits_slong_p (mpq_numref(q))
&& mpq_integer_p (q))
{
- ostringstream got;
- long n = mpz_get_si (mpq_numref(q));
+ ostringstream got;
+ long n = mpz_get_si (mpq_numref(q));
CALL (got << n);
if (got.str().compare (data[i].want) != 0)
{
cout << "check_mpq data[" << i
<< "] doesn't match standard ostream output\n";
- cout << " q: " << data[i].q << "\n";
- cout << " n: " << n << "\n";
+ cout << " q: " << data[i].q << "\n";
+ cout << " n: " << n << "\n";
DUMP ();
}
}
@@ -257,56 +257,56 @@ void
check_mpf (void)
{
static const struct {
- const char *f;
- const char *want;
+ const char *f;
+ const char *want;
ios::fmtflags flags;
- int width;
- int precision;
- char fill;
+ int width;
+ int precision;
+ char fill;
} data[] = {
- { "0", "0", ios::dec },
- { "0", "+0", ios::dec | ios::showpos },
- { "0", "0.00000", ios::dec | ios::showpoint },
- { "0", "0", ios::dec | ios::fixed },
- { "0", "0.", ios::dec | ios::fixed | ios::showpoint },
+ { "0", "0", ios::dec },
+ { "0", "+0", ios::dec | ios::showpos },
+ { "0", "0.00000", ios::dec | ios::showpoint },
+ { "0", "0", ios::dec | ios::fixed },
+ { "0", "0.", ios::dec | ios::fixed | ios::showpoint },
{ "0", "0.000000e+00", ios::dec | ios::scientific },
{ "0", "0.000000e+00", ios::dec | ios::scientific | ios::showpoint },
-
- { "0", "0", ios::dec, 0, 4 },
- { "0", "0.000", ios::dec | ios::showpoint, 0, 4 },
- { "0", "0.0000", ios::dec | ios::fixed, 0, 4 },
- { "0", "0.0000", ios::dec | ios::fixed | ios::showpoint, 0, 4 },
+
+ { "0", "0", ios::dec, 0, 4 },
+ { "0", "0.000", ios::dec | ios::showpoint, 0, 4 },
+ { "0", "0.0000", ios::dec | ios::fixed, 0, 4 },
+ { "0", "0.0000", ios::dec | ios::fixed | ios::showpoint, 0, 4 },
{ "0", "0.0000e+00", ios::dec | ios::scientific, 0, 4 },
{ "0", "0.0000e+00", ios::dec | ios::scientific | ios::showpoint, 0, 4 },
-
- { "1", "1", ios::dec },
+
+ { "1", "1", ios::dec },
{ "1", "+1", ios::dec | ios::showpos },
{ "1", "1.00000", ios::dec | ios::showpoint },
- { "1", "1", ios::dec | ios::fixed },
+ { "1", "1", ios::dec | ios::fixed },
{ "1", "1.", ios::dec | ios::fixed | ios::showpoint },
{ "1", "1.000000e+00", ios::dec | ios::scientific },
{ "1", "1.000000e+00", ios::dec | ios::scientific | ios::showpoint },
-
- { "1", "1", ios::dec, 0, 4 },
- { "1", "1.000", ios::dec | ios::showpoint, 0, 4 },
- { "1", "1.0000", ios::dec | ios::fixed, 0, 4 },
- { "1", "1.0000", ios::dec | ios::fixed | ios::showpoint, 0, 4 },
+
+ { "1", "1", ios::dec, 0, 4 },
+ { "1", "1.000", ios::dec | ios::showpoint, 0, 4 },
+ { "1", "1.0000", ios::dec | ios::fixed, 0, 4 },
+ { "1", "1.0000", ios::dec | ios::fixed | ios::showpoint, 0, 4 },
{ "1", "1.0000e+00", ios::dec | ios::scientific, 0, 4 },
{ "1", "1.0000e+00", ios::dec | ios::scientific | ios::showpoint, 0, 4 },
- { "-1", "-1", ios::dec | ios::showpos },
+ { "-1", "-1", ios::dec | ios::showpos },
- { "-1", " -1", ios::dec, 4 },
- { "-1", "- 1", ios::dec | ios::internal, 4 },
- { "-1", "-1 ", ios::dec | ios::left, 4 },
+ { "-1", " -1", ios::dec, 4 },
+ { "-1", "- 1", ios::dec | ios::internal, 4 },
+ { "-1", "-1 ", ios::dec | ios::left, 4 },
- { "-1", " -0x1", ios::hex | ios::showbase, 6 },
- { "-1", "-0x 1", ios::hex | ios::showbase | ios::internal, 6 },
- { "-1", "-0x1 ", ios::hex | ios::showbase | ios::left, 6 },
+ { "-1", " -0x1", ios::hex | ios::showbase, 6 },
+ { "-1", "-0x 1", ios::hex | ios::showbase | ios::internal, 6 },
+ { "-1", "-0x1 ", ios::hex | ios::showbase | ios::left, 6 },
- { "1", "*********1", ios::dec, 10, 4, '*' },
+ { "1", "*********1", ios::dec, 10, 4, '*' },
{ "1234", "******1234", ios::dec, 10, 4, '*' },
{ "1234", "*****1234.", ios::dec | ios::showpoint, 10, 4, '*' },
@@ -316,12 +316,12 @@ check_mpf (void)
{ "1.9999999", "2", ios::dec, 0, 1 },
{ "1.0009999999", "1.001", ios::dec, 0, 4 },
- { "1.0001", "1", ios::dec, 0, 4 },
- { "1.0004", "1", ios::dec, 0, 4 },
+ { "1.0001", "1", ios::dec, 0, 4 },
+ { "1.0004", "1", ios::dec, 0, 4 },
{ "1.000555", "1.001", ios::dec, 0, 4 },
- { "1.0002", "1.000", ios::dec | ios::fixed, 0, 3 },
- { "1.0008", "1.001", ios::dec | ios::fixed, 0, 3 },
+ { "1.0002", "1.000", ios::dec | ios::fixed, 0, 3 },
+ { "1.0008", "1.001", ios::dec | ios::fixed, 0, 3 },
{ "0", "0", ios::hex },
{ "0", "0x0", ios::hex | ios::showbase },
@@ -351,13 +351,13 @@ check_mpf (void)
// octal showbase suppressed for 0
{ "0", "0", ios::oct | ios::showbase },
- { ".125", "00.1", ios::oct | ios::showbase, 0, 1 },
+ { ".125", "00.1", ios::oct | ios::showbase, 0, 1 },
{ ".015625", "00.01", ios::oct | ios::showbase, 0, 2 },
- { ".125", "00.1", ios::fixed | ios::oct | ios::showbase, 0, 1 },
- { ".015625", "0.0", ios::fixed | ios::oct | ios::showbase, 0, 1 },
+ { ".125", "00.1", ios::fixed | ios::oct | ios::showbase, 0, 1 },
+ { ".015625", "0.0", ios::fixed | ios::oct | ios::showbase, 0, 1 },
{ ".015625", "00.01", ios::fixed | ios::oct | ios::showbase, 0, 2 },
- { "0.125", "1.000000e-01", ios::oct | ios::scientific },
+ { "0.125", "1.000000e-01", ios::oct | ios::scientific },
{ "0.125", "+1.000000e-01", ios::oct | ios::scientific | ios::showpos },
{ "-0.125", "-1.000000e-01", ios::oct | ios::scientific },
{ "-0.125", "-1.000000e-01", ios::oct | ios::scientific | ios::showpos },
@@ -388,7 +388,7 @@ check_mpf (void)
};
size_t i;
- mpf_t f, f2;
+ mpf_t f, f2;
double d;
mpf_init (f);
@@ -403,14 +403,14 @@ check_mpf (void)
if (option_check_standard && mpf_cmp (f, f2) == 0
&& ! (data[i].flags & (ios::hex | ios::oct | ios::showbase)))
{
- ostringstream got;
+ ostringstream got;
CALL (got << d);
if (got.str().compare (data[i].want) != 0)
{
cout << "check_mpf data[" << i
<< "] doesn't match standard ostream output\n";
- cout << " f: " << data[i].f << "\n";
- cout << " d: " << d << "\n";
+ cout << " f: " << data[i].f << "\n";
+ cout << " d: " << d << "\n";
DUMP ();
}
}