1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 type lisSuite struct{}
13 var _ = check.Suite(&lisSuite{})
15 func (s *lisSuite) Test(c *check.C) {
16 for _, trial := range []struct {
29 in: []int{1, 2, 3, 4},
30 out: []int{0, 1, 2, 3},
33 in: []int{1, 2, 2, 4},
37 in: []int{4, 3, 2, 1},
41 in: []int{1, 3, 2, 4},
45 in: []int{1, 0, 0, 0, 4},
49 in: []int{0, 1, 2, 1, 4, 5},
50 out: []int{0, 1, 2, 4, 5},
53 c.Logf("=== %v", trial)
54 c.Check(longestIncreasingSubsequence(len(trial.in), func(i int) int { return trial.in[i] }), check.DeepEquals, trial.out)