Fix diff case
[lightning.git] / lis_test.go
1 // Copyright (C) The Lightning Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package lightning
6
7 import (
8         "gopkg.in/check.v1"
9 )
10
11 type lisSuite struct{}
12
13 var _ = check.Suite(&lisSuite{})
14
15 func (s *lisSuite) Test(c *check.C) {
16         for _, trial := range []struct {
17                 in  []int
18                 out []int
19         }{
20                 {},
21                 {
22                         in: []int{},
23                 },
24                 {
25                         in:  []int{0},
26                         out: []int{0},
27                 },
28                 {
29                         in:  []int{1, 2, 3, 4},
30                         out: []int{0, 1, 2, 3},
31                 },
32                 {
33                         in:  []int{1, 2, 2, 4},
34                         out: []int{0, 2, 3},
35                 },
36                 {
37                         in:  []int{4, 3, 2, 1},
38                         out: []int{3},
39                 },
40                 {
41                         in:  []int{1, 3, 2, 4},
42                         out: []int{0, 2, 3},
43                 },
44                 {
45                         in:  []int{1, 0, 0, 0, 4},
46                         out: []int{3, 4},
47                 },
48                 {
49                         in:  []int{0, 1, 2, 1, 4, 5},
50                         out: []int{0, 1, 2, 4, 5},
51                 },
52         } {
53                 c.Logf("=== %v", trial)
54                 c.Check(longestIncreasingSubsequence(len(trial.in), func(i int) int { return trial.in[i] }), check.DeepEquals, trial.out)
55         }
56 }