* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+/* We are testing some deprecated APIs here */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <glib.h>
static gint value_create_count = 0;
}
static void
+value_foreach (gpointer keyp, gpointer nodep, gpointer data)
+{
+ gint *count = data;
+ gint *key = keyp;
+
+ (*count)++;
+
+ g_assert_cmpint (*key, ==, 2);
+}
+
+static void
test_cache_basic (void)
{
GCache *c;
g_cache_key_foreach (c, key_foreach, &count);
g_assert_cmpint (count, ==, 1);
+ count = 0;
+ g_cache_value_foreach (c, value_foreach, &count);
+ g_assert_cmpint (count, ==, 1);
+
value = g_cache_insert (c, key);
g_assert_cmpint (*value, ==, 4);
g_assert_cmpint (value_create_count, ==, 1);
g_assert_cmpint (value_create_count, ==, 2);
g_assert_cmpint (value_destroy_count, ==, 1);
+ g_cache_remove (c, value);
g_cache_destroy (c);
+ g_free (key);
}
int