From 3d044414a290739b6191dd40a80e6ec9ef313e55 Mon Sep 17 00:00:00 2001 From: tphyhFighting <2363176358@qq.com> Date: Tue, 23 Nov 2021 10:44:37 +0800 Subject: [PATCH] add: leetcode 0859 test --- .../859.Buddy Strings_test.go | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 leetcode/0859.Buddy-Strings/859.Buddy Strings_test.go diff --git a/leetcode/0859.Buddy-Strings/859.Buddy Strings_test.go b/leetcode/0859.Buddy-Strings/859.Buddy Strings_test.go new file mode 100644 index 00000000..3085e448 --- /dev/null +++ b/leetcode/0859.Buddy-Strings/859.Buddy Strings_test.go @@ -0,0 +1,56 @@ +package leetcode + +import ( + "fmt" + "testing" +) + +type question859 struct { + para859 + ans859 +} + +// para 是参数 +type para859 struct { + s string + goal string +} + +// ans 是答案 +type ans859 struct { + ans bool +} + +func Test_Problem859(t *testing.T) { + + qs := []question859{ + + { + para859{"ab", "ba"}, + ans859{true}, + }, + + { + para859{"ab", "ab"}, + ans859{false}, + }, + + { + para859{"aa", "aa"}, + ans859{true}, + }, + + { + para859{"aaaaaaabc", "aaaaaaacb"}, + ans859{true}, + }, + } + + fmt.Printf("------------------------Leetcode Problem 859------------------------\n") + + for _, q := range qs { + _, p := q.ans859, q.para859 + fmt.Printf("【input】:%v 【output】:%v\n", p, buddyStrings(p.s, p.goal)) + } + fmt.Printf("\n\n\n") +}