tests for file_p->file_send_prepare

This commit is contained in:
2026-06-22 17:13:52 +03:00
parent 2f78bd8373
commit 3f1abfd485
5 changed files with 94 additions and 16 deletions
+1 -2
View File
@@ -49,10 +49,9 @@ void test__create_user__partial(void **state) {
session sess = {};
i_db_user_create p;
int32_t ret = 0;
char line[1024];
char line[1024] = "register " UNAME " " PASS "\n";
/* Less args */
sprintf(line, "register %s %s\n", UNAME, PASS);
ret = create_user(&sess, line);
assert_int_equal(ret, 0);
+1 -2
View File
@@ -28,8 +28,7 @@ void test_create_user(void **state) {
session sess = {};
i_db_user_create p;
int32_t ret = 0;
char line[sizeof "register" + sizeof UNAME + sizeof PASS + sizeof EMAIL + 5];
sprintf(line, "register %s %s %s\n", UNAME, PASS, EMAIL);
char line[] = "register " UNAME " " PASS " " EMAIL "\n";
will_return(__wrap_db_user_create, 123);
ret = create_user(&sess, line);
assert_int_equal(ret, 123);
+1 -2
View File
@@ -42,8 +42,7 @@ void test_create_login_success(void **state) {
// assert_int_not_equal(sess.privileges, 0);
assert_int_equal(sess.state, OP_WAIT);
char welcome_mes[sizeof "Welcome, " + sizeof UNAME + 5];
sprintf(welcome_mes, "Welcome, %s\n", UNAME);
char welcome_mes[] = "Welcome, " UNAME "\n";
assert_string_equal(welcome_mes, ret_buf);
}