Exemplo n.º 1
0
        public void Ast_getRandom_tree()
        {
            //arrange
            AstWrapper sut = new AstWrapper();
            //act
            var n1 = sut.GetRandomGraph(randomsource);
            var n2 = sut.GetRandomGraph(randomsource);

            //assert
            sut.Print(n1).Should().NotBe(sut.Print(n2));
        }
Exemplo n.º 2
0
        public void Ast_getRandom_tree_stress()
        {
            //arrange
            AstWrapper sut = new AstWrapper();

            int population   = 1000;
            int equalCounter = 0;

            //act
            for (int i = 0; i < population; i++)
            {
                var n1 = sut.GetRandomGraph(randomsource);
                var n2 = sut.GetRandomGraph(randomsource);
                //assert
                if (sut.Print(n1) == sut.Print(n2))
                {
                    equalCounter++;
                }
                n1 = null;
                n2 = null;
            }
            ((double)(equalCounter / population)).Should().BeLessOrEqualTo(0.1);
            Console.WriteLine((double)(equalCounter / population));
        }