[nest] Add 'Bound' class (#668)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 16 Jul 2018 09:38:16 +0000 (18:38 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 16 Jul 2018 09:38:16 +0000 (18:38 +0900)
This commit adds 'Bound' class which expresses value range of each
variable as min/max.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/nest/include/nest/Bound.h [new file with mode: 0644]
contrib/nest/src/Bound.test.cpp [new file with mode: 0644]

diff --git a/contrib/nest/include/nest/Bound.h b/contrib/nest/include/nest/Bound.h
new file mode 100644 (file)
index 0000000..bad28c5
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef __NEST_BOUND_H__
+#define __NEST_BOUND_H__
+
+#include <cstdint>
+
+namespace nest
+{
+
+class Bound
+{
+public:
+  Bound() = default;
+
+public:
+  Bound(int64_t min, int64_t max) : _min{min}, _max{max}
+  {
+    // DO NOTHING
+  }
+
+public:
+  int64_t min(void) const { return _min; }
+  int64_t max(void) const { return _max; }
+
+private:
+  int64_t _min;
+  int64_t _max;
+};
+
+} // namespace nest
+
+#endif // __NEST_BOUND_H__
diff --git a/contrib/nest/src/Bound.test.cpp b/contrib/nest/src/Bound.test.cpp
new file mode 100644 (file)
index 0000000..6a7c83d
--- /dev/null
@@ -0,0 +1,11 @@
+#include "nest/Bound.h"
+
+#include <gtest/gtest.h>
+
+TEST(BOUND, ctor)
+{
+  const nest::Bound b{-10, 20};
+
+  ASSERT_EQ(b.min(), -10);
+  ASSERT_EQ(b.max(), 20);
+}