예제 #1
0
        private static LocalStats GetOrMaterialize(string project, Dictionary <string, LocalStats> dic)
        {
            Contract.Ensures(Contract.Result <LocalStats>() != null);

            LocalStats result;

            if (!dic.TryGetValue(project, out result))
            {
                result = new LocalStats();
                dic.Add(project, result);
            }
            else
            {
                Contract.Assume(result != null);
            }
            return(result);
        }
예제 #2
0
        private static Dictionary <string, LocalStats> OneFileStats(string file)
        {
            var result = new Dictionary <string, LocalStats>();

            try
            {
                var lines = File.ReadAllLines(file);

                LocalStats last = null;
                for (int i = 0; i < lines.Length; i++)
                {
                    var    line        = lines[i];
                    string projectName = "<dummy>";
                    if (MatchOneValue(ref projectName, line, @"^\s*(\d+(:\d+)?>)?CodeContracts:\s+([^:]+):", groupNo: 3))
                    {
                        if (!projectName.StartsWith("Checked "))
                        {
                            last = GetOrMaterialize(projectName, result);
                            MatchOneValue(ref last.MethodsAnalyzed, line, @"Total methods analyzed\s+(\d+)");
                            MatchOneValue(ref last.MethodsWith0Warnings, line, @"Methods with 0 warnings\s+(\d+)");
                            MatchOneValue(ref last.MethodsWithBaseLine, line, @"Methods with baseline:\s+(\d+)");
                            MatchOneValue(ref last.MethodsWithoutBaseLine, line, @"Methods w/o  baseline:\s+(\d+)");
                            MatchOneValue(ref last.MethodsWithIdenticalBaseLine, line, @"Methods with identical baseline:\s+(\d+)");
                            MatchOneValue(ref last.Checked, line, @"Checked\s+(\d+)\s+assertion");
                            MatchOneValue(ref last.Correct, line, @"(\d+)\s+correct");
                            MatchOneValue(ref last.Unknown, line, @"(\d+)\s+unknown");
                            MatchOneValue(ref last.Unreached, line, @"(\d+)\s+unreached");
                        }
                    }
                }
            }
            catch
            {
            }
            return(result);
        }
예제 #3
0
    private static LocalStats GetOrMaterialize(string project, Dictionary<string, LocalStats> dic)
    {
      Contract.Ensures(Contract.Result<LocalStats>() != null);

      LocalStats result;
      if (!dic.TryGetValue(project, out result))
      {
        result = new LocalStats();
        dic.Add(project, result);
      }
      else
      {
        Contract.Assume(result != null);
      }
      return result;
    }