Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

failing test for new comparison-returning use case

  • Loading branch information...
commit d177970ab941aa221cd54ab3f42c5f3df322f776 1 parent 50c9cc0
@substack authored
Showing with 36 additions and 0 deletions.
  1. +36 −0 test/cmp.js
View
36 test/cmp.js
@@ -0,0 +1,36 @@
+var test = require('tap').test;
+var fort = require('../');
+
+test('ascend', function (t) {
+ t.same([4,1,3,2].sort(fort.ascend), [1,2,3,4], 'identity');
+ t.same(
+ [4,1,3,2].sort(fort.ascend(function (x) { return x % 4 })),
+ [4,1,2,3],
+ 'mod 4 ascend'
+ );
+ t.same(
+ ['a','b','@','_','A','Z'].sort(fort.rise(function (c) {
+ return c.charCodeAt(0) % 13;
+ })),
+ ['A','_','a','b','@','Z'],
+ 'mod 13 character code ascend'
+ );
+ t.end();
+});
+
+test('descend', function (t) {
+ t.same([4,1,3,2].sort(fort.descend), [4,3,2,1], 'identity');
+ t.same(
+ [4,1,3,2].sort(fort.descend(function (x) { return x % 4 })),
+ [3,2,1,4],
+ 'mod 4 descend'
+ );
+ t.same(
+ ['a','b','@','_','A','Z'].sort(fort.fall(function (c) {
+ return c.charCodeAt(0) % 13;
+ })),
+ ['@','Z','b','a','_','A'],
+ 'mod 13 character code descend'
+ );
+ t.end();
+});
Please sign in to comment.
Something went wrong with that request. Please try again.