Skip to content

mw::com: missing test cases#707

Open
KrishaDeshkool wants to merge 3 commits into
eclipse-score:mainfrom
KrishaDeshkool:improve_test_case_fpr2
Open

mw::com: missing test cases#707
KrishaDeshkool wants to merge 3 commits into
eclipse-score:mainfrom
KrishaDeshkool:improve_test_case_fpr2

Conversation

@KrishaDeshkool

Copy link
Copy Markdown
Contributor

No description provided.

Add unit tests for to_string(MethodType), covering kMethod/kGet/kSet/kUnknown
and the out-of-range "Invalid" fallback.
@KrishaDeshkool KrishaDeshkool force-pushed the improve_test_case_fpr2 branch 3 times, most recently from 82b1c31 to c00b95f Compare July 14, 2026 16:14
@KrishaDeshkool KrishaDeshkool force-pushed the improve_test_case_fpr2 branch from c00b95f to 6be28aa Compare July 14, 2026 16:19
@KrishaDeshkool KrishaDeshkool marked this pull request as ready for review July 14, 2026 16:19

TEST(MethodTypeToStringTest, ReturnsMethodForKMethod)
{
// Given a MethodType of kMethod

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nitpick which doesn't have to be fixed but just for future reference, the given part is about setting up the environment / context for the test. In this case, the MethodType isn't part of the setup but is what's actually being tested. So it would be more correct to say: "When converting a MethodType of kMethod to string" without a given section.

// When calling Get()
auto result = field.Get();

// Then the call is delegated to the underlying method binding and succeeds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The expecting parts should go with the expectations above:

// Expecting that the binding returns a buffer for a return value and then calls the method
EXPECT_CALL(get_method_binding_mock_, GetReturnValueBuffer(0U));    EXPECT_CALL(get_method_binding_mock_, DoCall(0U));

    // When calling Get()
    auto result = field.Get();

    // Then the call succeeds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same for all the other tests

EXPECT_CALL(get_method_binding_mock_, DoCall(0U));

// When calling Get()
auto result = field.Get();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you also put a value in the return buffer and check that it's returned in result?

for (const auto method_type : {MethodType::kGet, MethodType::kSet})
{
auto proxy_method =
ProxyMethodBindingFactory<MethodSignature>::Create(handle, *this->proxy_, kDummyFieldName, method_type);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess we should also have a death test in case MethodType::kUnknown is provided (if we don't already have one)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants