The original challenge PDF asks for a method that converts “old phone keypad” input (digits, pauses, backspace *, send #) into text, plus tests and documentation.
The AI usage can be seen at https://chatgpt.com/share/691b01cc-47e0-8000-9e4f-a32716cb1a3e
- Keys
2–9map to letters (2→ABC,3→DEF, …,9→WXYZ). - Repeating a key cycles through its letters (for key
2:2#→A,22#→B,222#→C). - A space separates sequences on the same key (e.g.
222 2 22#→CAB). *acts as backspace, deleting the last output character.#sends the message and terminates input; it is not part of the output.
Examples from the PDF (covered by tests):
OldPhonePad("33#")→EOldPhonePad("227*#")→BOldPhonePad("4433555 555666#")→HELLOOldPhonePad("8 88777444666*664#")→TURING
- Core logic:
OldPhonePad/OldPhonePad.cs(OldPhonePadApp.OldPhonePad.Convert(string input)). - Console entry point:
OldPhonePad/Program.cs:- Writes
Enter key sequence: - Reads a line (e.g.
4433555 555666#) and prints the decoded output.
- Writes
From the root:
-
Build the app project:
dotnet build OldPhonePad/OldPhonePad.csproj -
Run the app project:
dotnet run --project OldPhonePad/OldPhonePad.csproj
Example:
- Input:
4433555 555666# - Output:
HELLO
From the repository root:
-
Run tests with line/branch coverage (
coverage.runsettings+ XPlat Code Coverage):
dotnet test OldPhonePad.Tests/OldPhonePad.Tests.csproj --collect:"XPlat Code Coverage" --settings coverage.runsettingsThis produces
OldPhonePad.Tests/TestResults/<guid>/coverage.info(LCOV). -
(Optional) Generate an HTML report with ReportGenerator:
- Install once (if needed):
dotnet tool install -g dotnet-reportgenerator-globaltool - Generate report:
reportgenerator -reports:"OldPhonePad.Tests/TestResults/*/coverage.info" -targetdir:"coveragereport" -reporttypes:Html
- Install once (if needed):
Open coveragereport/index.html to inspect coverage.