working on tree compare tests etc

This commit is contained in:
Peter Cottle 2013-06-08 14:11:13 -10:00
parent 89fa08e149
commit 3d8e40851e
5 changed files with 71 additions and 4 deletions

View file

@ -3,6 +3,29 @@ var _ = require('underscore');
// static class...
var TreeCompare = {};
TreeCompare.dispatchFromLevel = function(levelBlob, treeToCompare) {
var goalTreeString = levelBlob.goalTreeString;
return TreeCompare.dispatch(levelBlob, goalTreeString, treeToCompare);
};
TreeCompare.dispatch = function(levelBlob, goalTreeString, treeToCompare) {
switch(true) {
case !!levelBlob.compareOnlyMaster:
return TreeCompare.compareBranchWithinTrees(current, goalTreeString, 'master');
case !!levelBlob.compareOnlyBranches:
return TreeCompare.compareAllBranchesWithinTrees(current, goalTreeString);
case !!levelBlob.compareAllBranchesHashAgnostic:
return TreeCompare.compareAllBranchesWithinTreesHashAgnostic(current, goalTreeString);
case !!levelBlob.compareOnlyMasterHashAgnostic:
return TreeCompare.compareBranchesWithinTreesHashAgnostic(current, goalTreeString, ['master']);
case !!levelBlob.compareOnlyMasterHashAgnosticWithAsserts:
return TreeCompare.compareBranchesWithinTreesHashAgnostic(current, goalTreeString, ['master']) &&
TreeCompare.evalAsserts(current, levelBlob.goalAsserts);
default:
return TreeCompare.compareAllBranchesWithinTreesAndHEAD(current, goalTreeString);
}
};
// would love to have copy properties here.. :(
TreeCompare.compareAllBranchesWithinTreesAndHEAD = function(treeA, treeB) {
treeA = this.convertTreeSafe(treeA);

View file

@ -28,7 +28,9 @@ var toGlobalize = {
};
_.each(toGlobalize, function(module) {
_.extend(window, module);
for (var key in module) {
window['debug_' + key] = module[key];
}
});
$(document).ready(function() {
@ -37,5 +39,6 @@ $(document).ready(function() {
window.sandbox = toGlobalize.Main.getSandbox();
window.modules = toGlobalize;
window.levelDropdown = toGlobalize.Main.getLevelDropdown();
window.under = _;
});