New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0 <=> -1/2 #1406
Comments
From lewis@wall.org./perl6 -e 'say 0 <=> -1/2'
-1/2 is not close enough to 0 to warrant this result. |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S03-operators/comparison.t commit 1b64955d678116091d280fee482ec5f3bedc61df [t/spec] Test for RT 70664: Try <=> with rationals Inline Patchdiff --git a/t/spec/S03-operators/comparison.t b/t/spec/S03-operators/comparison.t
index cd60f36..4410a66 100644
--- a/t/spec/S03-operators/comparison.t
+++ b/t/spec/S03-operators/comparison.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 18;
+plan *;
# N.B.: relational ops are in relational.t
@@ -18,6 +18,19 @@ is(1 <=> 2, Order::Increase, '1 <=> 2 is increase');
is(2 <=> 1, Order::Decrease, '2 <=> 1 is decrease');
is('a' <=> '1', Order::Increase, '<=> is in numeric context');
+is 0 <=> -1, Order::Decrease, '0 <=> -1 is increase';
+is -1 <=> 0, Order::Increase, '-1 <=> 0 is decrease';
+#?rakudo 2 todo 'RT 70664'
+is 0 <=> -1/2, Order::Decrease, '0 <=> -1/2 is increase';
+is 0 <=> 1/2, Order::Increase, '0 <=> 1/2 is increase';
+#?rakudo 6 skip 'No suitable candidate found for cmp_num, with signature PP->I'
+is -1/2 <=> 0, Order::Increase, '-1/2 <=> 0 is decrease';
+is 1/2 <=> 0, Order::Decrease, '1/2 <=> 0 is decrease';
+is 1/2 <=> 1/2, Order::Same, '1/2 <=> 1/2 is same';
+is -1/2 <=> -1/2, Order::Same, '-1/2 <=> -1/2 is same';
+is 1/2 <=> -1/2, Order::Decrease, '1/2 <=> -1/2 is decrease';
+is -1/2 <=> 1/2, Order::Increase, '-1/2 <=> 1/2 is increase';
+
# leg comparison (Str)
is('a' leg 'a', Order::Same, 'a leg a is same');
is('a' leg 'b', Order::Increase, 'a leg b is increase');
@@ -33,4 +46,6 @@ is(1 cmp 2, Order::Increase, '1 cmp 2 is increase');
is(2 cmp 1, Order::Decrease, '2 cmp 1 is decrease');
is('a' cmp 1, Order::Decrease, '"a" cmp 1 is decrease'); # unspecced but P5 behavior
+done_testing;
+
# vim: ft=perl6 |
The RT System itself - Status changed from 'new' to 'open' |
From @moritzfixed now, and tests passing in S03-operators/comparison-simple.t |
@moritz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#70664 (status was 'resolved')
Searchable as RT70664$
The text was updated successfully, but these errors were encountered: