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

Function TestProblem3_Func

project_euler/problem_3/problem3_test.go:6–33  ·  view source on GitHub ↗

Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Problem3Function · 0.85

Tested by

no test coverage detected