Sha256: 8157ad54974a0142c23a41f1453d75e550d05219084fb513fb9e80dd25a23c49

Contents?: true

Size: 1008 Bytes

Versions: 68

Compression:

Stored size: 1008 Bytes

Contents

import CollatzConjecture from './collatz-conjecture'

describe('CollatzConjecture', () => {
    it('zero steps for one', () => {
        const expected = 0
        expect(CollatzConjecture.steps(1)).toBe(expected)
    })

    xit('divide if even', () => {
        const expected = 4
        expect(CollatzConjecture.steps(16)).toBe(expected)
    })

    xit('even and odd steps', () => {
        const expected = 9
        expect(CollatzConjecture.steps(12)).toBe(expected)
    })

    xit('Large number of even and odd steps', () => {
        const expected = 152
        expect(CollatzConjecture.steps(1000000)).toBe(expected)
    })

    xit('zero is an error', () => {
        const expected = 'Only positive numbers are allowed'
        expect(() => {CollatzConjecture.steps(0)}).toThrowError(expected)
    })

    xit('negative value is an error', () => {
        const expected = 'Only positive numbers are allowed'
        expect(() => {CollatzConjecture.steps(-15)}).toThrowError(expected)
    })
})

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.179 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.178 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.177 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.176 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.175 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.174 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.173 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.172 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.171 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.170 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.169 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.167 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.166 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.165 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.164 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.163 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.162 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.161 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts
trackler-2.2.1.160 tracks/typescript/exercises/collatz-conjecture/collatz-conjecture.test.ts