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

Function TestProblem6_Func

project_euler/problem_6/problem6_test.go:6–33  ·  view source on GitHub ↗

Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

4
5// Tests
6func TestProblem6_Func(t *testing.T) {
7 tests := []struct {
8 name string
9 input uint
10 want uint
11 }{
12 {
13 name: "Testcase 1 - input 10",
14 input: 10,
15 want: 2640,
16 },
17 {
18 name: "Testcase 2 - input 100",
19 input: 100,
20 want: 25164150,
21 },
22 }
23
24 for _, tt := range tests {
25 t.Run(tt.name, func(t *testing.T) {
26 n := Problem6(tt.input)
27
28 if n != tt.want {
29 t.Errorf("Problem6() = %v, want %v", n, tt.want)
30 }
31 })
32 }
33}
34
35// Benchmarks
36func BenchmarkProblem6(b *testing.B) {

Callers

nothing calls this directly

Calls 1

Problem6Function · 0.85

Tested by

no test coverage detected