File: key_phase_test.go

package info (click to toggle)
golang-github-lucas-clemente-quic-go 0.54.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,312 kB
  • sloc: sh: 54; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package protocol

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestKeyPhaseBitDefaultValue(t *testing.T) {
	var k KeyPhaseBit
	require.Equal(t, KeyPhaseUndefined, k)
}

func TestKeyPhaseStringRepresentation(t *testing.T) {
	require.Equal(t, "0", KeyPhaseZero.String())
	require.Equal(t, "1", KeyPhaseOne.String())
}

func TestKeyPhaseToBit(t *testing.T) {
	require.Equal(t, KeyPhaseZero, KeyPhase(0).Bit())
	require.Equal(t, KeyPhaseZero, KeyPhase(2).Bit())
	require.Equal(t, KeyPhaseZero, KeyPhase(4).Bit())
	require.Equal(t, KeyPhaseOne, KeyPhase(1).Bit())
	require.Equal(t, KeyPhaseOne, KeyPhase(3).Bit())
	require.Equal(t, KeyPhaseOne, KeyPhase(5).Bit())
}