regulators: Add test cases for object 'or'.

Test cases for object 'or' are:
*Valid: test or.
*Invalid: test or with empty array.
*Invalid: test or with wrong type.

Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I07a77958d997227428fbc6eb4e5a08301f8a9ef3
diff --git a/phosphor-regulators/test/validate-regulators-config_tests.cpp b/phosphor-regulators/test/validate-regulators-config_tests.cpp
index aa77df3..4903eb1 100644
--- a/phosphor-regulators/test/validate-regulators-config_tests.cpp
+++ b/phosphor-regulators/test/validate-regulators-config_tests.cpp
@@ -995,3 +995,34 @@
                             "1 is not of type u'object'");
     }
 }
+TEST(ValidateRegulatorsConfigTest, Or)
+{
+    json orFile = validConfigFile;
+    orFile["rules"][0]["actions"][1]["or"][0]["i2c_compare_byte"]["register"] =
+        "0xA0";
+    orFile["rules"][0]["actions"][1]["or"][0]["i2c_compare_byte"]["value"] =
+        "0x00";
+    orFile["rules"][0]["actions"][1]["or"][1]["i2c_compare_byte"]["register"] =
+        "0xA1";
+    orFile["rules"][0]["actions"][1]["or"][1]["i2c_compare_byte"]["value"] =
+        "0x00";
+    // Valid: test or.
+    {
+        json configFile = orFile;
+        EXPECT_JSON_VALID(configFile);
+    }
+    // Invalid: test or with empty array.
+    {
+        json configFile = orFile;
+        configFile["rules"][0]["actions"][1]["or"] = json::array();
+        EXPECT_JSON_INVALID(configFile, "Validation failed.",
+                            "[] is too short");
+    }
+    // Invalid: test or with wrong type.
+    {
+        json configFile = orFile;
+        configFile["rules"][0]["actions"][1]["or"] = 1;
+        EXPECT_JSON_INVALID(configFile, "Validation failed.",
+                            "1 is not of type u'array'");
+    }
+}