MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestProblem20_Func

Function TestProblem20_Func

project_euler/problem_20/problem20_test.go:6–24  ·  view source on GitHub ↗

Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

4
5// Tests
6func TestProblem20_Func(t *testing.T) {
7 tests := []struct {
8 name string
9 input int
10 expected int
11 }{
12 {"Problem 20 - Factorial digit sum", 10, 27},
13 {"Problem 20 - Factorial digit sum", 100, 648},
14 }
15
16 for _, test := range tests {
17 t.Run(test.name, func(t *testing.T) {
18 got := Problem20(test.input)
19 if got != test.expected {
20 t.Errorf("Problem20() = got %v, want %v", got, test.expected)
21 }
22 })
23 }
24}
25
26// Benchmarks
27func BenchmarkProblem20_Func(b *testing.B) {

Callers

nothing calls this directly

Calls 1

Problem20Function · 0.85

Tested by

no test coverage detected