 
 IntervalTree = require '../../src/lib/interval-tree'
 Interval     = require '../../src/lib/interval'
-
-createRandomInterval = (unit, id) ->
-
-    p1 = Math.floor(Math.random() * unit)
-    p2 = Math.floor(Math.random() * unit)
-
-    if p1 is p2
-        if p1 > 0
-            p1--
-        else
-            p2++
-
-    return new Interval(Math.min(p1, p2), Math.max(p1, p2), id)
-
+Node         = require '../../src/lib/node'
 
 
 describe 'IntervalTree', ->


        it 'removes an interval by id', ->

            id = 59
            interval = @iTree.intervalsById[id]
            node = @iTree.nodesById[id]
            count = node.count()


            @iTree.remove id


            expect(@iTree.intervalsById[id]).to.not.exist
            expect(@iTree.nodesById[id]).to.not.exist

                    if start < 500
                        expect(end).to.be.above 499

                    else if end > 510
                        expect(start).to.be.below 511

                    else
                        expect(start).within 500, 510
                        expect(end).within 500, 510

                else
                    expect(start > 510 or end < 500).to.be.true



