diff options
Diffstat (limited to 'internal/testgit/algorithms.go')
| -rw-r--r-- | internal/testgit/algorithms.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/testgit/algorithms.go b/internal/testgit/algorithms.go new file mode 100644 index 00000000..833b846b --- /dev/null +++ b/internal/testgit/algorithms.go @@ -0,0 +1,25 @@ +package testgit + +import ( + "testing" + + "codeberg.org/lindenii/furgit/oid" +) + +// SupportedAlgorithms returns all object ID algorithms supported by furgit. +func SupportedAlgorithms() []oid.Algorithm { + return []oid.Algorithm{ + oid.AlgorithmSHA1, + oid.AlgorithmSHA256, + } +} + +// ForEachAlgorithm runs a subtest for every supported algorithm. +func ForEachAlgorithm(t *testing.T, fn func(t *testing.T, algo oid.Algorithm)) { + t.Helper() + for _, algo := range SupportedAlgorithms() { + t.Run(algo.String(), func(t *testing.T) { + fn(t, algo) + }) + } +} |
