lidavidm commented on code in PR #17:
URL: https://github.com/apache/arrow-nanoarrow/pull/17#discussion_r942812080


##########
src/nanoarrow/buffer_test.cc:
##########
@@ -160,3 +160,31 @@ TEST(BufferTest, BufferTestError) {
 
   ArrowBufferReset(&buffer);
 }
+
+TEST(BufferTest, BufferTestAppendHelpers) {
+  struct ArrowBuffer buffer;
+  ArrowBufferInit(&buffer);
+
+  EXPECT_EQ(ArrowBufferAppendInt8(&buffer, 123), NANOARROW_OK);
+  EXPECT_EQ(reinterpret_cast<int8_t*>(buffer.data + buffer.size_bytes)[-1], 
123);
+  EXPECT_EQ(ArrowBufferAppendUInt8(&buffer, 123), NANOARROW_OK);
+  EXPECT_EQ(reinterpret_cast<uint8_t*>(buffer.data + buffer.size_bytes)[-1], 
123);
+  EXPECT_EQ(ArrowBufferAppendInt16(&buffer, 123), NANOARROW_OK);

Review Comment:
   I think these are all unaligned accesses; that's probably OK, but I think 
Arrow itself tries to avoid this (or uses memcpy to do unaligned reads) to be 
portable. That said this is test code so not a big deal.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to