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)); }
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)); }
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()); }
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()); }
public void TestGetSameCount() { AntString antStr = new AntString("111100"); Assert.AreEqual(4, antStr.getSameCount()); }