private void VerifyCompareToOtherWithLesserItems() { var equalItems = Items.ToArray(); var greaterItems = ShiftedItems.ToArray(); SwapLast(equalItems, greaterItems); var failure = CompareItems(greaterItems, equalItems, (x, y) => x.CompareTo(y) > 0); if (failure != null) { Fail($"IComparable<T>.CompareTo failed with values expected to be lesser at index {failure.Value.Index}. Expected: <{failure.Value.Right}>. Actual: <{failure.Value.Left}>."); } }
private void VerifyCompareToObjWithGreaterItems() { var equalItems = Items.ToArray(); var greaterItems = ShiftedItems.ToArray(); SwapLast(equalItems, greaterItems); var failure = CompareItems(equalItems, greaterItems, (x, y) => ((IComparable)x).CompareTo(y) < 0); if (failure != null) { Fail($"IComparable.CompareTo failed with values expected to be greater at index {failure.Value.Index}. " + $"Expected: <{failure.Value.Right}>. Actual: <{failure.Value.Left}>."); } }
private void VerifyOpLessThanWithLesserItems() { if (OpLessThanFunc == null) { return; } var equalItems = Items.ToArray(); var greaterItems = ShiftedItems.ToArray(); SwapLast(equalItems, greaterItems); var failure = CompareItems(greaterItems, equalItems, (x, y) => !OpLessThanFunc(x, y)); if (failure != null) { Fail($"op_LessThan failed with values expected to be greater at index {failure.Value.Index}. Expected: <{failure.Value.Right}>. Actual: <{failure.Value.Left}>."); } }