test/src/scale/scale_decoder_stream_test.cpp
TEST(ScaleDecoderStreamTest, HasMoreTest) {
  auto bytes = ByteArray{0, 1};
  auto stream = ScaleDecoderStream{bytes};

  ASSERT_TRUE(stream.hasMore(0));
  ASSERT_TRUE(stream.hasMore(1));
  ASSERT_TRUE(stream.hasMore(2));
  ASSERT_FALSE(stream.hasMore(3));

  ASSERT_NO_THROW(stream.nextByte());
  ASSERT_TRUE(stream.hasMore(1));
  ASSERT_FALSE(stream.hasMore(2));

  ASSERT_NO_THROW(stream.nextByte());
  ASSERT_FALSE(stream.hasMore(1));

  ASSERT_ANY_THROW(stream.nextByte());
}
/**
 * @given byte array of two bytes
 * @when taking bytes one by one
 * @then first hasMore() answers that 2 bytes are available, but not 3
 * then only 1 byte is available
 * and then even 1 byte is not available, no bytes left
 */
@given byte array of two bytes
@when taking bytes one by one
@then first hasMore() answers that 2 bytes are available, but not 3
then only 1 byte is available
and then even 1 byte is not available, no bytes left
@given byte array of two bytes @when taking bytes one by one @then first hasMore () answers that 2 bytes are available but not 3 then only 1 byte is available and then even 1 byte is not available no bytes left
TEST(ScaleDecoderStreamTest, HasMoreTest) {
  auto bytes = ByteArray{0, 1};
  auto stream = ScaleDecoderStream{bytes};
  ASSERT_TRUE(stream.hasMore(0));
  ASSERT_TRUE(stream.hasMore(1));
  ASSERT_TRUE(stream.hasMore(2));
  ASSERT_FALSE(stream.hasMore(3));
  ASSERT_NO_THROW(stream.nextByte());
  ASSERT_TRUE(stream.hasMore(1));
  ASSERT_FALSE(stream.hasMore(2));
  ASSERT_NO_THROW(stream.nextByte());
  ASSERT_FALSE(stream.hasMore(1));
  ASSERT_ANY_THROW(stream.nextByte());
}
TEST ( ScaleDecoderStreamTest , HasMoreTest ) { auto bytes = ByteArray { 0 , 1 } ; auto stream = ScaleDecoderStream { bytes } ; ASSERT_TRUE ( stream . hasMore ( 0 ) ) ; ASSERT_TRUE ( stream . hasMore ( 1 ) ) ; ASSERT_TRUE ( stream . hasMore ( 2 ) ) ; ASSERT_FALSE ( stream . hasMore ( 3 ) ) ; ASSERT_NO_THROW ( stream . nextByte ( ) ) ; ASSERT_TRUE ( stream . hasMore ( 1 ) ) ; ASSERT_FALSE ( stream . hasMore ( 2 ) ) ; ASSERT_NO_THROW ( stream . nextByte ( ) ) ; ASSERT_FALSE ( stream . hasMore ( 1 ) ) ; ASSERT_ANY_THROW ( stream . nextByte ( ) ) ; }
@given byte array of two bytes
 @when taking bytes one by one
 @then first hasMore() answers that 2 bytes are available, but not 3
 then only 1 byte is available
 and then even 1 byte is not available, no bytes left
@given byte array of two bytes @when taking bytes one by one @then first hasMore () answers that 2 bytes are available but not 3 then only 1 byte is available and then even 1 byte is not available no bytes left