Ejemplo n.º 1
0
 public void IterativeNumbering()
 {
     Generator.IRingNumbering rnums = new Generator.IterativeRingNumbering(0);
     for (int i = 0; i < 50; i++)
     {
         int rnum = rnums.Next();
         Assert.AreEqual(rnum, i);
         rnums.Use(rnum);
     }
     rnums.Free(40);
     rnums.Free(25);
     Assert.AreEqual(rnums.Next(), 50);
     rnums.Use(50);
     Assert.AreEqual(rnums.Next(), 51);
     rnums.Use(51);
     Assert.AreEqual(rnums.Next(), 52);
     rnums.Use(52);
     for (int i = 53; i < 100; i++)
     {
         int rnum = rnums.Next();
         Assert.AreEqual(rnum, i);
         rnums.Use(rnum);
     }
     rnums.Free(20);
     rnums.Free(5);
     Assert.AreEqual(rnums.Next(), 5);
     rnums.Use(5);
     Assert.AreEqual(rnums.Next(), 20);
     rnums.Use(20);
     Assert.AreEqual(rnums.Next(), 25);
     rnums.Use(25);
     Assert.AreEqual(rnums.Next(), 40);
     rnums.Use(40);
 }
Ejemplo n.º 2
0
 public void MaxRingNumbers()
 {
     Generator.IRingNumbering rnums = new Generator.IterativeRingNumbering(0);
     for (int i = 0; i < 101; i++)
     {
         int rnum = rnums.Next();
         rnums.Use(rnum);
     }
 }