Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[spec] fudged and corrected range.t

git-svn-id: http://svn.pugscode.org/pugs@21123 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit ba2d31cf782e8202fcad3390771364f2c109761d 1 parent 26eada7
moritz authored
Showing with 32 additions and 27 deletions.
  1. +32 −27 S03-operators/range.t
View
59 S03-operators/range.t
@@ -16,8 +16,8 @@ is ~("a".."a"), "a", "(..) works on chars (2)";
is ~("b".."a"), "", "(..) works on chars (3)";
is ~("Y".."AB"), "Y Z AA AB", "(..) works on carried chars (3)";
-is ~('Y'..'z', 'Y Z', '(..) works on uppercase letter .. lowercase letter');
-is ~('Y'..'_', 'Y Z', '(..) works on letter .. non-letter');
+is ~('Y'..'z'), 'Y Z', '(..) works on uppercase letter .. lowercase letter';
+is ~('Y'..'_'), 'Y Z', '(..) works on letter .. non-letter';
#?rakudo skip "Can't parse '0.. ^10'"
isnt ~(0..^10), ~(0.. ^10), '(0..^10) is not the same as (0.. ^10)');
@@ -43,6 +43,7 @@ is ["a"^..^"z"], ["b".."y"], "double-exclusive string range (^..^) works";
is ['a'^..^'b'], [], "double-exclusive string range (^..^) can produce null range";
is ['a' ^..^ 'a'], [], "double-exclusive range (x ^..^ x) where x is a char";
+#?rakudo todo 'ranges with Num'
is 1.5 ~~ 1^..^2, Bool::True, "lazy evaluation of the range operator", :todo<bug>;
# Test the unary ^ operator
@@ -50,33 +51,37 @@ is ~(^5), "0 1 2 3 4", "unary ^num produces the range 0..^num";
is [^1], [0], "unary ^ on the boundary ^1 works";
is [^0], [], "unary ^0 produces null range";
-# Test with floats
-# 2006-12-05:
-# 16:16 <TimToady> ~(1.9 ^..^ 4.9) should produce 2.9, 3.9
-# 16:17 <pmichaud> and ~(1.9 ^..^ 4.5) would produce the same?
-# 16:17 <TimToady> yes
-is ~(1.1 .. 4) , "1.1 2.1 3.1", "range with float .min";
-is ~(1.9 .. 4) , "1.9 2.9 3.9", "range with float .min";
-is ~(1.1 ^.. 4), "2.1 3.1" , "bottom exclusive range of float";
-is ~(1.9 ^.. 4), "2.9 3.9" , "bottom exclusive range of float";
-
-is ~(1 .. 4.1) , "1 2 3 4", "range with float .max";
-is ~(1 .. 4.9) , "1 2 3 4", "range with float .max";
-is ~(1 ..^ 4.1), "1 2 3 4", "top exclusive range of float";
-is ~(1 ..^ 4.9), "1 2 3 4", "top exclusive range of float";
-
-is ~(1.1 .. 4.1), "1.1 2.1 3.1 4.1", "range with float .min/.max";
-is ~(1.9 .. 4.1), "1.9 2.9 3.9" , "range with float .min/.max";
-is ~(1.1 .. 4.9), "1.1 2.1 3.1 4.1", "range with float .min/.max";
-is ~(1.9 .. 4.9), "1.9 2.9 3.9 4.9", "range with float .min/.max";
-
-is ~(1.1 ^..^ 4.1), "2.1 3.1" , "both exclusive float range";
-is ~(1.9 ^..^ 4.1), "2.9 3.9" , "both exclusive float range";
-is ~(1.1 ^..^ 4.9), "2.1 3.1 4.1", "both exclusive float range";
-is ~(1.9 ^..^ 4.9), "2.9 3.9" , "both exclusive float range";
-is [1.1 ^..^ 1.1], [], "double-exclusive range (x ^..^ x) where x is a float";
+#?rakudo skip 'ranges with floats'
+{
+ # Test with floats
+ # 2006-12-05:
+ # 16:16 <TimToady> ~(1.9 ^..^ 4.9) should produce 2.9, 3.9
+ # 16:17 <pmichaud> and ~(1.9 ^..^ 4.5) would produce the same?
+ # 16:17 <TimToady> yes
+ is ~(1.1 .. 4) , "1.1 2.1 3.1", "range with float .min";
+ is ~(1.9 .. 4) , "1.9 2.9 3.9", "range with float .min";
+ is ~(1.1 ^.. 4), "2.1 3.1" , "bottom exclusive range of float";
+ is ~(1.9 ^.. 4), "2.9 3.9" , "bottom exclusive range of float";
+
+ is ~(1 .. 4.1) , "1 2 3 4", "range with float .max";
+ is ~(1 .. 4.9) , "1 2 3 4", "range with float .max";
+ is ~(1 ..^ 4.1), "1 2 3 4", "top exclusive range of float";
+ is ~(1 ..^ 4.9), "1 2 3 4", "top exclusive range of float";
+
+ is ~(1.1 .. 4.1), "1.1 2.1 3.1 4.1", "range with float .min/.max";
+ is ~(1.9 .. 4.1), "1.9 2.9 3.9" , "range with float .min/.max";
+ is ~(1.1 .. 4.9), "1.1 2.1 3.1 4.1", "range with float .min/.max";
+ is ~(1.9 .. 4.9), "1.9 2.9 3.9 4.9", "range with float .min/.max";
+
+ is ~(1.1 ^..^ 4.1), "2.1 3.1" , "both exclusive float range";
+ is ~(1.9 ^..^ 4.1), "2.9 3.9" , "both exclusive float range";
+ is ~(1.1 ^..^ 4.9), "2.1 3.1 4.1", "both exclusive float range";
+ is ~(1.9 ^..^ 4.9), "2.9 3.9" , "both exclusive float range";
+ is [1.1 ^..^ 1.1], [], "double-exclusive range (x ^..^ x) where x is a float";
+}
# Test that the operands are forced to scalar context
+#?rakudo skip 'MMD function __cmp not found for types (101, 95)'
{
my @one = (1,);
my @three = (1, 1, 1);
Please sign in to comment.
Something went wrong with that request. Please try again.