aboutsummaryrefslogtreecommitdiff
path: root/internal/testgit/algorithms.go
blob: 833b846bdf781eb261aa072c5bd0642c1ccae625 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
		})
	}
}