MCPcopy Create free account
hub / github.com/akash-network/node / TestNonStandardAPIOrder

Function TestNonStandardAPIOrder

util/partialord/partialord_test.go:35–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestNonStandardAPIOrder(t *testing.T) {
36 // This test uses direct ordering before First, and after Last
37 names := []string{"A", "B", "C", "D", "E", "F", "G"}
38 ord := partialord.NewPartialOrdering(names)
39 ord.After("A", "C")
40 ord.After("A", "D")
41 ord.After("E", "B")
42 // overrides the "A" after "C" & "A" after "D" constraints
43 ord.FirstElements("A", "B", "C")
44 expOrdering := []string{"A", "B", "C", "D", "E", "F", "G"}
45 require.Equal(t, expOrdering, ord.TotalOrdering())
46
47 ord.After("E", "D")
48 expOrdering = []string{"A", "B", "C", "D", "F", "G", "E"}
49 require.Equal(t, expOrdering, ord.TotalOrdering())
50
51 ord.LastElements("G")
52 ord.After("F", "E")
53 expOrdering = []string{"A", "B", "C", "D", "E", "F", "G"}
54 require.Equal(t, expOrdering, ord.TotalOrdering())
55}
56
57// This test ad-hocly tests combination of multiple sequences, first elements, and an After
58// invocation.

Callers

nothing calls this directly

Calls 5

AfterMethod · 0.95
FirstElementsMethod · 0.95
TotalOrderingMethod · 0.95
LastElementsMethod · 0.95
NewPartialOrderingFunction · 0.92

Tested by

no test coverage detected