/* * SPDX-FileCopyrightText: 2023 jordi fita mas * SPDX-License-Identifier: AGPL-3.0-only */ package app import ( "strings" "testing" ) type test struct { in string isHash bool } var tests = []test{ {"6ccd4e641d6c52c11262b1a8140d656ff80c5c32e230ada565d5d46f11132ead", true}, {"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", true}, {"x6df42afe8fafbe77089309b732b5c20234d4b0ed429144ba5b8471b1b371310", false}, {"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde99", false}, {"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde", false}, } func testValid(t *testing.T, in string, isHash bool) { if ok := mediaHashValid(in); ok != isHash { t.Errorf("Valid(%s) got %v expected %v", in, ok, isHash) } } func TestMediaHash(t *testing.T) { for _, tt := range tests { testValid(t, tt.in, tt.isHash) testValid(t, strings.ToUpper(tt.in), tt.isHash) } }