Просмотр исходного кода

Changed the test case to hit the correct error.

Bart Hertog 5 лет назад
Родитель
Сommit
99a0f6b81e
2 измененных файлов с 7 добавлено и 6 удалено
  1. 5 4
      src/RepeatedField.h
  2. 2 2
      test/test_RepeatedFieldMessage.cpp

+ 5 - 4
src/RepeatedField.h

@@ -224,9 +224,10 @@ namespace EmbeddedProto
         return return_value;
       }
 
-      //! Calculate the size of this message when serialized.
+      //! Calculate the size of this field when serialized.
       /*!
-          \return The number of bytes this message will require once serialized.
+          The calculation only includes the data, not the size required by the tag and 
+          \return The number of bytes this field will require once serialized.
       */
       uint32_t serialized_size_packed(int32_t field_number) const 
       {
@@ -235,9 +236,9 @@ namespace EmbeddedProto
         return calcBuffer.get_size();
       }
 
-      //! Calculate the size of this message when serialized.
+      //! Calculate the size of this field when serialized.
       /*!
-          \return The number of bytes this message will require once serialized.
+          \return The number of bytes this field will require once serialized.
       */
       uint32_t serialized_size_unpacked(int32_t field_number) const 
       {

+ 2 - 2
test/test_RepeatedFieldMessage.cpp

@@ -317,8 +317,8 @@ TEST(RepeatedFieldMessage, serialize_fault_buffer_full)
   msg.add_y(1);
   msg.add_y(1);                 
   
-  // Need 5 bytes but got only three.
-  EXPECT_CALL(buffer, get_available_size()).Times(1).WillOnce(Return(3));
+  // Need 3 bytes but got only 2.
+  EXPECT_CALL(buffer, get_available_size()).Times(1).WillOnce(Return(2));
 
   EXPECT_EQ(::EmbeddedProto::Error::BUFFER_FULL, msg.serialize(buffer));
 }