diff --git a/src/sut/broadcast/broadcast.go b/src/sut/broadcast/broadcast.go index 0b55f72d..4d77def2 100644 --- a/src/sut/broadcast/broadcast.go +++ b/src/sut/broadcast/broadcast.go @@ -53,9 +53,6 @@ type Node struct { // The round or version of the implementation. Round Round `json:"round"` - - // Node name. - Name string `json:"name"` } type Broadcast struct { @@ -80,11 +77,10 @@ func NewNodeA(round Round) *Node { "C": true, }, Round: round, - Name: "A", } } -func NewNode(name string, round Round) *Node { +func NewNode(round Round, neighbour string) *Node { var broadcast bool switch round { case SimpleDeliv, RetryDeliv, ClassicDeliv: @@ -94,30 +90,21 @@ func NewNode(name string, round Round) *Node { default: panic("Unknown round") } - neighbours := make(map[string]bool, 3) - var neighbour string - switch name { - case "B": - neighbour = "C" - case "C": - neighbour = "B" - default: - panic("unexpected name") - } + neighbours := make(map[string]bool) neighbours[neighbour] = broadcast - if round == ClassicDeliv && name == "B" || name == "C" { + if round == ClassicDeliv { // Normally node A isn't considered a neighbour, but in the // classic delivery example it seems like node B and C should // send messages back to A. neighbours["A"] = broadcast + neighbours[neighbour] = broadcast } return &Node{ Log: "", Neighbours: neighbours, Round: round, - Name: name, } } diff --git a/src/sut/broadcast/broadcast_test.go b/src/sut/broadcast/broadcast_test.go index b730ef9c..9dd51cfd 100644 --- a/src/sut/broadcast/broadcast_test.go +++ b/src/sut/broadcast/broadcast_test.go @@ -15,8 +15,8 @@ import ( func once(round Round, testId lib.TestId, runEvent lib.CreateRunEvent, t *testing.T) (lib.RunId, bool) { topology := lib.NewTopology( lib.Item{"A", NewNodeA(round)}, - lib.Item{"B", NewNode("B", round)}, - lib.Item{"C", NewNode("C", round)}, + lib.Item{"B", NewNode(round, "C")}, + lib.Item{"C", NewNode(round, "B")}, ) marshaler := NewMarshaler() var srv http.Server @@ -53,7 +53,7 @@ func many(round Round, expectedRuns int, t *testing.T, expectedFaults []lib.Faul // time, we can't. And we also got timers which increase the // logical clock, which means we sometimes need a higher EFF in // order to find the problem. - EFF: 5, + EFF: 3, Crashes: 1, EOT: 10, }