-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCase.cs
More file actions
36 lines (30 loc) · 1.04 KB
/
Copy pathTestCase.cs
File metadata and controls
36 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
namespace CodingRange
{
public readonly struct TestCase
{
public readonly object[] inputs;
public readonly object expectedOutput;
public TestCase(object[] inputs, object expectedOutput)
{
this.inputs = inputs;
this.expectedOutput = expectedOutput;
}
public void DisplayExample()
{
var exampleInputs = DisplayHelper.ForDisplay(inputs, true);
var exampleOutputs = DisplayHelper.ForDisplay(expectedOutput, false);
Console.WriteLine($"\nExample: {exampleInputs} => {exampleOutputs}");
}
public void DisplayDiscrepancy(object result)
{
Console.WriteLine("Error!");
if (inputs is not null && inputs.Length > 0)
{
Console.WriteLine($"Inputs: {DisplayHelper.ForDisplay(inputs, true)}");
}
Console.WriteLine($"Got: {DisplayHelper.ForDisplay(result, false)}");
Console.WriteLine($"Expected: {DisplayHelper.ForDisplay(expectedOutput, false)}");
}
}
}