-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <FlameIDE/../../src/Common/Tests/FunctionalTraitTest.hpp> | ||
|
||
#include <FlameIDE/Common/Traits/Functional.hpp> | ||
|
||
namespace flame_ide | ||
{namespace common | ||
{namespace tests | ||
{ | ||
|
||
FunctionalTraitTest::FunctionalTraitTest() noexcept : ::AbstractTest{ "FunctionalTrait" } | ||
{} | ||
|
||
FunctionalTraitTest::~FunctionalTraitTest() noexcept = default; | ||
|
||
int FunctionalTraitTest::vStart() | ||
{ | ||
CHECK_RESULT_SUCCESS(doTestCase( | ||
"TypeMapper" | ||
, [this] { return typeMapper(); } | ||
)); | ||
return ResultType::SUCCESS; | ||
} | ||
|
||
int FunctionalTraitTest::typeMapper() | ||
{ | ||
using T1 = long long; | ||
using T2 = unsigned long long; | ||
using TestTypeMatchingTrait = TypeMappingTrait<T1, T2>; | ||
|
||
using T2Result = TypeMapper<T1, TestTypeMatchingTrait>::Type; | ||
using T1Result = TypeMapper<T2, TestTypeMatchingTrait>::Type; | ||
|
||
const bool t1ComparationResult = ComparingTypes<T1, T1Result>::VALUE; | ||
const bool t2ComparationResult = ComparingTypes<T2, T2Result>::VALUE; | ||
|
||
IN_CASE_CHECK(t1ComparationResult == true); | ||
IN_CASE_CHECK(t2ComparationResult == true); | ||
|
||
using T3 = double; | ||
// using T3Result = TypeMapper<T3, TestTypeMatchingTrait>::Type; // static assert | ||
using T3Result = TypeMapper<T3, TestTypeMatchingTrait, false>::Type; | ||
|
||
const bool t3ComparationResult = ComparingTypes<Empty, T3Result>::VALUE; | ||
IN_CASE_CHECK(t3ComparationResult == true); | ||
|
||
return ResultType::SUCCESS; | ||
} | ||
|
||
}}} // namespace flame_ide::common::tests |
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,26 @@ | ||
#ifndef FLAMEIDE_COMMON_TESTS_FUNCTIONALTRAITTEST_HPP | ||
#define FLAMEIDE_COMMON_TESTS_FUNCTIONALTRAITTEST_HPP | ||
|
||
#include <tests/Test.hpp> | ||
|
||
namespace flame_ide | ||
{namespace common | ||
{namespace tests | ||
{ | ||
|
||
class FunctionalTraitTest: public ::AbstractTest | ||
{ | ||
public: | ||
FunctionalTraitTest() noexcept; | ||
~FunctionalTraitTest() noexcept override; | ||
|
||
private: | ||
int vStart() override; | ||
|
||
private: | ||
int typeMapper(); | ||
}; | ||
|
||
}}} // namespace flame_ide::common::tests | ||
|
||
#endif // FLAMEIDE_COMMON_TESTS_FUNCTIONALTRAITTEST_HPP |
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