MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / TestProblem18_Func

Function TestProblem18_Func

project_euler/problem_18/problem18_test.go:6–35  ·  view source on GitHub ↗

Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

4
5// Tests
6func TestProblem18_Func(t *testing.T) {
7 tests := []struct {
8 name string
9 input []string
10 deep int
11 expected int
12 }{
13 {
14 name: "Test case 1",
15 input: problem18_test_parsed_string,
16 deep: 2,
17 expected: 23,
18 },
19 {
20 name: "Test case 2",
21 input: problem18_input_parsed_string,
22 deep: 2,
23 expected: 1074,
24 },
25 }
26
27 for _, test := range tests {
28 t.Run(test.name, func(t *testing.T) {
29 actual := Problem18(test.input, test.deep)
30 if actual != test.expected {
31 t.Errorf("Expected %d, but got %d", test.expected, actual)
32 }
33 })
34 }
35}
36
37// Benchmarks
38func BenchmarkProblem18_Func(b *testing.B) {

Callers

nothing calls this directly

Calls 1

Problem18Function · 0.85

Tested by

no test coverage detected