< Summary

Class:GDX.Developer.ConsoleCommands.WatchListConsoleCommand
Assembly:GDX
File(s):./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/WatchListConsoleCommand.cs
Covered lines:4
Uncovered lines:33
Coverable lines:37
Total lines:70
Line coverage:10.8% (4 of 37)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:6
Method coverage:33.3% (2 of 6)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WatchListConsoleCommand()0%110100%
Evaluate(...)0%30500%
GetKeyword()0%110100%
GetHelpUsage()0%2100%
GetHelpMessage()0%2100%
GetInstance(...)0%2100%

File(s)

./Packages/com.dotbunny.gdx/GDX/Developer/ConsoleCommands/WatchListConsoleCommand.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
 5namespace GDX.Developer.ConsoleCommands
 6{
 7#if UNITY_2022_2_OR_NEWER
 8    public class WatchListConsoleCommand : ConsoleCommandBase
 9    {
 710        string m_Filter = null;
 11
 12        public override bool Evaluate(float deltaTime)
 013        {
 014      TextGenerator enabledGenerator = new TextGenerator();
 015            enabledGenerator.AppendLine("Enabled Watches");
 16
 017            TextGenerator disabledGenerator = new TextGenerator();
 018            disabledGenerator.AppendLine("Disabled Watches");
 19
 020            bool isFiltering = !string.IsNullOrEmpty(m_Filter);
 21
 022            WatchProvider.WatchList watches = WatchProvider.GetWatchList();
 23
 024            for (int i = 0; i < watches.Count; i++)
 025            {
 026                if (isFiltering && !watches.Identfiers[i].Contains(m_Filter))
 027                {
 028                    continue;
 29                }
 30
 031                if (watches.IsActive[i])
 032                {
 033                    enabledGenerator.AppendLine($"\t{watches.Identfiers[i]} : {watches.DisplayNames[i]}");
 034                }
 35                else
 036                {
 037                    disabledGenerator.AppendLine($"\t{watches.Identfiers[i]} : {watches.DisplayNames[i]}");
 038                }
 039            }
 040            enabledGenerator.AppendLine(disabledGenerator.ToString());
 041            UnityEngine.Debug.Log(enabledGenerator.ToString());
 042            return true;
 043        }
 44
 45        /// <inheritdoc />
 46        public override string GetKeyword()
 747        {
 748            return "watch.list";
 749        }
 50
 51        /// <inheritdoc />
 52        public override string GetHelpUsage()
 053        {
 054            return "watch.list <filter>";
 055        }
 56
 57        /// <inheritdoc />
 58        public override string GetHelpMessage()
 059        {
 060            return "Return a list of all registered watches, with the ability to filter.";
 061        }
 62
 63        /// <inheritdoc />
 64        public override ConsoleCommandBase GetInstance(string context)
 065        {
 066            return new WatchListConsoleCommand { m_Filter = context };
 067        }
 68    }
 69#endif // UNITY_2022_2_OR_NEWER
 70}

Coverage by test methods







Methods/Properties

WatchListConsoleCommand()
Evaluate(System.Single)
GetKeyword()
GetHelpUsage()
GetHelpMessage()
GetInstance(System.String)