shekharpro / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Assert.Sorted, Assert.Distinct #416

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Should add two new asserts for testing various conditions:

// Assert that all values in the enumeration appear in increasing
(non-decreasing) order.

Assert.Sorted<T>(IEnumerable<T> values);
Assert.Sorted<T>(IEnumerable<T> values, Comparison<T> comparison);

Optional refinement:

enum SortOrder { Increasing, StrictlyIncreasing, Decreasing,
StrictlyDecreasing }

Assert.Sorted<T>(IEnumerable<T> values, SortOrder sortOrder);
Assert.Sorted<T>(IEnumerable<T> values, SortOrder sortOrder, Comparison<T>
comparison);

// Assert that all values in the enumeration are distinct.

Assert.Distinct<T>(IEnumerable<T> values);
Assert.Distinct<T>(IEnumerable<T> values, EqualityComparison<T>
equivalenceRelation);

Could also support IComparer<T>, etc.

Then we can extend the collection contract verifier to check for
order-based and distinctness invariants.

Original issue reported on code.google.com by jeff.br...@gmail.com on 1 Apr 2009 at 8:02

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 6 Apr 2009 at 6:27

GoogleCodeExporter commented 8 years ago
Assert.Sorted implemented

Original comment by Yann.Tre...@gmail.com on 8 Apr 2009 at 7:10

GoogleCodeExporter commented 8 years ago
Assert.Distinct implemented.

Original comment by Yann.Tre...@gmail.com on 21 Apr 2009 at 6:25