<commit_before><!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Refactored date examples</title>
 
  <link rel="stylesheet" href="qunit-1.18.0.css">
  <script src="qunit-1.18.0.js"></script>  
  <script src="../js/checkpointer.js"></script>
 
  <script>
	QUnit.test("checkpointer: named modules 1", function( assert ) {
		var orderCheck = "";        
		var module1 = {val:1}, module2 = {val:2}, module3 = {val:3};
		orderCheck += "S0";
		checkpointer(['module1', 'module2'], function(m1, m2) {
			assert.equal(m1==module1 && m2==module2, true);
			orderCheck += "C0";
		});
		checkpointer(['module2'], function(m2) {		
			assert.equal(m2==module2, true);
			orderCheck += "C1";
		});
		orderCheck += "S1";
		checkpointer.setModuleOnce('module1', ['module2', 'module3'], function(m2, m3) {
			orderCheck += "M1";
			assert.equal(m2==module2 && m3==module3, true);
			return module1;
		});
		orderCheck += "S2";
		checkpointer.setModuleOnce('module2', [], function() {
			orderCheck += 'M2';
			return module2;
		});
		orderCheck += "S3";
		checkpointer.setModuleOnce('module3', [], function() {
			orderCheck += "M3";
			return module3;
		});	
		orderCheck += "S4";	
		assert.equal(orderCheck, "S0S1S2M2C1S3M3M1C0S4");
	});
	
	QUnit.test("checkpointer: clock check", function( assert ) {
		var orderCheck = "";        
		var module1 = {val:1}, module2 = {val:2}, module3 = {val:3};		
		var flag = false;
		assert.equal(checkpointer.clock.callbacks.length, 0);		
		checkpointer([
				function() {orderCheck+= "check"; return flag == true;}
			], function() {
				orderCheck += "C0";
				assert.equal(checkpointer.clock.callbacks.length, 0);						
				assert.equal(orderCheck, "checkcheckC0"); /* from initial condition check, and check inside ticker */		
			});		
		assert.equal(orderCheck, "check"); /* from initial condition check */
		assert.equal(checkpointer.clock.callbacks.length, 1);				
		Array(10000000).map(function(v, k) {
			return Math.sin(Math.random());			
		});
		assert.equal(orderCheck, "check");	
		flag = true;		
		assert.equal(checkpointer.clock.callbacks.length, 1);		
		assert.equal(orderCheck, "check");						
	});
	
	
	setTimeout(function() {	
		QUnit.test("checkpointer: named modules, conditions, watch property", function( assert ) {
			var orderCheck = "";        
			var module1 = {val:1}, module2 = {val:2}, module3 = {val:3};
			assert.equal(checkpointer.clock.callbacks.length, 0);		
			orderCheck += "S0";		
			checkpointer(['t2_module2'], function(m2) {		
				assert.equal(m2, module2);
				orderCheck += "C0";
			});
			orderCheck += "S1";
			checkpointer.setModuleOnce('t2_module1', [
					't2_module2',	
					function() {return !!document.getElementById('testElem1');},
					[window, 'globalFlag', function() { return window.globalFlag == 'exact';}],
					
				], function(m2, nothing, globalFlag) {
				orderCheck += "M1";
				console.log(arguments);
				assert.equal(m2, module2);
				assert.equal(nothing, undefined);
				assert.equal(globalFlag, 'exact');
				return module1;
			});
			orderCheck += "S2";
			checkpointer.setModuleOnce('t2_module2', [], function() {
				orderCheck += 'M2';<commit_msg>qunit test, bugfixes<commit_after><!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Tests</title>
 
  <link rel="stylesheet" href="qunit-1.18.0.css">
  <script src="qunit-1.18.0.js"></script>  
  <script src="../js/checkpointer.js"></script>
 
  <script>
	QUnit.test("checkpointer: named modules 1", function( assert ) {
		var orderCheck = "";        
		var module1 = {val:1}, module2 = {val:2}, module3 = {val:3};
		orderCheck += "S0";
		checkpointer(['module1', 'module2'], function(m1, m2) {
			assert.equal(m1==module1 && m2==module2, true);
			orderCheck += "C0";
		});
		checkpointer(['module2'], function(m2) {		
			assert.equal(m2==module2, true);
			orderCheck += "C1";
		});
		orderCheck += "S1";
		checkpointer.setModuleOnce('module1', ['module2', 'module3'], function(m2, m3) {
			orderCheck += "M1";
			assert.equal(m2==module2 && m3==module3, true);
			return module1;
		});
		orderCheck += "S2";
		checkpointer.setModuleOnce('module2', [], function() {
			orderCheck += 'M2';
			return module2;
		});
		orderCheck += "S3";
		checkpointer.setModuleOnce('module3', [], function() {
			orderCheck += "M3";
			return module3;
		});	
		orderCheck += "S4";	
		assert.equal(orderCheck, "S0S1S2M2C1S3M3M1C0S4");
	});
	
	QUnit.test("checkpointer: clock check", function( assert ) {
		var orderCheck = "";        
		var module1 = {val:1}, module2 = {val:2}, module3 = {val:3};		
		var flag = false;
		assert.equal(checkpointer.clock.callbacks.length, 0);		
		checkpointer([
				function() {orderCheck+= "check"; return flag == true;}
			], function() {
				orderCheck += "C0";
				assert.equal(checkpointer.clock.callbacks.length, 0);						
				assert.equal(orderCheck, "checkcheckC0"); /* from initial condition check, and check inside ticker */		
			});		
		assert.equal(orderCheck, "check"); /* from initial condition check */
		assert.equal(checkpointer.clock.callbacks.length, 1);				
		Array(10000000).map(function(v, k) {
			return Math.sin(Math.random());			
		});
		assert.equal(orderCheck, "check");	
		flag = true;		
		assert.equal(checkpointer.clock.callbacks.length, 1);		
		assert.equal(orderCheck, "check");						
	});
	
	
	setTimeout(function() {	
		QUnit.test("checkpointer: named modules, conditions, watch property", function( assert ) {
			var orderCheck = "";        
			var module1 = {val:1}, module2 = {val:2}, module3 = {val:3};
			assert.equal(checkpointer.clock.callbacks.length, 0);		
			orderCheck += "S0";		
			checkpointer(['t2_module2'], function(m2) {		
				assert.equal(m2, module2);
				orderCheck += "C0";
			});
			orderCheck += "S1";
			checkpointer.setModuleOnce('t2_module1', [
					't2_module2',	
					function() {return !!document.getElementById('testElem1');},
					[window, 'globalFlag', function() { return window.globalFlag == 'exact';}],
					
				], function(m2, nothing, globalFlag) {
				orderCheck += "M1";
				// console.log(arguments);
				assert.equal(m2, module2);
				assert.equal(nothing, undefined);
				assert.equal(globalFlag, 'exact');
				return module1;
			});
			orderCheck += "S2";
			checkpointer.setModuleOnce('t2_module2', [], function() {
				orderCheck += 'M2';
{'fraction_non_alphanumeric': 0.18312985571587126, 'fraction_numerical': 0.03519898525447915, 'mean_word_length': 3.7571644042232277, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3573616', 'n_tokens_mistral': 2560, 'n_tokens_neox': 2169, 'n_words': 409}