MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestIsSubsequence

Function TestIsSubsequence

strings/issubsequence_test.go:10–75  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestIsSubsequence(t *testing.T) {
11 var testCases = []struct {
12 name string
13 s string
14 t string
15 expected bool
16 }{
17 {
18 "Valid case 1 ",
19 "ace",
20 "abcde",
21 true,
22 },
23 {
24 "Invalid case 1",
25 "aec",
26 "abcde",
27 false,
28 },
29 {
30 "Empty strings",
31 "",
32 "",
33 true,
34 },
35 {
36 "s is more then t",
37 "aeccccc",
38 "abcde",
39 false,
40 },
41 {
42 "s is empty",
43 "",
44 "abcde",
45 true,
46 },
47 {
48 "Equal strings",
49 "aec",
50 "aec",
51 true,
52 },
53 {
54 "Valid case 2",
55 "pyr",
56 "wpxqyrz",
57 true,
58 },
59 {
60 "Invalid case 2",
61 "prx",
62 "wpxqyrz",
63 false,
64 },
65 }
66
67 for _, test := range testCases {

Callers

nothing calls this directly

Calls 1

IsSubsequenceFunction · 0.92

Tested by

no test coverage detected