< Summary

Class:GDX.Developer.ConsoleCommands.ConsoleVariablesConsoleCommand
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/ConsoleVariablesConsoleCommands.cs
Covered lines:3
Uncovered lines:23
Coverable lines:26
Total lines:51
Line coverage:11.5% (3 of 26)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:3
Method coverage:33.3% (1 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Evaluate(...)0%12300%
GetKeyword()0%110100%
GetHelpMessage()0%2100%

File(s)

./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/ConsoleVariablesConsoleCommands.cs

#LineLine coverage
 1// Copyright (c) 2020-2024 dotBunny Inc.
 2// dotBunny licenses this file to you under the BSL-1.0 license.
 3// See the LICENSE file in the project root for more information.
 4
 5using System.Collections.Generic;
 6
 7namespace GDX.Developer.ConsoleCommands
 8{
 9#if UNITY_2022_2_OR_NEWER
 10    public class ConsoleVariablesConsoleCommand : ConsoleCommandBase
 11    {
 12        /// <inheritdoc />
 13        public override bool Evaluate(float deltaTime)
 014        {
 015            TextGenerator textGenerator = new TextGenerator();
 016            List<string> sortedVariables = new List<string>(Console.GetVariableNamesCopy());
 017            sortedVariables.Sort();
 018            int variableCount = sortedVariables.Count;
 019            Console.ConsoleAccessLevel maxAccessLevel = Console.GetAccessLevel();
 020            for (int i = 0; i < variableCount; i++)
 021            {
 022                ConsoleVariableBase variable = Console.GetVariable(sortedVariables[i]);
 023                if (variable.GetAccessLevel() > maxAccessLevel)
 024                {
 025                    continue;
 26                }
 27
 028                textGenerator.AppendLine(variable.GetName());
 029                textGenerator.AppendLine($"\t{variable.GetDescription()}");
 030                textGenerator.AppendLine($"\tCurrent: {variable.GetCurrentValueAsString()}");
 031                textGenerator.AppendLine($"\tDefault: {variable.GetDefaultValueAsString()}");
 032            }
 33
 034            UnityEngine.Debug.Log(textGenerator.ToString());
 035            return true;
 036        }
 37
 38        /// <inheritdoc />
 39        public override string GetKeyword()
 740        {
 741            return "cvars";
 742        }
 43
 44        /// <inheritdoc />
 45        public override string GetHelpMessage()
 046        {
 047            return "Return a list of all registered console variables.";
 048        }
 49    }
 50#endif // UNITY_2022_2_OR_NEWER
 51}

Coverage by test methods







Methods/Properties

Evaluate(System.Single)
GetKeyword()
GetHelpMessage()