Add StyxSerializer C++ tests#32
Merged
Merged
Conversation
70eafcf to
4293a61
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds full support for C++ serialization of StyxStat and StyxQID along with Catch2 tests, and aligns related headers and CMake configurations.
- Implemented
serializeStat,serializeQid,getStatSerializedSize, andgetQidSizeinStyxSerializerImpl. - Defined
EMPTYstatic constants forStyxStatandStyxQID. - Added Catch2 tests for QID and Stat serialization and updated Java tests and build files accordingly.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| native/V2StyxLib/modules/l5/test/test_StyxSerializerImpl.cpp | Added Catch2 test cases for QID and Stat serialization |
| native/V2StyxLib/modules/l5/src/StyxSerializerImpl.cpp | Implemented Stat/QID serialization methods; left generic serialize stubbed |
| native/V2StyxLib/modules/l5/src/StyxQID.cpp | Defined static EMPTY QID instance |
| native/V2StyxLib/modules/l5/src/StyxStat.cpp | Defined static EMPTY Stat instance |
| native/V2StyxLib/modules/l5/include/structs/StyxStat.h | Declared EMPTY static member and updated includes |
| native/V2StyxLib/modules/l5/include/structs/StyxQID.h | Added constexpr constructor and declared EMPTY constant |
| native/V2StyxLib/modules/l5/include/serialization/StyxSerializerImpl.h | Declared overrides for serialization methods |
| native/V2StyxLib/modules/l5/include/serialization/IDataSerializer.h | Switched pointer parameters to references |
| native/V2StyxLib/modules/l5/include/serialization/IBufferReader.h | Introduced styxlib::serialization namespace |
| native/V2StyxLib/modules/l5/include/serialization/BufferReaderImpl.h | Updated inheritance to new namespace |
| native/V2StyxLib/modules/l5/CMakeLists.txt | Added new source and test files to the build |
| java/v2styx-lib/src/test/java/.../StyxSerializerImplTest.java | Added JUnit test for serializeStat |
| java/v2styx-lib/src/main/java/.../StyxSerializerImpl.java | Marked getMessageSize override and cleaned up commented code |
| java/v2styx-lib/src/main/java/.../IDataSerializer.java | Added getMessageSize to interface |
| .vscode/settings.json | Updated file association settings |
Comments suppressed due to low confidence (1)
native/V2StyxLib/modules/l5/test/test_StyxSerializerImpl.cpp:121
- Current tests cover only QID and Stat serialization; consider adding tests for other message serialization methods (e.g., walk, open, read/write) to improve coverage.
TEST_CASE("testGetQidSize", "[StyxSerializationImpl]") {
Comment on lines
+1
to
+8
| #include "serialization/StyxSerializerImpl.h" | ||
|
|
||
|
|
||
| void StyxSerializerImpl::serialize(const styxlib::messages::StyxMessage &message, | ||
| IBufferWriter &output) { | ||
|
|
||
| } | ||
|
|
There was a problem hiding this comment.
The generic serialize method is empty and unimplemented, which will cause calls to it to silently do nothing; consider throwing a not-implemented error or providing a default behavior.
Suggested change
| #include "serialization/StyxSerializerImpl.h" | |
| void StyxSerializerImpl::serialize(const styxlib::messages::StyxMessage &message, | |
| IBufferWriter &output) { | |
| } | |
| #include <stdexcept> | |
| #include "serialization/StyxSerializerImpl.h" | |
| void StyxSerializerImpl::serialize(const styxlib::messages::StyxMessage &message, | |
| IBufferWriter &output) { | |
| throw std::runtime_error("StyxSerializerImpl::serialize is not implemented."); | |
| } |
| #include "enums/QidType.h" | ||
| #include "serialization/BufferWriterImpl.h" | ||
|
|
||
| // void testGetSize() { |
There was a problem hiding this comment.
[nitpick] There's a large commented-out block of legacy tests at the top; removing or relocating these comments will improve readability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.