-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To enhance testing, Google Mock was utilized, requiring modifications to the 'Lib'. Additionally: - an issue in the 'analyseCode' function was addressed in 'run.sh' - fix a warning noticed by clang-tidy - install Doxygen on Windows in CI because it is no longer available out-of-the-box. The installation of DoxyGen is placed into a separate CI task in order to update the PATH at the right time on Windows.
- Loading branch information
Showing
13 changed files
with
146 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef HELLOWORLD_H | ||
#define HELLOWORLD_H | ||
|
||
/** @file | ||
* @brief HelloWorld related elements. | ||
* | ||
* It contains the HelloWorld related elements. | ||
*/ | ||
|
||
#include "IHelloWorld.h" | ||
|
||
/** | ||
* @brief The HelloWorld implementation. | ||
* | ||
* This class is an implementation of the IHelloWorld interface. | ||
*/ | ||
class HelloWorld : public IHelloWorld { | ||
public: | ||
/** | ||
* @brief See IHelloWorld::hello | ||
*/ | ||
[[nodiscard]] const char* hello() const override; | ||
}; | ||
|
||
#endif // HELLOWORLD_H |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef IHELLOWORLD_H | ||
#define IHELLOWORLD_H | ||
|
||
/** @file | ||
* @brief IHelloWorld interface related elements. | ||
* | ||
* It contains the Hello World interface related elements. | ||
*/ | ||
|
||
/** | ||
* @brief The IHelloWorld interface. | ||
* | ||
* This class is the interface of Hello World. | ||
*/ | ||
class IHelloWorld { | ||
public: | ||
IHelloWorld() = default; | ||
virtual ~IHelloWorld() = default; | ||
constexpr IHelloWorld(const IHelloWorld&) = default; | ||
constexpr IHelloWorld(IHelloWorld&&) = default; | ||
IHelloWorld& operator=(const IHelloWorld&) = default; | ||
IHelloWorld& operator=(IHelloWorld&&) = default; | ||
|
||
/** | ||
* @brief It returns with the hello world string. | ||
* | ||
* This function returns with the hello world c-string. | ||
* | ||
* @return the hello world c-string. | ||
*/ | ||
[[nodiscard]] virtual const char* hello() const = 0; | ||
}; | ||
|
||
#endif // IHELLOWORLD_H |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
include_directories(../incl) | ||
|
||
add_library (${CMAKE_PROJECT_NAME}Lib ../incl/Lib.h Lib.cpp) | ||
add_library (${CMAKE_PROJECT_NAME}Lib ../incl/Lib.h Lib.cpp ../incl/IHelloWorld.h ../incl/HelloWorld.h HelloWorld.cpp) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "HelloWorld.h" | ||
|
||
const char* HelloWorld::hello() const { return "Hello LibWorld!"; } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
#include "Lib.h" | ||
|
||
#include "IHelloWorld.h" | ||
|
||
const char* | ||
// Silence because meber function is used by desing since it is a demo code | ||
// NOLINTNEXTLINE(readability-convert-member-functions-to-static) | ||
Lib::helloWorld() { | ||
return "Hello LibWorld!"; | ||
Lib::getString(const IHelloWorld& helloWorld) const { | ||
return helloWorld.hello(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
include_directories(../incl) | ||
include_directories(../src) | ||
include_directories(../../../Deps/googletest/googletest/include) | ||
include_directories(../../../Deps/googletest/googlemock/include) | ||
|
||
add_executable (${CMAKE_PROJECT_NAME}Test main.cpp LibTestCases.cpp AppTestCases.cpp) | ||
find_library(GTest gtest HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../../Deps/googletest/build/lib/) | ||
find_library(GMock gmock HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../../Deps/googletest/build/lib/) | ||
if(UNIX) | ||
set(PThreadLib -pthread) | ||
else() | ||
set(StaticLink -static) | ||
endif() | ||
target_link_libraries(${CMAKE_PROJECT_NAME}Test PUBLIC ${CMAKE_PROJECT_NAME}Lib ${CMAKE_PROJECT_NAME}InnerLib ${PThreadLib} ${StaticLink} ${GTest}) | ||
target_link_libraries(${CMAKE_PROJECT_NAME}Test PUBLIC ${CMAKE_PROJECT_NAME}Lib ${CMAKE_PROJECT_NAME}InnerLib ${PThreadLib} ${StaticLink} ${GTest} ${GMock}) | ||
|
||
add_test(NAME ${CMAKE_PROJECT_NAME}Test COMMAND ${CMAKE_PROJECT_NAME}Test) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** @file | ||
* @brief Mocks of IHelloWorld. | ||
* | ||
* It contains mocks of IHelloWorld. | ||
*/ | ||
|
||
#include "IHelloWorld.h" | ||
#include "gmock/gmock.h" | ||
|
||
/** | ||
* @brief A mock of IHelloWorld. | ||
* | ||
* This class is a mock of IHelloWorld. | ||
*/ | ||
class MockHelloWorld : public IHelloWorld { | ||
public: | ||
// NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) | ||
MOCK_METHOD(const char*, hello, (), (const, override)); | ||
}; |