Ejemplo n.º 1
0
                it(expectedData.name + ' ' + filePath.replace(DIRECTORY_GET_LOOPS, ''), function () {
                    var loopsData = graphLoopsFloodFill.getLoops(expectedData.inbound);
                    assert.equal(
                        loopsData.length,
                        expectedData.outbound.length,
                        'Actual loops count (' + loopsData.length + ') not equal to Expected loops count (' + expectedData.outbound.length + ')');

                    _.forEach(loopsData, function (loopItem, index) {
                        assert(_.some(expectedData.outbound, function (expectedLoopItem) {
                            var result = LoopHelpers.isUnsortedArraysEqual(loopItem.loop, expectedLoopItem.loop) &&
                                LoopHelpers.isUnsortedArraysEqual(loopItem.trappedDots, expectedLoopItem.trappedDots);

                            return result;
                        }), index + ' loop should not exist!');
                    });
                });
Ejemplo n.º 2
0
                it(filePath.replace(DIRECTORY_GET_LOOPS, '') + '  x' + ITERATION_NUM, function () {
                    var i,
                        fileName,
                        testData,
                        summaryStart = 0,
                        summaryEnd = 0;
                    this.timeout(Infinity);

                    for (i = 0; i < ITERATION_NUM; i++) {
                        fileName = filePath.replace(/\.json$/, '');
                        summaryStart += Date.now();
                        testData = require(fileName);
                        graphLoopsFloodFill.getLoops(testData.inbound);
                        summaryEnd += Date.now();
                    }
                    console.log('-------------------------------------------------------------------------------------------');
                    console.log('\t%sms', (summaryEnd - summaryStart) / ITERATION_NUM);
                });
Ejemplo n.º 3
0
 it(expectedData.name + ' ' + filePath.replace(DIRECTORY_GET_LOOPS, ''), function () {
     var loopsData = graphLoopsFloodFill.getLoops(expectedData.inbound);
     this.timeout(Infinity);
     assert.equal(loopsData.length, 0);
 });