Added tests for lastSent and lastReceived get/set

Validate the new behaviour when these atomic vars have not been
set yet.
This commit is contained in:
David Hamilton
2019-12-12 02:00:25 +13:00
committed by Sean DuBois
parent 11a6fedef9
commit 5870fb0c99

View File

@@ -1,6 +1,11 @@
package ice package ice
import "testing" import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestCandidatePriority(t *testing.T) { func TestCandidatePriority(t *testing.T) {
for _, test := range []struct { for _, test := range []struct {
@@ -49,3 +54,19 @@ func TestCandidatePriority(t *testing.T) {
} }
} }
} }
func TestCandidateLastSent(t *testing.T) {
candidate := candidateBase{}
assert.Equal(t, candidate.LastSent(), time.Time{})
now := time.Now()
candidate.setLastSent(now)
assert.Equal(t, candidate.LastSent(), now)
}
func TestCandidateLastReceived(t *testing.T) {
candidate := candidateBase{}
assert.Equal(t, candidate.LastReceived(), time.Time{})
now := time.Now()
candidate.setLastReceived(now)
assert.Equal(t, candidate.LastReceived(), now)
}