gemini-code-assist[bot] commented on code in PR #447:
URL: https://github.com/apache/tvm-ffi/pull/447#discussion_r2808096003


##########
tests/cpp/test_base.cc:
##########
@@ -29,4 +29,25 @@ TEST(Base, Version) {
   EXPECT_EQ(version.patch, TVM_FFI_VERSION_PATCH);
 }
 
+TEST(Base, InvalidObject) {
+  TVMFFIAny out;
+  out.type_index = kTVMFFINone;
+  out.zero_padding = 0;
+  out.v_int64 = 0;

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For better readability and conciseness, you can use value initialization for 
the `TVMFFIAny` struct. This will zero-initialize all members, which is the 
intended effect here.
   
   ```suggestion
     TVMFFIAny out{};
   ```



##########
tests/cpp/test_base.cc:
##########
@@ -29,4 +29,25 @@ TEST(Base, Version) {
   EXPECT_EQ(version.patch, TVM_FFI_VERSION_PATCH);
 }
 
+TEST(Base, InvalidObject) {
+  TVMFFIAny out;
+  out.type_index = kTVMFFINone;
+  out.zero_padding = 0;
+  out.v_int64 = 0;
+  TVMFFIAnyGetInvalidObject(&out);
+  // Should return a valid Object
+  EXPECT_EQ(out.type_index, kTVMFFIObject);
+  EXPECT_NE(out.v_obj, nullptr);
+  // Calling again should return the same singleton
+  TVMFFIAny out2;
+  out2.type_index = kTVMFFINone;
+  out2.zero_padding = 0;
+  out2.v_int64 = 0;

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Similarly, you can use value initialization here for conciseness.
   
   ```suggestion
     TVMFFIAny out2{};
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to