コード例 #1
0
        public void Remove_Object()
        {
            PackTwoKeyDictionary ptkd = new PackTwoKeyDictionary();
            TwoKeyDictionary <string, int, int>  tkd  = ptkd.GetLoadedTwoKeyDictionary(POPSIZE);
            TwoKeyValueTriple <string, int, int> src1 = new TwoKeyValueTriple <string, int, int>(ptkd.kavalues[3], ptkd.kbvalues[3], ptkd.vvalues[3]);
            TwoKeyValueTriple <string, int, int> src2 = new TwoKeyValueTriple <string, int, int>(ptkd.kavalues[6], ptkd.kbvalues[6], ptkd.vvalues[6]);


            tkd.Remove((object)src1.KeyA);
            if (tkd.Contains(src1.KeyA))
            {
                Assert.Fail();
            }

            if (!tkd.Contains(src1.KeyB))
            {
                Assert.Pass();
            }

            tkd.Remove((object)src2.KeyA);
            if (tkd.Contains(src1.KeyA))
            {
                Assert.Fail();
            }

            if (!tkd.Contains(src2.KeyB))
            {
                Assert.Pass();
            }
        }
コード例 #2
0
        public void Contains_TwoKeyValueTriple()
        {
            List <TwoKeyValueTriple <string, int, int> > items = new List <TwoKeyValueTriple <string, int, int> >();
            PackTwoKeyDictionary ptkd = new PackTwoKeyDictionary();

            for (int i = 0; i < POPSIZE; i++)
            {
                TwoKeyValueTriple <string, int, int> tkv = new TwoKeyValueTriple <string, int, int>(ptkd.kavalues[i], ptkd.kbvalues[i], ptkd.vvalues[i]);
                items.Add(tkv);
            }

            TwoKeyDictionary <string, int, int> tkd = new TwoKeyDictionary <string, int, int>();

            for (int i = 0; i < items.Count; i++)
            {
                tkd.Add(items[i]);
            }

            for (int i = 0; i < POPSIZE; i++)
            {
                if (!tkd.Contains(items[i]))
                {
                    Assert.Fail();
                }
            }

            Assert.Pass();
        }
コード例 #3
0
        public void Contains_Object()
        {
            PackTwoKeyDictionary ptkd = new PackTwoKeyDictionary();
            TwoKeyDictionary <string, int, int> tkd = ptkd.GetLoadedTwoKeyDictionary(POPSIZE);
            object keya = ptkd.kavalues[3];
            object keyb = ptkd.kbvalues[6];

            if (!tkd.Contains(keya))
            {
                Assert.Fail();
            }

            if (!tkd.Contains(keyb))
            {
                Assert.Fail();
            }
        }
コード例 #4
0
        public void RemoveKeyB()
        {
            PackTwoKeyDictionary ptkd = new PackTwoKeyDictionary();
            TwoKeyDictionary <string, int, int> tkd = ptkd.GetLoadedTwoKeyDictionary(POPSIZE);

            if (!tkd.RemoveKeyB(ptkd.kbvalues[5]))
            {
                Assert.Fail();
            }

            if (!tkd.Contains(ptkd.kavalues[5]))
            {
                Assert.Pass();
            }
        }
コード例 #5
0
        public void Remove_TwoKeyValueTriple()
        {
            PackTwoKeyDictionary ptkd = new PackTwoKeyDictionary();
            TwoKeyDictionary <string, int, int> tkd = ptkd.GetLoadedTwoKeyDictionary(POPSIZE);

            TwoKeyValueTriple <string, int, int>[] items = new TwoKeyValueTriple <string, int, int> [tkd.Count];

            for (int i = 0; i < tkd.Count; i++)
            {
                TwoKeyValueTriple <string, int, int> tkvt = new TwoKeyValueTriple <string, int, int>(ptkd.kavalues[i], ptkd.kbvalues[i], ptkd.vvalues[i]);
                items[i] = tkvt;
            }

            if (!tkd.Remove(items[5]))
            {
                Assert.Fail();
            }

            if (!tkd.Contains(items[5]))
            {
                Assert.Pass();
            }
        }