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

Function TestProblem2_Func

project_euler/problem_2/problem2_test.go:6–38  ·  view source on GitHub ↗

Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

4
5// Tests
6func TestProblem2_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: 10,
16 },
17 {
18 name: "Testcase 2 - input 100",
19 input: 100,
20 want: 44,
21 },
22 {
23 name: "Testcase 3 - input 4e6",
24 input: 4e6,
25 want: 4613732,
26 },
27 }
28
29 for _, tt := range tests {
30 t.Run(tt.name, func(t *testing.T) {
31 n := Problem2(tt.input)
32
33 if n != tt.want {
34 t.Errorf("Problem2() = %v, want %v", n, tt.want)
35 }
36 })
37 }
38}
39
40// Benchmarks
41func BenchmarkProblem2(b *testing.B) {

Callers

nothing calls this directly

Calls 1

Problem2Function · 0.85

Tested by

no test coverage detected