public void SByteArray() { var n = 1000; var rand = new MersenneTwisterFast(0L); var r = new sbyte[n]; rand.NextBytes(r); var a = (sbyte[])r.Clone(); Array.Sort(r); // Reference QuickSort.QSort(a); // Test // First we just ensure that values are sorted. var last = r[0]; for (var i = 1; i < r.Length; i++) { Assert.IsTrue(r[i] >= last); } // Now we make sure both arrays are in the same order. for (var i = 0; i < a.Length; i++) { Assert.AreEqual(r[i], a[i]); } }