Create stubs for regulator Device, Rail, and Rule
Create stub versions of the Device, Rail, and Rule classes for the
phosphor-regulators application. Having a stub version of these classes
is a pre-requisite for implementing the action framework.
Also updated the top level meson.build file to build the
phosphor-regulators directory. Created new meson.build files for
several phosphor-regulators sub-directories.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I50b018db744191acd1e473652019906a8506745f
diff --git a/phosphor-regulators/test/device_tests.cpp b/phosphor-regulators/test/device_tests.cpp
new file mode 100644
index 0000000..bee4bdc
--- /dev/null
+++ b/phosphor-regulators/test/device_tests.cpp
@@ -0,0 +1,32 @@
+/**
+ * Copyright © 2019 IBM Corporation
+ *
+ * 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 "device.hpp"
+
+#include <gtest/gtest.h>
+
+using namespace phosphor::power::regulators;
+
+TEST(DeviceTests, Constructor)
+{
+ Device device("vdd_vrm2");
+ EXPECT_EQ(device.getId(), "vdd_vrm2");
+}
+
+TEST(DeviceTests, GetId)
+{
+ Device device("vio_vrm");
+ EXPECT_EQ(device.getId(), "vio_vrm");
+}
diff --git a/phosphor-regulators/test/meson.build b/phosphor-regulators/test/meson.build
new file mode 100644
index 0000000..0e32ad7
--- /dev/null
+++ b/phosphor-regulators/test/meson.build
@@ -0,0 +1,15 @@
+test('phosphor-regulators-tests',
+ executable('phosphor-regulators-tests',
+ 'device_tests.cpp',
+ 'rail_tests.cpp',
+ 'rule_tests.cpp',
+ dependencies: [
+ gmock,
+ gtest,
+ ],
+ implicit_include_directories: false,
+ include_directories: phosphor_regulators_includes,
+ )
+)
+
+# subdir('actions')
diff --git a/phosphor-regulators/test/rail_tests.cpp b/phosphor-regulators/test/rail_tests.cpp
new file mode 100644
index 0000000..09932f6
--- /dev/null
+++ b/phosphor-regulators/test/rail_tests.cpp
@@ -0,0 +1,32 @@
+/**
+ * Copyright © 2019 IBM Corporation
+ *
+ * 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 "rail.hpp"
+
+#include <gtest/gtest.h>
+
+using namespace phosphor::power::regulators;
+
+TEST(RailTests, Constructor)
+{
+ Rail rail("vdd0");
+ EXPECT_EQ(rail.getId(), "vdd0");
+}
+
+TEST(RailTests, GetId)
+{
+ Rail rail("vio2");
+ EXPECT_EQ(rail.getId(), "vio2");
+}
diff --git a/phosphor-regulators/test/rule_tests.cpp b/phosphor-regulators/test/rule_tests.cpp
new file mode 100644
index 0000000..6c32dc8
--- /dev/null
+++ b/phosphor-regulators/test/rule_tests.cpp
@@ -0,0 +1,32 @@
+/**
+ * Copyright © 2019 IBM Corporation
+ *
+ * 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 "rule.hpp"
+
+#include <gtest/gtest.h>
+
+using namespace phosphor::power::regulators;
+
+TEST(RuleTests, Constructor)
+{
+ Rule rule("set_voltage_rule");
+ EXPECT_EQ(rule.getId(), "set_voltage_rule");
+}
+
+TEST(RuleTests, GetId)
+{
+ Rule rule("read_sensor_values");
+ EXPECT_EQ(rule.getId(), "read_sensor_values");
+}