Implement submit encode
This commit is contained in:
@@ -283,50 +283,6 @@ func TestEncodeIntoWithBoundaryValues(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// func TestRealScenario(t *testing.T) {
|
||||
// expected := []byte{0, 0, 0, 54, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 67, 77, 84, 0, 1, 1, 49, 50, 51, 52, 53, 0, 1, 1, 54, 55, 56, 57, 48, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 72, 101, 108, 108, 111, 44, 32, 83, 77, 80, 80, 33}
|
||||
// p := &SUBMIT_SM{
|
||||
// header: PDU_HEADER{
|
||||
// command_length: 0,
|
||||
// command_id: 4,
|
||||
// command_status: 0,
|
||||
// sequence_number: 1,
|
||||
// },
|
||||
// service_type: "CMT",
|
||||
// source_addr_ton: 1,
|
||||
// source_addr_npi: 1,
|
||||
// source_addr: "12345",
|
||||
// dest_addr_ton: 1,
|
||||
// dest_addr_npi: 1,
|
||||
// destination_addr: "67890",
|
||||
// esm_class: 0,
|
||||
// protocol_id: 0,
|
||||
// priority_flag: 0,
|
||||
// schedule_delivery_time: "",
|
||||
// validity_period: "",
|
||||
// registered_delivery: 1,
|
||||
// data_coding: 0,
|
||||
// sm_default_msg_id: 0,
|
||||
// short_message: "Hello, SMPP!",
|
||||
// }
|
||||
// p.header.command_length = uint32(p.Size())
|
||||
// p.sm_length = byte(len(p.short_message))
|
||||
// buf := make([]byte, p.Size())
|
||||
// err := p.EncodeInto(&buf)
|
||||
// if err != nil {
|
||||
// t.Errorf("Expected no error, got %v", err)
|
||||
// }
|
||||
// if len(buf) != len(expected) {
|
||||
// t.Errorf("Expected byte slice of length %d, got %d", len(expected), len(buf))
|
||||
// }
|
||||
// for i, v := range buf {
|
||||
// if v != expected[i] {
|
||||
// t.Errorf("Expected byte slice with values %v, got %v", expected, buf)
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// region decode
|
||||
func TestDecodeHandlesShortByteSlice(t *testing.T) {
|
||||
var p PDU_HEADER
|
||||
|
||||
Reference in New Issue
Block a user