コード例 #1
0
        public void GetSizeTest(int size)
        {
            var list = new List <VarInt>();

            for (int i = 0; i < size; ++i)
            {
                list.Add(new VarInt("", ""));
            }

            var svwLocal = new SetVariablesWrapper(list);

            Assert.AreEqual(size, svwLocal.GetNumberVariables());
        }
コード例 #2
0
        public void GetIndexTest()
        {
            var domain = new Domain(10, 0);
            var obj1   = new VarInt("a", "aa", domain, 5);
            var obj2   = new VarInt("b", "bb", domain, -1);
            var obj3   = new VarInt("c", "cc", domain, 4);
            var svw    = new SetVariablesWrapper(new List <VarInt> {
                obj1, obj2
            });

            Assert.AreEqual(0, svw.GetIndex(obj1));
            Assert.AreEqual(1, svw.GetIndex(obj2));
            Assert.AreEqual(-1, svw.GetIndex(obj3));
        }
コード例 #3
0
        public void GetIndexTest()
        {
            var domain = new Domain(10, 0);
            var obj1   = new VarInt("a", "aa", domain, 5);
            var obj2   = new VarInt("b", "bb", domain, -1);
            var obj3   = new VarInt("c", "cc", domain, 4);
            var svw    = new SetVariablesWrapper(new List <VarInt> {
                obj1, obj2
            });

            Assert.That(svw.GetIndex(obj1), Is.Zero);
            Assert.That(svw.GetIndex(obj2), Is.EqualTo(1));
            Assert.That(svw.GetIndex(obj3), Is.EqualTo(-1));
        }