예제 #1
0
        public void TestGetAndSet()
        {
            CyclingHash hash = new CyclingHash();

            hash.Add("A", "a");
            hash.Add("B", "b");
            hash.Add("C", "c");
            Assert.AreEqual(hash.ContainsKey("B"), true);
            Assert.AreEqual(hash.GetCurrentData(), "C");
            Assert.AreEqual(hash.GetValue("A"), "a");
        }
예제 #2
0
        public void TestGetKeyByValueChangeValue()
        {
            CyclingHash hash = new CyclingHash();

            for (int i = 0; i < 1000; i++)
            {
                hash.Add(i, i % 10);
            }
            List <int> objsA = new List <int>(hash.ReadByValue(9, -1, 10).Cast <int>());

            for (int i = 0; i < objsA.Count; i++)
            {
                Assert.IsTrue(objsA[i] == 999 - i * 10);
            }
        }
예제 #3
0
        public void TestGetKeyByValue()
        {
            CyclingHash hash = new CyclingHash();

            for (int i = 0; i < 1000; i++)
            {
                hash.Add(i, i % 10);
            }
            List <int> objs = new List <int>(hash.ReadByValue("2", null, 101).Cast <int>());

            for (int i = 0; i < objs.Count; i++)
            {
                Assert.IsTrue(objs[i] == 992 - i * 10);
            }
        }
예제 #4
0
 public void TestGetKeyByValueChangeValue()
 {
     CyclingHash hash = new CyclingHash();
     for (int i = 0; i < 1000; i++)
     {
         hash.Add(i, i % 10);
     }
     List<int> objsA = new List<int>(hash.ReadByValue(9, -1, 10).Cast<int>());
     for (int i = 0; i < objsA.Count; i++)
     {
         Assert.IsTrue(objsA[i] == 999 - i * 10);
     }
 }
예제 #5
0
 public void TestGetKeyByValue()
 {
     CyclingHash hash = new CyclingHash();
     for (int i = 0; i < 1000; i++)
     {
         hash.Add(i, i % 10);
     }
     List<int> objs = new List<int>(hash.ReadByValue("2", null, 101).Cast<int>());
     for (int i = 0; i < objs.Count; i++)
     {
         Assert.IsTrue(objs[i] == 992 - i * 10);
     }
 }
예제 #6
0
 public void TestGetAndSet()
 {
     CyclingHash hash = new CyclingHash();
     hash.Add("A", "a");
     hash.Add("B", "b");
     hash.Add("C", "c");
     Assert.AreEqual(hash.ContainsKey("B"), true);
     Assert.AreEqual(hash.GetCurrentData(), "C");
     Assert.AreEqual(hash.GetValue("A"), "a");
 }
예제 #7
0
 /// <summary>
 /// 构造方法
 /// </summary>
 public Executor()
 {
     _table  = new CyclingHash();
     _server = new Server(_host, _listenPort, ProcessRequest);
 }
예제 #8
0
파일: Executor.cs 프로젝트: 89sos98/iveely
 /// <summary>
 /// 构造方法
 /// </summary>
 public Executor()
 {
     _table = new CyclingHash();
     _server = new Server(_host, _listenPort, ProcessRequest);
 }