Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (47 sloc) 2.397 kb
58135b3 [t/spec] changed 'use v6-alpha;' to 'use v6;'
moritz authored
1 use v6;
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
2 use Test;
3
6a6e12a [t/spec] Test for RT 70664: Try <=> with rationals
kyle authored
4 plan *;
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
5
6 # N.B.: relational ops are in relational.t
7
b877b80 [gsoc_spectest] Added more cmp, leg, and <=> tests. Tested the values of...
Auzon authored
8 # L<S03/Nonchaining binary precedence/Order::Increase, Order::Same, or Order::Decrease>
9 is(+Order::Increase, -1, 'Order::Increase numifies to -1');
10 is(+Order::Same, 0, 'Order::Same numifies to 0');
497b392 [comparison.t] typo spotted by oskie++
masak authored
11 is(+Order::Decrease, 1, 'Order::Decrease numifies to 1');
b877b80 [gsoc_spectest] Added more cmp, leg, and <=> tests. Tested the values of...
Auzon authored
12
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
13 #L<S03/Comparison semantics>
14
15 # spaceship comparisons (Num)
b877b80 [gsoc_spectest] Added more cmp, leg, and <=> tests. Tested the values of...
Auzon authored
16 is(1 <=> 1, Order::Same, '1 <=> 1 is same');
17 is(1 <=> 2, Order::Increase, '1 <=> 2 is increase');
18 is(2 <=> 1, Order::Decrease, '2 <=> 1 is decrease');
19 is('a' <=> '1', Order::Increase, '<=> is in numeric context');
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
20
6a6e12a [t/spec] Test for RT 70664: Try <=> with rationals
kyle authored
21 is 0 <=> -1, Order::Decrease, '0 <=> -1 is increase';
22 is -1 <=> 0, Order::Increase, '-1 <=> 0 is decrease';
23 #?rakudo 2 todo 'RT 70664'
24 is 0 <=> -1/2, Order::Decrease, '0 <=> -1/2 is increase';
25 is 0 <=> 1/2, Order::Increase, '0 <=> 1/2 is increase';
26 #?rakudo 6 skip 'No suitable candidate found for cmp_num, with signature PP->I'
27 is -1/2 <=> 0, Order::Increase, '-1/2 <=> 0 is decrease';
28 is 1/2 <=> 0, Order::Decrease, '1/2 <=> 0 is decrease';
29 is 1/2 <=> 1/2, Order::Same, '1/2 <=> 1/2 is same';
30 is -1/2 <=> -1/2, Order::Same, '-1/2 <=> -1/2 is same';
31 is 1/2 <=> -1/2, Order::Decrease, '1/2 <=> -1/2 is decrease';
32 is -1/2 <=> 1/2, Order::Increase, '-1/2 <=> 1/2 is increase';
33
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
34 # leg comparison (Str)
b877b80 [gsoc_spectest] Added more cmp, leg, and <=> tests. Tested the values of...
Auzon authored
35 is('a' leg 'a', Order::Same, 'a leg a is same');
36 is('a' leg 'b', Order::Increase, 'a leg b is increase');
37 is('b' leg 'a', Order::Decrease, 'b leg a is decrease');
38 is('a' leg 1, Order::Decrease, 'leg is in string context');
0312dc0 [comparison.t] add some tests involving \0
lwall authored
39 is("a" leg "a\0", Order::Increase, 'a leg a\0 is increase');
40 is("a\0" leg "a\0", Order::Same, 'a\0 leg a\0 is same');
41 is("a\0" leg "a", Order::Decrease, 'a\0 leg a is decrease');
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
42
43 # cmp comparison
b877b80 [gsoc_spectest] Added more cmp, leg, and <=> tests. Tested the values of...
Auzon authored
44 is('a' cmp 'a', Order::Same, 'a cmp a is same');
45 is('a' cmp 'b', Order::Increase, 'a cmp b is increase');
46 is('b' cmp 'a', Order::Decrease, 'b cmp a is decrease');
47 is(1 cmp 1, Order::Same, '1 cmp 1 is same');
48 is(1 cmp 2, Order::Increase, '1 cmp 2 is increase');
49 is(2 cmp 1, Order::Decrease, '2 cmp 1 is decrease');
50 is('a' cmp 1, Order::Decrease, '"a" cmp 1 is decrease'); # unspecced but P5 behavior
0312dc0 [comparison.t] add some tests involving \0
lwall authored
51 is("a" cmp "a\0", Order::Increase, 'a cmp a\0 is increase');
52 is("a\0" cmp "a\0", Order::Same, 'a\0 cmp a\0 is same');
53 is("a\0" cmp "a", Order::Decrease, 'a\0 cmp a is decrease');
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
54
6a6e12a [t/spec] Test for RT 70664: Try <=> with rationals
kyle authored
55 done_testing;
56
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
57 # vim: ft=perl6
Something went wrong with that request. Please try again.