From 9d1b05a8964fd1271e2cbd32cfa8036afd24a7d2 Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 27 Dec 2013 00:07:04 +0000 Subject: [PATCH] Test priority above upper bounds --- tests/test_cmd_account.c | 21 +++++++++++++++++++-- tests/test_cmd_account.h | 1 + tests/testsuite.c | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 3db512ab..c0cceae6 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -986,7 +986,24 @@ void cmd_account_does_not_set_priority_when_too_low(void **state) } -// test invalid priority low -// test invalid priority high + +void cmd_account_does_not_set_priority_when_too_high(void **state) +{ + mock_cons_show(); + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "set", "a_account", "online", "150", NULL }; + + accounts_account_exists_return(TRUE); + + expect_cons_show("Value out of range. Must be in -128..127."); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); + + +} + // test presence updated when connected as account and current presence equals setting diff --git a/tests/test_cmd_account.h b/tests/test_cmd_account.h index 94ce6d74..9377cf08 100644 --- a/tests/test_cmd_account.h +++ b/tests/test_cmd_account.h @@ -52,3 +52,4 @@ void cmd_account_set_xa_priority_sets_preference(void **state); void cmd_account_set_dnd_priority_sets_preference(void **state); void cmd_account_set_online_priority_shows_message(void **state); void cmd_account_does_not_set_priority_when_too_low(void **state); +void cmd_account_does_not_set_priority_when_too_high(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index 126a69a2..30d53ffa 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -243,6 +243,7 @@ int main(int argc, char* argv[]) { unit_test(cmd_account_set_dnd_priority_sets_preference), unit_test(cmd_account_set_online_priority_shows_message), unit_test(cmd_account_does_not_set_priority_when_too_low), + unit_test(cmd_account_does_not_set_priority_when_too_high), }; return run_tests(tests); }