-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented arrayed fixup cadences, completing fixup cadences. Closes #61.
- Loading branch information
1 parent
cef593c
commit 5f13538
Showing
2 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
#!/usr/bin/env node | ||
|
||
require('proof')(1, function (step, deepEqual) { | ||
require('proof')(2, function (step, deepEqual) { | ||
var fs = require('fs'), cadence = require('../..'); | ||
|
||
cadence(function (step) { | ||
|
||
items(step(step, function (items) { | ||
return items.sort(); | ||
}, function (items) { | ||
return items.reverse(); | ||
echo(1, step(step, function (number) { | ||
return - number; | ||
})); | ||
|
||
}, function (items) { | ||
|
||
deepEqual(items, [ 3, 2, 1 ], "inline cadence"); | ||
deepEqual(items, -1, 'fixup cadence'); | ||
|
||
})(step()); | ||
|
||
cadence(function (step) { | ||
|
||
var numbers = step(step, [], function (number) { return - number }); | ||
[ 1, 2, 3 ].forEach(function (number) { | ||
echo(number, numbers()); | ||
}); | ||
|
||
}, function (numbers) { | ||
|
||
deepEqual(numbers, [ -1, -2, -3 ], 'fixup array cadence'); | ||
|
||
})(step()); | ||
}); | ||
|
||
function items (callback) { | ||
callback(null, [ 2, 3, 1 ]); | ||
} | ||
function echo (value, callback) { callback(null, value); } |