use simplified async test syntax

This commit is contained in:
rolux 2012-05-27 18:44:00 +02:00
parent ba4086bc55
commit b44b2da4d2
2 changed files with 8 additions and 1 deletions

View file

@ -95,6 +95,8 @@
1000 1000
); );
</script> </script>
> Ox.nonblockingMap(Ox.range(1000000), Ox.identity, function(r) { Ox.test(r.length, 1000000); })
undefined
@*/ @*/
Ox.nonblockingMap = function(collection, iterator, that, callback, ms) { Ox.nonblockingMap = function(collection, iterator, that, callback, ms) {
var last = Ox.last(arguments), var last = Ox.last(arguments),
@ -163,6 +165,8 @@
} }
); );
</script> </script>
> Ox.parallelMap(Ox.range(1000000), Ox.noop, function(r) { Ox.test(r.length, 1000000); })
undefined
@*/ @*/
Ox.parallelMap = function() { Ox.parallelMap = function() {
asyncMap.apply(null, [Ox.parallelForEach].concat(Ox.toArray(arguments))); asyncMap.apply(null, [Ox.parallelForEach].concat(Ox.toArray(arguments)));
@ -229,9 +233,12 @@
} }
); );
</script> </script>
> Ox.serialMap(Ox.range(1000), Ox.noop, function(r) { Ox.test(r.length, 1000); })
undefined
@*/ @*/
Ox.serialMap = function(collection, iterator, that, callback) { Ox.serialMap = function(collection, iterator, that, callback) {
asyncMap.apply(null, [Ox.serialForEach].concat(Ox.toArray(arguments))); asyncMap.apply(null, [Ox.serialForEach].concat(Ox.toArray(arguments)));
}; };
// FIXME: The above test with 10000 iterations blows the stack
}()); }());

View file

@ -139,7 +139,7 @@ Ox.encodeDeflate <f> Encodes a string, using deflate
head, tail and chunk names are removed. head, tail and chunk names are removed.
(str) -> <s> The encoded string (str) -> <s> The encoded string
str <s> The string to be encoded str <s> The string to be encoded
> Ox.decodeDeflate(Ox.encodeDeflate('foo'), function(str) { Ox.test.async('Ox.encodeDeflate', str == 'foo'); }) > Ox.decodeDeflate(Ox.encodeDeflate('foo'), function(str) { Ox.test(str, 'foo'); })
undefined undefined
@*/ @*/
Ox.encodeDeflate = function(string, callback) { Ox.encodeDeflate = function(string, callback) {