Something went wrong. Try again.
An ATProto Powered Reputation Network
Something went wrong. Try again.
1.1 kB · 30 lines
Go
at master
12345678910111213141516171819202122232425262728293031package algorithms_test
import ( "fmt" "provenance/internal/reputation/algorithms" "provenance/internal/reputation/reputationtest" "provenance/internal/trust" trustalg "provenance/internal/trust/algorithms" "provenance/internal/trust/trusttest" "testing")
func TestAuthorityDepthCap(t *testing.T) { for _, algorithm := range []trust.Algorithm{trustalg.Optimistic{}, trustalg.ShortestPath{}} { t.Run(algorithm.Describe().Name, func(t *testing.T) { for _, depth := range []int{trust.MaxDepth, trust.MaxDepth + 1} { edges := make([]trusttest.Edge, depth+1) for index := 0; index < depth; index++ { edges[index] = trusttest.Edge{From: fmt.Sprint(index), To: fmt.Sprint(index + 1), Score: 2} } edges[depth] = trusttest.Edge{From: fmt.Sprint(depth), To: "target", Score: 2} score := 0.0 if depth == trust.MaxDepth { score = 2 } reputationtest.Run(t, algorithms.DirectSum{}, algorithm, []reputationtest.Scenario{{Name: fmt.Sprint(depth), Source: "0", Target: "target", Threshold: 1, Edges: edges, Score: score, MeanScore: score}}) } }) }}