Skip to content

Commit

Permalink
add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ainghazal committed Jan 31, 2024
1 parent a701b83 commit 8071942
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/reliabletransport/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ type reliableReceiver struct {
lastConsumed model.PacketID
}

func newReliableReceiver(logger model.Logger, i chan incomingPacketSeen) *reliableReceiver {
func newReliableReceiver(logger model.Logger, ch chan incomingPacketSeen) *reliableReceiver {
return &reliableReceiver{
logger: logger,
incomingPackets: make([]*model.Packet, 0),
incomingSeen: i,
incomingSeen: ch,
lastConsumed: 0,
}
}
Expand Down
13 changes: 13 additions & 0 deletions internal/reliabletransport/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ import (
// tests for reliableReceiver
//

func Test_newReliableReceiver(t *testing.T) {
rr := newReliableReceiver(log.Log, make(chan incomingPacketSeen))
if rr.logger == nil {
t.Errorf("newReliableReceiver() should not have nil logger")
}
if rr.incomingPackets == nil {
t.Errorf("newReliableReceiver() should not have nil incomingPackets ch")
}
if rr.lastConsumed != 0 {
t.Errorf("newReliableReceiver() should have lastConsumed == 0")
}
}

func Test_reliableQueue_MaybeInsertIncoming(t *testing.T) {
log.SetLevel(log.DebugLevel)

Expand Down
1 change: 0 additions & 1 deletion internal/session/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ type Manager struct {

// Ready is a channel where we signal that we can start accepting data, because we've
// successfully generated key material for the data channel.
// TODO(ainghazal): find a better way?
Ready chan any
}

Expand Down

0 comments on commit 8071942

Please sign in to comment.