public void IsSortedUtil()
 {
     Assert.That(
         OneThreeTwoFour.Begin().IsSortedUntil(
             OneThreeTwoFour.End(),
             IsIntLessThanInt).Index,
         Is.EqualTo(2));
 }
    public void PushHeap()
    {
        NativeArrayIterator <int> pushHeapIt = FourTwoThreeOne.Begin().Copy(
            FourTwoThreeOne.End(),
            arrLong.Begin());

        pushHeapIt.SetCurrent(5);
        pushHeapIt = pushHeapIt.GetNext();
        arrLong.Begin().PushHeap(pushHeapIt, IsIntLessThanInt);
        Assert.That(arrLong, Is.EqualTo(new[] { 5, 4, 3, 1, 2, 0, 0, 0 }));
    }
 public void Includes()
 {
     Assert.That(
         arr.Begin().Includes(
             arr.End(),
             TwoThree.Begin(),
             TwoThree.End(),
             IsIntLessThanInt),
         Is.True);
 }
 public void CopyBackward()
 {
     Assert.That(
         arr.IteratorAt(1).CopyBackward(arr.IteratorAt(3), arr2.End()).Index,
         Is.EqualTo(2));
     Assert.That(arr2, Is.EqualTo(new[] { 0, 0, 2, 2 }));
 }
    public void InplaceMerge()
    {
        NativeArrayIterator <int> copyResult = arr.Begin().Copy(
            arr.End(),
            arrLong.Begin());

        OneThreeThreeFour.Begin().Copy(OneThreeThreeFour.End(), copyResult);
        arrLong.Begin().InplaceMerge(
            copyResult,
            arrLong.End(),
            IsIntLessThanInt);
        Assert.That(arrLong, Is.EqualTo(new[] { 1, 1, 2, 2, 3, 3, 3, 4 }));
    }
 public void Merge()
 {
     Assert.That(
         arr.Begin().Merge(
             arr.End(),
             OneThreeThreeFour.Begin(),
             OneThreeThreeFour.End(),
             arrLong.Begin(),
             IsIntLessThanInt
             ).Index,
         Is.EqualTo(8));
     Assert.That(arrLong, Is.EqualTo(new[] { 1, 1, 2, 2, 3, 3, 3, 4 }));
 }
    public void PrevPermutation()
    {
        Assert.That(
            ThreeTwoOne.Begin().PrevPermutation(
                ThreeTwoOne.End(),
                IsIntLessThanInt),
            Is.True);
        Assert.That(ThreeTwoOne, Is.EqualTo(new[] { 3, 1, 2 }));


        Assert.That(
            ThreeTwoOne.Begin().PrevPermutation(
                ThreeTwoOne.End(),
                IsIntLessThanInt),
            Is.True);
        Assert.That(ThreeTwoOne, Is.EqualTo(new[] { 2, 3, 1 }));

        Assert.That(
            ThreeTwoOne.Begin().PrevPermutation(
                ThreeTwoOne.End(),
                IsIntLessThanInt),
            Is.True);
        Assert.That(ThreeTwoOne, Is.EqualTo(new[] { 2, 1, 3 }));


        Assert.That(
            ThreeTwoOne.Begin().PrevPermutation(
                ThreeTwoOne.End(),
                IsIntLessThanInt),
            Is.True);
        Assert.That(ThreeTwoOne, Is.EqualTo(new[] { 1, 3, 2 }));


        Assert.That(
            ThreeTwoOne.Begin().PrevPermutation(
                ThreeTwoOne.End(),
                IsIntLessThanInt),
            Is.True);
        Assert.That(ThreeTwoOne, Is.EqualTo(new[] { 1, 2, 3 }));

        Assert.That(
            ThreeTwoOne.Begin().PrevPermutation(
                ThreeTwoOne.End(),
                IsIntLessThanInt),
            Is.False);
        Assert.That(ThreeTwoOne, Is.EqualTo(new[] { 3, 2, 1 }));
    }
 public void MakeHeap()
 {
     OneTwoThreeFour.Begin().Copy(OneTwoThreeFour.End(), arr2.Begin());
     arr2.Begin().MakeHeap(arr2.End(), IsIntLessThanInt);
     Assert.That(arr2, Is.EqualTo(new[] { 4, 2, 3, 1 }));
 }
 public void Distance()
 {
     Assert.That(arr.Begin().Distance(arr.End()), Is.EqualTo(4));
 }