Sha256: 52d60f1bc95d416ba0229efa5afd2a85317407557f1a8871fcf5d432b5cf0b00

Contents?: true

Size: 1.3 KB

Versions: 42

Compression:

Stored size: 1.3 KB

Contents

import SpiralMatrix from './spiral-matrix'

describe('Spiral Matrix', () => {
    it('empty spiral', () => {
        const expected: number[][] = []
        const actual = SpiralMatrix.ofSize(0)
        expect(actual).toEqual(expected)
    })

    xit('trivial spiral', () => {
        const expected = [[1]]
        const actual = SpiralMatrix.ofSize(1)
        expect(actual).toEqual(expected)
    })

    xit('spiral of size 2', () => {
        const expected = [[1, 2],
        [4, 3]]
        const actual = SpiralMatrix.ofSize(2)
        expect(actual).toEqual(expected)
    })

    xit('spiral of size 3', () => {
        const expected = [[1, 2, 3],
        [8, 9, 4],
        [7, 6, 5]]
        const actual = SpiralMatrix.ofSize(3)
        expect(actual).toEqual(expected)
    })

    xit('spiral of size 4', () => {
        const expected = [[1, 2, 3, 4],
        [12, 13, 14, 5],
        [11, 16, 15, 6],
        [10, 9, 8, 7]]
        const actual = SpiralMatrix.ofSize(4)
        expect(actual).toEqual(expected)
    })

    xit('spiral of size 5', () => {
        const expected = [[1, 2, 3, 4, 5],
        [16, 17, 18, 19, 6],
        [15, 24, 25, 20, 7],
        [14, 23, 22, 21, 8],
        [13, 12, 11, 10, 9]]
        const actual = SpiralMatrix.ofSize(5)
        expect(expected).toEqual(actual)
    })
})

Version data entries

42 entries across 42 versions & 1 rubygems

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