MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / Test_fib

Function Test_fib

fibonacci_number_509/solution_test.go:8–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func Test_fib(t *testing.T) {
9 type args struct {
10 N int
11 }
12 tests := []struct {
13 name string
14 args args
15 want int
16 }{
17 {
18 name: "nth fibonacci number",
19 args: args{
20 N: 0,
21 },
22 want: 0,
23 },
24 {
25 name: "nth fibonacci number",
26 args: args{
27 N: 1,
28 },
29 want: 1,
30 },
31 {
32 name: "nth fibonacci number",
33 args: args{
34 N: 2,
35 },
36 want: 1,
37 },
38 {
39 name: "nth fibonacci number",
40 args: args{
41 N: 3,
42 },
43 want: 2,
44 },
45 {
46 name: "nth fibonacci number",
47 args: args{
48 N: 4,
49 },
50 want: 3,
51 },
52 }
53 for _, tt := range tests {
54 t.Run(tt.name, func(t *testing.T) {
55 assert.Equal(t, tt.want, fib(tt.args.N))
56 })
57 }
58}

Callers

nothing calls this directly

Calls 1

fibFunction · 0.85

Tested by

no test coverage detected