aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/fingerprint_test.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-06-23 20:54:26 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-06-23 22:03:44 -0700
commit01059cc4339065a97fd63274b12dd940e48b48cd (patch)
treebfeccc2d1bcf490bf1e2a34e08ca33f129b8fef4 /tensorflow/core/platform/fingerprint_test.cc
parent8c7886cf71ec0cd3b0a4ecded028d3814cce7a56 (diff)
Adding Fprint128 type and Fingerprint128() to Tensorflow and using that in SDCA.
Change: 125752088
Diffstat (limited to 'tensorflow/core/platform/fingerprint_test.cc')
-rw-r--r--tensorflow/core/platform/fingerprint_test.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/tensorflow/core/platform/fingerprint_test.cc b/tensorflow/core/platform/fingerprint_test.cc
new file mode 100644
index 0000000000..b275b0bf41
--- /dev/null
+++ b/tensorflow/core/platform/fingerprint_test.cc
@@ -0,0 +1,50 @@
+/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+#include "tensorflow/core/platform/types.h"
+
+#include <unordered_set>
+#include "tensorflow/core/platform/fingerprint.h"
+#include "tensorflow/core/platform/test.h"
+
+namespace tensorflow {
+namespace {
+
+TEST(Fingerprint64, IsForeverFrozen) {
+ EXPECT_EQ(15404698994557526151ULL, Fingerprint64("Hello"));
+ EXPECT_EQ(18308117990299812472ULL, Fingerprint64("World"));
+}
+
+TEST(Fingerprint128, IsForeverFrozen) {
+ {
+ const Fprint128 fingerprint = Fingerprint128("Hello");
+ EXPECT_EQ(1163506517679092766ULL, fingerprint.low64);
+ EXPECT_EQ(10829806600034513965ULL, fingerprint.high64);
+ }
+
+ {
+ const Fprint128 fingerprint = Fingerprint128("World");
+ EXPECT_EQ(14404540403896557767ULL, fingerprint.low64);
+ EXPECT_EQ(4859093245152058524ULL, fingerprint.high64);
+ }
+}
+
+TEST(Fingerprint128, Fprint128Hasher) {
+ // Tests that this compiles:
+ const std::unordered_set<Fprint128> map = {{1, 2}, {3, 4}};
+}
+
+} // namespace
+} // namespace tensorflow