Beispiel #1
0
        private void testContains(BasicStack <DSString> the_stack)
        {
            //make sure all items are matched inside
            Assert.AreEqual(true, the_stack.contains(new DSString("0")));
            Assert.AreEqual(true, the_stack.contains(new DSString("1")));
            Assert.AreEqual(true, the_stack.contains(new DSString("2")));
            Assert.AreEqual(true, the_stack.contains(new DSString("3")));
            Assert.AreEqual(true, the_stack.contains(new DSString("4")));
            Assert.AreEqual(true, the_stack.contains(new DSString("5")));
            Assert.AreEqual(true, the_stack.contains(new DSString("6")));
            Assert.AreEqual(true, the_stack.contains(new DSString("7")));
            Assert.AreEqual(true, the_stack.contains(new DSString("8")));
            Assert.AreEqual(true, the_stack.contains(new DSString("9")));

            //check after removal
            the_stack.pop();
            Assert.AreEqual(false, the_stack.contains(new DSString("9")));

            //check after adding
            the_stack.push(new DSString("13"));
            Assert.AreEqual(true, the_stack.contains(new DSString("13")));

            //check after removing all
            the_stack.clear();
            Assert.AreEqual(false, the_stack.contains(new DSString("13")));
            Assert.AreEqual(false, the_stack.contains(new DSString("0")));
            Assert.AreEqual(false, the_stack.contains(new DSString("1")));
            Assert.AreEqual(false, the_stack.contains(new DSString("2")));
            Assert.AreEqual(false, the_stack.contains(new DSString("3")));
            Assert.AreEqual(false, the_stack.contains(new DSString("4")));
            Assert.AreEqual(false, the_stack.contains(new DSString("5")));
            Assert.AreEqual(false, the_stack.contains(new DSString("6")));
            Assert.AreEqual(false, the_stack.contains(new DSString("7")));
            Assert.AreEqual(false, the_stack.contains(new DSString("8")));
            Assert.AreEqual(false, the_stack.contains(new DSString("9")));
        }