Sha256: 62cdd03c36f0285e9d2944f16ebef93b8874f8f01a3bbc50e0a79fd254ddef84

Contents?: true

Size: 1.82 KB

Versions: 396

Compression:

Stored size: 1.82 KB

Contents

Triangle = require './triangle'

describe "Triangle", ->
  it 'is equilateral with equal sides', ->
    triangle = new Triangle(2,2,2)
    expect(triangle.kind()).toBe 'equilateral'

  xit 'is equilateral for larger triangle', ->
    triangle = new Triangle(10,10,10)
    expect(triangle.kind()).toBe 'equilateral'

  xit 'is isosceles when last two sides equal', ->
    triangle = new Triangle(2,4,4)
    expect(triangle.kind()).toBe 'isosceles'

  xit 'is isosceles when first and last equal', ->
    triangle = new Triangle(4,2,4)
    expect(triangle.kind()).toBe 'isosceles'

  xit 'is isosceles when first two equal', ->
    triangle = new Triangle(4,4,2)
    expect(triangle.kind()).toBe 'isosceles'

  xit 'is isosceles with arbitrary sides', ->
    triangle = new Triangle(10,10,2)
    expect(triangle.kind()).toBe 'isosceles'

  xit 'is scalene when no sides equal', ->
    triangle = new Triangle(3,4,5)
    expect(triangle.kind()).toBe 'scalene'

  xit 'is scalene when larger as well', ->
    triangle = new Triangle(10,11,12)
    expect(triangle.kind()).toBe 'scalene'

  xit 'is scalene in decesending order', ->
    triangle = new Triangle(5,4,3)
    expect(triangle.kind()).toBe 'scalene'

  xit 'is legal when very small', ->
    triangle = new Triangle(.03,.06,.04)
    expect(triangle.kind()).toBe 'scalene'

  xit 'is illegal when a side is negative', ->
    expect(-> new Triangle(2,3,-5)).toThrow("negative sides are illegal")

  xit 'is illegal when violating triangle inequality', ->
    expect(-> new Triangle(1,1,3)).toThrow("violation of triangle inequality")

  xit 'is illegal when violating triangle inequality 2', ->
    expect(-> new Triangle(2,2,4)).toThrow("violation of triangle inequality")

  xit 'is illegal when violating triangle inequality 3', ->
    expect(-> new Triangle(7,3,2)).toThrow("violation of triangle inequality")

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.138 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.137 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.136 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.135 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.134 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.133 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.132 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.131 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.130 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.129 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.128 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.127 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.126 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.125 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.124 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.123 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.122 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.121 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.120 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee