=== modified file 'torture/unit/Makefile.am' --- torture/unit/Makefile.am 2011-08-29 15:17:29 +0000 +++ torture/unit/Makefile.am 2011-09-23 12:55:51 +0000 @@ -87,6 +87,9 @@ base/hash/pdf-hash-add-list.c \ base/hash/pdf-hash-add-stm.c \ base/hash/pdf-hash-add-text.c \ + base/hash/pdf-hash-add-bool.c \ + base/hash/pdf-hash-add-i32.c \ + base/hash/pdf-hash-add-u32.c \ base/hash/pdf-hash-size.c \ base/hash/pdf-hash-get-value.c \ base/hash/pdf-hash-key-p.c \ === added file 'torture/unit/base/hash/pdf-hash-add-bool.c' --- torture/unit/base/hash/pdf-hash-add-bool.c 1970-01-01 00:00:00 +0000 +++ torture/unit/base/hash/pdf-hash-add-bool.c 2011-09-19 21:05:18 +0000 @@ -0,0 +1,74 @@ +/* -*- mode: C -*- + * + * File: pdf-hash-add-bool.c + * Date: Mon Sep 19 12:43:00 2011 + * + * GNU PDF Library - Unit tests for pdf_hash_add_bool + * + */ + +/* Copyright (C) 2008-2011 Free Software Foundation, Inc. */ + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#include +/* + * Test: pdf_hash_add_bool_001 + * Description: + * Try to add a bool variable inside a hash table. + * Success condition: + * Returns PDF_TRUE + */ +START_TEST (pdf_hash_add_bool_001) +{ + pdf_hash_t *table; + pdf_bool_t inner = PDF_TRUE; + pdf_error_t *error = NULL; + + + table = pdf_hash_new (NULL); + + fail_if (pdf_hash_add_bool (table, + "theKey", + inner, + &error) != PDF_TRUE); + fail_if (error != NULL); + + pdf_hash_destroy (table); +} +END_TEST + +/* + * Test case creation function + */ +TCase * +test_pdf_hash_add_bool (void) +{ + TCase *tc = tcase_create ("pdf_hash_add_bool"); + + tcase_add_test (tc, pdf_hash_add_bool_001); + tcase_add_checked_fixture (tc, + pdf_test_setup, + pdf_test_teardown); + return tc; +} + +/* End of pdf-hash-add-bool.c */ === added file 'torture/unit/base/hash/pdf-hash-add-i32.c' --- torture/unit/base/hash/pdf-hash-add-i32.c 1970-01-01 00:00:00 +0000 +++ torture/unit/base/hash/pdf-hash-add-i32.c 2011-09-20 08:45:48 +0000 @@ -0,0 +1,74 @@ +/* -*- mode: C -*- + * + * File: pdf-hash-add-i32.c + * Date: Mon Sep 19 12:43:00 2011 + * + * GNU PDF Library - Unit tests for pdf_hash_add_i32 + * + */ + +/* Copyright (C) 2008-2011 Free Software Foundation, Inc. */ + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#include +/* + * Test: pdf_hash_add_i32_001 + * Description: + * Try to add a i32 variable inside a hash table. + * Success condition: + * Returns PDF_TRUE + */ +START_TEST (pdf_hash_add_i32_001) +{ + pdf_hash_t *table; + pdf_i32_t inner = INT32_MAX; + pdf_error_t *error = NULL; + + + table = pdf_hash_new (NULL); + + fail_if (pdf_hash_add_i32 (table, + "theKey", + inner, + &error) != PDF_TRUE); + fail_if (error != NULL); + + pdf_hash_destroy (table); +} +END_TEST + +/* + * Test case creation function + */ +TCase * +test_pdf_hash_add_i32 (void) +{ + TCase *tc = tcase_create ("pdf_hash_add_i32"); + + tcase_add_test (tc, pdf_hash_add_i32_001); + tcase_add_checked_fixture (tc, + pdf_test_setup, + pdf_test_teardown); + return tc; +} + +/* End of pdf-hash-add-i32.c */ === added file 'torture/unit/base/hash/pdf-hash-add-u32.c' --- torture/unit/base/hash/pdf-hash-add-u32.c 1970-01-01 00:00:00 +0000 +++ torture/unit/base/hash/pdf-hash-add-u32.c 2011-09-20 08:45:36 +0000 @@ -0,0 +1,74 @@ +/* -*- mode: C -*- + * + * File: pdf-hash-add-u32.c + * Date: Mon Sep 19 12:43:00 2011 + * + * GNU PDF Library - Unit tests for pdf_hash_add_u32 + * + */ + +/* Copyright (C) 2008-2011 Free Software Foundation, Inc. */ + +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include +#include +#include +#include +#include +/* + * Test: pdf_hash_add_u32_001 + * Description: + * Try to add a u32 variable inside a hash table. + * Success condition: + * Returns PDF_TRUE + */ +START_TEST (pdf_hash_add_u32_001) +{ + pdf_hash_t *table; + pdf_u32_t inner = UINT32_MAX; + pdf_error_t *error = NULL; + + + table = pdf_hash_new (NULL); + + fail_if (pdf_hash_add_u32 (table, + "theKey", + inner, + &error) != PDF_TRUE); + fail_if (error != NULL); + + pdf_hash_destroy (table); +} +END_TEST + +/* + * Test case creation function + */ +TCase * +test_pdf_hash_add_u32 (void) +{ + TCase *tc = tcase_create ("pdf_hash_add_u32"); + + tcase_add_test (tc, pdf_hash_add_u32_001); + tcase_add_checked_fixture (tc, + pdf_test_setup, + pdf_test_teardown); + return tc; +} + +/* End of pdf-hash-add-u32.c */ === modified file 'torture/unit/base/hash/tsuite-hash.c' --- torture/unit/base/hash/tsuite-hash.c 2011-02-24 22:52:23 +0000 +++ torture/unit/base/hash/tsuite-hash.c 2011-09-23 12:55:27 +0000 @@ -36,6 +36,9 @@ extern TCase *test_pdf_hash_add_time (void); extern TCase *test_pdf_hash_add_hash (void); extern TCase *test_pdf_hash_add_text (void); +extern TCase *test_pdf_hash_add_bool (void); +extern TCase *test_pdf_hash_add_i32 (void); +extern TCase *test_pdf_hash_add_u32 (void); extern TCase *test_pdf_hash_add_list (void); extern TCase *test_pdf_hash_add_stm (void); extern TCase *test_pdf_hash_remove (void); @@ -63,6 +66,9 @@ suite_add_tcase (s, test_pdf_hash_add_time ()); suite_add_tcase (s, test_pdf_hash_add_hash ()); suite_add_tcase (s, test_pdf_hash_add_text ()); + suite_add_tcase (s, test_pdf_hash_add_bool ()); + suite_add_tcase (s, test_pdf_hash_add_i32 ()); + suite_add_tcase (s, test_pdf_hash_add_u32 ()); suite_add_tcase (s, test_pdf_hash_add_list ()); suite_add_tcase (s, test_pdf_hash_add_stm ());