Need explanation of bitSizeOf(), initializeOffsets(), and hashCode() functions to test our C++ code #666
Replies: 1 comment
-
Hello, welcome and thanks for the question. I will try to answer: bitSizeOf(): I recommend to test
initializeOffsets(): hashCode():
I hope, it helps. Don't hesitate to ask again if something is still not clear. |
Beta Was this translation helpful? Give feedback.
-
Hi Team,
We are currently working on writing unit tests for three functions in zserio generated C++ code for our project, but having difficulty understanding how they work and what to expect as final value comparisons. I would greatly appreciate it if you could provide some clarification on the following:
bitSizeOf() :
As per the reference document, it's mentioned as it calculates a number of bits needed for serialization of the Zserio object. Need few clarifications:
Do we need to manually calculate the total number of bits based on the fields defined in the structure, if so is there any alignment or padding needs to be added?
Are there any edge cases or special scenarios I should consider when testing?
initializeOffsets() :
From the name of the function, it seems like it sets offsets for fields. But it would be very helpful if there is some more information on how it works, what kind of inputs and outputs, and the expected behavior.
hashCode() :
As per the README reference, it calculates a hash code of the Zserio object. Could you please help us with more information on how it calculates, how it works, and the expected outputs.
In summary, In order to test our code, we need to understand how these functions are working/calculating the required values. It will help us to write EXPECT_EQ/ASSERT_EQ statements with a specific value to compare against the calculated values.
Please reach out if any more clarifications needed from our end.
Thankyou
Beta Was this translation helpful? Give feedback.
All reactions