aboutsummaryrefslogtreecommitdiff
path: root/subseq/strings_test.go
blob: b35b13957d88c36da2c712072fd1a3c1765b2178 (plain) (blame)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package subseq

import (
	"testing"
)

func TestMaxSubstring(t *testing.T) {
	type args struct {
		s1 string
		s2 string
	}
	tests := []struct {
		name string
		args args
		want string
	}{
		{
			name: "test",
			args: args{
				s1: "какая то строка текста",
				s2: "другая строка другого",
			},
			want: " строка ",
		},
		{
			name: "test2",
			args: args{
				s1: "qwertyuiop",
				s2: "asdfghertyjklzxcvzxqertyuvzvb",
			},
			want: "ertyu",
		},
		{
			name: "empty",
			args: args{
				s1: "abc",
				s2: "def",
			},
			want: "",
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := MaxSubstring(tt.args.s1, tt.args.s2); got != tt.want {
				t.Errorf("MaxSubstring() = %v, want %v", got, tt.want)
			}
		})
	}
}

func TestMaxSubseq(t *testing.T) {
	type args struct {
		s1 string
		s2 string
	}
	tests := []struct {
		name string
		args args
		want string
	}{
		{
			name: "test",
			args: args{
				s1: "nematode knowledge",
				s2: "empty bottle",
			},
			want: "emt ole",
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := MaxSubsequence(tt.args.s1, tt.args.s2); got != tt.want {
				t.Errorf("MaxSubseq() = %v, want %v", got, tt.want)
			}
		})
	}
}