summaryrefslogtreecommitdiff
path: root/gmp/tests/cxx/t-assign.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gmp/tests/cxx/t-assign.cc')
-rw-r--r--gmp/tests/cxx/t-assign.cc116
1 files changed, 14 insertions, 102 deletions
diff --git a/gmp/tests/cxx/t-assign.cc b/gmp/tests/cxx/t-assign.cc
index ad10edd8a8..407f726265 100644
--- a/gmp/tests/cxx/t-assign.cc
+++ b/gmp/tests/cxx/t-assign.cc
@@ -1,21 +1,21 @@
/* Test mp*_class assignment operators.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-The GNU MP Library test suite is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 3 of the License,
-or (at your option) any later version.
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
-The GNU MP Library test suite is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-Public License for more details.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
-You should have received a copy of the GNU General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "config.h"
@@ -27,8 +27,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-using std::string;
-using std::invalid_argument;
+using namespace std;
void
@@ -186,35 +185,6 @@ check_mpz (void)
} catch (invalid_argument) {
}
}
-
- // swap(mpz_class &)
- {
- mpz_class a(123);
- mpz_class b(456);
- a.swap(b);
- a.swap(a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
-
- // swap(mpz_class &, mpz_class &)
- {
- mpz_class a(123);
- mpz_class b(456);
- ::swap(a, b);
- ::swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
- {
- using std::swap;
- mpz_class a(123);
- mpz_class b(456);
- swap(a, b);
- swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
}
void
@@ -287,7 +257,7 @@ check_mpq (void)
// operator=(unsigned short int)
{
unsigned short int a = 54321u;
- mpq_class b;
+ mpz_class b;
b = a; ASSERT_ALWAYS(b == 54321u);
}
@@ -372,35 +342,6 @@ check_mpq (void)
} catch (invalid_argument) {
}
}
-
- // swap(mpq_class &)
- {
- mpq_class a(3, 2);
- mpq_class b(-1, 4);
- a.swap(b);
- a.swap(a);
- ASSERT_ALWAYS(a == -.25);
- ASSERT_ALWAYS(b == 1.5);
- }
-
- // swap(mpq_class &, mpq_class &)
- {
- mpq_class a(3, 2);
- mpq_class b(-1, 4);
- ::swap(a, b);
- ::swap(a, a);
- ASSERT_ALWAYS(a == -.25);
- ASSERT_ALWAYS(b == 1.5);
- }
- {
- using std::swap;
- mpq_class a(3, 2);
- mpq_class b(-1, 4);
- swap(a, b);
- swap(a, a);
- ASSERT_ALWAYS(a == -.25);
- ASSERT_ALWAYS(b == 1.5);
- }
}
void
@@ -558,35 +499,6 @@ check_mpf (void)
} catch (invalid_argument) {
}
}
-
- // swap(mpf_class &)
- {
- mpf_class a(123);
- mpf_class b(456);
- a.swap(b);
- a.swap(a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
-
- // swap(mpf_class &, mpf_class &)
- {
- mpf_class a(123);
- mpf_class b(456);
- ::swap(a, b);
- ::swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
- {
- using std::swap;
- mpf_class a(123);
- mpf_class b(456);
- swap(a, b);
- swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
}