1# GMP perl module tests (part 2) 2 3# Copyright 2001 Free Software Foundation, Inc. 4# 5# This file is part of the GNU MP Library. 6# 7# The GNU MP Library is free software; you can redistribute it and/or modify 8# it under the terms of the GNU Lesser General Public License as published 9# by the Free Software Foundation; either version 3 of the License, or (at 10# your option) any later version. 11# 12# The GNU MP Library is distributed in the hope that it will be useful, but 13# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15# License for more details. 16# 17# You should have received a copy of the GNU Lesser General Public License 18# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 19 20 21# The following uses of :constants seem to provoke segvs in perl 5.005_03, 22# so they're kept separate file to be run only on suitable perl versions. 23 24 25use GMP::Mpz qw(:constants); 26{ 27 my $a = 123; 28 ok (UNIVERSAL::isa ($a, "GMP::Mpz")); 29} 30use GMP::Mpz qw(:noconstants); 31 32use GMP::Mpq qw(:constants); 33{ 34 my $a = 123; 35 ok (UNIVERSAL::isa ($a, "GMP::Mpq")); 36} 37use GMP::Mpq qw(:noconstants); 38 39use GMP::Mpf qw(:constants); 40{ 41 my $a = 123; 42 ok (UNIVERSAL::isa ($a, "GMP::Mpf")); 43} 44use GMP::Mpf qw(:noconstants); 45 46 47# compiled constants unchanged by clrbit etc when re-executed 48foreach (0, 1, 2) { 49 use GMP::Mpz qw(:constants); 50 my $a = 15; 51 my $b = 6; 52 use GMP::Mpz qw(:noconstants); 53 clrbit ($a, 0); 54 ok ($a == 14); 55 setbit ($b, 0); 56 ok ($b == 7); 57} 58 591; 60 61 62# Local variables: 63# perl-indent-level: 2 64# End: 65