@@ -38,3 +38,39 @@ TEST_F(PythonTest, callFunctionWithWrongArguments)
3838 EXPECT_FALSE (result_1.valueOr (true ));
3939 EXPECT_FALSE (result_2.valueOr (true ));
4040}
41+
42+ TEST_F (PythonTest, callFunctionWithDict)
43+ {
44+ auto result = plugin->call <int >(" accept_dict" , std::map<std::string, int > {
45+ { " " , 1 },
46+ { " a" , 2 },
47+ { " b" , 3 },
48+ { " c" , 4 },
49+ },
50+ " c" );
51+
52+ ASSERT_TRUE (result.hasValue ()) << ppplugin::test::errorOutput (result);
53+ EXPECT_EQ (result.valueOr (0 ), 4 );
54+ }
55+
56+ TEST_F (PythonTest, callFunctionWithList)
57+ {
58+ auto result = plugin->call <std::string>(" accept_list" , std::vector<char > { ' a' , ' b' , ' c' });
59+
60+ ASSERT_TRUE (result.hasValue ()) << ppplugin::test::errorOutput (result);
61+ EXPECT_EQ (result.valueOr (" " ), " a,b,c," );
62+ }
63+
64+ TEST_F (PythonTest, nestedDict)
65+ {
66+ using ResultType = std::map<std::string, std::vector<std::map<int , int >>>;
67+ const ResultType expected = {
68+ { " " , {} },
69+ { " a" , { { { 1 , 1 }, { 2 , 2 } }, { { 0 , 0 } } } },
70+ { " b" , { { { 1 , 1 } } } }
71+ };
72+
73+ auto result = plugin->call <ResultType>(" identity" , expected);
74+
75+ EXPECT_EQ (result.valueOr (ResultType {}), expected);
76+ }
0 commit comments