Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] core c test added / core cpp test cleaned up #1423

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

rex-schilasky
Copy link
Contributor

Description

eCAL C API is currently not tested. Therefore a core C API test is added and the existing C++ API test is aligned with that.

Cherry-pick to

  • none

core cpp test cleanup
Initialize/Finalize tests removed from pubsub_test (moved to core_test)
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

#include <ecal/cimpl/ecal_core_cimpl.h>
#include <ecal/ecal_defs.h>

#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^


#include <gtest/gtest.h>

TEST(core_c, Core_GetVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'TEST' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

TEST(core_c, Core_GetVersion)
^

#include <ecal/ecal_core.h>
#include <ecal/ecal_defs.h>

#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^


#include <gtest/gtest.h>

TEST(core_cpp, Core_GetVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp, Core_GetVersion)
TEST(core_cpp /*unused*/, Core_GetVersion /*unused*/)

EXPECT_EQ(ECAL_VERSION_PATCH, patch);
}

TEST(core_cpp, Core_InitializeFinalize)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp, Core_InitializeFinalize)
TEST(core_cpp /*unused*/, Core_InitializeFinalize /*unused*/)

EXPECT_EQ(1, eCAL::Finalize());
}

TEST(core_cpp, Core_MultipleInitializeFinalize)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp, Core_MultipleInitializeFinalize)
TEST(core_cpp /*unused*/, Core_MultipleInitializeFinalize /*unused*/)

}
}

TEST(core_cpp, Core_UnitName)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp, Core_UnitName)
TEST(core_cpp /*unused*/, Core_UnitName /*unused*/)

EXPECT_EQ(0, eCAL::Finalize());
}

TEST(core_cpp, Core_eCAL_Ok)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp, Core_eCAL_Ok)
TEST(core_cpp /*unused*/, Core_eCAL_Ok /*unused*/)

Copy link
Contributor

@KerstinKeller KerstinKeller left a comment

Choose a reason for hiding this comment

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

👍

{
// check uninitialized eCAL, should not be okay
EXPECT_EQ(0, eCAL_Ok());

Copy link
Contributor

Choose a reason for hiding this comment

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

Nothing to change atm, but it's super counter intuitive, that eCAL_Initialize() returns 0 upon success, but on the other hand eCAL_Ok() returns 0 upon failure, and 1 upon success (e.g. boolean values casted..).

So one behaves like a C style function while the other one doesn't....

@rex-schilasky rex-schilasky merged commit e4e6e88 into master Mar 6, 2024
14 checks passed
@rex-schilasky rex-schilasky deleted the feature/core-test-renewal branch July 17, 2024 16:04
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