mirror of
https://github.com/pion/ice.git
synced 2025-10-05 07:26:55 +08:00
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:

committed by
Sean DuBois

parent
11a6fedef9
commit
5870fb0c99
@@ -1,6 +1,11 @@
|
||||
package ice
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCandidatePriority(t *testing.T) {
|
||||
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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user