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.180 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.179 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.178 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.177 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.176 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.175 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.174 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.173 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.172 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.171 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.170 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.169 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.167 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.166 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.165 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.164 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.163 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.162 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.161 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee
trackler-2.2.1.160 tracks/coffeescript/exercises/triangle/triangle_test.spec.coffee