diff --git a/test/binarySearch/binarySearch.test.js b/test/binarySearch/binarySearch.test.js index a98fc8e90..cd7d7c2ed 100644 --- a/test/binarySearch/binarySearch.test.js +++ b/test/binarySearch/binarySearch.test.js @@ -6,7 +6,8 @@ test('Testing binarySearch', (t) => { //Please go to https://github.com/substack/tape t.true(typeof binarySearch === 'function', 'binarySearch is a Function'); //t.deepEqual(binarySearch(args..), 'Expected'); - //t.equal(binarySearch(args..), 'Expected'); + t.equal(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6), 2, 'Finds item in array'); + t.equal(binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21), -1, 'Returns -1 when not found'); //t.false(binarySearch(args..), 'Expected'); //t.throws(binarySearch(args..), 'Expected'); t.end(); diff --git a/test/call/call.test.js b/test/call/call.test.js index ba15d452e..bf1ed5e56 100644 --- a/test/call/call.test.js +++ b/test/call/call.test.js @@ -6,7 +6,7 @@ test('Testing call', (t) => { //Please go to https://github.com/substack/tape t.true(typeof call === 'function', 'call is a Function'); //t.deepEqual(call(args..), 'Expected'); - //t.equal(call(args..), 'Expected'); + t.looseEqual(call('map', x => x * 2)([1, 2, 3]), [2, 4, 6], 'Calls function on given object'); //t.false(call(args..), 'Expected'); //t.throws(call(args..), 'Expected'); t.end(); diff --git a/test/chainAsync/chainAsync.test.js b/test/chainAsync/chainAsync.test.js index 7101ab686..d013df52f 100644 --- a/test/chainAsync/chainAsync.test.js +++ b/test/chainAsync/chainAsync.test.js @@ -6,8 +6,25 @@ test('Testing chainAsync', (t) => { //Please go to https://github.com/substack/tape t.true(typeof chainAsync === 'function', 'chainAsync is a Function'); //t.deepEqual(chainAsync(args..), 'Expected'); - //t.equal(chainAsync(args..), 'Expected'); + // chainAsync([ + // next => { + // next(); + // }, + // next => { + // (() =>{ + // next() + // })(); + // }, + // next => { + // t.pass("Calls all functions in an array"); + // next(); + // } + // ]); + // + // // Ensure we wait for the 2nd assertion to be made + // t.plan(2); + //t.false(chainAsync(args..), 'Expected'); //t.throws(chainAsync(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/collatz/collatz.test.js b/test/collatz/collatz.test.js index 1922e40ed..73ce78109 100644 --- a/test/collatz/collatz.test.js +++ b/test/collatz/collatz.test.js @@ -6,7 +6,18 @@ test('Testing collatz', (t) => { //Please go to https://github.com/substack/tape t.true(typeof collatz === 'function', 'collatz is a Function'); //t.deepEqual(collatz(args..), 'Expected'); - //t.equal(collatz(args..), 'Expected'); + t.equal(collatz(8), 4, 'When n is even, divide by 2'); + t.equal(collatz(9), 28, 'When n is odd, times by 3 and add 1'); + + let n = 9; + while(true){ + if (n == 1){ + t.pass('Eventually reaches 1'); + break; + } + n = collatz(n); + } + //t.false(collatz(args..), 'Expected'); //t.throws(collatz(args..), 'Expected'); t.end();