summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2022-11-08 03:28:37 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-08 18:59:33 +0000
commite28685b395bb082a1ff37e1bede87cf42560c891 (patch)
tree0c1bb47788848e7b8d2e8f2d86969e32d19d5dd9
parent6b2517c5abe101698343678a7082aaf926627bf5 (diff)
downloadchrome-ec-e28685b395bb082a1ff37e1bede87cf42560c891.tar.gz
test: add more edge case tests for "chgstate sustain"
Catch cases when non-numbers are passed into "chgstate sustain" console command. BRANCH=none BUG=none TEST=twister Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I541897ecb27e87cda63b5650d06c187a09186a7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4011173 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/charge_state.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/zephyr/test/drivers/default/src/console_cmd/charge_state.c b/zephyr/test/drivers/default/src/console_cmd/charge_state.c
index 5eb21f9ff8..70b18beb9b 100644
--- a/zephyr/test/drivers/default/src/console_cmd/charge_state.c
+++ b/zephyr/test/drivers/default/src/console_cmd/charge_state.c
@@ -159,6 +159,16 @@ ZTEST_USER(console_cmd_charge_state, test_sustain_invalid_params)
zassert_equal(shell_execute_cmd(get_ec_shell(),
"chgstate sustain 50 101"),
EC_ERROR_INVAL, NULL);
+
+ /* Verify invalid lower bound (not a number) */
+ zassert_equal(shell_execute_cmd(get_ec_shell(),
+ "chgstate sustain a 50"),
+ EC_ERROR_PARAM2);
+
+ /* Verify invalid uppoer bound (not a number) */
+ zassert_equal(shell_execute_cmd(get_ec_shell(),
+ "chgstate sustain 30 a"),
+ EC_ERROR_PARAM3);
}
struct console_cmd_charge_state_fixture {