Example #1
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));
        }
Example #2
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());
        }