< Summary

Information
Class: LeetCode.Algorithms.RomanToInteger.Iterative.RomanNumeral
Assembly: LeetCode
File(s): D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\RomanToInteger\Iterative\RomanNumeral.cs
Line coverage
88%
Covered lines: 23
Uncovered lines: 3
Coverable lines: 26
Total lines: 49
Line coverage: 88.4%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Symbol()100%11100%
get_Value()100%11100%
get_I()100%11100%
get_V()100%11100%
get_X()100%11100%
get_L()100%11100%
get_C()100%11100%
get_D()100%11100%
get_M()100%11100%
get_RomanNumerals()100%22100%
ToString()100%210%
GetRomanNumerals()100%11100%

File(s)

D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\RomanToInteger\Iterative\RomanNumeral.cs

#LineLine coverage
 1// --------------------------------------------------------------------------------
 2// Copyright (C) 2025 Eugene Eremeev (also known as Yevhenii Yeriemeieiv).
 3// All Rights Reserved.
 4// --------------------------------------------------------------------------------
 5// This software is the confidential and proprietary information of Eugene Eremeev
 6// (also known as Yevhenii Yeriemeieiv) ("Confidential Information"). You shall not
 7// disclose such Confidential Information and shall use it only in accordance with
 8// the terms of the license agreement you entered into with Eugene Eremeev (also
 9// known as Yevhenii Yeriemeieiv).
 10// --------------------------------------------------------------------------------
 11
 12namespace LeetCode.Algorithms.RomanToInteger.Iterative;
 13
 1314internal class RomanNumeral(RomanSymbol symbol, int value)
 15{
 16    private static List<RomanNumeral>? _romanNumerals;
 17
 9618    public RomanSymbol Symbol { get; } = symbol;
 2519    public int Value { get; } = value;
 20
 121    public static RomanNumeral I => new(RomanSymbol.I, 1);
 122    public static RomanNumeral V => new(RomanSymbol.V, 5);
 123    public static RomanNumeral X => new(RomanSymbol.X, 10);
 124    public static RomanNumeral L => new(RomanSymbol.L, 50);
 125    public static RomanNumeral C => new(RomanSymbol.C, 100);
 126    public static RomanNumeral D => new(RomanSymbol.D, 500);
 127    public static RomanNumeral M => new(RomanSymbol.M, 1000);
 28
 929    public static List<RomanNumeral> RomanNumerals => _romanNumerals ??= GetRomanNumerals();
 30
 31    public override string ToString()
 032    {
 033        return Symbol.ToString();
 034    }
 35
 36    private static List<RomanNumeral> GetRomanNumerals()
 137    {
 138        return new List<RomanNumeral>
 139        {
 140            I,
 141            V,
 142            X,
 143            L,
 144            C,
 145            D,
 146            M
 147        };
 148    }
 49}