This repository was archived by the owner on Sep 20, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathnumber-of-longest-increasing-subsequence_test.go
executable file
·59 lines (47 loc) · 2.48 KB
/
number-of-longest-increasing-subsequence_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package problem0673
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
// tcs is testcase slice
var tcs = []struct {
nums []int
ans int
}{
{
[]int{-51352, 15205, -65427, -83043, 76659, -8024, -85277, -44152, 36446, 93694, 50743, 12892, 27985, 32150, -63844, 55946, -4000, 14123, 63541, 74544, -42255, 97608, 76290, 27429, 44628, 15894, 87961, -18456, 7487, 96033, 56941, 10910, -1177, 8875, 30191, 82607, -43724, 38113, 94726, 29250, 74589, 77271, -19031, -89367, 59834, -92444, 18138, -10681, -48922, 49634, 36196, 55360, 35096, -65044, -36847, 69609, 96398, 63949, 51367, -4949, 69677, -55449, -81826, 59265, 19403, -85698, 76146, 19048, -50975, 88533, 89822, -93839, 29632, -52868, -35704, -13993, 97623, 47644, 76941, 41852, 12972, -738, -97741, -8150, 28516, 33046, 63634, 15042, 90687, -25488, 64622, -46530, -56385, 13007, 38522, 42333, -55614, 69245, -88282, 98610, -82087, -87454, 95891, -22632, 79349, 48546, -31268, -6520, 4055, 37809, 75194, -59844, 99284, -6329, 11295, 19556, -55531, 66976, 92077, 97764, 45497, -17626, 74660, -57832, 83829, 46739, 35576, 38315, 4126, 23089, 64671, 12780, -96665, -47985, 83770, 46694, 91307, 94410, 8820, -83994, -21045, 70822, 73097, -7177, 69717, 84186, -57132, -76130, 8738, 35818, -91206, -72574, 93176, -16995, -7734, 69773, 231, 47933, -2643, -34384, 80255, -76597, 24155, 41216, -44050, -82503, 24778, 21380, -56159, -54978, 22079, 1605, -28798, 85924, 45973, 52543, 45626, -85452, -32778, 75165, 42902, 22760, 17184, 96065, 88094, 81662, 20794, -13057, 33818, 62533, 9566, -52279, 20672, -43700, -67264, -59657, 23083, 64271, 7131, 30780, 66781, 40609, -18707, 20102, 77835, -40754, -24429, 85711, 59703, 91752, -76222, 55709, 19870, 96364, 67733, 24778, 1359, 14301, 14847, -55484, 89580, -79042, 460, -42022, 3700, 48167, -90309, 39300, -85033, -1761, 33443, -46567, 64901, -86117, -98418, 67997, -87866, -68567, -94327, 90278, 73166, 68448, 26448, 86239, 68834, 93342, -18409, 18979, 50063, 50526, 8531, -35692, 80641, 55008, -25146, 53, 44300, 73549, 72511},
6720,
},
{
[]int{},
0,
},
{
[]int{1, 3, 5, 4, 7},
2,
},
{
[]int{1, 2, 4, 3, 5, 4, 7, 2},
3,
},
{
[]int{2, 2, 2, 2, 2},
5,
},
// 可以有多个 testcase
}
func Test_fn(t *testing.T) {
ast := assert.New(t)
for _, tc := range tcs {
fmt.Printf("~~%v~~\n", tc)
ast.Equal(tc.ans, findNumberOfLIS(tc.nums), "输入:%v", tc)
}
}
func Benchmark_fn(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, tc := range tcs {
findNumberOfLIS(tc.nums)
}
}
}