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.0.0.5 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.0.0.4 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.0.0.3 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.0.0.2 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.0.0.1 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.0.0.0 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.4.1 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.4.0 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.3.0 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.2.1 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.2.0 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.1.2 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.1.1 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.1.0 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.0.1 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-1.0.0 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee