Sha256: 94dec894fe1cc096c693acebd38c86e7cca5b6819cf0b243e7967044c8aeed39

Contents?: true

Size: 1.22 KB

Versions: 120

Compression:

Stored size: 1.22 KB

Contents

import Triplet from './pythagorean-triplet'

describe('Triplet', () => {
    it('calculates the sum', () => {
        expect(new Triplet(3, 4, 5).sum()).toBe(12)
    })

    xit('calculates the product', () => {
        expect(new Triplet(3, 4, 5).product()).toBe(60)
    })

    xit('can recognize a pythagorean triplet', () => {
        expect(new Triplet(3, 4, 5).isPythagorean()).toBe(true)
    })

    xit('can recognize a non pythagorean triplet', () => {
        expect(new Triplet(5, 6, 7).isPythagorean()).toBe(false)
    })

    xit('can make triplets up to 10', () => {
        const triplets = Triplet.where(10)
        const products = triplets.sort().map((triplet: Triplet) => triplet.product())
        expect(products).toEqual([60, 480])
    })

    xit('can make triplets 11 through 20', () => {
        const triplets = Triplet.where(20, 11)
        const products = triplets.sort().map((triplet: Triplet) => triplet.product())
        expect(products).toEqual([3840])
    })

    xit('can filter on sum', () => {
        const triplets = Triplet.where(100, undefined, 180)
        const products = triplets.sort().map((triplet: Triplet) => triplet.product())
        expect(products).toEqual([118080, 168480, 202500])
    })
})

Version data entries

120 entries across 120 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.77 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.76 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.75 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.74 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.73 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.72 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.71 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.70 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.69 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.68 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.67 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.66 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.65 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.64 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.63 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.62 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.61 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.60 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts
trackler-2.2.1.59 tracks/typescript/exercises/pythagorean-triplet/pythagorean-triplet.test.ts