64 lines
2.8 KiB
C++
64 lines
2.8 KiB
C++
/**
|
|
* @file test_flm_dtc_impl_custom.cpp
|
|
* @brief Tests für DtcImplCustom (flm_dtc_impl_custom.h)
|
|
*
|
|
* DtcImplCustom-Instanzen benötigen einen live DDSConnector (Domain
|
|
* Participant); Verhaltenstests laufen daher nur im Integrationstest flmTests
|
|
* (docker: make flmTests). Diese Unit-Tests sichern die Qt6-relevante Struktur
|
|
* ab: Q_OBJECT-Klasse, Vererbung vom generierten Interface::DtcImpl,
|
|
* Konstruktor-Signatur und die inline Folder-Name-Methoden.
|
|
*/
|
|
|
|
#include <FileManagement/flm_dtc_impl_custom.h>
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <type_traits>
|
|
|
|
/**
|
|
* @test DtcImplCustom muss final sein, vom generierten Interface::DtcImpl
|
|
* erben und (wegen des Q_OBJECT-Makros) QObject-abgeleitet sein —
|
|
* moc verifiziert die Klasse beim Bauen von migration_tests.
|
|
*/
|
|
TEST(flm_dtc_impl_custom, IsFinalQObjectDerivedFromGeneratedDtcImpl)
|
|
{
|
|
static_assert(std::is_final<FileManagement::Interface::DtcImplCustom>::value,
|
|
"DtcImplCustom muss final sein");
|
|
static_assert(std::is_base_of<FileManagement::Interface::DtcImpl,
|
|
FileManagement::Interface::DtcImplCustom>::value,
|
|
"DtcImplCustom muss von Interface::DtcImpl erben");
|
|
static_assert(std::is_base_of<QObject, FileManagement::Interface::DtcImplCustom>::value,
|
|
"Q_OBJECT erfordert eine QObject-Basis");
|
|
SUCCEED();
|
|
}
|
|
|
|
/**
|
|
* @test Der Konstruktor muss den shared_ptr<DDSConnector::DdsConnector> aus
|
|
* der generierten DtcImpl-Basis durchreichen (inherited ctor).
|
|
*/
|
|
TEST(flm_dtc_impl_custom, ConstructorTakesDdsConnector)
|
|
{
|
|
static_assert(
|
|
std::is_constructible<FileManagement::Interface::DtcImplCustom,
|
|
const std::shared_ptr<DDSConnector::DdsConnector> &>::value,
|
|
"DtcImplCustom muss aus const std::shared_ptr<DdsConnector>& konstruierbar sein");
|
|
SUCCEED();
|
|
}
|
|
|
|
/**
|
|
* @test Die in flm_dtc_impl_custom.h inline implementierten Folder-Name-
|
|
* Formatierungen ("$EX_"/"$PY_"/"$PH_" + Id) müssen als const-Methoden
|
|
* mit QString-Rückgabe deklariert sein. (Aufruf braucht eine Instanz
|
|
* mit live DDS — siehe Klassenkommentar.)
|
|
*/
|
|
TEST(flm_dtc_impl_custom, InlineFolderNameSignatures)
|
|
{
|
|
using FileManagement::Interface::DtcImplCustom;
|
|
static_assert(std::is_same<QString, decltype(std::declval<const DtcImplCustom &>().getExerciseFolderName(1))>::value,
|
|
"getExerciseFolderName muss const QString(int) sein");
|
|
static_assert(std::is_same<QString, decltype(std::declval<const DtcImplCustom &>().getPartyFolderName(1))>::value,
|
|
"getPartyFolderName muss const QString(int) sein");
|
|
static_assert(std::is_same<QString, decltype(std::declval<const DtcImplCustom &>().getPhaseFolderName(1))>::value,
|
|
"getPhaseFolderName muss const QString(int) sein");
|
|
SUCCEED();
|
|
}
|