Prevent some memory leaks in unit tests.

This commit is contained in:
Vreixo Formoso 2008-01-12 17:32:44 +01:00
parent 25f4402147
commit 7e8a9b9473
2 changed files with 54 additions and 16 deletions

View File

@ -267,6 +267,8 @@ static void test_rrip_calc_len_symlink()
CU_ASSERT_EQUAL(ce_len, 252 + 255 + 9);
CU_ASSERT_EQUAL(sua_len, 44 + (5 + 74) + (5 + 3*7) + 1 + 28);
free(link);
free(node);
}
static
@ -712,6 +714,8 @@ static void test_rrip_get_susp_fields_symlink()
CU_ASSERT_EQUAL(entry[47], 0);
CU_ASSERT_EQUAL(entry[48], 10);
CU_ASSERT_NSTRING_EQUAL(entry + 49, "components", 10);
susp_info_free(&susp);
/* case 3. name fits, dest is one byte larger to fit */
/* 3.a extra byte in dest */

View File

@ -175,26 +175,60 @@ static void test_iso_datetime_7()
static void test_iso_1_dirid()
{
CU_ASSERT_STRING_EQUAL( iso_1_dirid("dir1"), "DIR1" );
CU_ASSERT_STRING_EQUAL( iso_1_dirid("dIR1"), "DIR1" );
CU_ASSERT_STRING_EQUAL( iso_1_dirid("DIR1"), "DIR1" );
CU_ASSERT_STRING_EQUAL( iso_1_dirid("dirwithbigname"), "DIRWITHB");
CU_ASSERT_STRING_EQUAL( iso_1_dirid("dirwith8"), "DIRWITH8");
CU_ASSERT_STRING_EQUAL( iso_1_dirid("dir.1"), "DIR_1");
CU_ASSERT_STRING_EQUAL( iso_1_dirid("4f<0KmM::xcvf"), "4F_0KMM_");
char *dir;
dir = iso_1_dirid("dir1");
CU_ASSERT_STRING_EQUAL(dir, "DIR1");
free(dir);
dir = iso_1_dirid("dIR1");
CU_ASSERT_STRING_EQUAL(dir, "DIR1");
free(dir);
dir = iso_1_dirid("DIR1");
CU_ASSERT_STRING_EQUAL(dir, "DIR1");
free(dir);
dir = iso_1_dirid("dirwithbigname");
CU_ASSERT_STRING_EQUAL(dir, "DIRWITHB");
free(dir);
dir = iso_1_dirid("dirwith8");
CU_ASSERT_STRING_EQUAL(dir, "DIRWITH8");
free(dir);
dir = iso_1_dirid("dir.1");
CU_ASSERT_STRING_EQUAL(dir, "DIR_1");
free(dir);
dir = iso_1_dirid("4f<0KmM::xcvf");
CU_ASSERT_STRING_EQUAL(dir, "4F_0KMM_");
free(dir);
}
static void test_iso_2_dirid()
{
CU_ASSERT_STRING_EQUAL( iso_2_dirid("dir1"), "DIR1" );
CU_ASSERT_STRING_EQUAL( iso_2_dirid("dIR1"), "DIR1" );
CU_ASSERT_STRING_EQUAL( iso_2_dirid("DIR1"), "DIR1" );
CU_ASSERT_STRING_EQUAL( iso_2_dirid("dirwithbigname"), "DIRWITHBIGNAME");
CU_ASSERT_STRING_EQUAL( iso_2_dirid("dirwith8"), "DIRWITH8");
CU_ASSERT_STRING_EQUAL( iso_2_dirid("dir.1"), "DIR_1");
CU_ASSERT_STRING_EQUAL( iso_2_dirid("4f<0KmM::xcvf"), "4F_0KMM__XCVF");
CU_ASSERT_STRING_EQUAL( iso_2_dirid("directory with 31 characters ok"), "DIRECTORY_WITH_31_CHARACTERS_OK");
CU_ASSERT_STRING_EQUAL( iso_2_dirid("directory with more than 31 characters"), "DIRECTORY_WITH_MORE_THAN_31_CHA");
char *dir;
dir = iso_2_dirid("dir1");
CU_ASSERT_STRING_EQUAL(dir, "DIR1");
free(dir);
dir = iso_2_dirid("dIR1");
CU_ASSERT_STRING_EQUAL(dir, "DIR1");
free(dir);
dir = iso_2_dirid("DIR1");
CU_ASSERT_STRING_EQUAL(dir, "DIR1");
free(dir);
dir = iso_2_dirid("dirwithbigname");
CU_ASSERT_STRING_EQUAL(dir, "DIRWITHBIGNAME");
free(dir);
dir = iso_2_dirid("dirwith8");
CU_ASSERT_STRING_EQUAL(dir, "DIRWITH8");
free(dir);
dir = iso_2_dirid("dir.1");
CU_ASSERT_STRING_EQUAL(dir, "DIR_1");
free(dir);
dir = iso_2_dirid("4f<0KmM::xcvf");
CU_ASSERT_STRING_EQUAL(dir, "4F_0KMM__XCVF");
free(dir);
dir = iso_2_dirid("directory with 31 characters ok");
CU_ASSERT_STRING_EQUAL(dir, "DIRECTORY_WITH_31_CHARACTERS_OK");
free(dir);
dir = iso_2_dirid("directory with more than 31 characters");
CU_ASSERT_STRING_EQUAL(dir, "DIRECTORY_WITH_MORE_THAN_31_CHA");
free(dir);
}
static void test_iso_1_fileid()