TensorFlow Serving C++ API Documentation
storage_path_test.cc
1 /* Copyright 2016 Google Inc. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7  http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #include "tensorflow_serving/core/storage_path.h"
17 
18 #include <gtest/gtest.h>
19 #include "tensorflow/core/lib/core/errors.h"
20 
21 namespace tensorflow {
22 namespace serving {
23 namespace {
24 
25 TEST(StoragePathTest, ServableDataEquality) {
26  ServableId id0 = {"0", 0};
27  ServableId id1 = {"1", 1};
28 
29  ServableData<StoragePath> a(id0, "x");
30  ServableData<StoragePath> a2(id0, "x");
31  EXPECT_TRUE(a == a);
32  EXPECT_TRUE(a == a2);
33  EXPECT_TRUE(a2 == a);
34 
35  ServableData<StoragePath> b(id0, "y");
36  ServableData<StoragePath> c(id1, "x");
37  ServableData<StoragePath> d(id0, errors::Unknown("error"));
38  for (const ServableData<StoragePath>& other : {b, c, d}) {
39  EXPECT_TRUE(other == other);
40  EXPECT_FALSE(a == other);
41  EXPECT_FALSE(other == a);
42  }
43 }
44 
45 } // namespace
46 } // namespace serving
47 } // namespace tensorflow