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;