public void GiveRange_MergeMultipleTest() {
         var hardList = new LinkedList<UniqueIdentificationSet.Segment>().With(list => {
            list.AddLast(new UniqueIdentificationSet.Segment { low = 1, high = 5 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 12, high = 15 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 30, high = 50 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 52, high = 100 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 150, high = 200 });
         });
         IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);
         uidSet.__Assign(hardList);
         uidSet.GiveRange(0, 16);
         AssertEquals("[0, 16][30, 50][52, 100][150, 200]", uidSet.ToString());

         uidSet.__Assign(hardList);
         uidSet.GiveRange(15, 51);
         AssertEquals("[1, 5][12, 100][150, 200]", uidSet.ToString());

         uidSet.__Assign(hardList);
         uidSet.GiveRange(15, UInt32.MaxValue);
         AssertEquals("[1, 5][12, " + UInt32.MaxValue + "]", uidSet.ToString());

         uidSet.__Assign(hardList);
         uidSet.GiveRange(0, UInt32.MaxValue);
         AssertEquals("[0, " + UInt32.MaxValue + "]", uidSet.ToString());

         uidSet.__Assign(hardList);
         uidSet.GiveRange(201, 1000);
         AssertEquals("[1, 5][12, 15][30, 50][52, 100][150, 1000]", uidSet.ToString());

         uidSet.__Assign(hardList);
         uidSet.GiveRange(0, 0);
         AssertEquals("[0, 5][12, 15][30, 50][52, 100][150, 200]", uidSet.ToString());
      }
 public void GiveRange_MergeAfterFirstTest() {
    IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);
    uidSet.GiveRange(1, 5);
    uidSet.GiveRange(10, 12);
    uidSet.GiveRange(8, 9);
    AssertEquals("[1, 5][8, 12]", uidSet.ToString());
 }
 public void GiveRange_AppendInMiddleTest() {
    IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);
    uidSet.GiveRange(12, 15);
    uidSet.GiveRange(18, 20);
    uidSet.GiveRange(1, 5);
    uidSet.GiveRange(7, 10);
    AssertEquals("[1, 5][7, 10][12, 15][18, 20]", uidSet.ToString());
 }
        public void GiveRange_MergeAfterFirstTest()
        {
            IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);

            uidSet.GiveRange(1, 5);
            uidSet.GiveRange(10, 12);
            uidSet.GiveRange(8, 9);
            AssertEquals("[1, 5][8, 12]", uidSet.ToString());
        }
 public void GiveRange_PrependToFrontTest() {
    IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);
    uidSet.Clear();
    uidSet.GiveRange(18, 20);
    uidSet.GiveRange(12, 15);
    uidSet.GiveRange(7, 10);
    uidSet.GiveRange(1, 5);
    AssertEquals("[1, 5][7, 10][12, 15][18, 20]", uidSet.ToString());
 }
        public void GiveRange_AppendInMiddleTest()
        {
            IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);

            uidSet.GiveRange(12, 15);
            uidSet.GiveRange(18, 20);
            uidSet.GiveRange(1, 5);
            uidSet.GiveRange(7, 10);
            AssertEquals("[1, 5][7, 10][12, 15][18, 20]", uidSet.ToString());
        }
        public void GiveRange_PrependToFrontTest()
        {
            IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);

            uidSet.Clear();
            uidSet.GiveRange(18, 20);
            uidSet.GiveRange(12, 15);
            uidSet.GiveRange(7, 10);
            uidSet.GiveRange(1, 5);
            AssertEquals("[1, 5][7, 10][12, 15][18, 20]", uidSet.ToString());
        }
        public void TakeRangeStartTest()
        {
            var hardList = new LinkedList <UniqueIdentificationSet.Segment>().With(list => {
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 1, high = 5
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 12, high = 15
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 30, high = 50
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 52, high = 100
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 150, high = 200
                });
            });
            IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);

            uidSet.__Assign(hardList);
            uidSet.TakeRange(3, 11);
            AssertEquals("[1, 2][12, 15][30, 50][52, 100][150, 200]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.TakeRange(0, 300);
            AssertEquals("", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.TakeRange(1, 3);
            AssertEquals("[4, 5][12, 15][30, 50][52, 100][150, 200]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.TakeRange(1, 5);
            AssertEquals("[12, 15][30, 50][52, 100][150, 200]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.TakeRange(150, 200);
            AssertEquals("[1, 5][12, 15][30, 50][52, 100]", uidSet.ToString());
        }
        public void GiveRange_MergeMultipleTest()
        {
            var hardList = new LinkedList <UniqueIdentificationSet.Segment>().With(list => {
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 1, high = 5
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 12, high = 15
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 30, high = 50
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 52, high = 100
                });
                list.AddLast(new UniqueIdentificationSet.Segment {
                    low = 150, high = 200
                });
            });
            IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);

            uidSet.__Assign(hardList);
            uidSet.GiveRange(0, 16);
            AssertEquals("[0, 16][30, 50][52, 100][150, 200]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.GiveRange(15, 51);
            AssertEquals("[1, 5][12, 100][150, 200]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.GiveRange(15, UInt32.MaxValue);
            AssertEquals("[1, 5][12, " + UInt32.MaxValue + "]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.GiveRange(0, UInt32.MaxValue);
            AssertEquals("[0, " + UInt32.MaxValue + "]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.GiveRange(201, 1000);
            AssertEquals("[1, 5][12, 15][30, 50][52, 100][150, 1000]", uidSet.ToString());

            uidSet.__Assign(hardList);
            uidSet.GiveRange(0, 0);
            AssertEquals("[0, 5][12, 15][30, 50][52, 100][150, 200]", uidSet.ToString());
        }
      public void TakeRangeStartTest() {
         var hardList = new LinkedList<UniqueIdentificationSet.Segment>().With(list => {
            list.AddLast(new UniqueIdentificationSet.Segment { low = 1, high = 5 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 12, high = 15 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 30, high = 50 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 52, high = 100 });
            list.AddLast(new UniqueIdentificationSet.Segment { low = 150, high = 200 });
         });
         IUniqueIdentificationSet uidSet = new UniqueIdentificationSet(false);
         uidSet.__Assign(hardList);
         uidSet.TakeRange(3, 11);
         AssertEquals("[1, 2][12, 15][30, 50][52, 100][150, 200]", uidSet.ToString());

         uidSet.__Assign(hardList);
         uidSet.TakeRange(0, 300);
         AssertEquals("", uidSet.ToString());
       
         uidSet.__Assign(hardList);
         uidSet.TakeRange(1, 3);
         AssertEquals("[4, 5][12, 15][30, 50][52, 100][150, 200]", uidSet.ToString()); 

         uidSet.__Assign(hardList);
         uidSet.TakeRange(1, 5);
         AssertEquals("[12, 15][30, 50][52, 100][150, 200]", uidSet.ToString()); 

         uidSet.__Assign(hardList);
         uidSet.TakeRange(150, 200);
         AssertEquals("[1, 5][12, 15][30, 50][52, 100]", uidSet.ToString()); 
      }