Navigation Menu

Skip to content
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

Closed
p6rt opened this issue Nov 20, 2009 · 5 comments
Closed

0 <=> -1/2 #1406

p6rt opened this issue Nov 20, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Nov 20, 2009

Migrated from rt.perl.org#70664 (status was 'resolved')

Searchable as RT70664$

@p6rt
Copy link
Author

p6rt commented Nov 20, 2009

From lewis@wall.org

./perl6 -e 'say 0 <=> -1/2'

0

-1/2 is not close enough to 0 to warrant this result.

@p6rt
Copy link
Author

p6rt commented Nov 20, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S03-operators/comparison.t

commit 1b64955d678116091d280fee482ec5f3bedc61df
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Fri Nov 20 20​:16​:12 2009 +0000

  [t/spec] Test for RT 70664​: Try <=> with rationals
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;29156 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --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

@p6rt
Copy link
Author

p6rt commented Nov 20, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

From @moritz

fixed now, and tests passing in S03-operators/comparison-simple.t

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Mar 9, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant