Skip to content
Snippets Groups Projects
Commit 155e0d04 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add missing tests for FunctionArgumentConverter

parent f38c5713
No related branches found
No related tags found
1 merge request!116Add tests for EmbeddedIDiscreteFunctionUtils
...@@ -172,6 +172,18 @@ TEST_CASE("FunctionArgumentConverter", "[language]") ...@@ -172,6 +172,18 @@ TEST_CASE("FunctionArgumentConverter", "[language]")
std::vector<TinyVector<2>>{TinyVector<2>{1, 3.2}, TinyVector<2>{-1, 0.2}}); std::vector<TinyVector<2>>{TinyVector<2>{1, 3.2}, TinyVector<2>{-1, 0.2}});
REQUIRE(std::get<std::vector<TinyVector<2>>>(execution_policy.currentContext()[2]) == REQUIRE(std::get<std::vector<TinyVector<2>>>(execution_policy.currentContext()[2]) ==
std::vector<TinyVector<2>>{TinyVector<2>{-3, 12.2}, TinyVector<2>{2, 1.2}}); std::vector<TinyVector<2>>{TinyVector<2>{-3, 12.2}, TinyVector<2>{2, 1.2}});
std::shared_ptr symbol_table = std::make_shared<SymbolTable>();
AggregateDataVariant v_fid{std::vector<DataVariant>{uint64_t{3}, uint64_t{2}, uint64_t{7}}};
FunctionListArgumentConverter<FunctionSymbolId, FunctionSymbolId> converterFid{0, symbol_table};
converterFid.convert(execution_policy, v_fid);
auto&& fid_tuple = std::get<std::vector<FunctionSymbolId>>(execution_policy.currentContext()[0]);
REQUIRE(fid_tuple[0].id() == 3);
REQUIRE(fid_tuple[1].id() == 2);
REQUIRE(fid_tuple[2].id() == 7);
} }
SECTION("FunctionArgumentToFunctionSymbolIdConverter") SECTION("FunctionArgumentToFunctionSymbolIdConverter")
...@@ -184,4 +196,16 @@ TEST_CASE("FunctionArgumentConverter", "[language]") ...@@ -184,4 +196,16 @@ TEST_CASE("FunctionArgumentConverter", "[language]")
REQUIRE(std::get<FunctionSymbolId>(execution_policy.currentContext()[0]).id() == f_id); REQUIRE(std::get<FunctionSymbolId>(execution_policy.currentContext()[0]).id() == f_id);
} }
SECTION("FunctionArgumentToTupleFunctionSymbolIdConverter")
{
std::shared_ptr symbol_table = std::make_shared<SymbolTable>();
const uint64_t f_id = 3;
FunctionArgumentToTupleFunctionSymbolIdConverter converter0{0, symbol_table};
converter0.convert(execution_policy, f_id);
auto&& tuple = std::get<std::vector<FunctionSymbolId>>(execution_policy.currentContext()[0]);
REQUIRE(tuple.size() == 1);
REQUIRE(tuple[0].id() == f_id);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment