diff options
author | 2016-12-16 18:13:28 -0800 | |
---|---|---|
committer | 2016-12-16 18:23:28 -0800 | |
commit | 157dbdda6d7d6e4f679c5e89d0bd3e8c0a6085d5 (patch) | |
tree | ab912e09618f3e7b5518933e790937dd85c3a853 /tensorflow/core/framework/attr_value_util_test.cc | |
parent | d6501689726e74d05b14617a26df942a0fc04832 (diff) |
Validate that DataType is valid when parsing from proto using
proto's DataType_IsValid check in AttrValueUtil, with tests.
Change: 142318102
Diffstat (limited to 'tensorflow/core/framework/attr_value_util_test.cc')
-rw-r--r-- | tensorflow/core/framework/attr_value_util_test.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/core/framework/attr_value_util_test.cc b/tensorflow/core/framework/attr_value_util_test.cc index 0b03765c55..8679044f76 100644 --- a/tensorflow/core/framework/attr_value_util_test.cc +++ b/tensorflow/core/framework/attr_value_util_test.cc @@ -55,6 +55,9 @@ TEST(AttrValueUtil, HasType) { EXPECT_FALSE(AttrValueHasType(V(DT_FLOAT), "shape").ok()); EXPECT_FALSE(AttrValueHasType(F("f", {}), "string").ok()); EXPECT_FALSE(AttrValueHasType(P("T"), "float").ok()); + EXPECT_FALSE(AttrValueHasType(V(static_cast<DataType>(1000)), "type").ok()); + std::vector<DataType> list_type({static_cast<DataType>(1000)}); + EXPECT_FALSE(AttrValueHasType(V(list_type), "list(type)").ok()); } SubstituteFunc ReplaceTWith(const AttrValue& val) { |