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.159 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.158 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.157 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.156 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.155 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.154 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.153 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.152 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.151 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.150 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.149 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.148 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.147 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.146 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.145 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.144 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.143 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.142 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.141 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts
trackler-2.2.1.140 tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts