OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // Unit tests for SMS message creation |
| 5 |
| 6 #include "sms_message.h" |
| 7 |
| 8 #include <gflags/gflags.h> |
| 9 #include <glog/logging.h> |
| 10 #include <gtest/gtest.h> |
| 11 |
| 12 const uint8_t pdu[] = { |
| 13 0x07, 0x91, 0x21, 0x04, 0x44, 0x29, 0x61, 0xf4, |
| 14 0x04, 0x0b, 0x91, 0x61, 0x71, 0x95, 0x72, 0x91, |
| 15 0xf8, 0x00, 0x00, 0x11, 0x20, 0x82, 0x11, 0x05, |
| 16 0x05, 0x0a, |
| 17 // user data: |
| 18 0x6a, 0xc8, 0xb2, 0xbc, 0x7c, 0x9a, 0x83, 0xc2, |
| 19 0x20, 0xf6, 0xdb, 0x7d, 0x2e, 0xcb, 0x41, 0xed, |
| 20 0xf2, 0x7c, 0x1e, 0x3e, 0x97, 0x41, 0x1b, 0xde, |
| 21 0x06, 0x75, 0x4f, 0xd3, 0xd1, 0xa0, 0xf9, 0xbb, |
| 22 0x5d, 0x06, 0x95, 0xf1, 0xf4, 0xb2, 0x9b, 0x5c, |
| 23 0x26, 0x83, 0xc6, 0xe8, 0xb0, 0x3c, 0x3c, 0xa6, |
| 24 0x97, 0xe5, 0xf3, 0x4d, 0x6a, 0xe3, 0x03, 0xd1, |
| 25 0xd1, 0xf2, 0xf7, 0xdd, 0x0d, 0x4a, 0xbb, 0x59, |
| 26 0xa0, 0x79, 0x7d, 0x8c, 0x06, 0x85, 0xe7, 0xa0, |
| 27 0x00, 0x28, 0xec, 0x26, 0x83, 0x2a, 0x96, 0x0b, |
| 28 0x28, 0xec, 0x26, 0x83, 0xbe, 0x60, 0x50, 0x78, |
| 29 0x0e, 0xba, 0x97, 0xd9, 0x6c, 0x17 |
| 30 }; |
| 31 |
| 32 TEST(SmsMessage, CreateFromPdu) { |
| 33 SmsMessage* sms = SmsMessage::CreateMessage(pdu, sizeof(pdu)); |
| 34 |
| 35 ASSERT_TRUE(NULL != sms); |
| 36 EXPECT_EQ("12404492164", sms->smsc_address()); |
| 37 EXPECT_EQ("16175927198", sms->sender_address()); |
| 38 EXPECT_EQ("110228115050-08", sms->timestamp()); |
| 39 EXPECT_EQ("Here's a longer message [{with some extended characters}] " |
| 40 "thrown in, such as £ and ΩΠΨ and §¿ as well.", sms->text()); |
| 41 } |
| 42 |
| 43 int main(int argc, char* argv[]) { |
| 44 testing::InitGoogleTest(&argc, argv); |
| 45 google::InitGoogleLogging(argv[0]); |
| 46 google::ParseCommandLineFlags(&argc, &argv, true); |
| 47 |
| 48 return RUN_ALL_TESTS(); |
| 49 } |
OLD | NEW |