1 /* Copyright (c) 2007 Eric Scott Albright
\r
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
4 * of this software and associated documentation files (the "Software"), to deal
\r
5 * in the Software without restriction, including without limitation the rights
\r
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
7 * copies of the Software, and to permit persons to whom the Software is
\r
8 * furnished to do so, subject to the following conditions:
\r
10 * The above copyright notice and this permission notice shall be included in
\r
11 * all copies or substantial portions of the Software.
\r
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
22 #include <UnitTest++.h>
\r
23 #include <enchant.h>
\r
24 #include "../EnchantDictionaryTestFixture.h"
\r
26 struct EnchantDictFreeStringList_TestFixture : EnchantDictionaryTestFixture
\r
29 EnchantDictFreeStringList_TestFixture()
\r
31 _string_list = enchant_dict_suggest (_dict, "foo", -1, NULL);
\r
32 _pwl_string_list = enchant_dict_suggest (_pwl, "foo", -1, NULL);
\r
35 ~EnchantDictFreeStringList_TestFixture()
\r
37 FreeStringList(_string_list);
\r
38 FreeStringList(_pwl_string_list);
\r
40 char ** _string_list;
\r
41 char ** _pwl_string_list;
\r
45 * enchant_dict_free_string_list
\r
46 * @dict: A non-null #EnchantDict
\r
47 * @string_list: A non-null string list returned from enchant_dict_suggest
\r
49 * Releases the string list
\r
52 /////////////////////////////////////////////////////////////////////////////
\r
53 // Test Normal Operation
\r
54 TEST_FIXTURE(EnchantDictFreeStringList_TestFixture,
\r
55 EnchantDictFreeStringList)
\r
58 enchant_dict_free_string_list(_dict, _string_list);
\r
59 _string_list = NULL;
\r
62 TEST_FIXTURE(EnchantDictFreeStringList_TestFixture,
\r
63 EnchantDictFreeStringListOnPwl)
\r
66 enchant_dict_free_string_list(_pwl, _string_list);
\r
67 _string_list = NULL;
\r
70 TEST_FIXTURE(EnchantDictFreeStringList_TestFixture,
\r
71 EnchantDictFreeStringList_HasPreviousError_ErrorCleared)
\r
73 SetErrorOnMockDictionary("something bad happened");
\r
75 enchant_dict_free_string_list(_dict, _string_list);
\r
76 _string_list = NULL;
\r
78 CHECK_EQUAL((void*)NULL, (void*)enchant_dict_get_error(_dict));
\r
81 /////////////////////////////////////////////////////////////////////////////
\r
82 // Test Error Conditions
\r
83 TEST_FIXTURE(EnchantDictFreeStringList_TestFixture,
\r
84 EnchantDictFreeStringList_NullDict_DoNothing)
\r
87 enchant_dict_free_string_list(NULL, _string_list);
\r
90 TEST_FIXTURE(EnchantDictFreeStringList_TestFixture,
\r
91 EnchantDictFreeStringList_NullStringList_DoNothing)
\r
94 enchant_dict_free_string_list(_dict, NULL);
\r