Skip to content

Commit c6706d5

Browse files
committed
test
1 parent 312ea36 commit c6706d5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

main_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func (v app) CombineValues(values ...scp.Value) (composite scp.Value) {
4444
}
4545

4646
func (v app) PersistSlot(s scp.Slot) {
47+
fmt.Println("externalize slot", s.Index, s.Value)
4748
v.slots[s.Index] = s
4849
}
4950

@@ -157,6 +158,7 @@ func Test(t *testing.T) {
157158
go func() {
158159
for {
159160
m := node1.OutputMessage()
161+
//printMessage(m)
160162
node2.InputMessage(m)
161163
node3.InputMessage(m)
162164
node4.InputMessage(m)
@@ -166,6 +168,7 @@ func Test(t *testing.T) {
166168
go func() {
167169
for {
168170
m := node2.OutputMessage()
171+
//printMessage(m)
169172
node1.InputMessage(m)
170173
node3.InputMessage(m)
171174
node4.InputMessage(m)
@@ -175,6 +178,7 @@ func Test(t *testing.T) {
175178
go func() {
176179
for {
177180
m := node3.OutputMessage()
181+
//printMessage(m)
178182
node2.InputMessage(m)
179183
node1.InputMessage(m)
180184
node4.InputMessage(m)
@@ -184,6 +188,7 @@ func Test(t *testing.T) {
184188
go func() {
185189
for {
186190
m := node4.OutputMessage()
191+
//printMessage(m)
187192
node2.InputMessage(m)
188193
node3.InputMessage(m)
189194
node1.InputMessage(m)
@@ -211,3 +216,25 @@ func Test(t *testing.T) {
211216
time.Sleep(500 * time.Millisecond)
212217
}
213218
}
219+
220+
func printMessage(m *scp.Message) {
221+
node := m.NodeID
222+
223+
var action string
224+
switch m.Type {
225+
case scp.VoteNominate:
226+
action = "votes nominate"
227+
case scp.AcceptNominate:
228+
action = "accepts nominate"
229+
case scp.VotePrepare:
230+
action = "votes prepare"
231+
case scp.AcceptPrepare:
232+
action = "accepts prepare"
233+
case scp.VoteCommit:
234+
action = "votes commit"
235+
case scp.AcceptCommit:
236+
action = "accepts commit"
237+
}
238+
239+
fmt.Println(node, action, "counter:", m.Counter, "value", string(m.Value))
240+
}

0 commit comments

Comments
 (0)