< Summary

Class:NanoCLang.VerbConsole
Assembly:NanoCLang
File(s):C:\GitLab-Runner\builds\JxAESPd8\0\chenmichael\nanoc\src\NanoCLang\VerbConsole.cs
Covered lines:7
Uncovered lines:2
Coverable lines:9
Total lines:49
Line coverage:77.7% (7 of 9)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Verbosity()100%1100%
WriteLine(...)50%275%
WriteLine(...)50%275%

File(s)

C:\GitLab-Runner\builds\JxAESPd8\0\chenmichael\nanoc\src\NanoCLang\VerbConsole.cs

#LineLine coverage
 1using System;
 2
 3namespace NanoCLang {
 4    /// <summary>
 5    /// Provides the class to toggle the verbosity of the program output during well-formedness checking.
 6    /// </summary>
 7    public static class VerbConsole {
 8        /// <summary>
 9        /// Gets or sets the current verbosity level. All information that has less verbosity is omitted.
 10        /// </summary>
 217611        public static VerbosityLevel Verbosity { get; set; } = VerbosityLevel.High;
 12        /// <summary>
 13        /// Writes a formatted string to the console depending on the current verbosity level.
 14        /// </summary>
 15        /// <param name="level">Level of verbosity to print with. The higher the level of a write, the lower its importa
 16        /// <param name="format">A composite format string.</param>
 17        /// <param name="arg">An array of objects to write using <paramref name="format"/>.</param>
 18518        public static void WriteLine(VerbosityLevel level, string format, params object[] arg) {
 18519            if ((int)Verbosity <= (int)level)
 020                Console.Error.WriteLine(format, arg);
 18521        }
 22        /// <summary>
 23        /// Writes a string to the console depending on the current verbosity level.
 24        /// </summary>
 25        /// <param name="level">Level of verbosity to print with. The higher the level of a write, the lower its importa
 26        /// <param name="value">The value to write.</param>
 199027        public static void WriteLine(VerbosityLevel level, string value) {
 199028            if ((int)Verbosity <= (int)level)
 029                Console.Error.WriteLine(value);
 199030        }
 31    }
 32    /// <summary>
 33    /// A verbosity level enumeration that lists possible verbosities.
 34    /// </summary>
 35    public enum VerbosityLevel : int {
 36        /// <summary>
 37        /// Low verbosity, only outputs on failure.
 38        /// </summary>
 39        Quiet = -5,
 40        /// <summary>
 41        /// Default verbosity, outputs important information.
 42        /// </summary>
 43        Default = 0,
 44        /// <summary>
 45        /// High verbosity, outputs additional information.
 46        /// </summary>
 47        High = 5
 48    }
 49}