/*globals describe it beforeEach afterEach */
require("should");
var path = require("path");
var fs = require("fs");
var TestHelper = require("./helpers/TestHelper");
var Watchpack = require("../lib/watchpack");

var fixtures = path.join(__dirname, "fixtures");
var testHelper = new TestHelper(fixtures);

describe("Assumption", function() {
	this.timeout(10000);
	beforeEach(testHelper.before);
	afterEach(testHelper.after);

	it("should have a file system with correct mtime behavior", function(done) {
		var i = 10;
		testHelper.tick(100, function checkMtime() {
			var before = Date.now();
			testHelper.file("a");
			var after = Date.now();
			var s = fs.statSync(path.join(fixtures, "a"));
			(+s.mtime).should.be.aboveOrEqual(before - 2000);
			(+s.mtime).should.be.below(after + 2000);
			if(i-- === 0)
				done();
			else
				testHelper.tick(100, checkMtime);
		});
	});
});


@@ -512,285 +512,762 @@
 i = 
-10;%0A%09%09testHelper.tick(100, function checkMtime() %7B%0A%09%09%09var before = Date.now();%0A%09%09%09testHelper.file(%22a%22);%0A%09%09%09var after = Date.now();%0A%09%09%09var s = fs.statSync(path.join(fixtures, %22a%22));%0A%09%09%09(+s.mtime).should.be.aboveOrEqual(before - 2000);%0A%09%09%09(+s.mtime).should.be.below(after + 2000)
+60;%0A%09%09var count = 60;%0A%09%09var minDiffBefore = +Infinity;%0A%09%09var maxDiffBefore = -Infinity;%0A%09%09var sumDiffBefore = 0;%0A%09%09var minDiffAfter = +Infinity;%0A%09%09var maxDiffAfter = -Infinity;%0A%09%09var sumDiffAfter = 0;%0A%09%09testHelper.tick(100, function checkMtime() %7B%0A%09%09%09var before = Date.now();%0A%09%09%09testHelper.file(%22a%22);%0A%09%09%09var after = Date.now();%0A%09%09%09var s = fs.statSync(path.join(fixtures, %22a%22));%0A%09%09%09var diffBefore = +s.mtime - before;%0A%09%09%09if(diffBefore %3C minDiffBefore) minDiffBefore = diffBefore;%0A%09%09%09if(diffBefore %3E maxDiffBefore) maxDiffBefore = diffBefore;%0A%09%09%09sumDiffBefore += diffBefore;%0A%09%09%09var diffAfter = +s.mtime - after;%0A%09%09%09if(diffAfter %3C minDiffAfter) minDiffAfter = diffAfter;%0A%09%09%09if(diffAfter %3E maxDiffAfter) maxDiffAfter = diffAfter;%0A%09%09%09sumDiffAfter += diffAfter
 ;%0A%09%09
@@ -1284,24 +1284,35 @@
 = 0)
+ %7B
 %0A%09%09%09%09
-don
+afterMeassur
 e();%0A%09%09%09
 else
@@ -1311,12 +1311,16 @@
 %0A%09%09%09
+%7D 
 else
+ %7B
 %0A%09%09%09
@@ -1356,19 +1356,505 @@
 ime);%0A%09%09
-%7D);
+%09%7D%0A%09%09%7D);%0A%0A%09%09function afterMeassure() %7B%0A%09%09%09console.log(%22mtime accuracy (before): %5B%22 + minDiffBefore + %22 ; %22 + maxDiffBefore + %22%5D avg %22 + Math.round(sumDiffBefore / count));%0A%09%09%09console.log(%22mtime accuracy (after): %5B%22 + minDiffAfter + %22 ; %22 + maxDiffAfter + %22%5D avg %22 + Math.round(sumDiffAfter / count));%0A%09%09%09minDiffBefore.should.be.aboveOrEqual(-2000);%0A%09%09%09maxDiffBefore.should.be.below(2000);%0A%09%09%09minDiffAfter.should.be.aboveOrEqual(-2000);%0A%09%09%09maxDiffAfter.should.be.below(2000);%0A%09%09%09done();%0A%09%09%7D
 %0A%09%7D);%0A%7D)

improve assumption test