コード例 #1
0
ファイル: TestOverlap.cs プロジェクト: FanZhangSX/Aderant
        public void TestWholeProcessByNullString()
        {
            var overlap = new Overlap((string)null);

            Assert.AreEqual(overlap.MergeOverlap(), string.Empty);
            overlap.Dispose();
        }
コード例 #2
0
ファイル: TestOverlap.cs プロジェクト: FanZhangSX/Aderant
        public void TestWholeProcessByString()
        {
            var fragments = new StringBuilder();

            fragments.Append("all is well\n");
            fragments.Append("ell that en\n");
            fragments.Append("hat end\n");
            fragments.Append("t ends well\n");
            var overlap = new Overlap(fragments.ToString());

            Assert.AreEqual(overlap.MergeOverlap(), "all is well that ends well");
            overlap.Dispose();
        }
コード例 #3
0
ファイル: TestOverlap.cs プロジェクト: FanZhangSX/Aderant
        public void TestWholeProcessByRandomArray()
        {
            var s = @"Other collaborative online encyclopedias were attempted before Wikipedia, but none were as successful.[24] Wikipedia began as a complementary project for Nupedia, a free online English-language encyclopedia project whose articles were written by experts and reviewed under a formal process.[25] It was founded on March 9, 2000, under the ownership of Bomis, a web portal company. Its main figures were Bomis CEO Jimmy Wales and Larry Sanger, editor-in-chief for Nupedia and later Wikipedia.[26][27] Nupedia was initially licensed under its own Nupedia Open Content License, but even before Wikipedia was founded, Nupedia switched to the GNU Free Documentation License at the urging of Richard Stallman.[28] Wales is credited with defining the goal of making a publicly editable encyclopedia,[29][30] while Sanger is credited with the strategy of using a wiki to reach that goal.[31] On January 10, 2001, Sanger proposed on the Nupedia mailing list to create a wiki as a feeder project for Nupedia.[32]";

            int successTimes = 0;

            for (int i = 0; i < 10; i++)
            {
                var l = ProduceTestCase(s);
                l = Shuffle(l);
                var overlap = new Overlap(l);
                if (s.Equals(overlap.MergeOverlap()))
                {
                    successTimes++;
                }
                overlap.Dispose();
            }

            Assert.IsTrue(successTimes > 0);
        }