diff options
author | Grail Finder <wohilas@gmail.com> | 2023-02-26 14:48:15 +0600 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2023-02-26 14:48:15 +0600 |
commit | 3f99abb502d373cb4b520b212afd4be9ed4da07f (patch) | |
tree | 221c7ccc943a4e4262d536cb268fd7dd04c59074 /main_test.go | |
parent | f60be7df2d741b73863df63c8a275d1b9471db58 (diff) |
Feat: use md5 hash to save on space with shorter names
Diffstat (limited to 'main_test.go')
-rw-r--r-- | main_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/main_test.go b/main_test.go index e494dc6..83a1649 100644 --- a/main_test.go +++ b/main_test.go @@ -63,5 +63,31 @@ func TestFullyIncludes(t *testing.T) { } }) } +} +func TestHashStr(t *testing.T) { + cases := []struct { + Input string + Want string + Description string + }{ + { + Input: "Let's Play Reļ¼Kinder [Rpg Maker Horror] #5 - Im Meer der traurigen Erinnerungen [iU9Un035p3A].opus", + Want: "b047af2cb102a2a6b15007108f99cfef", + Description: "sum of filename example", + }, + { + Input: "", + Want: "d41d8cd98f00b204e9800998ecf8427e", + Description: "sum of empty string", + }, + } + for i, tc := range cases { + t.Run(fmt.Sprintf("run: #%d; %q", i, tc.Description), func(t *testing.T) { + got := hashStr(tc.Input) + if got != tc.Want { + t.Errorf("want: %v; got: %v", tc.Want, got) + } + }) + } } |