MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / Test_isSubtree

Function Test_isSubtree

subtree_of_another_tree_572/solution_test.go:9–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func Test_isSubtree(t *testing.T) {
10 type args struct {
11 s *TreeNode
12 t *TreeNode
13 }
14 tests := []struct {
15 name string
16 args args
17 want bool
18 }{
19 {
20 name: "is subtree",
21 args: args{
22 s: &TreeNode{
23 Left: &TreeNode{
24 Left: &TreeNode{
25 Val: 1,
26 },
27 Right: &TreeNode{
28 Val: 2,
29 },
30 Val: 4,
31 },
32 Right: &TreeNode{
33 Val: 5,
34 },
35 Val: 3,
36 },
37 t: &TreeNode{
38 Left: &TreeNode{
39 Val: 1,
40 },
41 Right: &TreeNode{
42 Val: 2,
43 },
44 Val: 4,
45 },
46 },
47 want: true,
48 },
49 {
50 name: "is not subtree",
51 args: args{
52 s: &TreeNode{
53 Left: &TreeNode{
54 Left: &TreeNode{
55 Val: 1,
56 },
57 Right: &TreeNode{
58 Val: 2,
59 Left: &TreeNode{
60 Val: 0,
61 },
62 },
63 Val: 4,
64 },
65 Right: &TreeNode{
66 Val: 5,

Callers

nothing calls this directly

Calls 1

isSubtreeFunction · 0.85

Tested by

no test coverage detected