| 35 | class FunctionsTest : public ::testing::Test {}; |
| 36 | |
| 37 | TEST_F(FunctionsTest, IsParametrized) { |
| 38 | // Function is defined for multiple input types. |
| 39 | FunctionDef parametrized_func = FunctionDefHelper::Create( |
| 40 | "MyMul", {"x:T", "y:T"}, {"z:T"}, {"T: {float, double}"}, |
| 41 | {{{"output"}, "Mul", {"x", "y"}, {{"T", "$T"}}}}, |
| 42 | /* Mapping between function returns and function node outputs. */ |
| 43 | {{"z", "output:z:0"}}); |
| 44 | |
| 45 | // Function is defined just for float inputs. |
| 46 | FunctionDef non_parametrized_func = FunctionDefHelper::Create( |
| 47 | "MyMul", {"x:float", "y:float"}, {"z:float"}, {}, |
| 48 | {{{"output"}, "Mul", {"x", "y"}, {{"T", DT_FLOAT}}}}, |
| 49 | /* Mapping between function returns and function node outputs. */ |
| 50 | {{"z", "output:z:0"}}); |
| 51 | |
| 52 | EXPECT_TRUE(HasParametrizedType(parametrized_func)); |
| 53 | EXPECT_TRUE(HasParametrizedBody(parametrized_func)); |
| 54 | EXPECT_TRUE(IsParametrized(parametrized_func)); |
| 55 | |
| 56 | EXPECT_FALSE(HasParametrizedType(non_parametrized_func)); |
| 57 | EXPECT_FALSE(HasParametrizedBody(non_parametrized_func)); |
| 58 | EXPECT_FALSE(IsParametrized(non_parametrized_func)); |
| 59 | } |
| 60 | |
| 61 | TEST_F(FunctionsTest, InstantiationParameters) { |
| 62 | // Function definition is invalid, only type/body parameters are important. |
nothing calls this directly
no test coverage detected