Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pugs fudge

  • Loading branch information...
commit 29e16b6420f740d27d06ea0a3865256e77070d1c 1 parent ede6fd4
@coke coke authored
View
17 S03-operators/precedence.t
@@ -46,13 +46,16 @@ is(?2*2, 2, "binary -> numify causes reinterpretation as, binds tighter than *")
# multiplicative
is(4 + 3 * 2, 10, "* binds tighter than binary +");
+#?pugs skip 'div'
is(2 - 2 div 2, 1, "div binds tighter than binary -");
is(2 - 2 / 2, 1 / 1, "/ binds tighter than binary -");
# additive
is(1 ~ 2 * 3, 16, "~ binds looser than *");
+#?pugs skip 'autothread'
ok(?((1 ~ 2 & 12) == 12), "but tighter than &");
+#?pugs skip 'autothread'
ok(?((2 + 2 | 4 - 1) == 4), "and + binds tighter than |");
# replication
@@ -63,10 +66,12 @@ is((2 x 2) + 3, 25, "doublecheck");
# concatenation
is(2 x 2 ~ 3, "223", "x binds tighter than binary ~");
+#?pugs skip 'autothread'
ok(?((2 ~ 2 | 4 ~ 1) == 41), "and ~ binds tighter than |");
# junctive and
+#?pugs 4 skip 'autothread'
ok( ?( (1 & 2 | 3) ==3), '& binds tighter than |');
ok((!(1 & 2 | 3) < 2), "ditto");
ok(?((1 & 2 ^ 3) < 3), "and also ^");
@@ -75,16 +80,19 @@ ok(?(!(1 & 2 ^ 4) != 3), "blah blah blah");
# junctive or
#?rakudo todo 'non-associativeness of infix:<^> and |'
+#?pugs skip 'autothread, Mu'
{ # test that | and ^ are on the same level but parsefail
eval_dies_ok 'my Mu $a = (1 | 2 ^ 3)', '| and ^ may not associate';
eval_dies_ok 'my Mu $a = (1 ^ 2 | 3)', '^ and | may not associate';
};
+#?pugs skip 'autothread, Mu'
{
my Mu $a = (abs -1 ^ -1); # read as abs(-1 ^ -1) -> (1^1)
ok(!($a == 1), 'junctive or binds more tightly then abs (1)');
}
+#?pugs skip 'Mu'
{
my Mu $b = ((abs -1) ^ -1); # -> (1 ^ -1)
ok($b == 1, "this is true because only one is == 1");
@@ -135,6 +143,7 @@ is((1 && 0 ?? 2 !! 3), 3, "&& binds tighter than ??");
# loose unary
my $x;
+#?pugs skip 'wrong precedence'
is((so $x = 42), True, "item assignment is tighter than true");
# comma
@@ -143,10 +152,10 @@ is(((not 1,42)[1]), 42, "not is tighter than comma");
# list infix
-#?pugs todo 'list infix and assignment'
{
my @d;
ok (@d = 1,3 Z 2,4), "list infix tighter than list assignment, looser t than comma";
+ #?pugs todo 'list infix and assignment'
is(@d, [1 .. 4], "to complicate things further, it dwims");
}
@@ -158,6 +167,7 @@ is(((not 1,42)[1]), 42, "not is tighter than comma");
# list prefix
+#?pugs skip 'authothread'
{
my $c = any 1, 2 Z 3, 4;
ok($c == 3, "any is less tight than comma and Z");
@@ -192,10 +202,11 @@ is(@c, [1,2,3], "@ = binds looser than ,");
# http://irclog.perlgeek.de/perl6/2009-07-14#i_1316200
#
# so uc(False) stringifies False to 'FALSE', and uc('0') is false. Phew.
+#?pugs skip 'Bool.Str'
is (uc "a" eq "A"), uc(False.Str), "uc has the correct precedence in comparison to eq";
# L<S03/Named unary precedence/my $i = int $x; # ILLEGAL>
-
+#?pugs todo
eval_dies_ok 'int 4.5', 'there is no more prefix:<int>';
@@ -207,11 +218,13 @@ ok ((1 => 2 => 3).value ~~ Pair), '=> is right-assoc (2)';
# L<S03/Operator precedence/only works between identical operators>
#?rakudo todo 'list associativity bug'
+#?pugs todo
eval_dies_ok '1, 2 Z 3, 4 X 5, 6',
'list associativity only works between identical operators';
#?rakudo skip 'nom regression'
#?niecza skip 'assigning to readonly value'
+#?pugs todo
{
# Check a 3 != 3 vs 3 !=3 parsing issue that can cropped up in Rakudo.
# Needs careful following of STD to get it right. :-)
View
9 S09-autovivification/autovivification.t
@@ -8,7 +8,6 @@ plan 42;
{
my %hash;
%hash<a>;
- #?pugs todo: 'perl #61882'
ok !%hash.exists('a'), 'just mentioning a hash value should not autovivify it';
}
@@ -65,6 +64,7 @@ plan 42;
#?rakudo skip 'autoviv with push/unshift'
#?niecza skip 'Unable to resolve method push in class Any'
+#?pugs todo
{
my %hash;
@@ -83,10 +83,10 @@ plan 42;
$hashref<key> = 23;
is $hashref<key>, 23, "hash element assignment worked";
#?niecza skip 'No value for parameter \$other in CORE Any.isa'
+ #?pugs skip 'isa multi variant'
ok $hashref.isa !~~ Hash, "uninitialized variable was autovivified to a hash (1)";
}
-#?pugs todo: 'The lives_ok items are failing'
{
my $hashref;
ok $hashref !~~ Hash, "uninitialized variable is not a Hash (2)";
@@ -96,14 +96,15 @@ plan 42;
# ... value extraction does not autovivify.
lives_ok { my $elem = $hashref<key> },
"accessing a not existing hash element of an uninitialized variable works";
+ #?pugs todo
ok $hashref !~~ Hash, "uninitialized variable is not autovivified to a hash (2)";
my $hashref2;
lives_ok { my $elem2 = $hashref2<key2><a><b><c><d><e><f> },
"accessing a not existing hash element of an uninitialized variable works (2)";
+ #?pugs 2 todo
ok $hashref2 !~~ Hash, "uninitialized variable is not autovivified to a hash (3)";
ok $hashref2<key2><a><b><c><d><e> !~~ Hash, "uninitialized variable is not autovivified to a hash (4)";
-
}
{
@@ -140,11 +141,13 @@ plan 42;
# ... value extraction does not autovivify.
lives_ok { my $elem = $arrayref[42] },
"accessing a not existing array element of an uninitialized variable works";
+ #?pugs todo
ok !$arrayref.isa(Array), "uninitialized variable was not autovivified to an array (2)";
my $arrayref2;
lives_ok { my $elem = $arrayref2[1][2][3][4][5][6] },
"accessing a not existing array element of an uninitialized variable works";
+ #?pugs 2 todo
ok !$arrayref2.isa(Array), "uninitialized variable was not autovivified to an array (3)";
ok !$arrayref2[1][2][3][4][5].isa(Array), "uninitialized variable was not autovivified to an array (4)";
}
View
11 S32-num/power.t
@@ -20,8 +20,10 @@ is((-2) ** 2, 4, "-2 ** 2 = 4");
#?niecza todo '#87'
is(1 ** Inf, 1, '1**Inf=1');
is(0 ** Inf, 0, '0**Inf=0');
+#?pugs 2 todo
is(Inf ** 2, Inf, 'Inf**2 = Inf');
is((-Inf) ** 3, -Inf, '(-Inf)**3 = -Inf');
+#?pugs skip 'hangs'
is(Inf ** Inf, Inf, 'Inf**Inf = Inf');
is(NaN ** 2, NaN, "NaN propagates with integer powers");
is(NaN ** 3.14, NaN, "NaN propagates with numeric powers");
@@ -47,19 +49,27 @@ is_approx(exp(1) ** 2.5, exp(2.5), "e ** 2.5 == exp(2.5)");
# Complex ** Real
# These work by accident even if you don't have Complex **
is_approx((4 + 0i) ** 2, 4 ** 2, "(4+0i) ** 2 == 16");
+#?pugs todo
is_approx(1i ** 4, 1, "i ** 4 == 1");
is_approx((4 + 0i) ** .5, 2, "(4+0i) ** .5 == 2");
+#?pugs todo
is_approx(1i ** 2, -1, "i ** 2 == -1");
+#?pugs todo
is_approx(1i ** 3, -1i, "i ** 3 == -i");
+#?pugs todo
is_approx(5i ** 3, -125i, "5i ** 3 = -125i");
+#?pugs todo
is_approx(3i ** 3, -27i, "3i ** 3 = -27i");
+#?pugs todo
is_approx((-3i) ** 3, 27i, "-3i ** 3 = 27i");
#?rakudo skip 'i'
+#?pugs skip 'i'
is_approx (-1) ** -i, 23.1406926327793, "(-1) ** -i is approx 23.1406926327793";
#?DOES 4
+#?pugs skip '.roots'
{
for (8i).roots(4) -> $z {
is_approx($z ** 4, 8i, "quartic root of 8i ** 4 = 8i");
@@ -68,6 +78,7 @@ is_approx (-1) ** -i, 23.1406926327793, "(-1) ** -i is approx 23.1406926327793";
#?DOES 1
# Real ** Complex
+#?pugs todo
{
is_approx(exp(1) ** (pi * 1i), -1, "e ** pi i = -1");
}
Please sign in to comment.
Something went wrong with that request. Please try again.