aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/jpillora/longestcommon/lc_test.go
diff options
context:
space:
mode:
authorStefan Majewsky <stefan.majewsky@sap.com>2021-05-28 14:27:59 +0200
committerStefan Majewsky <stefan.majewsky@sap.com>2021-05-28 14:44:42 +0200
commit651cd5a02f2f9cce3d9f256bfa85553b8e17c3a0 (patch)
tree9bffcfa33d8ebb1b84aa69e4cc297d2b178cd4c1 /vendor/github.com/jpillora/longestcommon/lc_test.go
parentf5332c147be25b138294151b3dd57ec4e0f28e26 (diff)
downloadgo-schwift-651cd5a02f2f9cce3d9f256bfa85553b8e17c3a0.tar.gz
use Go modules, update Makefile to my current conventions
Diffstat (limited to 'vendor/github.com/jpillora/longestcommon/lc_test.go')
-rw-r--r--vendor/github.com/jpillora/longestcommon/lc_test.go111
1 files changed, 0 insertions, 111 deletions
diff --git a/vendor/github.com/jpillora/longestcommon/lc_test.go b/vendor/github.com/jpillora/longestcommon/lc_test.go
deleted file mode 100644
index 136e3ff..0000000
--- a/vendor/github.com/jpillora/longestcommon/lc_test.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package longestcommon
-
-import (
- "strings"
- "testing"
-)
-
-func doTest(t *testing.T, lines, pre, suf string) {
- strs := []string{}
- if lines != "" {
- strs = strings.Split(lines, "\n")
- }
- p := Prefix(strs)
- if p != pre {
- t.Fatalf("fail: expected prefix '%s', got '%s'", pre, p)
- }
- s := Suffix(strs)
- if s != suf {
- t.Fatalf("fail: expected suffix '%s', got '%s'", suf, s)
- }
-}
-
-func TestXFix1(t *testing.T) {
- doTest(t, ``, "", "")
-}
-
-func TestXFix2(t *testing.T) {
- doTest(t, `single`, "single", "single")
-}
-
-func TestXFix3(t *testing.T) {
- doTest(t, "single\ndouble", "", "le")
-}
-
-func TestXFix4(t *testing.T) {
- doTest(t, "flower\nflow\nfleet", "fl", "")
-}
-
-func TestXFix5(t *testing.T) {
- doTest(t, `My Awesome Album - 01.mp3
-My Awesome Album - 11.mp3
-My Awesome Album - 03.mp3
-My Awesome Album - 04.mp3
-My Awesome Album - 05.mp3
-My Awesome Album - 06.mp3
-My Awesome Album - 07.mp3
-My Awesome Album - 08.mp3
-My Awesome Album - 09.mp3
-My Awesome Album - 10.mp3
-My Awesome Album - 11.mp3
-My Awesome Album - 12.mp3
-My Awesome Album - 13.mp3
-My Awesome Album - 14.mp3
-My Awesome Album - 15.mp3
-My Awesome Album - 16.mp3
-My Awesome Album - 17.mp3
-My Awesome Album - 18.mp3
-My Awesome Album - 19.mp3
-My Awesome Album - 20.mp3
-My Awesome Album - 21.mp3
-My Awesome Album - 22.mp3
-My Awesome Album - 23.mp3
-My Awesome Album - 24.mp3
-My Awesome Album - 25.mp3
-My Awesome Album - 26.mp3
-My Awesome Album - 27.mp3
-My Awesome Album - 28.mp3
-My Awesome Album - 29.mp3
-My Awesome Album - 30.mp3
-My Awesome Album - 31.mp3
-My Awesome Album - 32.mp3
-My Awesome Album - 33.mp3
-My Awesome Album - 34.mp3
-My Awesome Album - 35.mp3
-My Awesome Album - 36.mp3
-My Awesome Album - 37.mp3
-My Awesome Album - 38.mp3
-My Awesome Album - 39.mp3`, "My Awesome Album - ", ".mp3")
-}
-
-func TestTrimPrefix1(t *testing.T) {
- strs := []string{"flower", "flow", "fleet"}
- TrimPrefix(strs)
- if strs[0] != "ower" {
- t.Fatalf("fail: expected result string to be 'ower', got '%s'", strs[0])
- }
-}
-
-func TestTrimPrefix2(t *testing.T) {
- strs := []string{"flower", "tree"}
- TrimPrefix(strs) //no common prefix
- if strs[0] != "flower" {
- t.Fatalf("fail: expected result string to be 'flower', got '%s'", strs[0])
- }
-}
-
-func TestTrimSuffix1(t *testing.T) {
- strs := []string{"flower", "power"}
- TrimSuffix(strs)
- if strs[0] != "fl" {
- t.Fatalf("fail: expected result string to be 'fl', got '%s'", strs[0])
- }
-}
-
-func TestTrimSuffix2(t *testing.T) {
- strs := []string{"flower", "tree"}
- TrimSuffix(strs) //no common suffix
- if strs[0] != "flower" {
- t.Fatalf("fail: expected result string to be 'flower', got '%s'", strs[0])
- }
-}