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

Function TestProblem1_Func

project_euler/problem_1/problem1_test.go:6–38  ·  view source on GitHub ↗

Tests

(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Problem1Function · 0.85

Tested by

no test coverage detected