57 FAIL_UNLESS(i != 0,
"string started with spaces should not be considered valid");
62 FAIL_UNLESS(i != 0,
"string with colons should not be considered valid");
64 FAIL_UNLESS(i != 0,
"string with semicolons should not be considered valid");
66 FAIL_UNLESS(i != 0,
"string with slash should not be considered valid");
68 FAIL_UNLESS(i != 0,
"string with quote should not be considered valid");
71 FAIL_UNLESS(i != 0,
"string with non printable characters should not be considered valid");
74 FAIL_UNLESS(i != 0,
"string starting with non alphanumeric should not be considered valid");
77 FAIL_UNLESS(i != 0,
"string ending in space should not be considered valid");
85 FAIL_UNLESS(i != 0,
"Too long string should not be considered valid");
88 FAIL_UNLESS(i == 0,
"Valid string not considered valid");
106 FAIL_UNLESS(i == 0,
"Could not add valid account, got code %d", i);
109 FAIL_UNLESS(i != 0,
"Duplicate account successfully added");
113 FAIL_UNLESS(i == 0,
"Could not add valid account, got code %d", i);
117 FAIL_UNLESS(i == 0,
"Could not add valid account");
120 FAIL_UNLESS(i != 0,
"Added player to non existent character name");
123 FAIL_UNLESS(i == 0,
"Failed to add player to valid account");
125 for (j=0; j<30; j++) {
126 sprintf(
names,
"char-%02d", j);
131 FAIL_UNLESS(char_names == NULL,
"Got non null value for players on account with non existant accoun");
134 FAIL_UNLESS(char_names != NULL,
"Got null value for players on account");
153 FAIL_UNLESS(ae != NULL,
"Could not find valid account");
155 FAIL_UNLESS(ae != NULL,
"Could not find valid account");
158 FAIL_UNLESS(char_names != NULL,
"Got null value for players on account");
165 while (char_names[i] != NULL) {
166 j=strlen(char_names[i]);
170 FAIL_UNLESS(char_names != NULL,
"Got null value for players on account");
171 FAIL_UNLESS(strcmp(char_names[0],
"foobar") == 0,
"Can not match on name we put in");
178 FAIL_UNLESS(char_names == NULL,
"Got non null value for players on account with non existant account");
181 FAIL_UNLESS(i!=0,
"Got successsful return code on account_remove_player_from_account with non existent account");
184 FAIL_UNLESS(i!=0,
"Got successsful return code on account_remove_player_from_account with non existent player");
188 while (char_names[j] != NULL) {
193 FAIL_UNLESS(i==0,
"Got error removing player when it should have worked");
198 while (char_names[i] != NULL) {
201 FAIL_UNLESS((i+1) == j,
"Player removal get unexpected result - %d != %d", i+1, j);
206 Suite *s = suite_create(
"account");
207 TCase *tc_core = tcase_create(
"Core");
212 suite_add_tcase(s, tc_core);
213 tcase_add_test(tc_core, test_account_check_string);
214 tcase_add_test(tc_core, test_account_add_account);
215 tcase_add_test(tc_core, test_account_load_entries);
223 SRunner *sr = srunner_create(s);
239 srunner_set_xml(sr, LOGDIR
"/unit/server/account.xml");
240 srunner_set_log(sr, LOGDIR
"/unit/server/account.out");
241 srunner_run_all(sr, CK_ENV);
242 nf = srunner_ntests_failed(sr);
245 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;