예제 #1
0
        public static void main()
        {
            OrderedStream  os   = new OrderedStream(5);
            IList <string> list = os.Insert(3, "ccccc"); // Inserts (3, "ccccc"), returns [].

            dumpList(list);
            list = os.Insert(1, "aaaaa"); // Inserts (1, "aaaaa"), returns ["aaaaa"].
            dumpList(list);
            list = os.Insert(2, "bbbbb"); // Inserts (2, "bbbbb"), returns ["bbbbb", "ccccc"].
            dumpList(list);
            list = os.Insert(5, "eeeee"); // Inserts (5, "eeeee"), returns [].
            dumpList(list);
            list = os.Insert(4, "ddddd"); // Inserts (4, "ddddd"), returns ["ddddd", "eeeee"].
            dumpList(list);
        }
예제 #2
0
    public void ExampleTest1()
    {
        // Your OrderedStream object will be instantiated and called as such:
        OrderedStream  obj     = new OrderedStream(5);
        IList <string> param_1 = obj.Insert(3, "ccccc");

        obj.Insert(1, "aaaaa");
        obj.Insert(2, "bbbbb");
        obj.Insert(5, "eeeee");
        obj.Insert(4, "ddddd");

        string[][] expected =
        {
            new[] { ""      },
            new[] { "aaaaa" },
            new[] { "bbbbb", "ccccc"},
            new[] { ""      },
            new[] { "ddddd", "eeeee"}
        };

        Assert.AreEqual(expected, param_1);
    }