private void TestTree( string label, IRangeList tree, IEnumerable <Op> sequence, VoidAction action) { try { BuildTree(tree, sequence); } catch (Exception exception) { Console.WriteLine("{0} [setup]: Unexpected exception occurred: {1}", label, exception); throw new UnitTestFailureException(label, exception); } try { action(); } catch (Exception exception) { Console.WriteLine("{0} [action]: Unexpected exception occurred: {1}", label, exception); throw new UnitTestFailureException(label, exception); } ValidateRanges(((INonInvasiveRange2MapInspection)tree).GetRanges()); }
protected void ValidateRangesEqual(IRangeList tree1, IRangeList tree2) { IncrementIteration(); Range2MapEntry[] ranges1 = ((INonInvasiveRange2MapInspection)tree1).GetRanges(); ValidateRanges(ranges1); Range2MapEntry[] ranges2 = ((INonInvasiveRange2MapInspection)tree2).GetRanges(); ValidateRanges(ranges2); ValidateRangesEqual(ranges1, ranges2); TestTrue("GetExtent", delegate() { return(tree1.GetExtent() == tree2.GetExtent()); }); }
public override bool Do(int seed, StochasticControls control) { IRangeList[] collections = new IRangeList[] { new ReferenceRangeList(), // must be first new SplayTreeRangeList(), new SplayTreeArrayRangeList(), new AdaptRangeListToRangeListLong(new SplayTreeRangeListLong()), new RedBlackTreeRangeList(), new RedBlackTreeArrayRangeList(), new AdaptRangeListToRangeListLong(new RedBlackTreeRangeListLong()), new AVLTreeRangeList(), new AVLTreeArrayRangeList(), new AdaptRangeListToRangeListLong(new AVLTreeRangeListLong()), }; Tuple <Tuple <int, int>, InvokeAction <IRangeList> >[] actions = new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >[] { new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(100, 100), ContainsAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(300 - 90, 300 + 100), TryInsertAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(300, 300), TryDeleteAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(100, 100), TryGetLengthAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(100, 100), TrySetLengthAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(300 - 90, 300 + 100), InsertAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(300, 300), DeleteAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(100, 100), GetLengthAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(100, 100), SetLengthAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(150, 150), AdjustLengthAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(100, 100), GetExtentAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(150, 150), NearestLessOrEqualAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(150, 150), NearestLessAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(150, 150), NearestGreaterOrEqualAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(150, 150), NearestGreaterAction), new Tuple <Tuple <int, int>, InvokeAction <IRangeList> >(new Tuple <int, int>(75, 75), EnumerateAction), }; return(StochasticDriver( "Range Map Stochastic Test", seed, control, collections, actions, delegate(IRangeList _collection) { return _collection.Count; }, delegate(IRangeList[] _collections) { Validate(_collections); })); }
private void BuildTree( IRangeList tree, IEnumerable <Op> sequence) { ValidateTree(tree); foreach (Op op in sequence) { IncrementIteration(); op.Do(tree); ValidateTree(tree); ValidateRanges(((INonInvasiveRange2MapInspection)tree).GetRanges()); } }
private void BuildTree( IRangeList tree, IRangeList treeAnalog, IEnumerable <Op> sequence) { ValidateTree(tree); foreach (Op op in sequence) { IncrementIteration(); op.Do(tree, treeAnalog); ValidateTree(tree); } ValidateRangesEqual(tree, treeAnalog); }
public AllocTestRangeList(IRangeList actual) { this.actual = actual; }
public override void Do(IRangeList tree, IRangeList treeAnalog) { tree.Delete(start); treeAnalog.Delete(start); }
public override void Do(IRangeList tree) { tree.Delete(start); }
public override void Do(IRangeList tree, IRangeList treeAnalog) { tree.Insert(start, length); treeAnalog.Insert(start, length); }
public override void Do(IRangeList tree) { tree.Insert(start, length); }
public abstract void Do(IRangeList tree, IRangeList treeAnalog);
public abstract void Do(IRangeList tree);