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