예제 #1
0
        public void RegexpBuildingPerformanceTest3()
        {
            Assert.Timeout(() =>
            {
                StringDistribution dist = StringFormatOp_RequireEveryPlaceholder_NoArgumentNames.FormatAverageConditional(
                    StringDistribution.String("aaaaaaaaaaa"),
                    new[] { StringDistribution.PointMass("a"), StringDistribution.PointMass("aa") });

                Console.WriteLine(dist.ToString());

                ProfileAction(() => RegexpTreeBuilder.BuildRegexp(dist.GetWorkspaceOrPoint()), 1000);
            }, 20000);
        }
예제 #2
0
 /// <summary>
 /// A helper function for testing messages to <c>format</c>.
 /// </summary>
 /// <param name="str">The message from <c>str</c>.</param>
 /// <param name="args">The message from <c>args</c>.</param>
 /// <param name="expectedFormatRequireEveryPlaceholder">
 /// The expected message to <c>format</c> if the format string is required to contain placeholders for all arguments.
 /// </param>
 /// <param name="expectedFormatAllowMissingPlaceholders">
 /// The expected message to <c>format</c> if the format string may not contain placeholders for some arguments.
 /// </param>
 private static void TestMessageToFormat(
     StringDistribution str,
     StringDistribution[] args,
     StringDistribution expectedFormatRequireEveryPlaceholder,
     StringDistribution expectedFormatAllowMissingPlaceholders)
 {
     string[] argNames = GetDefaultArgumentNames(args.Length);
     Assert.Equal(
         expectedFormatRequireEveryPlaceholder,
         StringFormatOp_RequireEveryPlaceholder_NoArgumentNames.FormatAverageConditional(str, args));
     Assert.Equal(
         expectedFormatRequireEveryPlaceholder,
         StringFormatOp_RequireEveryPlaceholder.FormatAverageConditional(str, args, argNames));
     Assert.Equal(
         expectedFormatAllowMissingPlaceholders,
         StringFormatOp_AllowMissingPlaceholders_NoArgumentNames.FormatAverageConditional(str, args));
     Assert.Equal(
         expectedFormatAllowMissingPlaceholders,
         StringFormatOp_AllowMissingPlaceholders.FormatAverageConditional(str, args, argNames));
 }