Go to the documentation of this file.00001
00031 #include "create/data.h"
00032 #include "create/serial_stream.h"
00033
00034 #include "gtest/gtest.h"
00035
00036 #include <boost/shared_ptr.hpp>
00037
00038 TEST(SerialStreamTest, Constructor)
00039 {
00040 boost::shared_ptr<create::Data> data_ptr = boost::make_shared<create::Data>();
00041 create::SerialStream serial_stream(data_ptr);
00042 }
00043
00044 TEST(SerialStreamTest, Connected)
00045 {
00046 boost::shared_ptr<create::Data> data_ptr = boost::make_shared<create::Data>();
00047 create::SerialStream serial_stream(data_ptr);
00048
00049
00050 EXPECT_FALSE(serial_stream.connected());
00051 }
00052
00053 TEST(SerialStreamTest, Disconnect)
00054 {
00055 boost::shared_ptr<create::Data> data_ptr = boost::make_shared<create::Data>();
00056 create::SerialStream serial_stream(data_ptr);
00057
00058
00059 serial_stream.disconnect();
00060 }
00061
00062 TEST(SerialStreamTest, NumPackets)
00063 {
00064 boost::shared_ptr<create::Data> data_ptr = boost::make_shared<create::Data>();
00065 create::SerialStream serial_stream(data_ptr);
00066
00067
00068 EXPECT_EQ(serial_stream.getNumCorruptPackets(), 0);
00069 EXPECT_EQ(serial_stream.getTotalPackets(), 0);
00070 }
00071
00072 TEST(SerialStreamTest, Send)
00073 {
00074 boost::shared_ptr<create::Data> data_ptr = boost::make_shared<create::Data>();
00075 create::SerialStream serial_stream(data_ptr);
00076
00077
00078 uint8_t bytes[4] = { create::OC_DATE, 0, 1, 2 };
00079
00080 EXPECT_FALSE(serial_stream.send(bytes, 4));
00081 }
00082
00083 TEST(SerialStreamTest, SendOpcode)
00084 {
00085 boost::shared_ptr<create::Data> data_ptr = boost::make_shared<create::Data>();
00086 create::SerialStream serial_stream(data_ptr);
00087
00088
00089 EXPECT_FALSE(serial_stream.sendOpcode(create::OC_POWER));
00090 }