diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2019-05-27 00:53:54 +0700 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-05-29 08:48:46 +0000 |
commit | 1dc82643c549a27fb8851ba64e9a0f621f5aea00 (patch) | |
tree | 3a55ba100c646815e47d29b47e635e39278eb43a /tests | |
parent | bdf70347fb779e3da5dcaccde0c1096547d4908d (diff) |
gsm48_encode_bcd_number(): clarify optional LHV header initialization
Change-Id: Iafd911dd55691b3715391e3899cd6971245c8d7f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gsm0408/gsm0408_test.c | 10 | ||||
-rw-r--r-- | tests/gsm0408/gsm0408_test.ok | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c index d7bae775..b5f80614 100644 --- a/tests/gsm0408/gsm0408_test.c +++ b/tests/gsm0408/gsm0408_test.c @@ -654,7 +654,7 @@ static const struct bcd_number_test { /* Encoding test */ .enc_ascii = "123456", - .enc_hex = "0700000000214365", + .enc_hex = "07ffffffff214365", .enc_h_len = 4, /* LHV */ .enc_rc = 4 + 4, @@ -732,8 +732,8 @@ static const struct bcd_number_test { static void test_bcd_number_encode_decode() { const struct bcd_number_test *test; - uint8_t buf_enc[0xff] = { 0 }; - char buf_dec[0xff] = { 0 }; + uint8_t buf_enc[0xff] = { 0xff }; + char buf_dec[0xff] = { 0xff }; size_t buf_len, i; int rc; @@ -780,6 +780,10 @@ static void test_bcd_number_encode_decode() printf(" - Actual: (rc=%d) '%s'\n", rc, (rc == 0 || rc == -ENOSPC) ? buf_dec : "(none)"); } + + /* Poison buffers between the test iterations */ + memset(buf_enc, 0xff, sizeof(buf_enc)); + memset(buf_dec, 0xff, sizeof(buf_dec)); } printf("\n"); diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok index 075886ec..844c2018 100644 --- a/tests/gsm0408/gsm0408_test.ok +++ b/tests/gsm0408/gsm0408_test.ok @@ -149,8 +149,8 @@ BSD number encoding / decoding test - Actual: (rc=0) '123456789' - Running test: regular 6-digit MSISDN with optional header (LHV) - Encoding ASCII (buffer limit=0) '123456'... - - Expected: (rc=8) '0700000000214365' - - Actual: (rc=8) '0721436587214365' + - Expected: (rc=8) '07ffffffff214365' + - Actual: (rc=8) '07ffffffff214365' - Decoding HEX (buffer limit=0) '07deadbeef214365'... - Expected: (rc=0) '123456' - Actual: (rc=0) '123456' |