Initial commit based on GenericQtClient v0.3.0
This commit is contained in:
30
tests/GenericCoreTests/CMakeLists.txt
Normal file
30
tests/GenericCoreTests/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
||||
include(FetchContent)
|
||||
|
||||
set(TARGET_APP "core_test")
|
||||
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG v1.17.0
|
||||
)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
add_library(GTest::GTest INTERFACE IMPORTED)
|
||||
target_link_libraries(GTest::GTest INTERFACE gtest_main)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core LinguistTools)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core LinguistTools)
|
||||
|
||||
add_executable(${TARGET_APP} core_test.cpp)
|
||||
|
||||
target_include_directories(${TARGET_APP} PRIVATE ${CORE_LIB_DIR}/include)
|
||||
|
||||
target_link_libraries(${TARGET_APP}
|
||||
PRIVATE
|
||||
GTest::GTest
|
||||
GenericCore)
|
||||
target_link_libraries(${TARGET_APP} PUBLIC Qt${QT_VERSION_MAJOR}::Core)
|
||||
|
||||
add_test(core_gtests ${TARGET_APP})
|
||||
26
tests/GenericCoreTests/core_test.cpp
Normal file
26
tests/GenericCoreTests/core_test.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "../../libs/GenericCore/genericcore.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
inline void PrintTo(const QString& qString, ::std::ostream* os) { *os << qUtf8Printable(qString); }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
TEST(CoreTests, TestEqualString) {
|
||||
const QString coreName("GenericCore");
|
||||
const QString coreVersion("0.2.0");
|
||||
const auto expected = QString("%1 (Version %2)").arg(coreName).arg(coreVersion);
|
||||
auto core = std::make_unique<GenericCore>();
|
||||
const auto actual = core->toString();
|
||||
// const auto actual = multiply(1, 1);
|
||||
ASSERT_EQ(expected, actual);
|
||||
}
|
||||
|
||||
TEST(CoreTests, TestNotEqualString) {
|
||||
const QString expected = QString("Hello from the Core!");
|
||||
auto core = std::make_unique<GenericCore>();
|
||||
const QString actual = core->toString();
|
||||
ASSERT_NE(expected, actual);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
Name,Description,Info,Factor
|
||||
Item 0,This is item 0,Info of item 0,0
|
||||
Item 1,This is item 1,Info of item 1,1
|
||||
Item 2,This is item 2,Info of item 2,2
|
||||
Item 3,This is item 3,Info of item 3,3
|
||||
Item 4,This is item 4,Info of item 4,4
|
||||
Item 5,This is item 5,Info of item 5,5
|
||||
Item 6,This is item 6,Info of item 6,6
|
||||
|
@ -0,0 +1,8 @@
|
||||
Name,Description,Info,Amount,Factor
|
||||
Item 0,This is item 0,Info of item 0,0,0
|
||||
Item 1,This is item 1,Info of item 1,1,1
|
||||
Item 2,This is item 2,Info of item 2,2,2
|
||||
Item 3,This is item 3,Info of item 3,3,3
|
||||
Item 4,This is item 4,Info of item 4,4,4
|
||||
Item 5,This is item 5,Info of item 5,5,5
|
||||
Item 6,This is item 6,Info of item 6,6,6
|
||||
|
Reference in New Issue
Block a user