< Summary

Information
Class: Rudim.CLI.CliClient
Assembly: Rudim
File(s): /home/runner/work/rudim/rudim/Rudim/CLI/CliClient.cs
Line coverage
47%
Covered lines: 8
Uncovered lines: 9
Coverable lines: 17
Total lines: 50
Line coverage: 47%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
Run()0%2040%
WriteLine(...)100%11100%

File(s)

/home/runner/work/rudim/rudim/Rudim/CLI/CliClient.cs

#LineLine coverage
 1using Rudim.CLI.UCI;
 2using System;
 3using System.Collections.Generic;
 4using System.Linq;
 5
 6namespace Rudim.CLI
 7{
 8    public class CliClient
 9    {
 10        private static IDictionary<string, ICliCommand> Commands;
 11
 12        static CliClient()
 13        {
 114            Commands = new Dictionary<string, ICliCommand>
 115            {
 116                ["info"] = new InfoCommand(),
 117                ["uci"] = new UciClient()
 118            };
 119        }
 20        public static void Run()
 21        {
 022            while (true)
 23            {
 024                string[] input = Console.ReadLine().Split(' ');
 025                string command = input[0];
 026                string[] parameters = input.Skip(1).ToArray();
 27
 028                if (command == "exit")
 29                {
 030                    Environment.Exit(0);
 31                }
 32
 033                if (Commands.ContainsKey(command))
 34                {
 035                    Commands[command].Run(parameters);
 36                }
 37                else
 38                {
 039                    WriteLine($"Unknown command {command}");
 40                }
 41            }
 42        }
 43
 44
 45        public static void WriteLine(string message)
 46        {
 147            Console.WriteLine(message);
 148        }
 49    }
 50}