1
0
Fork 0

Fix test_jid unittest memleak

Regards https://github.com/profanity-im/profanity/issues/1019
This commit is contained in:
Michael Vetter 2019-10-06 17:07:00 +02:00
parent fd18230cd4
commit ae9ef75bab
1 changed files with 29 additions and 0 deletions

View File

@ -22,90 +22,105 @@ void create_jid_from_full_returns_full(void **state)
{
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equal("myuser@mydomain/laptop", result->fulljid);
jid_destroy(result);
}
void create_jid_from_full_returns_bare(void **state)
{
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equal("myuser@mydomain", result->barejid);
jid_destroy(result);
}
void create_jid_from_full_returns_resourcepart(void **state)
{
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equal("laptop", result->resourcepart);
jid_destroy(result);
}
void create_jid_from_full_returns_localpart(void **state)
{
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equal("myuser", result->localpart);
jid_destroy(result);
}
void create_jid_from_full_returns_domainpart(void **state)
{
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equal("mydomain", result->domainpart);
jid_destroy(result);
}
void create_jid_from_full_nolocal_returns_full(void **state)
{
Jid *result = jid_create("mydomain/laptop");
assert_string_equal("mydomain/laptop", result->fulljid);
jid_destroy(result);
}
void create_jid_from_full_nolocal_returns_bare(void **state)
{
Jid *result = jid_create("mydomain/laptop");
assert_string_equal("mydomain", result->barejid);
jid_destroy(result);
}
void create_jid_from_full_nolocal_returns_resourcepart(void **state)
{
Jid *result = jid_create("mydomain/laptop");
assert_string_equal("laptop", result->resourcepart);
jid_destroy(result);
}
void create_jid_from_full_nolocal_returns_domainpart(void **state)
{
Jid *result = jid_create("mydomain/laptop");
assert_string_equal("mydomain", result->domainpart);
jid_destroy(result);
}
void create_jid_from_full_nolocal_returns_null_localpart(void **state)
{
Jid *result = jid_create("mydomain/laptop");
assert_null(result->localpart);
jid_destroy(result);
}
void create_jid_from_bare_returns_null_full(void **state)
{
Jid *result = jid_create("myuser@mydomain");
assert_null(result->fulljid);
jid_destroy(result);
}
void create_jid_from_bare_returns_null_resource(void **state)
{
Jid *result = jid_create("myuser@mydomain");
assert_null(result->resourcepart);
jid_destroy(result);
}
void create_jid_from_bare_returns_bare(void **state)
{
Jid *result = jid_create("myuser@mydomain");
assert_string_equal("myuser@mydomain", result->barejid);
jid_destroy(result);
}
void create_jid_from_bare_returns_localpart(void **state)
{
Jid *result = jid_create("myuser@mydomain");
assert_string_equal("myuser", result->localpart);
jid_destroy(result);
}
void create_jid_from_bare_returns_domainpart(void **state)
{
Jid *result = jid_create("myuser@mydomain");
assert_string_equal("mydomain", result->domainpart);
jid_destroy(result);
}
void create_room_jid_returns_room(void **state)
@ -113,6 +128,7 @@ void create_room_jid_returns_room(void **state)
Jid *result = jid_create_from_bare_and_resource("room@conference.domain.org", "myname");
assert_string_equal("room@conference.domain.org", result->barejid);
jid_destroy(result);
}
void create_room_jid_returns_nick(void **state)
@ -120,6 +136,7 @@ void create_room_jid_returns_nick(void **state)
Jid *result = jid_create_from_bare_and_resource("room@conference.domain.org", "myname");
assert_string_equal("myname", result->resourcepart);
jid_destroy(result);
}
void create_with_slash_in_resource(void **state)
@ -131,6 +148,8 @@ void create_with_slash_in_resource(void **state)
assert_string_equal("my/nick", result->resourcepart);
assert_string_equal("room@conference.domain.org", result->barejid);
assert_string_equal("room@conference.domain.org/my/nick", result->fulljid);
jid_destroy(result);
}
void create_with_at_in_resource(void **state)
@ -142,6 +161,8 @@ void create_with_at_in_resource(void **state)
assert_string_equal("my@nick", result->resourcepart);
assert_string_equal("room@conference.domain.org", result->barejid);
assert_string_equal("room@conference.domain.org/my@nick", result->fulljid);
jid_destroy(result);
}
void create_with_at_and_slash_in_resource(void **state)
@ -153,6 +174,8 @@ void create_with_at_and_slash_in_resource(void **state)
assert_string_equal("my@nick/something", result->resourcepart);
assert_string_equal("room@conference.domain.org", result->barejid);
assert_string_equal("room@conference.domain.org/my@nick/something", result->fulljid);
jid_destroy(result);
}
void create_full_with_trailing_slash(void **state)
@ -164,6 +187,8 @@ void create_full_with_trailing_slash(void **state)
assert_string_equal("nick/", result->resourcepart);
assert_string_equal("room@conference.domain.org", result->barejid);
assert_string_equal("room@conference.domain.org/nick/", result->fulljid);
jid_destroy(result);
}
void returns_fulljid_when_exists(void **state)
@ -173,6 +198,8 @@ void returns_fulljid_when_exists(void **state)
char *result = jid_fulljid_or_barejid(jid);
assert_string_equal("localpart@domainpart/resourcepart", result);
jid_destroy(jid);
}
void returns_barejid_when_fulljid_not_exists(void **state)
@ -182,4 +209,6 @@ void returns_barejid_when_fulljid_not_exists(void **state)
char *result = jid_fulljid_or_barejid(jid);
assert_string_equal("localpart@domainpart", result);
jid_destroy(jid);
}