aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tests/test-sms.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tests/test-sms.c b/src/tests/test-sms.c
index 2f3f3781..a6dda609 100644
--- a/src/tests/test-sms.c
+++ b/src/tests/test-sms.c
@@ -572,6 +572,34 @@ test_create_pdu_gsm_no_smsc (void *f, gpointer d)
g_assert_cmpint (memcmp (pdu, expected, len), ==, 0);
}
+static void
+test_create_pdu_gsm_3 (void *f, gpointer d)
+{
+ static const char *number = "+15556661234";
+ static const char *text = "This is really cool ΔΔΔΔΔ";
+ static const guint8 expected[] = {
+ 0x00, 0x11, 0x00, 0x0B, 0x91, 0x51, 0x55, 0x66, 0x16, 0x32, 0xF4, 0x00,
+ 0x00, 0x00, 0x19, 0x54, 0x74, 0x7A, 0x0E, 0x4A, 0xCF, 0x41, 0xF2, 0x72,
+ 0x98, 0xCD, 0xCE, 0x83, 0xC6, 0xEF, 0x37, 0x1B, 0x04, 0x81, 0x40, 0x20,
+ 0x10
+ };
+ guint8 *pdu;
+ guint len = 0;
+ GError *error = NULL;
+
+ /* Tests that a 25-character message (where the last septet is packed into
+ * an octet by itself) is created correctly. Previous to
+ * "core: fix some bugs in GSM7 packing code" the GSM packing code would
+ * leave off the last octet.
+ */
+
+ pdu = sms_create_submit_pdu (number, text, NULL, 1, 0, &len, &error);
+ g_assert_no_error (error);
+ g_assert (pdu);
+ g_assert_cmpint (len, ==, sizeof (expected));
+ g_assert_cmpint (memcmp (pdu, expected, len), ==, 0);
+}
+
#if 0
{
int i;
@@ -626,6 +654,8 @@ int main (int argc, char **argv)
g_test_suite_add (suite, TESTCASE (test_create_pdu_gsm_with_smsc, NULL));
g_test_suite_add (suite, TESTCASE (test_create_pdu_gsm_no_smsc, NULL));
+ g_test_suite_add (suite, TESTCASE (test_create_pdu_gsm_3, NULL));
+
result = g_test_run ();
return result;