-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from FactomProject/FD-87
Fd 87
- Loading branch information
Showing
12 changed files
with
120 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package engine_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/FactomProject/factomd/engine" | ||
"github.com/FactomProject/factomd/state" | ||
"github.com/FactomProject/factomd/common/messages" | ||
"github.com/FactomProject/factomd/common/primitives" | ||
|
||
"time" | ||
) | ||
|
||
|
||
|
||
func TestMessageLoging(t *testing.T) { | ||
msgLog := new(MsgLog) | ||
msgLog.Init(true, 0) | ||
|
||
fnode := new(FactomNode) | ||
fnode.State = new(state.State) | ||
s := fnode.State | ||
|
||
msg := new(messages.Bounce) | ||
msg.Name = "bob" | ||
msg.Timestamp = primitives.NewTimestampNow() | ||
msg.Data = []byte("here is some data") | ||
msg.Stamps = append(msg.Stamps, primitives.NewTimestampNow()) | ||
|
||
msgLog.PrtMsgs(s) | ||
|
||
msgLog.Add2(fnode, true, "peer","where",true,msg) | ||
msgLog.Add2(fnode, false, "peer","where",true,msg) | ||
|
||
msgLog.Startp = primitives.NewTimestampFromMilliseconds(0) | ||
msgLog.Add2(fnode, false, "peer","where",true,msg) | ||
|
||
if len(msgLog.MsgList) != 3 { | ||
t.Error("Should have three entries") | ||
} | ||
msgLog.PrtMsgs(s) | ||
|
||
msgLog.Last.SetTimeSeconds(msgLog.Last.GetTimeSeconds()-6) | ||
time.Sleep(10*time.Millisecond) | ||
msgLog.Add2(fnode, false, "peer","where",true,msg) | ||
|
||
if len(msgLog.MsgList) != 0 { | ||
t.Error("Should have zero messages") | ||
} | ||
msgLog.PrtMsgs(s) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2017 Factom Foundation | ||
// Use of this source code is governed by the MIT | ||
// license that can be found in the LICENSE file. | ||
|
||
package state_test | ||
|
||
import ( | ||
|
||
) | ||
|
||
|
||
|