public void FuzzTest()

in UProveUnitTest/EndToEndTest.cs [579:631]


        public void FuzzTest()
        {
            for (int repeat = 0; repeat < 20; repeat++)
            {
                StringBuilder msg = new StringBuilder("Test options: ");

                int numberOfPregenGenerators = ParameterSet.NumberOfIssuerGenerators;
                bool useSubgroupConstruction = CoinFlip(); msg.Append("group=" + (useSubgroupConstruction ? "subgroup" : "ECC"));
                int numberOfAttributes = CoinFlip() ?
                    // small number of attributes to use recommeded params [0, max]
                    random.Next(numberOfPregenGenerators + 1) :
                    // large number of attributes to use custom generators [max + 1, max + 10]
                    random.Next(10) + numberOfPregenGenerators + 1;
                msg.Append(", n=" + numberOfAttributes);
                bool deviceProtected = CoinFlip(); msg.Append(", device=" + (deviceProtected ? "true" : "false"));
                int numberOfTokens = random.Next(5) + 1; msg.Append(", #tokens=" + numberOfTokens);
                List<int> dList = new List<int>();
                List<int> uList = new List<int>();
                List<int> cList = new List<int>();
                for (int i = 1; i <= numberOfAttributes; i++)
                {
                    if (CoinFlip())
                    {
                        dList.Add(i); // disclosed attributes
                    }
                    else
                    {
                        uList.Add(i); // undisclosed attributes
                        if (CoinFlip())
                        {
                            cList.Add(i); // committed attributes
                        }
                    }
                }
                msg.Append(", D=" + PrintList(dList));
                msg.Append(", C=" + PrintList(cList));
                int[] dArray = dList.ToArray();
                int[] cArray = cList.ToArray();
                int pseudonymIndex = 0;
                if (uList.Count > 0)
                {
                    pseudonymIndex = CoinFlip() ? 0 : uList[random.Next(uList.Count)]; msg.Append(", p=" + pseudonymIndex); // random undisclosed attribute
                }
                try
                {
                    RunFuzzedTest(useSubgroupConstruction, "SHA256", numberOfAttributes, deviceProtected, numberOfTokens, dArray, cArray, pseudonymIndex);
                }
                catch (Exception e)
                {
                    Assert.Fail(msg.ToString() + ". Exception: " + e.StackTrace);
                }
            }
        }