コード例 #1
0
        public void Add(bool a, int b, long val)
        {
            NKeyHash <bool, int, long> cube = new NKeyHash <bool, int, long>();

            cube.Add(a, b, val);
            Assert.AreEqual(val, cube.Get(a, b));
        }
コード例 #2
0
        public void Forloop4()
        {
            List <Expected4> data4 = new List <Expected4>();

            data4.Add(new Expected4 {
                E1 = 1, E2 = 3, E3 = 5, E4 = "zxcv"
            });
            data4.Add(new Expected4 {
                E1 = 5, E2 = 2, E3 = 15, E4 = "asdf"
            });
            data4.Add(new Expected4 {
                E1 = 3, E2 = 6, E3 = -5, E4 = "4t6a"
            });

            NKeyHash <long, decimal, float, string> cube4 = new NKeyHash <long, decimal, float, string>();

            foreach (Expected4 x in data4)
            {
                cube4.Add(x.E1, x.E2, x.E3, x.E4);
            }

            foreach (NKeyValue <long, decimal, float, string> cc4 in cube4)
            {
                Assert.IsTrue(data4.Contains(new Expected4 {
                    E1 = cc4.Key0, E2 = cc4.Key1, E3 = cc4.Key2, E4 = cc4.Value
                }), "Cube4 does not contain what Data4 contains");
            }

            foreach (Expected4 x in data4)
            {
                Assert.AreEqual(x.E4, cube4.Get(x.E1, x.E2, x.E3), "Data4 does not contain what Cube4 contains");
            }
        }
コード例 #3
0
        public void Upsert(bool a, int b, long val)
        {
            NKeyHash <bool, int, long> cube = new NKeyHash <bool, int, long>();
            long newValue = 0;

            cube.Add(a, b, val);
            cube.Upsert(a, b, newValue);
            Assert.AreEqual(newValue, cube.Get(a, b));
        }