mirror of git://git.sysmocom.de/ofono
Add unit test for 3G STATUS response data
This commit is contained in:
parent
8bf64ef07d
commit
98e2228c27
|
@ -31,6 +31,7 @@
|
|||
#include <ofono/types.h>
|
||||
|
||||
#include "simutil.h"
|
||||
#include "util.h"
|
||||
|
||||
const unsigned char valid_efopl[] = {
|
||||
0x42, 0xf6, 0x1d, 0x00, 0x00, 0xff, 0xfe, 0x01,
|
||||
|
@ -92,12 +93,57 @@ static void test_ef_db()
|
|||
g_assert(info);
|
||||
}
|
||||
|
||||
static const char *binary_ef = "62178202412183022F058A01058B032F060F8002000A"
|
||||
"880128";
|
||||
static const char *record_ef = "62198205422100200483026F408A01058B036F0607"
|
||||
"800200808800";
|
||||
|
||||
static void test_3g_status_data()
|
||||
{
|
||||
unsigned char *response;
|
||||
long len;
|
||||
int flen, rlen, str;
|
||||
unsigned char access[3];
|
||||
unsigned short efid;
|
||||
|
||||
response = decode_hex(binary_ef, -1, &len, 0);
|
||||
|
||||
sim_parse_3G_get_response(response, len, &flen, &rlen, &str,
|
||||
access, &efid);
|
||||
|
||||
g_assert(flen == 10);
|
||||
g_assert(rlen == 0);
|
||||
g_assert(str == 0);
|
||||
g_assert(access[0] == 0x01);
|
||||
g_assert(access[1] == 0xff);
|
||||
g_assert(access[2] == 0x44);
|
||||
g_assert(efid == 0x2F05);
|
||||
|
||||
g_free(response);
|
||||
|
||||
response = decode_hex(record_ef, -1, &len, 0);
|
||||
|
||||
sim_parse_3G_get_response(response, len, &flen, &rlen, &str,
|
||||
access, &efid);
|
||||
|
||||
g_assert(flen == 0x80);
|
||||
g_assert(rlen == 0x20);
|
||||
g_assert(str == 1);
|
||||
g_assert(access[0] == 0x11);
|
||||
g_assert(access[1] == 0xff);
|
||||
g_assert(access[2] == 0x44);
|
||||
g_assert(efid == 0x6F40);
|
||||
|
||||
g_free(response);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
g_test_init(&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func("/testsimutil/EONS Handling", test_eons);
|
||||
g_test_add_func("/testsimutil/Elementary File DB", test_ef_db);
|
||||
g_test_add_func("/testsimutil/3G Status response", test_3g_status_data);
|
||||
|
||||
return g_test_run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue