libNbiotCore/test/serial_test.cpp
// Tests if error is set properly when trying to read although no ReadFunction is set
Tests if error is set properly when trying to read although no ReadFunction is set
Tests if error is set properly when trying to read although no ReadFunction is set
TEST(SerialTest, ReadWithoutReadFunction) {
    Serial s;
    pSerCom = new MockSerialCom();
    s.configSetWriteStatus(writeStatus);
    s.configSetPutChar(writeByte);
    unsigned char buffer;
    size_t result;
    result = s.readRaw(&buffer, 10);
    EXPECT_EQ((int) Serial::NoReadFunction, s.getError())
                        << "After calling readRaw without specifying a readByte function"
                        << "the error should be set to NoReadFunction";
    EXPECT_EQ(0, result);
    nbiot::string line;
    result = s.readLine(line, 10);
    EXPECT_EQ((int) Serial::NoReadFunction, s.getError())
                        << "After calling readLine without specifying a readByte function"
                        << "the error should be set to NoReadFunction";
    EXPECT_EQ(0, result);
    delete (pSerCom);
}
TEST ( SerialTest , ReadWithoutReadFunction ) { Serial s ; pSerCom = new MockSerialCom ( ) ; s . configSetWriteStatus ( writeStatus ) ; s . configSetPutChar ( writeByte ) ; unsigned char buffer ; size_t result ; result = s . readRaw ( & buffer , 10 ) ; EXPECT_EQ ( ( int ) Serial :: NoReadFunction , s . getError ( ) ) << " " << " " ; EXPECT_EQ ( 0 , result ) ; nbiot :: string line ; result = s . readLine ( line , 10 ) ; EXPECT_EQ ( ( int ) Serial :: NoReadFunction , s . getError ( ) ) << " " << " " ; EXPECT_EQ ( 0 , result ) ; delete ( pSerCom ) ; }
Tests if error is set properly when trying to read although no ReadFunction is set
Tests if error is set properly when trying to read although no ReadFunction is set