aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/integral_types_test.cc
diff options
context:
space:
mode:
authorGravatar Manjunath Kudlur <keveman@gmail.com>2015-11-06 16:27:58 -0800
committerGravatar Manjunath Kudlur <keveman@gmail.com>2015-11-06 16:27:58 -0800
commitf41959ccb2d9d4c722fe8fc3351401d53bcf4900 (patch)
treeef0ca22cb2a5ac4bdec9d080d8e0788a53ed496d /tensorflow/core/platform/integral_types_test.cc
TensorFlow: Initial commit of TensorFlow library.
TensorFlow is an open source software library for numerical computation using data flow graphs. Base CL: 107276108
Diffstat (limited to 'tensorflow/core/platform/integral_types_test.cc')
-rw-r--r--tensorflow/core/platform/integral_types_test.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/tensorflow/core/platform/integral_types_test.cc b/tensorflow/core/platform/integral_types_test.cc
new file mode 100644
index 0000000000..067787a9f4
--- /dev/null
+++ b/tensorflow/core/platform/integral_types_test.cc
@@ -0,0 +1,33 @@
+#include "tensorflow/core/platform/port.h"
+
+#include <gtest/gtest.h>
+
+namespace tensorflow {
+namespace {
+
+TEST(IntegralTypes, Basic) {
+ EXPECT_EQ(1, sizeof(int8));
+ EXPECT_EQ(2, sizeof(int16));
+ EXPECT_EQ(4, sizeof(int32));
+ EXPECT_EQ(8, sizeof(int64));
+
+ EXPECT_EQ(1, sizeof(uint8));
+ EXPECT_EQ(2, sizeof(uint16));
+ EXPECT_EQ(4, sizeof(uint32));
+ EXPECT_EQ(8, sizeof(uint64));
+}
+
+TEST(IntegralTypes, MinAndMaxConstants) {
+ EXPECT_EQ(static_cast<uint8>(kint8min), static_cast<uint8>(kint8max) + 1);
+ EXPECT_EQ(static_cast<uint16>(kint16min), static_cast<uint16>(kint16max) + 1);
+ EXPECT_EQ(static_cast<uint32>(kint32min), static_cast<uint32>(kint32max) + 1);
+ EXPECT_EQ(static_cast<uint64>(kint64min), static_cast<uint64>(kint64max) + 1);
+
+ EXPECT_EQ(0, static_cast<uint8>(kuint8max + 1));
+ EXPECT_EQ(0, static_cast<uint16>(kuint16max + 1));
+ EXPECT_EQ(0, static_cast<uint32>(kuint32max + 1));
+ EXPECT_EQ(0, static_cast<uint64>(kuint64max + 1));
+}
+
+} // namespace
+} // namespace tensorflow