aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test-sms-part-cdma.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/test-sms-part-cdma.c b/src/tests/test-sms-part-cdma.c
index 935a9c6b..61a12e71 100644
--- a/src/tests/test-sms-part-cdma.c
+++ b/src/tests/test-sms-part-cdma.c
@@ -106,6 +106,27 @@ common_test_invalid_part_from_pdu (const guint8 *pdu,
}
static void
+common_test_valid_part_from_hexpdu (const gchar *hexpdu)
+{
+ g_autoptr(MMSmsPart) part = NULL;
+ GError *error = NULL;
+
+ part = mm_sms_part_cdma_new_from_pdu (0, hexpdu, NULL, &error);
+ g_assert (part != NULL);
+ g_assert (error == NULL);
+}
+
+static void
+common_test_valid_part_from_pdu (const guint8 *pdu,
+ gsize pdu_size)
+{
+ g_autofree gchar *hexpdu = NULL;
+
+ hexpdu = mm_utils_bin2hexstr (pdu, pdu_size);
+ common_test_valid_part_from_hexpdu (hexpdu);
+}
+
+static void
test_pdu1 (void)
{
static const guint8 pdu[] = {
@@ -370,6 +391,17 @@ test_empty_unicode_user_data (void)
common_test_invalid_part_from_pdu (pdu, sizeof (pdu));
}
+static void
+test_empty_ascii_user_data (void)
+{
+ static const guint8 pdu[] = {
+ 0x00, 0x08, 0x08, 0x01, 0x06, 0x10, 0x34, 0x00,
+ 0x00, 0x01, 0x00 };
+
+ /* valid but don't care about exact details */
+ common_test_valid_part_from_pdu (pdu, sizeof (pdu));
+}
+
/********************* PDU CREATOR TESTS *********************/
static void
@@ -576,6 +608,7 @@ int main (int argc, char **argv)
g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/latin-encoding-2", test_latin_encoding_2);
g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/unicode-encoding", test_unicode_encoding);
g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/empty-unicode-user-data", test_empty_unicode_user_data);
+ g_test_add_func ("/MM/SMS/CDMA/PDU-Parser/empty-ascii-user-data", test_empty_ascii_user_data);
g_test_add_func ("/MM/SMS/CDMA/PDU-Creator/ascii-encoding", test_create_pdu_text_ascii_encoding);
g_test_add_func ("/MM/SMS/CDMA/PDU-Creator/latin-encoding", test_create_pdu_text_latin_encoding);