~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/gmp/demos/perl/test2.pl

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2006-05-17 02:46:26 UTC
  • Revision ID: james.westby@ubuntu.com-20060517024626-lljr08ftv9g9vefl
Tags: upstream-0.9h-20060510
ImportĀ upstreamĀ versionĀ 0.9h-20060510

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 2.1 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; see the file COPYING.LIB.  If not, write to
 
19
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
20
# MA 02111-1307, USA.
 
21
 
 
22
 
 
23
# The following uses of :constants seem to provoke segvs in perl 5.005_03,
 
24
# so they're kept separate file to be run only on suitable perl versions.
 
25
 
 
26
 
 
27
use GMP::Mpz qw(:constants);
 
28
{
 
29
  my $a = 123;
 
30
  ok (UNIVERSAL::isa ($a, "GMP::Mpz"));
 
31
}
 
32
use GMP::Mpz qw(:noconstants);
 
33
  
 
34
use GMP::Mpq qw(:constants);
 
35
{
 
36
  my $a = 123;
 
37
  ok (UNIVERSAL::isa ($a, "GMP::Mpq"));
 
38
}
 
39
use GMP::Mpq qw(:noconstants);
 
40
  
 
41
use GMP::Mpf qw(:constants);
 
42
{
 
43
  my $a = 123;
 
44
  ok (UNIVERSAL::isa ($a, "GMP::Mpf"));
 
45
}
 
46
use GMP::Mpf qw(:noconstants);
 
47
 
 
48
 
 
49
# compiled constants unchanged by clrbit etc when re-executed
 
50
foreach (0, 1, 2) {
 
51
  use GMP::Mpz qw(:constants);
 
52
  my $a = 15;
 
53
  my $b = 6;
 
54
  use GMP::Mpz qw(:noconstants);
 
55
  clrbit ($a, 0);
 
56
  ok ($a == 14);
 
57
  setbit ($b, 0);
 
58
  ok ($b == 7);
 
59
}
 
60
 
 
61
1;
 
62
 
 
63
 
 
64
# Local variables:
 
65
# perl-indent-level: 2
 
66
# End: