示例#1
0
    /**
     * main.
     *
     * @param args
     */
    public static void main(string[] args)
    {
        int nbTests             = (args != null && args.Length >= 1) ? int.Parse(args[0]) : NB_TESTS;
        int nbOfExclusionMinMax = (args != null && args.Length >= 2) ? int.Parse(args[1]) : NB_OF_EXCLUSION_MIN_MAX;

        List <long> executionTimes = new List <long>(nbTests);

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(ExceptionTest.testUncheckedException());
        }
        executionTimes.Sort();
        Console.WriteLine("[ExceptionTest], Throw and catch RuntimeException " + NB_EXCEPTION_TESTS + " try {throw new RuntimeException()} catch (RuntimeException e) {  },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(ExceptionTest.testUncheckedExceptionWithDeepTry());
        }
        executionTimes.Sort();
        Console.WriteLine("[ExceptionTest], Throw and catch RuntimeException with deep try (5) " + NB_EXCEPTION_TESTS + " try { try { try { try { try {throw new RuntimeException()  } catch (RuntimeException e) {},, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();
    }