forked from warthog618/sms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions_test.go
49 lines (41 loc) · 1.13 KB
/
options_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
47
48
49
// Copyright © 2020 Kent Gibson <warthog618@gmail.com>.
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
package tpdu_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/warthog618/sms/encoding/tpdu"
)
func TestWithDA(t *testing.T) {
addr := tpdu.NewAddress(tpdu.FromNumber("12345"))
s, err := tpdu.New(tpdu.WithDA(addr))
require.Nil(t, err)
assert.Equal(t, addr, s.DA)
}
func TestWithOA(t *testing.T) {
addr := tpdu.NewAddress(tpdu.FromNumber("12345"))
s, err := tpdu.New(tpdu.WithOA(addr))
require.Nil(t, err)
assert.Equal(t, addr, s.OA)
}
func TestWithUDH(t *testing.T) {
udh := tpdu.UserDataHeader{
tpdu.InformationElement{ID: 0, Data: []byte{3, 2, 1}},
}
s, err := tpdu.New(tpdu.WithUDH(udh))
require.Nil(t, err)
assert.Equal(t, udh, s.UDH)
}
func TestWithMTI(t *testing.T) {
s, err := tpdu.New(tpdu.MtSubmit)
require.Nil(t, err)
assert.Equal(t, tpdu.MtSubmit, s.MTI())
}
func TestWithDirection(t *testing.T) {
s, err := tpdu.New(tpdu.MO)
require.Nil(t, err)
assert.Equal(t, tpdu.MO, s.Direction)
}