Esempio n. 1
0
        public void TestIsSameWithKey()
        {
            AntString antStr = new AntString("1010");

            Assert.IsFalse(antStr.isSameWithKey(1));
            Assert.IsTrue(antStr.isSameWithKey(2));
            Assert.IsFalse(antStr.isSameWithKey(3));
            Assert.IsFalse(antStr.isSameWithKey(4));
        }
Esempio n. 2
0
        public void TestNextKeyAndOverflowNextKey()
        {
            AntString antStr = new AntString("00011100");

            Assert.AreEqual("0", antStr.getKey());
            Assert.IsTrue(antStr.nextKeyPosition(3));
            Assert.AreEqual("1", antStr.getKey());
            Assert.IsTrue(antStr.nextKeyPosition(3));
            Assert.AreEqual("0", antStr.getKey());

            Assert.IsFalse(antStr.nextKeyPosition(2));
        }
Esempio n. 3
0
        public void TestGetAnt()
        {
            AntString antStr = new AntString("001100");

            Assert.AreEqual("021202", antStr.getNextAnt());

            antStr = new AntString("1");
            Assert.AreEqual("11", antStr.getNextAnt());

            antStr = new AntString("11");
            Assert.AreEqual("12", antStr.getNextAnt());

            //antStr = new AntString("");
            //Assert.AreEqual("", antStr.getNextAnt());
        }
Esempio n. 4
0
        public void TestGetSameCountAndNextKey()
        {
            AntString antStr = new AntString("110001110");

            Assert.AreEqual("1", antStr.getKey());

            int nextKeyPosition = antStr.getSameCount();

            antStr.nextKeyPosition(nextKeyPosition);
            Assert.AreEqual("0", antStr.getKey());

            nextKeyPosition = antStr.getSameCount();
            antStr.nextKeyPosition(nextKeyPosition);
            Assert.AreEqual("1", antStr.getKey());

            nextKeyPosition = antStr.getSameCount();
            antStr.nextKeyPosition(nextKeyPosition);
            Assert.AreEqual("0", antStr.getKey());
        }
Esempio n. 5
0
        public void TestGetSameCount()
        {
            AntString antStr = new AntString("111100");

            Assert.AreEqual(4, antStr.getSameCount());
        }