regulators: Add test cases for check_run_rule_value_exists

*Invalid: test run_rule actions specify a rule ID that does not exist.

Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: Idec5938eb1e510d977833eb50721d78d84af37ed
diff --git a/phosphor-regulators/test/validate-regulators-config_tests.cpp b/phosphor-regulators/test/validate-regulators-config_tests.cpp
index 6960462..1cb7396 100644
--- a/phosphor-regulators/test/validate-regulators-config_tests.cpp
+++ b/phosphor-regulators/test/validate-regulators-config_tests.cpp
@@ -2428,3 +2428,13 @@
                             "Infinite loop caused by run_rule actions.", "");
     }
 }
+TEST(ValidateRegulatorsConfigTest, RunRuleValueExists)
+{
+    // Invalid: test run_rule actions specify a rule ID that does not exist.
+    {
+        json configFile = validConfigFile;
+        configFile["rules"][2]["actions"][0]["run_rule"] = "set_voltage_rule2";
+        configFile["rules"][2]["id"] = "set_voltage_rule1";
+        EXPECT_JSON_INVALID(configFile, "Error: Rule ID does not exist.", "");
+    }
+}