Skip to content

Add StyxSerializer C++ tests#32

Merged
vshcryabets merged 3 commits into
masterfrom
feature/cpp-deserialization
Jul 8, 2025
Merged

Add StyxSerializer C++ tests#32
vshcryabets merged 3 commits into
masterfrom
feature/cpp-deserialization

Conversation

@vshcryabets
Copy link
Copy Markdown
Owner

No description provided.

@vshcryabets vshcryabets requested a review from Copilot June 29, 2025 14:59
@vshcryabets vshcryabets self-assigned this Jun 29, 2025

This comment was marked as outdated.

@vshcryabets vshcryabets force-pushed the feature/cpp-deserialization branch from 70eafcf to 4293a61 Compare June 29, 2025 16:10
@vshcryabets vshcryabets requested a review from Copilot June 29, 2025 17:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and getQidSize in StyxSerializerImpl.
  • Defined EMPTY static constants for StyxStat and StyxQID.
  • 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) {

}

Copy link

Copilot AI Jun 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.");
}

Copilot uses AI. Check for mistakes.
#include "enums/QidType.h"
#include "serialization/BufferWriterImpl.h"

// void testGetSize() {
Copy link

Copilot AI Jun 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] There's a large commented-out block of legacy tests at the top; removing or relocating these comments will improve readability.

Copilot uses AI. Check for mistakes.
@vshcryabets vshcryabets merged commit 72f36e1 into master Jul 8, 2025
2 checks passed
@vshcryabets vshcryabets deleted the feature/cpp-deserialization branch July 8, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants