aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/util/saved_tensor_slice_util_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/util/saved_tensor_slice_util_test.cc')
-rw-r--r--tensorflow/core/util/saved_tensor_slice_util_test.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/tensorflow/core/util/saved_tensor_slice_util_test.cc b/tensorflow/core/util/saved_tensor_slice_util_test.cc
new file mode 100644
index 0000000000..2c34c903db
--- /dev/null
+++ b/tensorflow/core/util/saved_tensor_slice_util_test.cc
@@ -0,0 +1,32 @@
+#include "tensorflow/core/util/saved_tensor_slice_util.h"
+
+#include <gtest/gtest.h>
+#include "tensorflow/core/lib/core/status_test_util.h"
+#include "tensorflow/core/platform/logging.h"
+#include "tensorflow/core/platform/protobuf.h"
+
+namespace tensorflow {
+
+namespace checkpoint {
+
+namespace {
+
+// Testing serialization of tensor name and tensor slice in the ordered code
+// format.
+TEST(TensorShapeUtilTest, TensorNameSliceToOrderedCode) {
+ {
+ TensorSlice s = TensorSlice::ParseOrDie("-:-:1,3:4,5");
+ string buffer = EncodeTensorNameSlice("foo", s);
+ string name;
+ s.Clear();
+ TF_CHECK_OK(DecodeTensorNameSlice(buffer, &name, &s));
+ EXPECT_EQ("foo", name);
+ EXPECT_EQ("-:-:1,3:4,5", s.DebugString());
+ }
+}
+
+} // namespace
+
+} // namespace checkpoint
+
+} // namespace tensorflow