forked from warthog618/sms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparameterindicator_test.go
46 lines (39 loc) · 1.02 KB
/
parameterindicator_test.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: MIT
//
// Copyright © 2020 Kent Gibson <warthog618@gmail.com>.
package tpdu_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/warthog618/sms/encoding/tpdu"
)
func TestParameterIndicatorPID(t *testing.T) {
assert.False(t, tpdu.PI(0).PID())
assert.True(t, tpdu.PI(tpdu.PiPID).PID())
}
func TestParameterIndicatorDCS(t *testing.T) {
assert.False(t, tpdu.PI(0).DCS())
assert.True(t, tpdu.PI(tpdu.PiDCS).DCS())
}
func TestParameterIndicatorUDL(t *testing.T) {
assert.False(t, tpdu.PI(0).UDL())
assert.True(t, tpdu.PI(tpdu.PiUDL).UDL())
}
func TestParameterIndicatorString(t *testing.T) {
patterns := []struct {
in tpdu.PI
out string
}{
{0, "0"},
{tpdu.PiPID, "PID"},
{tpdu.PiDCS, "DCS"},
{tpdu.PiUDL, "UDL"},
{tpdu.PiPID | tpdu.PiDCS, "PID|DCS"},
{tpdu.PiPID | tpdu.PiUDL, "PID|UDL"},
{tpdu.PiDCS | tpdu.PiUDL, "DCS|UDL"},
{tpdu.PiPID | tpdu.PiDCS | tpdu.PiUDL, "PID|DCS|UDL"},
}
for _, p := range patterns {
assert.Equal(t, p.out, p.in.String())
}
}