Sha256: 54cdc6cdf105e7e767bd86b4645c7721f22faf9ca088cde44283a4aabfc7fe2e

Contents?: true

Size: 1.93 KB

Versions: 396

Compression:

Stored size: 1.93 KB

Contents

Queens = require './queens'

describe "Queens", ->
  it "has the correct default positions", ->
    queens = new Queens
    expect(queens.white).toEqual([0,3])
    expect(queens.black).toEqual([7,3])

  xit "initialized with specific placement", ->
    queens = new Queens({white: [3,7], black: [6,1] })
    expect(queens.white).toEqual([3, 7])
    expect(queens.black).toEqual([6, 1])


  xit "cannot occupy the same space", ->
    positioning = { white: [2,4], black: [2,4] }
    expect(-> new Queens(positioning)).toThrow("Queens cannot share the same space")


  xit "toString representation", ->
    positioning = {white: [2, 4], black: [6, 6]}
    queens = new Queens(positioning)
    board = "_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ _ _\n" +
      "_ _ W _ _ _ _ _\n_ _ _ _ _ _ _ _\n_ _ _ _ _ _ B _\n_ _ _ _ _ _ _ _"
    expect(queens.toString()).toEqual(board)

  xit "queens cannot attack", ->
    queens = new Queens({ white: [2,3], black: [4,7] })
    expect(queens.canAttack()).toEqual(false)


  xit "queens can attack when they are on the same row", ->
    queens = new Queens({ white: [2,4], black: [2,7] })
    expect(queens.canAttack()).toEqual(true)


  xit "queens can attack when they are on the same column", ->
    queens = new Queens({ white: [5,4], black: [2,4] })
    expect(queens.canAttack()).toEqual(true)


  xit "queens can attack diagonally", ->
    queens = new Queens({ white: [1, 1], black: [6, 6] })
    expect(queens.canAttack()).toEqual(true)


  xit "queens can attack another diagonally", ->
    queens = new Queens({ white: [0, 6], black: [1, 7] })
    expect(queens.canAttack()).toEqual(true)


  xit "queens can attack yet another diagonally", ->
    queens = new Queens({ white: [4, 1], black: [6, 3] })
    expect(queens.canAttack()).toEqual(true)

  xit "queens can attack yet yet another diagonally", ->
    queens = new Queens({ white: [6, 1], black: [1, 6] })
    expect(queens.canAttack()).toEqual(true)

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.179 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.178 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.177 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.176 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.175 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.174 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.173 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.172 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.171 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.170 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.169 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.167 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.166 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.165 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.164 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.163 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.162 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.161 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee
trackler-2.2.1.160 tracks/coffeescript/exercises/queen-attack/queen_attack_test.spec.coffee