Fixed error prone checking etc in codebase
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
const collatz = n => (n % 2 == 0 ? n / 2 : 3 * n + 1);
|
||||
const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1);
|
||||
module.exports = collatz;
|
||||
@ -11,14 +11,14 @@ test('Testing collatz', (t) => {
|
||||
|
||||
let n = 9;
|
||||
while(true){
|
||||
if (n == 1){
|
||||
if (n === 1){
|
||||
t.pass('Eventually reaches 1');
|
||||
break;
|
||||
}
|
||||
n = collatz(n);
|
||||
}
|
||||
|
||||
|
||||
//t.false(collatz(args..), 'Expected');
|
||||
//t.throws(collatz(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user