xdescribe('ServerStats', function(){
	var ServerStats, Stats;
	it('requirements', function(){
		Stats = require('../../lib/index.js').Stats.ServerStats.Stats;
		expect(Stats).not.toBeNull();
		ServerStats = require('../../lib/index.js').Stats.ServerStats;
		expect(Stats).not.toBeNull();
	}); 
	xit('Stats computeStats', function(){
        var sample = new Stats();
        sample.computeStats(100, 1000);
        sample.computeStats(100, 1000);
        sample.computeStats(100, 1000);
        sample.computeStats(100, 1000);
        sample.computeStats(100, 1000);
        
        sample.endTime = sample.startTime + 5000;
        
        var result = sample.getCalculatedStats();
        
        expect(result.time).toEqual(5000);
        expect(result.minSize).toEqual(100);
        expect(result.maxSize).toEqual(100);
        expect(result.avgSize).toEqual(100);
        expect(result.minTime).toEqual(1000);
        expect(result.maxTime).toEqual(1000);
        expect(result.avgTime).toEqual(1000);
        expect(result.requestCount).toEqual(5);
        expect(result.totalSize).toEqual(500);
        expect(result.totalTime).toEqual(5000);
        expect(result.avgNormalized).toEqual(0.096875);
        expect(result.avgRequestPerSecond).toEqual(1);
        expect(result.avgThroughputBytesPerSecond).toEqual(100);
        
        sample = new Stats();
        sample.computeStats(100, 500);
        sample.computeStats(1000, 1000);
        sample.computeStats(100, 500);
        sample.computeStats(1000, 1000);
        sample.computeStats(100, 500);
        sample.computeStats(1000, 1000);
        sample.computeStats(100, 500);
        sample.computeStats(1000, 1000);
        sample.computeStats(100, 500);
        sample.computeStats(1000, 1000);
        
        sample.endTime = sample.startTime + 7500;
        
        result = sample.getCalculatedStats();
        
        expect(result.time).toEqual(7500);
        expect(result.minSize).toEqual(100);
        expect(result.maxSize).toEqual(1000);
        expect(result.avgSize).toEqual(699.4140625);
        expect(result.minTime).toEqual(500);
        expect(result.maxTime).toEqual(1000);
        expect(result.avgTime).toEqual(833.0078125);
        expect(result.requestCount).toEqual(10);
        expect(result.totalSize).toEqual(5500);
        expect(result.totalTime).toEqual(7500);
        expect(result.avgNormalized).toEqual(0.7326171875);
        expect(result.avgRequestPerSecond).toEqual(1.3333333333333333);
        expect(result.avgThroughputBytesPerSecond).toEqual(733.3333333333334);
  
        //console.log(">>", result);
	});

    it('Stats add', function(){
        var sampleA = new Stats(),
            sampleB = new Stats(),
            sampleC = new Stats();
        
        sampleA.computeStats(100, 1000);
        sampleA.computeStats(100, 1000);
        sampleA.computeStats(100, 1000);
        sampleA.computeStats(100, 1000);
        sampleA.computeStats(100, 1000);
        
        sampleA.endTime = sampleA.startTime + 5000;
        
        sampleB.startTime = sampleA.endTime;
        
        sampleB.computeStats(100, 1000);
        sampleB.computeStats(100, 1000);
        sampleB.computeStats(100, 1000);
        sampleB.computeStats(100, 1000);
        sampleB.computeStats(100, 1000);
        
        sampleB.endTime = sampleB.startTime + 5000;
        
        sampleC.startTime = sampleC.endTime = sampleB.endTime;
        
        console.log('1', sampleC.startTime, sampleC.endTime);
        
        sampleC.add(sampleA);
        sampleC.add(sampleB);
        
        console.log('2', sampleC.startTime, sampleC.endTime);
        
        var result = sampleC.getCalculatedStats();
        
        //console.log(">>>>", result);
        expect(result.time).toEqual(10000);
        expect(result.minSize).toEqual(100);
        expect(result.maxSize).toEqual(100);
        expect(result.avgSize).toEqual(75);
        expect(result.minTime).toEqual(1000);
        expect(result.maxTime).toEqual(1000);
        expect(result.avgTime).toEqual(750);
        expect(result.requestCount).toEqual(10);
        expect(result.totalSize).toEqual(1000);
        expect(result.totalTime).toEqual(10000);
        expect(result.avgNormalized).toEqual(0.07265625);
        expect(result.avgRequestPerSecond).toEqual(1);
        expect(result.avgThroughputBytesPerSecond).toEqual(100);
    });
 });
