Skip to content

Commit

Permalink
[t/spec] Add tests for Complex conversions via .Real, .Int, .Rat, .Nu…
Browse files Browse the repository at this point in the history
…m, and .Complex.

git-svn-id: http://svn.pugscode.org/pugs@31186 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
colomon committed Jun 10, 2010
1 parent 6adb282 commit 4e37e94
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions S32-num/complex.t
Expand Up @@ -36,6 +36,17 @@ is_approx( (eval (1+0i).perl), 1, 'eval (1+0i).perl is 1' );
isa_ok( eval((3i).perl), Complex, 'eval (3i).perl is Complex' );
is_approx( (eval (3i).perl), 3i, 'eval (3i).perl is 3i' );

ok (1+0i).Real ~~ Real, "(1+0i).Real is a Real";
is (1+0i).Real, 1, "(1+0i).Real is 1";
isa_ok (1.2+0i).Int, Int, "(1.2+0i).Int is an Int";
is (1.2+0i).Int, 1, "(1.2+0i).Int is 1";
isa_ok (1.2.sin+0i).Rat, Rat, "(1.2.sin+0i).Rat is an Rat";
is_approx (1.2.sin+0i).Rat, 1.2.sin, "(1.2.sin+0i).Rat is 1.2.sin";
isa_ok (1.2+0i).Num, Num, "(1.2+0i).Num is an Num";
is_approx (1.2+0i).Num, 1.2, "(1.2+0i).Num is 1.2";
isa_ok (1.2+1i).Complex, Complex, "(1.2+1i).Complex is an Complex";
is_approx (1.2+1i).Complex, 1.2+1i, "(1.2+1i).Complex is 1.2+1i";

# MUST: test .Str

my @examples = (0i, 1 + 0i, -1 + 0i, 1i, -1i, 2 + 0i, -2 + 0i, 2i, -2i,
Expand Down

0 comments on commit 4e37e94

Please sign in to comment.