Extend the "pdu" test
The new part of this test currently fails though.
This commit is contained in:
parent
38aaba0a63
commit
40e8fea674
|
@ -843,7 +843,8 @@ static char * _hayes_message_to_pdu(HayesChannel * channel, char const * number,
|
|||
+ strlen((data != NULL) ? data : "");
|
||||
if(addr != NULL && (ret = malloc(len)) != NULL)
|
||||
{
|
||||
if(hayeschannel_has_quirks(channel,
|
||||
/* XXX no longer require the channel here */
|
||||
if(channel != NULL && hayeschannel_has_quirks(channel,
|
||||
HAYES_QUIRK_WANT_SMSC_IN_PDU))
|
||||
smsc = "00";
|
||||
if(snprintf(ret, len, "%s%s%02lX%s%s%s%s%02lX%s", smsc, prefix,
|
||||
|
|
37
tests/pdu.c
37
tests/pdu.c
|
@ -37,18 +37,23 @@ static int _pdu(void);
|
|||
static int _pdu_decode(char const * pdu, char const * number,
|
||||
char const * datetime, ModemMessageEncoding encoding,
|
||||
char const * message);
|
||||
static int _pdu_encode(void);
|
||||
|
||||
|
||||
/* functions */
|
||||
/* pdu */
|
||||
static int _pdu(void)
|
||||
{
|
||||
return _pdu_decode("07916407058099F9040B916407752743"
|
||||
"F60000990121017580001554747A0E4A"
|
||||
"CF416110945805B5CBF379F85C06",
|
||||
"+46705772346", "12/10/1999 12:57:08",
|
||||
MODEM_MESSAGE_ENCODING_UTF8,
|
||||
"This is a PDU message");
|
||||
int ret = 0;
|
||||
|
||||
ret |= (_pdu_decode("07916407058099F9040B916407752743"
|
||||
"F60000990121017580001554747A0E4A"
|
||||
"CF416110945805B5CBF379F85C06",
|
||||
"+46705772346", "12/10/1999 12:57:08",
|
||||
MODEM_MESSAGE_ENCODING_UTF8,
|
||||
"This is a PDU message") != 0) ? 1 : 0;
|
||||
ret |= (_pdu_encode() != 0) ? 2 : 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,8 +116,26 @@ static int _pdu_decode(char const * pdu, char const * number,
|
|||
}
|
||||
|
||||
|
||||
/* pdu_encode */
|
||||
static int _pdu_encode(void)
|
||||
{
|
||||
int ret;
|
||||
char * pdu;
|
||||
char const number[] = "1234";
|
||||
ModemMessageEncoding encoding = MODEM_MESSAGE_ENCODING_ASCII;
|
||||
char const string[] = "This is just a test.";
|
||||
|
||||
if((pdu = _hayes_message_to_pdu(NULL, number, encoding,
|
||||
sizeof(string) - 1, string)) == NULL)
|
||||
return -1;
|
||||
ret = _pdu_decode(pdu, number, NULL, encoding, string);
|
||||
free(pdu);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* main */
|
||||
int main(void)
|
||||
{
|
||||
return (_pdu() == 0) ? 0 : 2;
|
||||
return (_pdu() << 1);
|
||||
}
|
||||
|
|
|
@ -101,10 +101,10 @@ FAILED=
|
|||
echo "Performing tests:" 1>&2
|
||||
_test "hayes"
|
||||
_test "modems"
|
||||
_test "pdu"
|
||||
_test "plugins"
|
||||
_test "ussd"
|
||||
echo "Expected failures:" 1>&2
|
||||
_fail "pdu"
|
||||
if [ -n "$FAILED" ]; then
|
||||
echo "Failed tests:$FAILED" 1>&2
|
||||
exit 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user