Permalink
Browse files

[t/spec] Infinity tests moved to S02-builtin-types

git-svn-id: http://svn.pugscode.org/pugs@20238 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 6794d4b commit 2aafe5085bf814b31adb76cde9f9f9321d207fce cosimo committed Apr 5, 2008
Showing with 38 additions and 0 deletions.
  1. +38 −0 S02-builtin_data_types/infinity.t
@@ -0,0 +1,38 @@
+use v6-alpha;
+use Test;
+plan 8;
+
+# L<S02/"Built-In Data Types" /Perl 6 should by default make standard IEEE floating point concepts visible>
+
+{
+ my $x = Inf;
+
+ cmp_ok( $x, &infix:<==>, Inf, 'numeric equal' );
+ cmp_ok( $x, &infix:<eq>, 'Inf', 'string equal' );
+}
+
+{
+ my $x = -Inf;
+ cmp_ok( $x, &infix:<==>, -Inf, 'negative numeric equal' );
+ cmp_ok( $x, &infix:<eq>, '-Inf', 'negative string equal' );
+}
+
+{
+ my $x = int( Inf );
+ cmp_ok( $x, &infix:<==>, Inf, 'int numeric equal' );
+ cmp_ok( $x, &infix:<eq>, 'Inf', 'int string equal', :todo<bug> );
+}
+
+{
+ my $x = int( -Inf );
+ cmp_ok( $x, &infix:<==>, -Inf, 'int negative numeric equal');
+ cmp_ok( $x, &infix:<eq>, '-Inf', 'int negative string equal', :todo<bug> );
+}
+
+# Inf should == Inf. Additionally, Inf's stringification (~Inf), "Inf", should
+# eq to the stringification of other Infs.
+# Thus:
+# Inf == Inf # true
+# and:
+# Inf eq Inf # same as
+# ~Inf eq ~Inf # true

0 comments on commit 2aafe50

Please sign in to comment.