diff options
author | Mark Ryan <mark.d.ryan@intel.com> | 2012-11-14 14:10:28 +0100 |
---|---|---|
committer | Mark Ryan <mark.d.ryan@intel.com> | 2012-11-23 16:58:09 +0100 |
commit | 75473b7905e059480b48b84293253f0c85658b69 (patch) | |
tree | f27827fa4b4569bc69ae4deaf9ca588323b127ba /tests | |
download | libgee-75473b7905e059480b48b84293253f0c85658b69.tar.gz libgee-75473b7905e059480b48b84293253f0c85658b69.tar.bz2 libgee-75473b7905e059480b48b84293253f0c85658b69.zip |
Initial Submission of libgee to Tizen IVIsubmit/2.0alpha/20121126.132540
- Submitting version 0.6.6.1 ( 38af23e )
- Compiled with valac 0.16.1
Diffstat (limited to 'tests')
59 files changed, 29197 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..b4bfffd --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,87 @@ +include $(top_srcdir)/Makefile.decl + +NULL = + +AM_CPPFLAGS = \ + -I$(top_srcdir)/gee \ + $(GLIB_CFLAGS) \ + $(NULL) + +noinst_PROGRAMS = $(TEST_PROGS) + +progs_ldadd = $(GLIB_LIBS) ../gee/libgee.la + +BUILT_SOURCES = tests.vala.stamp + +TEST_PROGS += tests +tests_VALASOURCES = \ + testarraylist.vala \ + testcase.vala \ + testcollection.vala \ + testcomparable.vala \ + testdeque.vala \ + testhashmap.vala \ + testhashmultimap.vala \ + testhashmultiset.vala \ + testhashset.vala \ + testlinkedlist.vala \ + testlinkedlistasdeque.vala \ + testlist.vala \ + testmain.vala \ + testmap.vala \ + testmultimap.vala \ + testmultiset.vala \ + testpriorityqueue.vala \ + testqueue.vala \ + testreadonlycollection.vala \ + testreadonlylist.vala \ + testreadonlymap.vala \ + testreadonlyset.vala \ + testset.vala \ + testsortedset.vala \ + testtreemap.vala \ + testtreemultimap.vala \ + testtreemultiset.vala \ + testtreeset.vala \ + $(NULL) + +tests_DEPENDENCIES = $(top_srcdir)/gee/gee-1.0.vapi + +tests_SOURCES = tests.vala.stamp $(tests_VALASOURCES:.vala=.c) +tests.vala.stamp: $(tests_VALASOURCES) + $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 --pkg posix $^ + touch $@ +tests_LDADD = $(progs_ldadd) +EXTRA_DIST += $(tests_VALASOURCES) + +coverage-reset: + lcov --base-directory=@top_srcdir@ --directory @top_srcdir@/gee --zerocounters + +coverage-report: + lcov --directory @top_srcdir@/gee \ + --capture \ + --output-file @top_builddir@/lcov.info + + lcov --directory @top_srcdir@/gee \ + --output-file @top_builddir@/lcov.info \ + --remove @top_builddir@/lcov.info \ + "/usr/include/*" "*.c" "*.h" "*.vapi" + + $(mkdir_p) @top_builddir@/tests/coverage + git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\ + genhtml --title "@PACKAGE_STRING@ $$git_commit" \ + --output-directory @top_builddir@/tests/coverage @top_builddir@/lcov.info + @echo + @echo 'lcov report can be found in:' + @echo 'file://@abs_top_builddir@/tests/coverage/index.html' + @echo + +MAINTAINERCLEANFILES = \ + $(tests_VALASOURCES:.vala=.c) \ + tests.vala.stamp \ + $(NULL) + +clean-local: + -rm -rf coverage + +.PHONY: coverage-report diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..405ce55 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,720 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# GLIB - Library of useful C routines + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/Makefile.decl +noinst_PROGRAMS = $(am__EXEEXT_1) +subdir = tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = tests$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am__objects_1 = +am__objects_2 = testarraylist.$(OBJEXT) testcase.$(OBJEXT) \ + testcollection.$(OBJEXT) testcomparable.$(OBJEXT) \ + testdeque.$(OBJEXT) testhashmap.$(OBJEXT) \ + testhashmultimap.$(OBJEXT) testhashmultiset.$(OBJEXT) \ + testhashset.$(OBJEXT) testlinkedlist.$(OBJEXT) \ + testlinkedlistasdeque.$(OBJEXT) testlist.$(OBJEXT) \ + testmain.$(OBJEXT) testmap.$(OBJEXT) testmultimap.$(OBJEXT) \ + testmultiset.$(OBJEXT) testpriorityqueue.$(OBJEXT) \ + testqueue.$(OBJEXT) testreadonlycollection.$(OBJEXT) \ + testreadonlylist.$(OBJEXT) testreadonlymap.$(OBJEXT) \ + testreadonlyset.$(OBJEXT) testset.$(OBJEXT) \ + testsortedset.$(OBJEXT) testtreemap.$(OBJEXT) \ + testtreemultimap.$(OBJEXT) testtreemultiset.$(OBJEXT) \ + testtreeset.$(OBJEXT) $(am__objects_1) +am_tests_OBJECTS = $(am__objects_2) +tests_OBJECTS = $(am_tests_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) ../gee/libgee.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(tests_SOURCES) +DIST_SOURCES = $(tests_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COVERAGE_CFLAGS = @COVERAGE_CFLAGS@ +COVERAGE_LIBS = @COVERAGE_LIBS@ +COVERAGE_VALAFLAGS = @COVERAGE_VALAFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGEE_LT_VERSION = @LIBGEE_LT_VERSION@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VALAC = @VALAC@ +VALADOC = @VALADOC@ +VALAFLAGS = @VALAFLAGS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = $(tests_VALASOURCES) +TEST_PROGS = tests +NULL = +AM_CPPFLAGS = \ + -I$(top_srcdir)/gee \ + $(GLIB_CFLAGS) \ + $(NULL) + +progs_ldadd = $(GLIB_LIBS) ../gee/libgee.la +BUILT_SOURCES = tests.vala.stamp +tests_VALASOURCES = \ + testarraylist.vala \ + testcase.vala \ + testcollection.vala \ + testcomparable.vala \ + testdeque.vala \ + testhashmap.vala \ + testhashmultimap.vala \ + testhashmultiset.vala \ + testhashset.vala \ + testlinkedlist.vala \ + testlinkedlistasdeque.vala \ + testlist.vala \ + testmain.vala \ + testmap.vala \ + testmultimap.vala \ + testmultiset.vala \ + testpriorityqueue.vala \ + testqueue.vala \ + testreadonlycollection.vala \ + testreadonlylist.vala \ + testreadonlymap.vala \ + testreadonlyset.vala \ + testset.vala \ + testsortedset.vala \ + testtreemap.vala \ + testtreemultimap.vala \ + testtreemultiset.vala \ + testtreeset.vala \ + $(NULL) + +tests_DEPENDENCIES = $(top_srcdir)/gee/gee-1.0.vapi +tests_SOURCES = tests.vala.stamp $(tests_VALASOURCES:.vala=.c) +tests_LDADD = $(progs_ldadd) +MAINTAINERCLEANFILES = \ + $(tests_VALASOURCES:.vala=.c) \ + tests.vala.stamp \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.decl $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(top_srcdir)/Makefile.decl: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +tests$(EXEEXT): $(tests_OBJECTS) $(tests_DEPENDENCIES) $(EXTRA_tests_DEPENDENCIES) + @rm -f tests$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(tests_OBJECTS) $(tests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testarraylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcase.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcollection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcomparable.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdeque.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashmultimap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashmultiset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhashset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlinkedlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlinkedlistasdeque.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmain.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmultimap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmultiset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testpriorityqueue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testqueue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlycollection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlylist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlymap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testreadonlyset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testsortedset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreemap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreemultimap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreemultiset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtreeset.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check check-am install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \ + clean-generic clean-libtool clean-local clean-noinstPROGRAMS \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done +# test-report: run tests in subdirs and generate report +# perf-report: run tests in subdirs with -m perf and generate report +# full-report: like test-report: with -m perf and -m slow +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '<?xml version="1.0"?>' > $@.xml ; \ + echo '<report-collection>' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '</report-collection>' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test +tests.vala.stamp: $(tests_VALASOURCES) + $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 --pkg posix $^ + touch $@ + +coverage-reset: + lcov --base-directory=@top_srcdir@ --directory @top_srcdir@/gee --zerocounters + +coverage-report: + lcov --directory @top_srcdir@/gee \ + --capture \ + --output-file @top_builddir@/lcov.info + + lcov --directory @top_srcdir@/gee \ + --output-file @top_builddir@/lcov.info \ + --remove @top_builddir@/lcov.info \ + "/usr/include/*" "*.c" "*.h" "*.vapi" + + $(mkdir_p) @top_builddir@/tests/coverage + git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\ + genhtml --title "@PACKAGE_STRING@ $$git_commit" \ + --output-directory @top_builddir@/tests/coverage @top_builddir@/lcov.info + @echo + @echo 'lcov report can be found in:' + @echo 'file://@abs_top_builddir@/tests/coverage/index.html' + @echo + +clean-local: + -rm -rf coverage + +.PHONY: coverage-report + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/testarraylist.c b/tests/testarraylist.c new file mode 100644 index 0000000..423396e --- /dev/null +++ b/tests/testarraylist.c @@ -0,0 +1,766 @@ +/* testarraylist.c generated by valac 0.18.0, the Vala compiler + * generated from testarraylist.vala, do not modify */ + +/* testarraylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> +#include <float.h> +#include <math.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; +typedef struct _ListTestsPrivate ListTestsPrivate; + +#define TYPE_ARRAY_LIST_TESTS (array_list_tests_get_type ()) +#define ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTests)) +#define ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) +#define IS_ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ARRAY_LIST_TESTS)) +#define IS_ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ARRAY_LIST_TESTS)) +#define ARRAY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) + +typedef struct _ArrayListTests ArrayListTests; +typedef struct _ArrayListTestsClass ArrayListTestsClass; +typedef struct _ArrayListTestsPrivate ArrayListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _ListTests { + CollectionTests parent_instance; + ListTestsPrivate * priv; +}; + +struct _ListTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_retained) (ListTests* self); +}; + +struct _ArrayListTests { + ListTests parent_instance; + ArrayListTestsPrivate * priv; +}; + +struct _ArrayListTestsClass { + ListTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer array_list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +GType array_list_tests_get_type (void) G_GNUC_CONST; +enum { + ARRAY_LIST_TESTS_DUMMY_PROPERTY +}; +#define ARRAY_LIST_TESTS_BIG_SORT_SIZE 1000000 +ArrayListTests* array_list_tests_new (void); +ArrayListTests* array_list_tests_construct (GType object_type); +ListTests* list_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void array_list_tests_test_selected_functions (ArrayListTests* self); +static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void array_list_tests_test_gobject_properties (ArrayListTests* self); +static void _array_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void array_list_tests_test_small_sort (ArrayListTests* self); +static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self); +static void array_list_tests_test_big_sort (ArrayListTests* self); +static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self); +static void array_list_tests_test_typed_to_array (ArrayListTests* self); +static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self); +static void array_list_tests_real_set_up (GeeTestCase* base); +static void array_list_tests_real_tear_down (GeeTestCase* base); +static gdouble* _double_dup (gdouble* self); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _array_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + array_list_tests_test_selected_functions (self); +} + + +static void _array_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + array_list_tests_test_gobject_properties (self); +} + + +static void _array_list_tests_test_small_sort_gee_test_case_test_method (gpointer self) { + array_list_tests_test_small_sort (self); +} + + +static void _array_list_tests_test_big_sort_gee_test_case_test_method (gpointer self) { + array_list_tests_test_big_sort (self); +} + + +static void _array_list_tests_test_typed_to_array_gee_test_case_test_method (gpointer self) { + array_list_tests_test_typed_to_array (self); +} + + +ArrayListTests* array_list_tests_construct (GType object_type) { + ArrayListTests * self = NULL; + self = (ArrayListTests*) list_tests_construct (object_type, "ArrayList"); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] selected functions", _array_list_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] GObject properties", _array_list_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] small sort (insertion)", _array_list_tests_test_small_sort_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] big sort (timsort)", _array_list_tests_test_big_sort_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ArrayList] typed to_array calls", _array_list_tests_test_typed_to_array_gee_test_case_test_method, self); + return self; +} + + +ArrayListTests* array_list_tests_new (void) { + return array_list_tests_construct (TYPE_ARRAY_LIST_TESTS); +} + + +static void array_list_tests_real_set_up (GeeTestCase* base) { + ArrayListTests * self; + GeeArrayList* _tmp0_; + self = (ArrayListTests*) base; + _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void array_list_tests_real_tear_down (GeeTestCase* base) { + ArrayListTests * self; + self = (ArrayListTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void array_list_tests_test_selected_functions (ArrayListTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* test_list; + GEqualFunc _tmp2_; + GEqualFunc _tmp3_; + GEqualFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_array_list_get_equal_func (test_list); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_equal; + _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal"); + _g_object_unref0 (test_list); +} + + +void array_list_tests_test_gobject_properties (ArrayListTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* test_list; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_list, "equal-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_array_list_get_equal_func (test_list); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_list.equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_list); +} + + +static void array_list_tests_test_small_sort (ArrayListTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* test_list; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gpointer _tmp6_ = NULL; + gchar* _tmp7_; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_ARRAY_LIST) ? ((GeeArrayList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "one"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "two"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "three"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "four"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "five"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "six"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "seven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eight"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "nine"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "ten"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eleven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "twelve"); + gee_list_sort ((GeeList*) test_list, NULL); + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 0); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (g_strcmp0 (_tmp3_, "eight") == 0, "test_list.get (0) == \"eight\""); + _g_free0 (_tmp3_); + _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 1); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "eleven") == 0, "test_list.get (1) == \"eleven\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 2); + _tmp7_ = (gchar*) _tmp6_; + _vala_assert (g_strcmp0 (_tmp7_, "five") == 0, "test_list.get (2) == \"five\""); + _g_free0 (_tmp7_); + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 3); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "four") == 0, "test_list.get (3) == \"four\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 4); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "nine") == 0, "test_list.get (4) == \"nine\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 5); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_list.get (5) == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 6); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "seven") == 0, "test_list.get (6) == \"seven\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 7); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_list.get (7) == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 8); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "ten") == 0, "test_list.get (8) == \"ten\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 9); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "three") == 0, "test_list.get (9) == \"three\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 10); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "twelve") == 0, "test_list.get (10) == \"twelve\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 11); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (11) == \"two\""); + _g_free0 (_tmp25_); + _g_object_unref0 (test_list); +} + + +static void array_list_tests_test_big_sort (ArrayListTests* self) { + GeeArrayList* _tmp0_; + GeeList* big_test_list; + GeeList* _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL); + big_test_list = (GeeList*) _tmp0_; + { + gint i; + i = 0; + { + gboolean _tmp1_; + _tmp1_ = TRUE; + while (TRUE) { + gboolean _tmp2_; + gint _tmp4_; + GeeList* _tmp5_; + gint32 _tmp6_ = 0; + _tmp2_ = _tmp1_; + if (!_tmp2_) { + gint _tmp3_; + _tmp3_ = i; + i = _tmp3_ + 1; + } + _tmp1_ = FALSE; + _tmp4_ = i; + if (!(_tmp4_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) { + break; + } + _tmp5_ = big_test_list; + _tmp6_ = g_random_int_range ((gint32) 1, (gint32) (ARRAY_LIST_TESTS_BIG_SORT_SIZE - 1)); + gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) _tmp6_)); + } + } + } + _tmp7_ = big_test_list; + gee_list_sort (_tmp7_, NULL); + { + gint i; + i = 1; + { + gboolean _tmp8_; + _tmp8_ = TRUE; + while (TRUE) { + gboolean _tmp9_; + gint _tmp11_; + GeeList* _tmp12_; + gint _tmp13_; + gpointer _tmp14_ = NULL; + GeeList* _tmp15_; + gint _tmp16_; + gpointer _tmp17_ = NULL; + _tmp9_ = _tmp8_; + if (!_tmp9_) { + gint _tmp10_; + _tmp10_ = i; + i = _tmp10_ + 1; + } + _tmp8_ = FALSE; + _tmp11_ = i; + if (!(_tmp11_ < ARRAY_LIST_TESTS_BIG_SORT_SIZE)) { + break; + } + _tmp12_ = big_test_list; + _tmp13_ = i; + _tmp14_ = gee_list_get (_tmp12_, _tmp13_ - 1); + _tmp15_ = big_test_list; + _tmp16_ = i; + _tmp17_ = gee_list_get (_tmp15_, _tmp16_); + _vala_assert (((gint32) ((gintptr) _tmp14_)) <= ((gint32) ((gintptr) _tmp17_)), "big_test_list[i - 1] <= big_test_list[i]"); + } + } + } + _g_object_unref0 (big_test_list); +} + + +static gdouble* _double_dup (gdouble* self) { + gdouble* dup; + dup = g_new0 (gdouble, 1); + memcpy (dup, self, sizeof (gdouble)); + return dup; +} + + +static void array_list_tests_test_typed_to_array (ArrayListTests* self) { + GeeArrayList* _tmp0_; + GeeList* bool_list; + GeeList* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeList* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeList* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeList* _tmp7_; + gint _tmp8_ = 0; + gpointer* _tmp9_ = NULL; + gboolean* bool_array; + gint bool_array_length1; + gint _bool_array_size_; + gint index; + GeeArrayList* _tmp25_; + GeeList* int_list; + GeeList* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeList* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeList* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeList* _tmp32_; + gint _tmp33_ = 0; + gpointer* _tmp34_ = NULL; + gint* int_array; + gint int_array_length1; + gint _int_array_size_; + GeeArrayList* _tmp50_; + GeeList* double_list; + GeeList* _tmp51_; + gdouble _tmp52_; + gboolean _tmp53_ = FALSE; + GeeList* _tmp54_; + gdouble _tmp55_; + gboolean _tmp56_ = FALSE; + GeeList* _tmp57_; + gdouble _tmp58_; + gboolean _tmp59_ = FALSE; + GeeList* _tmp60_; + gint _tmp61_ = 0; + gpointer* _tmp62_ = NULL; + gdouble** double_array; + gint double_array_length1; + gint _double_array_size_; + g_return_if_fail (self != NULL); + _tmp0_ = gee_array_list_new (G_TYPE_BOOLEAN, NULL, NULL, NULL); + bool_list = (GeeList*) _tmp0_; + _tmp1_ = bool_list; + _tmp2_ = gee_collection_add ((GeeCollection*) _tmp1_, (gpointer) ((gintptr) TRUE)); + _vala_assert (_tmp2_, "bool_list.add (true)"); + _tmp3_ = bool_list; + _tmp4_ = gee_collection_add ((GeeCollection*) _tmp3_, (gpointer) ((gintptr) TRUE)); + _vala_assert (_tmp4_, "bool_list.add (true)"); + _tmp5_ = bool_list; + _tmp6_ = gee_collection_add ((GeeCollection*) _tmp5_, (gpointer) ((gintptr) FALSE)); + _vala_assert (_tmp6_, "bool_list.add (false)"); + _tmp7_ = bool_list; + _tmp9_ = gee_collection_to_array ((GeeCollection*) _tmp7_, &_tmp8_); + bool_array = _tmp9_; + bool_array_length1 = _tmp8_; + _bool_array_size_ = bool_array_length1; + index = 0; + { + GeeList* _tmp10_; + GeeList* _tmp11_; + GeeList* _element_list; + GeeList* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gint _element_size; + gint _element_index; + _tmp10_ = bool_list; + _tmp11_ = _g_object_ref0 (_tmp10_); + _element_list = _tmp11_; + _tmp12_ = _element_list; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _element_size = _tmp14_; + _element_index = -1; + while (TRUE) { + gint _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeList* _tmp18_; + gint _tmp19_; + gpointer _tmp20_ = NULL; + gboolean element; + gboolean _tmp21_; + gboolean* _tmp22_; + gint _tmp22__length1; + gint _tmp23_; + gboolean _tmp24_; + _tmp15_ = _element_index; + _element_index = _tmp15_ + 1; + _tmp16_ = _element_index; + _tmp17_ = _element_size; + if (!(_tmp16_ < _tmp17_)) { + break; + } + _tmp18_ = _element_list; + _tmp19_ = _element_index; + _tmp20_ = gee_list_get (_tmp18_, _tmp19_); + element = (gboolean) ((gintptr) _tmp20_); + _tmp21_ = element; + _tmp22_ = bool_array; + _tmp22__length1 = bool_array_length1; + _tmp23_ = index; + index = _tmp23_ + 1; + _tmp24_ = _tmp22_[_tmp23_]; + _vala_assert (_tmp21_ == _tmp24_, "element == bool_array[index++]"); + } + _g_object_unref0 (_element_list); + } + _tmp25_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL); + int_list = (GeeList*) _tmp25_; + _tmp26_ = int_list; + _tmp27_ = gee_collection_add ((GeeCollection*) _tmp26_, (gpointer) ((gintptr) 1)); + _vala_assert (_tmp27_, "int_list.add (1)"); + _tmp28_ = int_list; + _tmp29_ = gee_collection_add ((GeeCollection*) _tmp28_, (gpointer) ((gintptr) 2)); + _vala_assert (_tmp29_, "int_list.add (2)"); + _tmp30_ = int_list; + _tmp31_ = gee_collection_add ((GeeCollection*) _tmp30_, (gpointer) ((gintptr) 3)); + _vala_assert (_tmp31_, "int_list.add (3)"); + _tmp32_ = int_list; + _tmp34_ = gee_collection_to_array ((GeeCollection*) _tmp32_, &_tmp33_); + int_array = _tmp34_; + int_array_length1 = _tmp33_; + _int_array_size_ = int_array_length1; + index = 0; + { + GeeList* _tmp35_; + GeeList* _tmp36_; + GeeList* _element_list; + GeeList* _tmp37_; + gint _tmp38_; + gint _tmp39_; + gint _element_size; + gint _element_index; + _tmp35_ = int_list; + _tmp36_ = _g_object_ref0 (_tmp35_); + _element_list = _tmp36_; + _tmp37_ = _element_list; + _tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_); + _tmp39_ = _tmp38_; + _element_size = _tmp39_; + _element_index = -1; + while (TRUE) { + gint _tmp40_; + gint _tmp41_; + gint _tmp42_; + GeeList* _tmp43_; + gint _tmp44_; + gpointer _tmp45_ = NULL; + gint element; + gint _tmp46_; + gint* _tmp47_; + gint _tmp47__length1; + gint _tmp48_; + gint _tmp49_; + _tmp40_ = _element_index; + _element_index = _tmp40_ + 1; + _tmp41_ = _element_index; + _tmp42_ = _element_size; + if (!(_tmp41_ < _tmp42_)) { + break; + } + _tmp43_ = _element_list; + _tmp44_ = _element_index; + _tmp45_ = gee_list_get (_tmp43_, _tmp44_); + element = (gint) ((gintptr) _tmp45_); + _tmp46_ = element; + _tmp47_ = int_array; + _tmp47__length1 = int_array_length1; + _tmp48_ = index; + index = _tmp48_ + 1; + _tmp49_ = _tmp47_[_tmp48_]; + _vala_assert (_tmp46_ == _tmp49_, "element == int_array[index++]"); + } + _g_object_unref0 (_element_list); + } + _tmp50_ = gee_array_list_new (G_TYPE_DOUBLE, (GBoxedCopyFunc) _double_dup, g_free, NULL); + double_list = (GeeList*) _tmp50_; + _tmp51_ = double_list; + _tmp52_ = 1.0; + _tmp53_ = gee_collection_add ((GeeCollection*) _tmp51_, &_tmp52_); + _vala_assert (_tmp53_, "double_list.add (1.0d)"); + _tmp54_ = double_list; + _tmp55_ = 1.5; + _tmp56_ = gee_collection_add ((GeeCollection*) _tmp54_, &_tmp55_); + _vala_assert (_tmp56_, "double_list.add (1.5d)"); + _tmp57_ = double_list; + _tmp58_ = 2.0; + _tmp59_ = gee_collection_add ((GeeCollection*) _tmp57_, &_tmp58_); + _vala_assert (_tmp59_, "double_list.add (2.0d)"); + _tmp60_ = double_list; + _tmp62_ = gee_collection_to_array ((GeeCollection*) _tmp60_, &_tmp61_); + double_array = _tmp62_; + double_array_length1 = _tmp61_; + _double_array_size_ = double_array_length1; + index = 0; + { + GeeList* _tmp63_; + GeeList* _tmp64_; + GeeList* _element_list; + GeeList* _tmp65_; + gint _tmp66_; + gint _tmp67_; + gint _element_size; + gint _element_index; + _tmp63_ = double_list; + _tmp64_ = _g_object_ref0 (_tmp63_); + _element_list = _tmp64_; + _tmp65_ = _element_list; + _tmp66_ = gee_collection_get_size ((GeeCollection*) _tmp65_); + _tmp67_ = _tmp66_; + _element_size = _tmp67_; + _element_index = -1; + while (TRUE) { + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + GeeList* _tmp71_; + gint _tmp72_; + gpointer _tmp73_ = NULL; + gdouble* _tmp74_; + gdouble _tmp75_; + gdouble element; + gdouble _tmp76_; + gdouble** _tmp77_; + gint _tmp77__length1; + gint _tmp78_; + gdouble* _tmp79_; + _tmp68_ = _element_index; + _element_index = _tmp68_ + 1; + _tmp69_ = _element_index; + _tmp70_ = _element_size; + if (!(_tmp69_ < _tmp70_)) { + break; + } + _tmp71_ = _element_list; + _tmp72_ = _element_index; + _tmp73_ = gee_list_get (_tmp71_, _tmp72_); + _tmp74_ = (gdouble*) _tmp73_; + _tmp75_ = *_tmp74_; + _g_free0 (_tmp74_); + element = _tmp75_; + _tmp76_ = element; + _tmp77_ = double_array; + _tmp77__length1 = double_array_length1; + _tmp78_ = index; + index = _tmp78_ + 1; + _tmp79_ = _tmp77_[_tmp78_]; + _vala_assert ((_tmp76_) == (*_tmp79_), "element == double_array[index++]"); + } + _g_object_unref0 (_element_list); + } + double_array = (_vala_array_free (double_array, double_array_length1, (GDestroyNotify) g_free), NULL); + _g_object_unref0 (double_list); + int_array = (g_free (int_array), NULL); + _g_object_unref0 (int_list); + bool_array = (g_free (bool_array), NULL); + _g_object_unref0 (bool_list); +} + + +static void array_list_tests_class_init (ArrayListTestsClass * klass) { + array_list_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = array_list_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = array_list_tests_real_tear_down; +} + + +static void array_list_tests_instance_init (ArrayListTests * self) { +} + + +GType array_list_tests_get_type (void) { + static volatile gsize array_list_tests_type_id__volatile = 0; + if (g_once_init_enter (&array_list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ArrayListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) array_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ArrayListTests), 0, (GInstanceInitFunc) array_list_tests_instance_init, NULL }; + GType array_list_tests_type_id; + array_list_tests_type_id = g_type_register_static (TYPE_LIST_TESTS, "ArrayListTests", &g_define_type_info, 0); + g_once_init_leave (&array_list_tests_type_id__volatile, array_list_tests_type_id); + } + return array_list_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testarraylist.vala b/tests/testarraylist.vala new file mode 100644 index 0000000..9537f79 --- /dev/null +++ b/tests/testarraylist.vala @@ -0,0 +1,161 @@ +/* testarraylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class ArrayListTests : ListTests { + + public ArrayListTests () { + base ("ArrayList"); + add_test ("[ArrayList] selected functions", test_selected_functions); + add_test ("[ArrayList] GObject properties", test_gobject_properties); + add_test ("[ArrayList] small sort (insertion)", test_small_sort); + add_test ("[ArrayList] big sort (timsort)", test_big_sort); + add_test ("[ArrayList] typed to_array calls", test_typed_to_array); + } + + private static const int BIG_SORT_SIZE = 1000000; + + public override void set_up () { + test_collection = new ArrayList<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + public void test_selected_functions () { + var test_list = test_collection as ArrayList<string>; + + // Check the collection exists + assert (test_list != null); + + // Check the selected equal function + assert (test_list.equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_list = test_collection as ArrayList<string>; + + // Check the list exists + assert (test_list != null); + Value value; + + value = Value (typeof (EqualFunc)); + test_list.get_property ("equal-func", ref value); + assert (value.get_pointer () == (void*) test_list.equal_func); + value.unset (); + } + + private void test_small_sort () { + var test_list = test_collection as ArrayList<string>; + + // Check the collection exists + assert (test_list != null); + + test_list.add ("one"); + test_list.add ("two"); + test_list.add ("three"); + test_list.add ("four"); + test_list.add ("five"); + test_list.add ("six"); + test_list.add ("seven"); + test_list.add ("eight"); + test_list.add ("nine"); + test_list.add ("ten"); + test_list.add ("eleven"); + test_list.add ("twelve"); + + test_list.sort (); + + assert (test_list.get (0) == "eight"); + assert (test_list.get (1) == "eleven"); + assert (test_list.get (2) == "five"); + assert (test_list.get (3) == "four"); + assert (test_list.get (4) == "nine"); + assert (test_list.get (5) == "one"); + assert (test_list.get (6) == "seven"); + assert (test_list.get (7) == "six"); + assert (test_list.get (8) == "ten"); + assert (test_list.get (9) == "three"); + assert (test_list.get (10) == "twelve"); + assert (test_list.get (11) == "two"); + } + + private void test_big_sort () { + Gee.List<int32> big_test_list = new ArrayList<int32> (); + for (int i = 0; i < BIG_SORT_SIZE; i++) { + big_test_list.add (GLib.Random.int_range (1, BIG_SORT_SIZE - 1)); + } + + big_test_list.sort (); + + for (int i = 1; i < BIG_SORT_SIZE; i++) { + assert (big_test_list[i - 1] <= big_test_list[i]); + } + } + + private void test_typed_to_array () { + // Test with a bool collection + Gee.List<bool> bool_list = new ArrayList<bool> (); + assert (bool_list.add (true)); + assert (bool_list.add (true)); + assert (bool_list.add (false)); + + bool[] bool_array = bool_list.to_array (); + int index = 0; + foreach (bool element in bool_list) { + assert (element == bool_array[index++]); + } + + // Test with an int collection + Gee.List<int> int_list = new ArrayList<int> (); + assert (int_list.add (1)); + assert (int_list.add (2)); + assert (int_list.add (3)); + + int[] int_array = int_list.to_array (); + index = 0; + foreach (int element in int_list) { + assert (element == int_array[index++]); + } + + // Test with a double collection + Gee.List<double?> double_list = new ArrayList<double?> (); + assert (double_list.add (1.0d)); + assert (double_list.add (1.5d)); + assert (double_list.add (2.0d)); + +#if VALA_0_16 + double?[] double_array = double_list.to_array (); +#else + double[] double_array = double_list.to_array (); +#endif + index = 0; + foreach (double element in double_list) { + assert (element == double_array[index++]); + } + } +} diff --git a/tests/testcase.c b/tests/testcase.c new file mode 100644 index 0000000..2418301 --- /dev/null +++ b/tests/testcase.c @@ -0,0 +1,561 @@ +/* testcase.c generated by valac 0.18.0, the Vala compiler + * generated from testcase.vala, do not modify */ + +/* testcase.vala + * + * Copyright (C) 2009 Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <stdlib.h> +#include <string.h> +#include <gobject/gvaluecollector.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define GEE_TEST_CASE_TYPE_ADAPTOR (gee_test_case_adaptor_get_type ()) +#define GEE_TEST_CASE_ADAPTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptor)) +#define GEE_TEST_CASE_ADAPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptorClass)) +#define GEE_TEST_CASE_IS_ADAPTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TEST_CASE_TYPE_ADAPTOR)) +#define GEE_TEST_CASE_IS_ADAPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TEST_CASE_TYPE_ADAPTOR)) +#define GEE_TEST_CASE_ADAPTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptorClass)) + +typedef struct _GeeTestCaseAdaptor GeeTestCaseAdaptor; +typedef struct _GeeTestCaseAdaptorClass GeeTestCaseAdaptorClass; +#define _gee_test_case_adaptor_unref0(var) ((var == NULL) ? NULL : (var = (gee_test_case_adaptor_unref (var), NULL))) +typedef struct _GeeTestCaseAdaptorPrivate GeeTestCaseAdaptorPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +typedef struct _GeeTestCaseParamSpecAdaptor GeeTestCaseParamSpecAdaptor; + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _GeeTestCasePrivate { + GTestSuite* suite; + GeeTestCaseAdaptor** adaptors; + gint adaptors_length1; + gint _adaptors_size_; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +struct _GeeTestCaseAdaptor { + GTypeInstance parent_instance; + volatile int ref_count; + GeeTestCaseAdaptorPrivate * priv; +}; + +struct _GeeTestCaseAdaptorClass { + GTypeClass parent_class; + void (*finalize) (GeeTestCaseAdaptor *self); +}; + +struct _GeeTestCaseAdaptorPrivate { + gchar* _name; + GeeTestCaseTestMethod test; + gpointer test_target; + GDestroyNotify test_target_destroy_notify; + GeeTestCase* test_case; +}; + +struct _GeeTestCaseParamSpecAdaptor { + GParamSpec parent_instance; +}; + + +static gpointer gee_test_case_parent_class = NULL; +static gpointer gee_test_case_adaptor_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +static gpointer gee_test_case_adaptor_ref (gpointer instance); +static void gee_test_case_adaptor_unref (gpointer instance); +static GParamSpec* gee_test_case_param_spec_adaptor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED; +static void gee_test_case_value_set_adaptor (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static void gee_test_case_value_take_adaptor (GValue* value, gpointer v_object) G_GNUC_UNUSED; +static gpointer gee_test_case_value_get_adaptor (const GValue* value) G_GNUC_UNUSED; +static GType gee_test_case_adaptor_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +#define GEE_TEST_CASE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_TEST_CASE, GeeTestCasePrivate)) +enum { + GEE_TEST_CASE_DUMMY_PROPERTY +}; +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static GeeTestCaseAdaptor* gee_test_case_adaptor_new (const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case); +static GeeTestCaseAdaptor* gee_test_case_adaptor_construct (GType object_type, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case); +static void _vala_array_add1 (GeeTestCaseAdaptor*** array, int* length, int* size, GeeTestCaseAdaptor* value); +static const gchar* gee_test_case_adaptor_get_name (GeeTestCaseAdaptor* self); +static void gee_test_case_adaptor_set_up (GeeTestCaseAdaptor* self, void* fixture); +static void _gee_test_case_adaptor_set_up_gtest_func (void* fixture, gpointer self); +static void gee_test_case_adaptor_run (GeeTestCaseAdaptor* self, void* fixture); +static void _gee_test_case_adaptor_run_gtest_func (void* fixture, gpointer self); +static void gee_test_case_adaptor_tear_down (GeeTestCaseAdaptor* self, void* fixture); +static void _gee_test_case_adaptor_tear_down_gtest_func (void* fixture, gpointer self); +void gee_test_case_set_up (GeeTestCase* self); +static void gee_test_case_real_set_up (GeeTestCase* self); +void gee_test_case_tear_down (GeeTestCase* self); +static void gee_test_case_real_tear_down (GeeTestCase* self); +GTestSuite* gee_test_case_get_suite (GeeTestCase* self); +#define GEE_TEST_CASE_ADAPTOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptorPrivate)) +enum { + GEE_TEST_CASE_ADAPTOR_DUMMY_PROPERTY +}; +static void gee_test_case_adaptor_set_name (GeeTestCaseAdaptor* self, const gchar* value); +static void gee_test_case_adaptor_finalize (GeeTestCaseAdaptor* obj); +static void gee_test_case_finalize (GObject* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name) { + GeeTestCase * self = NULL; + const gchar* _tmp0_; + GTestSuite* _tmp1_; + g_return_val_if_fail (name != NULL, NULL); + self = (GeeTestCase*) g_object_new (object_type, NULL); + _tmp0_ = name; + _tmp1_ = g_test_create_suite (_tmp0_); + self->priv->suite = _tmp1_; + return self; +} + + +static gpointer _gee_test_case_adaptor_ref0 (gpointer self) { + return self ? gee_test_case_adaptor_ref (self) : NULL; +} + + +static void _vala_array_add1 (GeeTestCaseAdaptor*** array, int* length, int* size, GeeTestCaseAdaptor* value) { + if ((*length) == (*size)) { + *size = (*size) ? (2 * (*size)) : 4; + *array = g_renew (GeeTestCaseAdaptor*, *array, (*size) + 1); + } + (*array)[(*length)++] = value; + (*array)[*length] = NULL; +} + + +static void _gee_test_case_adaptor_set_up_gtest_func (void* fixture, gpointer self) { + gee_test_case_adaptor_set_up (self, fixture); +} + + +static void _gee_test_case_adaptor_run_gtest_func (void* fixture, gpointer self) { + gee_test_case_adaptor_run (self, fixture); +} + + +static void _gee_test_case_adaptor_tear_down_gtest_func (void* fixture, gpointer self) { + gee_test_case_adaptor_tear_down (self, fixture); +} + + +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target) { + const gchar* _tmp0_; + GeeTestCaseTestMethod _tmp1_; + void* _tmp1__target; + GeeTestCaseAdaptor* _tmp2_; + GeeTestCaseAdaptor* adaptor; + GeeTestCaseAdaptor** _tmp3_; + gint _tmp3__length1; + GeeTestCaseAdaptor* _tmp4_; + GTestSuite* _tmp5_; + const gchar* _tmp6_; + const gchar* _tmp7_; + GTestCase* _tmp8_; + g_return_if_fail (self != NULL); + g_return_if_fail (name != NULL); + _tmp0_ = name; + _tmp1_ = test; + _tmp1__target = test_target; + _tmp2_ = gee_test_case_adaptor_new (_tmp0_, _tmp1_, _tmp1__target, self); + adaptor = _tmp2_; + _tmp3_ = self->priv->adaptors; + _tmp3__length1 = self->priv->adaptors_length1; + _tmp4_ = _gee_test_case_adaptor_ref0 (adaptor); + _vala_array_add1 (&self->priv->adaptors, &self->priv->adaptors_length1, &self->priv->_adaptors_size_, _tmp4_); + _tmp5_ = self->priv->suite; + _tmp6_ = gee_test_case_adaptor_get_name (adaptor); + _tmp7_ = _tmp6_; + _tmp8_ = g_test_create_case (_tmp7_, (gsize) 0, adaptor, (void (*) (void)) _gee_test_case_adaptor_set_up_gtest_func, (void (*) (void)) _gee_test_case_adaptor_run_gtest_func, (void (*) (void)) _gee_test_case_adaptor_tear_down_gtest_func); + g_test_suite_add (_tmp5_, _tmp8_); + _gee_test_case_adaptor_unref0 (adaptor); +} + + +static void gee_test_case_real_set_up (GeeTestCase* self) { +} + + +void gee_test_case_set_up (GeeTestCase* self) { + g_return_if_fail (self != NULL); + GEE_TEST_CASE_GET_CLASS (self)->set_up (self); +} + + +static void gee_test_case_real_tear_down (GeeTestCase* self) { +} + + +void gee_test_case_tear_down (GeeTestCase* self) { + g_return_if_fail (self != NULL); + GEE_TEST_CASE_GET_CLASS (self)->tear_down (self); +} + + +GTestSuite* gee_test_case_get_suite (GeeTestCase* self) { + GTestSuite* result = NULL; + GTestSuite* _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->suite; + result = _tmp0_; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static GeeTestCaseAdaptor* gee_test_case_adaptor_construct (GType object_type, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case) { + GeeTestCaseAdaptor* self = NULL; + const gchar* _tmp0_; + GeeTestCaseTestMethod _tmp1_; + void* _tmp1__target; + GeeTestCase* _tmp2_; + GeeTestCase* _tmp3_; + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (test_case != NULL, NULL); + self = (GeeTestCaseAdaptor*) g_type_create_instance (object_type); + _tmp0_ = name; + gee_test_case_adaptor_set_name (self, _tmp0_); + _tmp1_ = test; + _tmp1__target = test_target; + (self->priv->test_target_destroy_notify == NULL) ? NULL : (self->priv->test_target_destroy_notify (self->priv->test_target), NULL); + self->priv->test = NULL; + self->priv->test_target = NULL; + self->priv->test_target_destroy_notify = NULL; + self->priv->test = _tmp1_; + self->priv->test_target = _tmp1__target; + self->priv->test_target_destroy_notify = NULL; + _tmp2_ = test_case; + _tmp3_ = _g_object_ref0 (_tmp2_); + _g_object_unref0 (self->priv->test_case); + self->priv->test_case = _tmp3_; + return self; +} + + +static GeeTestCaseAdaptor* gee_test_case_adaptor_new (const gchar* name, GeeTestCaseTestMethod test, void* test_target, GeeTestCase* test_case) { + return gee_test_case_adaptor_construct (GEE_TEST_CASE_TYPE_ADAPTOR, name, test, test_target, test_case); +} + + +static void gee_test_case_adaptor_set_up (GeeTestCaseAdaptor* self, void* fixture) { + GeeTestCase* _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->test_case; + gee_test_case_set_up (_tmp0_); +} + + +static void gee_test_case_adaptor_run (GeeTestCaseAdaptor* self, void* fixture) { + GeeTestCaseTestMethod _tmp0_; + void* _tmp0__target; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->test; + _tmp0__target = self->priv->test_target; + _tmp0_ (_tmp0__target); +} + + +static void gee_test_case_adaptor_tear_down (GeeTestCaseAdaptor* self, void* fixture) { + GeeTestCase* _tmp0_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->test_case; + gee_test_case_tear_down (_tmp0_); +} + + +static const gchar* gee_test_case_adaptor_get_name (GeeTestCaseAdaptor* self) { + const gchar* result; + const gchar* _tmp0_; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = self->priv->_name; + result = _tmp0_; + return result; +} + + +static void gee_test_case_adaptor_set_name (GeeTestCaseAdaptor* self, const gchar* value) { + const gchar* _tmp0_; + gchar* _tmp1_; + g_return_if_fail (self != NULL); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); + _g_free0 (self->priv->_name); + self->priv->_name = _tmp1_; +} + + +static void gee_test_case_value_adaptor_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void gee_test_case_value_adaptor_free_value (GValue* value) { + if (value->data[0].v_pointer) { + gee_test_case_adaptor_unref (value->data[0].v_pointer); + } +} + + +static void gee_test_case_value_adaptor_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = gee_test_case_adaptor_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer gee_test_case_value_adaptor_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* gee_test_case_value_adaptor_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + GeeTestCaseAdaptor* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = gee_test_case_adaptor_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* gee_test_case_value_adaptor_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + GeeTestCaseAdaptor** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = gee_test_case_adaptor_ref (value->data[0].v_pointer); + } + return NULL; +} + + +static GParamSpec* gee_test_case_param_spec_adaptor (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + GeeTestCaseParamSpecAdaptor* spec; + g_return_val_if_fail (g_type_is_a (object_type, GEE_TEST_CASE_TYPE_ADAPTOR), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +static gpointer gee_test_case_value_get_adaptor (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEST_CASE_TYPE_ADAPTOR), NULL); + return value->data[0].v_pointer; +} + + +static void gee_test_case_value_set_adaptor (GValue* value, gpointer v_object) { + GeeTestCaseAdaptor* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEST_CASE_TYPE_ADAPTOR)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TEST_CASE_TYPE_ADAPTOR)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + gee_test_case_adaptor_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_test_case_adaptor_unref (old); + } +} + + +static void gee_test_case_value_take_adaptor (GValue* value, gpointer v_object) { + GeeTestCaseAdaptor* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TEST_CASE_TYPE_ADAPTOR)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TEST_CASE_TYPE_ADAPTOR)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + gee_test_case_adaptor_unref (old); + } +} + + +static void gee_test_case_adaptor_class_init (GeeTestCaseAdaptorClass * klass) { + gee_test_case_adaptor_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_ADAPTOR_CLASS (klass)->finalize = gee_test_case_adaptor_finalize; + g_type_class_add_private (klass, sizeof (GeeTestCaseAdaptorPrivate)); +} + + +static void gee_test_case_adaptor_instance_init (GeeTestCaseAdaptor * self) { + self->priv = GEE_TEST_CASE_ADAPTOR_GET_PRIVATE (self); + self->ref_count = 1; +} + + +static void gee_test_case_adaptor_finalize (GeeTestCaseAdaptor* obj) { + GeeTestCaseAdaptor * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TEST_CASE_TYPE_ADAPTOR, GeeTestCaseAdaptor); + _g_free0 (self->priv->_name); + (self->priv->test_target_destroy_notify == NULL) ? NULL : (self->priv->test_target_destroy_notify (self->priv->test_target), NULL); + self->priv->test = NULL; + self->priv->test_target = NULL; + self->priv->test_target_destroy_notify = NULL; + _g_object_unref0 (self->priv->test_case); +} + + +static GType gee_test_case_adaptor_get_type (void) { + static volatile gsize gee_test_case_adaptor_type_id__volatile = 0; + if (g_once_init_enter (&gee_test_case_adaptor_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { gee_test_case_value_adaptor_init, gee_test_case_value_adaptor_free_value, gee_test_case_value_adaptor_copy_value, gee_test_case_value_adaptor_peek_pointer, "p", gee_test_case_value_adaptor_collect_value, "p", gee_test_case_value_adaptor_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (GeeTestCaseAdaptorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_test_case_adaptor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTestCaseAdaptor), 0, (GInstanceInitFunc) gee_test_case_adaptor_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType gee_test_case_adaptor_type_id; + gee_test_case_adaptor_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeeTestCaseAdaptor", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&gee_test_case_adaptor_type_id__volatile, gee_test_case_adaptor_type_id); + } + return gee_test_case_adaptor_type_id__volatile; +} + + +static gpointer gee_test_case_adaptor_ref (gpointer instance) { + GeeTestCaseAdaptor* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +static void gee_test_case_adaptor_unref (gpointer instance) { + GeeTestCaseAdaptor* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + GEE_TEST_CASE_ADAPTOR_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + +static void gee_test_case_class_init (GeeTestCaseClass * klass) { + gee_test_case_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GeeTestCasePrivate)); + GEE_TEST_CASE_CLASS (klass)->set_up = gee_test_case_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = gee_test_case_real_tear_down; + G_OBJECT_CLASS (klass)->finalize = gee_test_case_finalize; +} + + +static void gee_test_case_instance_init (GeeTestCase * self) { + GeeTestCaseAdaptor** _tmp0_ = NULL; + self->priv = GEE_TEST_CASE_GET_PRIVATE (self); + _tmp0_ = g_new0 (GeeTestCaseAdaptor*, 0 + 1); + self->priv->adaptors = _tmp0_; + self->priv->adaptors_length1 = 0; + self->priv->_adaptors_size_ = self->priv->adaptors_length1; +} + + +static void gee_test_case_finalize (GObject* obj) { + GeeTestCase * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, GEE_TYPE_TEST_CASE, GeeTestCase); + self->priv->adaptors = (_vala_array_free (self->priv->adaptors, self->priv->adaptors_length1, (GDestroyNotify) gee_test_case_adaptor_unref), NULL); + G_OBJECT_CLASS (gee_test_case_parent_class)->finalize (obj); +} + + +GType gee_test_case_get_type (void) { + static volatile gsize gee_test_case_type_id__volatile = 0; + if (g_once_init_enter (&gee_test_case_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GeeTestCaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_test_case_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeTestCase), 0, (GInstanceInitFunc) gee_test_case_instance_init, NULL }; + GType gee_test_case_type_id; + gee_test_case_type_id = g_type_register_static (G_TYPE_OBJECT, "GeeTestCase", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&gee_test_case_type_id__volatile, gee_test_case_type_id); + } + return gee_test_case_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testcase.vala b/tests/testcase.vala new file mode 100644 index 0000000..edcbe04 --- /dev/null +++ b/tests/testcase.vala @@ -0,0 +1,80 @@ +/* testcase.vala + * + * Copyright (C) 2009 Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters <contact@julienpeeters.fr> + */ + +public abstract class Gee.TestCase : Object { + + private GLib.TestSuite suite; + private Adaptor[] adaptors = new Adaptor[0]; + + public delegate void TestMethod (); + + public TestCase (string name) { + this.suite = new GLib.TestSuite (name); + } + + public void add_test (string name, TestMethod test) { + var adaptor = new Adaptor (name, test, this); + this.adaptors += adaptor; + + this.suite.add (new GLib.TestCase (adaptor.name, + adaptor.set_up, + adaptor.run, + adaptor.tear_down )); + } + + public virtual void set_up () { + } + + public virtual void tear_down () { + } + + public GLib.TestSuite get_suite () { + return this.suite; + } + + private class Adaptor { + + public string name { get; private set; } + private TestMethod test; + private TestCase test_case; + + public Adaptor (string name, + TestMethod test, + TestCase test_case) { + this.name = name; + this.test = test; + this.test_case = test_case; + } + + public void set_up (void* fixture) { + this.test_case.set_up (); + } + + public void run (void* fixture) { + this.test (); + } + + public void tear_down (void* fixture) { + this.test_case.tear_down (); + } + } +} diff --git a/tests/testcollection.c b/tests/testcollection.c new file mode 100644 index 0000000..80c1a98 --- /dev/null +++ b/tests/testcollection.c @@ -0,0 +1,2455 @@ +/* testcollection.c generated by valac 0.18.0, the Vala compiler + * generated from testcollection.vala, do not modify */ + +/* testcollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer collection_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +enum { + COLLECTION_TESTS_DUMMY_PROPERTY +}; +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void collection_tests_test_type_correctness (CollectionTests* self); +static void _collection_tests_test_type_correctness_gee_test_case_test_method (gpointer self); +void collection_tests_test_iterator_returns_all_elements_once (CollectionTests* self); +static void _collection_tests_test_iterator_returns_all_elements_once_gee_test_case_test_method (gpointer self); +void collection_tests_test_mutable_iterator (CollectionTests* self); +static void _collection_tests_test_mutable_iterator_gee_test_case_test_method (gpointer self); +void collection_tests_test_contains_size_and_is_empty (CollectionTests* self); +static void _collection_tests_test_contains_size_and_is_empty_gee_test_case_test_method (gpointer self); +void collection_tests_test_add_remove (CollectionTests* self); +static void _collection_tests_test_add_remove_gee_test_case_test_method (gpointer self); +void collection_tests_test_clear (CollectionTests* self); +static void _collection_tests_test_clear_gee_test_case_test_method (gpointer self); +void collection_tests_test_add_all (CollectionTests* self); +static void _collection_tests_test_add_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_contains_all (CollectionTests* self); +static void _collection_tests_test_contains_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_remove_all (CollectionTests* self); +static void _collection_tests_test_remove_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_retain_all (CollectionTests* self); +static void _collection_tests_test_retain_all_gee_test_case_test_method (gpointer self); +void collection_tests_test_to_array (CollectionTests* self); +static void _collection_tests_test_to_array_gee_test_case_test_method (gpointer self); +void collection_tests_test_gobject_properties (CollectionTests* self); +static void _collection_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void collection_tests_finalize (GObject* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _collection_tests_test_type_correctness_gee_test_case_test_method (gpointer self) { + collection_tests_test_type_correctness (self); +} + + +static void _collection_tests_test_iterator_returns_all_elements_once_gee_test_case_test_method (gpointer self) { + collection_tests_test_iterator_returns_all_elements_once (self); +} + + +static void _collection_tests_test_mutable_iterator_gee_test_case_test_method (gpointer self) { + collection_tests_test_mutable_iterator (self); +} + + +static void _collection_tests_test_contains_size_and_is_empty_gee_test_case_test_method (gpointer self) { + collection_tests_test_contains_size_and_is_empty (self); +} + + +static void _collection_tests_test_add_remove_gee_test_case_test_method (gpointer self) { + collection_tests_test_add_remove (self); +} + + +static void _collection_tests_test_clear_gee_test_case_test_method (gpointer self) { + collection_tests_test_clear (self); +} + + +static void _collection_tests_test_add_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_add_all (self); +} + + +static void _collection_tests_test_contains_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_contains_all (self); +} + + +static void _collection_tests_test_remove_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_remove_all (self); +} + + +static void _collection_tests_test_retain_all_gee_test_case_test_method (gpointer self) { + collection_tests_test_retain_all (self); +} + + +static void _collection_tests_test_to_array_gee_test_case_test_method (gpointer self) { + collection_tests_test_to_array (self); +} + + +static void _collection_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + collection_tests_test_gobject_properties (self); +} + + +CollectionTests* collection_tests_construct (GType object_type, const gchar* name) { + CollectionTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (CollectionTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] type correctness", _collection_tests_test_type_correctness_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] iterator returns all elements once", _collection_tests_test_iterator_returns_all_elements_once_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] mutable iterator", _collection_tests_test_mutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] contains, size and is_empty", _collection_tests_test_contains_size_and_is_empty_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] add and remove", _collection_tests_test_add_remove_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] clear", _collection_tests_test_clear_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] add_all", _collection_tests_test_add_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] contains_all", _collection_tests_test_contains_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] remove_all", _collection_tests_test_remove_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] retain_all", _collection_tests_test_retain_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] to_array", _collection_tests_test_to_array_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] GObject properties", _collection_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +void collection_tests_test_type_correctness (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + GType _tmp2_; + GType _tmp3_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_iterable_get_element_type ((GeeIterable*) _tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == G_TYPE_STRING, "test_collection.element_type == typeof (string)"); +} + + +void collection_tests_test_iterator_returns_all_elements_once (CollectionTests* self) { + GeeCollection* _tmp0_; + gboolean has_next = FALSE; + GeeCollection* _tmp1_; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + GeeIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeIterator* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeIterator* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean one_found; + gboolean two_found; + gboolean three_found; + gboolean one_found_once; + gboolean two_found_once; + gboolean three_found_once; + GeeCollection* _tmp15_; + GeeIterator* _tmp16_ = NULL; + GeeIterator* _tmp31_; + gboolean _tmp32_ = FALSE; + gboolean _tmp33_; + gboolean _tmp34_; + GeeIterator* _tmp35_; + gboolean _tmp36_ = FALSE; + gboolean _tmp37_; + gboolean _tmp38_; + gboolean _tmp39_; + gboolean _tmp40_; + gboolean _tmp41_; + gboolean _tmp42_; + GeeIterator* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeIterator* _tmp59_; + gboolean _tmp60_ = FALSE; + gboolean _tmp61_; + gboolean _tmp62_; + GeeIterator* _tmp63_; + gboolean _tmp64_ = FALSE; + gboolean _tmp65_; + gboolean _tmp66_; + gboolean _tmp67_; + gboolean _tmp68_; + gboolean _tmp69_; + gboolean _tmp70_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_iterator_has_next (_tmp3_); + _vala_assert (!_tmp4_, "! iterator.has_next ()"); + _tmp5_ = iterator; + _tmp6_ = gee_iterator_next (_tmp5_); + _vala_assert (!_tmp6_, "! iterator.next ()"); + _tmp7_ = iterator; + _tmp8_ = gee_iterator_first (_tmp7_); + _vala_assert (!_tmp8_, "! iterator.first ()"); + _tmp9_ = self->test_collection; + _tmp10_ = gee_collection_add (_tmp9_, "one"); + _vala_assert (_tmp10_, "test_collection.add (\"one\")"); + _tmp11_ = self->test_collection; + _tmp12_ = gee_collection_add (_tmp11_, "two"); + _vala_assert (_tmp12_, "test_collection.add (\"two\")"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_add (_tmp13_, "three"); + _vala_assert (_tmp14_, "test_collection.add (\"three\")"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + _tmp15_ = self->test_collection; + _tmp16_ = gee_iterable_iterator ((GeeIterable*) _tmp15_); + _g_object_unref0 (iterator); + iterator = _tmp16_; + while (TRUE) { + GeeIterator* _tmp17_; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_; + GeeIterator* _tmp20_; + gboolean _tmp21_ = FALSE; + gboolean _tmp22_; + GeeIterator* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* element; + const gchar* _tmp25_; + _tmp17_ = iterator; + _tmp18_ = gee_iterator_has_next (_tmp17_); + has_next = _tmp18_; + _tmp19_ = has_next; + _tmp20_ = iterator; + _tmp21_ = gee_iterator_next (_tmp20_); + _vala_assert (_tmp19_ == _tmp21_, "has_next == iterator.next ()"); + _tmp22_ = has_next; + if (!_tmp22_) { + break; + } + _tmp23_ = iterator; + _tmp24_ = gee_iterator_get (_tmp23_); + element = (gchar*) _tmp24_; + _tmp25_ = element; + if (g_strcmp0 (_tmp25_, "one") == 0) { + gboolean _tmp26_; + _tmp26_ = one_found; + if (_tmp26_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp27_; + _tmp27_ = element; + if (g_strcmp0 (_tmp27_, "two") == 0) { + gboolean _tmp28_; + _tmp28_ = two_found; + if (_tmp28_) { + two_found_once = FALSE; + } + two_found = TRUE; + } else { + const gchar* _tmp29_; + _tmp29_ = element; + if (g_strcmp0 (_tmp29_, "three") == 0) { + gboolean _tmp30_; + _tmp30_ = three_found; + if (_tmp30_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _g_free0 (element); + } + _tmp31_ = iterator; + _tmp32_ = gee_iterator_has_next (_tmp31_); + has_next = _tmp32_; + _tmp33_ = has_next; + _vala_assert (!_tmp33_, "! has_next"); + _tmp34_ = has_next; + _tmp35_ = iterator; + _tmp36_ = gee_iterator_next (_tmp35_); + _vala_assert (_tmp34_ == _tmp36_, "has_next == iterator.next ()"); + _tmp37_ = one_found; + _vala_assert (_tmp37_, "one_found"); + _tmp38_ = one_found_once; + _vala_assert (_tmp38_, "one_found_once"); + _tmp39_ = two_found; + _vala_assert (_tmp39_, "two_found"); + _tmp40_ = two_found_once; + _vala_assert (_tmp40_, "two_found_once"); + _tmp41_ = three_found; + _vala_assert (_tmp41_, "three_found"); + _tmp42_ = three_found_once; + _vala_assert (_tmp42_, "three_found_once"); + _tmp43_ = iterator; + _tmp44_ = gee_iterator_first (_tmp43_); + _vala_assert (_tmp44_, "iterator.first ()"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + while (TRUE) { + GeeIterator* _tmp45_; + gpointer _tmp46_ = NULL; + gchar* element; + const gchar* _tmp47_; + GeeIterator* _tmp53_; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_; + GeeIterator* _tmp56_; + gboolean _tmp57_ = FALSE; + gboolean _tmp58_; + _tmp45_ = iterator; + _tmp46_ = gee_iterator_get (_tmp45_); + element = (gchar*) _tmp46_; + _tmp47_ = element; + if (g_strcmp0 (_tmp47_, "one") == 0) { + gboolean _tmp48_; + _tmp48_ = one_found; + if (_tmp48_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp49_; + _tmp49_ = element; + if (g_strcmp0 (_tmp49_, "two") == 0) { + gboolean _tmp50_; + _tmp50_ = two_found; + if (_tmp50_) { + two_found_once = FALSE; + } + two_found = TRUE; + } else { + const gchar* _tmp51_; + _tmp51_ = element; + if (g_strcmp0 (_tmp51_, "three") == 0) { + gboolean _tmp52_; + _tmp52_ = three_found; + if (_tmp52_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _tmp53_ = iterator; + _tmp54_ = gee_iterator_has_next (_tmp53_); + has_next = _tmp54_; + _tmp55_ = has_next; + _tmp56_ = iterator; + _tmp57_ = gee_iterator_next (_tmp56_); + _vala_assert (_tmp55_ == _tmp57_, "has_next == iterator.next ()"); + _tmp58_ = has_next; + if (!_tmp58_) { + _g_free0 (element); + break; + } + _g_free0 (element); + } + _tmp59_ = iterator; + _tmp60_ = gee_iterator_has_next (_tmp59_); + has_next = _tmp60_; + _tmp61_ = has_next; + _vala_assert (!_tmp61_, "! has_next"); + _tmp62_ = has_next; + _tmp63_ = iterator; + _tmp64_ = gee_iterator_next (_tmp63_); + _vala_assert (_tmp62_ == _tmp64_, "has_next == iterator.next ()"); + _tmp65_ = one_found; + _vala_assert (_tmp65_, "one_found"); + _tmp66_ = one_found_once; + _vala_assert (_tmp66_, "one_found_once"); + _tmp67_ = two_found; + _vala_assert (_tmp67_, "two_found"); + _tmp68_ = two_found_once; + _vala_assert (_tmp68_, "two_found_once"); + _tmp69_ = three_found; + _vala_assert (_tmp69_, "three_found"); + _tmp70_ = three_found_once; + _vala_assert (_tmp70_, "three_found_once"); + _g_object_unref0 (iterator); +} + + +void collection_tests_test_mutable_iterator (CollectionTests* self) { + GeeCollection* _tmp0_; + gboolean has_next = FALSE; + GeeCollection* _tmp1_; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + GeeCollection* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeCollection* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeCollection* _tmp7_; + gboolean _tmp8_ = FALSE; + gboolean one_found; + gboolean two_found; + gboolean three_found; + gboolean one_found_once; + gboolean two_found_once; + gboolean three_found_once; + GeeCollection* _tmp9_; + GeeIterator* _tmp10_ = NULL; + GeeIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + gboolean _tmp28_; + gboolean _tmp29_; + GeeIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + gboolean _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + gboolean _tmp37_; + GeeIterator* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeIterator* _tmp53_; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_; + gboolean _tmp56_; + GeeIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + gboolean _tmp59_; + gboolean _tmp60_; + gboolean _tmp61_; + gboolean _tmp62_; + gboolean _tmp63_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_); + iterator = _tmp2_; + _tmp3_ = self->test_collection; + _tmp4_ = gee_collection_add (_tmp3_, "one"); + _vala_assert (_tmp4_, "test_collection.add (\"one\")"); + _tmp5_ = self->test_collection; + _tmp6_ = gee_collection_add (_tmp5_, "two"); + _vala_assert (_tmp6_, "test_collection.add (\"two\")"); + _tmp7_ = self->test_collection; + _tmp8_ = gee_collection_add (_tmp7_, "three"); + _vala_assert (_tmp8_, "test_collection.add (\"three\")"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + _tmp9_ = self->test_collection; + _tmp10_ = gee_iterable_iterator ((GeeIterable*) _tmp9_); + _g_object_unref0 (iterator); + iterator = _tmp10_; + while (TRUE) { + GeeIterator* _tmp11_; + gboolean _tmp12_ = FALSE; + gboolean _tmp13_; + GeeIterator* _tmp14_; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_; + GeeIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* element; + const gchar* _tmp19_; + _tmp11_ = iterator; + _tmp12_ = gee_iterator_has_next (_tmp11_); + has_next = _tmp12_; + _tmp13_ = has_next; + _tmp14_ = iterator; + _tmp15_ = gee_iterator_next (_tmp14_); + _vala_assert (_tmp13_ == _tmp15_, "has_next == iterator.next ()"); + _tmp16_ = has_next; + if (!_tmp16_) { + break; + } + _tmp17_ = iterator; + _tmp18_ = gee_iterator_get (_tmp17_); + element = (gchar*) _tmp18_; + _tmp19_ = element; + if (g_strcmp0 (_tmp19_, "one") == 0) { + gboolean _tmp20_; + _tmp20_ = one_found; + if (_tmp20_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp21_; + _tmp21_ = element; + if (g_strcmp0 (_tmp21_, "two") == 0) { + gboolean _tmp22_; + GeeIterator* _tmp23_; + _tmp22_ = two_found; + if (_tmp22_) { + two_found_once = FALSE; + } + two_found = TRUE; + _tmp23_ = iterator; + gee_iterator_remove (_tmp23_); + } else { + const gchar* _tmp24_; + _tmp24_ = element; + if (g_strcmp0 (_tmp24_, "three") == 0) { + gboolean _tmp25_; + _tmp25_ = three_found; + if (_tmp25_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _g_free0 (element); + } + _tmp26_ = iterator; + _tmp27_ = gee_iterator_has_next (_tmp26_); + has_next = _tmp27_; + _tmp28_ = has_next; + _vala_assert (!_tmp28_, "! has_next"); + _tmp29_ = has_next; + _tmp30_ = iterator; + _tmp31_ = gee_iterator_next (_tmp30_); + _vala_assert (_tmp29_ == _tmp31_, "has_next == iterator.next ()"); + _tmp32_ = one_found; + _vala_assert (_tmp32_, "one_found"); + _tmp33_ = one_found_once; + _vala_assert (_tmp33_, "one_found_once"); + _tmp34_ = two_found; + _vala_assert (_tmp34_, "two_found"); + _tmp35_ = two_found_once; + _vala_assert (_tmp35_, "two_found_once"); + _tmp36_ = three_found; + _vala_assert (_tmp36_, "three_found"); + _tmp37_ = three_found_once; + _vala_assert (_tmp37_, "three_found_once"); + _tmp38_ = iterator; + _tmp39_ = gee_iterator_first (_tmp38_); + _vala_assert (_tmp39_, "iterator.first ()"); + one_found = FALSE; + two_found = FALSE; + three_found = FALSE; + one_found_once = TRUE; + two_found_once = TRUE; + three_found_once = TRUE; + while (TRUE) { + GeeIterator* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* element; + const gchar* _tmp42_; + GeeIterator* _tmp47_; + gboolean _tmp48_ = FALSE; + gboolean _tmp49_; + GeeIterator* _tmp50_; + gboolean _tmp51_ = FALSE; + gboolean _tmp52_; + _tmp40_ = iterator; + _tmp41_ = gee_iterator_get (_tmp40_); + element = (gchar*) _tmp41_; + _tmp42_ = element; + if (g_strcmp0 (_tmp42_, "one") == 0) { + gboolean _tmp43_; + _tmp43_ = one_found; + if (_tmp43_) { + one_found_once = FALSE; + } + one_found = TRUE; + } else { + const gchar* _tmp44_; + _tmp44_ = element; + if (g_strcmp0 (_tmp44_, "two") == 0) { + two_found = TRUE; + } else { + const gchar* _tmp45_; + _tmp45_ = element; + if (g_strcmp0 (_tmp45_, "three") == 0) { + gboolean _tmp46_; + _tmp46_ = three_found; + if (_tmp46_) { + three_found_once = FALSE; + } + three_found = TRUE; + } + } + } + _tmp47_ = iterator; + _tmp48_ = gee_iterator_has_next (_tmp47_); + has_next = _tmp48_; + _tmp49_ = has_next; + _tmp50_ = iterator; + _tmp51_ = gee_iterator_next (_tmp50_); + _vala_assert (_tmp49_ == _tmp51_, "has_next == iterator.next ()"); + _tmp52_ = has_next; + if (!_tmp52_) { + _g_free0 (element); + break; + } + _g_free0 (element); + } + _tmp53_ = iterator; + _tmp54_ = gee_iterator_has_next (_tmp53_); + has_next = _tmp54_; + _tmp55_ = has_next; + _vala_assert (!_tmp55_, "! has_next"); + _tmp56_ = has_next; + _tmp57_ = iterator; + _tmp58_ = gee_iterator_next (_tmp57_); + _vala_assert (_tmp56_ == _tmp58_, "has_next == iterator.next ()"); + _tmp59_ = one_found; + _vala_assert (_tmp59_, "one_found"); + _tmp60_ = one_found_once; + _vala_assert (_tmp60_, "one_found_once"); + _tmp61_ = two_found; + _vala_assert (!_tmp61_, "!two_found"); + _tmp62_ = three_found; + _vala_assert (_tmp62_, "three_found"); + _tmp63_ = three_found_once; + _vala_assert (_tmp63_, "three_found_once"); + _g_object_unref0 (iterator); +} + + +void collection_tests_test_contains_size_and_is_empty (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeCollection* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeCollection* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeCollection* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeCollection* _tmp10_; + gboolean _tmp11_; + gboolean _tmp12_; + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeCollection* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeCollection* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeCollection* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeCollection* _tmp21_; + gint _tmp22_; + gint _tmp23_; + GeeCollection* _tmp24_; + gboolean _tmp25_; + gboolean _tmp26_; + GeeCollection* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeCollection* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeCollection* _tmp31_; + gboolean _tmp32_ = FALSE; + GeeCollection* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeCollection* _tmp35_; + gint _tmp36_; + gint _tmp37_; + GeeCollection* _tmp38_; + gboolean _tmp39_; + gboolean _tmp40_; + GeeCollection* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeCollection* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeCollection* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeCollection* _tmp47_; + gboolean _tmp48_ = FALSE; + GeeCollection* _tmp49_; + gint _tmp50_; + gint _tmp51_; + GeeCollection* _tmp52_; + gboolean _tmp53_; + gboolean _tmp54_; + GeeCollection* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeCollection* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeCollection* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeCollection* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeCollection* _tmp63_; + gint _tmp64_; + gint _tmp65_; + GeeCollection* _tmp66_; + gboolean _tmp67_; + gboolean _tmp68_; + GeeCollection* _tmp69_; + gboolean _tmp70_ = FALSE; + GeeCollection* _tmp71_; + gboolean _tmp72_ = FALSE; + GeeCollection* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeCollection* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeCollection* _tmp77_; + gint _tmp78_; + gint _tmp79_; + GeeCollection* _tmp80_; + gboolean _tmp81_; + gboolean _tmp82_; + GeeCollection* _tmp83_; + gboolean _tmp84_ = FALSE; + GeeCollection* _tmp85_; + gboolean _tmp86_ = FALSE; + GeeCollection* _tmp87_; + gboolean _tmp88_ = FALSE; + GeeCollection* _tmp89_; + gboolean _tmp90_ = FALSE; + GeeCollection* _tmp91_; + gint _tmp92_; + gint _tmp93_; + GeeCollection* _tmp94_; + gboolean _tmp95_; + gboolean _tmp96_; + GeeCollection* _tmp97_; + gboolean _tmp98_ = FALSE; + GeeCollection* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeCollection* _tmp101_; + gboolean _tmp102_ = FALSE; + GeeCollection* _tmp103_; + gboolean _tmp104_ = FALSE; + GeeCollection* _tmp105_; + gint _tmp106_; + gint _tmp107_; + GeeCollection* _tmp108_; + gboolean _tmp109_; + gboolean _tmp110_; + GeeCollection* _tmp111_; + GeeCollection* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeCollection* _tmp114_; + gboolean _tmp115_ = FALSE; + GeeCollection* _tmp116_; + gboolean _tmp117_ = FALSE; + GeeCollection* _tmp118_; + gint _tmp119_; + gint _tmp120_; + GeeCollection* _tmp121_; + gboolean _tmp122_; + gboolean _tmp123_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_collection_contains (_tmp1_, "one"); + _vala_assert (!_tmp2_, "! test_collection.contains (\"one\")"); + _tmp3_ = self->test_collection; + _tmp4_ = gee_collection_contains (_tmp3_, "two"); + _vala_assert (!_tmp4_, "! test_collection.contains (\"two\")"); + _tmp5_ = self->test_collection; + _tmp6_ = gee_collection_contains (_tmp5_, "three"); + _vala_assert (!_tmp6_, "! test_collection.contains (\"three\")"); + _tmp7_ = self->test_collection; + _tmp8_ = gee_collection_get_size (_tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 0, "test_collection.size == 0"); + _tmp10_ = self->test_collection; + _tmp11_ = gee_collection_get_is_empty (_tmp10_); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_, "test_collection.is_empty"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_add (_tmp13_, "one"); + _vala_assert (_tmp14_, "test_collection.add (\"one\")"); + _tmp15_ = self->test_collection; + _tmp16_ = gee_collection_contains (_tmp15_, "one"); + _vala_assert (_tmp16_, "test_collection.contains (\"one\")"); + _tmp17_ = self->test_collection; + _tmp18_ = gee_collection_contains (_tmp17_, "two"); + _vala_assert (!_tmp18_, "! test_collection.contains (\"two\")"); + _tmp19_ = self->test_collection; + _tmp20_ = gee_collection_contains (_tmp19_, "three"); + _vala_assert (!_tmp20_, "! test_collection.contains (\"three\")"); + _tmp21_ = self->test_collection; + _tmp22_ = gee_collection_get_size (_tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 1, "test_collection.size == 1"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_get_is_empty (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (!_tmp26_, "! test_collection.is_empty"); + _tmp27_ = self->test_collection; + _tmp28_ = gee_collection_remove (_tmp27_, "one"); + _vala_assert (_tmp28_, "test_collection.remove (\"one\")"); + _tmp29_ = self->test_collection; + _tmp30_ = gee_collection_contains (_tmp29_, "one"); + _vala_assert (!_tmp30_, "! test_collection.contains (\"one\")"); + _tmp31_ = self->test_collection; + _tmp32_ = gee_collection_contains (_tmp31_, "two"); + _vala_assert (!_tmp32_, "! test_collection.contains (\"two\")"); + _tmp33_ = self->test_collection; + _tmp34_ = gee_collection_contains (_tmp33_, "three"); + _vala_assert (!_tmp34_, "! test_collection.contains (\"three\")"); + _tmp35_ = self->test_collection; + _tmp36_ = gee_collection_get_size (_tmp35_); + _tmp37_ = _tmp36_; + _vala_assert (_tmp37_ == 0, "test_collection.size == 0"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_get_is_empty (_tmp38_); + _tmp40_ = _tmp39_; + _vala_assert (_tmp40_, "test_collection.is_empty"); + _tmp41_ = self->test_collection; + _tmp42_ = gee_collection_add (_tmp41_, "one"); + _vala_assert (_tmp42_, "test_collection.add (\"one\")"); + _tmp43_ = self->test_collection; + _tmp44_ = gee_collection_contains (_tmp43_, "one"); + _vala_assert (_tmp44_, "test_collection.contains (\"one\")"); + _tmp45_ = self->test_collection; + _tmp46_ = gee_collection_contains (_tmp45_, "two"); + _vala_assert (!_tmp46_, "! test_collection.contains (\"two\")"); + _tmp47_ = self->test_collection; + _tmp48_ = gee_collection_contains (_tmp47_, "three"); + _vala_assert (!_tmp48_, "! test_collection.contains (\"three\")"); + _tmp49_ = self->test_collection; + _tmp50_ = gee_collection_get_size (_tmp49_); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 1, "test_collection.size == 1"); + _tmp52_ = self->test_collection; + _tmp53_ = gee_collection_get_is_empty (_tmp52_); + _tmp54_ = _tmp53_; + _vala_assert (!_tmp54_, "! test_collection.is_empty"); + _tmp55_ = self->test_collection; + _tmp56_ = gee_collection_add (_tmp55_, "two"); + _vala_assert (_tmp56_, "test_collection.add (\"two\")"); + _tmp57_ = self->test_collection; + _tmp58_ = gee_collection_contains (_tmp57_, "one"); + _vala_assert (_tmp58_, "test_collection.contains (\"one\")"); + _tmp59_ = self->test_collection; + _tmp60_ = gee_collection_contains (_tmp59_, "two"); + _vala_assert (_tmp60_, "test_collection.contains (\"two\")"); + _tmp61_ = self->test_collection; + _tmp62_ = gee_collection_contains (_tmp61_, "three"); + _vala_assert (!_tmp62_, "! test_collection.contains (\"three\")"); + _tmp63_ = self->test_collection; + _tmp64_ = gee_collection_get_size (_tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_ == 2, "test_collection.size == 2"); + _tmp66_ = self->test_collection; + _tmp67_ = gee_collection_get_is_empty (_tmp66_); + _tmp68_ = _tmp67_; + _vala_assert (!_tmp68_, "! test_collection.is_empty"); + _tmp69_ = self->test_collection; + _tmp70_ = gee_collection_add (_tmp69_, "three"); + _vala_assert (_tmp70_, "test_collection.add (\"three\")"); + _tmp71_ = self->test_collection; + _tmp72_ = gee_collection_contains (_tmp71_, "one"); + _vala_assert (_tmp72_, "test_collection.contains (\"one\")"); + _tmp73_ = self->test_collection; + _tmp74_ = gee_collection_contains (_tmp73_, "two"); + _vala_assert (_tmp74_, "test_collection.contains (\"two\")"); + _tmp75_ = self->test_collection; + _tmp76_ = gee_collection_contains (_tmp75_, "three"); + _vala_assert (_tmp76_, "test_collection.contains (\"three\")"); + _tmp77_ = self->test_collection; + _tmp78_ = gee_collection_get_size (_tmp77_); + _tmp79_ = _tmp78_; + _vala_assert (_tmp79_ == 3, "test_collection.size == 3"); + _tmp80_ = self->test_collection; + _tmp81_ = gee_collection_get_is_empty (_tmp80_); + _tmp82_ = _tmp81_; + _vala_assert (!_tmp82_, "! test_collection.is_empty"); + _tmp83_ = self->test_collection; + _tmp84_ = gee_collection_remove (_tmp83_, "two"); + _vala_assert (_tmp84_, "test_collection.remove (\"two\")"); + _tmp85_ = self->test_collection; + _tmp86_ = gee_collection_contains (_tmp85_, "one"); + _vala_assert (_tmp86_, "test_collection.contains (\"one\")"); + _tmp87_ = self->test_collection; + _tmp88_ = gee_collection_contains (_tmp87_, "two"); + _vala_assert (!_tmp88_, "! test_collection.contains (\"two\")"); + _tmp89_ = self->test_collection; + _tmp90_ = gee_collection_contains (_tmp89_, "three"); + _vala_assert (_tmp90_, "test_collection.contains (\"three\")"); + _tmp91_ = self->test_collection; + _tmp92_ = gee_collection_get_size (_tmp91_); + _tmp93_ = _tmp92_; + _vala_assert (_tmp93_ == 2, "test_collection.size == 2"); + _tmp94_ = self->test_collection; + _tmp95_ = gee_collection_get_is_empty (_tmp94_); + _tmp96_ = _tmp95_; + _vala_assert (!_tmp96_, "! test_collection.is_empty"); + _tmp97_ = self->test_collection; + _tmp98_ = gee_collection_remove (_tmp97_, "two"); + _vala_assert (!_tmp98_, "! test_collection.remove (\"two\")"); + _tmp99_ = self->test_collection; + _tmp100_ = gee_collection_contains (_tmp99_, "one"); + _vala_assert (_tmp100_, "test_collection.contains (\"one\")"); + _tmp101_ = self->test_collection; + _tmp102_ = gee_collection_contains (_tmp101_, "two"); + _vala_assert (!_tmp102_, "! test_collection.contains (\"two\")"); + _tmp103_ = self->test_collection; + _tmp104_ = gee_collection_contains (_tmp103_, "three"); + _vala_assert (_tmp104_, "test_collection.contains (\"three\")"); + _tmp105_ = self->test_collection; + _tmp106_ = gee_collection_get_size (_tmp105_); + _tmp107_ = _tmp106_; + _vala_assert (_tmp107_ == 2, "test_collection.size == 2"); + _tmp108_ = self->test_collection; + _tmp109_ = gee_collection_get_is_empty (_tmp108_); + _tmp110_ = _tmp109_; + _vala_assert (!_tmp110_, "! test_collection.is_empty"); + _tmp111_ = self->test_collection; + gee_collection_clear (_tmp111_); + _tmp112_ = self->test_collection; + _tmp113_ = gee_collection_contains (_tmp112_, "one"); + _vala_assert (!_tmp113_, "! test_collection.contains (\"one\")"); + _tmp114_ = self->test_collection; + _tmp115_ = gee_collection_contains (_tmp114_, "two"); + _vala_assert (!_tmp115_, "! test_collection.contains (\"two\")"); + _tmp116_ = self->test_collection; + _tmp117_ = gee_collection_contains (_tmp116_, "three"); + _vala_assert (!_tmp117_, "! test_collection.contains (\"three\")"); + _tmp118_ = self->test_collection; + _tmp119_ = gee_collection_get_size (_tmp118_); + _tmp120_ = _tmp119_; + _vala_assert (_tmp120_ == 0, "test_collection.size == 0"); + _tmp121_ = self->test_collection; + _tmp122_ = gee_collection_get_is_empty (_tmp121_); + _tmp123_ = _tmp122_; + _vala_assert (_tmp123_, "test_collection.is_empty"); +} + + +void collection_tests_test_add_remove (CollectionTests* self) { + GeeCollection* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar* _tmp27_; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar* _tmp31_; + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar* _tmp35_; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar* _tmp39_; + gchar** _tmp40_ = NULL; + gchar** to_add; + gint to_add_length1; + gint _to_add_size_; + gint expected_size; + gchar** _tmp41_; + gint _tmp41__length1; + GeeCollection* _tmp56_; + gint _tmp57_; + gint _tmp58_; + gchar** _tmp59_; + gint _tmp59__length1; + gchar** _tmp60_; + gint _tmp60__length1; + gchar** _tmp65_; + gint _tmp65__length1; + GeeCollection* _tmp80_; + gint _tmp81_; + gint _tmp82_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = g_strdup ("one"); + _tmp2_ = g_strdup ("two"); + _tmp3_ = g_strdup ("three"); + _tmp4_ = g_strdup ("four"); + _tmp5_ = g_strdup ("five"); + _tmp6_ = g_strdup ("six"); + _tmp7_ = g_strdup ("seven"); + _tmp8_ = g_strdup ("eight"); + _tmp9_ = g_strdup ("nine"); + _tmp10_ = g_strdup ("ten"); + _tmp11_ = g_strdup ("eleven"); + _tmp12_ = g_strdup ("twelve"); + _tmp13_ = g_strdup ("thirteen"); + _tmp14_ = g_strdup ("fourteen"); + _tmp15_ = g_strdup ("fifteen"); + _tmp16_ = g_strdup ("sixteen"); + _tmp17_ = g_strdup ("seventeen"); + _tmp18_ = g_strdup ("eighteen"); + _tmp19_ = g_strdup ("nineteen"); + _tmp20_ = g_strdup ("twenty"); + _tmp21_ = g_strdup ("twenty one"); + _tmp22_ = g_strdup ("twenty two"); + _tmp23_ = g_strdup ("twenty three"); + _tmp24_ = g_strdup ("twenty four"); + _tmp25_ = g_strdup ("twenty five"); + _tmp26_ = g_strdup ("twenty six"); + _tmp27_ = g_strdup ("twenty seven"); + _tmp28_ = g_strdup ("twenty eight"); + _tmp29_ = g_strdup ("twenty nine"); + _tmp30_ = g_strdup ("thirty"); + _tmp31_ = g_strdup ("thirty one"); + _tmp32_ = g_strdup ("thirty two"); + _tmp33_ = g_strdup ("thirty four"); + _tmp34_ = g_strdup ("thirty five"); + _tmp35_ = g_strdup ("thirty six"); + _tmp36_ = g_strdup ("thirty seven"); + _tmp37_ = g_strdup ("thirty eight"); + _tmp38_ = g_strdup ("thirty nine"); + _tmp39_ = g_strdup ("fourty"); + _tmp40_ = g_new0 (gchar*, 39 + 1); + _tmp40_[0] = _tmp1_; + _tmp40_[1] = _tmp2_; + _tmp40_[2] = _tmp3_; + _tmp40_[3] = _tmp4_; + _tmp40_[4] = _tmp5_; + _tmp40_[5] = _tmp6_; + _tmp40_[6] = _tmp7_; + _tmp40_[7] = _tmp8_; + _tmp40_[8] = _tmp9_; + _tmp40_[9] = _tmp10_; + _tmp40_[10] = _tmp11_; + _tmp40_[11] = _tmp12_; + _tmp40_[12] = _tmp13_; + _tmp40_[13] = _tmp14_; + _tmp40_[14] = _tmp15_; + _tmp40_[15] = _tmp16_; + _tmp40_[16] = _tmp17_; + _tmp40_[17] = _tmp18_; + _tmp40_[18] = _tmp19_; + _tmp40_[19] = _tmp20_; + _tmp40_[20] = _tmp21_; + _tmp40_[21] = _tmp22_; + _tmp40_[22] = _tmp23_; + _tmp40_[23] = _tmp24_; + _tmp40_[24] = _tmp25_; + _tmp40_[25] = _tmp26_; + _tmp40_[26] = _tmp27_; + _tmp40_[27] = _tmp28_; + _tmp40_[28] = _tmp29_; + _tmp40_[29] = _tmp30_; + _tmp40_[30] = _tmp31_; + _tmp40_[31] = _tmp32_; + _tmp40_[32] = _tmp33_; + _tmp40_[33] = _tmp34_; + _tmp40_[34] = _tmp35_; + _tmp40_[35] = _tmp36_; + _tmp40_[36] = _tmp37_; + _tmp40_[37] = _tmp38_; + _tmp40_[38] = _tmp39_; + to_add = _tmp40_; + to_add_length1 = 39; + _to_add_size_ = to_add_length1; + expected_size = 0; + _tmp41_ = to_add; + _tmp41__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp41_; + a_collection_length1 = _tmp41__length1; + for (a_it = 0; a_it < _tmp41__length1; a_it = a_it + 1) { + gchar* _tmp42_; + gchar* a = NULL; + _tmp42_ = g_strdup (a_collection[a_it]); + a = _tmp42_; + { + GeeCollection* _tmp43_; + const gchar* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeCollection* _tmp46_; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_; + GeeCollection* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + _tmp43_ = self->test_collection; + _tmp44_ = a; + _tmp45_ = gee_collection_contains (_tmp43_, _tmp44_); + _vala_assert (!_tmp45_, "!test_collection.contains (a)"); + _tmp46_ = self->test_collection; + _tmp47_ = gee_collection_get_size (_tmp46_); + _tmp48_ = _tmp47_; + _tmp49_ = expected_size; + expected_size = _tmp49_ + 1; + _vala_assert (_tmp48_ == _tmp49_, "test_collection.size == expected_size++"); + _tmp50_ = self->test_collection; + _tmp51_ = a; + _tmp52_ = gee_collection_add (_tmp50_, _tmp51_); + _vala_assert (_tmp52_, "test_collection.add (a)"); + _tmp53_ = self->test_collection; + _tmp54_ = a; + _tmp55_ = gee_collection_contains (_tmp53_, _tmp54_); + _vala_assert (_tmp55_, "test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp56_ = self->test_collection; + _tmp57_ = gee_collection_get_size (_tmp56_); + _tmp58_ = _tmp57_; + _tmp59_ = to_add; + _tmp59__length1 = to_add_length1; + _vala_assert (_tmp58_ == _tmp59__length1, "test_collection.size == to_add.length"); + _tmp60_ = to_add; + _tmp60__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp60_; + a_collection_length1 = _tmp60__length1; + for (a_it = 0; a_it < _tmp60__length1; a_it = a_it + 1) { + gchar* _tmp61_; + gchar* a = NULL; + _tmp61_ = g_strdup (a_collection[a_it]); + a = _tmp61_; + { + GeeCollection* _tmp62_; + const gchar* _tmp63_; + gboolean _tmp64_ = FALSE; + _tmp62_ = self->test_collection; + _tmp63_ = a; + _tmp64_ = gee_collection_contains (_tmp62_, _tmp63_); + _vala_assert (_tmp64_, "test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp65_ = to_add; + _tmp65__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp65_; + a_collection_length1 = _tmp65__length1; + for (a_it = 0; a_it < _tmp65__length1; a_it = a_it + 1) { + gchar* _tmp66_; + gchar* a = NULL; + _tmp66_ = g_strdup (a_collection[a_it]); + a = _tmp66_; + { + GeeCollection* _tmp67_; + const gchar* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeCollection* _tmp70_; + gint _tmp71_; + gint _tmp72_; + gint _tmp73_; + GeeCollection* _tmp74_; + const gchar* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeCollection* _tmp77_; + const gchar* _tmp78_; + gboolean _tmp79_ = FALSE; + _tmp67_ = self->test_collection; + _tmp68_ = a; + _tmp69_ = gee_collection_contains (_tmp67_, _tmp68_); + _vala_assert (_tmp69_, "test_collection.contains (a)"); + _tmp70_ = self->test_collection; + _tmp71_ = gee_collection_get_size (_tmp70_); + _tmp72_ = _tmp71_; + _tmp73_ = expected_size; + expected_size = _tmp73_ - 1; + _vala_assert (_tmp72_ == _tmp73_, "test_collection.size == expected_size--"); + _tmp74_ = self->test_collection; + _tmp75_ = a; + _tmp76_ = gee_collection_remove (_tmp74_, _tmp75_); + _vala_assert (_tmp76_, "test_collection.remove (a)"); + _tmp77_ = self->test_collection; + _tmp78_ = a; + _tmp79_ = gee_collection_contains (_tmp77_, _tmp78_); + _vala_assert (!_tmp79_, "!test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp80_ = self->test_collection; + _tmp81_ = gee_collection_get_size (_tmp80_); + _tmp82_ = _tmp81_; + _vala_assert (_tmp82_ == 0, "test_collection.size == 0"); + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); +} + + +void collection_tests_test_clear (CollectionTests* self) { + GeeCollection* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar* _tmp27_; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar* _tmp31_; + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar* _tmp35_; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar* _tmp39_; + gchar** _tmp40_ = NULL; + gchar** to_add; + gint to_add_length1; + gint _to_add_size_; + gint expected_size; + gchar** _tmp41_; + gint _tmp41__length1; + GeeCollection* _tmp56_; + gint _tmp57_; + gint _tmp58_; + gchar** _tmp59_; + gint _tmp59__length1; + GeeCollection* _tmp60_; + GeeCollection* _tmp61_; + gint _tmp62_; + gint _tmp63_; + GeeCollection* _tmp64_; + GeeIterator* _tmp65_ = NULL; + GeeIterator* iter; + gboolean _tmp66_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = g_strdup ("one"); + _tmp2_ = g_strdup ("two"); + _tmp3_ = g_strdup ("three"); + _tmp4_ = g_strdup ("four"); + _tmp5_ = g_strdup ("five"); + _tmp6_ = g_strdup ("six"); + _tmp7_ = g_strdup ("seven"); + _tmp8_ = g_strdup ("eight"); + _tmp9_ = g_strdup ("nine"); + _tmp10_ = g_strdup ("ten"); + _tmp11_ = g_strdup ("eleven"); + _tmp12_ = g_strdup ("twelve"); + _tmp13_ = g_strdup ("thirteen"); + _tmp14_ = g_strdup ("fourteen"); + _tmp15_ = g_strdup ("fifteen"); + _tmp16_ = g_strdup ("sixteen"); + _tmp17_ = g_strdup ("seventeen"); + _tmp18_ = g_strdup ("eighteen"); + _tmp19_ = g_strdup ("nineteen"); + _tmp20_ = g_strdup ("twenty"); + _tmp21_ = g_strdup ("twenty one"); + _tmp22_ = g_strdup ("twenty two"); + _tmp23_ = g_strdup ("twenty three"); + _tmp24_ = g_strdup ("twenty four"); + _tmp25_ = g_strdup ("twenty five"); + _tmp26_ = g_strdup ("twenty six"); + _tmp27_ = g_strdup ("twenty seven"); + _tmp28_ = g_strdup ("twenty eight"); + _tmp29_ = g_strdup ("twenty nine"); + _tmp30_ = g_strdup ("thirty"); + _tmp31_ = g_strdup ("thirty one"); + _tmp32_ = g_strdup ("thirty two"); + _tmp33_ = g_strdup ("thirty four"); + _tmp34_ = g_strdup ("thirty five"); + _tmp35_ = g_strdup ("thirty six"); + _tmp36_ = g_strdup ("thirty seven"); + _tmp37_ = g_strdup ("thirty eight"); + _tmp38_ = g_strdup ("thirty nine"); + _tmp39_ = g_strdup ("fourty"); + _tmp40_ = g_new0 (gchar*, 39 + 1); + _tmp40_[0] = _tmp1_; + _tmp40_[1] = _tmp2_; + _tmp40_[2] = _tmp3_; + _tmp40_[3] = _tmp4_; + _tmp40_[4] = _tmp5_; + _tmp40_[5] = _tmp6_; + _tmp40_[6] = _tmp7_; + _tmp40_[7] = _tmp8_; + _tmp40_[8] = _tmp9_; + _tmp40_[9] = _tmp10_; + _tmp40_[10] = _tmp11_; + _tmp40_[11] = _tmp12_; + _tmp40_[12] = _tmp13_; + _tmp40_[13] = _tmp14_; + _tmp40_[14] = _tmp15_; + _tmp40_[15] = _tmp16_; + _tmp40_[16] = _tmp17_; + _tmp40_[17] = _tmp18_; + _tmp40_[18] = _tmp19_; + _tmp40_[19] = _tmp20_; + _tmp40_[20] = _tmp21_; + _tmp40_[21] = _tmp22_; + _tmp40_[22] = _tmp23_; + _tmp40_[23] = _tmp24_; + _tmp40_[24] = _tmp25_; + _tmp40_[25] = _tmp26_; + _tmp40_[26] = _tmp27_; + _tmp40_[27] = _tmp28_; + _tmp40_[28] = _tmp29_; + _tmp40_[29] = _tmp30_; + _tmp40_[30] = _tmp31_; + _tmp40_[31] = _tmp32_; + _tmp40_[32] = _tmp33_; + _tmp40_[33] = _tmp34_; + _tmp40_[34] = _tmp35_; + _tmp40_[35] = _tmp36_; + _tmp40_[36] = _tmp37_; + _tmp40_[37] = _tmp38_; + _tmp40_[38] = _tmp39_; + to_add = _tmp40_; + to_add_length1 = 39; + _to_add_size_ = to_add_length1; + expected_size = 0; + _tmp41_ = to_add; + _tmp41__length1 = to_add_length1; + { + gchar** a_collection = NULL; + gint a_collection_length1 = 0; + gint _a_collection_size_ = 0; + gint a_it = 0; + a_collection = _tmp41_; + a_collection_length1 = _tmp41__length1; + for (a_it = 0; a_it < _tmp41__length1; a_it = a_it + 1) { + gchar* _tmp42_; + gchar* a = NULL; + _tmp42_ = g_strdup (a_collection[a_it]); + a = _tmp42_; + { + GeeCollection* _tmp43_; + const gchar* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeCollection* _tmp46_; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_; + GeeCollection* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + _tmp43_ = self->test_collection; + _tmp44_ = a; + _tmp45_ = gee_collection_contains (_tmp43_, _tmp44_); + _vala_assert (!_tmp45_, "!test_collection.contains (a)"); + _tmp46_ = self->test_collection; + _tmp47_ = gee_collection_get_size (_tmp46_); + _tmp48_ = _tmp47_; + _tmp49_ = expected_size; + expected_size = _tmp49_ + 1; + _vala_assert (_tmp48_ == _tmp49_, "test_collection.size == expected_size++"); + _tmp50_ = self->test_collection; + _tmp51_ = a; + _tmp52_ = gee_collection_add (_tmp50_, _tmp51_); + _vala_assert (_tmp52_, "test_collection.add (a)"); + _tmp53_ = self->test_collection; + _tmp54_ = a; + _tmp55_ = gee_collection_contains (_tmp53_, _tmp54_); + _vala_assert (_tmp55_, "test_collection.contains (a)"); + _g_free0 (a); + } + } + } + _tmp56_ = self->test_collection; + _tmp57_ = gee_collection_get_size (_tmp56_); + _tmp58_ = _tmp57_; + _tmp59_ = to_add; + _tmp59__length1 = to_add_length1; + _vala_assert (_tmp58_ == _tmp59__length1, "test_collection.size == to_add.length"); + _tmp60_ = self->test_collection; + gee_collection_clear (_tmp60_); + _tmp61_ = self->test_collection; + _tmp62_ = gee_collection_get_size (_tmp61_); + _tmp63_ = _tmp62_; + _vala_assert (_tmp63_ == 0, "test_collection.size == 0"); + _tmp64_ = self->test_collection; + _tmp65_ = gee_iterable_iterator ((GeeIterable*) _tmp64_); + iter = _tmp65_; + _vala_assert (iter != NULL, "iter != null"); + _tmp66_ = gee_iterator_has_next (iter); + _vala_assert (!_tmp66_, "!iter.has_next ()"); + _g_object_unref0 (iter); + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); +} + + +void collection_tests_test_add_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeCollection* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + gboolean _tmp21_ = FALSE; + GeeCollection* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gint _tmp25_; + gint _tmp26_; + GeeCollection* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeCollection* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeCollection* _tmp31_; + gboolean _tmp32_ = FALSE; + gint _tmp33_; + gint _tmp34_; + gboolean _tmp35_ = FALSE; + gboolean _tmp36_ = FALSE; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + gboolean _tmp40_ = FALSE; + gboolean _tmp41_ = FALSE; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeCollection* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeCollection* _tmp46_; + gint _tmp47_; + gint _tmp48_; + GeeCollection* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeCollection* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + gboolean _tmp54_ = FALSE; + GeeCollection* _tmp55_; + gboolean _tmp56_ = FALSE; + gint _tmp57_; + gint _tmp58_; + gboolean _tmp59_ = FALSE; + gboolean _tmp60_ = FALSE; + gboolean _tmp61_ = FALSE; + GeeCollection* _tmp62_; + gboolean _tmp63_ = FALSE; + gboolean _tmp64_ = FALSE; + gboolean _tmp65_ = FALSE; + GeeCollection* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeCollection* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeCollection* _tmp70_; + gint _tmp71_; + gint _tmp72_; + GeeCollection* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeCollection* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeCollection* _tmp77_; + gboolean _tmp78_ = FALSE; + gint _tmp79_; + gint _tmp80_; + gboolean _tmp81_ = FALSE; + gboolean _tmp82_ = FALSE; + gboolean _tmp83_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_add_all (_tmp2_, (GeeCollection*) dummy); + _vala_assert (!_tmp3_, "! test_collection.add_all (dummy)"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_collection.is_empty"); + _tmp7_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "dummy.is_empty"); + _tmp9_ = self->test_collection; + _tmp10_ = gee_collection_add (_tmp9_, "hello"); + _vala_assert (_tmp10_, "test_collection.add (\"hello\")"); + _tmp11_ = self->test_collection; + _tmp12_ = gee_collection_add_all (_tmp11_, (GeeCollection*) dummy); + _vala_assert (!_tmp12_, "! test_collection.add_all (dummy)"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_get_size (_tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "test_collection.size == 1"); + _tmp16_ = self->test_collection; + _tmp17_ = gee_collection_contains (_tmp16_, "hello"); + _vala_assert (_tmp17_, "test_collection.contains (\"hello\")"); + _tmp18_ = self->test_collection; + gee_collection_clear (_tmp18_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp19_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp19_, "dummy.add (\"hello1\")"); + _tmp20_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp20_, "dummy.add (\"hello2\")"); + _tmp21_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp21_, "dummy.add (\"hello3\")"); + _tmp22_ = self->test_collection; + _tmp23_ = gee_collection_add_all (_tmp22_, (GeeCollection*) dummy); + _vala_assert (_tmp23_, "test_collection.add_all (dummy)"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_get_size (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 3, "test_collection.size == 3"); + _tmp27_ = self->test_collection; + _tmp28_ = gee_collection_contains (_tmp27_, "hello1"); + _vala_assert (_tmp28_, "test_collection.contains (\"hello1\")"); + _tmp29_ = self->test_collection; + _tmp30_ = gee_collection_contains (_tmp29_, "hello2"); + _vala_assert (_tmp30_, "test_collection.contains (\"hello2\")"); + _tmp31_ = self->test_collection; + _tmp32_ = gee_collection_contains (_tmp31_, "hello3"); + _vala_assert (_tmp32_, "test_collection.contains (\"hello3\")"); + _tmp33_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 3, "dummy.size == 3"); + _tmp35_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp35_, "dummy.contains (\"hello1\")"); + _tmp36_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp36_, "dummy.contains (\"hello2\")"); + _tmp37_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp37_, "dummy.contains (\"hello3\")"); + _tmp38_ = self->test_collection; + gee_collection_clear (_tmp38_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp39_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp39_, "dummy.add (\"hello1\")"); + _tmp40_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp40_, "dummy.add (\"hello2\")"); + _tmp41_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp41_, "dummy.add (\"hello3\")"); + _tmp42_ = self->test_collection; + _tmp43_ = gee_collection_add (_tmp42_, "hello"); + _vala_assert (_tmp43_, "test_collection.add (\"hello\")"); + _tmp44_ = self->test_collection; + _tmp45_ = gee_collection_add_all (_tmp44_, (GeeCollection*) dummy); + _vala_assert (_tmp45_, "test_collection.add_all (dummy)"); + _tmp46_ = self->test_collection; + _tmp47_ = gee_collection_get_size (_tmp46_); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_collection.size == 4"); + _tmp49_ = self->test_collection; + _tmp50_ = gee_collection_contains (_tmp49_, "hello"); + _vala_assert (_tmp50_, "test_collection.contains (\"hello\")"); + _tmp51_ = self->test_collection; + _tmp52_ = gee_collection_contains (_tmp51_, "hello1"); + _vala_assert (_tmp52_, "test_collection.contains (\"hello1\")"); + _tmp53_ = self->test_collection; + _tmp54_ = gee_collection_contains (_tmp53_, "hello2"); + _vala_assert (_tmp54_, "test_collection.contains (\"hello2\")"); + _tmp55_ = self->test_collection; + _tmp56_ = gee_collection_contains (_tmp55_, "hello3"); + _vala_assert (_tmp56_, "test_collection.contains (\"hello3\")"); + _tmp57_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 3, "dummy.size == 3"); + _tmp59_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp59_, "dummy.contains (\"hello1\")"); + _tmp60_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp60_, "dummy.contains (\"hello2\")"); + _tmp61_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp61_, "dummy.contains (\"hello3\")"); + _tmp62_ = self->test_collection; + gee_collection_clear (_tmp62_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp63_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp63_, "dummy.add (\"hello1\")"); + _tmp64_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp64_, "dummy.add (\"hello2\")"); + _tmp65_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp65_, "dummy.add (\"hello3\")"); + _tmp66_ = self->test_collection; + _tmp67_ = gee_collection_add (_tmp66_, "hello1"); + _vala_assert (_tmp67_, "test_collection.add (\"hello1\")"); + _tmp68_ = self->test_collection; + _tmp69_ = gee_collection_add_all (_tmp68_, (GeeCollection*) dummy); + _vala_assert (_tmp69_, "test_collection.add_all (dummy)"); + _tmp70_ = self->test_collection; + _tmp71_ = gee_collection_get_size (_tmp70_); + _tmp72_ = _tmp71_; + _vala_assert (_tmp72_ >= 3, "test_collection.size >= 3"); + _tmp73_ = self->test_collection; + _tmp74_ = gee_collection_contains (_tmp73_, "hello1"); + _vala_assert (_tmp74_, "test_collection.contains (\"hello1\")"); + _tmp75_ = self->test_collection; + _tmp76_ = gee_collection_contains (_tmp75_, "hello2"); + _vala_assert (_tmp76_, "test_collection.contains (\"hello2\")"); + _tmp77_ = self->test_collection; + _tmp78_ = gee_collection_contains (_tmp77_, "hello3"); + _vala_assert (_tmp78_, "test_collection.contains (\"hello3\")"); + _tmp79_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp80_ = _tmp79_; + _vala_assert (_tmp80_ == 3, "dummy.size == 3"); + _tmp81_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp81_, "dummy.contains (\"hello1\")"); + _tmp82_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp82_, "dummy.contains (\"hello2\")"); + _tmp83_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp83_, "dummy.contains (\"hello3\")"); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_contains_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + GeeCollection* _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + GeeCollection* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeCollection* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeCollection* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeCollection* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeCollection* _tmp26_; + gboolean _tmp27_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp2_, "dummy.add (\"hello1\")"); + _tmp3_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp3_, "dummy.add (\"hello2\")"); + _tmp4_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp4_, "dummy.add (\"hello3\")"); + _tmp5_ = self->test_collection; + _tmp6_ = gee_collection_get_is_empty (_tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_, "test_collection.is_empty"); + _tmp8_ = self->test_collection; + _tmp9_ = gee_collection_contains_all (_tmp8_, (GeeCollection*) dummy); + _vala_assert (!_tmp9_, "! test_collection.contains_all (dummy)"); + _tmp10_ = self->test_collection; + _tmp11_ = gee_collection_add (_tmp10_, "hello4"); + _vala_assert (_tmp11_, "test_collection.add (\"hello4\")"); + _tmp12_ = self->test_collection; + _tmp13_ = gee_collection_add (_tmp12_, "hello5"); + _vala_assert (_tmp13_, "test_collection.add (\"hello5\")"); + _tmp14_ = self->test_collection; + _tmp15_ = gee_collection_contains_all (_tmp14_, (GeeCollection*) dummy); + _vala_assert (!_tmp15_, "! test_collection.contains_all (dummy)"); + _tmp16_ = self->test_collection; + _tmp17_ = gee_collection_add (_tmp16_, "hello1"); + _vala_assert (_tmp17_, "test_collection.add (\"hello1\")"); + _tmp18_ = self->test_collection; + _tmp19_ = gee_collection_add (_tmp18_, "hello2"); + _vala_assert (_tmp19_, "test_collection.add (\"hello2\")"); + _tmp20_ = self->test_collection; + _tmp21_ = gee_collection_contains_all (_tmp20_, (GeeCollection*) dummy); + _vala_assert (!_tmp21_, "! test_collection.contains_all (dummy)"); + _tmp22_ = self->test_collection; + _tmp23_ = gee_collection_add (_tmp22_, "hello3"); + _vala_assert (_tmp23_, "test_collection.add (\"hello3\")"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_contains_all (_tmp24_, (GeeCollection*) dummy); + _vala_assert (_tmp25_, "test_collection.contains_all (dummy)"); + _tmp26_ = self->test_collection; + _tmp27_ = gee_abstract_collection_contains_all ((GeeAbstractCollection*) dummy, _tmp26_); + _vala_assert (!_tmp27_, "! dummy.contains_all (test_collection)"); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_remove_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + gboolean _tmp9_ = FALSE; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_ = FALSE; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_; + gboolean _tmp16_; + GeeCollection* _tmp17_; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeCollection* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeCollection* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeCollection* _tmp25_; + gboolean _tmp26_ = FALSE; + GeeCollection* _tmp27_; + gint _tmp28_; + gint _tmp29_; + gint _tmp30_; + gint _tmp31_; + GeeCollection* _tmp32_; + gboolean _tmp33_ = FALSE; + gboolean _tmp34_ = FALSE; + gboolean _tmp35_ = FALSE; + GeeCollection* _tmp36_; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeCollection* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeCollection* _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + gint _tmp47_; + gint _tmp48_; + GeeCollection* _tmp49_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_remove_all (_tmp2_, (GeeCollection*) dummy); + _vala_assert (!_tmp3_, "! test_collection.remove_all (dummy)"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_collection.is_empty"); + _tmp7_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "dummy.is_empty"); + _tmp9_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp9_, "dummy.add (\"hello1\")"); + _tmp10_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp10_, "dummy.add (\"hello2\")"); + _tmp11_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp11_, "dummy.add (\"hello3\")"); + _tmp12_ = self->test_collection; + _tmp13_ = gee_collection_remove_all (_tmp12_, (GeeCollection*) dummy); + _vala_assert (!_tmp13_, "! test_collection.remove_all (dummy)"); + _tmp14_ = self->test_collection; + _tmp15_ = gee_collection_get_is_empty (_tmp14_); + _tmp16_ = _tmp15_; + _vala_assert (_tmp16_, "test_collection.is_empty"); + _tmp17_ = self->test_collection; + gee_collection_clear (_tmp17_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp18_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp18_, "dummy.add (\"hello1\")"); + _tmp19_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp19_, "dummy.add (\"hello2\")"); + _tmp20_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp20_, "dummy.add (\"hello3\")"); + _tmp21_ = self->test_collection; + _tmp22_ = gee_collection_add (_tmp21_, "hello4"); + _vala_assert (_tmp22_, "test_collection.add (\"hello4\")"); + _tmp23_ = self->test_collection; + _tmp24_ = gee_collection_add (_tmp23_, "hello5"); + _vala_assert (_tmp24_, "test_collection.add (\"hello5\")"); + _tmp25_ = self->test_collection; + _tmp26_ = gee_collection_remove_all (_tmp25_, (GeeCollection*) dummy); + _vala_assert (!_tmp26_, "! test_collection.remove_all (dummy)"); + _tmp27_ = self->test_collection; + _tmp28_ = gee_collection_get_size (_tmp27_); + _tmp29_ = _tmp28_; + _vala_assert (_tmp29_ == 2, "test_collection.size == 2"); + _tmp30_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp31_ = _tmp30_; + _vala_assert (_tmp31_ == 3, "dummy.size == 3"); + _tmp32_ = self->test_collection; + gee_collection_clear (_tmp32_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp33_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp33_, "dummy.add (\"hello1\")"); + _tmp34_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp34_, "dummy.add (\"hello2\")"); + _tmp35_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp35_, "dummy.add (\"hello3\")"); + _tmp36_ = self->test_collection; + _tmp37_ = gee_collection_add (_tmp36_, "hello1"); + _vala_assert (_tmp37_, "test_collection.add (\"hello1\")"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_add (_tmp38_, "hello2"); + _vala_assert (_tmp39_, "test_collection.add (\"hello2\")"); + _tmp40_ = self->test_collection; + _tmp41_ = gee_collection_add (_tmp40_, "hello3"); + _vala_assert (_tmp41_, "test_collection.add (\"hello3\")"); + _tmp42_ = self->test_collection; + _tmp43_ = gee_collection_remove_all (_tmp42_, (GeeCollection*) dummy); + _vala_assert (_tmp43_, "test_collection.remove_all (dummy)"); + _tmp44_ = self->test_collection; + _tmp45_ = gee_collection_get_is_empty (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_, "test_collection.is_empty"); + _tmp47_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 3, "dummy.size == 3"); + _tmp49_ = self->test_collection; + gee_collection_clear (_tmp49_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_retain_all (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* dummy; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeCollection* _tmp15_; + gboolean _tmp16_; + gboolean _tmp17_; + gboolean _tmp18_; + gboolean _tmp19_; + GeeCollection* _tmp20_; + gboolean _tmp21_ = FALSE; + gboolean _tmp22_ = FALSE; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeCollection* _tmp26_; + gboolean _tmp27_; + gboolean _tmp28_; + gint _tmp29_; + gint _tmp30_; + gboolean _tmp31_ = FALSE; + gboolean _tmp32_ = FALSE; + gboolean _tmp33_ = FALSE; + GeeCollection* _tmp34_; + gboolean _tmp35_ = FALSE; + gboolean _tmp36_ = FALSE; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeCollection* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeCollection* _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + gint _tmp47_; + gint _tmp48_; + gboolean _tmp49_ = FALSE; + gboolean _tmp50_ = FALSE; + gboolean _tmp51_ = FALSE; + GeeCollection* _tmp52_; + gboolean _tmp53_ = FALSE; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_ = FALSE; + GeeCollection* _tmp56_; + gboolean _tmp57_ = FALSE; + GeeCollection* _tmp58_; + gboolean _tmp59_ = FALSE; + GeeCollection* _tmp60_; + gboolean _tmp61_ = FALSE; + GeeCollection* _tmp62_; + gboolean _tmp63_ = FALSE; + GeeCollection* _tmp64_; + gint _tmp65_; + gint _tmp66_; + GeeCollection* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeCollection* _tmp69_; + gboolean _tmp70_ = FALSE; + GeeCollection* _tmp71_; + gboolean _tmp72_ = FALSE; + gint _tmp73_; + gint _tmp74_; + gboolean _tmp75_ = FALSE; + gboolean _tmp76_ = FALSE; + gboolean _tmp77_ = FALSE; + GeeCollection* _tmp78_; + gboolean _tmp79_ = FALSE; + gboolean _tmp80_ = FALSE; + gboolean _tmp81_ = FALSE; + GeeCollection* _tmp82_; + gboolean _tmp83_ = FALSE; + GeeCollection* _tmp84_; + gboolean _tmp85_ = FALSE; + GeeCollection* _tmp86_; + gboolean _tmp87_ = FALSE; + GeeCollection* _tmp88_; + gboolean _tmp89_ = FALSE; + GeeCollection* _tmp90_; + gint _tmp91_; + gint _tmp92_; + GeeCollection* _tmp93_; + gboolean _tmp94_ = FALSE; + GeeCollection* _tmp95_; + gboolean _tmp96_ = FALSE; + gint _tmp97_; + gint _tmp98_; + gboolean _tmp99_ = FALSE; + gboolean _tmp100_ = FALSE; + gboolean _tmp101_ = FALSE; + GeeCollection* _tmp102_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp1_; + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_retain_all (_tmp2_, (GeeCollection*) dummy); + _vala_assert (!_tmp3_, "! test_collection.retain_all (dummy)"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_collection.is_empty"); + _tmp7_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "dummy.is_empty"); + _tmp9_ = self->test_collection; + _tmp10_ = gee_collection_add (_tmp9_, "hello1"); + _vala_assert (_tmp10_, "test_collection.add (\"hello1\")"); + _tmp11_ = self->test_collection; + _tmp12_ = gee_collection_add (_tmp11_, "hello2"); + _vala_assert (_tmp12_, "test_collection.add (\"hello2\")"); + _tmp13_ = self->test_collection; + _tmp14_ = gee_collection_retain_all (_tmp13_, (GeeCollection*) dummy); + _vala_assert (_tmp14_, "test_collection.retain_all (dummy)"); + _tmp15_ = self->test_collection; + _tmp16_ = gee_collection_get_is_empty (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_, "test_collection.is_empty"); + _tmp18_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) dummy); + _tmp19_ = _tmp18_; + _vala_assert (_tmp19_, "dummy.is_empty"); + _tmp20_ = self->test_collection; + gee_collection_clear (_tmp20_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp21_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp21_, "dummy.add (\"hello1\")"); + _tmp22_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp22_, "dummy.add (\"hello2\")"); + _tmp23_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp23_, "dummy.add (\"hello3\")"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_retain_all (_tmp24_, (GeeCollection*) dummy); + _vala_assert (!_tmp25_, "! test_collection.retain_all (dummy)"); + _tmp26_ = self->test_collection; + _tmp27_ = gee_collection_get_is_empty (_tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_, "test_collection.is_empty"); + _tmp29_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp30_ = _tmp29_; + _vala_assert (_tmp30_ == 3, "dummy.size == 3"); + _tmp31_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp31_, "dummy.contains (\"hello1\")"); + _tmp32_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp32_, "dummy.contains (\"hello2\")"); + _tmp33_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp33_, "dummy.contains (\"hello3\")"); + _tmp34_ = self->test_collection; + gee_collection_clear (_tmp34_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp35_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp35_, "dummy.add (\"hello1\")"); + _tmp36_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp36_, "dummy.add (\"hello2\")"); + _tmp37_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp37_, "dummy.add (\"hello3\")"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_add (_tmp38_, "hello4"); + _vala_assert (_tmp39_, "test_collection.add (\"hello4\")"); + _tmp40_ = self->test_collection; + _tmp41_ = gee_collection_add (_tmp40_, "hello5"); + _vala_assert (_tmp41_, "test_collection.add (\"hello5\")"); + _tmp42_ = self->test_collection; + _tmp43_ = gee_collection_retain_all (_tmp42_, (GeeCollection*) dummy); + _vala_assert (_tmp43_, "test_collection.retain_all (dummy)"); + _tmp44_ = self->test_collection; + _tmp45_ = gee_collection_get_is_empty (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_, "test_collection.is_empty"); + _tmp47_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 3, "dummy.size == 3"); + _tmp49_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp49_, "dummy.contains (\"hello1\")"); + _tmp50_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp50_, "dummy.contains (\"hello2\")"); + _tmp51_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp51_, "dummy.contains (\"hello3\")"); + _tmp52_ = self->test_collection; + gee_collection_clear (_tmp52_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp53_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp53_, "dummy.add (\"hello1\")"); + _tmp54_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp54_, "dummy.add (\"hello2\")"); + _tmp55_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp55_, "dummy.add (\"hello3\")"); + _tmp56_ = self->test_collection; + _tmp57_ = gee_collection_add (_tmp56_, "hello1"); + _vala_assert (_tmp57_, "test_collection.add (\"hello1\")"); + _tmp58_ = self->test_collection; + _tmp59_ = gee_collection_add (_tmp58_, "hello2"); + _vala_assert (_tmp59_, "test_collection.add (\"hello2\")"); + _tmp60_ = self->test_collection; + _tmp61_ = gee_collection_add (_tmp60_, "hello3"); + _vala_assert (_tmp61_, "test_collection.add (\"hello3\")"); + _tmp62_ = self->test_collection; + _tmp63_ = gee_collection_retain_all (_tmp62_, (GeeCollection*) dummy); + _vala_assert (!_tmp63_, "! test_collection.retain_all (dummy)"); + _tmp64_ = self->test_collection; + _tmp65_ = gee_collection_get_size (_tmp64_); + _tmp66_ = _tmp65_; + _vala_assert (_tmp66_ == 3, "test_collection.size == 3"); + _tmp67_ = self->test_collection; + _tmp68_ = gee_collection_contains (_tmp67_, "hello1"); + _vala_assert (_tmp68_, "test_collection.contains (\"hello1\")"); + _tmp69_ = self->test_collection; + _tmp70_ = gee_collection_contains (_tmp69_, "hello2"); + _vala_assert (_tmp70_, "test_collection.contains (\"hello2\")"); + _tmp71_ = self->test_collection; + _tmp72_ = gee_collection_contains (_tmp71_, "hello3"); + _vala_assert (_tmp72_, "test_collection.contains (\"hello3\")"); + _tmp73_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 3, "dummy.size == 3"); + _tmp75_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp75_, "dummy.contains (\"hello1\")"); + _tmp76_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp76_, "dummy.contains (\"hello2\")"); + _tmp77_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp77_, "dummy.contains (\"hello3\")"); + _tmp78_ = self->test_collection; + gee_collection_clear (_tmp78_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _tmp79_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp79_, "dummy.add (\"hello1\")"); + _tmp80_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp80_, "dummy.add (\"hello2\")"); + _tmp81_ = gee_abstract_collection_add ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp81_, "dummy.add (\"hello3\")"); + _tmp82_ = self->test_collection; + _tmp83_ = gee_collection_add (_tmp82_, "hello2"); + _vala_assert (_tmp83_, "test_collection.add (\"hello2\")"); + _tmp84_ = self->test_collection; + _tmp85_ = gee_collection_add (_tmp84_, "hello3"); + _vala_assert (_tmp85_, "test_collection.add (\"hello3\")"); + _tmp86_ = self->test_collection; + _tmp87_ = gee_collection_add (_tmp86_, "hello4"); + _vala_assert (_tmp87_, "test_collection.add (\"hello4\")"); + _tmp88_ = self->test_collection; + _tmp89_ = gee_collection_retain_all (_tmp88_, (GeeCollection*) dummy); + _vala_assert (_tmp89_, "test_collection.retain_all (dummy)"); + _tmp90_ = self->test_collection; + _tmp91_ = gee_collection_get_size (_tmp90_); + _tmp92_ = _tmp91_; + _vala_assert (_tmp92_ == 2, "test_collection.size == 2"); + _tmp93_ = self->test_collection; + _tmp94_ = gee_collection_contains (_tmp93_, "hello2"); + _vala_assert (_tmp94_, "test_collection.contains (\"hello2\")"); + _tmp95_ = self->test_collection; + _tmp96_ = gee_collection_contains (_tmp95_, "hello3"); + _vala_assert (_tmp96_, "test_collection.contains (\"hello3\")"); + _tmp97_ = gee_abstract_collection_get_size ((GeeCollection*) dummy); + _tmp98_ = _tmp97_; + _vala_assert (_tmp98_ == 3, "dummy.size == 3"); + _tmp99_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello1"); + _vala_assert (_tmp99_, "dummy.contains (\"hello1\")"); + _tmp100_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello2"); + _vala_assert (_tmp100_, "dummy.contains (\"hello2\")"); + _tmp101_ = gee_abstract_collection_contains ((GeeAbstractCollection*) dummy, "hello3"); + _vala_assert (_tmp101_, "dummy.contains (\"hello3\")"); + _tmp102_ = self->test_collection; + gee_collection_clear (_tmp102_); + gee_abstract_collection_clear ((GeeAbstractCollection*) dummy); + _g_object_unref0 (dummy); +} + + +void collection_tests_test_to_array (CollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + gboolean _tmp2_; + gboolean _tmp3_; + GeeCollection* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeCollection* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeCollection* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeCollection* _tmp10_; + gint _tmp11_ = 0; + gpointer* _tmp12_ = NULL; + gchar** array; + gint array_length1; + gint _array_size_; + gint index; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + _tmp1_ = self->test_collection; + _tmp2_ = gee_collection_get_is_empty (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_, "test_collection.is_empty"); + _tmp4_ = self->test_collection; + _tmp5_ = gee_collection_add (_tmp4_, "hello1"); + _vala_assert (_tmp5_, "test_collection.add (\"hello1\")"); + _tmp6_ = self->test_collection; + _tmp7_ = gee_collection_add (_tmp6_, "hello2"); + _vala_assert (_tmp7_, "test_collection.add (\"hello2\")"); + _tmp8_ = self->test_collection; + _tmp9_ = gee_collection_add (_tmp8_, "hello3"); + _vala_assert (_tmp9_, "test_collection.add (\"hello3\")"); + _tmp10_ = self->test_collection; + _tmp12_ = gee_collection_to_array (_tmp10_, &_tmp11_); + array = (gchar**) _tmp12_; + array_length1 = (_tmp11_ * sizeof (gchar*)) / sizeof (gchar*); + _array_size_ = array_length1; + index = 0; + { + GeeCollection* _tmp13_; + GeeIterator* _tmp14_ = NULL; + GeeIterator* _element_it; + _tmp13_ = self->test_collection; + _tmp14_ = gee_iterable_iterator ((GeeIterable*) _tmp13_); + _element_it = _tmp14_; + while (TRUE) { + GeeIterator* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* element; + const gchar* _tmp19_; + gchar** _tmp20_; + gint _tmp20__length1; + gint _tmp21_; + const gchar* _tmp22_; + _tmp15_ = _element_it; + _tmp16_ = gee_iterator_next (_tmp15_); + if (!_tmp16_) { + break; + } + _tmp17_ = _element_it; + _tmp18_ = gee_iterator_get (_tmp17_); + element = (gchar*) _tmp18_; + _tmp19_ = element; + _tmp20_ = array; + _tmp20__length1 = array_length1; + _tmp21_ = index; + index = _tmp21_ + 1; + _tmp22_ = _tmp20_[_tmp21_]; + _vala_assert (g_strcmp0 (_tmp19_, _tmp22_) == 0, "element == array[index++]"); + _g_free0 (element); + } + _g_object_unref0 (_element_it); + } + array = (_vala_array_free (array, array_length1, (GDestroyNotify) g_free), NULL); +} + + +void collection_tests_test_gobject_properties (CollectionTests* self) { + GeeCollection* _tmp0_; + GValue value = {0}; + GValue _tmp1_ = {0}; + GValue _tmp2_; + GeeCollection* _tmp3_; + GType _tmp4_ = 0UL; + GeeCollection* _tmp5_; + GType _tmp6_; + GType _tmp7_; + GValue _tmp8_ = {0}; + GValue _tmp9_; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeCollection* _tmp12_; + gboolean _tmp13_; + gboolean _tmp14_; + GValue _tmp15_ = {0}; + GValue _tmp16_; + GeeCollection* _tmp17_; + gint _tmp18_ = 0; + GeeCollection* _tmp19_; + gint _tmp20_; + gint _tmp21_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _vala_assert (_tmp0_ != NULL, "test_collection != null"); + g_value_init (&_tmp1_, G_TYPE_GTYPE); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp1_; + _tmp2_ = value; + _tmp3_ = self->test_collection; + g_object_get_property ((GObject*) _tmp3_, "element-type", &value); + _tmp4_ = g_value_get_gtype (&value); + _tmp5_ = self->test_collection; + _tmp6_ = gee_iterable_get_element_type ((GeeIterable*) _tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp4_ == _tmp7_, "value.get_gtype () == test_collection.element_type"); + g_value_unset (&value); + g_value_init (&_tmp8_, G_TYPE_BOOLEAN); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp8_; + _tmp9_ = value; + _tmp10_ = self->test_collection; + g_object_get_property ((GObject*) _tmp10_, "is-empty", &value); + _tmp11_ = g_value_get_boolean (&value); + _tmp12_ = self->test_collection; + _tmp13_ = gee_collection_get_is_empty (_tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp11_ == _tmp14_, "value.get_boolean () == test_collection.is_empty"); + g_value_unset (&value); + g_value_init (&_tmp15_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp15_; + _tmp16_ = value; + _tmp17_ = self->test_collection; + g_object_get_property ((GObject*) _tmp17_, "size", &value); + _tmp18_ = g_value_get_int (&value); + _tmp19_ = self->test_collection; + _tmp20_ = gee_collection_get_size (_tmp19_); + _tmp21_ = _tmp20_; + _vala_assert (_tmp18_ == _tmp21_, "value.get_int () == test_collection.size"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; +} + + +static void collection_tests_class_init (CollectionTestsClass * klass) { + collection_tests_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = collection_tests_finalize; +} + + +static void collection_tests_instance_init (CollectionTests * self) { +} + + +static void collection_tests_finalize (GObject* obj) { + CollectionTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_COLLECTION_TESTS, CollectionTests); + _g_object_unref0 (self->test_collection); + G_OBJECT_CLASS (collection_tests_parent_class)->finalize (obj); +} + + +GType collection_tests_get_type (void) { + static volatile gsize collection_tests_type_id__volatile = 0; + if (g_once_init_enter (&collection_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (CollectionTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) collection_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CollectionTests), 0, (GInstanceInitFunc) collection_tests_instance_init, NULL }; + GType collection_tests_type_id; + collection_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "CollectionTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&collection_tests_type_id__volatile, collection_tests_type_id); + } + return collection_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testcollection.vala b/tests/testcollection.vala new file mode 100644 index 0000000..6155f9e --- /dev/null +++ b/tests/testcollection.vala @@ -0,0 +1,736 @@ +/* testcollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public abstract class CollectionTests : Gee.TestCase { + + public CollectionTests (string name) { + base (name); + add_test ("[Collection] type correctness", test_type_correctness); + add_test ("[Collection] iterator returns all elements once", + test_iterator_returns_all_elements_once); + add_test ("[Collection] mutable iterator", test_mutable_iterator); + add_test ("[Collection] contains, size and is_empty", + test_contains_size_and_is_empty); + add_test ("[Collection] add and remove", test_add_remove); + add_test ("[Collection] clear", test_clear); + add_test ("[Collection] add_all", test_add_all); + add_test ("[Collection] contains_all", test_contains_all); + add_test ("[Collection] remove_all", test_remove_all); + add_test ("[Collection] retain_all", test_retain_all); + add_test ("[Collection] to_array", test_to_array); + add_test ("[Collection] GObject properties", test_gobject_properties); + } + + protected Collection<string> test_collection; + + public void test_type_correctness () { + // Check the collection exists + assert (test_collection != null); + + // Check the advertised element type + assert (test_collection.element_type == typeof (string)); + } + + public void test_iterator_returns_all_elements_once () { + // Check the collection exists + assert (test_collection != null); + bool has_next; + + // Check with an empty collection + Iterator<string> iterator = test_collection.iterator (); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + assert (! iterator.first ()); + + // Check for some elements in the collection + assert (test_collection.add ("one")); + assert (test_collection.add ("two")); + assert (test_collection.add ("three")); + + bool one_found = false; + bool two_found = false; + bool three_found = false; + bool one_found_once = true; + bool two_found_once = true; + bool three_found_once = true; + iterator = test_collection.iterator (); + while (true) { + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + if (two_found) { + two_found_once = false; + } + two_found = true; + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (two_found); + assert (two_found_once); + assert (three_found); + assert (three_found_once); + + // Do it twice to check first () + assert (iterator.first ()); + + one_found = false; + two_found = false; + three_found = false; + one_found_once = true; + two_found_once = true; + three_found_once = true; + while (true) { + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + if (two_found) { + two_found_once = false; + } + two_found = true; + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (two_found); + assert (two_found_once); + assert (three_found); + assert (three_found_once); + } + + public void test_mutable_iterator () { + // Check the collection exists + assert (test_collection != null); + bool has_next; + + // Check with an empty collection + Iterator<string> iterator = test_collection.iterator (); + // ... + + // Check for some elements in the collection and remove one + assert (test_collection.add ("one")); + assert (test_collection.add ("two")); + assert (test_collection.add ("three")); + + bool one_found = false; + bool two_found = false; + bool three_found = false; + bool one_found_once = true; + bool two_found_once = true; + bool three_found_once = true; + iterator = test_collection.iterator (); + while (true) { + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + if (two_found) { + two_found_once = false; + } + two_found = true; + + // Remove this element + iterator.remove (); + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (two_found); + assert (two_found_once); + assert (three_found); + assert (three_found_once); + + // Check after removal + assert (iterator.first ()); + + one_found = false; + two_found = false; + three_found = false; + one_found_once = true; + two_found_once = true; + three_found_once = true; + while (true) { + string element = iterator.get (); + if (element == "one") { + if (one_found) { + one_found_once = false; + } + one_found = true; + } else if (element == "two") { + two_found = true; + } else if (element == "three") { + if (three_found) { + three_found_once = false; + } + three_found = true; + } + + has_next = iterator.has_next (); + assert (has_next == iterator.next ()); + if (! has_next) { + break; + } + } + has_next = iterator.has_next (); + assert (! has_next); + assert (has_next == iterator.next ()); + assert (one_found); + assert (one_found_once); + assert (!two_found); + assert (three_found); + assert (three_found_once); + } + + public void test_contains_size_and_is_empty () { + // Check the collection exists + assert (test_collection != null); + + // Check the collection is initially empty + assert (! test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 0); + assert (test_collection.is_empty); + + // Add an element + assert (test_collection.add ("one")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 1); + assert (! test_collection.is_empty); + + // Remove the added element + assert (test_collection.remove ("one")); + assert (! test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 0); + assert (test_collection.is_empty); + + // Add more elements + assert (test_collection.add ("one")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 1); + assert (! test_collection.is_empty); + + assert (test_collection.add ("two")); + assert (test_collection.contains ("one")); + assert (test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 2); + assert (! test_collection.is_empty); + + assert (test_collection.add ("three")); + assert (test_collection.contains ("one")); + assert (test_collection.contains ("two")); + assert (test_collection.contains ("three")); + assert (test_collection.size == 3); + assert (! test_collection.is_empty); + + // Remove one element + assert (test_collection.remove ("two")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (test_collection.contains ("three")); + assert (test_collection.size == 2); + assert (! test_collection.is_empty); + + // Remove the same element again + assert (! test_collection.remove ("two")); + assert (test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (test_collection.contains ("three")); + assert (test_collection.size == 2); + assert (! test_collection.is_empty); + + // Remove all elements + test_collection.clear (); + assert (! test_collection.contains ("one")); + assert (! test_collection.contains ("two")); + assert (! test_collection.contains ("three")); + assert (test_collection.size == 0); + assert (test_collection.is_empty); + } + + public void test_add_remove () { + // Check the collection exists + assert (test_collection != null); + + string[] to_add = { + "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", + "twenty one", "twenty two", "twenty three", "twenty four", + "twenty five", "twenty six", "twenty seven", "twenty eight", + "twenty nine", "thirty", "thirty one", "thirty two", "thirty four", + "thirty five", "thirty six", "thirty seven", "thirty eight", + "thirty nine", "fourty" + }; + var expected_size = 0; + + foreach (var a in to_add) { + assert (!test_collection.contains (a)); + assert (test_collection.size == expected_size++); + assert (test_collection.add (a)); + assert (test_collection.contains (a)); + } + assert (test_collection.size == to_add.length); + + foreach (var a in to_add) { + assert (test_collection.contains (a)); + } + + foreach (var a in to_add) { + assert (test_collection.contains (a)); + assert (test_collection.size == expected_size--); + assert (test_collection.remove (a)); + assert (!test_collection.contains (a)); + } + assert (test_collection.size == 0); + } + + public void test_clear () { + // Check the collection exists + assert (test_collection != null); + + string[] to_add = { + "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", + "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", + "twenty one", "twenty two", "twenty three", "twenty four", + "twenty five", "twenty six", "twenty seven", "twenty eight", + "twenty nine", "thirty", "thirty one", "thirty two", "thirty four", + "thirty five", "thirty six", "thirty seven", "thirty eight", + "thirty nine", "fourty" + }; + var expected_size = 0; + + foreach (var a in to_add) { + assert (!test_collection.contains (a)); + assert (test_collection.size == expected_size++); + assert (test_collection.add (a)); + assert (test_collection.contains (a)); + } + assert (test_collection.size == to_add.length); + + test_collection.clear (); + + assert (test_collection.size == 0); + + Iterator<string> iter = test_collection.iterator (); + assert (iter != null); + assert (!iter.has_next ()); + + } + + public void test_add_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList<string> (); + + // Check when the test collection is initially empty and + // dummy collection is empty + assert (! test_collection.add_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + // Check when test collection is not empty but dummy is + assert (test_collection.add ("hello")); + assert (! test_collection.add_all (dummy)); + + assert (test_collection.size == 1); + assert (test_collection.contains ("hello")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is initially empty and + // dummy collection is not empty + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (test_collection.add_all (dummy)); + + assert (test_collection.size == 3); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections does not intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (test_collection.add ("hello")); + + assert (test_collection.add_all (dummy)); + + assert (test_collection.size == 4); + assert (test_collection.contains ("hello")); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collection intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (test_collection.add ("hello1")); + + assert (test_collection.add_all (dummy)); + + // We can only assert the result is greater or equal than 3 + // as we do not assume duplicates + assert (test_collection.size >= 3); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + } + + public void test_contains_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList<string> (); + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + // Check when the test collection is initially empty + assert (test_collection.is_empty); + assert (! test_collection.contains_all (dummy)); + + // Check when the test collection is not empty and both + // collections does not intersect + assert (test_collection.add ("hello4")); + assert (test_collection.add ("hello5")); + assert (! test_collection.contains_all (dummy)); + + // Check when the test collection is not empty and both + // collections intersect but are not equal + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (! test_collection.contains_all (dummy)); + + // Check when the test collection is not empty and the + // dummy collection is contained in the test one + assert (test_collection.add ("hello3")); + assert (test_collection.contains_all (dummy)); + assert (! dummy.contains_all (test_collection)); + } + + public void test_remove_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList<string> (); + + // Check when both collection are intially empty + assert (! test_collection.remove_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + // Check when the test collection is initially empty and + // dummy collection is not empty + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (! test_collection.remove_all (dummy)); + + assert (test_collection.is_empty); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections does not intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello4")); + assert (test_collection.add ("hello5")); + + assert (! test_collection.remove_all (dummy)); + + assert (test_collection.size == 2); + assert (dummy.size == 3); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + + assert (test_collection.remove_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.size == 3); + + test_collection.clear (); + dummy.clear (); + } + + public void test_retain_all () { + // Check the collection exists + assert (test_collection != null); + + // Creating a dummy collection + var dummy = new ArrayList<string> (); + + // Check when the test collection is initially empty and + // dummy collection is empty + assert (! test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + // Check when the test collection is not empty and + // the dummy one is + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + + assert (test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.is_empty); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is initially empty and + // dummy collection is not empty + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + + assert (! test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collection does not intersect + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello4")); + assert (test_collection.add ("hello5")); + + assert (test_collection.retain_all (dummy)); + + assert (test_collection.is_empty); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when both collections have the same elements + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + + assert (! test_collection.retain_all (dummy)); + + assert (test_collection.size == 3); + assert (test_collection.contains ("hello1")); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + + // Check when the test collection is not empty and both + // collections intersect but are not equal + assert (dummy.add ("hello1")); + assert (dummy.add ("hello2")); + assert (dummy.add ("hello3")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + assert (test_collection.add ("hello4")); + + assert (test_collection.retain_all (dummy)); + + assert (test_collection.size == 2); + assert (test_collection.contains ("hello2")); + assert (test_collection.contains ("hello3")); + assert (dummy.size == 3); + assert (dummy.contains ("hello1")); + assert (dummy.contains ("hello2")); + assert (dummy.contains ("hello3")); + + test_collection.clear (); + dummy.clear (); + } + + public void test_to_array () { + // Check the collection exists + assert (test_collection != null); + + // Check the collection is empty + assert (test_collection.is_empty); + + // Add some elements + assert (test_collection.add ("hello1")); + assert (test_collection.add ("hello2")); + assert (test_collection.add ("hello3")); + + // Check the conversion to array + string[] array = (string[]) test_collection.to_array (); + int index = 0; + foreach (string element in test_collection) { + assert (element == array[index++]); + } + } + + public void test_gobject_properties () { + // Check the collection exists + assert (test_collection != null); + Value value; + + value = Value (typeof (Type)); + test_collection.get_property ("element-type", ref value); + assert (value.get_gtype () == test_collection.element_type); + value.unset (); + + value = Value (typeof (bool)); + test_collection.get_property ("is-empty", ref value); + assert (value.get_boolean () == test_collection.is_empty); + value.unset (); + + value = Value (typeof (int)); + test_collection.get_property ("size", ref value); + assert (value.get_int () == test_collection.size); + value.unset (); + } +} diff --git a/tests/testcomparable.c b/tests/testcomparable.c new file mode 100644 index 0000000..2241ca0 --- /dev/null +++ b/tests/testcomparable.c @@ -0,0 +1,258 @@ +/* testcomparable.c generated by valac 0.18.0, the Vala compiler + * generated from testcomparable.vala, do not modify */ + +/* testcomparable.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <stdlib.h> +#include <string.h> +#include <gee.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COMPARABLE_TESTS (comparable_tests_get_type ()) +#define COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMPARABLE_TESTS, ComparableTests)) +#define COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) +#define IS_COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMPARABLE_TESTS)) +#define IS_COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMPARABLE_TESTS)) +#define COMPARABLE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) + +typedef struct _ComparableTests ComparableTests; +typedef struct _ComparableTestsClass ComparableTestsClass; +typedef struct _ComparableTestsPrivate ComparableTestsPrivate; + +#define COMPARABLE_TESTS_TYPE_TEST_COMPARABLE (comparable_tests_test_comparable_get_type ()) +#define COMPARABLE_TESTS_TEST_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparable)) +#define COMPARABLE_TESTS_TEST_COMPARABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparableClass)) +#define COMPARABLE_TESTS_IS_TEST_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE)) +#define COMPARABLE_TESTS_IS_TEST_COMPARABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE)) +#define COMPARABLE_TESTS_TEST_COMPARABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparableClass)) + +typedef struct _ComparableTestsTestComparable ComparableTestsTestComparable; +typedef struct _ComparableTestsTestComparableClass ComparableTestsTestComparableClass; +typedef struct _ComparableTestsTestComparablePrivate ComparableTestsTestComparablePrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ComparableTests { + GeeTestCase parent_instance; + ComparableTestsPrivate * priv; +}; + +struct _ComparableTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +struct _ComparableTestsTestComparable { + GObject parent_instance; + ComparableTestsTestComparablePrivate * priv; + gint _a; +}; + +struct _ComparableTestsTestComparableClass { + GObjectClass parent_class; +}; + + +static gpointer comparable_tests_parent_class = NULL; +static gpointer comparable_tests_test_comparable_parent_class = NULL; +static GeeComparableIface* comparable_tests_test_comparable_gee_comparable_parent_iface = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType comparable_tests_get_type (void) G_GNUC_CONST; +enum { + COMPARABLE_TESTS_DUMMY_PROPERTY +}; +ComparableTests* comparable_tests_new (void); +ComparableTests* comparable_tests_construct (GType object_type); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void comparable_tests_test_selected_functions (ComparableTests* self); +static void _comparable_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static ComparableTestsTestComparable* comparable_tests_test_comparable_new (gint a); +static ComparableTestsTestComparable* comparable_tests_test_comparable_construct (GType object_type, gint a); +static GType comparable_tests_test_comparable_get_type (void) G_GNUC_CONST G_GNUC_UNUSED; +enum { + COMPARABLE_TESTS_TEST_COMPARABLE_DUMMY_PROPERTY +}; +static gint comparable_tests_test_comparable_real_compare_to (GeeComparable* base, ComparableTestsTestComparable* object); +static void comparable_tests_test_comparable_finalize (GObject* obj); + + +static void _comparable_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + comparable_tests_test_selected_functions (self); +} + + +ComparableTests* comparable_tests_construct (GType object_type) { + ComparableTests * self = NULL; + self = (ComparableTests*) gee_test_case_construct (object_type, "Comparable"); + gee_test_case_add_test ((GeeTestCase*) self, "[Comparable] selected functions", _comparable_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +ComparableTests* comparable_tests_new (void) { + return comparable_tests_construct (TYPE_COMPARABLE_TESTS); +} + + +void comparable_tests_test_selected_functions (ComparableTests* self) { + ComparableTestsTestComparable* _tmp0_; + ComparableTestsTestComparable* o1; + ComparableTestsTestComparable* _tmp1_; + ComparableTestsTestComparable* o2; + GCompareFunc _tmp2_ = NULL; + GCompareFunc compare; + gint _tmp3_ = 0; + gint _tmp4_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = comparable_tests_test_comparable_new (10); + o1 = _tmp0_; + _tmp1_ = comparable_tests_test_comparable_new (20); + o2 = _tmp1_; + _tmp2_ = gee_functions_get_compare_func_for (COMPARABLE_TESTS_TYPE_TEST_COMPARABLE); + compare = _tmp2_; + _tmp3_ = compare (o1, o2); + _vala_assert (_tmp3_ < 0, "compare (o1, o2) < 0"); + o1->_a = 42; + _tmp4_ = compare (o1, o2); + _vala_assert (_tmp4_ > 0, "compare (o1, o2) > 0"); + _g_object_unref0 (o2); + _g_object_unref0 (o1); +} + + +static ComparableTestsTestComparable* comparable_tests_test_comparable_construct (GType object_type, gint a) { + ComparableTestsTestComparable * self = NULL; + gint _tmp0_; + self = (ComparableTestsTestComparable*) g_object_new (object_type, NULL); + _tmp0_ = a; + self->_a = _tmp0_; + return self; +} + + +static ComparableTestsTestComparable* comparable_tests_test_comparable_new (gint a) { + return comparable_tests_test_comparable_construct (COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, a); +} + + +static gint comparable_tests_test_comparable_real_compare_to (GeeComparable* base, ComparableTestsTestComparable* object) { + ComparableTestsTestComparable * self; + gint result = 0; + gint _tmp0_; + ComparableTestsTestComparable* _tmp1_; + gint _tmp2_; + self = (ComparableTestsTestComparable*) base; + g_return_val_if_fail (object != NULL, 0); + _tmp0_ = self->_a; + _tmp1_ = object; + _tmp2_ = _tmp1_->_a; + result = _tmp0_ - _tmp2_; + return result; +} + + +static void comparable_tests_test_comparable_class_init (ComparableTestsTestComparableClass * klass) { + comparable_tests_test_comparable_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = comparable_tests_test_comparable_finalize; +} + + +static void comparable_tests_test_comparable_gee_comparable_interface_init (GeeComparableIface * iface) { + comparable_tests_test_comparable_gee_comparable_parent_iface = g_type_interface_peek_parent (iface); + iface->compare_to = (gint (*)(GeeComparable*, gconstpointer)) comparable_tests_test_comparable_real_compare_to; +} + + +static void comparable_tests_test_comparable_instance_init (ComparableTestsTestComparable * self) { +} + + +static void comparable_tests_test_comparable_finalize (GObject* obj) { + ComparableTestsTestComparable * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, COMPARABLE_TESTS_TYPE_TEST_COMPARABLE, ComparableTestsTestComparable); + G_OBJECT_CLASS (comparable_tests_test_comparable_parent_class)->finalize (obj); +} + + +static GType comparable_tests_test_comparable_get_type (void) { + static volatile gsize comparable_tests_test_comparable_type_id__volatile = 0; + if (g_once_init_enter (&comparable_tests_test_comparable_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ComparableTestsTestComparableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) comparable_tests_test_comparable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ComparableTestsTestComparable), 0, (GInstanceInitFunc) comparable_tests_test_comparable_instance_init, NULL }; + static const GInterfaceInfo gee_comparable_info = { (GInterfaceInitFunc) comparable_tests_test_comparable_gee_comparable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; + GType comparable_tests_test_comparable_type_id; + comparable_tests_test_comparable_type_id = g_type_register_static (G_TYPE_OBJECT, "ComparableTestsTestComparable", &g_define_type_info, 0); + g_type_add_interface_static (comparable_tests_test_comparable_type_id, GEE_TYPE_COMPARABLE, &gee_comparable_info); + g_once_init_leave (&comparable_tests_test_comparable_type_id__volatile, comparable_tests_test_comparable_type_id); + } + return comparable_tests_test_comparable_type_id__volatile; +} + + +static void comparable_tests_class_init (ComparableTestsClass * klass) { + comparable_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void comparable_tests_instance_init (ComparableTests * self) { +} + + +GType comparable_tests_get_type (void) { + static volatile gsize comparable_tests_type_id__volatile = 0; + if (g_once_init_enter (&comparable_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ComparableTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) comparable_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ComparableTests), 0, (GInstanceInitFunc) comparable_tests_instance_init, NULL }; + GType comparable_tests_type_id; + comparable_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "ComparableTests", &g_define_type_info, 0); + g_once_init_leave (&comparable_tests_type_id__volatile, comparable_tests_type_id); + } + return comparable_tests_type_id__volatile; +} + + + diff --git a/tests/testcomparable.vala b/tests/testcomparable.vala new file mode 100644 index 0000000..de5c2ef --- /dev/null +++ b/tests/testcomparable.vala @@ -0,0 +1,54 @@ +/* testcomparable.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public class ComparableTests : Gee.TestCase { + + public ComparableTests () { + base ("Comparable"); + add_test ("[Comparable] selected functions", test_selected_functions); + } + + private class TestComparable : Object, Comparable<TestComparable> { + public int _a; + + public TestComparable (int a) { + _a = a; + } + + public int compare_to (TestComparable object) { + return _a - object._a; + } + } + + public void test_selected_functions () { + TestComparable o1 = new TestComparable (10); + TestComparable o2 = new TestComparable (20); + + CompareFunc compare = Functions.get_compare_func_for (typeof (TestComparable)); + assert (compare (o1, o2) < 0); + + o1._a = 42; + assert (compare (o1, o2) > 0); + } +} diff --git a/tests/testdeque.c b/tests/testdeque.c new file mode 100644 index 0000000..4af05df --- /dev/null +++ b/tests/testdeque.c @@ -0,0 +1,873 @@ +/* testdeque.c generated by valac 0.18.0, the Vala compiler + * generated from testdeque.vala, do not modify */ + +/* testdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; + +#define TYPE_DEQUE_TESTS (deque_tests_get_type ()) +#define DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEQUE_TESTS, DequeTests)) +#define DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEQUE_TESTS, DequeTestsClass)) +#define IS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEQUE_TESTS)) +#define IS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEQUE_TESTS)) +#define DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEQUE_TESTS, DequeTestsClass)) + +typedef struct _DequeTests DequeTests; +typedef struct _DequeTestsClass DequeTestsClass; +typedef struct _DequeTestsPrivate DequeTestsPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +struct _DequeTests { + QueueTests parent_instance; + DequeTestsPrivate * priv; +}; + +struct _DequeTestsClass { + QueueTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer deque_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +GType deque_tests_get_type (void) G_GNUC_CONST; +enum { + DEQUE_TESTS_DUMMY_PROPERTY +}; +DequeTests* deque_tests_construct (GType object_type, const gchar* name); +QueueTests* queue_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void deque_tests_test_queue_use (DequeTests* self); +static void _deque_tests_test_queue_use_gee_test_case_test_method (gpointer self); +void deque_tests_test_stack_use (DequeTests* self); +static void _deque_tests_test_stack_use_gee_test_case_test_method (gpointer self); +void deque_tests_test_reversed_stack_use (DequeTests* self); +static void _deque_tests_test_reversed_stack_use_gee_test_case_test_method (gpointer self); + + +static void _deque_tests_test_queue_use_gee_test_case_test_method (gpointer self) { + deque_tests_test_queue_use (self); +} + + +static void _deque_tests_test_stack_use_gee_test_case_test_method (gpointer self) { + deque_tests_test_stack_use (self); +} + + +static void _deque_tests_test_reversed_stack_use_gee_test_case_test_method (gpointer self) { + deque_tests_test_reversed_stack_use (self); +} + + +DequeTests* deque_tests_construct (GType object_type, const gchar* name) { + DequeTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (DequeTests*) queue_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Deque] queue use", _deque_tests_test_queue_use_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Deque] stack use", _deque_tests_test_stack_use_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Deque] reversed stack use", _deque_tests_test_reversed_stack_use_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void deque_tests_test_queue_use (DequeTests* self) { + GeeCollection* _tmp0_; + GeeDeque* _tmp1_; + GeeDeque* test_deque; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp13_; + gint _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gint _tmp19_; + gint _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gint _tmp25_; + gint _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gint _tmp31_; + gint _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_; + gint _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + gboolean _tmp45_ = FALSE; + gboolean _tmp46_ = FALSE; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_ = 0; + gint _tmp50_; + gint _tmp51_; + gint _tmp52_; + gint _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gint _tmp56_ = 0; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gint _tmp67_ = 0; + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + gint _tmp71_; + gint _tmp72_ = 0; + gint _tmp73_; + gint _tmp74_; + gint _tmp75_; + gint _tmp76_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_DEQUE) ? ((GeeDeque*) _tmp0_) : NULL); + test_deque = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_deque != NULL, "test_deque != null"); + _tmp3_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp3_, "test_deque.offer_tail (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_deque.size == 1"); + _tmp6_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp6_, "test_deque.offer_tail (\"two\")"); + _tmp7_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 2, "test_deque.size == 2"); + _tmp9_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp9_, "test_deque.offer_tail (\"three\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 3, "test_deque.size == 3"); + _tmp12_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp12_, "test_deque.offer_tail (\"four\")"); + _tmp13_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 4, "test_deque.size == 4"); + _tmp15_ = gee_deque_peek_head (test_deque); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "one") == 0, "test_deque.peek_head () == \"one\""); + _g_free0 (_tmp16_); + _tmp17_ = gee_deque_poll_head (test_deque); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "one") == 0, "test_deque.poll_head () == \"one\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_deque.size == 3"); + _tmp21_ = gee_deque_peek_head (test_deque); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "two") == 0, "test_deque.peek_head () == \"two\""); + _g_free0 (_tmp22_); + _tmp23_ = gee_deque_poll_head (test_deque); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "two") == 0, "test_deque.poll_head () == \"two\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "test_deque.size == 2"); + _tmp27_ = gee_deque_peek_head (test_deque); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "three") == 0, "test_deque.peek_head () == \"three\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_deque_poll_head (test_deque); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "three") == 0, "test_deque.poll_head () == \"three\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "test_deque.size == 1"); + _tmp33_ = gee_deque_peek_head (test_deque); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "four") == 0, "test_deque.peek_head () == \"four\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_deque_poll_head (test_deque); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "four") == 0, "test_deque.poll_head () == \"four\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp38_ = _tmp37_; + _vala_assert (_tmp38_ == 0, "test_deque.size == 0"); + _tmp39_ = gee_deque_peek_head (test_deque); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (_tmp40_ == NULL, "test_deque.peek_head () == null"); + _g_free0 (_tmp40_); + _tmp41_ = gee_deque_poll_head (test_deque); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "test_deque.poll_head () == null"); + _g_free0 (_tmp42_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp43_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp43_, "test_deque.offer_tail (\"one\")"); + _tmp44_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp44_, "test_deque.offer_tail (\"two\")"); + _tmp45_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp45_, "test_deque.offer_tail (\"three\")"); + _tmp46_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp46_, "test_deque.offer_tail (\"four\")"); + _tmp47_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_deque.size == 4"); + _tmp49_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp49_ == 1, "test_deque.drain_head (recipient, 1) == 1"); + _tmp50_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 3, "test_deque.size == 3"); + _tmp52_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_ == 1, "recipient.size == 1"); + _tmp54_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp55_ = (gchar*) _tmp54_; + _vala_assert (g_strcmp0 (_tmp55_, "one") == 0, "recipient.get (0) == \"one\""); + _g_free0 (_tmp55_); + _tmp56_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp56_ == 3, "test_deque.drain_head (recipient) == 3"); + _tmp57_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "test_deque.size == 0"); + _tmp59_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 4, "recipient.size == 4"); + _tmp61_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 1); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "two") == 0, "recipient.get (1) == \"two\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 2); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "three") == 0, "recipient.get (2) == \"three\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 3); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "four") == 0, "recipient.get (3) == \"four\""); + _g_free0 (_tmp66_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp67_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp67_ == 0, "test_deque.drain_head (recipient, 1) == 0"); + _tmp68_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp69_ = _tmp68_; + _vala_assert (_tmp69_ == 0, "test_deque.size == 0"); + _tmp70_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp71_ = _tmp70_; + _vala_assert (_tmp71_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp72_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp72_ == 0, "test_deque.drain_head (recipient) == 0"); + _tmp73_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 0, "test_deque.size == 0"); + _tmp75_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 0, "recipient.size == 0"); + _g_object_unref0 (recipient); + _g_object_unref0 (test_deque); +} + + +void deque_tests_test_stack_use (DequeTests* self) { + GeeCollection* _tmp0_; + GeeDeque* _tmp1_; + GeeDeque* test_deque; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp13_; + gint _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gint _tmp19_; + gint _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gint _tmp25_; + gint _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gint _tmp31_; + gint _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_; + gint _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + gboolean _tmp45_ = FALSE; + gboolean _tmp46_ = FALSE; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_ = 0; + gint _tmp50_; + gint _tmp51_; + gint _tmp52_; + gint _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gint _tmp56_ = 0; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gint _tmp67_ = 0; + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + gint _tmp71_; + gint _tmp72_ = 0; + gint _tmp73_; + gint _tmp74_; + gint _tmp75_; + gint _tmp76_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_DEQUE) ? ((GeeDeque*) _tmp0_) : NULL); + test_deque = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_deque != NULL, "test_deque != null"); + _tmp3_ = gee_deque_offer_head (test_deque, "one"); + _vala_assert (_tmp3_, "test_deque.offer_head (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_deque.size == 1"); + _tmp6_ = gee_deque_offer_head (test_deque, "two"); + _vala_assert (_tmp6_, "test_deque.offer_head (\"two\")"); + _tmp7_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 2, "test_deque.size == 2"); + _tmp9_ = gee_deque_offer_head (test_deque, "three"); + _vala_assert (_tmp9_, "test_deque.offer_head (\"three\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 3, "test_deque.size == 3"); + _tmp12_ = gee_deque_offer_head (test_deque, "four"); + _vala_assert (_tmp12_, "test_deque.offer_head (\"four\")"); + _tmp13_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 4, "test_deque.size == 4"); + _tmp15_ = gee_deque_peek_head (test_deque); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "four") == 0, "test_deque.peek_head () == \"four\""); + _g_free0 (_tmp16_); + _tmp17_ = gee_deque_poll_head (test_deque); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "four") == 0, "test_deque.poll_head () == \"four\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_deque.size == 3"); + _tmp21_ = gee_deque_peek_head (test_deque); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "three") == 0, "test_deque.peek_head () == \"three\""); + _g_free0 (_tmp22_); + _tmp23_ = gee_deque_poll_head (test_deque); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "three") == 0, "test_deque.poll_head () == \"three\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "test_deque.size == 2"); + _tmp27_ = gee_deque_peek_head (test_deque); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "two") == 0, "test_deque.peek_head () == \"two\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_deque_poll_head (test_deque); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "two") == 0, "test_deque.poll_head () == \"two\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "test_deque.size == 1"); + _tmp33_ = gee_deque_peek_head (test_deque); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "one") == 0, "test_deque.peek_head () == \"one\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_deque_poll_head (test_deque); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "one") == 0, "test_deque.poll_head () == \"one\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp38_ = _tmp37_; + _vala_assert (_tmp38_ == 0, "test_deque.size == 0"); + _tmp39_ = gee_deque_peek_head (test_deque); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (_tmp40_ == NULL, "test_deque.peek_head () == null"); + _g_free0 (_tmp40_); + _tmp41_ = gee_deque_poll_head (test_deque); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "test_deque.poll_head () == null"); + _g_free0 (_tmp42_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp43_ = gee_deque_offer_head (test_deque, "one"); + _vala_assert (_tmp43_, "test_deque.offer_head (\"one\")"); + _tmp44_ = gee_deque_offer_head (test_deque, "two"); + _vala_assert (_tmp44_, "test_deque.offer_head (\"two\")"); + _tmp45_ = gee_deque_offer_head (test_deque, "three"); + _vala_assert (_tmp45_, "test_deque.offer_head (\"three\")"); + _tmp46_ = gee_deque_offer_head (test_deque, "four"); + _vala_assert (_tmp46_, "test_deque.offer_head (\"four\")"); + _tmp47_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_deque.size == 4"); + _tmp49_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp49_ == 1, "test_deque.drain_head (recipient, 1) == 1"); + _tmp50_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 3, "test_deque.size == 3"); + _tmp52_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_ == 1, "recipient.size == 1"); + _tmp54_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp55_ = (gchar*) _tmp54_; + _vala_assert (g_strcmp0 (_tmp55_, "four") == 0, "recipient.get (0) == \"four\""); + _g_free0 (_tmp55_); + _tmp56_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp56_ == 3, "test_deque.drain_head (recipient) == 3"); + _tmp57_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "test_deque.size == 0"); + _tmp59_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 4, "recipient.size == 4"); + _tmp61_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 1); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "three") == 0, "recipient.get (1) == \"three\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 2); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "two") == 0, "recipient.get (2) == \"two\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 3); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "one") == 0, "recipient.get (3) == \"one\""); + _g_free0 (_tmp66_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp67_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp67_ == 0, "test_deque.drain_head (recipient, 1) == 0"); + _tmp68_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp69_ = _tmp68_; + _vala_assert (_tmp69_ == 0, "test_deque.size == 0"); + _tmp70_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp71_ = _tmp70_; + _vala_assert (_tmp71_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp72_ = gee_deque_drain_head (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp72_ == 0, "test_deque.drain_head (recipient) == 0"); + _tmp73_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 0, "test_deque.size == 0"); + _tmp75_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 0, "recipient.size == 0"); + _g_object_unref0 (recipient); + _g_object_unref0 (test_deque); +} + + +void deque_tests_test_reversed_stack_use (DequeTests* self) { + GeeCollection* _tmp0_; + GeeDeque* _tmp1_; + GeeDeque* test_deque; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gboolean _tmp12_ = FALSE; + gint _tmp13_; + gint _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gint _tmp19_; + gint _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gint _tmp25_; + gint _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gint _tmp31_; + gint _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_; + gint _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + gboolean _tmp45_ = FALSE; + gboolean _tmp46_ = FALSE; + gint _tmp47_; + gint _tmp48_; + gint _tmp49_ = 0; + gint _tmp50_; + gint _tmp51_; + gint _tmp52_; + gint _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gint _tmp56_ = 0; + gint _tmp57_; + gint _tmp58_; + gint _tmp59_; + gint _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gint _tmp67_ = 0; + gint _tmp68_; + gint _tmp69_; + gint _tmp70_; + gint _tmp71_; + gint _tmp72_ = 0; + gint _tmp73_; + gint _tmp74_; + gint _tmp75_; + gint _tmp76_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_DEQUE) ? ((GeeDeque*) _tmp0_) : NULL); + test_deque = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_deque != NULL, "test_deque != null"); + _tmp3_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp3_, "test_deque.offer_tail (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_deque.size == 1"); + _tmp6_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp6_, "test_deque.offer_tail (\"two\")"); + _tmp7_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 2, "test_deque.size == 2"); + _tmp9_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp9_, "test_deque.offer_tail (\"three\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 3, "test_deque.size == 3"); + _tmp12_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp12_, "test_deque.offer_tail (\"four\")"); + _tmp13_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 4, "test_deque.size == 4"); + _tmp15_ = gee_deque_peek_tail (test_deque); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "four") == 0, "test_deque.peek_tail () == \"four\""); + _g_free0 (_tmp16_); + _tmp17_ = gee_deque_poll_tail (test_deque); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "four") == 0, "test_deque.poll_tail () == \"four\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_deque.size == 3"); + _tmp21_ = gee_deque_peek_tail (test_deque); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "three") == 0, "test_deque.peek_tail () == \"three\""); + _g_free0 (_tmp22_); + _tmp23_ = gee_deque_poll_tail (test_deque); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "three") == 0, "test_deque.poll_tail () == \"three\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "test_deque.size == 2"); + _tmp27_ = gee_deque_peek_tail (test_deque); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "two") == 0, "test_deque.peek_tail () == \"two\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_deque_poll_tail (test_deque); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "two") == 0, "test_deque.poll_tail () == \"two\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "test_deque.size == 1"); + _tmp33_ = gee_deque_peek_tail (test_deque); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "one") == 0, "test_deque.peek_tail () == \"one\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_deque_poll_tail (test_deque); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "one") == 0, "test_deque.poll_tail () == \"one\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp38_ = _tmp37_; + _vala_assert (_tmp38_ == 0, "test_deque.size == 0"); + _tmp39_ = gee_deque_peek_tail (test_deque); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (_tmp40_ == NULL, "test_deque.peek_tail () == null"); + _g_free0 (_tmp40_); + _tmp41_ = gee_deque_poll_tail (test_deque); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "test_deque.poll_tail () == null"); + _g_free0 (_tmp42_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp43_ = gee_deque_offer_tail (test_deque, "one"); + _vala_assert (_tmp43_, "test_deque.offer_tail (\"one\")"); + _tmp44_ = gee_deque_offer_tail (test_deque, "two"); + _vala_assert (_tmp44_, "test_deque.offer_tail (\"two\")"); + _tmp45_ = gee_deque_offer_tail (test_deque, "three"); + _vala_assert (_tmp45_, "test_deque.offer_tail (\"three\")"); + _tmp46_ = gee_deque_offer_tail (test_deque, "four"); + _vala_assert (_tmp46_, "test_deque.offer_tail (\"four\")"); + _tmp47_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp48_ = _tmp47_; + _vala_assert (_tmp48_ == 4, "test_deque.size == 4"); + _tmp49_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp49_ == 1, "test_deque.drain_tail (recipient, 1) == 1"); + _tmp50_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 3, "test_deque.size == 3"); + _tmp52_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_ == 1, "recipient.size == 1"); + _tmp54_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp55_ = (gchar*) _tmp54_; + _vala_assert (g_strcmp0 (_tmp55_, "four") == 0, "recipient.get (0) == \"four\""); + _g_free0 (_tmp55_); + _tmp56_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp56_ == 3, "test_deque.drain_tail (recipient) == 3"); + _tmp57_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "test_deque.size == 0"); + _tmp59_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 4, "recipient.size == 4"); + _tmp61_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 1); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "three") == 0, "recipient.get (1) == \"three\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 2); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "two") == 0, "recipient.get (2) == \"two\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 3); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "one") == 0, "recipient.get (3) == \"one\""); + _g_free0 (_tmp66_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp67_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, 1); + _vala_assert (_tmp67_ == 0, "test_deque.drain_tail (recipient, 1) == 0"); + _tmp68_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp69_ = _tmp68_; + _vala_assert (_tmp69_ == 0, "test_deque.size == 0"); + _tmp70_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp71_ = _tmp70_; + _vala_assert (_tmp71_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp72_ = gee_deque_drain_tail (test_deque, (GeeCollection*) recipient, -1); + _vala_assert (_tmp72_ == 0, "test_deque.drain_tail (recipient) == 0"); + _tmp73_ = gee_collection_get_size ((GeeCollection*) test_deque); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 0, "test_deque.size == 0"); + _tmp75_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 0, "recipient.size == 0"); + _g_object_unref0 (recipient); + _g_object_unref0 (test_deque); +} + + +static void deque_tests_class_init (DequeTestsClass * klass) { + deque_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void deque_tests_instance_init (DequeTests * self) { +} + + +GType deque_tests_get_type (void) { + static volatile gsize deque_tests_type_id__volatile = 0; + if (g_once_init_enter (&deque_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (DequeTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deque_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DequeTests), 0, (GInstanceInitFunc) deque_tests_instance_init, NULL }; + GType deque_tests_type_id; + deque_tests_type_id = g_type_register_static (TYPE_QUEUE_TESTS, "DequeTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&deque_tests_type_id__volatile, deque_tests_type_id); + } + return deque_tests_type_id__volatile; +} + + + diff --git a/tests/testdeque.vala b/tests/testdeque.vala new file mode 100644 index 0000000..d100ce0 --- /dev/null +++ b/tests/testdeque.vala @@ -0,0 +1,225 @@ +/* testdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public abstract class DequeTests : QueueTests { + + public DequeTests (string name) { + base (name); + add_test ("[Deque] queue use", test_queue_use); + add_test ("[Deque] stack use", test_stack_use); + add_test ("[Deque] reversed stack use", test_reversed_stack_use); + } + + public void test_queue_use () { + var test_deque = test_collection as Gee.Deque<string>; + ArrayList<string> recipient = new ArrayList<string> (); + + // Check the test deque is not null + assert (test_deque != null); + + // Check normal FIFO behavior + assert (test_deque.offer_tail ("one")); + assert (test_deque.size == 1); + assert (test_deque.offer_tail ("two")); + assert (test_deque.size == 2); + assert (test_deque.offer_tail ("three")); + assert (test_deque.size == 3); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.peek_head () == "one"); + assert (test_deque.poll_head () == "one"); + assert (test_deque.size == 3); + assert (test_deque.peek_head () == "two"); + assert (test_deque.poll_head () == "two"); + assert (test_deque.size == 2); + assert (test_deque.peek_head () == "three"); + assert (test_deque.poll_head () == "three"); + assert (test_deque.size == 1); + assert (test_deque.peek_head () == "four"); + assert (test_deque.poll_head () == "four"); + assert (test_deque.size == 0); + + // Check normal behavior when no element + assert (test_deque.peek_head () == null); + assert (test_deque.poll_head () == null); + + // Check drain with FIFO behavior + recipient.clear (); + assert (test_deque.offer_tail ("one")); + assert (test_deque.offer_tail ("two")); + assert (test_deque.offer_tail ("three")); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.drain_head (recipient, 1) == 1); + assert (test_deque.size == 3); + assert (recipient.size == 1); + assert (recipient.get (0) == "one"); + assert (test_deque.drain_head (recipient) == 3); + assert (test_deque.size == 0); + assert (recipient.size == 4); + assert (recipient.get (1) == "two"); + assert (recipient.get (2) == "three"); + assert (recipient.get (3) == "four"); + + // Check drain one when no element + recipient.clear (); + assert (test_deque.drain_head (recipient, 1) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + + // Check drain all when no element + recipient.clear (); + assert (test_deque.drain_head (recipient) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + } + + public void test_stack_use () { + var test_deque = test_collection as Gee.Deque<string>; + ArrayList<string> recipient = new ArrayList<string> (); + + // Check the test deque is not null + assert (test_deque != null); + + // Check normal LIFO behavior + assert (test_deque.offer_head ("one")); + assert (test_deque.size == 1); + assert (test_deque.offer_head ("two")); + assert (test_deque.size == 2); + assert (test_deque.offer_head ("three")); + assert (test_deque.size == 3); + assert (test_deque.offer_head ("four")); + assert (test_deque.size == 4); + assert (test_deque.peek_head () == "four"); + assert (test_deque.poll_head () == "four"); + assert (test_deque.size == 3); + assert (test_deque.peek_head () == "three"); + assert (test_deque.poll_head () == "three"); + assert (test_deque.size == 2); + assert (test_deque.peek_head () == "two"); + assert (test_deque.poll_head () == "two"); + assert (test_deque.size == 1); + assert (test_deque.peek_head () == "one"); + assert (test_deque.poll_head () == "one"); + assert (test_deque.size == 0); + + // Check normal behavior when no element + assert (test_deque.peek_head () == null); + assert (test_deque.poll_head () == null); + + // Check drain with LIFO behavior + recipient.clear (); + assert (test_deque.offer_head ("one")); + assert (test_deque.offer_head ("two")); + assert (test_deque.offer_head ("three")); + assert (test_deque.offer_head ("four")); + assert (test_deque.size == 4); + assert (test_deque.drain_head (recipient, 1) == 1); + assert (test_deque.size == 3); + assert (recipient.size == 1); + assert (recipient.get (0) == "four"); + assert (test_deque.drain_head (recipient) == 3); + assert (test_deque.size == 0); + assert (recipient.size == 4); + assert (recipient.get (1) == "three"); + assert (recipient.get (2) == "two"); + assert (recipient.get (3) == "one"); + + // Check drain one when no element + recipient.clear (); + assert (test_deque.drain_head (recipient, 1) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + + // Check drain all when no element + recipient.clear (); + assert (test_deque.drain_head (recipient) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + } + + public void test_reversed_stack_use () { + var test_deque = test_collection as Gee.Deque<string>; + ArrayList<string> recipient = new ArrayList<string> (); + + // Check the test deque is not null + assert (test_deque != null); + + // Check normal LIFO behavior + assert (test_deque.offer_tail ("one")); + assert (test_deque.size == 1); + assert (test_deque.offer_tail ("two")); + assert (test_deque.size == 2); + assert (test_deque.offer_tail ("three")); + assert (test_deque.size == 3); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.peek_tail () == "four"); + assert (test_deque.poll_tail () == "four"); + assert (test_deque.size == 3); + assert (test_deque.peek_tail () == "three"); + assert (test_deque.poll_tail () == "three"); + assert (test_deque.size == 2); + assert (test_deque.peek_tail () == "two"); + assert (test_deque.poll_tail () == "two"); + assert (test_deque.size == 1); + assert (test_deque.peek_tail () == "one"); + assert (test_deque.poll_tail () == "one"); + assert (test_deque.size == 0); + + // Check normal behavior when no element + assert (test_deque.peek_tail () == null); + assert (test_deque.poll_tail () == null); + + // Check drain with LIFO behavior + recipient.clear (); + assert (test_deque.offer_tail ("one")); + assert (test_deque.offer_tail ("two")); + assert (test_deque.offer_tail ("three")); + assert (test_deque.offer_tail ("four")); + assert (test_deque.size == 4); + assert (test_deque.drain_tail (recipient, 1) == 1); + assert (test_deque.size == 3); + assert (recipient.size == 1); + assert (recipient.get (0) == "four"); + assert (test_deque.drain_tail (recipient) == 3); + assert (test_deque.size == 0); + assert (recipient.size == 4); + assert (recipient.get (1) == "three"); + assert (recipient.get (2) == "two"); + assert (recipient.get (3) == "one"); + + // Check drain one when no element + recipient.clear (); + assert (test_deque.drain_tail (recipient, 1) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + + // Check drain all when no element + recipient.clear (); + assert (test_deque.drain_tail (recipient) == 0); + assert (test_deque.size == 0); + assert (recipient.size == 0); + } +} diff --git a/tests/testhashmap.c b/tests/testhashmap.c new file mode 100644 index 0000000..9f826ed --- /dev/null +++ b/tests/testhashmap.c @@ -0,0 +1,285 @@ +/* testhashmap.c generated by valac 0.18.0, the Vala compiler + * generated from testhashmap.vala, do not modify */ + +/* testhashmap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; +typedef struct _MapTestsPrivate MapTestsPrivate; + +#define TYPE_HASH_MAP_TESTS (hash_map_tests_get_type ()) +#define HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MAP_TESTS, HashMapTests)) +#define HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) +#define IS_HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MAP_TESTS)) +#define IS_HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MAP_TESTS)) +#define HASH_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) + +typedef struct _HashMapTests HashMapTests; +typedef struct _HashMapTestsClass HashMapTestsClass; +typedef struct _HashMapTestsPrivate HashMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MapTests { + GeeTestCase parent_instance; + MapTestsPrivate * priv; + GeeMap* test_map; +}; + +struct _MapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _HashMapTests { + MapTests parent_instance; + HashMapTestsPrivate * priv; +}; + +struct _HashMapTestsClass { + MapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType map_tests_get_type (void) G_GNUC_CONST; +GType hash_map_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_MAP_TESTS_DUMMY_PROPERTY +}; +HashMapTests* hash_map_tests_new (void); +HashMapTests* hash_map_tests_construct (GType object_type); +MapTests* map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void hash_map_tests_test_selected_functions (HashMapTests* self); +static void _hash_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void hash_map_tests_test_gobject_properties (HashMapTests* self); +static void _hash_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void hash_map_tests_real_set_up (GeeTestCase* base); +static void hash_map_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_map_tests_test_selected_functions (self); +} + + +static void _hash_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + hash_map_tests_test_gobject_properties (self); +} + + +HashMapTests* hash_map_tests_construct (GType object_type) { + HashMapTests * self = NULL; + self = (HashMapTests*) map_tests_construct (object_type, "HashMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMap] selected functions", _hash_map_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMap] GObject properties", _hash_map_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +HashMapTests* hash_map_tests_new (void) { + return hash_map_tests_construct (TYPE_HASH_MAP_TESTS); +} + + +static void hash_map_tests_real_set_up (GeeTestCase* base) { + HashMapTests * self; + GeeHashMap* _tmp0_; + self = (HashMapTests*) base; + _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = (GeeMap*) _tmp0_; +} + + +static void hash_map_tests_real_tear_down (GeeTestCase* base) { + HashMapTests * self; + self = (HashMapTests*) base; + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void hash_map_tests_test_selected_functions (HashMapTests* self) { + GeeMap* _tmp0_; + GeeHashMap* _tmp1_; + GeeHashMap* test_hash_map; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + GEqualFunc _tmp8_; + GEqualFunc _tmp9_; + GEqualFunc _tmp10_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MAP) ? ((GeeHashMap*) _tmp0_) : NULL); + test_hash_map = _tmp1_; + _vala_assert (test_hash_map != NULL, "test_hash_map != null"); + _tmp2_ = gee_hash_map_get_key_hash_func (test_hash_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_hash_map.key_hash_func == str_hash"); + _tmp5_ = gee_hash_map_get_key_equal_func (test_hash_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_hash_map.key_equal_func == str_equal"); + _tmp8_ = gee_hash_map_get_value_equal_func (test_hash_map); + _tmp9_ = _tmp8_; + _tmp10_ = g_str_equal; + _vala_assert (_tmp9_ == _tmp10_, "test_hash_map.value_equal_func == str_equal"); + _g_object_unref0 (test_hash_map); +} + + +void hash_map_tests_test_gobject_properties (HashMapTests* self) { + GeeMap* _tmp0_; + GeeHashMap* _tmp1_; + GeeHashMap* test_hash_map; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GHashFunc _tmp5_; + GHashFunc _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + void* _tmp9_ = NULL; + GEqualFunc _tmp10_; + GEqualFunc _tmp11_; + GValue _tmp12_ = {0}; + GValue _tmp13_; + void* _tmp14_ = NULL; + GEqualFunc _tmp15_; + GEqualFunc _tmp16_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MAP) ? ((GeeHashMap*) _tmp0_) : NULL); + test_hash_map = _tmp1_; + _vala_assert (test_hash_map != NULL, "test_hash_map != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_hash_map, "key-hash-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_hash_map_get_key_hash_func (test_hash_map); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_hash_map.key_hash_func"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_hash_map, "key-equal-func", &value); + _tmp9_ = g_value_get_pointer (&value); + _tmp10_ = gee_hash_map_get_key_equal_func (test_hash_map); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == ((void*) _tmp11_), "value.get_pointer () == (void*) test_hash_map.key_equal_func"); + g_value_unset (&value); + g_value_init (&_tmp12_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp12_; + _tmp13_ = value; + g_object_get_property ((GObject*) test_hash_map, "value-equal-func", &value); + _tmp14_ = g_value_get_pointer (&value); + _tmp15_ = gee_hash_map_get_value_equal_func (test_hash_map); + _tmp16_ = _tmp15_; + _vala_assert (_tmp14_ == ((void*) _tmp16_), "value.get_pointer () == (void*) test_hash_map.value_equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_hash_map); +} + + +static void hash_map_tests_class_init (HashMapTestsClass * klass) { + hash_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_map_tests_real_tear_down; +} + + +static void hash_map_tests_instance_init (HashMapTests * self) { +} + + +GType hash_map_tests_get_type (void) { + static volatile gsize hash_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMapTests), 0, (GInstanceInitFunc) hash_map_tests_instance_init, NULL }; + GType hash_map_tests_type_id; + hash_map_tests_type_id = g_type_register_static (TYPE_MAP_TESTS, "HashMapTests", &g_define_type_info, 0); + g_once_init_leave (&hash_map_tests_type_id__volatile, hash_map_tests_type_id); + } + return hash_map_tests_type_id__volatile; +} + + + diff --git a/tests/testhashmap.vala b/tests/testhashmap.vala new file mode 100644 index 0000000..6ea5582 --- /dev/null +++ b/tests/testhashmap.vala @@ -0,0 +1,76 @@ +/* testhashmap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class HashMapTests : MapTests { + + public HashMapTests () { + base ("HashMap"); + add_test ("[HashMap] selected functions", test_selected_functions); + add_test ("[HashMap] GObject properties", test_gobject_properties); + } + + public override void set_up () { + test_map = new HashMap<string,string> (); + } + + public override void tear_down () { + test_map = null; + } + + public void test_selected_functions () { + var test_hash_map = test_map as HashMap<string,string>; + + // Check the map exists + assert (test_hash_map != null); + + // Check the selected hash and equal functions + assert (test_hash_map.key_hash_func == str_hash); + assert (test_hash_map.key_equal_func == str_equal); + assert (test_hash_map.value_equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_hash_map = test_map as HashMap<string,string>; + + // Check the list exists + assert (test_hash_map != null); + Value value; + + value = Value (typeof (HashFunc)); + test_hash_map.get_property ("key-hash-func", ref value); + assert (value.get_pointer () == (void*) test_hash_map.key_hash_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_hash_map.get_property ("key-equal-func", ref value); + assert (value.get_pointer () == (void*) test_hash_map.key_equal_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_hash_map.get_property ("value-equal-func", ref value); + assert (value.get_pointer () == (void*) test_hash_map.value_equal_func); + value.unset (); + } +} diff --git a/tests/testhashmultimap.c b/tests/testhashmultimap.c new file mode 100644 index 0000000..1e29589 --- /dev/null +++ b/tests/testhashmultimap.c @@ -0,0 +1,226 @@ +/* testhashmultimap.c generated by valac 0.18.0, the Vala compiler + * generated from testhashmultimap.vala, do not modify */ + +/* testhashmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; +typedef struct _MultiMapTestsPrivate MultiMapTestsPrivate; + +#define TYPE_HASH_MULTI_MAP_TESTS (hash_multi_map_tests_get_type ()) +#define HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTests)) +#define HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) +#define IS_HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_MAP_TESTS)) +#define IS_HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_MAP_TESTS)) +#define HASH_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) + +typedef struct _HashMultiMapTests HashMultiMapTests; +typedef struct _HashMultiMapTestsClass HashMultiMapTestsClass; +typedef struct _HashMultiMapTestsPrivate HashMultiMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MultiMapTests { + GeeTestCase parent_instance; + MultiMapTestsPrivate * priv; + GeeMultiMap* test_multi_map; +}; + +struct _MultiMapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _HashMultiMapTests { + MultiMapTests parent_instance; + HashMultiMapTestsPrivate * priv; +}; + +struct _HashMultiMapTestsClass { + MultiMapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_multi_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType multi_map_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_map_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_MULTI_MAP_TESTS_DUMMY_PROPERTY +}; +HashMultiMapTests* hash_multi_map_tests_new (void); +HashMultiMapTests* hash_multi_map_tests_construct (GType object_type); +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void hash_multi_map_tests_test_selected_functions (HashMultiMapTests* self); +static void _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void hash_multi_map_tests_real_set_up (GeeTestCase* base); +static void hash_multi_map_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_multi_map_tests_test_selected_functions (self); +} + + +HashMultiMapTests* hash_multi_map_tests_construct (GType object_type) { + HashMultiMapTests * self = NULL; + self = (HashMultiMapTests*) multi_map_tests_construct (object_type, "HashMultiMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMultiMap] selected functions", _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +HashMultiMapTests* hash_multi_map_tests_new (void) { + return hash_multi_map_tests_construct (TYPE_HASH_MULTI_MAP_TESTS); +} + + +static void hash_multi_map_tests_real_set_up (GeeTestCase* base) { + HashMultiMapTests * self; + GeeHashMultiMap* _tmp0_; + self = (HashMultiMapTests*) base; + _tmp0_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL); + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = (GeeMultiMap*) _tmp0_; +} + + +static void hash_multi_map_tests_real_tear_down (GeeTestCase* base) { + HashMultiMapTests * self; + self = (HashMultiMapTests*) base; + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void hash_multi_map_tests_test_selected_functions (HashMultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeHashMultiMap* _tmp1_; + GeeHashMultiMap* test_hash_multi_map; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + GHashFunc _tmp8_; + GHashFunc _tmp9_; + GHashFunc _tmp10_; + GEqualFunc _tmp11_; + GEqualFunc _tmp12_; + GEqualFunc _tmp13_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MultiMapTests*) self)->test_multi_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MULTI_MAP) ? ((GeeHashMultiMap*) _tmp0_) : NULL); + test_hash_multi_map = _tmp1_; + _vala_assert (test_hash_multi_map != NULL, "test_hash_multi_map != null"); + _tmp2_ = gee_hash_multi_map_get_key_hash_func (test_hash_multi_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_hash_multi_map.key_hash_func == str_hash"); + _tmp5_ = gee_hash_multi_map_get_key_equal_func (test_hash_multi_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_hash_multi_map.key_equal_func == str_equal"); + _tmp8_ = gee_hash_multi_map_get_value_hash_func (test_hash_multi_map); + _tmp9_ = _tmp8_; + _tmp10_ = g_str_hash; + _vala_assert (_tmp9_ == _tmp10_, "test_hash_multi_map.value_hash_func == str_hash"); + _tmp11_ = gee_hash_multi_map_get_value_equal_func (test_hash_multi_map); + _tmp12_ = _tmp11_; + _tmp13_ = g_str_equal; + _vala_assert (_tmp12_ == _tmp13_, "test_hash_multi_map.value_equal_func == str_equal"); + _g_object_unref0 (test_hash_multi_map); +} + + +static void hash_multi_map_tests_class_init (HashMultiMapTestsClass * klass) { + hash_multi_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_multi_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_multi_map_tests_real_tear_down; +} + + +static void hash_multi_map_tests_instance_init (HashMultiMapTests * self) { +} + + +GType hash_multi_map_tests_get_type (void) { + static volatile gsize hash_multi_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_multi_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashMultiMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_multi_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMultiMapTests), 0, (GInstanceInitFunc) hash_multi_map_tests_instance_init, NULL }; + GType hash_multi_map_tests_type_id; + hash_multi_map_tests_type_id = g_type_register_static (TYPE_MULTI_MAP_TESTS, "HashMultiMapTests", &g_define_type_info, 0); + g_once_init_leave (&hash_multi_map_tests_type_id__volatile, hash_multi_map_tests_type_id); + } + return hash_multi_map_tests_type_id__volatile; +} + + + diff --git a/tests/testhashmultimap.vala b/tests/testhashmultimap.vala new file mode 100644 index 0000000..160985b --- /dev/null +++ b/tests/testhashmultimap.vala @@ -0,0 +1,55 @@ +/* testhashmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class HashMultiMapTests : MultiMapTests { + + public HashMultiMapTests () { + base ("HashMultiMap"); + add_test ("[HashMultiMap] selected functions", test_selected_functions); + } + + public override void set_up () { + test_multi_map = new HashMultiMap<string,string> (); + } + + public override void tear_down () { + test_multi_map = null; + } + + private void test_selected_functions () { + var test_hash_multi_map = test_multi_map as HashMultiMap<string,string>; + + // Check the map exists + assert (test_hash_multi_map != null); + + // Check the selected hash and equal functions + assert (test_hash_multi_map.key_hash_func == str_hash); + assert (test_hash_multi_map.key_equal_func == str_equal); + assert (test_hash_multi_map.value_hash_func == str_hash); + assert (test_hash_multi_map.value_equal_func == str_equal); + } +} diff --git a/tests/testhashmultiset.c b/tests/testhashmultiset.c new file mode 100644 index 0000000..31adc39 --- /dev/null +++ b/tests/testhashmultiset.c @@ -0,0 +1,233 @@ +/* testhashmultiset.c generated by valac 0.18.0, the Vala compiler + * generated from testhashmultiset.vala, do not modify */ + +/* testhashmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; +typedef struct _MultiSetTestsPrivate MultiSetTestsPrivate; + +#define TYPE_HASH_MULTI_SET_TESTS (hash_multi_set_tests_get_type ()) +#define HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTests)) +#define HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) +#define IS_HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_SET_TESTS)) +#define IS_HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_SET_TESTS)) +#define HASH_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) + +typedef struct _HashMultiSetTests HashMultiSetTests; +typedef struct _HashMultiSetTestsClass HashMultiSetTestsClass; +typedef struct _HashMultiSetTestsPrivate HashMultiSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _MultiSetTests { + CollectionTests parent_instance; + MultiSetTestsPrivate * priv; +}; + +struct _MultiSetTestsClass { + CollectionTestsClass parent_class; +}; + +struct _HashMultiSetTests { + MultiSetTests parent_instance; + HashMultiSetTestsPrivate * priv; +}; + +struct _HashMultiSetTestsClass { + MultiSetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_multi_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType multi_set_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_set_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_MULTI_SET_TESTS_DUMMY_PROPERTY +}; +HashMultiSetTests* hash_multi_set_tests_new (void); +HashMultiSetTests* hash_multi_set_tests_construct (GType object_type); +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void hash_multi_set_tests_test_selected_functions (HashMultiSetTests* self); +static void _hash_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void hash_multi_set_tests_real_set_up (GeeTestCase* base); +static void hash_multi_set_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_multi_set_tests_test_selected_functions (self); +} + + +HashMultiSetTests* hash_multi_set_tests_construct (GType object_type) { + HashMultiSetTests * self = NULL; + self = (HashMultiSetTests*) multi_set_tests_construct (object_type, "HashMultiSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashMultiSet] selected functions", _hash_multi_set_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +HashMultiSetTests* hash_multi_set_tests_new (void) { + return hash_multi_set_tests_construct (TYPE_HASH_MULTI_SET_TESTS); +} + + +static void hash_multi_set_tests_real_set_up (GeeTestCase* base) { + HashMultiSetTests * self; + GeeHashMultiSet* _tmp0_; + self = (HashMultiSetTests*) base; + _tmp0_ = gee_hash_multi_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void hash_multi_set_tests_real_tear_down (GeeTestCase* base) { + HashMultiSetTests * self; + self = (HashMultiSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void hash_multi_set_tests_test_selected_functions (HashMultiSetTests* self) { + GeeCollection* _tmp0_; + GeeHashMultiSet* _tmp1_; + GeeHashMultiSet* test_multi_set; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MULTI_SET) ? ((GeeHashMultiSet*) _tmp0_) : NULL); + test_multi_set = _tmp1_; + _vala_assert (test_multi_set != NULL, "test_multi_set != null"); + _tmp2_ = gee_hash_multi_set_get_hash_func (test_multi_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_multi_set.hash_func == str_hash"); + _tmp5_ = gee_hash_multi_set_get_equal_func (test_multi_set); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_multi_set.equal_func == str_equal"); + _g_object_unref0 (test_multi_set); +} + + +static void hash_multi_set_tests_class_init (HashMultiSetTestsClass * klass) { + hash_multi_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_multi_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_multi_set_tests_real_tear_down; +} + + +static void hash_multi_set_tests_instance_init (HashMultiSetTests * self) { +} + + +GType hash_multi_set_tests_get_type (void) { + static volatile gsize hash_multi_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_multi_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashMultiSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_multi_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMultiSetTests), 0, (GInstanceInitFunc) hash_multi_set_tests_instance_init, NULL }; + GType hash_multi_set_tests_type_id; + hash_multi_set_tests_type_id = g_type_register_static (TYPE_MULTI_SET_TESTS, "HashMultiSetTests", &g_define_type_info, 0); + g_once_init_leave (&hash_multi_set_tests_type_id__volatile, hash_multi_set_tests_type_id); + } + return hash_multi_set_tests_type_id__volatile; +} + + + diff --git a/tests/testhashmultiset.vala b/tests/testhashmultiset.vala new file mode 100644 index 0000000..13b951c --- /dev/null +++ b/tests/testhashmultiset.vala @@ -0,0 +1,53 @@ +/* testhashmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class HashMultiSetTests : MultiSetTests { + + public HashMultiSetTests () { + base ("HashMultiSet"); + add_test ("[HashMultiSet] selected functions", test_selected_functions); + } + + public override void set_up () { + test_collection = new HashMultiSet<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_multi_set = test_collection as HashMultiSet<string>; + + // Check the collection exists + assert (test_multi_set != null); + + // Check the selected hash and equal functions + assert (test_multi_set.hash_func == str_hash); + assert (test_multi_set.equal_func == str_equal); + } +} diff --git a/tests/testhashset.c b/tests/testhashset.c new file mode 100644 index 0000000..59710db --- /dev/null +++ b/tests/testhashset.c @@ -0,0 +1,285 @@ +/* testhashset.c generated by valac 0.18.0, the Vala compiler + * generated from testhashset.vala, do not modify */ + +/* testhashset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; + +#define TYPE_HASH_SET_TESTS (hash_set_tests_get_type ()) +#define HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_SET_TESTS, HashSetTests)) +#define HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_SET_TESTS, HashSetTestsClass)) +#define IS_HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_SET_TESTS)) +#define IS_HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_SET_TESTS)) +#define HASH_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_SET_TESTS, HashSetTestsClass)) + +typedef struct _HashSetTests HashSetTests; +typedef struct _HashSetTestsClass HashSetTestsClass; +typedef struct _HashSetTestsPrivate HashSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +struct _HashSetTests { + SetTests parent_instance; + HashSetTestsPrivate * priv; +}; + +struct _HashSetTestsClass { + SetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer hash_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +GType hash_set_tests_get_type (void) G_GNUC_CONST; +enum { + HASH_SET_TESTS_DUMMY_PROPERTY +}; +HashSetTests* hash_set_tests_new (void); +HashSetTests* hash_set_tests_construct (GType object_type); +SetTests* set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void hash_set_tests_test_selected_functions (HashSetTests* self); +static void _hash_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void hash_set_tests_test_gobject_properties (HashSetTests* self); +static void _hash_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void hash_set_tests_real_set_up (GeeTestCase* base); +static void hash_set_tests_real_tear_down (GeeTestCase* base); + + +static void _hash_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + hash_set_tests_test_selected_functions (self); +} + + +static void _hash_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + hash_set_tests_test_gobject_properties (self); +} + + +HashSetTests* hash_set_tests_construct (GType object_type) { + HashSetTests * self = NULL; + self = (HashSetTests*) set_tests_construct (object_type, "HashSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[HashSet] selected functions", _hash_set_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[HashSet] GObject properties", _hash_set_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +HashSetTests* hash_set_tests_new (void) { + return hash_set_tests_construct (TYPE_HASH_SET_TESTS); +} + + +static void hash_set_tests_real_set_up (GeeTestCase* base) { + HashSetTests * self; + GeeHashSet* _tmp0_; + self = (HashSetTests*) base; + _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void hash_set_tests_real_tear_down (GeeTestCase* base) { + HashSetTests * self; + self = (HashSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void hash_set_tests_test_selected_functions (HashSetTests* self) { + GeeCollection* _tmp0_; + GeeHashSet* _tmp1_; + GeeHashSet* test_set; + GHashFunc _tmp2_; + GHashFunc _tmp3_; + GHashFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_SET) ? ((GeeHashSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + _tmp2_ = gee_hash_set_get_hash_func (test_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_hash; + _vala_assert (_tmp3_ == _tmp4_, "test_set.hash_func == str_hash"); + _tmp5_ = gee_hash_set_get_equal_func (test_set); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_set.equal_func == str_equal"); + _g_object_unref0 (test_set); +} + + +void hash_set_tests_test_gobject_properties (HashSetTests* self) { + GeeCollection* _tmp0_; + GeeHashSet* _tmp1_; + GeeHashSet* test_set; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GHashFunc _tmp5_; + GHashFunc _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + void* _tmp9_ = NULL; + GEqualFunc _tmp10_; + GEqualFunc _tmp11_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_SET) ? ((GeeHashSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_set, "hash-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_hash_set_get_hash_func (test_set); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_set.hash_func"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_set, "equal-func", &value); + _tmp9_ = g_value_get_pointer (&value); + _tmp10_ = gee_hash_set_get_equal_func (test_set); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == ((void*) _tmp11_), "value.get_pointer () == (void*) test_set.equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_set); +} + + +static void hash_set_tests_class_init (HashSetTestsClass * klass) { + hash_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = hash_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = hash_set_tests_real_tear_down; +} + + +static void hash_set_tests_instance_init (HashSetTests * self) { +} + + +GType hash_set_tests_get_type (void) { + static volatile gsize hash_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&hash_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (HashSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashSetTests), 0, (GInstanceInitFunc) hash_set_tests_instance_init, NULL }; + GType hash_set_tests_type_id; + hash_set_tests_type_id = g_type_register_static (TYPE_SET_TESTS, "HashSetTests", &g_define_type_info, 0); + g_once_init_leave (&hash_set_tests_type_id__volatile, hash_set_tests_type_id); + } + return hash_set_tests_type_id__volatile; +} + + + diff --git a/tests/testhashset.vala b/tests/testhashset.vala new file mode 100644 index 0000000..b252c19 --- /dev/null +++ b/tests/testhashset.vala @@ -0,0 +1,70 @@ +/* testhashset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class HashSetTests : SetTests { + + public HashSetTests () { + base ("HashSet"); + add_test ("[HashSet] selected functions", test_selected_functions); + add_test ("[HashSet] GObject properties", test_gobject_properties); + } + + public override void set_up () { + test_collection = new HashSet<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + public void test_selected_functions () { + var test_set = test_collection as HashSet<string>; + + // Check the map exists + assert (test_set != null); + + // Check the selected hash and equal functions + assert (test_set.hash_func == str_hash); + assert (test_set.equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_set = test_collection as HashSet<string>; + + // Check the list exists + assert (test_set != null); + Value value; + + value = Value (typeof (HashFunc)); + test_set.get_property ("hash-func", ref value); + assert (value.get_pointer () == (void*) test_set.hash_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_set.get_property ("equal-func", ref value); + assert (value.get_pointer () == (void*) test_set.equal_func); + value.unset (); + } +} diff --git a/tests/testlinkedlist.c b/tests/testlinkedlist.c new file mode 100644 index 0000000..a4113f3 --- /dev/null +++ b/tests/testlinkedlist.c @@ -0,0 +1,371 @@ +/* testlinkedlist.c generated by valac 0.18.0, the Vala compiler + * generated from testlinkedlist.vala, do not modify */ + +/* testlinkedlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Jürg Billeter <j@bitron.ch> + * Mark Lee <marklee@src.gnome.org> (port to LinkedList) + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; +typedef struct _ListTestsPrivate ListTestsPrivate; + +#define TYPE_LINKED_LIST_TESTS (linked_list_tests_get_type ()) +#define LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTests)) +#define LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) +#define IS_LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_TESTS)) +#define IS_LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_TESTS)) +#define LINKED_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) + +typedef struct _LinkedListTests LinkedListTests; +typedef struct _LinkedListTestsClass LinkedListTestsClass; +typedef struct _LinkedListTestsPrivate LinkedListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _ListTests { + CollectionTests parent_instance; + ListTestsPrivate * priv; +}; + +struct _ListTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_retained) (ListTests* self); +}; + +struct _LinkedListTests { + ListTests parent_instance; + LinkedListTestsPrivate * priv; +}; + +struct _LinkedListTestsClass { + ListTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer linked_list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +GType linked_list_tests_get_type (void) G_GNUC_CONST; +enum { + LINKED_LIST_TESTS_DUMMY_PROPERTY +}; +LinkedListTests* linked_list_tests_new (void); +LinkedListTests* linked_list_tests_construct (GType object_type); +ListTests* list_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void linked_list_tests_test_selected_functions (LinkedListTests* self); +static void _linked_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void linked_list_tests_test_gobject_properties (LinkedListTests* self); +static void _linked_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void linked_list_tests_test_sort (LinkedListTests* self); +static void _linked_list_tests_test_sort_gee_test_case_test_method (gpointer self); +static void linked_list_tests_real_set_up (GeeTestCase* base); +static void linked_list_tests_real_tear_down (GeeTestCase* base); + + +static void _linked_list_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + linked_list_tests_test_selected_functions (self); +} + + +static void _linked_list_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + linked_list_tests_test_gobject_properties (self); +} + + +static void _linked_list_tests_test_sort_gee_test_case_test_method (gpointer self) { + linked_list_tests_test_sort (self); +} + + +LinkedListTests* linked_list_tests_construct (GType object_type) { + LinkedListTests * self = NULL; + self = (LinkedListTests*) list_tests_construct (object_type, "LinkedList"); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] selected functions", _linked_list_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] GObject properties", _linked_list_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] sort", _linked_list_tests_test_sort_gee_test_case_test_method, self); + return self; +} + + +LinkedListTests* linked_list_tests_new (void) { + return linked_list_tests_construct (TYPE_LINKED_LIST_TESTS); +} + + +static void linked_list_tests_real_set_up (GeeTestCase* base) { + LinkedListTests * self; + GeeLinkedList* _tmp0_; + self = (LinkedListTests*) base; + _tmp0_ = gee_linked_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void linked_list_tests_real_tear_down (GeeTestCase* base) { + LinkedListTests * self; + self = (LinkedListTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void linked_list_tests_test_selected_functions (LinkedListTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + GEqualFunc _tmp2_; + GEqualFunc _tmp3_; + GEqualFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_linked_list_get_equal_func (test_list); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_equal; + _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal"); + _g_object_unref0 (test_list); +} + + +void linked_list_tests_test_gobject_properties (LinkedListTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_list, "equal-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_linked_list_get_equal_func (test_list); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_list.equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_list); +} + + +static void linked_list_tests_test_sort (LinkedListTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gpointer _tmp6_ = NULL; + gchar* _tmp7_; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "one"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "two"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "three"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "four"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "five"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "six"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "seven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eight"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "nine"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "ten"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "eleven"); + gee_abstract_collection_add ((GeeAbstractCollection*) test_list, "twelve"); + gee_list_sort ((GeeList*) test_list, NULL); + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 0); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (g_strcmp0 (_tmp3_, "eight") == 0, "test_list.get (0) == \"eight\""); + _g_free0 (_tmp3_); + _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 1); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "eleven") == 0, "test_list.get (1) == \"eleven\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 2); + _tmp7_ = (gchar*) _tmp6_; + _vala_assert (g_strcmp0 (_tmp7_, "five") == 0, "test_list.get (2) == \"five\""); + _g_free0 (_tmp7_); + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 3); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "four") == 0, "test_list.get (3) == \"four\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 4); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "nine") == 0, "test_list.get (4) == \"nine\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 5); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_list.get (5) == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 6); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "seven") == 0, "test_list.get (6) == \"seven\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 7); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_list.get (7) == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 8); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "ten") == 0, "test_list.get (8) == \"ten\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 9); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "three") == 0, "test_list.get (9) == \"three\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 10); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "twelve") == 0, "test_list.get (10) == \"twelve\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_abstract_list_get ((GeeAbstractList*) test_list, 11); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (11) == \"two\""); + _g_free0 (_tmp25_); + _g_object_unref0 (test_list); +} + + +static void linked_list_tests_class_init (LinkedListTestsClass * klass) { + linked_list_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = linked_list_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = linked_list_tests_real_tear_down; +} + + +static void linked_list_tests_instance_init (LinkedListTests * self) { +} + + +GType linked_list_tests_get_type (void) { + static volatile gsize linked_list_tests_type_id__volatile = 0; + if (g_once_init_enter (&linked_list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (LinkedListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) linked_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LinkedListTests), 0, (GInstanceInitFunc) linked_list_tests_instance_init, NULL }; + GType linked_list_tests_type_id; + linked_list_tests_type_id = g_type_register_static (TYPE_LIST_TESTS, "LinkedListTests", &g_define_type_info, 0); + g_once_init_leave (&linked_list_tests_type_id__volatile, linked_list_tests_type_id); + } + return linked_list_tests_type_id__volatile; +} + + + diff --git a/tests/testlinkedlist.vala b/tests/testlinkedlist.vala new file mode 100644 index 0000000..737b6e3 --- /dev/null +++ b/tests/testlinkedlist.vala @@ -0,0 +1,101 @@ +/* testlinkedlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Jürg Billeter <j@bitron.ch> + * Mark Lee <marklee@src.gnome.org> (port to LinkedList) + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class LinkedListTests : ListTests { + + public LinkedListTests () { + base ("LinkedList"); + add_test ("[LinkedList] selected functions", test_selected_functions); + add_test ("[LinkedList] GObject properties", test_gobject_properties); + add_test ("[LinkedList] sort", test_sort); + } + + public override void set_up () { + test_collection = new LinkedList<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_list = test_collection as LinkedList<string>; + + // Check the collection exists + assert (test_list != null); + + // Check the selected equal function + assert (test_list.equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_list = test_collection as LinkedList<string>; + + // Check the list exists + assert (test_list != null); + Value value; + + value = Value (typeof (EqualFunc)); + test_list.get_property ("equal-func", ref value); + assert (value.get_pointer () == (void*) test_list.equal_func); + value.unset (); + } + + private void test_sort () { + var test_list = test_collection as LinkedList<string>; + + // Check the collection exists + assert (test_list != null); + + test_list.add ("one"); + test_list.add ("two"); + test_list.add ("three"); + test_list.add ("four"); + test_list.add ("five"); + test_list.add ("six"); + test_list.add ("seven"); + test_list.add ("eight"); + test_list.add ("nine"); + test_list.add ("ten"); + test_list.add ("eleven"); + test_list.add ("twelve"); + + test_list.sort (); + + assert (test_list.get (0) == "eight"); + assert (test_list.get (1) == "eleven"); + assert (test_list.get (2) == "five"); + assert (test_list.get (3) == "four"); + assert (test_list.get (4) == "nine"); + assert (test_list.get (5) == "one"); + assert (test_list.get (6) == "seven"); + assert (test_list.get (7) == "six"); + assert (test_list.get (8) == "ten"); + assert (test_list.get (9) == "three"); + assert (test_list.get (10) == "twelve"); + assert (test_list.get (11) == "two"); + } +} diff --git a/tests/testlinkedlistasdeque.c b/tests/testlinkedlistasdeque.c new file mode 100644 index 0000000..2bc8f68 --- /dev/null +++ b/tests/testlinkedlistasdeque.c @@ -0,0 +1,244 @@ +/* testlinkedlistasdeque.c generated by valac 0.18.0, the Vala compiler + * generated from testlinkedlistasdeque.vala, do not modify */ + +/* testlinkedlistasdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; + +#define TYPE_DEQUE_TESTS (deque_tests_get_type ()) +#define DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEQUE_TESTS, DequeTests)) +#define DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEQUE_TESTS, DequeTestsClass)) +#define IS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEQUE_TESTS)) +#define IS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEQUE_TESTS)) +#define DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEQUE_TESTS, DequeTestsClass)) + +typedef struct _DequeTests DequeTests; +typedef struct _DequeTestsClass DequeTestsClass; +typedef struct _DequeTestsPrivate DequeTestsPrivate; + +#define TYPE_LINKED_LIST_AS_DEQUE_TESTS (linked_list_as_deque_tests_get_type ()) +#define LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTests)) +#define LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define LINKED_LIST_AS_DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) + +typedef struct _LinkedListAsDequeTests LinkedListAsDequeTests; +typedef struct _LinkedListAsDequeTestsClass LinkedListAsDequeTestsClass; +typedef struct _LinkedListAsDequeTestsPrivate LinkedListAsDequeTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +struct _DequeTests { + QueueTests parent_instance; + DequeTestsPrivate * priv; +}; + +struct _DequeTestsClass { + QueueTestsClass parent_class; +}; + +struct _LinkedListAsDequeTests { + DequeTests parent_instance; + LinkedListAsDequeTestsPrivate * priv; +}; + +struct _LinkedListAsDequeTestsClass { + DequeTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer linked_list_as_deque_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +GType deque_tests_get_type (void) G_GNUC_CONST; +GType linked_list_as_deque_tests_get_type (void) G_GNUC_CONST; +enum { + LINKED_LIST_AS_DEQUE_TESTS_DUMMY_PROPERTY +}; +LinkedListAsDequeTests* linked_list_as_deque_tests_new (void); +LinkedListAsDequeTests* linked_list_as_deque_tests_construct (GType object_type); +DequeTests* deque_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void linked_list_as_deque_tests_test_selected_functions (LinkedListAsDequeTests* self); +static void _linked_list_as_deque_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void linked_list_as_deque_tests_real_set_up (GeeTestCase* base); +static void linked_list_as_deque_tests_real_tear_down (GeeTestCase* base); + + +static void _linked_list_as_deque_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + linked_list_as_deque_tests_test_selected_functions (self); +} + + +LinkedListAsDequeTests* linked_list_as_deque_tests_construct (GType object_type) { + LinkedListAsDequeTests * self = NULL; + self = (LinkedListAsDequeTests*) deque_tests_construct (object_type, "LinkedList as Deque"); + gee_test_case_add_test ((GeeTestCase*) self, "[LinkedList] selected functions", _linked_list_as_deque_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +LinkedListAsDequeTests* linked_list_as_deque_tests_new (void) { + return linked_list_as_deque_tests_construct (TYPE_LINKED_LIST_AS_DEQUE_TESTS); +} + + +static void linked_list_as_deque_tests_real_set_up (GeeTestCase* base) { + LinkedListAsDequeTests * self; + GeeLinkedList* _tmp0_; + self = (LinkedListAsDequeTests*) base; + _tmp0_ = gee_linked_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void linked_list_as_deque_tests_real_tear_down (GeeTestCase* base) { + LinkedListAsDequeTests * self; + self = (LinkedListAsDequeTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void linked_list_as_deque_tests_test_selected_functions (LinkedListAsDequeTests* self) { + GeeCollection* _tmp0_; + GeeLinkedList* _tmp1_; + GeeLinkedList* test_list; + GEqualFunc _tmp2_; + GEqualFunc _tmp3_; + GEqualFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LINKED_LIST) ? ((GeeLinkedList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_linked_list_get_equal_func (test_list); + _tmp3_ = _tmp2_; + _tmp4_ = g_str_equal; + _vala_assert (_tmp3_ == _tmp4_, "test_list.equal_func == str_equal"); + _g_object_unref0 (test_list); +} + + +static void linked_list_as_deque_tests_class_init (LinkedListAsDequeTestsClass * klass) { + linked_list_as_deque_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = linked_list_as_deque_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = linked_list_as_deque_tests_real_tear_down; +} + + +static void linked_list_as_deque_tests_instance_init (LinkedListAsDequeTests * self) { +} + + +GType linked_list_as_deque_tests_get_type (void) { + static volatile gsize linked_list_as_deque_tests_type_id__volatile = 0; + if (g_once_init_enter (&linked_list_as_deque_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (LinkedListAsDequeTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) linked_list_as_deque_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LinkedListAsDequeTests), 0, (GInstanceInitFunc) linked_list_as_deque_tests_instance_init, NULL }; + GType linked_list_as_deque_tests_type_id; + linked_list_as_deque_tests_type_id = g_type_register_static (TYPE_DEQUE_TESTS, "LinkedListAsDequeTests", &g_define_type_info, 0); + g_once_init_leave (&linked_list_as_deque_tests_type_id__volatile, linked_list_as_deque_tests_type_id); + } + return linked_list_as_deque_tests_type_id__volatile; +} + + + diff --git a/tests/testlinkedlistasdeque.vala b/tests/testlinkedlistasdeque.vala new file mode 100644 index 0000000..81b791f --- /dev/null +++ b/tests/testlinkedlistasdeque.vala @@ -0,0 +1,49 @@ +/* testlinkedlistasdeque.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public class LinkedListAsDequeTests : DequeTests { + + public LinkedListAsDequeTests () { + base ("LinkedList as Deque"); + add_test ("[LinkedList] selected functions", test_selected_functions); + } + + public override void set_up () { + test_collection = new LinkedList<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_list = test_collection as LinkedList<string>; + + // Check the collection exists + assert (test_list != null); + + // Check the selected equal function + assert (test_list.equal_func == str_equal); + } +} diff --git a/tests/testlist.c b/tests/testlist.c new file mode 100644 index 0000000..580d171 --- /dev/null +++ b/tests/testlist.c @@ -0,0 +1,2248 @@ +/* testlist.c generated by valac 0.18.0, the Vala compiler + * generated from testlist.vala, do not modify */ + +/* testlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; +typedef struct _ListTestsPrivate ListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _ListTests { + CollectionTests parent_instance; + ListTestsPrivate * priv; +}; + +struct _ListTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_retained) (ListTests* self); +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +enum { + LIST_TESTS_DUMMY_PROPERTY +}; +ListTests* list_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void list_tests_test_iterator_is_ordered (ListTests* self); +static void _list_tests_test_iterator_is_ordered_gee_test_case_test_method (gpointer self); +void list_tests_test_list_iterator (ListTests* self); +static void _list_tests_test_list_iterator_gee_test_case_test_method (gpointer self); +void list_tests_test_duplicates_are_retained (ListTests* self); +static void _list_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self); +void list_tests_test_get (ListTests* self); +static void _list_tests_test_get_gee_test_case_test_method (gpointer self); +void list_tests_test_set (ListTests* self); +static void _list_tests_test_set_gee_test_case_test_method (gpointer self); +void list_tests_test_insert (ListTests* self); +static void _list_tests_test_insert_gee_test_case_test_method (gpointer self); +void list_tests_test_remove_at (ListTests* self); +static void _list_tests_test_remove_at_gee_test_case_test_method (gpointer self); +void list_tests_test_index_of (ListTests* self); +static void _list_tests_test_index_of_gee_test_case_test_method (gpointer self); +void list_tests_test_first (ListTests* self); +static void _list_tests_test_first_gee_test_case_test_method (gpointer self); +void list_tests_test_last (ListTests* self); +static void _list_tests_test_last_gee_test_case_test_method (gpointer self); +void list_tests_test_insert_all (ListTests* self); +static void _list_tests_test_insert_all_gee_test_case_test_method (gpointer self); +void list_tests_test_slice (ListTests* self); +static void _list_tests_test_slice_gee_test_case_test_method (gpointer self); +static void list_tests_real_test_duplicates_are_retained (ListTests* self); + + +static void _list_tests_test_iterator_is_ordered_gee_test_case_test_method (gpointer self) { + list_tests_test_iterator_is_ordered (self); +} + + +static void _list_tests_test_list_iterator_gee_test_case_test_method (gpointer self) { + list_tests_test_list_iterator (self); +} + + +static void _list_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self) { + list_tests_test_duplicates_are_retained (self); +} + + +static void _list_tests_test_get_gee_test_case_test_method (gpointer self) { + list_tests_test_get (self); +} + + +static void _list_tests_test_set_gee_test_case_test_method (gpointer self) { + list_tests_test_set (self); +} + + +static void _list_tests_test_insert_gee_test_case_test_method (gpointer self) { + list_tests_test_insert (self); +} + + +static void _list_tests_test_remove_at_gee_test_case_test_method (gpointer self) { + list_tests_test_remove_at (self); +} + + +static void _list_tests_test_index_of_gee_test_case_test_method (gpointer self) { + list_tests_test_index_of (self); +} + + +static void _list_tests_test_first_gee_test_case_test_method (gpointer self) { + list_tests_test_first (self); +} + + +static void _list_tests_test_last_gee_test_case_test_method (gpointer self) { + list_tests_test_last (self); +} + + +static void _list_tests_test_insert_all_gee_test_case_test_method (gpointer self) { + list_tests_test_insert_all (self); +} + + +static void _list_tests_test_slice_gee_test_case_test_method (gpointer self) { + list_tests_test_slice (self); +} + + +ListTests* list_tests_construct (GType object_type, const gchar* name) { + ListTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (ListTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[List] iterator is ordered", _list_tests_test_iterator_is_ordered_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] list iterator", _list_tests_test_list_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] duplicates are retained", _list_tests_test_duplicates_are_retained_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] get", _list_tests_test_get_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] set", _list_tests_test_set_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] insert", _list_tests_test_insert_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] remove_at", _list_tests_test_remove_at_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] index_of", _list_tests_test_index_of_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] first", _list_tests_test_first_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] last", _list_tests_test_last_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] insert_all", _list_tests_test_insert_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[List] slice", _list_tests_test_slice_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void list_tests_test_iterator_is_ordered (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + GeeIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + GeeIterator* _tmp9_ = NULL; + GeeIterator* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeIterator* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeIterator* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + GeeIterator* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeIterator* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeIterator* _tmp25_; + gboolean _tmp26_ = FALSE; + GeeIterator* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + GeeIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_iterable_iterator ((GeeIterable*) test_list); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_iterator_next (_tmp3_); + _vala_assert (!_tmp4_, "! iterator.next ()"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp5_, "test_list.add (\"one\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp6_, "test_list.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_list, "three"); + _vala_assert (_tmp7_, "test_list.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = gee_iterable_iterator ((GeeIterable*) test_list); + _g_object_unref0 (iterator); + iterator = _tmp9_; + _tmp10_ = iterator; + _tmp11_ = gee_iterator_next (_tmp10_); + _vala_assert (_tmp11_, "iterator.next()"); + _tmp12_ = iterator; + _tmp13_ = gee_iterator_get (_tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp14_); + _tmp15_ = iterator; + _tmp16_ = gee_iterator_next (_tmp15_); + _vala_assert (_tmp16_, "iterator.next()"); + _tmp17_ = iterator; + _tmp18_ = gee_iterator_get (_tmp17_); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp19_); + _tmp20_ = iterator; + _tmp21_ = gee_iterator_next (_tmp20_); + _vala_assert (_tmp21_, "iterator.next()"); + _tmp22_ = iterator; + _tmp23_ = gee_iterator_get (_tmp22_); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp24_); + _tmp25_ = iterator; + _tmp26_ = gee_iterator_next (_tmp25_); + _vala_assert (_tmp26_, "iterator.next()"); + _tmp27_ = iterator; + _tmp28_ = gee_iterator_get (_tmp27_); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp29_); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_next (_tmp30_); + _vala_assert (!_tmp31_, "! iterator.next ()"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_list); +} + + +void list_tests_test_list_iterator (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeListIterator* _tmp2_ = NULL; + GeeListIterator* iterator; + GeeListIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeListIterator* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeListIterator* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeListIterator* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeListIterator* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeListIterator* _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_ = FALSE; + gboolean _tmp17_ = FALSE; + GeeListIterator* _tmp18_ = NULL; + GeeListIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeListIterator* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + GeeListIterator* _tmp24_; + gint _tmp25_ = 0; + GeeListIterator* _tmp26_; + GeeListIterator* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeListIterator* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + GeeListIterator* _tmp32_; + gint _tmp33_ = 0; + GeeListIterator* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeListIterator* _tmp37_; + gint _tmp38_ = 0; + GeeListIterator* _tmp39_; + gint _tmp40_; + gint _tmp41_; + GeeListIterator* _tmp42_; + gint _tmp43_ = 0; + GeeListIterator* _tmp44_; + gint _tmp45_; + gint _tmp46_; + GeeListIterator* _tmp47_; + gint _tmp48_ = 0; + GeeListIterator* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeListIterator* _tmp51_; + gpointer _tmp52_ = NULL; + gchar* _tmp53_; + GeeListIterator* _tmp54_; + gint _tmp55_ = 0; + GeeListIterator* _tmp56_; + GeeListIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeListIterator* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeListIterator* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeListIterator* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeListIterator* _tmp66_; + gint _tmp67_ = 0; + GeeListIterator* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeListIterator* _tmp70_; + gboolean _tmp71_ = FALSE; + GeeListIterator* _tmp72_; + gboolean _tmp73_ = FALSE; + GeeListIterator* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + GeeListIterator* _tmp77_; + gint _tmp78_ = 0; + GeeListIterator* _tmp79_; + gboolean _tmp80_ = FALSE; + GeeListIterator* _tmp81_; + gboolean _tmp82_ = FALSE; + GeeListIterator* _tmp83_; + gboolean _tmp84_ = FALSE; + GeeListIterator* _tmp85_; + gboolean _tmp86_ = FALSE; + GeeListIterator* _tmp87_; + gpointer _tmp88_ = NULL; + gchar* _tmp89_; + GeeListIterator* _tmp90_; + gint _tmp91_ = 0; + GeeListIterator* _tmp92_; + gboolean _tmp93_ = FALSE; + GeeListIterator* _tmp94_; + gboolean _tmp95_ = FALSE; + GeeListIterator* _tmp96_; + gpointer _tmp97_ = NULL; + gchar* _tmp98_; + GeeListIterator* _tmp99_; + gint _tmp100_ = 0; + GeeListIterator* _tmp101_; + gboolean _tmp102_ = FALSE; + GeeListIterator* _tmp103_; + gboolean _tmp104_ = FALSE; + GeeListIterator* _tmp105_; + gpointer _tmp106_ = NULL; + gchar* _tmp107_; + GeeListIterator* _tmp108_; + gint _tmp109_ = 0; + GeeListIterator* _tmp110_; + gboolean _tmp111_ = FALSE; + GeeListIterator* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeListIterator* _tmp114_; + gpointer _tmp115_ = NULL; + gchar* _tmp116_; + GeeListIterator* _tmp117_; + gint _tmp118_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_list_list_iterator (test_list); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_iterator_has_next ((GeeIterator*) _tmp3_); + _vala_assert (!_tmp4_, "! iterator.has_next ()"); + _tmp5_ = iterator; + _tmp6_ = gee_iterator_next ((GeeIterator*) _tmp5_); + _vala_assert (!_tmp6_, "! iterator.next ()"); + _tmp7_ = iterator; + _tmp8_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp7_); + _vala_assert (!_tmp8_, "! iterator.has_previous ()"); + _tmp9_ = iterator; + _tmp10_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp9_); + _vala_assert (!_tmp10_, "! iterator.previous ()"); + _tmp11_ = iterator; + _tmp12_ = gee_iterator_first ((GeeIterator*) _tmp11_); + _vala_assert (!_tmp12_, "! iterator.first ()"); + _tmp13_ = iterator; + _tmp14_ = gee_bidir_iterator_last ((GeeBidirIterator*) _tmp13_); + _vala_assert (!_tmp14_, "! iterator.last ()"); + _tmp15_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp15_, "test_list.add (\"one\")"); + _tmp16_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp16_, "test_list.add (\"two\")"); + _tmp17_ = gee_collection_add ((GeeCollection*) test_list, "three"); + _vala_assert (_tmp17_, "test_list.add (\"three\")"); + _tmp18_ = gee_list_list_iterator (test_list); + _g_object_unref0 (iterator); + iterator = _tmp18_; + _tmp19_ = iterator; + _tmp20_ = gee_iterator_next ((GeeIterator*) _tmp19_); + _vala_assert (_tmp20_, "iterator.next()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_get ((GeeIterator*) _tmp21_); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp23_); + _tmp24_ = iterator; + _tmp25_ = gee_list_iterator_index (_tmp24_); + _vala_assert (_tmp25_ == 0, "iterator.index () == 0"); + _tmp26_ = iterator; + gee_list_iterator_set (_tmp26_, "new one"); + _tmp27_ = iterator; + _tmp28_ = gee_iterator_next ((GeeIterator*) _tmp27_); + _vala_assert (_tmp28_, "iterator.next()"); + _tmp29_ = iterator; + _tmp30_ = gee_iterator_get ((GeeIterator*) _tmp29_); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp31_); + _tmp32_ = iterator; + _tmp33_ = gee_list_iterator_index (_tmp32_); + _vala_assert (_tmp33_ == 1, "iterator.index () == 1"); + _tmp34_ = iterator; + gee_list_iterator_set (_tmp34_, "new two"); + _tmp35_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 3, "test_list.size == 3"); + _tmp37_ = iterator; + _tmp38_ = gee_list_iterator_index (_tmp37_); + _vala_assert (_tmp38_ == 1, "iterator.index () == 1"); + _tmp39_ = iterator; + gee_list_iterator_insert (_tmp39_, "before two"); + _tmp40_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp41_ = _tmp40_; + _vala_assert (_tmp41_ == 4, "test_list.size == 4"); + _tmp42_ = iterator; + _tmp43_ = gee_list_iterator_index (_tmp42_); + _vala_assert (_tmp43_ == 2, "iterator.index () == 2"); + _tmp44_ = iterator; + gee_list_iterator_add (_tmp44_, "after two"); + _tmp45_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_ == 5, "test_list.size == 5"); + _tmp47_ = iterator; + _tmp48_ = gee_list_iterator_index (_tmp47_); + _vala_assert (_tmp48_ == 3, "iterator.index () == 3"); + _tmp49_ = iterator; + _tmp50_ = gee_iterator_next ((GeeIterator*) _tmp49_); + _vala_assert (_tmp50_, "iterator.next()"); + _tmp51_ = iterator; + _tmp52_ = gee_iterator_get ((GeeIterator*) _tmp51_); + _tmp53_ = (gchar*) _tmp52_; + _vala_assert (g_strcmp0 (_tmp53_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp53_); + _tmp54_ = iterator; + _tmp55_ = gee_list_iterator_index (_tmp54_); + _vala_assert (_tmp55_ == 4, "iterator.index () == 4"); + _tmp56_ = iterator; + gee_list_iterator_set (_tmp56_, "new three"); + _tmp57_ = iterator; + _tmp58_ = gee_iterator_has_next ((GeeIterator*) _tmp57_); + _vala_assert (!_tmp58_, "! iterator.has_next ()"); + _tmp59_ = iterator; + _tmp60_ = gee_iterator_next ((GeeIterator*) _tmp59_); + _vala_assert (!_tmp60_, "! iterator.next ()"); + _tmp61_ = iterator; + _tmp62_ = gee_iterator_first ((GeeIterator*) _tmp61_); + _vala_assert (_tmp62_, "iterator.first ()"); + _tmp63_ = iterator; + _tmp64_ = gee_iterator_get ((GeeIterator*) _tmp63_); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (g_strcmp0 (_tmp65_, "new one") == 0, "iterator.get () == \"new one\""); + _g_free0 (_tmp65_); + _tmp66_ = iterator; + _tmp67_ = gee_list_iterator_index (_tmp66_); + _vala_assert (_tmp67_ == 0, "iterator.index () == 0"); + _tmp68_ = iterator; + _tmp69_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp68_); + _vala_assert (!_tmp69_, "! iterator.has_previous ()"); + _tmp70_ = iterator; + _tmp71_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp70_); + _vala_assert (!_tmp71_, "! iterator.previous ()"); + _tmp72_ = iterator; + _tmp73_ = gee_bidir_iterator_last ((GeeBidirIterator*) _tmp72_); + _vala_assert (_tmp73_, "iterator.last ()"); + _tmp74_ = iterator; + _tmp75_ = gee_iterator_get ((GeeIterator*) _tmp74_); + _tmp76_ = (gchar*) _tmp75_; + _vala_assert (g_strcmp0 (_tmp76_, "new three") == 0, "iterator.get () == \"new three\""); + _g_free0 (_tmp76_); + _tmp77_ = iterator; + _tmp78_ = gee_list_iterator_index (_tmp77_); + _vala_assert (_tmp78_ == 4, "iterator.index () == 4"); + _tmp79_ = iterator; + _tmp80_ = gee_iterator_has_next ((GeeIterator*) _tmp79_); + _vala_assert (!_tmp80_, "! iterator.has_next ()"); + _tmp81_ = iterator; + _tmp82_ = gee_iterator_next ((GeeIterator*) _tmp81_); + _vala_assert (!_tmp82_, "! iterator.next ()"); + _tmp83_ = iterator; + _tmp84_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp83_); + _vala_assert (_tmp84_, "iterator.has_previous ()"); + _tmp85_ = iterator; + _tmp86_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp85_); + _vala_assert (_tmp86_, "iterator.previous ()"); + _tmp87_ = iterator; + _tmp88_ = gee_iterator_get ((GeeIterator*) _tmp87_); + _tmp89_ = (gchar*) _tmp88_; + _vala_assert (g_strcmp0 (_tmp89_, "after two") == 0, "iterator.get () == \"after two\""); + _g_free0 (_tmp89_); + _tmp90_ = iterator; + _tmp91_ = gee_list_iterator_index (_tmp90_); + _vala_assert (_tmp91_ == 3, "iterator.index () == 3"); + _tmp92_ = iterator; + _tmp93_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp92_); + _vala_assert (_tmp93_, "iterator.has_previous ()"); + _tmp94_ = iterator; + _tmp95_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp94_); + _vala_assert (_tmp95_, "iterator.previous ()"); + _tmp96_ = iterator; + _tmp97_ = gee_iterator_get ((GeeIterator*) _tmp96_); + _tmp98_ = (gchar*) _tmp97_; + _vala_assert (g_strcmp0 (_tmp98_, "new two") == 0, "iterator.get () == \"new two\""); + _g_free0 (_tmp98_); + _tmp99_ = iterator; + _tmp100_ = gee_list_iterator_index (_tmp99_); + _vala_assert (_tmp100_ == 2, "iterator.index () == 2"); + _tmp101_ = iterator; + _tmp102_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp101_); + _vala_assert (_tmp102_, "iterator.has_previous ()"); + _tmp103_ = iterator; + _tmp104_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp103_); + _vala_assert (_tmp104_, "iterator.previous ()"); + _tmp105_ = iterator; + _tmp106_ = gee_iterator_get ((GeeIterator*) _tmp105_); + _tmp107_ = (gchar*) _tmp106_; + _vala_assert (g_strcmp0 (_tmp107_, "before two") == 0, "iterator.get () == \"before two\""); + _g_free0 (_tmp107_); + _tmp108_ = iterator; + _tmp109_ = gee_list_iterator_index (_tmp108_); + _vala_assert (_tmp109_ == 1, "iterator.index () == 1"); + _tmp110_ = iterator; + _tmp111_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp110_); + _vala_assert (_tmp111_, "iterator.has_previous ()"); + _tmp112_ = iterator; + _tmp113_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp112_); + _vala_assert (_tmp113_, "iterator.previous ()"); + _tmp114_ = iterator; + _tmp115_ = gee_iterator_get ((GeeIterator*) _tmp114_); + _tmp116_ = (gchar*) _tmp115_; + _vala_assert (g_strcmp0 (_tmp116_, "new one") == 0, "iterator.get () == \"new one\""); + _g_free0 (_tmp116_); + _tmp117_ = iterator; + _tmp118_ = gee_list_iterator_index (_tmp117_); + _vala_assert (_tmp118_ == 0, "iterator.index () == 0"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_list); +} + + +static void list_tests_real_test_duplicates_are_retained (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gint _tmp8_; + gint _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_ = FALSE; + gint _tmp12_; + gint _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gint _tmp16_; + gint _tmp17_; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gint _tmp20_; + gint _tmp21_; + gboolean _tmp22_ = FALSE; + gboolean _tmp23_ = FALSE; + gint _tmp24_; + gint _tmp25_; + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp2_, "test_list.add (\"one\")"); + _tmp3_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp3_, "test_list.contains (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_list.size == 1"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp6_, "test_list.add (\"one\")"); + _tmp7_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp7_, "test_list.contains (\"one\")"); + _tmp8_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 2, "test_list.size == 2"); + _tmp10_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp10_, "test_list.add (\"one\")"); + _tmp11_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp11_, "test_list.contains (\"one\")"); + _tmp12_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_ == 3, "test_list.size == 3"); + _tmp14_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp14_, "test_list.remove (\"one\")"); + _tmp15_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp15_, "test_list.contains (\"one\")"); + _tmp16_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 2, "test_list.size == 2"); + _tmp18_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp18_, "test_list.remove (\"one\")"); + _tmp19_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp19_, "test_list.contains (\"one\")"); + _tmp20_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp21_ = _tmp20_; + _vala_assert (_tmp21_ == 1, "test_list.size == 1"); + _tmp22_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp22_, "test_list.remove (\"one\")"); + _tmp23_ = gee_collection_contains ((GeeCollection*) test_list, "one"); + _vala_assert (!_tmp23_, "!test_list.contains (\"one\")"); + _tmp24_ = gee_collection_get_size ((GeeCollection*) test_list); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_ == 0, "test_list.size == 0"); + _g_object_unref0 (test_list); +} + + +void list_tests_test_duplicates_are_retained (ListTests* self) { + g_return_if_fail (self != NULL); + LIST_TESTS_GET_CLASS (self)->test_duplicates_are_retained (self); +} + + +void list_tests_test_get (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeList* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gboolean _tmp12_ = FALSE; + gboolean _tmp16_ = FALSE; + GeeList* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeList* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeList* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + GeeList* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + GeeList* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeList* _tmp33_; + gboolean _tmp34_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_get (_tmp4_, 0); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = test_list; + _tmp8_ = gee_collection_add ((GeeCollection*) _tmp7_, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = test_list; + _tmp10_ = gee_list_get (_tmp9_, 0); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp12_) { + GeeList* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + _tmp13_ = test_list; + _tmp14_ = gee_list_get (_tmp13_, 1); + _tmp15_ = (gchar*) _tmp14_; + _g_free0 (_tmp15_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp16_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp16_) { + GeeList* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + _tmp17_ = test_list; + _tmp18_ = gee_list_get (_tmp17_, -1); + _tmp19_ = (gchar*) _tmp18_; + _g_free0 (_tmp19_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp20_ = test_list; + _tmp21_ = gee_collection_add ((GeeCollection*) _tmp20_, "two"); + _vala_assert (_tmp21_, "test_list.add (\"two\")"); + _tmp22_ = test_list; + _tmp23_ = gee_collection_add ((GeeCollection*) _tmp22_, "three"); + _vala_assert (_tmp23_, "test_list.add (\"three\")"); + _tmp24_ = test_list; + _tmp25_ = gee_list_get (_tmp24_, 0); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp26_); + _tmp27_ = test_list; + _tmp28_ = gee_list_get (_tmp27_, 1); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "two") == 0, "test_list.get (1) == \"two\""); + _g_free0 (_tmp29_); + _tmp30_ = test_list; + _tmp31_ = gee_list_get (_tmp30_, 2); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "three") == 0, "test_list.get (2) == \"three\""); + _g_free0 (_tmp32_); + _tmp33_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp33_); + _tmp34_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp34_) { + GeeList* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + _tmp35_ = test_list; + _tmp36_ = gee_list_get (_tmp35_, 0); + _tmp37_ = (gchar*) _tmp36_; + _g_free0 (_tmp37_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_set (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + GeeList* _tmp3_; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + GeeList* _tmp8_; + gint _tmp9_; + gint _tmp10_; + GeeList* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeList* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeList* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeList* _tmp19_; + GeeList* _tmp20_; + gint _tmp21_; + gint _tmp22_; + GeeList* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeList* _tmp26_; + gint _tmp27_; + gint _tmp28_; + gboolean _tmp29_ = FALSE; + GeeList* _tmp31_; + gint _tmp32_; + gint _tmp33_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = test_list; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "test_list.size == 0"); + _tmp6_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp6_) { + GeeList* _tmp7_; + _tmp7_ = test_list; + gee_list_set (_tmp7_, 0, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp8_ = test_list; + _tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 0, "test_list.size == 0"); + _tmp11_ = test_list; + _tmp12_ = gee_collection_add ((GeeCollection*) _tmp11_, "one"); + _vala_assert (_tmp12_, "test_list.add (\"one\")"); + _tmp13_ = test_list; + _tmp14_ = gee_collection_get_size ((GeeCollection*) _tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "test_list.size == 1"); + _tmp16_ = test_list; + _tmp17_ = gee_list_get (_tmp16_, 0); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp18_); + _tmp19_ = test_list; + gee_list_set (_tmp19_, 0, "two"); + _tmp20_ = test_list; + _tmp21_ = gee_collection_get_size ((GeeCollection*) _tmp20_); + _tmp22_ = _tmp21_; + _vala_assert (_tmp22_ == 1, "test_list.size == 1"); + _tmp23_ = test_list; + _tmp24_ = gee_list_get (_tmp23_, 0); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp25_); + _tmp26_ = test_list; + _tmp27_ = gee_collection_get_size ((GeeCollection*) _tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 1, "test_list.size == 1"); + _tmp29_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp29_) { + GeeList* _tmp30_; + _tmp30_ = test_list; + gee_list_set (_tmp30_, 1, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp31_ = test_list; + _tmp32_ = gee_collection_get_size ((GeeCollection*) _tmp31_); + _tmp33_ = _tmp32_; + _vala_assert (_tmp33_ == 1, "test_list.size == 1"); + _g_object_unref0 (test_list); +} + + +void list_tests_test_insert (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeList* _tmp8_; + GeeList* _tmp9_; + gint _tmp10_; + gint _tmp11_; + GeeList* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeList* _tmp15_; + GeeList* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeList* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeList* _tmp22_; + GeeList* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeList* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + GeeList* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + gboolean _tmp32_ = FALSE; + GeeList* _tmp34_; + GeeList* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + GeeList* _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + GeeList* _tmp41_; + gpointer _tmp42_ = NULL; + gchar* _tmp43_; + GeeList* _tmp44_; + gpointer _tmp45_ = NULL; + gchar* _tmp46_; + gboolean _tmp47_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + _tmp4_ = test_list; + gee_list_insert (_tmp4_, 1, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp5_ = test_list; + _tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_ == 0, "test_list.size == 0"); + _tmp8_ = test_list; + gee_list_insert (_tmp8_, 0, "one"); + _tmp9_ = test_list; + _tmp10_ = gee_collection_get_size ((GeeCollection*) _tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 1, "test_list.size == 1"); + _tmp12_ = test_list; + _tmp13_ = gee_list_get (_tmp12_, 0); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "one") == 0, "test_list.get (0) == \"one\""); + _g_free0 (_tmp14_); + _tmp15_ = test_list; + gee_list_insert (_tmp15_, 0, "two"); + _tmp16_ = test_list; + _tmp17_ = gee_list_get (_tmp16_, 0); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp18_); + _tmp19_ = test_list; + _tmp20_ = gee_list_get (_tmp19_, 1); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp21_); + _tmp22_ = test_list; + gee_list_insert (_tmp22_, 1, "three"); + _tmp23_ = test_list; + _tmp24_ = gee_list_get (_tmp23_, 0); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp25_); + _tmp26_ = test_list; + _tmp27_ = gee_list_get (_tmp26_, 1); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp28_); + _tmp29_ = test_list; + _tmp30_ = gee_list_get (_tmp29_, 2); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "one") == 0, "test_list.get (2) == \"one\""); + _g_free0 (_tmp31_); + _tmp32_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp32_) { + GeeList* _tmp33_; + _tmp33_ = test_list; + gee_list_insert (_tmp33_, 4, "four"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp34_ = test_list; + gee_list_insert (_tmp34_, 3, "four"); + _tmp35_ = test_list; + _tmp36_ = gee_list_get (_tmp35_, 0); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp37_); + _tmp38_ = test_list; + _tmp39_ = gee_list_get (_tmp38_, 1); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (g_strcmp0 (_tmp40_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp40_); + _tmp41_ = test_list; + _tmp42_ = gee_list_get (_tmp41_, 2); + _tmp43_ = (gchar*) _tmp42_; + _vala_assert (g_strcmp0 (_tmp43_, "one") == 0, "test_list.get (2) == \"one\""); + _g_free0 (_tmp43_); + _tmp44_ = test_list; + _tmp45_ = gee_list_get (_tmp44_, 3); + _tmp46_ = (gchar*) _tmp45_; + _vala_assert (g_strcmp0 (_tmp46_, "four") == 0, "test_list.get (3) == \"four\""); + _g_free0 (_tmp46_); + _tmp47_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp47_) { + GeeList* _tmp48_; + _tmp48_ = test_list; + gee_list_insert (_tmp48_, -1, "zero"); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_remove_at (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + gboolean _tmp7_ = FALSE; + GeeList* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeList* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeList* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeList* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeList* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeList* _tmp21_; + gint _tmp22_; + gint _tmp23_; + GeeList* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + GeeList* _tmp27_; + gint _tmp28_; + gint _tmp29_; + GeeList* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeList* _tmp33_; + gpointer _tmp34_ = NULL; + gchar* _tmp35_; + GeeList* _tmp36_; + gpointer _tmp37_ = NULL; + gchar* _tmp38_; + GeeList* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + GeeList* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + GeeList* _tmp45_; + gint _tmp46_; + gint _tmp47_; + GeeList* _tmp48_; + gpointer _tmp49_ = NULL; + gchar* _tmp50_; + GeeList* _tmp51_; + gpointer _tmp52_ = NULL; + gchar* _tmp53_; + GeeList* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + GeeList* _tmp57_; + gpointer _tmp58_ = NULL; + gchar* _tmp59_; + GeeList* _tmp60_; + gint _tmp61_; + gint _tmp62_; + GeeList* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeList* _tmp66_; + gpointer _tmp67_ = NULL; + gchar* _tmp68_; + gboolean _tmp69_ = FALSE; + gboolean _tmp73_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_remove_at (_tmp4_, 0); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp7_) { + GeeList* _tmp8_; + gpointer _tmp9_ = NULL; + gchar* _tmp10_; + _tmp8_ = test_list; + _tmp9_ = gee_list_remove_at (_tmp8_, 1); + _tmp10_ = (gchar*) _tmp9_; + _g_free0 (_tmp10_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp11_ = test_list; + _tmp12_ = gee_collection_add ((GeeCollection*) _tmp11_, "one"); + _vala_assert (_tmp12_, "test_list.add (\"one\")"); + _tmp13_ = test_list; + _tmp14_ = gee_collection_add ((GeeCollection*) _tmp13_, "two"); + _vala_assert (_tmp14_, "test_list.add (\"two\")"); + _tmp15_ = test_list; + _tmp16_ = gee_collection_add ((GeeCollection*) _tmp15_, "three"); + _vala_assert (_tmp16_, "test_list.add (\"three\")"); + _tmp17_ = test_list; + _tmp18_ = gee_collection_add ((GeeCollection*) _tmp17_, "four"); + _vala_assert (_tmp18_, "test_list.add (\"four\")"); + _tmp19_ = test_list; + _tmp20_ = gee_collection_add ((GeeCollection*) _tmp19_, "five"); + _vala_assert (_tmp20_, "test_list.add (\"five\")"); + _tmp21_ = test_list; + _tmp22_ = gee_collection_get_size ((GeeCollection*) _tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 5, "test_list.size == 5"); + _tmp24_ = test_list; + _tmp25_ = gee_list_remove_at (_tmp24_, 0); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "one") == 0, "test_list.remove_at (0) == \"one\""); + _g_free0 (_tmp26_); + _tmp27_ = test_list; + _tmp28_ = gee_collection_get_size ((GeeCollection*) _tmp27_); + _tmp29_ = _tmp28_; + _vala_assert (_tmp29_ == 4, "test_list.size == 4"); + _tmp30_ = test_list; + _tmp31_ = gee_list_get (_tmp30_, 0); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp32_); + _tmp33_ = test_list; + _tmp34_ = gee_list_get (_tmp33_, 1); + _tmp35_ = (gchar*) _tmp34_; + _vala_assert (g_strcmp0 (_tmp35_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp35_); + _tmp36_ = test_list; + _tmp37_ = gee_list_get (_tmp36_, 2); + _tmp38_ = (gchar*) _tmp37_; + _vala_assert (g_strcmp0 (_tmp38_, "four") == 0, "test_list.get (2) == \"four\""); + _g_free0 (_tmp38_); + _tmp39_ = test_list; + _tmp40_ = gee_list_get (_tmp39_, 3); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "five") == 0, "test_list.get (3) == \"five\""); + _g_free0 (_tmp41_); + _tmp42_ = test_list; + _tmp43_ = gee_list_remove_at (_tmp42_, 3); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "five") == 0, "test_list.remove_at (3) == \"five\""); + _g_free0 (_tmp44_); + _tmp45_ = test_list; + _tmp46_ = gee_collection_get_size ((GeeCollection*) _tmp45_); + _tmp47_ = _tmp46_; + _vala_assert (_tmp47_ == 3, "test_list.size == 3"); + _tmp48_ = test_list; + _tmp49_ = gee_list_get (_tmp48_, 0); + _tmp50_ = (gchar*) _tmp49_; + _vala_assert (g_strcmp0 (_tmp50_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp50_); + _tmp51_ = test_list; + _tmp52_ = gee_list_get (_tmp51_, 1); + _tmp53_ = (gchar*) _tmp52_; + _vala_assert (g_strcmp0 (_tmp53_, "three") == 0, "test_list.get (1) == \"three\""); + _g_free0 (_tmp53_); + _tmp54_ = test_list; + _tmp55_ = gee_list_get (_tmp54_, 2); + _tmp56_ = (gchar*) _tmp55_; + _vala_assert (g_strcmp0 (_tmp56_, "four") == 0, "test_list.get (2) == \"four\""); + _g_free0 (_tmp56_); + _tmp57_ = test_list; + _tmp58_ = gee_list_remove_at (_tmp57_, 1); + _tmp59_ = (gchar*) _tmp58_; + _vala_assert (g_strcmp0 (_tmp59_, "three") == 0, "test_list.remove_at (1) == \"three\""); + _g_free0 (_tmp59_); + _tmp60_ = test_list; + _tmp61_ = gee_collection_get_size ((GeeCollection*) _tmp60_); + _tmp62_ = _tmp61_; + _vala_assert (_tmp62_ == 2, "test_list.size == 2"); + _tmp63_ = test_list; + _tmp64_ = gee_list_get (_tmp63_, 0); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (g_strcmp0 (_tmp65_, "two") == 0, "test_list.get (0) == \"two\""); + _g_free0 (_tmp65_); + _tmp66_ = test_list; + _tmp67_ = gee_list_get (_tmp66_, 1); + _tmp68_ = (gchar*) _tmp67_; + _vala_assert (g_strcmp0 (_tmp68_, "four") == 0, "test_list.get (1) == \"four\""); + _g_free0 (_tmp68_); + _tmp69_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp69_) { + GeeList* _tmp70_; + gpointer _tmp71_ = NULL; + gchar* _tmp72_; + _tmp70_ = test_list; + _tmp71_ = gee_list_remove_at (_tmp70_, 2); + _tmp72_ = (gchar*) _tmp71_; + _g_free0 (_tmp72_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp73_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp73_) { + GeeList* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + _tmp74_ = test_list; + _tmp75_ = gee_list_remove_at (_tmp74_, -1); + _tmp76_ = (gchar*) _tmp75_; + _g_free0 (_tmp76_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_index_of (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + gint _tmp2_ = 0; + gboolean _tmp3_ = FALSE; + gint _tmp4_ = 0; + gint _tmp5_ = 0; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + gint _tmp12_ = 0; + gint _tmp13_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _vala_assert (test_list != NULL, "test_list != null"); + _tmp2_ = gee_list_index_of (test_list, "one"); + _vala_assert (_tmp2_ == (-1), "test_list.index_of (\"one\") == -1"); + _tmp3_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp3_, "test_list.add (\"one\")"); + _tmp4_ = gee_list_index_of (test_list, "one"); + _vala_assert (_tmp4_ == 0, "test_list.index_of (\"one\") == 0"); + _tmp5_ = gee_list_index_of (test_list, "two"); + _vala_assert (_tmp5_ == (-1), "test_list.index_of (\"two\") == -1"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp6_, "test_list.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_list, "three"); + _vala_assert (_tmp7_, "test_list.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_list, "four"); + _vala_assert (_tmp8_, "test_list.add (\"four\")"); + _tmp9_ = gee_list_index_of (test_list, "one"); + _vala_assert (_tmp9_ == 0, "test_list.index_of (\"one\") == 0"); + _tmp10_ = gee_list_index_of (test_list, "two"); + _vala_assert (_tmp10_ == 1, "test_list.index_of (\"two\") == 1"); + _tmp11_ = gee_list_index_of (test_list, "three"); + _vala_assert (_tmp11_ == 2, "test_list.index_of (\"three\") == 2"); + _tmp12_ = gee_list_index_of (test_list, "four"); + _vala_assert (_tmp12_ == 3, "test_list.index_of (\"four\") == 3"); + _tmp13_ = gee_list_index_of (test_list, "five"); + _vala_assert (_tmp13_ == (-1), "test_list.index_of (\"five\") == -1"); + _g_object_unref0 (test_list); +} + + +void list_tests_test_first (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeList* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + GeeList* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeList* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + GeeList* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeList* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeList* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeList* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeList* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeList* _tmp31_; + gboolean _tmp32_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_first (_tmp4_); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = test_list; + _tmp8_ = gee_collection_add ((GeeCollection*) _tmp7_, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = test_list; + _tmp10_ = gee_list_first (_tmp9_); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_list.first () == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = test_list; + _tmp13_ = gee_list_first (_tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _tmp15_ = test_list; + _tmp16_ = gee_list_get (_tmp15_, 0); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp14_, _tmp17_) == 0, "test_list.first () == test_list.get (0)"); + _g_free0 (_tmp17_); + _g_free0 (_tmp14_); + _tmp18_ = test_list; + _tmp19_ = gee_collection_add ((GeeCollection*) _tmp18_, "two"); + _vala_assert (_tmp19_, "test_list.add (\"two\")"); + _tmp20_ = test_list; + _tmp21_ = gee_collection_add ((GeeCollection*) _tmp20_, "three"); + _vala_assert (_tmp21_, "test_list.add (\"three\")"); + _tmp22_ = test_list; + _tmp23_ = gee_list_first (_tmp22_); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "one") == 0, "test_list.first () == \"one\""); + _g_free0 (_tmp24_); + _tmp25_ = test_list; + _tmp26_ = gee_list_first (_tmp25_); + _tmp27_ = (gchar*) _tmp26_; + _tmp28_ = test_list; + _tmp29_ = gee_list_get (_tmp28_, 0); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp27_, _tmp30_) == 0, "test_list.first () == test_list.get (0)"); + _g_free0 (_tmp30_); + _g_free0 (_tmp27_); + _tmp31_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp31_); + _tmp32_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp32_) { + GeeList* _tmp33_; + gpointer _tmp34_ = NULL; + gchar* _tmp35_; + _tmp33_ = test_list; + _tmp34_ = gee_list_first (_tmp33_); + _tmp35_ = (gchar*) _tmp34_; + _g_free0 (_tmp35_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_last (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeList* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeList* _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + GeeList* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeList* _tmp15_; + GeeList* _tmp16_; + gint _tmp17_; + gint _tmp18_; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + GeeList* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeList* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeList* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeList* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeList* _tmp31_; + GeeList* _tmp32_; + gint _tmp33_; + gint _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeList* _tmp37_; + gboolean _tmp38_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + gpointer _tmp5_ = NULL; + gchar* _tmp6_; + _tmp4_ = test_list; + _tmp5_ = gee_list_last (_tmp4_); + _tmp6_ = (gchar*) _tmp5_; + _g_free0 (_tmp6_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp7_ = test_list; + _tmp8_ = gee_collection_add ((GeeCollection*) _tmp7_, "one"); + _vala_assert (_tmp8_, "test_list.add (\"one\")"); + _tmp9_ = test_list; + _tmp10_ = gee_list_last (_tmp9_); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_list.last () == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = test_list; + _tmp13_ = gee_list_last (_tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _tmp15_ = test_list; + _tmp16_ = test_list; + _tmp17_ = gee_collection_get_size ((GeeCollection*) _tmp16_); + _tmp18_ = _tmp17_; + _tmp19_ = gee_list_get (_tmp15_, _tmp18_ - 1); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp14_, _tmp20_) == 0, "test_list.last () == test_list.get (test_list.size - 1)"); + _g_free0 (_tmp20_); + _g_free0 (_tmp14_); + _tmp21_ = test_list; + _tmp22_ = gee_collection_add ((GeeCollection*) _tmp21_, "two"); + _vala_assert (_tmp22_, "test_list.add (\"two\")"); + _tmp23_ = test_list; + _tmp24_ = gee_collection_add ((GeeCollection*) _tmp23_, "three"); + _vala_assert (_tmp24_, "test_list.add (\"three\")"); + _tmp25_ = test_list; + _tmp26_ = gee_list_last (_tmp25_); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "three") == 0, "test_list.last () == \"three\""); + _g_free0 (_tmp27_); + _tmp28_ = test_list; + _tmp29_ = gee_list_last (_tmp28_); + _tmp30_ = (gchar*) _tmp29_; + _tmp31_ = test_list; + _tmp32_ = test_list; + _tmp33_ = gee_collection_get_size ((GeeCollection*) _tmp32_); + _tmp34_ = _tmp33_; + _tmp35_ = gee_list_get (_tmp31_, _tmp34_ - 1); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp30_, _tmp36_) == 0, "test_list.last () == test_list.get (test_list.size - 1)"); + _g_free0 (_tmp36_); + _g_free0 (_tmp30_); + _tmp37_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp37_); + _tmp38_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp38_) { + GeeList* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + _tmp39_ = test_list; + _tmp40_ = gee_list_last (_tmp39_); + _tmp41_ = (gchar*) _tmp40_; + _g_free0 (_tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (test_list); +} + + +void list_tests_test_insert_all (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + GeeArrayList* _tmp3_; + GeeArrayList* dummy; + GeeList* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeList* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeList* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeList* _tmp10_; + gint _tmp11_; + gint _tmp12_; + GeeArrayList* _tmp13_; + gboolean _tmp14_; + gboolean _tmp15_; + GeeList* _tmp16_; + GeeArrayList* _tmp17_; + GeeList* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeArrayList* _tmp21_; + gboolean _tmp22_; + gboolean _tmp23_; + GeeList* _tmp24_; + GeeArrayList* _tmp25_; + GeeArrayList* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeArrayList* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeArrayList* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeList* _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + GeeArrayList* _tmp35_; + gint _tmp36_; + gint _tmp37_; + GeeList* _tmp38_; + GeeArrayList* _tmp39_; + GeeList* _tmp40_; + gint _tmp41_; + gint _tmp42_; + GeeArrayList* _tmp43_; + gint _tmp44_; + gint _tmp45_; + GeeList* _tmp46_; + GeeArrayList* _tmp47_; + GeeArrayList* _tmp48_; + gboolean _tmp49_ = FALSE; + GeeArrayList* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeArrayList* _tmp52_; + gboolean _tmp53_ = FALSE; + GeeList* _tmp54_; + gboolean _tmp55_; + gboolean _tmp56_; + gboolean _tmp57_ = FALSE; + GeeList* _tmp60_; + GeeArrayList* _tmp61_; + GeeList* _tmp62_; + gboolean _tmp63_ = FALSE; + GeeList* _tmp64_; + gboolean _tmp65_ = FALSE; + GeeList* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeArrayList* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeArrayList* _tmp70_; + gboolean _tmp71_ = FALSE; + GeeArrayList* _tmp72_; + gboolean _tmp73_ = FALSE; + GeeList* _tmp74_; + gint _tmp75_; + gint _tmp76_; + GeeArrayList* _tmp77_; + gint _tmp78_; + gint _tmp79_; + GeeList* _tmp80_; + GeeArrayList* _tmp81_; + GeeList* _tmp82_; + gint _tmp83_; + gint _tmp84_; + GeeArrayList* _tmp85_; + gint _tmp86_; + gint _tmp87_; + GeeList* _tmp88_; + gpointer _tmp89_ = NULL; + gchar* _tmp90_; + GeeList* _tmp91_; + gpointer _tmp92_ = NULL; + gchar* _tmp93_; + GeeList* _tmp94_; + gpointer _tmp95_ = NULL; + gchar* _tmp96_; + GeeList* _tmp97_; + gpointer _tmp98_ = NULL; + gchar* _tmp99_; + GeeList* _tmp100_; + gpointer _tmp101_ = NULL; + gchar* _tmp102_; + GeeList* _tmp103_; + gpointer _tmp104_ = NULL; + gchar* _tmp105_; + GeeList* _tmp106_; + GeeArrayList* _tmp107_; + GeeList* _tmp108_; + gboolean _tmp109_ = FALSE; + GeeList* _tmp110_; + gboolean _tmp111_ = FALSE; + GeeList* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeList* _tmp114_; + gboolean _tmp115_ = FALSE; + GeeArrayList* _tmp116_; + gboolean _tmp117_ = FALSE; + GeeArrayList* _tmp118_; + gboolean _tmp119_ = FALSE; + GeeArrayList* _tmp120_; + gboolean _tmp121_ = FALSE; + GeeList* _tmp122_; + gint _tmp123_; + gint _tmp124_; + GeeArrayList* _tmp125_; + gint _tmp126_; + gint _tmp127_; + GeeList* _tmp128_; + GeeArrayList* _tmp129_; + GeeList* _tmp130_; + gint _tmp131_; + gint _tmp132_; + GeeArrayList* _tmp133_; + gint _tmp134_; + gint _tmp135_; + GeeList* _tmp136_; + gpointer _tmp137_ = NULL; + gchar* _tmp138_; + GeeList* _tmp139_; + gpointer _tmp140_ = NULL; + gchar* _tmp141_; + GeeList* _tmp142_; + gpointer _tmp143_ = NULL; + gchar* _tmp144_; + GeeList* _tmp145_; + gpointer _tmp146_ = NULL; + gchar* _tmp147_; + GeeList* _tmp148_; + gpointer _tmp149_ = NULL; + gchar* _tmp150_; + GeeList* _tmp151_; + gpointer _tmp152_ = NULL; + gchar* _tmp153_; + GeeList* _tmp154_; + gpointer _tmp155_ = NULL; + gchar* _tmp156_; + GeeList* _tmp157_; + GeeArrayList* _tmp158_; + GeeList* _tmp159_; + gboolean _tmp160_ = FALSE; + GeeList* _tmp161_; + gboolean _tmp162_ = FALSE; + GeeList* _tmp163_; + gboolean _tmp164_ = FALSE; + GeeArrayList* _tmp165_; + gboolean _tmp166_ = FALSE; + GeeArrayList* _tmp167_; + gboolean _tmp168_ = FALSE; + GeeArrayList* _tmp169_; + gboolean _tmp170_ = FALSE; + GeeList* _tmp171_; + gint _tmp172_; + gint _tmp173_; + GeeArrayList* _tmp174_; + gint _tmp175_; + gint _tmp176_; + GeeList* _tmp177_; + GeeArrayList* _tmp178_; + GeeList* _tmp179_; + gint _tmp180_; + gint _tmp181_; + GeeArrayList* _tmp182_; + gint _tmp183_; + gint _tmp184_; + GeeList* _tmp185_; + gpointer _tmp186_ = NULL; + gchar* _tmp187_; + GeeList* _tmp188_; + gpointer _tmp189_ = NULL; + gchar* _tmp190_; + GeeList* _tmp191_; + gpointer _tmp192_ = NULL; + gchar* _tmp193_; + GeeList* _tmp194_; + gpointer _tmp195_ = NULL; + gchar* _tmp196_; + GeeList* _tmp197_; + gpointer _tmp198_ = NULL; + gchar* _tmp199_; + GeeList* _tmp200_; + gpointer _tmp201_ = NULL; + gchar* _tmp202_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = _tmp3_; + _tmp4_ = test_list; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "zero"); + _vala_assert (_tmp5_, "test_list.add (\"zero\")"); + _tmp6_ = test_list; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_list.add (\"one\")"); + _tmp8_ = test_list; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_list.add (\"two\")"); + _tmp10_ = test_list; + _tmp11_ = gee_collection_get_size ((GeeCollection*) _tmp10_); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_ == 3, "test_list.size == 3"); + _tmp13_ = dummy; + _tmp14_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) _tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_, "dummy.is_empty"); + _tmp16_ = test_list; + _tmp17_ = dummy; + gee_list_insert_all (_tmp16_, 0, (GeeCollection*) _tmp17_); + _tmp18_ = test_list; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 3, "test_list.size == 3"); + _tmp21_ = dummy; + _tmp22_ = gee_abstract_collection_get_is_empty ((GeeAbstractCollection*) _tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_, "dummy.is_empty"); + _tmp24_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp24_); + _tmp25_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp25_); + _tmp26_ = dummy; + _tmp27_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp26_, "zero"); + _vala_assert (_tmp27_, "dummy.add (\"zero\")"); + _tmp28_ = dummy; + _tmp29_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp28_, "one"); + _vala_assert (_tmp29_, "dummy.add (\"one\")"); + _tmp30_ = dummy; + _tmp31_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp30_, "two"); + _vala_assert (_tmp31_, "dummy.add (\"two\")"); + _tmp32_ = test_list; + _tmp33_ = gee_collection_get_is_empty ((GeeCollection*) _tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_, "test_list.is_empty"); + _tmp35_ = dummy; + _tmp36_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp35_); + _tmp37_ = _tmp36_; + _vala_assert (_tmp37_ == 3, "dummy.size == 3"); + _tmp38_ = test_list; + _tmp39_ = dummy; + gee_list_insert_all (_tmp38_, 0, (GeeCollection*) _tmp39_); + _tmp40_ = test_list; + _tmp41_ = gee_collection_get_size ((GeeCollection*) _tmp40_); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_ == 3, "test_list.size == 3"); + _tmp43_ = dummy; + _tmp44_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (_tmp45_ == 3, "dummy.size == 3"); + _tmp46_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp46_); + _tmp47_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp47_); + _tmp48_ = dummy; + _tmp49_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp48_, "zero"); + _vala_assert (_tmp49_, "dummy.add (\"zero\")"); + _tmp50_ = dummy; + _tmp51_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp50_, "one"); + _vala_assert (_tmp51_, "dummy.add (\"one\")"); + _tmp52_ = dummy; + _tmp53_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp52_, "two"); + _vala_assert (_tmp53_, "dummy.add (\"two\")"); + _tmp54_ = test_list; + _tmp55_ = gee_collection_get_is_empty ((GeeCollection*) _tmp54_); + _tmp56_ = _tmp55_; + _vala_assert (_tmp56_, "test_list.is_empty"); + _tmp57_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp57_) { + GeeList* _tmp58_; + GeeArrayList* _tmp59_; + _tmp58_ = test_list; + _tmp59_ = dummy; + gee_list_insert_all (_tmp58_, 1, (GeeCollection*) _tmp59_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp60_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp60_); + _tmp61_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp61_); + _tmp62_ = test_list; + _tmp63_ = gee_collection_add ((GeeCollection*) _tmp62_, "three"); + _vala_assert (_tmp63_, "test_list.add (\"three\")"); + _tmp64_ = test_list; + _tmp65_ = gee_collection_add ((GeeCollection*) _tmp64_, "four"); + _vala_assert (_tmp65_, "test_list.add (\"four\")"); + _tmp66_ = test_list; + _tmp67_ = gee_collection_add ((GeeCollection*) _tmp66_, "five"); + _vala_assert (_tmp67_, "test_list.add (\"five\")"); + _tmp68_ = dummy; + _tmp69_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp68_, "zero"); + _vala_assert (_tmp69_, "dummy.add (\"zero\")"); + _tmp70_ = dummy; + _tmp71_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp70_, "one"); + _vala_assert (_tmp71_, "dummy.add (\"one\")"); + _tmp72_ = dummy; + _tmp73_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp72_, "two"); + _vala_assert (_tmp73_, "dummy.add (\"two\")"); + _tmp74_ = test_list; + _tmp75_ = gee_collection_get_size ((GeeCollection*) _tmp74_); + _tmp76_ = _tmp75_; + _vala_assert (_tmp76_ == 3, "test_list.size == 3"); + _tmp77_ = dummy; + _tmp78_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp77_); + _tmp79_ = _tmp78_; + _vala_assert (_tmp79_ == 3, "dummy.size == 3"); + _tmp80_ = test_list; + _tmp81_ = dummy; + gee_list_insert_all (_tmp80_, 0, (GeeCollection*) _tmp81_); + _tmp82_ = test_list; + _tmp83_ = gee_collection_get_size ((GeeCollection*) _tmp82_); + _tmp84_ = _tmp83_; + _vala_assert (_tmp84_ == 6, "test_list.size == 6"); + _tmp85_ = dummy; + _tmp86_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp85_); + _tmp87_ = _tmp86_; + _vala_assert (_tmp87_ == 3, "dummy.size == 3"); + _tmp88_ = test_list; + _tmp89_ = gee_list_get (_tmp88_, 0); + _tmp90_ = (gchar*) _tmp89_; + _vala_assert (g_strcmp0 (_tmp90_, "zero") == 0, "test_list.get (0) == \"zero\""); + _g_free0 (_tmp90_); + _tmp91_ = test_list; + _tmp92_ = gee_list_get (_tmp91_, 1); + _tmp93_ = (gchar*) _tmp92_; + _vala_assert (g_strcmp0 (_tmp93_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp93_); + _tmp94_ = test_list; + _tmp95_ = gee_list_get (_tmp94_, 2); + _tmp96_ = (gchar*) _tmp95_; + _vala_assert (g_strcmp0 (_tmp96_, "two") == 0, "test_list.get (2) == \"two\""); + _g_free0 (_tmp96_); + _tmp97_ = test_list; + _tmp98_ = gee_list_get (_tmp97_, 3); + _tmp99_ = (gchar*) _tmp98_; + _vala_assert (g_strcmp0 (_tmp99_, "three") == 0, "test_list.get (3) == \"three\""); + _g_free0 (_tmp99_); + _tmp100_ = test_list; + _tmp101_ = gee_list_get (_tmp100_, 4); + _tmp102_ = (gchar*) _tmp101_; + _vala_assert (g_strcmp0 (_tmp102_, "four") == 0, "test_list.get (4) == \"four\""); + _g_free0 (_tmp102_); + _tmp103_ = test_list; + _tmp104_ = gee_list_get (_tmp103_, 5); + _tmp105_ = (gchar*) _tmp104_; + _vala_assert (g_strcmp0 (_tmp105_, "five") == 0, "test_list.get (5) == \"five\""); + _g_free0 (_tmp105_); + _tmp106_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp106_); + _tmp107_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp107_); + _tmp108_ = test_list; + _tmp109_ = gee_collection_add ((GeeCollection*) _tmp108_, "zero"); + _vala_assert (_tmp109_, "test_list.add (\"zero\")"); + _tmp110_ = test_list; + _tmp111_ = gee_collection_add ((GeeCollection*) _tmp110_, "one"); + _vala_assert (_tmp111_, "test_list.add (\"one\")"); + _tmp112_ = test_list; + _tmp113_ = gee_collection_add ((GeeCollection*) _tmp112_, "five"); + _vala_assert (_tmp113_, "test_list.add (\"five\")"); + _tmp114_ = test_list; + _tmp115_ = gee_collection_add ((GeeCollection*) _tmp114_, "six"); + _vala_assert (_tmp115_, "test_list.add (\"six\")"); + _tmp116_ = dummy; + _tmp117_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp116_, "two"); + _vala_assert (_tmp117_, "dummy.add (\"two\")"); + _tmp118_ = dummy; + _tmp119_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp118_, "three"); + _vala_assert (_tmp119_, "dummy.add (\"three\")"); + _tmp120_ = dummy; + _tmp121_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp120_, "four"); + _vala_assert (_tmp121_, "dummy.add (\"four\")"); + _tmp122_ = test_list; + _tmp123_ = gee_collection_get_size ((GeeCollection*) _tmp122_); + _tmp124_ = _tmp123_; + _vala_assert (_tmp124_ == 4, "test_list.size == 4"); + _tmp125_ = dummy; + _tmp126_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp125_); + _tmp127_ = _tmp126_; + _vala_assert (_tmp127_ == 3, "dummy.size == 3"); + _tmp128_ = test_list; + _tmp129_ = dummy; + gee_list_insert_all (_tmp128_, 2, (GeeCollection*) _tmp129_); + _tmp130_ = test_list; + _tmp131_ = gee_collection_get_size ((GeeCollection*) _tmp130_); + _tmp132_ = _tmp131_; + _vala_assert (_tmp132_ == 7, "test_list.size == 7"); + _tmp133_ = dummy; + _tmp134_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp133_); + _tmp135_ = _tmp134_; + _vala_assert (_tmp135_ == 3, "dummy.size == 3"); + _tmp136_ = test_list; + _tmp137_ = gee_list_get (_tmp136_, 0); + _tmp138_ = (gchar*) _tmp137_; + _vala_assert (g_strcmp0 (_tmp138_, "zero") == 0, "test_list.get (0) == \"zero\""); + _g_free0 (_tmp138_); + _tmp139_ = test_list; + _tmp140_ = gee_list_get (_tmp139_, 1); + _tmp141_ = (gchar*) _tmp140_; + _vala_assert (g_strcmp0 (_tmp141_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp141_); + _tmp142_ = test_list; + _tmp143_ = gee_list_get (_tmp142_, 2); + _tmp144_ = (gchar*) _tmp143_; + _vala_assert (g_strcmp0 (_tmp144_, "two") == 0, "test_list.get (2) == \"two\""); + _g_free0 (_tmp144_); + _tmp145_ = test_list; + _tmp146_ = gee_list_get (_tmp145_, 3); + _tmp147_ = (gchar*) _tmp146_; + _vala_assert (g_strcmp0 (_tmp147_, "three") == 0, "test_list.get (3) == \"three\""); + _g_free0 (_tmp147_); + _tmp148_ = test_list; + _tmp149_ = gee_list_get (_tmp148_, 4); + _tmp150_ = (gchar*) _tmp149_; + _vala_assert (g_strcmp0 (_tmp150_, "four") == 0, "test_list.get (4) == \"four\""); + _g_free0 (_tmp150_); + _tmp151_ = test_list; + _tmp152_ = gee_list_get (_tmp151_, 5); + _tmp153_ = (gchar*) _tmp152_; + _vala_assert (g_strcmp0 (_tmp153_, "five") == 0, "test_list.get (5) == \"five\""); + _g_free0 (_tmp153_); + _tmp154_ = test_list; + _tmp155_ = gee_list_get (_tmp154_, 6); + _tmp156_ = (gchar*) _tmp155_; + _vala_assert (g_strcmp0 (_tmp156_, "six") == 0, "test_list.get (6) == \"six\""); + _g_free0 (_tmp156_); + _tmp157_ = test_list; + gee_collection_clear ((GeeCollection*) _tmp157_); + _tmp158_ = dummy; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp158_); + _tmp159_ = test_list; + _tmp160_ = gee_collection_add ((GeeCollection*) _tmp159_, "zero"); + _vala_assert (_tmp160_, "test_list.add (\"zero\")"); + _tmp161_ = test_list; + _tmp162_ = gee_collection_add ((GeeCollection*) _tmp161_, "one"); + _vala_assert (_tmp162_, "test_list.add (\"one\")"); + _tmp163_ = test_list; + _tmp164_ = gee_collection_add ((GeeCollection*) _tmp163_, "two"); + _vala_assert (_tmp164_, "test_list.add (\"two\")"); + _tmp165_ = dummy; + _tmp166_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp165_, "three"); + _vala_assert (_tmp166_, "dummy.add (\"three\")"); + _tmp167_ = dummy; + _tmp168_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp167_, "four"); + _vala_assert (_tmp168_, "dummy.add (\"four\")"); + _tmp169_ = dummy; + _tmp170_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp169_, "five"); + _vala_assert (_tmp170_, "dummy.add (\"five\")"); + _tmp171_ = test_list; + _tmp172_ = gee_collection_get_size ((GeeCollection*) _tmp171_); + _tmp173_ = _tmp172_; + _vala_assert (_tmp173_ == 3, "test_list.size == 3"); + _tmp174_ = dummy; + _tmp175_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp174_); + _tmp176_ = _tmp175_; + _vala_assert (_tmp176_ == 3, "dummy.size == 3"); + _tmp177_ = test_list; + _tmp178_ = dummy; + gee_list_insert_all (_tmp177_, 3, (GeeCollection*) _tmp178_); + _tmp179_ = test_list; + _tmp180_ = gee_collection_get_size ((GeeCollection*) _tmp179_); + _tmp181_ = _tmp180_; + _vala_assert (_tmp181_ == 6, "test_list.size == 6"); + _tmp182_ = dummy; + _tmp183_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp182_); + _tmp184_ = _tmp183_; + _vala_assert (_tmp184_ == 3, "dummy.size == 3"); + _tmp185_ = test_list; + _tmp186_ = gee_list_get (_tmp185_, 0); + _tmp187_ = (gchar*) _tmp186_; + _vala_assert (g_strcmp0 (_tmp187_, "zero") == 0, "test_list.get (0) == \"zero\""); + _g_free0 (_tmp187_); + _tmp188_ = test_list; + _tmp189_ = gee_list_get (_tmp188_, 1); + _tmp190_ = (gchar*) _tmp189_; + _vala_assert (g_strcmp0 (_tmp190_, "one") == 0, "test_list.get (1) == \"one\""); + _g_free0 (_tmp190_); + _tmp191_ = test_list; + _tmp192_ = gee_list_get (_tmp191_, 2); + _tmp193_ = (gchar*) _tmp192_; + _vala_assert (g_strcmp0 (_tmp193_, "two") == 0, "test_list.get (2) == \"two\""); + _g_free0 (_tmp193_); + _tmp194_ = test_list; + _tmp195_ = gee_list_get (_tmp194_, 3); + _tmp196_ = (gchar*) _tmp195_; + _vala_assert (g_strcmp0 (_tmp196_, "three") == 0, "test_list.get (3) == \"three\""); + _g_free0 (_tmp196_); + _tmp197_ = test_list; + _tmp198_ = gee_list_get (_tmp197_, 4); + _tmp199_ = (gchar*) _tmp198_; + _vala_assert (g_strcmp0 (_tmp199_, "four") == 0, "test_list.get (4) == \"four\""); + _g_free0 (_tmp199_); + _tmp200_ = test_list; + _tmp201_ = gee_list_get (_tmp200_, 5); + _tmp202_ = (gchar*) _tmp201_; + _vala_assert (g_strcmp0 (_tmp202_, "five") == 0, "test_list.get (5) == \"five\""); + _g_free0 (_tmp202_); + _g_object_unref0 (dummy); + _g_object_unref0 (test_list); +} + + +void list_tests_test_slice (ListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeList* _tmp2_; + GeeList* dummy = NULL; + gboolean _tmp3_ = FALSE; + GeeList* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeList* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeList* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeList* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeList* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeList* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeList* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeList* _tmp21_; + GeeList* _tmp22_ = NULL; + GeeList* _tmp23_; + gint _tmp24_; + gint _tmp25_; + GeeList* _tmp26_; + gint _tmp27_; + gint _tmp28_; + GeeList* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + GeeList* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + GeeList* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + gboolean _tmp38_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = test_list; + _vala_assert (_tmp2_ != NULL, "test_list != null"); + _tmp3_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp3_) { + GeeList* _tmp4_; + GeeList* _tmp5_ = NULL; + _tmp4_ = test_list; + _tmp5_ = gee_list_slice (_tmp4_, 1, 4); + _g_object_unref0 (dummy); + dummy = _tmp5_; + exit (0); + } + g_test_trap_assert_failed (); + _tmp6_ = test_list; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "zero"); + _vala_assert (_tmp7_, "test_list.add (\"zero\")"); + _tmp8_ = test_list; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "one"); + _vala_assert (_tmp9_, "test_list.add (\"one\")"); + _tmp10_ = test_list; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "two"); + _vala_assert (_tmp11_, "test_list.add (\"two\")"); + _tmp12_ = test_list; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "three"); + _vala_assert (_tmp13_, "test_list.add (\"three\")"); + _tmp14_ = test_list; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "four"); + _vala_assert (_tmp15_, "test_list.add (\"four\")"); + _tmp16_ = test_list; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "five"); + _vala_assert (_tmp17_, "test_list.add (\"five\")"); + _tmp18_ = test_list; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 6, "test_list.size == 6"); + _tmp21_ = test_list; + _tmp22_ = gee_list_slice (_tmp21_, 1, 4); + _g_object_unref0 (dummy); + dummy = _tmp22_; + _tmp23_ = dummy; + _tmp24_ = gee_collection_get_size ((GeeCollection*) _tmp23_); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_ == 3, "dummy.size == 3"); + _tmp26_ = test_list; + _tmp27_ = gee_collection_get_size ((GeeCollection*) _tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 6, "test_list.size == 6"); + _tmp29_ = dummy; + _tmp30_ = gee_list_get (_tmp29_, 0); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "one") == 0, "dummy.get (0) == \"one\""); + _g_free0 (_tmp31_); + _tmp32_ = dummy; + _tmp33_ = gee_list_get (_tmp32_, 1); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "two") == 0, "dummy.get (1) == \"two\""); + _g_free0 (_tmp34_); + _tmp35_ = dummy; + _tmp36_ = gee_list_get (_tmp35_, 2); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "three") == 0, "dummy.get (2) == \"three\""); + _g_free0 (_tmp37_); + _tmp38_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp38_) { + GeeList* _tmp39_; + GeeList* _tmp40_ = NULL; + _tmp39_ = test_list; + _tmp40_ = gee_list_slice (_tmp39_, 0, 9); + _g_object_unref0 (dummy); + dummy = _tmp40_; + exit (0); + } + g_test_trap_assert_failed (); + _g_object_unref0 (dummy); + _g_object_unref0 (test_list); +} + + +static void list_tests_class_init (ListTestsClass * klass) { + list_tests_parent_class = g_type_class_peek_parent (klass); + LIST_TESTS_CLASS (klass)->test_duplicates_are_retained = list_tests_real_test_duplicates_are_retained; +} + + +static void list_tests_instance_init (ListTests * self) { +} + + +GType list_tests_get_type (void) { + static volatile gsize list_tests_type_id__volatile = 0; + if (g_once_init_enter (&list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ListTests), 0, (GInstanceInitFunc) list_tests_instance_init, NULL }; + GType list_tests_type_id; + list_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "ListTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&list_tests_type_id__volatile, list_tests_type_id); + } + return list_tests_type_id__volatile; +} + + + diff --git a/tests/testlist.vala b/tests/testlist.vala new file mode 100644 index 0000000..48ca387 --- /dev/null +++ b/tests/testlist.vala @@ -0,0 +1,667 @@ +/* testlist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using GLib; +using Gee; + +public abstract class ListTests : CollectionTests { + + public ListTests (string name) { + base (name); + add_test ("[List] iterator is ordered", test_iterator_is_ordered); + add_test ("[List] list iterator", test_list_iterator); + add_test ("[List] duplicates are retained", + test_duplicates_are_retained); + add_test ("[List] get", test_get); + add_test ("[List] set", test_set); + add_test ("[List] insert", test_insert); + add_test ("[List] remove_at", test_remove_at); + add_test ("[List] index_of", test_index_of); + add_test ("[List] first", test_first); + add_test ("[List] last", test_last); + add_test ("[List] insert_all", test_insert_all); + add_test ("[List] slice", test_slice); + } + + public void test_iterator_is_ordered () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check iterate empty list + var iterator = test_list.iterator (); + assert (! iterator.next ()); + + // Check iterate list + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("one")); + + iterator = test_list.iterator (); + assert (iterator.next()); + assert (iterator.get () == "one"); + assert (iterator.next()); + assert (iterator.get () == "two"); + assert (iterator.next()); + assert (iterator.get () == "three"); + assert (iterator.next()); + assert (iterator.get () == "one"); + assert (! iterator.next ()); + } + + public void test_list_iterator () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check iterate empty list + var iterator = test_list.list_iterator (); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + assert (! iterator.has_previous ()); + assert (! iterator.previous ()); + assert (! iterator.first ()); + assert (! iterator.last ()); + + // Check iterate list + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + + iterator = test_list.list_iterator (); + assert (iterator.next()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + iterator.set ("new one"); + assert (iterator.next()); + assert (iterator.get () == "two"); + assert (iterator.index () == 1); + iterator.set ("new two"); + assert (test_list.size == 3); + assert (iterator.index () == 1); + iterator.insert ("before two"); + assert (test_list.size == 4); + assert (iterator.index () == 2); + iterator.add ("after two"); + assert (test_list.size == 5); + assert (iterator.index () == 3); + assert (iterator.next()); + assert (iterator.get () == "three"); + assert (iterator.index () == 4); + iterator.set ("new three"); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.first ()); + assert (iterator.get () == "new one"); + assert (iterator.index () == 0); + assert (! iterator.has_previous ()); + assert (! iterator.previous ()); + + assert (iterator.last ()); + assert (iterator.get () == "new three"); + assert (iterator.index () == 4); + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "after two"); + assert (iterator.index () == 3); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "new two"); + assert (iterator.index () == 2); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "before two"); + assert (iterator.index () == 1); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "new one"); + assert (iterator.index () == 0); + } + + public virtual void test_duplicates_are_retained () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + assert (test_list.add ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 1); + + assert (test_list.add ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 2); + + assert (test_list.add ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 3); + + assert (test_list.remove ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 2); + + assert (test_list.remove ("one")); + assert (test_list.contains ("one")); + assert (test_list.size == 1); + + assert (test_list.remove ("one")); + assert (!test_list.contains ("one")); + assert (test_list.size == 0); + } + + public void test_get () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check get for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (0); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check get for valid index in list with one element + assert (test_list.add ("one")); + assert (test_list.get (0) == "one"); + + // Check get for indexes out of range + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (1); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check get for invalid index number + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (-1); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check get for valid indexes in list with multiple element + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.get (0) == "one"); + assert (test_list.get (1) == "two"); + assert (test_list.get (2) == "three"); + + // Check get if list is cleared and empty again + test_list.clear (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.get (0); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_set () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check set when list is empty + assert (test_list.size == 0); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.set (0, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (test_list.size == 0); + + // Check set when one item is in list + assert (test_list.add ("one")); // Add item "one" + assert (test_list.size == 1); + assert (test_list.get (0) == "one"); + + test_list.set (0, "two"); // Set the item to value 2 + assert (test_list.size == 1); + assert (test_list.get (0) == "two"); + + // Check set when index out of range + assert (test_list.size == 1); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.set (1, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (test_list.size == 1); + } + + public void test_insert () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check inserting in empty list + // Inserting at index 1 + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert (1, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Inserting at index 0 + assert (test_list.size == 0); + test_list.insert (0, "one"); + assert (test_list.size == 1); + assert (test_list.get (0) == "one"); + + // Check insert to the beginning + test_list.insert (0, "two"); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "one"); + + // Check insert in between + test_list.insert (1, "three"); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "one"); + + // Check insert into index out of current range + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert (4, "four"); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check insert to the end + test_list.insert (3, "four"); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "one"); + assert (test_list.get (3) == "four"); + + // Check insert into invalid index + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert (-1, "zero"); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_remove_at () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check removing in empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (0); + Posix.exit (0); + } + Test.trap_assert_failed (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (1); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // add 5 items + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.add ("five")); + assert (test_list.size == 5); + + // Check remove_at first + assert (test_list.remove_at (0) == "one"); + assert (test_list.size == 4); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "four"); + assert (test_list.get (3) == "five"); + + // Check remove_at last + assert (test_list.remove_at (3) == "five"); + assert (test_list.size == 3); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "three"); + assert (test_list.get (2) == "four"); + + // Check remove_at in between + assert (test_list.remove_at (1) == "three"); + assert (test_list.size == 2); + assert (test_list.get (0) == "two"); + assert (test_list.get (1) == "four"); + + // Check remove_at when index out of range + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (2); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check remove_at when invalid index + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.remove_at (-1); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_index_of () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check empty list + assert (test_list.index_of ("one") == -1); + + // Check one item + assert (test_list.add ("one")); + assert (test_list.index_of ("one") == 0); + assert (test_list.index_of ("two") == -1); + + // Check more items + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.index_of ("one") == 0); + assert (test_list.index_of ("two") == 1); + assert (test_list.index_of ("three") == 2); + assert (test_list.index_of ("four") == 3); + assert (test_list.index_of ("five") == -1); + } + + public void test_first () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check first for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check first for list with one element + assert (test_list.add ("one")); + assert (test_list.first () == "one"); + assert (test_list.first () == test_list.get (0)); + + // Check first for for list with multiple element + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.first () == "one"); + assert (test_list.first () == test_list.get (0)); + + // Check first if list is cleared and empty again + test_list.clear (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_last () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + // Check last for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check last for list with one element + assert (test_list.add ("one")); + assert (test_list.last () == "one"); + assert (test_list.last () == test_list.get (test_list.size - 1)); + + // Check last for for list with multiple element + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.last () == "three"); + assert (test_list.last () == test_list.get (test_list.size - 1)); + + // Check last if list is cleared and empty again + test_list.clear (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + + public void test_insert_all () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + + var dummy = new ArrayList<string> (); + + // Insert an empty list + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("two")); + + assert (test_list.size == 3); + assert (dummy.is_empty); + + test_list.insert_all (0, dummy); + + assert (test_list.size == 3); + assert (dummy.is_empty); + + test_list.clear (); + dummy.clear (); + + // Insert into an empty list at index 0 + assert (dummy.add ("zero")); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (test_list.is_empty); + assert (dummy.size == 3); + + test_list.insert_all (0, dummy); + + assert (test_list.size == 3); + assert (dummy.size == 3); + + test_list.clear (); + dummy.clear (); + + // Insert all into empty list as index 1 + assert (dummy.add ("zero")); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (test_list.is_empty); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_list.insert_all (1, dummy); + Posix.exit (0); + } + Test.trap_assert_failed (); + + test_list.clear (); + dummy.clear (); + + // Insert all in the beginnig + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.add ("five")); + + assert (dummy.add ("zero")); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (test_list.size == 3); + assert (dummy.size == 3); + + test_list.insert_all (0, dummy); + + assert (test_list.size == 6); + assert (dummy.size == 3); + + assert (test_list.get (0) == "zero"); + assert (test_list.get (1) == "one"); + assert (test_list.get (2) == "two"); + assert (test_list.get (3) == "three"); + assert (test_list.get (4) == "four"); + assert (test_list.get (5) == "five"); + + test_list.clear (); + dummy.clear (); + + // Insert all in the middle + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("five")); + assert (test_list.add ("six")); + + assert (dummy.add ("two")); + assert (dummy.add ("three")); + assert (dummy.add ("four")); + + assert (test_list.size == 4); + assert (dummy.size == 3); + + test_list.insert_all (2, dummy); + + assert (test_list.size == 7); + assert (dummy.size == 3); + + assert (test_list.get (0) == "zero"); + assert (test_list.get (1) == "one"); + assert (test_list.get (2) == "two"); + assert (test_list.get (3) == "three"); + assert (test_list.get (4) == "four"); + assert (test_list.get (5) == "five"); + assert (test_list.get (6) == "six"); + + test_list.clear (); + dummy.clear (); + + // Insert all in at the end + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("two")); + + assert (dummy.add ("three")); + assert (dummy.add ("four")); + assert (dummy.add ("five")); + + assert (test_list.size == 3); + assert (dummy.size == 3); + + test_list.insert_all (3, dummy); + + assert (test_list.size == 6); + assert (dummy.size == 3); + + assert (test_list.get (0) == "zero"); + assert (test_list.get (1) == "one"); + assert (test_list.get (2) == "two"); + assert (test_list.get (3) == "three"); + assert (test_list.get (4) == "four"); + assert (test_list.get (5) == "five"); + } + + public void test_slice () { + var test_list = test_collection as Gee.List<string>; + + // Check the test list is not null + assert (test_list != null); + Gee.List<string> dummy; + + // Check first for empty list + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + dummy = test_list.slice (1, 4); + Posix.exit (0); + } + Test.trap_assert_failed (); + + // Check for list with some items + assert (test_list.add ("zero")); + assert (test_list.add ("one")); + assert (test_list.add ("two")); + assert (test_list.add ("three")); + assert (test_list.add ("four")); + assert (test_list.add ("five")); + assert (test_list.size == 6); + + dummy = test_list.slice (1, 4); + assert (dummy.size == 3); + assert (test_list.size == 6); + + assert (dummy.get (0) == "one"); + assert (dummy.get (1) == "two"); + assert (dummy.get (2) == "three"); + + // Check for invalid indices + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + dummy = test_list.slice (0, 9); + Posix.exit (0); + } + Test.trap_assert_failed (); + } +} diff --git a/tests/testmain.c b/tests/testmain.c new file mode 100644 index 0000000..2b62033 --- /dev/null +++ b/tests/testmain.c @@ -0,0 +1,554 @@ +/* testmain.c generated by valac 0.18.0, the Vala compiler + * generated from testmain.vala, do not modify */ + +/* testmain.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; + +#define TYPE_LIST_TESTS (list_tests_get_type ()) +#define LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIST_TESTS, ListTests)) +#define LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIST_TESTS, ListTestsClass)) +#define IS_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIST_TESTS)) +#define IS_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIST_TESTS)) +#define LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIST_TESTS, ListTestsClass)) + +typedef struct _ListTests ListTests; +typedef struct _ListTestsClass ListTestsClass; + +#define TYPE_ARRAY_LIST_TESTS (array_list_tests_get_type ()) +#define ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTests)) +#define ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) +#define IS_ARRAY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ARRAY_LIST_TESTS)) +#define IS_ARRAY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ARRAY_LIST_TESTS)) +#define ARRAY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ARRAY_LIST_TESTS, ArrayListTestsClass)) + +typedef struct _ArrayListTests ArrayListTests; +typedef struct _ArrayListTestsClass ArrayListTestsClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +#define TYPE_COMPARABLE_TESTS (comparable_tests_get_type ()) +#define COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMPARABLE_TESTS, ComparableTests)) +#define COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) +#define IS_COMPARABLE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMPARABLE_TESTS)) +#define IS_COMPARABLE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMPARABLE_TESTS)) +#define COMPARABLE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COMPARABLE_TESTS, ComparableTestsClass)) + +typedef struct _ComparableTests ComparableTests; +typedef struct _ComparableTestsClass ComparableTestsClass; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; + +#define TYPE_HASH_MAP_TESTS (hash_map_tests_get_type ()) +#define HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MAP_TESTS, HashMapTests)) +#define HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) +#define IS_HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MAP_TESTS)) +#define IS_HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MAP_TESTS)) +#define HASH_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MAP_TESTS, HashMapTestsClass)) + +typedef struct _HashMapTests HashMapTests; +typedef struct _HashMapTestsClass HashMapTestsClass; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; + +#define TYPE_HASH_MULTI_MAP_TESTS (hash_multi_map_tests_get_type ()) +#define HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTests)) +#define HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) +#define IS_HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_MAP_TESTS)) +#define IS_HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_MAP_TESTS)) +#define HASH_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass)) + +typedef struct _HashMultiMapTests HashMultiMapTests; +typedef struct _HashMultiMapTestsClass HashMultiMapTestsClass; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; + +#define TYPE_HASH_MULTI_SET_TESTS (hash_multi_set_tests_get_type ()) +#define HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTests)) +#define HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) +#define IS_HASH_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_SET_TESTS)) +#define IS_HASH_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_SET_TESTS)) +#define HASH_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_SET_TESTS, HashMultiSetTestsClass)) + +typedef struct _HashMultiSetTests HashMultiSetTests; +typedef struct _HashMultiSetTestsClass HashMultiSetTestsClass; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; + +#define TYPE_HASH_SET_TESTS (hash_set_tests_get_type ()) +#define HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_SET_TESTS, HashSetTests)) +#define HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_SET_TESTS, HashSetTestsClass)) +#define IS_HASH_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_SET_TESTS)) +#define IS_HASH_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_SET_TESTS)) +#define HASH_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_SET_TESTS, HashSetTestsClass)) + +typedef struct _HashSetTests HashSetTests; +typedef struct _HashSetTestsClass HashSetTestsClass; + +#define TYPE_LINKED_LIST_TESTS (linked_list_tests_get_type ()) +#define LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTests)) +#define LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) +#define IS_LINKED_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_TESTS)) +#define IS_LINKED_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_TESTS)) +#define LINKED_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_TESTS, LinkedListTestsClass)) + +typedef struct _LinkedListTests LinkedListTests; +typedef struct _LinkedListTestsClass LinkedListTestsClass; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; + +#define TYPE_DEQUE_TESTS (deque_tests_get_type ()) +#define DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DEQUE_TESTS, DequeTests)) +#define DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DEQUE_TESTS, DequeTestsClass)) +#define IS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DEQUE_TESTS)) +#define IS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DEQUE_TESTS)) +#define DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DEQUE_TESTS, DequeTestsClass)) + +typedef struct _DequeTests DequeTests; +typedef struct _DequeTestsClass DequeTestsClass; + +#define TYPE_LINKED_LIST_AS_DEQUE_TESTS (linked_list_as_deque_tests_get_type ()) +#define LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTests)) +#define LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define IS_LINKED_LIST_AS_DEQUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LINKED_LIST_AS_DEQUE_TESTS)) +#define LINKED_LIST_AS_DEQUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LINKED_LIST_AS_DEQUE_TESTS, LinkedListAsDequeTestsClass)) + +typedef struct _LinkedListAsDequeTests LinkedListAsDequeTests; +typedef struct _LinkedListAsDequeTestsClass LinkedListAsDequeTestsClass; + +#define TYPE_PRIORITY_QUEUE_TESTS (priority_queue_tests_get_type ()) +#define PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTests)) +#define PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) +#define IS_PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PRIORITY_QUEUE_TESTS)) +#define IS_PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PRIORITY_QUEUE_TESTS)) +#define PRIORITY_QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) + +typedef struct _PriorityQueueTests PriorityQueueTests; +typedef struct _PriorityQueueTestsClass PriorityQueueTestsClass; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; + +#define TYPE_READ_ONLY_LIST_TESTS (read_only_list_tests_get_type ()) +#define READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTests)) +#define READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) +#define IS_READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_LIST_TESTS)) +#define IS_READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_LIST_TESTS)) +#define READ_ONLY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) + +typedef struct _ReadOnlyListTests ReadOnlyListTests; +typedef struct _ReadOnlyListTestsClass ReadOnlyListTestsClass; + +#define TYPE_READ_ONLY_MAP_TESTS (read_only_map_tests_get_type ()) +#define READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTests)) +#define READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) +#define IS_READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_MAP_TESTS)) +#define IS_READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_MAP_TESTS)) +#define READ_ONLY_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) + +typedef struct _ReadOnlyMapTests ReadOnlyMapTests; +typedef struct _ReadOnlyMapTestsClass ReadOnlyMapTestsClass; + +#define TYPE_READ_ONLY_SET_TESTS (read_only_set_tests_get_type ()) +#define READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTests)) +#define READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) +#define IS_READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_SET_TESTS)) +#define IS_READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_SET_TESTS)) +#define READ_ONLY_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) + +typedef struct _ReadOnlySetTests ReadOnlySetTests; +typedef struct _ReadOnlySetTestsClass ReadOnlySetTestsClass; + +#define TYPE_TREE_MAP_TESTS (tree_map_tests_get_type ()) +#define TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MAP_TESTS, TreeMapTests)) +#define TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) +#define IS_TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MAP_TESTS)) +#define IS_TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MAP_TESTS)) +#define TREE_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) + +typedef struct _TreeMapTests TreeMapTests; +typedef struct _TreeMapTestsClass TreeMapTestsClass; + +#define TYPE_TREE_MULTI_MAP_TESTS (tree_multi_map_tests_get_type ()) +#define TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTests)) +#define TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) +#define IS_TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_MAP_TESTS)) +#define IS_TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_MAP_TESTS)) +#define TREE_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) + +typedef struct _TreeMultiMapTests TreeMultiMapTests; +typedef struct _TreeMultiMapTestsClass TreeMultiMapTestsClass; + +#define TYPE_TREE_MULTI_SET_TESTS (tree_multi_set_tests_get_type ()) +#define TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTests)) +#define TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) +#define IS_TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_SET_TESTS)) +#define IS_TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_SET_TESTS)) +#define TREE_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) + +typedef struct _TreeMultiSetTests TreeMultiSetTests; +typedef struct _TreeMultiSetTestsClass TreeMultiSetTestsClass; + +#define TYPE_SORTED_SET_TESTS (sorted_set_tests_get_type ()) +#define SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SORTED_SET_TESTS, SortedSetTests)) +#define SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) +#define IS_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SORTED_SET_TESTS)) +#define IS_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SORTED_SET_TESTS)) +#define SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) + +typedef struct _SortedSetTests SortedSetTests; +typedef struct _SortedSetTestsClass SortedSetTestsClass; + +#define TYPE_TREE_SET_TESTS (tree_set_tests_get_type ()) +#define TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_SET_TESTS, TreeSetTests)) +#define TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) +#define IS_TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_SET_TESTS)) +#define IS_TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_SET_TESTS)) +#define TREE_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) + +typedef struct _TreeSetTests TreeSetTests; +typedef struct _TreeSetTestsClass TreeSetTestsClass; + + + +void _vala_main (gchar** args, int args_length1); +ArrayListTests* array_list_tests_new (void); +ArrayListTests* array_list_tests_construct (GType object_type); +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType list_tests_get_type (void) G_GNUC_CONST; +GType array_list_tests_get_type (void) G_GNUC_CONST; +GTestSuite* gee_test_case_get_suite (GeeTestCase* self); +ComparableTests* comparable_tests_new (void); +ComparableTests* comparable_tests_construct (GType object_type); +GType comparable_tests_get_type (void) G_GNUC_CONST; +HashMapTests* hash_map_tests_new (void); +HashMapTests* hash_map_tests_construct (GType object_type); +GType map_tests_get_type (void) G_GNUC_CONST; +GType hash_map_tests_get_type (void) G_GNUC_CONST; +HashMultiMapTests* hash_multi_map_tests_new (void); +HashMultiMapTests* hash_multi_map_tests_construct (GType object_type); +GType multi_map_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_map_tests_get_type (void) G_GNUC_CONST; +HashMultiSetTests* hash_multi_set_tests_new (void); +HashMultiSetTests* hash_multi_set_tests_construct (GType object_type); +GType multi_set_tests_get_type (void) G_GNUC_CONST; +GType hash_multi_set_tests_get_type (void) G_GNUC_CONST; +HashSetTests* hash_set_tests_new (void); +HashSetTests* hash_set_tests_construct (GType object_type); +GType set_tests_get_type (void) G_GNUC_CONST; +GType hash_set_tests_get_type (void) G_GNUC_CONST; +LinkedListTests* linked_list_tests_new (void); +LinkedListTests* linked_list_tests_construct (GType object_type); +GType linked_list_tests_get_type (void) G_GNUC_CONST; +LinkedListAsDequeTests* linked_list_as_deque_tests_new (void); +LinkedListAsDequeTests* linked_list_as_deque_tests_construct (GType object_type); +GType queue_tests_get_type (void) G_GNUC_CONST; +GType deque_tests_get_type (void) G_GNUC_CONST; +GType linked_list_as_deque_tests_get_type (void) G_GNUC_CONST; +PriorityQueueTests* priority_queue_tests_new (void); +PriorityQueueTests* priority_queue_tests_construct (GType object_type); +GType priority_queue_tests_get_type (void) G_GNUC_CONST; +ReadOnlyCollectionTests* read_only_collection_tests_new (void); +ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type); +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +ReadOnlyListTests* read_only_list_tests_new (void); +ReadOnlyListTests* read_only_list_tests_construct (GType object_type); +GType read_only_list_tests_get_type (void) G_GNUC_CONST; +ReadOnlyMapTests* read_only_map_tests_new (void); +ReadOnlyMapTests* read_only_map_tests_construct (GType object_type); +GType read_only_map_tests_get_type (void) G_GNUC_CONST; +ReadOnlySetTests* read_only_set_tests_new (void); +ReadOnlySetTests* read_only_set_tests_construct (GType object_type); +GType read_only_set_tests_get_type (void) G_GNUC_CONST; +TreeMapTests* tree_map_tests_new (void); +TreeMapTests* tree_map_tests_construct (GType object_type); +GType tree_map_tests_get_type (void) G_GNUC_CONST; +TreeMultiMapTests* tree_multi_map_tests_new (void); +TreeMultiMapTests* tree_multi_map_tests_construct (GType object_type); +GType tree_multi_map_tests_get_type (void) G_GNUC_CONST; +TreeMultiSetTests* tree_multi_set_tests_new (void); +TreeMultiSetTests* tree_multi_set_tests_construct (GType object_type); +GType tree_multi_set_tests_get_type (void) G_GNUC_CONST; +TreeSetTests* tree_set_tests_new (void); +TreeSetTests* tree_set_tests_construct (GType object_type); +GType sorted_set_tests_get_type (void) G_GNUC_CONST; +GType tree_set_tests_get_type (void) G_GNUC_CONST; + + +void _vala_main (gchar** args, int args_length1) { + GTestSuite* _tmp0_ = NULL; + ArrayListTests* _tmp1_; + ArrayListTests* _tmp2_; + GTestSuite* _tmp3_ = NULL; + GTestSuite* _tmp4_ = NULL; + ComparableTests* _tmp5_; + ComparableTests* _tmp6_; + GTestSuite* _tmp7_ = NULL; + GTestSuite* _tmp8_ = NULL; + HashMapTests* _tmp9_; + HashMapTests* _tmp10_; + GTestSuite* _tmp11_ = NULL; + GTestSuite* _tmp12_ = NULL; + HashMultiMapTests* _tmp13_; + HashMultiMapTests* _tmp14_; + GTestSuite* _tmp15_ = NULL; + GTestSuite* _tmp16_ = NULL; + HashMultiSetTests* _tmp17_; + HashMultiSetTests* _tmp18_; + GTestSuite* _tmp19_ = NULL; + GTestSuite* _tmp20_ = NULL; + HashSetTests* _tmp21_; + HashSetTests* _tmp22_; + GTestSuite* _tmp23_ = NULL; + GTestSuite* _tmp24_ = NULL; + LinkedListTests* _tmp25_; + LinkedListTests* _tmp26_; + GTestSuite* _tmp27_ = NULL; + GTestSuite* _tmp28_ = NULL; + LinkedListAsDequeTests* _tmp29_; + LinkedListAsDequeTests* _tmp30_; + GTestSuite* _tmp31_ = NULL; + GTestSuite* _tmp32_ = NULL; + PriorityQueueTests* _tmp33_; + PriorityQueueTests* _tmp34_; + GTestSuite* _tmp35_ = NULL; + GTestSuite* _tmp36_ = NULL; + ReadOnlyCollectionTests* _tmp37_; + ReadOnlyCollectionTests* _tmp38_; + GTestSuite* _tmp39_ = NULL; + GTestSuite* _tmp40_ = NULL; + ReadOnlyListTests* _tmp41_; + ReadOnlyListTests* _tmp42_; + GTestSuite* _tmp43_ = NULL; + GTestSuite* _tmp44_ = NULL; + ReadOnlyMapTests* _tmp45_; + ReadOnlyMapTests* _tmp46_; + GTestSuite* _tmp47_ = NULL; + GTestSuite* _tmp48_ = NULL; + ReadOnlySetTests* _tmp49_; + ReadOnlySetTests* _tmp50_; + GTestSuite* _tmp51_ = NULL; + GTestSuite* _tmp52_ = NULL; + TreeMapTests* _tmp53_; + TreeMapTests* _tmp54_; + GTestSuite* _tmp55_ = NULL; + GTestSuite* _tmp56_ = NULL; + TreeMultiMapTests* _tmp57_; + TreeMultiMapTests* _tmp58_; + GTestSuite* _tmp59_ = NULL; + GTestSuite* _tmp60_ = NULL; + TreeMultiSetTests* _tmp61_; + TreeMultiSetTests* _tmp62_; + GTestSuite* _tmp63_ = NULL; + GTestSuite* _tmp64_ = NULL; + TreeSetTests* _tmp65_; + TreeSetTests* _tmp66_; + GTestSuite* _tmp67_ = NULL; + g_test_init (&args_length1, &args, NULL); + _tmp0_ = g_test_get_root (); + _tmp1_ = array_list_tests_new (); + _tmp2_ = _tmp1_; + _tmp3_ = gee_test_case_get_suite ((GeeTestCase*) _tmp2_); + g_test_suite_add_suite (_tmp0_, _tmp3_); + _g_object_unref0 (_tmp2_); + _tmp4_ = g_test_get_root (); + _tmp5_ = comparable_tests_new (); + _tmp6_ = _tmp5_; + _tmp7_ = gee_test_case_get_suite ((GeeTestCase*) _tmp6_); + g_test_suite_add_suite (_tmp4_, _tmp7_); + _g_object_unref0 (_tmp6_); + _tmp8_ = g_test_get_root (); + _tmp9_ = hash_map_tests_new (); + _tmp10_ = _tmp9_; + _tmp11_ = gee_test_case_get_suite ((GeeTestCase*) _tmp10_); + g_test_suite_add_suite (_tmp8_, _tmp11_); + _g_object_unref0 (_tmp10_); + _tmp12_ = g_test_get_root (); + _tmp13_ = hash_multi_map_tests_new (); + _tmp14_ = _tmp13_; + _tmp15_ = gee_test_case_get_suite ((GeeTestCase*) _tmp14_); + g_test_suite_add_suite (_tmp12_, _tmp15_); + _g_object_unref0 (_tmp14_); + _tmp16_ = g_test_get_root (); + _tmp17_ = hash_multi_set_tests_new (); + _tmp18_ = _tmp17_; + _tmp19_ = gee_test_case_get_suite ((GeeTestCase*) _tmp18_); + g_test_suite_add_suite (_tmp16_, _tmp19_); + _g_object_unref0 (_tmp18_); + _tmp20_ = g_test_get_root (); + _tmp21_ = hash_set_tests_new (); + _tmp22_ = _tmp21_; + _tmp23_ = gee_test_case_get_suite ((GeeTestCase*) _tmp22_); + g_test_suite_add_suite (_tmp20_, _tmp23_); + _g_object_unref0 (_tmp22_); + _tmp24_ = g_test_get_root (); + _tmp25_ = linked_list_tests_new (); + _tmp26_ = _tmp25_; + _tmp27_ = gee_test_case_get_suite ((GeeTestCase*) _tmp26_); + g_test_suite_add_suite (_tmp24_, _tmp27_); + _g_object_unref0 (_tmp26_); + _tmp28_ = g_test_get_root (); + _tmp29_ = linked_list_as_deque_tests_new (); + _tmp30_ = _tmp29_; + _tmp31_ = gee_test_case_get_suite ((GeeTestCase*) _tmp30_); + g_test_suite_add_suite (_tmp28_, _tmp31_); + _g_object_unref0 (_tmp30_); + _tmp32_ = g_test_get_root (); + _tmp33_ = priority_queue_tests_new (); + _tmp34_ = _tmp33_; + _tmp35_ = gee_test_case_get_suite ((GeeTestCase*) _tmp34_); + g_test_suite_add_suite (_tmp32_, _tmp35_); + _g_object_unref0 (_tmp34_); + _tmp36_ = g_test_get_root (); + _tmp37_ = read_only_collection_tests_new (); + _tmp38_ = _tmp37_; + _tmp39_ = gee_test_case_get_suite ((GeeTestCase*) _tmp38_); + g_test_suite_add_suite (_tmp36_, _tmp39_); + _g_object_unref0 (_tmp38_); + _tmp40_ = g_test_get_root (); + _tmp41_ = read_only_list_tests_new (); + _tmp42_ = _tmp41_; + _tmp43_ = gee_test_case_get_suite ((GeeTestCase*) _tmp42_); + g_test_suite_add_suite (_tmp40_, _tmp43_); + _g_object_unref0 (_tmp42_); + _tmp44_ = g_test_get_root (); + _tmp45_ = read_only_map_tests_new (); + _tmp46_ = _tmp45_; + _tmp47_ = gee_test_case_get_suite ((GeeTestCase*) _tmp46_); + g_test_suite_add_suite (_tmp44_, _tmp47_); + _g_object_unref0 (_tmp46_); + _tmp48_ = g_test_get_root (); + _tmp49_ = read_only_set_tests_new (); + _tmp50_ = _tmp49_; + _tmp51_ = gee_test_case_get_suite ((GeeTestCase*) _tmp50_); + g_test_suite_add_suite (_tmp48_, _tmp51_); + _g_object_unref0 (_tmp50_); + _tmp52_ = g_test_get_root (); + _tmp53_ = tree_map_tests_new (); + _tmp54_ = _tmp53_; + _tmp55_ = gee_test_case_get_suite ((GeeTestCase*) _tmp54_); + g_test_suite_add_suite (_tmp52_, _tmp55_); + _g_object_unref0 (_tmp54_); + _tmp56_ = g_test_get_root (); + _tmp57_ = tree_multi_map_tests_new (); + _tmp58_ = _tmp57_; + _tmp59_ = gee_test_case_get_suite ((GeeTestCase*) _tmp58_); + g_test_suite_add_suite (_tmp56_, _tmp59_); + _g_object_unref0 (_tmp58_); + _tmp60_ = g_test_get_root (); + _tmp61_ = tree_multi_set_tests_new (); + _tmp62_ = _tmp61_; + _tmp63_ = gee_test_case_get_suite ((GeeTestCase*) _tmp62_); + g_test_suite_add_suite (_tmp60_, _tmp63_); + _g_object_unref0 (_tmp62_); + _tmp64_ = g_test_get_root (); + _tmp65_ = tree_set_tests_new (); + _tmp66_ = _tmp65_; + _tmp67_ = gee_test_case_get_suite ((GeeTestCase*) _tmp66_); + g_test_suite_add_suite (_tmp64_, _tmp67_); + _g_object_unref0 (_tmp66_); + g_test_run (); +} + + +int main (int argc, char ** argv) { + g_type_init (); + _vala_main (argv, argc); + return 0; +} + + + diff --git a/tests/testmain.vala b/tests/testmain.vala new file mode 100644 index 0000000..ad6e992 --- /dev/null +++ b/tests/testmain.vala @@ -0,0 +1,46 @@ +/* testmain.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +void main (string[] args) { + Test.init (ref args); + + TestSuite.get_root ().add_suite (new ArrayListTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ComparableTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashMultiMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashMultiSetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new HashSetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new LinkedListTests ().get_suite ()); + TestSuite.get_root ().add_suite (new LinkedListAsDequeTests ().get_suite ()); + TestSuite.get_root ().add_suite (new PriorityQueueTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlyCollectionTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlyListTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlyMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new ReadOnlySetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeMultiMapTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeMultiSetTests ().get_suite ()); + TestSuite.get_root ().add_suite (new TreeSetTests ().get_suite ()); + + Test.run (); +} diff --git a/tests/testmap.c b/tests/testmap.c new file mode 100644 index 0000000..e49ca88 --- /dev/null +++ b/tests/testmap.c @@ -0,0 +1,2060 @@ +/* testmap.c generated by valac 0.18.0, the Vala compiler + * generated from testmap.vala, do not modify */ + +/* testmap.vala + * + * Copyright (C) 2008 Jürg Billeter, Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Maciej Piechotka <uzytkownik2@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; +typedef struct _MapTestsPrivate MapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) + +#define MAP_TESTS_TYPE_TEST_ENTRY (map_tests_test_entry_get_type ()) +#define MAP_TESTS_TEST_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry)) +#define MAP_TESTS_TEST_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntryClass)) +#define MAP_TESTS_IS_TEST_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAP_TESTS_TYPE_TEST_ENTRY)) +#define MAP_TESTS_IS_TEST_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAP_TESTS_TYPE_TEST_ENTRY)) +#define MAP_TESTS_TEST_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntryClass)) + +typedef struct _MapTestsTestEntry MapTestsTestEntry; +typedef struct _MapTestsTestEntryClass MapTestsTestEntryClass; +typedef struct _MapTestsTestEntryPrivate MapTestsTestEntryPrivate; +#define _k_destroy_func0(var) (((var == NULL) || (k_destroy_func == NULL)) ? NULL : (var = (k_destroy_func (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MapTests { + GeeTestCase parent_instance; + MapTestsPrivate * priv; + GeeMap* test_map; +}; + +struct _MapTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +struct _MapTestsTestEntry { + GeeMapEntry parent_instance; + MapTestsTestEntryPrivate * priv; +}; + +struct _MapTestsTestEntryClass { + GeeMapEntryClass parent_class; +}; + +struct _MapTestsTestEntryPrivate { + GType k_type; + GBoxedCopyFunc k_dup_func; + GDestroyNotify k_destroy_func; + GType v_type; + GBoxedCopyFunc v_dup_func; + GDestroyNotify v_destroy_func; + gpointer _key; + gpointer _value; +}; + + +static gpointer map_tests_parent_class = NULL; +static gpointer map_tests_test_entry_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType map_tests_get_type (void) G_GNUC_CONST; +enum { + MAP_TESTS_DUMMY_PROPERTY +}; +MapTests* map_tests_construct (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void map_tests_test_type_correctness (MapTests* self); +static void _map_tests_test_type_correctness_gee_test_case_test_method (gpointer self); +void map_tests_test_has_key_size_is_empty (MapTests* self); +static void _map_tests_test_has_key_size_is_empty_gee_test_case_test_method (gpointer self); +void map_tests_test_keys (MapTests* self); +static void _map_tests_test_keys_gee_test_case_test_method (gpointer self); +void map_tests_test_values (MapTests* self); +static void _map_tests_test_values_gee_test_case_test_method (gpointer self); +void map_tests_test_entries (MapTests* self); +static void _map_tests_test_entries_gee_test_case_test_method (gpointer self); +void map_tests_test_set_all (MapTests* self); +static void _map_tests_test_set_all_gee_test_case_test_method (gpointer self); +void map_tests_test_unset_all (MapTests* self); +static void _map_tests_test_unset_all_gee_test_case_test_method (gpointer self); +void map_tests_test_has_all (MapTests* self); +static void _map_tests_test_has_all_gee_test_case_test_method (gpointer self); +void map_tests_test_gobject_properties (MapTests* self); +static void _map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +MapTestsTestEntry* map_tests_test_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value); +MapTestsTestEntry* map_tests_test_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value); +GType map_tests_test_entry_get_type (void) G_GNUC_CONST; +void map_tests_test_clear (MapTests* self); +#define MAP_TESTS_TEST_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntryPrivate)) +enum { + MAP_TESTS_TEST_ENTRY_DUMMY_PROPERTY, + MAP_TESTS_TEST_ENTRY_K_TYPE, + MAP_TESTS_TEST_ENTRY_K_DUP_FUNC, + MAP_TESTS_TEST_ENTRY_K_DESTROY_FUNC, + MAP_TESTS_TEST_ENTRY_V_TYPE, + MAP_TESTS_TEST_ENTRY_V_DUP_FUNC, + MAP_TESTS_TEST_ENTRY_V_DESTROY_FUNC, + MAP_TESTS_TEST_ENTRY_KEY, + MAP_TESTS_TEST_ENTRY_VALUE +}; +static void map_tests_test_entry_finalize (GObject* obj); +static void _vala_map_tests_test_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_map_tests_test_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void map_tests_finalize (GObject* obj); + + +static void _map_tests_test_type_correctness_gee_test_case_test_method (gpointer self) { + map_tests_test_type_correctness (self); +} + + +static void _map_tests_test_has_key_size_is_empty_gee_test_case_test_method (gpointer self) { + map_tests_test_has_key_size_is_empty (self); +} + + +static void _map_tests_test_keys_gee_test_case_test_method (gpointer self) { + map_tests_test_keys (self); +} + + +static void _map_tests_test_values_gee_test_case_test_method (gpointer self) { + map_tests_test_values (self); +} + + +static void _map_tests_test_entries_gee_test_case_test_method (gpointer self) { + map_tests_test_entries (self); +} + + +static void _map_tests_test_set_all_gee_test_case_test_method (gpointer self) { + map_tests_test_set_all (self); +} + + +static void _map_tests_test_unset_all_gee_test_case_test_method (gpointer self) { + map_tests_test_unset_all (self); +} + + +static void _map_tests_test_has_all_gee_test_case_test_method (gpointer self) { + map_tests_test_has_all (self); +} + + +static void _map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + map_tests_test_gobject_properties (self); +} + + +MapTests* map_tests_construct (GType object_type, const gchar* name) { + MapTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (MapTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] type correctness", _map_tests_test_type_correctness_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] has_key, size and is_empty", _map_tests_test_has_key_size_is_empty_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] keys", _map_tests_test_keys_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] values", _map_tests_test_values_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] entries", _map_tests_test_entries_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] set all", _map_tests_test_set_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] unset all", _map_tests_test_unset_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] has all", _map_tests_test_has_all_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Map] GObject properties", _map_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +void map_tests_test_type_correctness (MapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GType _tmp2_; + GType _tmp3_; + GeeMap* _tmp4_; + GType _tmp5_; + GType _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _vala_assert (_tmp0_ != NULL, "test_map != null"); + _tmp1_ = self->test_map; + _tmp2_ = gee_map_get_key_type (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == G_TYPE_STRING, "test_map.key_type == typeof (string)"); + _tmp4_ = self->test_map; + _tmp5_ = gee_map_get_value_type (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == G_TYPE_STRING, "test_map.value_type == typeof (string)"); +} + + +void map_tests_test_has_key_size_is_empty (MapTests* self) { + GeeMap* _tmp0_; + gchar* value = NULL; + GeeMap* _tmp1_; + gboolean _tmp2_ = FALSE; + GeeMap* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeMap* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeMap* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeMap* _tmp10_; + gboolean _tmp11_; + gboolean _tmp12_; + GeeMap* _tmp13_; + GeeMap* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeMap* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeMap* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeMap* _tmp20_; + gpointer _tmp21_ = NULL; + gchar* _tmp22_; + GeeMap* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeMap* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeMap* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeMap* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeMap* _tmp33_; + gint _tmp34_; + gint _tmp35_; + GeeMap* _tmp36_; + gboolean _tmp37_; + gboolean _tmp38_; + GeeMap* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeMap* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeMap* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeMap* _tmp47_; + gpointer _tmp48_ = NULL; + gchar* _tmp49_; + GeeMap* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeMap* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeMap* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeMap* _tmp57_; + gpointer _tmp58_ = NULL; + gchar* _tmp59_; + GeeMap* _tmp60_; + gint _tmp61_; + gint _tmp62_; + GeeMap* _tmp63_; + gboolean _tmp64_; + gboolean _tmp65_; + GeeMap* _tmp66_; + GeeMap* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeMap* _tmp69_; + gpointer _tmp70_ = NULL; + gchar* _tmp71_; + GeeMap* _tmp72_; + gboolean _tmp73_ = FALSE; + GeeMap* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + GeeMap* _tmp77_; + gboolean _tmp78_ = FALSE; + GeeMap* _tmp79_; + gpointer _tmp80_ = NULL; + gchar* _tmp81_; + GeeMap* _tmp82_; + gint _tmp83_; + gint _tmp84_; + GeeMap* _tmp85_; + gboolean _tmp86_; + gboolean _tmp87_; + GeeMap* _tmp88_; + GeeMap* _tmp89_; + gboolean _tmp90_ = FALSE; + GeeMap* _tmp91_; + gpointer _tmp92_ = NULL; + gchar* _tmp93_; + GeeMap* _tmp94_; + gboolean _tmp95_ = FALSE; + GeeMap* _tmp96_; + gpointer _tmp97_ = NULL; + gchar* _tmp98_; + GeeMap* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeMap* _tmp101_; + gpointer _tmp102_ = NULL; + gchar* _tmp103_; + GeeMap* _tmp104_; + gint _tmp105_; + gint _tmp106_; + GeeMap* _tmp107_; + gboolean _tmp108_; + gboolean _tmp109_; + GeeMap* _tmp110_; + GeeMap* _tmp111_; + gboolean _tmp112_ = FALSE; + GeeMap* _tmp113_; + gpointer _tmp114_ = NULL; + gchar* _tmp115_; + GeeMap* _tmp116_; + gboolean _tmp117_ = FALSE; + GeeMap* _tmp118_; + gpointer _tmp119_ = NULL; + gchar* _tmp120_; + GeeMap* _tmp121_; + gboolean _tmp122_ = FALSE; + GeeMap* _tmp123_; + gpointer _tmp124_ = NULL; + gchar* _tmp125_; + GeeMap* _tmp126_; + gint _tmp127_; + gint _tmp128_; + GeeMap* _tmp129_; + gboolean _tmp130_; + gboolean _tmp131_; + GeeMap* _tmp132_; + GeeMap* _tmp133_; + gboolean _tmp134_ = FALSE; + GeeMap* _tmp135_; + gpointer _tmp136_ = NULL; + gchar* _tmp137_; + GeeMap* _tmp138_; + gboolean _tmp139_ = FALSE; + GeeMap* _tmp140_; + gpointer _tmp141_ = NULL; + gchar* _tmp142_; + GeeMap* _tmp143_; + gboolean _tmp144_ = FALSE; + GeeMap* _tmp145_; + gpointer _tmp146_ = NULL; + gchar* _tmp147_; + GeeMap* _tmp148_; + gint _tmp149_; + gint _tmp150_; + GeeMap* _tmp151_; + gboolean _tmp152_; + gboolean _tmp153_; + GeeMap* _tmp154_; + gpointer _tmp155_ = NULL; + gboolean _tmp156_ = FALSE; + const gchar* _tmp157_; + GeeMap* _tmp158_; + gboolean _tmp159_ = FALSE; + GeeMap* _tmp160_; + gpointer _tmp161_ = NULL; + gchar* _tmp162_; + GeeMap* _tmp163_; + gboolean _tmp164_ = FALSE; + GeeMap* _tmp165_; + gpointer _tmp166_ = NULL; + gchar* _tmp167_; + GeeMap* _tmp168_; + gboolean _tmp169_ = FALSE; + GeeMap* _tmp170_; + gpointer _tmp171_ = NULL; + gchar* _tmp172_; + GeeMap* _tmp173_; + gint _tmp174_; + gint _tmp175_; + GeeMap* _tmp176_; + gboolean _tmp177_; + gboolean _tmp178_; + GeeMap* _tmp179_; + gpointer _tmp180_ = NULL; + gboolean _tmp181_ = FALSE; + const gchar* _tmp182_; + GeeMap* _tmp183_; + gboolean _tmp184_ = FALSE; + GeeMap* _tmp185_; + gboolean _tmp186_ = FALSE; + GeeMap* _tmp187_; + gboolean _tmp188_ = FALSE; + GeeMap* _tmp189_; + gint _tmp190_; + gint _tmp191_; + GeeMap* _tmp192_; + gboolean _tmp193_; + gboolean _tmp194_; + GeeMap* _tmp195_; + GeeMap* _tmp196_; + gboolean _tmp197_ = FALSE; + GeeMap* _tmp198_; + gpointer _tmp199_ = NULL; + gchar* _tmp200_; + GeeMap* _tmp201_; + gboolean _tmp202_ = FALSE; + GeeMap* _tmp203_; + gpointer _tmp204_ = NULL; + gchar* _tmp205_; + GeeMap* _tmp206_; + gboolean _tmp207_ = FALSE; + GeeMap* _tmp208_; + gpointer _tmp209_ = NULL; + gchar* _tmp210_; + GeeMap* _tmp211_; + gint _tmp212_; + gint _tmp213_; + GeeMap* _tmp214_; + gboolean _tmp215_; + gboolean _tmp216_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _vala_assert (_tmp0_ != NULL, "test_map != null"); + _tmp1_ = self->test_map; + _tmp2_ = gee_map_has_key (_tmp1_, "one"); + _vala_assert (!_tmp2_, "! test_map.has_key (\"one\")"); + _tmp3_ = self->test_map; + _tmp4_ = gee_map_has_key (_tmp3_, "two"); + _vala_assert (!_tmp4_, "! test_map.has_key (\"two\")"); + _tmp5_ = self->test_map; + _tmp6_ = gee_map_has_key (_tmp5_, "three"); + _vala_assert (!_tmp6_, "! test_map.has_key (\"three\")"); + _tmp7_ = self->test_map; + _tmp8_ = gee_map_get_size (_tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 0, "test_map.size == 0"); + _tmp10_ = self->test_map; + _tmp11_ = gee_map_get_is_empty (_tmp10_); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_, "test_map.is_empty"); + _tmp13_ = self->test_map; + gee_map_set (_tmp13_, "one", "value_of_one"); + _tmp14_ = self->test_map; + _tmp15_ = gee_map_has_key (_tmp14_, "one"); + _vala_assert (_tmp15_, "test_map.has_key (\"one\")"); + _tmp16_ = self->test_map; + _tmp17_ = gee_map_has (_tmp16_, "one", "value_of_one"); + _vala_assert (_tmp17_, "test_map.has (\"one\", \"value_of_one\")"); + _tmp18_ = self->test_map; + _tmp19_ = gee_map_has (_tmp18_, "one", "another_value_for_one"); + _vala_assert (!_tmp19_, "! test_map.has (\"one\", \"another_value_for_one\")"); + _tmp20_ = self->test_map; + _tmp21_ = gee_map_get (_tmp20_, "one"); + _tmp22_ = (gchar*) _tmp21_; + _vala_assert (g_strcmp0 (_tmp22_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp22_); + _tmp23_ = self->test_map; + _tmp24_ = gee_map_has_key (_tmp23_, "two"); + _vala_assert (!_tmp24_, "! test_map.has_key (\"two\")"); + _tmp25_ = self->test_map; + _tmp26_ = gee_map_get (_tmp25_, "two"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (_tmp27_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp27_); + _tmp28_ = self->test_map; + _tmp29_ = gee_map_has_key (_tmp28_, "three"); + _vala_assert (!_tmp29_, "! test_map.has_key (\"three\")"); + _tmp30_ = self->test_map; + _tmp31_ = gee_map_get (_tmp30_, "three"); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (_tmp32_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp32_); + _tmp33_ = self->test_map; + _tmp34_ = gee_map_get_size (_tmp33_); + _tmp35_ = _tmp34_; + _vala_assert (_tmp35_ == 1, "test_map.size == 1"); + _tmp36_ = self->test_map; + _tmp37_ = gee_map_get_is_empty (_tmp36_); + _tmp38_ = _tmp37_; + _vala_assert (!_tmp38_, "! test_map.is_empty"); + _tmp39_ = self->test_map; + _tmp40_ = gee_map_unset (_tmp39_, "one", NULL); + _vala_assert (_tmp40_, "test_map.unset (\"one\")"); + _tmp41_ = self->test_map; + _tmp42_ = gee_map_has_key (_tmp41_, "one"); + _vala_assert (!_tmp42_, "! test_map.has_key (\"one\")"); + _tmp43_ = self->test_map; + _tmp44_ = gee_map_has (_tmp43_, "one", "value_of_one"); + _vala_assert (!_tmp44_, "! test_map.has (\"one\", \"value_of_one\")"); + _tmp45_ = self->test_map; + _tmp46_ = gee_map_has (_tmp45_, "one", "another_value_for_one"); + _vala_assert (!_tmp46_, "! test_map.has (\"one\", \"another_value_for_one\")"); + _tmp47_ = self->test_map; + _tmp48_ = gee_map_get (_tmp47_, "one"); + _tmp49_ = (gchar*) _tmp48_; + _vala_assert (_tmp49_ == NULL, "test_map.get (\"one\") == null"); + _g_free0 (_tmp49_); + _tmp50_ = self->test_map; + _tmp51_ = gee_map_has_key (_tmp50_, "two"); + _vala_assert (!_tmp51_, "! test_map.has_key (\"two\")"); + _tmp52_ = self->test_map; + _tmp53_ = gee_map_get (_tmp52_, "two"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (_tmp54_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp54_); + _tmp55_ = self->test_map; + _tmp56_ = gee_map_has_key (_tmp55_, "three"); + _vala_assert (!_tmp56_, "! test_map.has_key (\"three\")"); + _tmp57_ = self->test_map; + _tmp58_ = gee_map_get (_tmp57_, "three"); + _tmp59_ = (gchar*) _tmp58_; + _vala_assert (_tmp59_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp59_); + _tmp60_ = self->test_map; + _tmp61_ = gee_map_get_size (_tmp60_); + _tmp62_ = _tmp61_; + _vala_assert (_tmp62_ == 0, "test_map.size == 0"); + _tmp63_ = self->test_map; + _tmp64_ = gee_map_get_is_empty (_tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_, "test_map.is_empty"); + _tmp66_ = self->test_map; + gee_map_set (_tmp66_, "one", "value_of_one"); + _tmp67_ = self->test_map; + _tmp68_ = gee_map_has_key (_tmp67_, "one"); + _vala_assert (_tmp68_, "test_map.has_key (\"one\")"); + _tmp69_ = self->test_map; + _tmp70_ = gee_map_get (_tmp69_, "one"); + _tmp71_ = (gchar*) _tmp70_; + _vala_assert (g_strcmp0 (_tmp71_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp71_); + _tmp72_ = self->test_map; + _tmp73_ = gee_map_has_key (_tmp72_, "two"); + _vala_assert (!_tmp73_, "! test_map.has_key (\"two\")"); + _tmp74_ = self->test_map; + _tmp75_ = gee_map_get (_tmp74_, "two"); + _tmp76_ = (gchar*) _tmp75_; + _vala_assert (_tmp76_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp76_); + _tmp77_ = self->test_map; + _tmp78_ = gee_map_has_key (_tmp77_, "three"); + _vala_assert (!_tmp78_, "! test_map.has_key (\"three\")"); + _tmp79_ = self->test_map; + _tmp80_ = gee_map_get (_tmp79_, "three"); + _tmp81_ = (gchar*) _tmp80_; + _vala_assert (_tmp81_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp81_); + _tmp82_ = self->test_map; + _tmp83_ = gee_map_get_size (_tmp82_); + _tmp84_ = _tmp83_; + _vala_assert (_tmp84_ == 1, "test_map.size == 1"); + _tmp85_ = self->test_map; + _tmp86_ = gee_map_get_is_empty (_tmp85_); + _tmp87_ = _tmp86_; + _vala_assert (!_tmp87_, "! test_map.is_empty"); + _tmp88_ = self->test_map; + gee_map_set (_tmp88_, "two", "value_of_two"); + _tmp89_ = self->test_map; + _tmp90_ = gee_map_has_key (_tmp89_, "one"); + _vala_assert (_tmp90_, "test_map.has_key (\"one\")"); + _tmp91_ = self->test_map; + _tmp92_ = gee_map_get (_tmp91_, "one"); + _tmp93_ = (gchar*) _tmp92_; + _vala_assert (g_strcmp0 (_tmp93_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp93_); + _tmp94_ = self->test_map; + _tmp95_ = gee_map_has_key (_tmp94_, "two"); + _vala_assert (_tmp95_, "test_map.has_key (\"two\")"); + _tmp96_ = self->test_map; + _tmp97_ = gee_map_get (_tmp96_, "two"); + _tmp98_ = (gchar*) _tmp97_; + _vala_assert (g_strcmp0 (_tmp98_, "value_of_two") == 0, "test_map.get (\"two\") == \"value_of_two\""); + _g_free0 (_tmp98_); + _tmp99_ = self->test_map; + _tmp100_ = gee_map_has_key (_tmp99_, "three"); + _vala_assert (!_tmp100_, "! test_map.has_key (\"three\")"); + _tmp101_ = self->test_map; + _tmp102_ = gee_map_get (_tmp101_, "three"); + _tmp103_ = (gchar*) _tmp102_; + _vala_assert (_tmp103_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp103_); + _tmp104_ = self->test_map; + _tmp105_ = gee_map_get_size (_tmp104_); + _tmp106_ = _tmp105_; + _vala_assert (_tmp106_ == 2, "test_map.size == 2"); + _tmp107_ = self->test_map; + _tmp108_ = gee_map_get_is_empty (_tmp107_); + _tmp109_ = _tmp108_; + _vala_assert (!_tmp109_, "! test_map.is_empty"); + _tmp110_ = self->test_map; + gee_map_set (_tmp110_, "three", "value_of_three"); + _tmp111_ = self->test_map; + _tmp112_ = gee_map_has_key (_tmp111_, "one"); + _vala_assert (_tmp112_, "test_map.has_key (\"one\")"); + _tmp113_ = self->test_map; + _tmp114_ = gee_map_get (_tmp113_, "one"); + _tmp115_ = (gchar*) _tmp114_; + _vala_assert (g_strcmp0 (_tmp115_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp115_); + _tmp116_ = self->test_map; + _tmp117_ = gee_map_has_key (_tmp116_, "two"); + _vala_assert (_tmp117_, "test_map.has_key (\"two\")"); + _tmp118_ = self->test_map; + _tmp119_ = gee_map_get (_tmp118_, "two"); + _tmp120_ = (gchar*) _tmp119_; + _vala_assert (g_strcmp0 (_tmp120_, "value_of_two") == 0, "test_map.get (\"two\") == \"value_of_two\""); + _g_free0 (_tmp120_); + _tmp121_ = self->test_map; + _tmp122_ = gee_map_has_key (_tmp121_, "three"); + _vala_assert (_tmp122_, "test_map.has_key (\"three\")"); + _tmp123_ = self->test_map; + _tmp124_ = gee_map_get (_tmp123_, "three"); + _tmp125_ = (gchar*) _tmp124_; + _vala_assert (g_strcmp0 (_tmp125_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp125_); + _tmp126_ = self->test_map; + _tmp127_ = gee_map_get_size (_tmp126_); + _tmp128_ = _tmp127_; + _vala_assert (_tmp128_ == 3, "test_map.size == 3"); + _tmp129_ = self->test_map; + _tmp130_ = gee_map_get_is_empty (_tmp129_); + _tmp131_ = _tmp130_; + _vala_assert (!_tmp131_, "! test_map.is_empty"); + _tmp132_ = self->test_map; + gee_map_set (_tmp132_, "two", "value_of_two_new"); + _tmp133_ = self->test_map; + _tmp134_ = gee_map_has_key (_tmp133_, "one"); + _vala_assert (_tmp134_, "test_map.has_key (\"one\")"); + _tmp135_ = self->test_map; + _tmp136_ = gee_map_get (_tmp135_, "one"); + _tmp137_ = (gchar*) _tmp136_; + _vala_assert (g_strcmp0 (_tmp137_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp137_); + _tmp138_ = self->test_map; + _tmp139_ = gee_map_has_key (_tmp138_, "two"); + _vala_assert (_tmp139_, "test_map.has_key (\"two\")"); + _tmp140_ = self->test_map; + _tmp141_ = gee_map_get (_tmp140_, "two"); + _tmp142_ = (gchar*) _tmp141_; + _vala_assert (g_strcmp0 (_tmp142_, "value_of_two_new") == 0, "test_map.get (\"two\") == \"value_of_two_new\""); + _g_free0 (_tmp142_); + _tmp143_ = self->test_map; + _tmp144_ = gee_map_has_key (_tmp143_, "three"); + _vala_assert (_tmp144_, "test_map.has_key (\"three\")"); + _tmp145_ = self->test_map; + _tmp146_ = gee_map_get (_tmp145_, "three"); + _tmp147_ = (gchar*) _tmp146_; + _vala_assert (g_strcmp0 (_tmp147_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp147_); + _tmp148_ = self->test_map; + _tmp149_ = gee_map_get_size (_tmp148_); + _tmp150_ = _tmp149_; + _vala_assert (_tmp150_ == 3, "test_map.size == 3"); + _tmp151_ = self->test_map; + _tmp152_ = gee_map_get_is_empty (_tmp151_); + _tmp153_ = _tmp152_; + _vala_assert (!_tmp153_, "! test_map.is_empty"); + _tmp154_ = self->test_map; + _tmp156_ = gee_map_unset (_tmp154_, "two", &_tmp155_); + _g_free0 (value); + value = _tmp155_; + _vala_assert (_tmp156_, "test_map.unset (\"two\", out value)"); + _tmp157_ = value; + _vala_assert (g_strcmp0 (_tmp157_, "value_of_two_new") == 0, "value == \"value_of_two_new\""); + _tmp158_ = self->test_map; + _tmp159_ = gee_map_has_key (_tmp158_, "one"); + _vala_assert (_tmp159_, "test_map.has_key (\"one\")"); + _tmp160_ = self->test_map; + _tmp161_ = gee_map_get (_tmp160_, "one"); + _tmp162_ = (gchar*) _tmp161_; + _vala_assert (g_strcmp0 (_tmp162_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp162_); + _tmp163_ = self->test_map; + _tmp164_ = gee_map_has_key (_tmp163_, "two"); + _vala_assert (!_tmp164_, "! test_map.has_key (\"two\")"); + _tmp165_ = self->test_map; + _tmp166_ = gee_map_get (_tmp165_, "two"); + _tmp167_ = (gchar*) _tmp166_; + _vala_assert (_tmp167_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp167_); + _tmp168_ = self->test_map; + _tmp169_ = gee_map_has_key (_tmp168_, "three"); + _vala_assert (_tmp169_, "test_map.has_key (\"three\")"); + _tmp170_ = self->test_map; + _tmp171_ = gee_map_get (_tmp170_, "three"); + _tmp172_ = (gchar*) _tmp171_; + _vala_assert (g_strcmp0 (_tmp172_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp172_); + _tmp173_ = self->test_map; + _tmp174_ = gee_map_get_size (_tmp173_); + _tmp175_ = _tmp174_; + _vala_assert (_tmp175_ == 2, "test_map.size == 2"); + _tmp176_ = self->test_map; + _tmp177_ = gee_map_get_is_empty (_tmp176_); + _tmp178_ = _tmp177_; + _vala_assert (!_tmp178_, "! test_map.is_empty"); + _tmp179_ = self->test_map; + _tmp181_ = gee_map_unset (_tmp179_, "two", &_tmp180_); + _g_free0 (value); + value = _tmp180_; + _vala_assert (!_tmp181_, "! test_map.unset (\"two\", out value)"); + _tmp182_ = value; + _vala_assert (_tmp182_ == NULL, "value == null"); + _tmp183_ = self->test_map; + _tmp184_ = gee_map_has_key (_tmp183_, "one"); + _vala_assert (_tmp184_, "test_map.has_key (\"one\")"); + _tmp185_ = self->test_map; + _tmp186_ = gee_map_has_key (_tmp185_, "two"); + _vala_assert (!_tmp186_, "! test_map.has_key (\"two\")"); + _tmp187_ = self->test_map; + _tmp188_ = gee_map_has_key (_tmp187_, "three"); + _vala_assert (_tmp188_, "test_map.has_key (\"three\")"); + _tmp189_ = self->test_map; + _tmp190_ = gee_map_get_size (_tmp189_); + _tmp191_ = _tmp190_; + _vala_assert (_tmp191_ == 2, "test_map.size == 2"); + _tmp192_ = self->test_map; + _tmp193_ = gee_map_get_is_empty (_tmp192_); + _tmp194_ = _tmp193_; + _vala_assert (!_tmp194_, "! test_map.is_empty"); + _tmp195_ = self->test_map; + gee_map_clear (_tmp195_); + _tmp196_ = self->test_map; + _tmp197_ = gee_map_has_key (_tmp196_, "one"); + _vala_assert (!_tmp197_, "! test_map.has_key (\"one\")"); + _tmp198_ = self->test_map; + _tmp199_ = gee_map_get (_tmp198_, "one"); + _tmp200_ = (gchar*) _tmp199_; + _vala_assert (_tmp200_ == NULL, "test_map.get (\"one\") == null"); + _g_free0 (_tmp200_); + _tmp201_ = self->test_map; + _tmp202_ = gee_map_has_key (_tmp201_, "two"); + _vala_assert (!_tmp202_, "! test_map.has_key (\"two\")"); + _tmp203_ = self->test_map; + _tmp204_ = gee_map_get (_tmp203_, "two"); + _tmp205_ = (gchar*) _tmp204_; + _vala_assert (_tmp205_ == NULL, "test_map.get (\"two\") == null"); + _g_free0 (_tmp205_); + _tmp206_ = self->test_map; + _tmp207_ = gee_map_has_key (_tmp206_, "three"); + _vala_assert (!_tmp207_, "! test_map.has_key (\"three\")"); + _tmp208_ = self->test_map; + _tmp209_ = gee_map_get (_tmp208_, "three"); + _tmp210_ = (gchar*) _tmp209_; + _vala_assert (_tmp210_ == NULL, "test_map.get (\"three\") == null"); + _g_free0 (_tmp210_); + _tmp211_ = self->test_map; + _tmp212_ = gee_map_get_size (_tmp211_); + _tmp213_ = _tmp212_; + _vala_assert (_tmp213_ == 0, "test_map.size == 0"); + _tmp214_ = self->test_map; + _tmp215_ = gee_map_get_is_empty (_tmp214_); + _tmp216_ = _tmp215_; + _vala_assert (_tmp216_, "test_map.is_empty"); + _g_free0 (value); +} + + +void map_tests_test_keys (MapTests* self) { + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* keys; + GeeSet* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeMap* _tmp6_; + GeeSet* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeSet* _tmp13_; + GeeSet* _tmp14_; + GeeSet* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeSet* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp23_; + GeeSet* _tmp24_; + gint _tmp25_; + gint _tmp26_; + GeeSet* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeSet* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeMap* _tmp31_; + GeeSet* _tmp32_; + GeeSet* _tmp33_; + GeeSet* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeSet* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeSet* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + GeeSet* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeMap* _tmp45_; + GeeSet* _tmp46_; + GeeSet* _tmp47_; + GeeSet* _tmp48_; + gint _tmp49_; + gint _tmp50_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_keys (_tmp0_); + _tmp2_ = _tmp1_; + keys = _tmp2_; + _tmp3_ = keys; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "keys.size == 0"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = keys; + _tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "keys.size == 1"); + _tmp10_ = keys; + _tmp11_ = gee_collection_contains ((GeeCollection*) _tmp10_, "one"); + _vala_assert (_tmp11_, "keys.contains (\"one\")"); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_keys (_tmp12_); + _tmp14_ = _tmp13_; + _g_object_unref0 (keys); + keys = _tmp14_; + _tmp15_ = keys; + _tmp16_ = gee_collection_get_size ((GeeCollection*) _tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "keys.size == 1"); + _tmp18_ = keys; + _tmp19_ = gee_collection_contains ((GeeCollection*) _tmp18_, "one"); + _vala_assert (_tmp19_, "keys.contains (\"one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeSet* _tmp21_; + gboolean _tmp22_ = FALSE; + _tmp21_ = keys; + _tmp22_ = gee_collection_add ((GeeCollection*) _tmp21_, "three"); + _vala_assert (!_tmp22_, "! keys.add (\"three\")"); + exit (0); + } + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*code should not be reached*"); + _tmp23_ = self->test_map; + gee_map_set (_tmp23_, "two", "value_of_two"); + _tmp24_ = keys; + _tmp25_ = gee_collection_get_size ((GeeCollection*) _tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "keys.size == 2"); + _tmp27_ = keys; + _tmp28_ = gee_collection_contains ((GeeCollection*) _tmp27_, "one"); + _vala_assert (_tmp28_, "keys.contains (\"one\")"); + _tmp29_ = keys; + _tmp30_ = gee_collection_contains ((GeeCollection*) _tmp29_, "two"); + _vala_assert (_tmp30_, "keys.contains (\"two\")"); + _tmp31_ = self->test_map; + _tmp32_ = gee_map_get_keys (_tmp31_); + _tmp33_ = _tmp32_; + _g_object_unref0 (keys); + keys = _tmp33_; + _tmp34_ = keys; + _tmp35_ = gee_collection_get_size ((GeeCollection*) _tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 2, "keys.size == 2"); + _tmp37_ = keys; + _tmp38_ = gee_collection_contains ((GeeCollection*) _tmp37_, "one"); + _vala_assert (_tmp38_, "keys.contains (\"one\")"); + _tmp39_ = keys; + _tmp40_ = gee_collection_contains ((GeeCollection*) _tmp39_, "two"); + _vala_assert (_tmp40_, "keys.contains (\"two\")"); + _tmp41_ = self->test_map; + gee_map_clear (_tmp41_); + _tmp42_ = keys; + _tmp43_ = gee_collection_get_size ((GeeCollection*) _tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 0, "keys.size == 0"); + _tmp45_ = self->test_map; + _tmp46_ = gee_map_get_keys (_tmp45_); + _tmp47_ = _tmp46_; + _g_object_unref0 (keys); + keys = _tmp47_; + _tmp48_ = keys; + _tmp49_ = gee_collection_get_size ((GeeCollection*) _tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 0, "keys.size == 0"); + _g_object_unref0 (keys); +} + + +void map_tests_test_values (MapTests* self) { + GeeMap* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_; + GeeCollection* values; + GeeCollection* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeMap* _tmp6_; + GeeCollection* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeCollection* _tmp13_; + GeeCollection* _tmp14_; + GeeCollection* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp23_; + GeeCollection* _tmp24_; + gint _tmp25_; + gint _tmp26_; + GeeCollection* _tmp27_; + gboolean _tmp28_ = FALSE; + GeeCollection* _tmp29_; + gboolean _tmp30_ = FALSE; + GeeMap* _tmp31_; + GeeCollection* _tmp32_; + GeeCollection* _tmp33_; + GeeCollection* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeCollection* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeCollection* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + GeeCollection* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeMap* _tmp45_; + GeeCollection* _tmp46_; + GeeCollection* _tmp47_; + GeeCollection* _tmp48_; + gint _tmp49_; + gint _tmp50_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_values (_tmp0_); + _tmp2_ = _tmp1_; + values = _tmp2_; + _tmp3_ = values; + _tmp4_ = gee_collection_get_size (_tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "values.size == 0"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = values; + _tmp8_ = gee_collection_get_size (_tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "values.size == 1"); + _tmp10_ = values; + _tmp11_ = gee_collection_contains (_tmp10_, "value_of_one"); + _vala_assert (_tmp11_, "values.contains (\"value_of_one\")"); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_values (_tmp12_); + _tmp14_ = _tmp13_; + _g_object_unref0 (values); + values = _tmp14_; + _tmp15_ = values; + _tmp16_ = gee_collection_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "values.size == 1"); + _tmp18_ = values; + _tmp19_ = gee_collection_contains (_tmp18_, "value_of_one"); + _vala_assert (_tmp19_, "values.contains (\"value_of_one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeCollection* _tmp21_; + gboolean _tmp22_ = FALSE; + _tmp21_ = values; + _tmp22_ = gee_collection_add (_tmp21_, "two"); + _vala_assert (!_tmp22_, "! values.add (\"two\")"); + exit (0); + } + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*code should not be reached*"); + _tmp23_ = self->test_map; + gee_map_set (_tmp23_, "two", "value_of_two"); + _tmp24_ = values; + _tmp25_ = gee_collection_get_size (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 2, "values.size == 2"); + _tmp27_ = values; + _tmp28_ = gee_collection_contains (_tmp27_, "value_of_one"); + _vala_assert (_tmp28_, "values.contains (\"value_of_one\")"); + _tmp29_ = values; + _tmp30_ = gee_collection_contains (_tmp29_, "value_of_two"); + _vala_assert (_tmp30_, "values.contains (\"value_of_two\")"); + _tmp31_ = self->test_map; + _tmp32_ = gee_map_get_values (_tmp31_); + _tmp33_ = _tmp32_; + _g_object_unref0 (values); + values = _tmp33_; + _tmp34_ = values; + _tmp35_ = gee_collection_get_size (_tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 2, "values.size == 2"); + _tmp37_ = values; + _tmp38_ = gee_collection_contains (_tmp37_, "value_of_one"); + _vala_assert (_tmp38_, "values.contains (\"value_of_one\")"); + _tmp39_ = values; + _tmp40_ = gee_collection_contains (_tmp39_, "value_of_two"); + _vala_assert (_tmp40_, "values.contains (\"value_of_two\")"); + _tmp41_ = self->test_map; + gee_map_clear (_tmp41_); + _tmp42_ = values; + _tmp43_ = gee_collection_get_size (_tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 0, "values.size == 0"); + _tmp45_ = self->test_map; + _tmp46_ = gee_map_get_values (_tmp45_); + _tmp47_ = _tmp46_; + _g_object_unref0 (values); + values = _tmp47_; + _tmp48_ = values; + _tmp49_ = gee_collection_get_size (_tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 0, "values.size == 0"); + _g_object_unref0 (values); +} + + +void map_tests_test_entries (MapTests* self) { + GeeMap* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + GeeSet* entries; + GeeSet* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeMap* _tmp6_; + GeeSet* _tmp7_; + gint _tmp8_; + gint _tmp9_; + GeeSet* _tmp10_; + MapTestsTestEntry* _tmp11_; + MapTestsTestEntry* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeMap* _tmp14_; + GeeSet* _tmp15_; + GeeSet* _tmp16_; + GeeSet* _tmp17_; + gint _tmp18_; + gint _tmp19_; + GeeSet* _tmp20_; + MapTestsTestEntry* _tmp21_; + MapTestsTestEntry* _tmp22_; + gboolean _tmp23_ = FALSE; + gboolean _tmp24_ = FALSE; + GeeMap* _tmp29_; + GeeSet* _tmp30_; + gint _tmp31_; + gint _tmp32_; + GeeSet* _tmp33_; + MapTestsTestEntry* _tmp34_; + MapTestsTestEntry* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeSet* _tmp37_; + MapTestsTestEntry* _tmp38_; + MapTestsTestEntry* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeMap* _tmp41_; + GeeSet* _tmp42_; + GeeSet* _tmp43_; + GeeSet* _tmp44_; + gint _tmp45_; + gint _tmp46_; + GeeSet* _tmp47_; + MapTestsTestEntry* _tmp48_; + MapTestsTestEntry* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeSet* _tmp51_; + MapTestsTestEntry* _tmp52_; + MapTestsTestEntry* _tmp53_; + gboolean _tmp54_ = FALSE; + GeeMap* _tmp55_; + GeeSet* _tmp56_; + gint _tmp57_; + gint _tmp58_; + GeeMap* _tmp59_; + GeeSet* _tmp60_; + GeeSet* _tmp61_; + GeeSet* _tmp62_; + gint _tmp63_; + gint _tmp64_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_entries (_tmp0_); + _tmp2_ = _tmp1_; + entries = _tmp2_; + _tmp3_ = entries; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "entries.size == 0"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = entries; + _tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "entries.size == 1"); + _tmp10_ = entries; + _tmp11_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp12_ = _tmp11_; + _tmp13_ = gee_collection_contains ((GeeCollection*) _tmp10_, (GeeMapEntry*) _tmp12_); + _vala_assert (_tmp13_, "entries.contains (new TestEntry<string,string> (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp12_); + _tmp14_ = self->test_map; + _tmp15_ = gee_map_get_entries (_tmp14_); + _tmp16_ = _tmp15_; + _g_object_unref0 (entries); + entries = _tmp16_; + _tmp17_ = entries; + _tmp18_ = gee_collection_get_size ((GeeCollection*) _tmp17_); + _tmp19_ = _tmp18_; + _vala_assert (_tmp19_ == 1, "entries.size == 1"); + _tmp20_ = entries; + _tmp21_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp22_ = _tmp21_; + _tmp23_ = gee_collection_contains ((GeeCollection*) _tmp20_, (GeeMapEntry*) _tmp22_); + _vala_assert (_tmp23_, "entries.contains (new TestEntry<string,string> (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp22_); + _tmp24_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp24_) { + GeeSet* _tmp25_; + MapTestsTestEntry* _tmp26_; + MapTestsTestEntry* _tmp27_; + gboolean _tmp28_ = FALSE; + _tmp25_ = entries; + _tmp26_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "two", "value_of_two"); + _tmp27_ = _tmp26_; + _tmp28_ = gee_collection_add ((GeeCollection*) _tmp25_, (GeeMapEntry*) _tmp27_); + _vala_assert (!_tmp28_, "! entries.add (new TestEntry<string,string> (\"two\", \"value_of_two\"))"); + _g_object_unref0 (_tmp27_); + exit (0); + } + g_test_trap_assert_failed (); + g_test_trap_assert_stderr ("*code should not be reached*"); + _tmp29_ = self->test_map; + gee_map_set (_tmp29_, "two", "value_of_two"); + _tmp30_ = entries; + _tmp31_ = gee_collection_get_size ((GeeCollection*) _tmp30_); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 2, "entries.size == 2"); + _tmp33_ = entries; + _tmp34_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp35_ = _tmp34_; + _tmp36_ = gee_collection_contains ((GeeCollection*) _tmp33_, (GeeMapEntry*) _tmp35_); + _vala_assert (_tmp36_, "entries.contains (new TestEntry<string,string> (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp35_); + _tmp37_ = entries; + _tmp38_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "two", "value_of_two"); + _tmp39_ = _tmp38_; + _tmp40_ = gee_collection_contains ((GeeCollection*) _tmp37_, (GeeMapEntry*) _tmp39_); + _vala_assert (_tmp40_, "entries.contains (new TestEntry<string,string> (\"two\", \"value_of_two\"))"); + _g_object_unref0 (_tmp39_); + _tmp41_ = self->test_map; + _tmp42_ = gee_map_get_entries (_tmp41_); + _tmp43_ = _tmp42_; + _g_object_unref0 (entries); + entries = _tmp43_; + _tmp44_ = entries; + _tmp45_ = gee_collection_get_size ((GeeCollection*) _tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_ == 2, "entries.size == 2"); + _tmp47_ = entries; + _tmp48_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "one", "value_of_one"); + _tmp49_ = _tmp48_; + _tmp50_ = gee_collection_contains ((GeeCollection*) _tmp47_, (GeeMapEntry*) _tmp49_); + _vala_assert (_tmp50_, "entries.contains (new TestEntry<string,string> (\"one\", \"value_of_one\"))"); + _g_object_unref0 (_tmp49_); + _tmp51_ = entries; + _tmp52_ = map_tests_test_entry_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, "two", "value_of_two"); + _tmp53_ = _tmp52_; + _tmp54_ = gee_collection_contains ((GeeCollection*) _tmp51_, (GeeMapEntry*) _tmp53_); + _vala_assert (_tmp54_, "entries.contains (new TestEntry<string,string> (\"two\", \"value_of_two\"))"); + _g_object_unref0 (_tmp53_); + _tmp55_ = self->test_map; + gee_map_clear (_tmp55_); + _tmp56_ = entries; + _tmp57_ = gee_collection_get_size ((GeeCollection*) _tmp56_); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "entries.size == 0"); + _tmp59_ = self->test_map; + _tmp60_ = gee_map_get_entries (_tmp59_); + _tmp61_ = _tmp60_; + _g_object_unref0 (entries); + entries = _tmp61_; + _tmp62_ = entries; + _tmp63_ = gee_collection_get_size ((GeeCollection*) _tmp62_); + _tmp64_ = _tmp63_; + _vala_assert (_tmp64_ == 0, "entries.size == 0"); + _g_object_unref0 (entries); +} + + +void map_tests_test_clear (MapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + GeeMap* _tmp3_; + GeeMap* _tmp4_; + gint _tmp5_; + gint _tmp6_; + GeeMap* _tmp7_; + GeeSet* _tmp8_; + GeeSet* _tmp9_; + GeeSet* keys; + GeeIterator* _tmp10_ = NULL; + GeeIterator* ikeys; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeCollection* _tmp13_; + GeeCollection* _tmp14_; + GeeCollection* vals; + GeeIterator* _tmp15_ = NULL; + GeeIterator* ivals; + gboolean _tmp16_ = FALSE; + GeeMap* _tmp17_; + GeeSet* _tmp18_; + GeeSet* _tmp19_; + GeeSet* ents; + GeeIterator* _tmp20_ = NULL; + GeeIterator* ients; + gboolean _tmp21_ = FALSE; + GeeMap* _tmp22_; + GeeMapIterator* _tmp23_ = NULL; + GeeMapIterator* iter; + gboolean _tmp24_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + gee_map_set (_tmp0_, "one", "value_of_one"); + _tmp1_ = self->test_map; + gee_map_set (_tmp1_, "two", "value_of_two"); + _tmp2_ = self->test_map; + gee_map_set (_tmp2_, "three", "value_of_three"); + _tmp3_ = self->test_map; + gee_map_clear (_tmp3_); + _tmp4_ = self->test_map; + _tmp5_ = gee_map_get_size (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == 0, "test_map.size == 0"); + _tmp7_ = self->test_map; + _tmp8_ = gee_map_get_keys (_tmp7_); + _tmp9_ = _tmp8_; + keys = _tmp9_; + _vala_assert (keys != NULL, "keys != null"); + _tmp10_ = gee_iterable_iterator ((GeeIterable*) keys); + ikeys = _tmp10_; + _vala_assert (ikeys != NULL, "ikeys != null"); + _tmp11_ = gee_iterator_has_next (ikeys); + _vala_assert (!_tmp11_, "!ikeys.has_next ()"); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_values (_tmp12_); + _tmp14_ = _tmp13_; + vals = _tmp14_; + _vala_assert (vals != NULL, "vals != null"); + _tmp15_ = gee_iterable_iterator ((GeeIterable*) vals); + ivals = _tmp15_; + _vala_assert (ivals != NULL, "ivals != null"); + _tmp16_ = gee_iterator_has_next (ivals); + _vala_assert (!_tmp16_, "!ivals.has_next ()"); + _tmp17_ = self->test_map; + _tmp18_ = gee_map_get_entries (_tmp17_); + _tmp19_ = _tmp18_; + ents = _tmp19_; + _vala_assert (ents != NULL, "ents != null"); + _tmp20_ = gee_iterable_iterator ((GeeIterable*) ents); + ients = _tmp20_; + _vala_assert (ients != NULL, "ients != null"); + _tmp21_ = gee_iterator_has_next (ients); + _vala_assert (!_tmp21_, "!ients.has_next ()"); + _tmp22_ = self->test_map; + _tmp23_ = gee_map_map_iterator (_tmp22_); + iter = _tmp23_; + _vala_assert (iter != NULL, "iter != null"); + _tmp24_ = gee_map_iterator_has_next (iter); + _vala_assert (!_tmp24_, "!iter.has_next ()"); + _g_object_unref0 (iter); + _g_object_unref0 (ients); + _g_object_unref0 (ents); + _g_object_unref0 (ivals); + _g_object_unref0 (vals); + _g_object_unref0 (ikeys); + _g_object_unref0 (keys); +} + + +void map_tests_test_set_all (MapTests* self) { + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + GeeHashMap* _tmp3_; + GeeHashMap* another_map; + GeeMap* _tmp4_; + GeeMap* _tmp5_; + GeeMap* _tmp6_; + GeeMap* _tmp7_; + GeeMap* _tmp8_; + gint _tmp9_; + gint _tmp10_; + GeeMap* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeMap* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeMap* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeMap* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeMap* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeMap* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeMap* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + GeeMap* _tmp29_; + gpointer _tmp30_ = NULL; + gchar* _tmp31_; + GeeMap* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + GeeMap* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + GeeMap* _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + g_return_if_fail (self != NULL); + _tmp0_ = g_str_hash; + _tmp1_ = g_str_equal; + _tmp2_ = g_str_equal; + _tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_, _tmp2_); + another_map = _tmp3_; + _tmp4_ = self->test_map; + gee_map_set (_tmp4_, "one", "value_of_one"); + _tmp5_ = self->test_map; + gee_map_set (_tmp5_, "two", "value_of_two"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "five", "value_of_five"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "six", "value_of_six"); + _tmp7_ = self->test_map; + gee_map_set_all (_tmp7_, (GeeMap*) another_map); + _tmp8_ = self->test_map; + _tmp9_ = gee_map_get_size (_tmp8_); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 6, "test_map.size == 6"); + _tmp11_ = self->test_map; + _tmp12_ = gee_map_has_key (_tmp11_, "one"); + _vala_assert (_tmp12_, "test_map.has_key (\"one\")"); + _tmp13_ = self->test_map; + _tmp14_ = gee_map_has_key (_tmp13_, "two"); + _vala_assert (_tmp14_, "test_map.has_key (\"two\")"); + _tmp15_ = self->test_map; + _tmp16_ = gee_map_has_key (_tmp15_, "three"); + _vala_assert (_tmp16_, "test_map.has_key (\"three\")"); + _tmp17_ = self->test_map; + _tmp18_ = gee_map_has_key (_tmp17_, "four"); + _vala_assert (_tmp18_, "test_map.has_key (\"four\")"); + _tmp19_ = self->test_map; + _tmp20_ = gee_map_has_key (_tmp19_, "five"); + _vala_assert (_tmp20_, "test_map.has_key (\"five\")"); + _tmp21_ = self->test_map; + _tmp22_ = gee_map_has_key (_tmp21_, "six"); + _vala_assert (_tmp22_, "test_map.has_key (\"six\")"); + _tmp23_ = self->test_map; + _tmp24_ = gee_map_get (_tmp23_, "one"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "value_of_one") == 0, "test_map.get (\"one\") == \"value_of_one\""); + _g_free0 (_tmp25_); + _tmp26_ = self->test_map; + _tmp27_ = gee_map_get (_tmp26_, "two"); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "value_of_two") == 0, "test_map.get (\"two\") == \"value_of_two\""); + _g_free0 (_tmp28_); + _tmp29_ = self->test_map; + _tmp30_ = gee_map_get (_tmp29_, "three"); + _tmp31_ = (gchar*) _tmp30_; + _vala_assert (g_strcmp0 (_tmp31_, "value_of_three") == 0, "test_map.get (\"three\") == \"value_of_three\""); + _g_free0 (_tmp31_); + _tmp32_ = self->test_map; + _tmp33_ = gee_map_get (_tmp32_, "four"); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "value_of_four") == 0, "test_map.get (\"four\") == \"value_of_four\""); + _g_free0 (_tmp34_); + _tmp35_ = self->test_map; + _tmp36_ = gee_map_get (_tmp35_, "five"); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "value_of_five") == 0, "test_map.get (\"five\") == \"value_of_five\""); + _g_free0 (_tmp37_); + _tmp38_ = self->test_map; + _tmp39_ = gee_map_get (_tmp38_, "six"); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (g_strcmp0 (_tmp40_, "value_of_six") == 0, "test_map.get (\"six\") == \"value_of_six\""); + _g_free0 (_tmp40_); + _g_object_unref0 (another_map); +} + + +void map_tests_test_unset_all (MapTests* self) { + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + GeeHashMap* _tmp3_; + GeeHashMap* another_map; + GeeMap* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + gboolean _tmp8_; + GeeMap* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeMap* _tmp11_; + gboolean _tmp12_; + gboolean _tmp13_; + gboolean _tmp14_; + gboolean _tmp15_; + GeeMap* _tmp16_; + GeeMap* _tmp17_; + gboolean _tmp18_; + gboolean _tmp19_; + gint _tmp20_; + gint _tmp21_; + GeeMap* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeMap* _tmp24_; + gboolean _tmp25_; + gboolean _tmp26_; + gint _tmp27_; + gint _tmp28_; + GeeMap* _tmp29_; + GeeMap* _tmp30_; + GeeMap* _tmp31_; + GeeMap* _tmp32_; + gint _tmp33_; + gint _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + GeeMap* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeMap* _tmp39_; + gint _tmp40_; + gint _tmp41_; + gboolean _tmp42_; + gboolean _tmp43_; + GeeMap* _tmp44_; + GeeMap* _tmp45_; + GeeMap* _tmp46_; + GeeMap* _tmp47_; + gint _tmp48_; + gint _tmp49_; + gint _tmp50_; + gint _tmp51_; + GeeMap* _tmp52_; + gboolean _tmp53_ = FALSE; + GeeMap* _tmp54_; + gboolean _tmp55_; + gboolean _tmp56_; + gint _tmp57_; + gint _tmp58_; + GeeMap* _tmp59_; + GeeMap* _tmp60_; + GeeMap* _tmp61_; + GeeMap* _tmp62_; + GeeMap* _tmp63_; + gint _tmp64_; + gint _tmp65_; + gint _tmp66_; + gint _tmp67_; + GeeMap* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeMap* _tmp70_; + gint _tmp71_; + gint _tmp72_; + gint _tmp73_; + gint _tmp74_; + GeeMap* _tmp75_; + gboolean _tmp76_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = g_str_hash; + _tmp1_ = g_str_equal; + _tmp2_ = g_str_equal; + _tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_, _tmp2_); + another_map = _tmp3_; + _tmp4_ = self->test_map; + _tmp5_ = gee_map_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "test_map.is_empty"); + _tmp7_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_, "another_map.is_empty"); + _tmp9_ = self->test_map; + _tmp10_ = gee_map_unset_all (_tmp9_, (GeeMap*) another_map); + _vala_assert (!_tmp10_, "! test_map.unset_all (another_map)"); + _tmp11_ = self->test_map; + _tmp12_ = gee_map_get_is_empty (_tmp11_); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_, "test_map.is_empty"); + _tmp14_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_, "another_map.is_empty"); + _tmp16_ = self->test_map; + gee_map_clear (_tmp16_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp17_ = self->test_map; + _tmp18_ = gee_map_get_is_empty (_tmp17_); + _tmp19_ = _tmp18_; + _vala_assert (_tmp19_, "test_map.is_empty"); + _tmp20_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp21_ = _tmp20_; + _vala_assert (_tmp21_ == 2, "another_map.size == 2"); + _tmp22_ = self->test_map; + _tmp23_ = gee_map_unset_all (_tmp22_, (GeeMap*) another_map); + _vala_assert (!_tmp23_, "! test_map.unset_all (another_map)"); + _tmp24_ = self->test_map; + _tmp25_ = gee_map_get_is_empty (_tmp24_); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_, "test_map.is_empty"); + _tmp27_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 2, "another_map.size == 2"); + _tmp29_ = self->test_map; + gee_map_clear (_tmp29_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp30_ = self->test_map; + gee_map_set (_tmp30_, "one", "value_of_one"); + _tmp31_ = self->test_map; + gee_map_set (_tmp31_, "two", "value_of_two"); + _tmp32_ = self->test_map; + _tmp33_ = gee_map_get_size (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 2, "test_map.size == 2"); + _tmp35_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_, "another_map.is_empty"); + _tmp37_ = self->test_map; + _tmp38_ = gee_map_unset_all (_tmp37_, (GeeMap*) another_map); + _vala_assert (!_tmp38_, "! test_map.unset_all (another_map)"); + _tmp39_ = self->test_map; + _tmp40_ = gee_map_get_size (_tmp39_); + _tmp41_ = _tmp40_; + _vala_assert (_tmp41_ == 2, "test_map.size == 2"); + _tmp42_ = gee_abstract_map_get_is_empty ((GeeAbstractMap*) another_map); + _tmp43_ = _tmp42_; + _vala_assert (_tmp43_, "another_map.is_empty"); + _tmp44_ = self->test_map; + gee_map_clear (_tmp44_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp45_ = self->test_map; + gee_map_set (_tmp45_, "one", "value_of_one"); + _tmp46_ = self->test_map; + gee_map_set (_tmp46_, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp47_ = self->test_map; + _tmp48_ = gee_map_get_size (_tmp47_); + _tmp49_ = _tmp48_; + _vala_assert (_tmp49_ == 2, "test_map.size == 2"); + _tmp50_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 2, "another_map.size == 2"); + _tmp52_ = self->test_map; + _tmp53_ = gee_map_unset_all (_tmp52_, (GeeMap*) another_map); + _vala_assert (_tmp53_, "test_map.unset_all (another_map)"); + _tmp54_ = self->test_map; + _tmp55_ = gee_map_get_is_empty (_tmp54_); + _tmp56_ = _tmp55_; + _vala_assert (_tmp56_, "test_map.is_empty"); + _tmp57_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 2, "another_map.size == 2"); + _tmp59_ = self->test_map; + gee_map_clear (_tmp59_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp60_ = self->test_map; + gee_map_set (_tmp60_, "one", "value_of_one"); + _tmp61_ = self->test_map; + gee_map_set (_tmp61_, "two", "value_of_two"); + _tmp62_ = self->test_map; + gee_map_set (_tmp62_, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "five", "value_of_five"); + _tmp63_ = self->test_map; + _tmp64_ = gee_map_get_size (_tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_ == 3, "test_map.size == 3"); + _tmp66_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp67_ = _tmp66_; + _vala_assert (_tmp67_ == 4, "another_map.size == 4"); + _tmp68_ = self->test_map; + _tmp69_ = gee_map_unset_all (_tmp68_, (GeeMap*) another_map); + _vala_assert (_tmp69_, "test_map.unset_all (another_map)"); + _tmp70_ = self->test_map; + _tmp71_ = gee_map_get_size (_tmp70_); + _tmp72_ = _tmp71_; + _vala_assert (_tmp72_ == 1, "test_map.size == 1"); + _tmp73_ = gee_abstract_map_get_size ((GeeMap*) another_map); + _tmp74_ = _tmp73_; + _vala_assert (_tmp74_ == 4, "another_map.size == 4"); + _tmp75_ = self->test_map; + _tmp76_ = gee_map_has_key (_tmp75_, "one"); + _vala_assert (_tmp76_, "test_map.has_key (\"one\")"); + _g_object_unref0 (another_map); +} + + +void map_tests_test_has_all (MapTests* self) { + GHashFunc _tmp0_; + GEqualFunc _tmp1_; + GEqualFunc _tmp2_; + GeeHashMap* _tmp3_; + GeeHashMap* another_map; + GeeMap* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeMap* _tmp6_; + GeeMap* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeMap* _tmp9_; + GeeMap* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp12_; + GeeMap* _tmp13_; + GeeMap* _tmp14_; + GeeMap* _tmp15_; + gboolean _tmp16_ = FALSE; + GeeMap* _tmp17_; + GeeMap* _tmp18_; + GeeMap* _tmp19_; + GeeMap* _tmp20_; + gboolean _tmp21_ = FALSE; + GeeMap* _tmp22_; + GeeMap* _tmp23_; + GeeMap* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeMap* _tmp26_; + GeeMap* _tmp27_; + GeeMap* _tmp28_; + GeeMap* _tmp29_; + GeeMap* _tmp30_; + GeeMap* _tmp31_; + GeeMap* _tmp32_; + GeeMap* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeMap* _tmp35_; + GeeMap* _tmp36_; + GeeMap* _tmp37_; + GeeMap* _tmp38_; + GeeMap* _tmp39_; + GeeMap* _tmp40_; + GeeMap* _tmp41_; + GeeMap* _tmp42_; + gboolean _tmp43_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = g_str_hash; + _tmp1_ = g_str_equal; + _tmp2_ = g_str_equal; + _tmp3_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_, _tmp2_); + another_map = _tmp3_; + _tmp4_ = self->test_map; + _tmp5_ = gee_map_has_all (_tmp4_, (GeeMap*) another_map); + _vala_assert (_tmp5_, "test_map.has_all (another_map)"); + _tmp6_ = self->test_map; + gee_map_set (_tmp6_, "one", "value_of_one"); + _tmp7_ = self->test_map; + _tmp8_ = gee_map_has_all (_tmp7_, (GeeMap*) another_map); + _vala_assert (_tmp8_, "test_map.has_all (another_map)"); + _tmp9_ = self->test_map; + gee_map_clear (_tmp9_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + _tmp10_ = self->test_map; + _tmp11_ = gee_map_has_all (_tmp10_, (GeeMap*) another_map); + _vala_assert (!_tmp11_, "! test_map.has_all (another_map)"); + _tmp12_ = self->test_map; + gee_map_clear (_tmp12_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp13_ = self->test_map; + gee_map_set (_tmp13_, "one", "value_of_one"); + _tmp14_ = self->test_map; + gee_map_set (_tmp14_, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp15_ = self->test_map; + _tmp16_ = gee_map_has_all (_tmp15_, (GeeMap*) another_map); + _vala_assert (_tmp16_, "test_map.has_all (another_map)"); + _tmp17_ = self->test_map; + gee_map_clear (_tmp17_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp18_ = self->test_map; + gee_map_set (_tmp18_, "one", "value_of_one"); + _tmp19_ = self->test_map; + gee_map_set (_tmp19_, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "one", "another_value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "another_value_of_two"); + _tmp20_ = self->test_map; + _tmp21_ = gee_map_has_all (_tmp20_, (GeeMap*) another_map); + _vala_assert (!_tmp21_, "! test_map.has_all (another_map)"); + _tmp22_ = self->test_map; + gee_map_clear (_tmp22_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp23_ = self->test_map; + gee_map_set (_tmp23_, "one", "value_of_one"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + _tmp24_ = self->test_map; + _tmp25_ = gee_map_has_all (_tmp24_, (GeeMap*) another_map); + _vala_assert (!_tmp25_, "! test_map.has_all (another_map)"); + _tmp26_ = self->test_map; + gee_map_clear (_tmp26_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp27_ = self->test_map; + gee_map_set (_tmp27_, "one", "value_of_one"); + _tmp28_ = self->test_map; + gee_map_set (_tmp28_, "two", "value_of_two"); + _tmp29_ = self->test_map; + gee_map_set (_tmp29_, "three", "value_of_three"); + _tmp30_ = self->test_map; + gee_map_set (_tmp30_, "four", "value_of_four"); + _tmp31_ = self->test_map; + gee_map_set (_tmp31_, "five", "value_of_five"); + _tmp32_ = self->test_map; + gee_map_set (_tmp32_, "six", "value_of_six"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + _tmp33_ = self->test_map; + _tmp34_ = gee_map_has_all (_tmp33_, (GeeMap*) another_map); + _vala_assert (_tmp34_, "test_map.has_all (another_map)"); + _tmp35_ = self->test_map; + gee_map_clear (_tmp35_); + gee_abstract_map_clear ((GeeAbstractMap*) another_map); + _tmp36_ = self->test_map; + gee_map_set (_tmp36_, "one", "value_of_one"); + _tmp37_ = self->test_map; + gee_map_set (_tmp37_, "two", "value_of_two"); + _tmp38_ = self->test_map; + gee_map_set (_tmp38_, "three", "value_of_three"); + _tmp39_ = self->test_map; + gee_map_set (_tmp39_, "four", "value_of_four"); + _tmp40_ = self->test_map; + gee_map_set (_tmp40_, "five", "value_of_five"); + _tmp41_ = self->test_map; + gee_map_set (_tmp41_, "six", "value_of_six"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "two", "value_of_two"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "three", "value_of_three"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "four", "value_of_four"); + gee_abstract_map_set ((GeeAbstractMap*) another_map, "height", "value_of_height"); + _tmp42_ = self->test_map; + _tmp43_ = gee_map_has_all (_tmp42_, (GeeMap*) another_map); + _vala_assert (!_tmp43_, "! test_map.has_all (another_map)"); + _g_object_unref0 (another_map); +} + + +void map_tests_test_gobject_properties (MapTests* self) { + GeeMap* _tmp0_; + GValue value = {0}; + GValue _tmp1_ = {0}; + GValue _tmp2_; + GeeMap* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeMap* _tmp5_; + gboolean _tmp6_; + gboolean _tmp7_; + GValue _tmp8_ = {0}; + GValue _tmp9_; + GeeMap* _tmp10_; + gint _tmp11_ = 0; + GeeMap* _tmp12_; + gint _tmp13_; + gint _tmp14_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _vala_assert (_tmp0_ != NULL, "test_map != null"); + g_value_init (&_tmp1_, G_TYPE_BOOLEAN); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp1_; + _tmp2_ = value; + _tmp3_ = self->test_map; + g_object_get_property ((GObject*) _tmp3_, "is-empty", &value); + _tmp4_ = g_value_get_boolean (&value); + _tmp5_ = self->test_map; + _tmp6_ = gee_map_get_is_empty (_tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp4_ == _tmp7_, "value.get_boolean () == test_map.is_empty"); + g_value_unset (&value); + g_value_init (&_tmp8_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp8_; + _tmp9_ = value; + _tmp10_ = self->test_map; + g_object_get_property ((GObject*) _tmp10_, "size", &value); + _tmp11_ = g_value_get_int (&value); + _tmp12_ = self->test_map; + _tmp13_ = gee_map_get_size (_tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp11_ == _tmp14_, "value.get_int () == test_map.size"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; +} + + +MapTestsTestEntry* map_tests_test_entry_construct (GType object_type, GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value) { + MapTestsTestEntry * self = NULL; + gconstpointer _tmp0_; + gpointer _tmp1_; + gconstpointer _tmp2_; + self = (MapTestsTestEntry*) gee_map_entry_construct (object_type, k_type, (GBoxedCopyFunc) k_dup_func, k_destroy_func, v_type, (GBoxedCopyFunc) v_dup_func, v_destroy_func); + self->priv->k_type = k_type; + self->priv->k_dup_func = k_dup_func; + self->priv->k_destroy_func = k_destroy_func; + self->priv->v_type = v_type; + self->priv->v_dup_func = v_dup_func; + self->priv->v_destroy_func = v_destroy_func; + _tmp0_ = key; + _tmp1_ = ((_tmp0_ != NULL) && (k_dup_func != NULL)) ? k_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_); + _k_destroy_func0 (self->priv->_key); + self->priv->_key = _tmp1_; + _tmp2_ = value; + gee_map_entry_set_value ((GeeMapEntry*) self, _tmp2_); + return self; +} + + +MapTestsTestEntry* map_tests_test_entry_new (GType k_type, GBoxedCopyFunc k_dup_func, GDestroyNotify k_destroy_func, GType v_type, GBoxedCopyFunc v_dup_func, GDestroyNotify v_destroy_func, gconstpointer key, gconstpointer value) { + return map_tests_test_entry_construct (MAP_TESTS_TYPE_TEST_ENTRY, k_type, k_dup_func, k_destroy_func, v_type, v_dup_func, v_destroy_func, key, value); +} + + +static gconstpointer map_tests_test_entry_real_get_key (GeeMapEntry* base) { + gconstpointer result; + MapTestsTestEntry* self; + gconstpointer _tmp0_; + self = (MapTestsTestEntry*) base; + _tmp0_ = self->priv->_key; + result = _tmp0_; + return result; +} + + +static gconstpointer map_tests_test_entry_real_get_value (GeeMapEntry* base) { + gconstpointer result; + MapTestsTestEntry* self; + gconstpointer _tmp0_; + self = (MapTestsTestEntry*) base; + _tmp0_ = self->priv->_value; + result = _tmp0_; + return result; +} + + +static void map_tests_test_entry_real_set_value (GeeMapEntry* base, gconstpointer value) { + MapTestsTestEntry* self; + gconstpointer _tmp0_; + gpointer _tmp1_; + self = (MapTestsTestEntry*) base; + _tmp0_ = value; + _tmp1_ = ((_tmp0_ != NULL) && (self->priv->v_dup_func != NULL)) ? self->priv->v_dup_func ((gpointer) _tmp0_) : ((gpointer) _tmp0_); + ((self->priv->_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->v_destroy_func (self->priv->_value), NULL)); + self->priv->_value = _tmp1_; + g_object_notify ((GObject *) self, "value"); +} + + +static void map_tests_test_entry_class_init (MapTestsTestEntryClass * klass) { + map_tests_test_entry_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (MapTestsTestEntryPrivate)); + GEE_MAP_ENTRY_CLASS (klass)->get_key = map_tests_test_entry_real_get_key; + GEE_MAP_ENTRY_CLASS (klass)->get_value = map_tests_test_entry_real_get_value; + GEE_MAP_ENTRY_CLASS (klass)->set_value = map_tests_test_entry_real_set_value; + G_OBJECT_CLASS (klass)->get_property = _vala_map_tests_test_entry_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_map_tests_test_entry_set_property; + G_OBJECT_CLASS (klass)->finalize = map_tests_test_entry_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_K_TYPE, g_param_spec_gtype ("k-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_K_DUP_FUNC, g_param_spec_pointer ("k-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_K_DESTROY_FUNC, g_param_spec_pointer ("k-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_V_TYPE, g_param_spec_gtype ("v-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_V_DUP_FUNC, g_param_spec_pointer ("v-dup-func", "dup func", "dup func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_V_DESTROY_FUNC, g_param_spec_pointer ("v-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_KEY, g_param_spec_pointer ("key", "key", "key", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), MAP_TESTS_TEST_ENTRY_VALUE, g_param_spec_pointer ("value", "value", "value", G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +} + + +static void map_tests_test_entry_instance_init (MapTestsTestEntry * self) { + self->priv = MAP_TESTS_TEST_ENTRY_GET_PRIVATE (self); +} + + +static void map_tests_test_entry_finalize (GObject* obj) { + MapTestsTestEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry); + ((self->priv->_key == NULL) || (self->priv->k_destroy_func == NULL)) ? NULL : (self->priv->_key = (self->priv->k_destroy_func (self->priv->_key), NULL)); + ((self->priv->_value == NULL) || (self->priv->v_destroy_func == NULL)) ? NULL : (self->priv->_value = (self->priv->v_destroy_func (self->priv->_value), NULL)); + G_OBJECT_CLASS (map_tests_test_entry_parent_class)->finalize (obj); +} + + +GType map_tests_test_entry_get_type (void) { + static volatile gsize map_tests_test_entry_type_id__volatile = 0; + if (g_once_init_enter (&map_tests_test_entry_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MapTestsTestEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) map_tests_test_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MapTestsTestEntry), 0, (GInstanceInitFunc) map_tests_test_entry_instance_init, NULL }; + GType map_tests_test_entry_type_id; + map_tests_test_entry_type_id = g_type_register_static (GEE_MAP_TYPE_ENTRY, "MapTestsTestEntry", &g_define_type_info, 0); + g_once_init_leave (&map_tests_test_entry_type_id__volatile, map_tests_test_entry_type_id); + } + return map_tests_test_entry_type_id__volatile; +} + + +static void _vala_map_tests_test_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + MapTestsTestEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry); + switch (property_id) { + case MAP_TESTS_TEST_ENTRY_KEY: + g_value_set_pointer (value, gee_map_entry_get_key ((GeeMapEntry*) self)); + break; + case MAP_TESTS_TEST_ENTRY_VALUE: + g_value_set_pointer (value, gee_map_entry_get_value ((GeeMapEntry*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_map_tests_test_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + MapTestsTestEntry * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, MAP_TESTS_TYPE_TEST_ENTRY, MapTestsTestEntry); + switch (property_id) { + case MAP_TESTS_TEST_ENTRY_VALUE: + gee_map_entry_set_value ((GeeMapEntry*) self, g_value_get_pointer (value)); + break; + case MAP_TESTS_TEST_ENTRY_K_TYPE: + self->priv->k_type = g_value_get_gtype (value); + break; + case MAP_TESTS_TEST_ENTRY_K_DUP_FUNC: + self->priv->k_dup_func = g_value_get_pointer (value); + break; + case MAP_TESTS_TEST_ENTRY_K_DESTROY_FUNC: + self->priv->k_destroy_func = g_value_get_pointer (value); + break; + case MAP_TESTS_TEST_ENTRY_V_TYPE: + self->priv->v_type = g_value_get_gtype (value); + break; + case MAP_TESTS_TEST_ENTRY_V_DUP_FUNC: + self->priv->v_dup_func = g_value_get_pointer (value); + break; + case MAP_TESTS_TEST_ENTRY_V_DESTROY_FUNC: + self->priv->v_destroy_func = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void map_tests_class_init (MapTestsClass * klass) { + map_tests_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = map_tests_finalize; +} + + +static void map_tests_instance_init (MapTests * self) { +} + + +static void map_tests_finalize (GObject* obj) { + MapTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAP_TESTS, MapTests); + _g_object_unref0 (self->test_map); + G_OBJECT_CLASS (map_tests_parent_class)->finalize (obj); +} + + +GType map_tests_get_type (void) { + static volatile gsize map_tests_type_id__volatile = 0; + if (g_once_init_enter (&map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MapTests), 0, (GInstanceInitFunc) map_tests_instance_init, NULL }; + GType map_tests_type_id; + map_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "MapTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&map_tests_type_id__volatile, map_tests_type_id); + } + return map_tests_type_id__volatile; +} + + + diff --git a/tests/testmap.vala b/tests/testmap.vala new file mode 100644 index 0000000..19fc091 --- /dev/null +++ b/tests/testmap.vala @@ -0,0 +1,549 @@ +/* testmap.vala + * + * Copyright (C) 2008 Jürg Billeter, Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Maciej Piechotka <uzytkownik2@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public abstract class MapTests : Gee.TestCase { + + public MapTests (string name) { + base (name); + add_test ("[Map] type correctness", test_type_correctness); + add_test ("[Map] has_key, size and is_empty", + test_has_key_size_is_empty); + add_test ("[Map] keys", test_keys); + add_test ("[Map] values", test_values); + add_test ("[Map] entries", test_entries); + add_test ("[Map] set all", test_set_all); + add_test ("[Map] unset all", test_unset_all); + add_test ("[Map] has all", test_has_all); + add_test ("[Map] GObject properties", test_gobject_properties); + } + + protected Map<string, string> test_map; + + public void test_type_correctness () { + // Check the map exists + assert (test_map != null); + + // Check the advertised key and value types + assert (test_map.key_type == typeof (string)); + assert (test_map.value_type == typeof (string)); + } + + public void test_has_key_size_is_empty () { + // Check the collection exists + assert (test_map != null); + string value; + + // Check the collection is initially empty + assert (! test_map.has_key ("one")); + assert (! test_map.has_key ("two")); + assert (! test_map.has_key ("three")); + assert (test_map.size == 0); + assert (test_map.is_empty); + + // Add a binding + test_map.set ("one", "value_of_one"); + assert (test_map.has_key ("one")); + assert (test_map.has ("one", "value_of_one")); + assert (! test_map.has ("one", "another_value_for_one")); + assert (test_map.get ("one") == "value_of_one"); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 1); + assert (! test_map.is_empty); + + // Remove the last added binding + assert (test_map.unset ("one")); + assert (! test_map.has_key ("one")); + assert (! test_map.has ("one", "value_of_one")); + assert (! test_map.has ("one", "another_value_for_one")); + assert (test_map.get ("one") == null); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 0); + assert (test_map.is_empty); + + // Add more bindings + test_map.set ("one", "value_of_one"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 1); + assert (! test_map.is_empty); + + test_map.set ("two", "value_of_two"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.has_key ("two")); + assert (test_map.get ("two") == "value_of_two"); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 2); + assert (! test_map.is_empty); + + test_map.set ("three", "value_of_three"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.has_key ("two")); + assert (test_map.get ("two") == "value_of_two"); + assert (test_map.has_key ("three")); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.size == 3); + assert (! test_map.is_empty); + + // Update an existent binding + test_map.set ("two", "value_of_two_new"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.has_key ("two")); + assert (test_map.get ("two") == "value_of_two_new"); + assert (test_map.has_key ("three")); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.size == 3); + assert (! test_map.is_empty); + + // Remove one element + assert (test_map.unset ("two", out value)); + assert (value == "value_of_two_new"); + assert (test_map.has_key ("one")); + assert (test_map.get ("one") == "value_of_one"); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (test_map.has_key ("three")); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.size == 2); + assert (! test_map.is_empty); + + // Remove the same element again + assert (! test_map.unset ("two", out value)); + assert (value == null); + assert (test_map.has_key ("one")); + assert (! test_map.has_key ("two")); + assert (test_map.has_key ("three")); + assert (test_map.size == 2); + assert (! test_map.is_empty); + + // Remove all elements + test_map.clear (); + assert (! test_map.has_key ("one")); + assert (test_map.get ("one") == null); + assert (! test_map.has_key ("two")); + assert (test_map.get ("two") == null); + assert (! test_map.has_key ("three")); + assert (test_map.get ("three") == null); + assert (test_map.size == 0); + assert (test_map.is_empty); + } + + public void test_keys () { + // Check keys on empty map + var keys = test_map.keys; + assert (keys.size == 0); + + // Check keys on map with one item + test_map.set ("one", "value_of_one"); + assert (keys.size == 1); + assert (keys.contains ("one")); + keys = test_map.keys; + assert (keys.size == 1); + assert (keys.contains ("one")); + + // Check modify key set directly + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (! keys.add ("three")); + Posix.exit (0); + } + Test.trap_assert_failed (); + Test.trap_assert_stderr ("*code should not be reached*"); + + // Check keys on map with multiple items + test_map.set ("two", "value_of_two"); + assert (keys.size == 2); + assert (keys.contains ("one")); + assert (keys.contains ("two")); + keys = test_map.keys; + assert (keys.size == 2); + assert (keys.contains ("one")); + assert (keys.contains ("two")); + + // Check keys on map clear + test_map.clear (); + assert (keys.size == 0); + keys = test_map.keys; + assert (keys.size == 0); + } + + public void test_values () { + // Check keys on empty map + var values = test_map.values; + assert (values.size == 0); + + // Check keys on map with one item + test_map.set ("one", "value_of_one"); + assert (values.size == 1); + assert (values.contains ("value_of_one")); + values = test_map.values; + assert (values.size == 1); + assert (values.contains ("value_of_one")); + + // Check modify key set directly + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (! values.add ("two")); + Posix.exit (0); + } + Test.trap_assert_failed (); + Test.trap_assert_stderr ("*code should not be reached*"); + + // Check keys on map with multiple items + test_map.set ("two", "value_of_two"); + assert (values.size == 2); + assert (values.contains ("value_of_one")); + assert (values.contains ("value_of_two")); + values = test_map.values; + assert (values.size == 2); + assert (values.contains ("value_of_one")); + assert (values.contains ("value_of_two")); + + // Check keys on map clear + test_map.clear (); + assert (values.size == 0); + values = test_map.values; + assert (values.size == 0); + } + + public void test_entries () { + // Check entries on empty map + var entries = test_map.entries; + assert (entries.size == 0); + + // Check entries on map with one item + test_map.set ("one", "value_of_one"); + assert (entries.size == 1); + assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one"))); + entries = test_map.entries; + assert (entries.size == 1); + assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one"))); + + // Check modify entry set directly + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (! entries.add (new TestEntry<string,string> ("two", "value_of_two"))); + Posix.exit (0); + } + Test.trap_assert_failed (); + Test.trap_assert_stderr ("*code should not be reached*"); + + // Check entries on map with multiple items + test_map.set ("two", "value_of_two"); + assert (entries.size == 2); + assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one"))); + assert (entries.contains (new TestEntry<string,string> ("two", "value_of_two"))); + entries = test_map.entries; + assert (entries.size == 2); + assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one"))); + assert (entries.contains (new TestEntry<string,string> ("two", "value_of_two"))); + + // Check keys on map clear + test_map.clear (); + assert (entries.size == 0); + entries = test_map.entries; + assert (entries.size == 0); + } + + public void test_clear () { + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + + test_map.clear (); + assert (test_map.size == 0); + + Set<string> keys = test_map.keys; + assert (keys != null); + Iterator<string> ikeys = keys.iterator (); + assert (ikeys != null); + assert (!ikeys.has_next ()); + + Collection<string> vals = test_map.values; + assert (vals != null); + Iterator<string> ivals = vals.iterator (); + assert (ivals != null); + assert (!ivals.has_next ()); + + Set<Map.Entry<string, string>> ents = test_map.entries; + assert (ents != null); + Iterator<Map.Entry<string, string>> ients = ents.iterator (); + assert (ients != null); + assert (!ients.has_next ()); + + MapIterator<string, string> iter = test_map.map_iterator (); + assert (iter != null); + assert (!iter.has_next ()); + } + + public void test_set_all () { + var another_map = new HashMap<string,string> (str_hash, + str_equal, + str_equal); + + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + another_map.set ("five", "value_of_five"); + another_map.set ("six", "value_of_six"); + + test_map.set_all (another_map); + + assert (test_map.size == 6); + assert (test_map.has_key ("one")); + assert (test_map.has_key ("two")); + assert (test_map.has_key ("three")); + assert (test_map.has_key ("four")); + assert (test_map.has_key ("five")); + assert (test_map.has_key ("six")); + + assert (test_map.get ("one") == "value_of_one"); + assert (test_map.get ("two") == "value_of_two"); + assert (test_map.get ("three") == "value_of_three"); + assert (test_map.get ("four") == "value_of_four"); + assert (test_map.get ("five") == "value_of_five"); + assert (test_map.get ("six") == "value_of_six"); + } + + public void test_unset_all () { + var another_map = new HashMap<string,string> (str_hash, + str_equal, + str_equal); + + // Check unset all on empty maps. + assert (test_map.is_empty); + assert (another_map.is_empty); + + assert (! test_map.unset_all (another_map)); + + assert (test_map.is_empty); + assert (another_map.is_empty); + + test_map.clear (); + another_map.clear (); + + // Test_Map is empty, another_map has entries. -> no change + another_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (test_map.is_empty); + assert (another_map.size == 2); + + assert (! test_map.unset_all (another_map)); + + assert (test_map.is_empty); + assert (another_map.size == 2); + + test_map.clear (); + another_map.clear (); + + // Test_Map has entries, another_map is empty. -> no change + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + + assert (test_map.size == 2); + assert (another_map.is_empty); + + assert (! test_map.unset_all (another_map)); + + assert (test_map.size == 2); + assert (another_map.is_empty); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map have the same + // entries -> test_map is cleared + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + another_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (test_map.size == 2); + assert (another_map.size == 2); + + assert (test_map.unset_all (another_map)); + + assert (test_map.is_empty); + assert (another_map.size == 2); + + test_map.clear (); + another_map.clear (); + + // Test_Map has some common keys with another_map + // but both have also unique keys -> common key are + // cleared from test_map + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + another_map.set ("two", "value_of_two"); + another_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + another_map.set ("five", "value_of_five"); + + assert (test_map.size == 3); + assert (another_map.size == 4); + + assert (test_map.unset_all (another_map)); + + assert (test_map.size == 1); + assert (another_map.size == 4); + + assert (test_map.has_key ("one")); + } + + public void test_has_all () { + var another_map = new HashMap<string,string> (str_hash, + str_equal, + str_equal); + + // Check empty. + assert (test_map.has_all (another_map)); + + // Test_Map has items, another_map is empty. + test_map.set ("one", "value_of_one"); + + assert (test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map is empty, another_map has items. + another_map.set ("one", "value_of_one"); + + assert (! test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map are the same. + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + + another_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map are not the same. + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + + another_map.set ("one", "another_value_of_one"); + another_map.set ("two", "another_value_of_two"); + + assert (! test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map and another_map are not the same + test_map.set ("one", "value_of_one"); + another_map.set ("two", "value_of_two"); + + assert (! test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map has a subset of another_map + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + test_map.set ("four", "value_of_four"); + test_map.set ("five", "value_of_five"); + test_map.set ("six", "value_of_six"); + another_map.set ("two", "value_of_two"); + another_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + + assert (test_map.has_all (another_map)); + + test_map.clear (); + another_map.clear (); + + // Test_Map has a subset of another_map in all but one element another_map + test_map.set ("one", "value_of_one"); + test_map.set ("two", "value_of_two"); + test_map.set ("three", "value_of_three"); + test_map.set ("four", "value_of_four"); + test_map.set ("five", "value_of_five"); + test_map.set ("six", "value_of_six"); + another_map.set ("two", "value_of_two"); + another_map.set ("three", "value_of_three"); + another_map.set ("four", "value_of_four"); + another_map.set ("height", "value_of_height"); + + assert (! test_map.has_all (another_map)); + } + + public void test_gobject_properties () { + // Check the map exists + assert (test_map != null); + Value value; + + value = Value (typeof (bool)); + test_map.get_property ("is-empty", ref value); + assert (value.get_boolean () == test_map.is_empty); + value.unset (); + + value = Value (typeof (int)); + test_map.get_property ("size", ref value); + assert (value.get_int () == test_map.size); + value.unset (); + } + + + + public class TestEntry<K,V> : Map.Entry<K,V> { + public TestEntry (K key, V value) { + this._key = key; + this.value = value; + } + + public override K key { get {return _key; } } + private K _key; + public override V value { get; set; } + } +} diff --git a/tests/testmultimap.c b/tests/testmultimap.c new file mode 100644 index 0000000..f341696 --- /dev/null +++ b/tests/testmultimap.c @@ -0,0 +1,851 @@ +/* testmultimap.c generated by valac 0.18.0, the Vala compiler + * generated from testmultimap.vala, do not modify */ + +/* testmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; +typedef struct _MultiMapTestsPrivate MultiMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MultiMapTests { + GeeTestCase parent_instance; + MultiMapTestsPrivate * priv; + GeeMultiMap* test_multi_map; +}; + +struct _MultiMapTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer multi_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType multi_map_tests_get_type (void) G_GNUC_CONST; +enum { + MULTI_MAP_TESTS_DUMMY_PROPERTY +}; +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void multi_map_tests_test_size (MultiMapTests* self); +static void _multi_map_tests_test_size_gee_test_case_test_method (gpointer self); +static void multi_map_tests_test_getting_setting (MultiMapTests* self); +static void _multi_map_tests_test_getting_setting_gee_test_case_test_method (gpointer self); +static void multi_map_tests_test_keys_all_keys_values (MultiMapTests* self); +static void _multi_map_tests_test_keys_all_keys_values_gee_test_case_test_method (gpointer self); +static void multi_map_tests_finalize (GObject* obj); + + +static void _multi_map_tests_test_size_gee_test_case_test_method (gpointer self) { + multi_map_tests_test_size (self); +} + + +static void _multi_map_tests_test_getting_setting_gee_test_case_test_method (gpointer self) { + multi_map_tests_test_getting_setting (self); +} + + +static void _multi_map_tests_test_keys_all_keys_values_gee_test_case_test_method (gpointer self) { + multi_map_tests_test_keys_all_keys_values (self); +} + + +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name) { + MultiMapTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (MultiMapTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiMap] size", _multi_map_tests_test_size_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiMap] getting and setting", _multi_map_tests_test_getting_setting_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiMap] keys, all keys and values", _multi_map_tests_test_keys_all_keys_values_gee_test_case_test_method, self); + return self; +} + + +static void multi_map_tests_test_size (MultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeMultiMap* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeMultiMap* _tmp4_; + GeeMultiMap* _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeMultiMap* _tmp8_; + GeeMultiMap* _tmp9_; + gint _tmp10_; + gint _tmp11_; + GeeMultiMap* _tmp12_; + GeeMultiMap* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeMultiMap* _tmp16_; + GeeMultiMap* _tmp17_; + GeeMultiMap* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeMultiMap* _tmp21_; + GeeMultiMap* _tmp22_; + gint _tmp23_; + gint _tmp24_; + GeeMultiMap* _tmp25_; + GeeMultiMap* _tmp26_; + gint _tmp27_; + gint _tmp28_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_multi_map; + _vala_assert (_tmp0_ != NULL, "test_multi_map != null"); + _tmp1_ = self->test_multi_map; + _tmp2_ = gee_multi_map_get_size (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == 0, "test_multi_map.size == 0"); + _tmp4_ = self->test_multi_map; + gee_multi_map_set (_tmp4_, "0", "0"); + _tmp5_ = self->test_multi_map; + _tmp6_ = gee_multi_map_get_size (_tmp5_); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_ == 1, "test_multi_map.size == 1"); + _tmp8_ = self->test_multi_map; + gee_multi_map_set (_tmp8_, "0", "1"); + _tmp9_ = self->test_multi_map; + _tmp10_ = gee_multi_map_get_size (_tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 2, "test_multi_map.size == 2"); + _tmp12_ = self->test_multi_map; + gee_multi_map_remove (_tmp12_, "0", "1"); + _tmp13_ = self->test_multi_map; + _tmp14_ = gee_multi_map_get_size (_tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "test_multi_map.size == 1"); + _tmp16_ = self->test_multi_map; + gee_multi_map_set (_tmp16_, "0", "1"); + _tmp17_ = self->test_multi_map; + gee_multi_map_remove_all (_tmp17_, "0"); + _tmp18_ = self->test_multi_map; + _tmp19_ = gee_multi_map_get_size (_tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 0, "test_multi_map.size == 0"); + _tmp21_ = self->test_multi_map; + gee_multi_map_set (_tmp21_, "0", "0"); + _tmp22_ = self->test_multi_map; + _tmp23_ = gee_multi_map_get_size (_tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (_tmp24_ == 1, "test_multi_map.size == 1"); + _tmp25_ = self->test_multi_map; + gee_multi_map_set (_tmp25_, "1", "1"); + _tmp26_ = self->test_multi_map; + _tmp27_ = gee_multi_map_get_size (_tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 2, "test_multi_map.size == 2"); +} + + +static void multi_map_tests_test_getting_setting (MultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeMultiMap* _tmp1_; + GeeMultiMap* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeMultiMap* _tmp4_; + GeeCollection* _tmp5_ = NULL; + GeeCollection* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeMultiMap* _tmp9_; + GeeCollection* _tmp10_ = NULL; + GeeCollection* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeMultiMap* _tmp13_; + GeeCollection* _tmp14_ = NULL; + GeeCollection* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeMultiMap* _tmp18_; + GeeMultiMap* _tmp19_; + GeeCollection* _tmp20_ = NULL; + GeeCollection* _tmp21_; + gint _tmp22_; + gint _tmp23_; + GeeMultiMap* _tmp24_; + GeeCollection* _tmp25_ = NULL; + GeeCollection* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeMultiMap* _tmp28_; + GeeCollection* _tmp29_ = NULL; + GeeCollection* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeMultiMap* _tmp32_; + GeeMultiMap* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeMultiMap* _tmp35_; + GeeCollection* _tmp36_ = NULL; + GeeCollection* _tmp37_; + gint _tmp38_; + gint _tmp39_; + GeeMultiMap* _tmp40_; + GeeCollection* _tmp41_ = NULL; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeMultiMap* _tmp44_; + GeeCollection* _tmp45_ = NULL; + GeeCollection* _tmp46_; + gboolean _tmp47_ = FALSE; + GeeMultiMap* _tmp48_; + GeeCollection* _tmp49_ = NULL; + GeeCollection* _tmp50_; + gint _tmp51_; + gint _tmp52_; + GeeMultiMap* _tmp53_; + GeeCollection* _tmp54_ = NULL; + GeeCollection* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeMultiMap* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeMultiMap* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeMultiMap* _tmp61_; + GeeCollection* _tmp62_ = NULL; + GeeCollection* _tmp63_; + gboolean _tmp64_ = FALSE; + GeeMultiMap* _tmp65_; + GeeCollection* _tmp66_ = NULL; + GeeCollection* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeMultiMap* _tmp69_; + gboolean _tmp70_ = FALSE; + GeeMultiMap* _tmp71_; + GeeCollection* _tmp72_ = NULL; + GeeCollection* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeMultiMap* _tmp75_; + gboolean _tmp76_ = FALSE; + GeeMultiMap* _tmp77_; + gboolean _tmp78_ = FALSE; + GeeMultiMap* _tmp79_; + GeeCollection* _tmp80_ = NULL; + GeeCollection* _tmp81_; + gboolean _tmp82_ = FALSE; + GeeMultiMap* _tmp83_; + GeeCollection* _tmp84_ = NULL; + GeeCollection* _tmp85_; + gboolean _tmp86_ = FALSE; + GeeMultiMap* _tmp87_; + gboolean _tmp88_ = FALSE; + GeeMultiMap* _tmp89_; + GeeCollection* _tmp90_ = NULL; + GeeCollection* _tmp91_; + gboolean _tmp92_ = FALSE; + GeeMultiMap* _tmp93_; + gboolean _tmp94_ = FALSE; + GeeMultiMap* _tmp95_; + gboolean _tmp96_ = FALSE; + GeeMultiMap* _tmp97_; + GeeCollection* _tmp98_ = NULL; + GeeCollection* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeMultiMap* _tmp101_; + GeeCollection* _tmp102_ = NULL; + GeeCollection* _tmp103_; + gboolean _tmp104_ = FALSE; + GeeMultiMap* _tmp105_; + gboolean _tmp106_ = FALSE; + GeeMultiMap* _tmp107_; + GeeCollection* _tmp108_ = NULL; + GeeCollection* _tmp109_; + gboolean _tmp110_ = FALSE; + GeeMultiMap* _tmp111_; + GeeMultiMap* _tmp112_; + gboolean _tmp113_ = FALSE; + GeeMultiMap* _tmp114_; + gboolean _tmp115_ = FALSE; + GeeMultiMap* _tmp116_; + GeeMultiMap* _tmp117_; + GeeMultiMap* _tmp118_; + GeeMultiMap* _tmp119_; + gint _tmp120_; + gint _tmp121_; + GeeMultiMap* _tmp122_; + gboolean _tmp123_ = FALSE; + GeeMultiMap* _tmp124_; + gboolean _tmp125_ = FALSE; + GeeMultiMap* _tmp126_; + GeeCollection* _tmp127_ = NULL; + GeeCollection* _tmp128_; + gint _tmp129_; + gint _tmp130_; + GeeMultiMap* _tmp131_; + GeeCollection* _tmp132_ = NULL; + GeeCollection* _tmp133_; + gboolean _tmp134_ = FALSE; + GeeMultiMap* _tmp135_; + GeeCollection* _tmp136_ = NULL; + GeeCollection* _tmp137_; + gboolean _tmp138_ = FALSE; + GeeMultiMap* _tmp139_; + GeeCollection* _tmp140_ = NULL; + GeeCollection* _tmp141_; + gint _tmp142_; + gint _tmp143_; + GeeMultiMap* _tmp144_; + GeeCollection* _tmp145_ = NULL; + GeeCollection* _tmp146_; + gboolean _tmp147_ = FALSE; + GeeMultiMap* _tmp148_; + gboolean _tmp149_ = FALSE; + GeeMultiMap* _tmp150_; + gboolean _tmp151_ = FALSE; + GeeMultiMap* _tmp152_; + GeeCollection* _tmp153_ = NULL; + GeeCollection* _tmp154_; + gboolean _tmp155_ = FALSE; + GeeMultiMap* _tmp156_; + GeeCollection* _tmp157_ = NULL; + GeeCollection* _tmp158_; + gboolean _tmp159_ = FALSE; + GeeMultiMap* _tmp160_; + gboolean _tmp161_ = FALSE; + GeeMultiMap* _tmp162_; + GeeCollection* _tmp163_ = NULL; + GeeCollection* _tmp164_; + gboolean _tmp165_ = FALSE; + GeeMultiMap* _tmp166_; + gboolean _tmp167_ = FALSE; + GeeMultiMap* _tmp168_; + gboolean _tmp169_ = FALSE; + GeeMultiMap* _tmp170_; + GeeCollection* _tmp171_ = NULL; + GeeCollection* _tmp172_; + gboolean _tmp173_ = FALSE; + GeeMultiMap* _tmp174_; + GeeCollection* _tmp175_ = NULL; + GeeCollection* _tmp176_; + gboolean _tmp177_ = FALSE; + GeeMultiMap* _tmp178_; + gboolean _tmp179_ = FALSE; + GeeMultiMap* _tmp180_; + GeeCollection* _tmp181_ = NULL; + GeeCollection* _tmp182_; + gboolean _tmp183_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_multi_map; + _vala_assert (_tmp0_ != NULL, "test_multi_map != null"); + _tmp1_ = self->test_multi_map; + gee_multi_map_set (_tmp1_, "0", "0"); + _tmp2_ = self->test_multi_map; + _tmp3_ = gee_multi_map_contains (_tmp2_, "0"); + _vala_assert (_tmp3_, "test_multi_map.contains (\"0\")"); + _tmp4_ = self->test_multi_map; + _tmp5_ = gee_multi_map_get (_tmp4_, "0"); + _tmp6_ = _tmp5_; + _tmp7_ = gee_collection_get_size (_tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 1, "test_multi_map.get (\"0\").size == 1"); + _g_object_unref0 (_tmp6_); + _tmp9_ = self->test_multi_map; + _tmp10_ = gee_multi_map_get (_tmp9_, "0"); + _tmp11_ = _tmp10_; + _tmp12_ = gee_collection_contains (_tmp11_, "0"); + _vala_assert (_tmp12_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp11_); + _tmp13_ = self->test_multi_map; + _tmp14_ = gee_multi_map_get (_tmp13_, "1"); + _tmp15_ = _tmp14_; + _tmp16_ = gee_collection_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 0, "test_multi_map.get (\"1\").size == 0"); + _g_object_unref0 (_tmp15_); + _tmp18_ = self->test_multi_map; + gee_multi_map_set (_tmp18_, "0", "1"); + _tmp19_ = self->test_multi_map; + _tmp20_ = gee_multi_map_get (_tmp19_, "0"); + _tmp21_ = _tmp20_; + _tmp22_ = gee_collection_get_size (_tmp21_); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 2, "test_multi_map.get (\"0\").size == 2"); + _g_object_unref0 (_tmp21_); + _tmp24_ = self->test_multi_map; + _tmp25_ = gee_multi_map_get (_tmp24_, "0"); + _tmp26_ = _tmp25_; + _tmp27_ = gee_collection_contains (_tmp26_, "0"); + _vala_assert (_tmp27_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp26_); + _tmp28_ = self->test_multi_map; + _tmp29_ = gee_multi_map_get (_tmp28_, "0"); + _tmp30_ = _tmp29_; + _tmp31_ = gee_collection_contains (_tmp30_, "1"); + _vala_assert (_tmp31_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp30_); + _tmp32_ = self->test_multi_map; + gee_multi_map_set (_tmp32_, "1", "1"); + _tmp33_ = self->test_multi_map; + _tmp34_ = gee_multi_map_contains (_tmp33_, "1"); + _vala_assert (_tmp34_, "test_multi_map.contains (\"1\")"); + _tmp35_ = self->test_multi_map; + _tmp36_ = gee_multi_map_get (_tmp35_, "0"); + _tmp37_ = _tmp36_; + _tmp38_ = gee_collection_get_size (_tmp37_); + _tmp39_ = _tmp38_; + _vala_assert (_tmp39_ == 2, "test_multi_map.get (\"0\").size == 2"); + _g_object_unref0 (_tmp37_); + _tmp40_ = self->test_multi_map; + _tmp41_ = gee_multi_map_get (_tmp40_, "0"); + _tmp42_ = _tmp41_; + _tmp43_ = gee_collection_contains (_tmp42_, "0"); + _vala_assert (_tmp43_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp42_); + _tmp44_ = self->test_multi_map; + _tmp45_ = gee_multi_map_get (_tmp44_, "0"); + _tmp46_ = _tmp45_; + _tmp47_ = gee_collection_contains (_tmp46_, "1"); + _vala_assert (_tmp47_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp46_); + _tmp48_ = self->test_multi_map; + _tmp49_ = gee_multi_map_get (_tmp48_, "1"); + _tmp50_ = _tmp49_; + _tmp51_ = gee_collection_get_size (_tmp50_); + _tmp52_ = _tmp51_; + _vala_assert (_tmp52_ == 1, "test_multi_map.get (\"1\").size == 1"); + _g_object_unref0 (_tmp50_); + _tmp53_ = self->test_multi_map; + _tmp54_ = gee_multi_map_get (_tmp53_, "0"); + _tmp55_ = _tmp54_; + _tmp56_ = gee_collection_contains (_tmp55_, "1"); + _vala_assert (_tmp56_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp55_); + _tmp57_ = self->test_multi_map; + _tmp58_ = gee_multi_map_remove (_tmp57_, "0", "0"); + _vala_assert (_tmp58_, "test_multi_map.remove (\"0\", \"0\")"); + _tmp59_ = self->test_multi_map; + _tmp60_ = gee_multi_map_contains (_tmp59_, "0"); + _vala_assert (_tmp60_, "test_multi_map.contains (\"0\")"); + _tmp61_ = self->test_multi_map; + _tmp62_ = gee_multi_map_get (_tmp61_, "0"); + _tmp63_ = _tmp62_; + _tmp64_ = gee_collection_contains (_tmp63_, "0"); + _vala_assert (!_tmp64_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp63_); + _tmp65_ = self->test_multi_map; + _tmp66_ = gee_multi_map_get (_tmp65_, "0"); + _tmp67_ = _tmp66_; + _tmp68_ = gee_collection_contains (_tmp67_, "1"); + _vala_assert (_tmp68_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp67_); + _tmp69_ = self->test_multi_map; + _tmp70_ = gee_multi_map_contains (_tmp69_, "1"); + _vala_assert (_tmp70_, "test_multi_map.contains (\"1\")"); + _tmp71_ = self->test_multi_map; + _tmp72_ = gee_multi_map_get (_tmp71_, "1"); + _tmp73_ = _tmp72_; + _tmp74_ = gee_collection_contains (_tmp73_, "1"); + _vala_assert (_tmp74_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp73_); + _tmp75_ = self->test_multi_map; + _tmp76_ = gee_multi_map_remove (_tmp75_, "0", "1"); + _vala_assert (_tmp76_, "test_multi_map.remove (\"0\", \"1\")"); + _tmp77_ = self->test_multi_map; + _tmp78_ = gee_multi_map_contains (_tmp77_, "0"); + _vala_assert (!_tmp78_, "! test_multi_map.contains (\"0\")"); + _tmp79_ = self->test_multi_map; + _tmp80_ = gee_multi_map_get (_tmp79_, "0"); + _tmp81_ = _tmp80_; + _tmp82_ = gee_collection_contains (_tmp81_, "0"); + _vala_assert (!_tmp82_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp81_); + _tmp83_ = self->test_multi_map; + _tmp84_ = gee_multi_map_get (_tmp83_, "0"); + _tmp85_ = _tmp84_; + _tmp86_ = gee_collection_contains (_tmp85_, "1"); + _vala_assert (!_tmp86_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp85_); + _tmp87_ = self->test_multi_map; + _tmp88_ = gee_multi_map_contains (_tmp87_, "1"); + _vala_assert (_tmp88_, "test_multi_map.contains (\"1\")"); + _tmp89_ = self->test_multi_map; + _tmp90_ = gee_multi_map_get (_tmp89_, "1"); + _tmp91_ = _tmp90_; + _tmp92_ = gee_collection_contains (_tmp91_, "1"); + _vala_assert (_tmp92_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp91_); + _tmp93_ = self->test_multi_map; + _tmp94_ = gee_multi_map_remove (_tmp93_, "0", "1"); + _vala_assert (!_tmp94_, "! test_multi_map.remove (\"0\", \"1\")"); + _tmp95_ = self->test_multi_map; + _tmp96_ = gee_multi_map_contains (_tmp95_, "0"); + _vala_assert (!_tmp96_, "! test_multi_map.contains (\"0\")"); + _tmp97_ = self->test_multi_map; + _tmp98_ = gee_multi_map_get (_tmp97_, "0"); + _tmp99_ = _tmp98_; + _tmp100_ = gee_collection_contains (_tmp99_, "0"); + _vala_assert (!_tmp100_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp99_); + _tmp101_ = self->test_multi_map; + _tmp102_ = gee_multi_map_get (_tmp101_, "0"); + _tmp103_ = _tmp102_; + _tmp104_ = gee_collection_contains (_tmp103_, "1"); + _vala_assert (!_tmp104_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp103_); + _tmp105_ = self->test_multi_map; + _tmp106_ = gee_multi_map_contains (_tmp105_, "1"); + _vala_assert (_tmp106_, "test_multi_map.contains (\"1\")"); + _tmp107_ = self->test_multi_map; + _tmp108_ = gee_multi_map_get (_tmp107_, "1"); + _tmp109_ = _tmp108_; + _tmp110_ = gee_collection_contains (_tmp109_, "1"); + _vala_assert (_tmp110_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp109_); + _tmp111_ = self->test_multi_map; + gee_multi_map_clear (_tmp111_); + _tmp112_ = self->test_multi_map; + _tmp113_ = gee_multi_map_contains (_tmp112_, "0"); + _vala_assert (!_tmp113_, "! test_multi_map.contains (\"0\")"); + _tmp114_ = self->test_multi_map; + _tmp115_ = gee_multi_map_contains (_tmp114_, "1"); + _vala_assert (!_tmp115_, "! test_multi_map.contains (\"1\")"); + _tmp116_ = self->test_multi_map; + gee_multi_map_set (_tmp116_, "0", "0"); + _tmp117_ = self->test_multi_map; + gee_multi_map_set (_tmp117_, "0", "1"); + _tmp118_ = self->test_multi_map; + gee_multi_map_set (_tmp118_, "1", "1"); + _tmp119_ = self->test_multi_map; + _tmp120_ = gee_multi_map_get_size (_tmp119_); + _tmp121_ = _tmp120_; + _vala_assert (_tmp121_ == 3, "test_multi_map.size == 3"); + _tmp122_ = self->test_multi_map; + _tmp123_ = gee_multi_map_contains (_tmp122_, "0"); + _vala_assert (_tmp123_, "test_multi_map.contains (\"0\")"); + _tmp124_ = self->test_multi_map; + _tmp125_ = gee_multi_map_contains (_tmp124_, "1"); + _vala_assert (_tmp125_, "test_multi_map.contains (\"1\")"); + _tmp126_ = self->test_multi_map; + _tmp127_ = gee_multi_map_get (_tmp126_, "0"); + _tmp128_ = _tmp127_; + _tmp129_ = gee_collection_get_size (_tmp128_); + _tmp130_ = _tmp129_; + _vala_assert (_tmp130_ == 2, "test_multi_map.get (\"0\").size == 2"); + _g_object_unref0 (_tmp128_); + _tmp131_ = self->test_multi_map; + _tmp132_ = gee_multi_map_get (_tmp131_, "0"); + _tmp133_ = _tmp132_; + _tmp134_ = gee_collection_contains (_tmp133_, "0"); + _vala_assert (_tmp134_, "test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp133_); + _tmp135_ = self->test_multi_map; + _tmp136_ = gee_multi_map_get (_tmp135_, "0"); + _tmp137_ = _tmp136_; + _tmp138_ = gee_collection_contains (_tmp137_, "1"); + _vala_assert (_tmp138_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp137_); + _tmp139_ = self->test_multi_map; + _tmp140_ = gee_multi_map_get (_tmp139_, "1"); + _tmp141_ = _tmp140_; + _tmp142_ = gee_collection_get_size (_tmp141_); + _tmp143_ = _tmp142_; + _vala_assert (_tmp143_ == 1, "test_multi_map.get (\"1\").size == 1"); + _g_object_unref0 (_tmp141_); + _tmp144_ = self->test_multi_map; + _tmp145_ = gee_multi_map_get (_tmp144_, "0"); + _tmp146_ = _tmp145_; + _tmp147_ = gee_collection_contains (_tmp146_, "1"); + _vala_assert (_tmp147_, "test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp146_); + _tmp148_ = self->test_multi_map; + _tmp149_ = gee_multi_map_remove_all (_tmp148_, "0"); + _vala_assert (_tmp149_, "test_multi_map.remove_all (\"0\")"); + _tmp150_ = self->test_multi_map; + _tmp151_ = gee_multi_map_contains (_tmp150_, "0"); + _vala_assert (!_tmp151_, "! test_multi_map.contains (\"0\")"); + _tmp152_ = self->test_multi_map; + _tmp153_ = gee_multi_map_get (_tmp152_, "0"); + _tmp154_ = _tmp153_; + _tmp155_ = gee_collection_contains (_tmp154_, "0"); + _vala_assert (!_tmp155_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp154_); + _tmp156_ = self->test_multi_map; + _tmp157_ = gee_multi_map_get (_tmp156_, "0"); + _tmp158_ = _tmp157_; + _tmp159_ = gee_collection_contains (_tmp158_, "1"); + _vala_assert (!_tmp159_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp158_); + _tmp160_ = self->test_multi_map; + _tmp161_ = gee_multi_map_contains (_tmp160_, "1"); + _vala_assert (_tmp161_, "test_multi_map.contains (\"1\")"); + _tmp162_ = self->test_multi_map; + _tmp163_ = gee_multi_map_get (_tmp162_, "1"); + _tmp164_ = _tmp163_; + _tmp165_ = gee_collection_contains (_tmp164_, "1"); + _vala_assert (_tmp165_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp164_); + _tmp166_ = self->test_multi_map; + _tmp167_ = gee_multi_map_remove_all (_tmp166_, "0"); + _vala_assert (!_tmp167_, "! test_multi_map.remove_all (\"0\")"); + _tmp168_ = self->test_multi_map; + _tmp169_ = gee_multi_map_contains (_tmp168_, "0"); + _vala_assert (!_tmp169_, "! test_multi_map.contains (\"0\")"); + _tmp170_ = self->test_multi_map; + _tmp171_ = gee_multi_map_get (_tmp170_, "0"); + _tmp172_ = _tmp171_; + _tmp173_ = gee_collection_contains (_tmp172_, "0"); + _vala_assert (!_tmp173_, "! test_multi_map.get (\"0\").contains (\"0\")"); + _g_object_unref0 (_tmp172_); + _tmp174_ = self->test_multi_map; + _tmp175_ = gee_multi_map_get (_tmp174_, "0"); + _tmp176_ = _tmp175_; + _tmp177_ = gee_collection_contains (_tmp176_, "1"); + _vala_assert (!_tmp177_, "! test_multi_map.get (\"0\").contains (\"1\")"); + _g_object_unref0 (_tmp176_); + _tmp178_ = self->test_multi_map; + _tmp179_ = gee_multi_map_contains (_tmp178_, "1"); + _vala_assert (_tmp179_, "test_multi_map.contains (\"1\")"); + _tmp180_ = self->test_multi_map; + _tmp181_ = gee_multi_map_get (_tmp180_, "1"); + _tmp182_ = _tmp181_; + _tmp183_ = gee_collection_contains (_tmp182_, "1"); + _vala_assert (_tmp183_, "test_multi_map.get (\"1\").contains (\"1\")"); + _g_object_unref0 (_tmp182_); +} + + +static void multi_map_tests_test_keys_all_keys_values (MultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeMultiMap* _tmp1_; + GeeMultiMap* _tmp2_; + GeeMultiMap* _tmp3_; + GeeMultiMap* _tmp4_; + GeeSet* _tmp5_ = NULL; + GeeSet* keys; + GeeMultiMap* _tmp6_; + GeeMultiSet* _tmp7_ = NULL; + GeeMultiSet* all_keys; + GeeMultiMap* _tmp8_; + GeeCollection* _tmp9_ = NULL; + GeeCollection* values; + GeeSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeMultiSet* _tmp14_; + gint _tmp15_ = 0; + GeeMultiSet* _tmp16_; + gint _tmp17_ = 0; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + GeeCollection* _tmp20_; + gboolean _tmp21_ = FALSE; + gboolean zero_found; + gboolean zero_found_once; + gboolean one_found; + gboolean one_found_twice; + gboolean nothing_more; + gboolean _tmp33_; + gboolean _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + gboolean _tmp37_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_multi_map; + _vala_assert (_tmp0_ != NULL, "test_multi_map != null"); + _tmp1_ = self->test_multi_map; + gee_multi_map_set (_tmp1_, "0", "0"); + _tmp2_ = self->test_multi_map; + gee_multi_map_set (_tmp2_, "0", "1"); + _tmp3_ = self->test_multi_map; + gee_multi_map_set (_tmp3_, "1", "1"); + _tmp4_ = self->test_multi_map; + _tmp5_ = gee_multi_map_get_keys (_tmp4_); + keys = _tmp5_; + _tmp6_ = self->test_multi_map; + _tmp7_ = gee_multi_map_get_all_keys (_tmp6_); + all_keys = _tmp7_; + _tmp8_ = self->test_multi_map; + _tmp9_ = gee_multi_map_get_values (_tmp8_); + values = _tmp9_; + _tmp10_ = keys; + _tmp11_ = gee_collection_contains ((GeeCollection*) _tmp10_, "0"); + _vala_assert (_tmp11_, "keys.contains (\"0\")"); + _tmp12_ = keys; + _tmp13_ = gee_collection_contains ((GeeCollection*) _tmp12_, "1"); + _vala_assert (_tmp13_, "keys.contains (\"1\")"); + _tmp14_ = all_keys; + _tmp15_ = gee_multi_set_count (_tmp14_, "0"); + _vala_assert (_tmp15_ == 2, "all_keys.count (\"0\") == 2"); + _tmp16_ = all_keys; + _tmp17_ = gee_multi_set_count (_tmp16_, "1"); + _vala_assert (_tmp17_ == 1, "all_keys.count (\"1\") == 1"); + _tmp18_ = values; + _tmp19_ = gee_collection_contains (_tmp18_, "0"); + _vala_assert (_tmp19_, "values.contains (\"0\")"); + _tmp20_ = values; + _tmp21_ = gee_collection_contains (_tmp20_, "1"); + _vala_assert (_tmp21_, "values.contains (\"1\")"); + zero_found = FALSE; + zero_found_once = TRUE; + one_found = FALSE; + one_found_twice = FALSE; + nothing_more = TRUE; + { + GeeCollection* _tmp22_; + GeeIterator* _tmp23_ = NULL; + GeeIterator* _value_it; + _tmp22_ = values; + _tmp23_ = gee_iterable_iterator ((GeeIterable*) _tmp22_); + _value_it = _tmp23_; + while (TRUE) { + GeeIterator* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeIterator* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* value; + const gchar* _tmp28_; + _tmp24_ = _value_it; + _tmp25_ = gee_iterator_next (_tmp24_); + if (!_tmp25_) { + break; + } + _tmp26_ = _value_it; + _tmp27_ = gee_iterator_get (_tmp26_); + value = (gchar*) _tmp27_; + _tmp28_ = value; + if (g_strcmp0 (_tmp28_, "0") == 0) { + gboolean _tmp29_; + _tmp29_ = zero_found; + if (_tmp29_) { + zero_found_once = FALSE; + } + zero_found = TRUE; + } else { + const gchar* _tmp30_; + _tmp30_ = value; + if (g_strcmp0 (_tmp30_, "1") == 0) { + gboolean _tmp31_; + _tmp31_ = one_found; + if (_tmp31_) { + gboolean _tmp32_; + _tmp32_ = one_found_twice; + if (_tmp32_) { + one_found_twice = FALSE; + } else { + one_found_twice = TRUE; + } + } + one_found = TRUE; + } else { + nothing_more = FALSE; + } + } + _g_free0 (value); + } + _g_object_unref0 (_value_it); + } + _tmp33_ = zero_found; + _vala_assert (_tmp33_, "zero_found"); + _tmp34_ = zero_found_once; + _vala_assert (_tmp34_, "zero_found_once"); + _tmp35_ = one_found; + _vala_assert (_tmp35_, "one_found"); + _tmp36_ = one_found_twice; + _vala_assert (_tmp36_, "one_found_twice"); + _tmp37_ = nothing_more; + _vala_assert (_tmp37_, "nothing_more"); + _g_object_unref0 (values); + _g_object_unref0 (all_keys); + _g_object_unref0 (keys); +} + + +static void multi_map_tests_class_init (MultiMapTestsClass * klass) { + multi_map_tests_parent_class = g_type_class_peek_parent (klass); + G_OBJECT_CLASS (klass)->finalize = multi_map_tests_finalize; +} + + +static void multi_map_tests_instance_init (MultiMapTests * self) { +} + + +static void multi_map_tests_finalize (GObject* obj) { + MultiMapTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MULTI_MAP_TESTS, MultiMapTests); + _g_object_unref0 (self->test_multi_map); + G_OBJECT_CLASS (multi_map_tests_parent_class)->finalize (obj); +} + + +GType multi_map_tests_get_type (void) { + static volatile gsize multi_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&multi_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MultiMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) multi_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MultiMapTests), 0, (GInstanceInitFunc) multi_map_tests_instance_init, NULL }; + GType multi_map_tests_type_id; + multi_map_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "MultiMapTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&multi_map_tests_type_id__volatile, multi_map_tests_type_id); + } + return multi_map_tests_type_id__volatile; +} + + + diff --git a/tests/testmultimap.vala b/tests/testmultimap.vala new file mode 100644 index 0000000..7a2f9e0 --- /dev/null +++ b/tests/testmultimap.vala @@ -0,0 +1,193 @@ +/* testmultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using GLib; +using Gee; + +public abstract class MultiMapTests : Gee.TestCase { + + public MultiMapTests (string name) { + base (name); + add_test ("[MultiMap] size", test_size); + add_test ("[MultiMap] getting and setting", test_getting_setting); + add_test ("[MultiMap] keys, all keys and values", test_keys_all_keys_values); + } + + protected MultiMap<string,string> test_multi_map; + + private void test_size () { + // Check the map exists + assert (test_multi_map != null); + + assert (test_multi_map.size == 0); + test_multi_map.set ("0", "0"); + assert (test_multi_map.size == 1); + test_multi_map.set ("0", "1"); + assert (test_multi_map.size == 2); + test_multi_map.remove ("0", "1"); + assert (test_multi_map.size == 1); + test_multi_map.set ("0", "1"); + test_multi_map.remove_all ("0"); + assert (test_multi_map.size == 0); + test_multi_map.set ("0", "0"); + assert (test_multi_map.size == 1); + test_multi_map.set ("1", "1"); + assert (test_multi_map.size == 2); + } + + private void test_getting_setting () { + // Check the map exists + assert (test_multi_map != null); + + test_multi_map.set ("0", "0"); + assert (test_multi_map.contains ("0")); + assert (test_multi_map.get ("0").size == 1); + assert (test_multi_map.get ("0").contains ("0")); + + assert (test_multi_map.get ("1").size == 0); + + test_multi_map.set ("0", "1"); + assert (test_multi_map.get ("0").size == 2); + assert (test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + + test_multi_map.set ("1", "1"); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("0").size == 2); + assert (test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.get ("1").size == 1); + assert (test_multi_map.get ("0").contains ("1")); + + // Check remove if bindings exist + assert (test_multi_map.remove ("0", "0")); + assert (test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + // Check remove if only one binding exists + assert (test_multi_map.remove ("0", "1")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + // Check remove if no binding exists + assert (! test_multi_map.remove ("0", "1")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + test_multi_map.clear (); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.contains ("1")); + + // Check remove_all + test_multi_map.set ("0", "0"); + test_multi_map.set ("0", "1"); + test_multi_map.set ("1", "1"); + assert (test_multi_map.size == 3); + + assert (test_multi_map.contains ("0")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("0").size == 2); + assert (test_multi_map.get ("0").contains ("0")); + assert (test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.get ("1").size == 1); + assert (test_multi_map.get ("0").contains ("1")); + + // Check remove_all if bindings exist + assert (test_multi_map.remove_all ("0")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + + // Check remove_all if no binding exists + assert (! test_multi_map.remove_all ("0")); + assert (! test_multi_map.contains ("0")); + assert (! test_multi_map.get ("0").contains ("0")); + assert (! test_multi_map.get ("0").contains ("1")); + assert (test_multi_map.contains ("1")); + assert (test_multi_map.get ("1").contains ("1")); + } + + private void test_keys_all_keys_values () { + // Check the map exists + assert (test_multi_map != null); + + test_multi_map.set ("0", "0"); + test_multi_map.set ("0", "1"); + test_multi_map.set ("1", "1"); + + // Check for keys, all_keys and values + Set<string> keys = test_multi_map.get_keys (); + MultiSet<string> all_keys = test_multi_map.get_all_keys (); + Collection<string> values = test_multi_map.get_values (); + + assert (keys.contains ("0")); + assert (keys.contains ("1")); + assert (all_keys.count ("0") == 2); + assert (all_keys.count ("1") == 1); + assert (values.contains ("0")); + assert (values.contains ("1")); + + bool zero_found = false; + bool zero_found_once = true; + bool one_found = false; + bool one_found_twice = false; + bool nothing_more = true; + foreach (string value in values) { + if (value == "0") { + if (zero_found) { + zero_found_once = false; + } + zero_found = true; + } else if (value == "1") { + if (one_found) { + if (one_found_twice) { + one_found_twice = false; + } else { + one_found_twice = true; + } + } + one_found = true; + } else { + nothing_more = false; + } + } + assert (zero_found); + assert (zero_found_once); + assert (one_found); + assert (one_found_twice); + assert (nothing_more); + } +} diff --git a/tests/testmultiset.c b/tests/testmultiset.c new file mode 100644 index 0000000..81a4598 --- /dev/null +++ b/tests/testmultiset.c @@ -0,0 +1,260 @@ +/* testmultiset.c generated by valac 0.18.0, the Vala compiler + * generated from testmultiset.vala, do not modify */ + +/* testmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; +typedef struct _MultiSetTestsPrivate MultiSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _MultiSetTests { + CollectionTests parent_instance; + MultiSetTestsPrivate * priv; +}; + +struct _MultiSetTestsClass { + CollectionTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer multi_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType multi_set_tests_get_type (void) G_GNUC_CONST; +enum { + MULTI_SET_TESTS_DUMMY_PROPERTY +}; +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void multi_set_tests_test_duplicates_are_retained (MultiSetTests* self); +static void _multi_set_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self); + + +static void _multi_set_tests_test_duplicates_are_retained_gee_test_case_test_method (gpointer self) { + multi_set_tests_test_duplicates_are_retained (self); +} + + +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name) { + MultiSetTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (MultiSetTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[MultiSet] duplicates are retained", _multi_set_tests_test_duplicates_are_retained_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void multi_set_tests_test_duplicates_are_retained (MultiSetTests* self) { + GeeCollection* _tmp0_; + GeeMultiSet* _tmp1_; + GeeMultiSet* test_multi_set; + gint _tmp2_ = 0; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_ = 0; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gint _tmp10_; + gint _tmp11_; + gint _tmp12_ = 0; + gboolean _tmp13_ = FALSE; + gboolean _tmp14_ = FALSE; + gint _tmp15_; + gint _tmp16_; + gint _tmp17_ = 0; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gint _tmp20_; + gint _tmp21_; + gint _tmp22_ = 0; + gboolean _tmp23_ = FALSE; + gboolean _tmp24_ = FALSE; + gint _tmp25_; + gint _tmp26_; + gint _tmp27_ = 0; + gboolean _tmp28_ = FALSE; + gboolean _tmp29_ = FALSE; + gint _tmp30_; + gint _tmp31_; + gint _tmp32_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_MULTI_SET) ? ((GeeMultiSet*) _tmp0_) : NULL); + test_multi_set = _tmp1_; + _vala_assert (test_multi_set != NULL, "test_multi_set != null"); + _tmp2_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp2_ == 0, "test_multi_set.count (\"one\") == 0"); + _tmp3_ = gee_collection_add ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp3_, "test_multi_set.add (\"one\")"); + _tmp4_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp4_, "test_multi_set.contains (\"one\")"); + _tmp5_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == 1, "test_multi_set.size == 1"); + _tmp7_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp7_ == 1, "test_multi_set.count (\"one\") == 1"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp8_, "test_multi_set.add (\"one\")"); + _tmp9_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp9_, "test_multi_set.contains (\"one\")"); + _tmp10_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_ == 2, "test_multi_set.size == 2"); + _tmp12_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp12_ == 2, "test_multi_set.count (\"one\") == 2"); + _tmp13_ = gee_collection_add ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp13_, "test_multi_set.add (\"one\")"); + _tmp14_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp14_, "test_multi_set.contains (\"one\")"); + _tmp15_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp16_ = _tmp15_; + _vala_assert (_tmp16_ == 3, "test_multi_set.size == 3"); + _tmp17_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp17_ == 3, "test_multi_set.count (\"one\") == 3"); + _tmp18_ = gee_collection_remove ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp18_, "test_multi_set.remove (\"one\")"); + _tmp19_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp19_, "test_multi_set.contains (\"one\")"); + _tmp20_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp21_ = _tmp20_; + _vala_assert (_tmp21_ == 2, "test_multi_set.size == 2"); + _tmp22_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp22_ == 2, "test_multi_set.count (\"one\") == 2"); + _tmp23_ = gee_collection_remove ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp23_, "test_multi_set.remove (\"one\")"); + _tmp24_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp24_, "test_multi_set.contains (\"one\")"); + _tmp25_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp26_ = _tmp25_; + _vala_assert (_tmp26_ == 1, "test_multi_set.size == 1"); + _tmp27_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp27_ == 1, "test_multi_set.count (\"one\") == 1"); + _tmp28_ = gee_collection_remove ((GeeCollection*) test_multi_set, "one"); + _vala_assert (_tmp28_, "test_multi_set.remove (\"one\")"); + _tmp29_ = gee_collection_contains ((GeeCollection*) test_multi_set, "one"); + _vala_assert (!_tmp29_, "!test_multi_set.contains (\"one\")"); + _tmp30_ = gee_collection_get_size ((GeeCollection*) test_multi_set); + _tmp31_ = _tmp30_; + _vala_assert (_tmp31_ == 0, "test_multi_set.size == 0"); + _tmp32_ = gee_multi_set_count (test_multi_set, "one"); + _vala_assert (_tmp32_ == 0, "test_multi_set.count (\"one\") == 0"); + _g_object_unref0 (test_multi_set); +} + + +static void multi_set_tests_class_init (MultiSetTestsClass * klass) { + multi_set_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void multi_set_tests_instance_init (MultiSetTests * self) { +} + + +GType multi_set_tests_get_type (void) { + static volatile gsize multi_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&multi_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (MultiSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) multi_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MultiSetTests), 0, (GInstanceInitFunc) multi_set_tests_instance_init, NULL }; + GType multi_set_tests_type_id; + multi_set_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "MultiSetTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&multi_set_tests_type_id__volatile, multi_set_tests_type_id); + } + return multi_set_tests_type_id__volatile; +} + + + diff --git a/tests/testmultiset.vala b/tests/testmultiset.vala new file mode 100644 index 0000000..6812bdd --- /dev/null +++ b/tests/testmultiset.vala @@ -0,0 +1,75 @@ +/* testmultiset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using GLib; +using Gee; + +public abstract class MultiSetTests : CollectionTests { + + public MultiSetTests (string name) { + base (name); + add_test ("[MultiSet] duplicates are retained", + test_duplicates_are_retained); + } + + private void test_duplicates_are_retained () { + var test_multi_set = test_collection as MultiSet<string>; + + // Check the test set is not null + assert (test_multi_set != null); + + assert (test_multi_set.count ("one") == 0); + + assert (test_multi_set.add ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 1); + assert (test_multi_set.count ("one") == 1); + + assert (test_multi_set.add ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 2); + assert (test_multi_set.count ("one") == 2); + + assert (test_multi_set.add ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 3); + assert (test_multi_set.count ("one") == 3); + + assert (test_multi_set.remove ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 2); + assert (test_multi_set.count ("one") == 2); + + assert (test_multi_set.remove ("one")); + assert (test_multi_set.contains ("one")); + assert (test_multi_set.size == 1); + assert (test_multi_set.count ("one") == 1); + + assert (test_multi_set.remove ("one")); + assert (!test_multi_set.contains ("one")); + assert (test_multi_set.size == 0); + assert (test_multi_set.count ("one") == 0); + } +} diff --git a/tests/testpriorityqueue.c b/tests/testpriorityqueue.c new file mode 100644 index 0000000..8bdbd4f --- /dev/null +++ b/tests/testpriorityqueue.c @@ -0,0 +1,520 @@ +/* testpriorityqueue.c generated by valac 0.18.0, the Vala compiler + * generated from testpriorityqueue.vala, do not modify */ + +/* testpriorityqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; + +#define TYPE_PRIORITY_QUEUE_TESTS (priority_queue_tests_get_type ()) +#define PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTests)) +#define PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) +#define IS_PRIORITY_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PRIORITY_QUEUE_TESTS)) +#define IS_PRIORITY_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PRIORITY_QUEUE_TESTS)) +#define PRIORITY_QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PRIORITY_QUEUE_TESTS, PriorityQueueTestsClass)) + +typedef struct _PriorityQueueTests PriorityQueueTests; +typedef struct _PriorityQueueTestsClass PriorityQueueTestsClass; +typedef struct _PriorityQueueTestsPrivate PriorityQueueTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +struct _PriorityQueueTests { + QueueTests parent_instance; + PriorityQueueTestsPrivate * priv; +}; + +struct _PriorityQueueTestsClass { + QueueTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer priority_queue_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +GType priority_queue_tests_get_type (void) G_GNUC_CONST; +enum { + PRIORITY_QUEUE_TESTS_DUMMY_PROPERTY +}; +PriorityQueueTests* priority_queue_tests_new (void); +PriorityQueueTests* priority_queue_tests_construct (GType object_type); +QueueTests* queue_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void priority_queue_tests_test_selected_functions (PriorityQueueTests* self); +static void _priority_queue_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void priority_queue_tests_test_gobject_properties (PriorityQueueTests* self); +static void _priority_queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +static void priority_queue_tests_test_poll_gives_minimum (PriorityQueueTests* self); +static void _priority_queue_tests_test_poll_gives_minimum_gee_test_case_test_method (gpointer self); +static void priority_queue_tests_real_set_up (GeeTestCase* base); +static void priority_queue_tests_real_tear_down (GeeTestCase* base); + + +static void _priority_queue_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + priority_queue_tests_test_selected_functions (self); +} + + +static void _priority_queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + priority_queue_tests_test_gobject_properties (self); +} + + +static void _priority_queue_tests_test_poll_gives_minimum_gee_test_case_test_method (gpointer self) { + priority_queue_tests_test_poll_gives_minimum (self); +} + + +PriorityQueueTests* priority_queue_tests_construct (GType object_type) { + PriorityQueueTests * self = NULL; + self = (PriorityQueueTests*) queue_tests_construct (object_type, "PriorityQueue"); + gee_test_case_add_test ((GeeTestCase*) self, "[PriorityQueue] selected functions", _priority_queue_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[PriorityQueue] GObject properties", _priority_queue_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[PriorityQueue] poll gives minimum", _priority_queue_tests_test_poll_gives_minimum_gee_test_case_test_method, self); + return self; +} + + +PriorityQueueTests* priority_queue_tests_new (void) { + return priority_queue_tests_construct (TYPE_PRIORITY_QUEUE_TESTS); +} + + +static void priority_queue_tests_real_set_up (GeeTestCase* base) { + PriorityQueueTests * self; + GeePriorityQueue* _tmp0_; + self = (PriorityQueueTests*) base; + _tmp0_ = gee_priority_queue_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void priority_queue_tests_real_tear_down (GeeTestCase* base) { + PriorityQueueTests * self; + self = (PriorityQueueTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void priority_queue_tests_test_selected_functions (PriorityQueueTests* self) { + GeeCollection* _tmp0_; + GeePriorityQueue* _tmp1_; + GeePriorityQueue* test_queue; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_PRIORITY_QUEUE) ? ((GeePriorityQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + _tmp2_ = gee_priority_queue_get_compare_func (test_queue); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_queue.compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_queue); +} + + +void priority_queue_tests_test_gobject_properties (PriorityQueueTests* self) { + GeeCollection* _tmp0_; + GeePriorityQueue* _tmp1_; + GeePriorityQueue* test_queue; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_PRIORITY_QUEUE) ? ((GeePriorityQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_queue, "compare-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_priority_queue_get_compare_func (test_queue); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_queue.compare_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_queue); +} + + +static void priority_queue_tests_test_poll_gives_minimum (PriorityQueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gboolean _tmp6_ = FALSE; + gpointer _tmp7_ = NULL; + gchar* _tmp8_; + gpointer _tmp9_ = NULL; + gchar* _tmp10_; + gboolean _tmp11_ = FALSE; + gboolean _tmp12_ = FALSE; + gboolean _tmp13_ = FALSE; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_ = FALSE; + gboolean _tmp17_ = FALSE; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + gboolean _tmp21_ = FALSE; + gboolean _tmp22_ = FALSE; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + gpointer _tmp27_ = NULL; + gchar* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gpointer _tmp37_ = NULL; + gchar* _tmp38_; + gpointer _tmp39_ = NULL; + gchar* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + gpointer _tmp45_ = NULL; + gchar* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + gpointer _tmp49_ = NULL; + gchar* _tmp50_; + gpointer _tmp51_ = NULL; + gchar* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + gpointer _tmp57_ = NULL; + gchar* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + gpointer _tmp61_ = NULL; + gchar* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gpointer _tmp65_ = NULL; + gchar* _tmp66_; + gpointer _tmp67_ = NULL; + gchar* _tmp68_; + gpointer _tmp69_ = NULL; + gchar* _tmp70_; + gboolean _tmp71_ = FALSE; + gboolean _tmp72_ = FALSE; + gpointer _tmp73_ = NULL; + gchar* _tmp74_; + gpointer _tmp75_ = NULL; + gchar* _tmp76_; + gpointer _tmp77_ = NULL; + gchar* _tmp78_; + gpointer _tmp79_ = NULL; + gchar* _tmp80_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + _tmp2_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp2_, "test_queue.offer (\"one\")"); + _tmp3_ = gee_queue_offer (test_queue, "two"); + _vala_assert (_tmp3_, "test_queue.offer (\"two\")"); + _tmp4_ = gee_queue_peek (test_queue); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_collection_remove ((GeeCollection*) test_queue, "two"); + _vala_assert (_tmp6_, "test_queue.remove (\"two\")"); + _tmp7_ = gee_queue_peek (test_queue); + _tmp8_ = (gchar*) _tmp7_; + _vala_assert (g_strcmp0 (_tmp8_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp8_); + _tmp9_ = gee_queue_poll (test_queue); + _tmp10_ = (gchar*) _tmp9_; + _vala_assert (g_strcmp0 (_tmp10_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp10_); + _tmp11_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp11_, "test_queue.offer (\"one\")"); + _tmp12_ = gee_queue_offer (test_queue, "two"); + _vala_assert (_tmp12_, "test_queue.offer (\"two\")"); + _tmp13_ = gee_queue_offer (test_queue, "three"); + _vala_assert (_tmp13_, "test_queue.offer (\"three\")"); + _tmp14_ = gee_queue_offer (test_queue, "four"); + _vala_assert (_tmp14_, "test_queue.offer (\"four\")"); + _tmp15_ = gee_queue_offer (test_queue, "five"); + _vala_assert (_tmp15_, "test_queue.offer (\"five\")"); + _tmp16_ = gee_queue_offer (test_queue, "six"); + _vala_assert (_tmp16_, "test_queue.offer (\"six\")"); + _tmp17_ = gee_queue_offer (test_queue, "seven"); + _vala_assert (_tmp17_, "test_queue.offer (\"seven\")"); + _tmp18_ = gee_queue_offer (test_queue, "eight"); + _vala_assert (_tmp18_, "test_queue.offer (\"eight\")"); + _tmp19_ = gee_queue_offer (test_queue, "nine"); + _vala_assert (_tmp19_, "test_queue.offer (\"nine\")"); + _tmp20_ = gee_queue_offer (test_queue, "ten"); + _vala_assert (_tmp20_, "test_queue.offer (\"ten\")"); + _tmp21_ = gee_queue_offer (test_queue, "eleven"); + _vala_assert (_tmp21_, "test_queue.offer (\"eleven\")"); + _tmp22_ = gee_queue_offer (test_queue, "twelve"); + _vala_assert (_tmp22_, "test_queue.offer (\"twelve\")"); + _tmp23_ = gee_queue_peek (test_queue); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "eight") == 0, "test_queue.peek () == \"eight\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_queue_poll (test_queue); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "eight") == 0, "test_queue.poll () == \"eight\""); + _g_free0 (_tmp26_); + _tmp27_ = gee_queue_peek (test_queue); + _tmp28_ = (gchar*) _tmp27_; + _vala_assert (g_strcmp0 (_tmp28_, "eleven") == 0, "test_queue.peek () == \"eleven\""); + _g_free0 (_tmp28_); + _tmp29_ = gee_queue_poll (test_queue); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "eleven") == 0, "test_queue.poll () == \"eleven\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_queue_peek (test_queue); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "five") == 0, "test_queue.peek () == \"five\""); + _g_free0 (_tmp32_); + _tmp33_ = gee_queue_poll (test_queue); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "five") == 0, "test_queue.poll () == \"five\""); + _g_free0 (_tmp34_); + _tmp35_ = gee_queue_peek (test_queue); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "four") == 0, "test_queue.peek () == \"four\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_queue_poll (test_queue); + _tmp38_ = (gchar*) _tmp37_; + _vala_assert (g_strcmp0 (_tmp38_, "four") == 0, "test_queue.poll () == \"four\""); + _g_free0 (_tmp38_); + _tmp39_ = gee_queue_peek (test_queue); + _tmp40_ = (gchar*) _tmp39_; + _vala_assert (g_strcmp0 (_tmp40_, "nine") == 0, "test_queue.peek () == \"nine\""); + _g_free0 (_tmp40_); + _tmp41_ = gee_queue_poll (test_queue); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "nine") == 0, "test_queue.poll () == \"nine\""); + _g_free0 (_tmp42_); + _tmp43_ = gee_queue_peek (test_queue); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp44_); + _tmp45_ = gee_queue_poll (test_queue); + _tmp46_ = (gchar*) _tmp45_; + _vala_assert (g_strcmp0 (_tmp46_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp46_); + _tmp47_ = gee_queue_peek (test_queue); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "seven") == 0, "test_queue.peek () == \"seven\""); + _g_free0 (_tmp48_); + _tmp49_ = gee_queue_poll (test_queue); + _tmp50_ = (gchar*) _tmp49_; + _vala_assert (g_strcmp0 (_tmp50_, "seven") == 0, "test_queue.poll () == \"seven\""); + _g_free0 (_tmp50_); + _tmp51_ = gee_queue_peek (test_queue); + _tmp52_ = (gchar*) _tmp51_; + _vala_assert (g_strcmp0 (_tmp52_, "six") == 0, "test_queue.peek () == \"six\""); + _g_free0 (_tmp52_); + _tmp53_ = gee_queue_poll (test_queue); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "six") == 0, "test_queue.poll () == \"six\""); + _g_free0 (_tmp54_); + _tmp55_ = gee_queue_peek (test_queue); + _tmp56_ = (gchar*) _tmp55_; + _vala_assert (g_strcmp0 (_tmp56_, "ten") == 0, "test_queue.peek () == \"ten\""); + _g_free0 (_tmp56_); + _tmp57_ = gee_queue_poll (test_queue); + _tmp58_ = (gchar*) _tmp57_; + _vala_assert (g_strcmp0 (_tmp58_, "ten") == 0, "test_queue.poll () == \"ten\""); + _g_free0 (_tmp58_); + _tmp59_ = gee_queue_peek (test_queue); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (g_strcmp0 (_tmp60_, "three") == 0, "test_queue.peek () == \"three\""); + _g_free0 (_tmp60_); + _tmp61_ = gee_queue_poll (test_queue); + _tmp62_ = (gchar*) _tmp61_; + _vala_assert (g_strcmp0 (_tmp62_, "three") == 0, "test_queue.poll () == \"three\""); + _g_free0 (_tmp62_); + _tmp63_ = gee_queue_peek (test_queue); + _tmp64_ = (gchar*) _tmp63_; + _vala_assert (g_strcmp0 (_tmp64_, "twelve") == 0, "test_queue.peek () == \"twelve\""); + _g_free0 (_tmp64_); + _tmp65_ = gee_queue_poll (test_queue); + _tmp66_ = (gchar*) _tmp65_; + _vala_assert (g_strcmp0 (_tmp66_, "twelve") == 0, "test_queue.poll () == \"twelve\""); + _g_free0 (_tmp66_); + _tmp67_ = gee_queue_peek (test_queue); + _tmp68_ = (gchar*) _tmp67_; + _vala_assert (g_strcmp0 (_tmp68_, "two") == 0, "test_queue.peek () == \"two\""); + _g_free0 (_tmp68_); + _tmp69_ = gee_queue_poll (test_queue); + _tmp70_ = (gchar*) _tmp69_; + _vala_assert (g_strcmp0 (_tmp70_, "two") == 0, "test_queue.poll () == \"two\""); + _g_free0 (_tmp70_); + _tmp71_ = gee_queue_offer (test_queue, "2"); + _vala_assert (_tmp71_, "test_queue.offer (\"2\")"); + _tmp72_ = gee_queue_offer (test_queue, "1"); + _vala_assert (_tmp72_, "test_queue.offer (\"1\")"); + _tmp73_ = gee_queue_peek (test_queue); + _tmp74_ = (gchar*) _tmp73_; + _vala_assert (g_strcmp0 (_tmp74_, "1") == 0, "test_queue.peek () == \"1\""); + _g_free0 (_tmp74_); + _tmp75_ = gee_queue_poll (test_queue); + _tmp76_ = (gchar*) _tmp75_; + _vala_assert (g_strcmp0 (_tmp76_, "1") == 0, "test_queue.poll () == \"1\""); + _g_free0 (_tmp76_); + _tmp77_ = gee_queue_peek (test_queue); + _tmp78_ = (gchar*) _tmp77_; + _vala_assert (g_strcmp0 (_tmp78_, "2") == 0, "test_queue.peek () == \"2\""); + _g_free0 (_tmp78_); + _tmp79_ = gee_queue_poll (test_queue); + _tmp80_ = (gchar*) _tmp79_; + _vala_assert (g_strcmp0 (_tmp80_, "2") == 0, "test_queue.poll () == \"2\""); + _g_free0 (_tmp80_); + _g_object_unref0 (test_queue); +} + + +static void priority_queue_tests_class_init (PriorityQueueTestsClass * klass) { + priority_queue_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = priority_queue_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = priority_queue_tests_real_tear_down; +} + + +static void priority_queue_tests_instance_init (PriorityQueueTests * self) { +} + + +GType priority_queue_tests_get_type (void) { + static volatile gsize priority_queue_tests_type_id__volatile = 0; + if (g_once_init_enter (&priority_queue_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (PriorityQueueTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) priority_queue_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PriorityQueueTests), 0, (GInstanceInitFunc) priority_queue_tests_instance_init, NULL }; + GType priority_queue_tests_type_id; + priority_queue_tests_type_id = g_type_register_static (TYPE_QUEUE_TESTS, "PriorityQueueTests", &g_define_type_info, 0); + g_once_init_leave (&priority_queue_tests_type_id__volatile, priority_queue_tests_type_id); + } + return priority_queue_tests_type_id__volatile; +} + + + diff --git a/tests/testpriorityqueue.vala b/tests/testpriorityqueue.vala new file mode 100644 index 0000000..cbeac2f --- /dev/null +++ b/tests/testpriorityqueue.vala @@ -0,0 +1,128 @@ +/* testpriorityqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public class PriorityQueueTests : QueueTests { + + public PriorityQueueTests () { + base ("PriorityQueue"); + add_test ("[PriorityQueue] selected functions", test_selected_functions); + add_test ("[PriorityQueue] GObject properties", test_gobject_properties); + add_test ("[PriorityQueue] poll gives minimum", test_poll_gives_minimum); + } + + public override void set_up () { + test_collection = new PriorityQueue<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_queue = test_collection as PriorityQueue<string>; + + // Check the queue exists + assert (test_queue != null); + + // Check the selected compare function + assert (test_queue.compare_func == (CompareFunc) strcmp); + } + + public new void test_gobject_properties () { + var test_queue = test_collection as PriorityQueue<string>; + + // Check the list exists + assert (test_queue != null); + Value value; + + value = Value (typeof (CompareFunc)); + test_queue.get_property ("compare-func", ref value); + assert (value.get_pointer () == (void*) test_queue.compare_func); + value.unset (); + } + + private void test_poll_gives_minimum () { + var test_queue = test_collection as Gee.Queue<string>; + + // Check the queue exists + assert (test_queue != null); + + // Add two elements and remove the greatest + assert (test_queue.offer ("one")); + assert (test_queue.offer ("two")); + assert (test_queue.peek () == "one"); + assert (test_queue.remove ("two")); + assert (test_queue.peek () == "one"); + assert (test_queue.poll () == "one"); + + // Add twelve elements + assert (test_queue.offer ("one")); + assert (test_queue.offer ("two")); + assert (test_queue.offer ("three")); + assert (test_queue.offer ("four")); + assert (test_queue.offer ("five")); + assert (test_queue.offer ("six")); + assert (test_queue.offer ("seven")); + assert (test_queue.offer ("eight")); + assert (test_queue.offer ("nine")); + assert (test_queue.offer ("ten")); + assert (test_queue.offer ("eleven")); + assert (test_queue.offer ("twelve")); + + assert (test_queue.peek () == "eight"); + assert (test_queue.poll () == "eight"); + assert (test_queue.peek () == "eleven"); + assert (test_queue.poll () == "eleven"); + assert (test_queue.peek () == "five"); + assert (test_queue.poll () == "five"); + assert (test_queue.peek () == "four"); + assert (test_queue.poll () == "four"); + assert (test_queue.peek () == "nine"); + assert (test_queue.poll () == "nine"); + assert (test_queue.peek () == "one"); + assert (test_queue.poll () == "one"); + assert (test_queue.peek () == "seven"); + assert (test_queue.poll () == "seven"); + assert (test_queue.peek () == "six"); + assert (test_queue.poll () == "six"); + assert (test_queue.peek () == "ten"); + assert (test_queue.poll () == "ten"); + assert (test_queue.peek () == "three"); + assert (test_queue.poll () == "three"); + assert (test_queue.peek () == "twelve"); + assert (test_queue.poll () == "twelve"); + assert (test_queue.peek () == "two"); + assert (test_queue.poll () == "two"); + + // Add decreasing elements + assert (test_queue.offer ("2")); + assert (test_queue.offer ("1")); + + + assert (test_queue.peek () == "1"); + assert (test_queue.poll () == "1"); + assert (test_queue.peek () == "2"); + assert (test_queue.poll () == "2"); + } +} diff --git a/tests/testqueue.c b/tests/testqueue.c new file mode 100644 index 0000000..d31807b --- /dev/null +++ b/tests/testqueue.c @@ -0,0 +1,538 @@ +/* testqueue.c generated by valac 0.18.0, the Vala compiler + * generated from testqueue.vala, do not modify */ + +/* testqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_QUEUE_TESTS (queue_tests_get_type ()) +#define QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUEUE_TESTS, QueueTests)) +#define QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUEUE_TESTS, QueueTestsClass)) +#define IS_QUEUE_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUEUE_TESTS)) +#define IS_QUEUE_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUEUE_TESTS)) +#define QUEUE_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUEUE_TESTS, QueueTestsClass)) + +typedef struct _QueueTests QueueTests; +typedef struct _QueueTestsClass QueueTestsClass; +typedef struct _QueueTestsPrivate QueueTestsPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _QueueTests { + CollectionTests parent_instance; + QueueTestsPrivate * priv; +}; + +struct _QueueTestsClass { + CollectionTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer queue_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType queue_tests_get_type (void) G_GNUC_CONST; +enum { + QUEUE_TESTS_DUMMY_PROPERTY +}; +QueueTests* queue_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void queue_tests_test_capacity_bound (QueueTests* self); +static void _queue_tests_test_capacity_bound_gee_test_case_test_method (gpointer self); +void queue_tests_test_one_element_operation (QueueTests* self); +static void _queue_tests_test_one_element_operation_gee_test_case_test_method (gpointer self); +void queue_tests_test_gobject_properties (QueueTests* self); +static void _queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); + + +static void _queue_tests_test_capacity_bound_gee_test_case_test_method (gpointer self) { + queue_tests_test_capacity_bound (self); +} + + +static void _queue_tests_test_one_element_operation_gee_test_case_test_method (gpointer self) { + queue_tests_test_one_element_operation (self); +} + + +static void _queue_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + queue_tests_test_gobject_properties (self); +} + + +QueueTests* queue_tests_construct (GType object_type, const gchar* name) { + QueueTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (QueueTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Queue] capacity bound", _queue_tests_test_capacity_bound_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Queue] one element operation", _queue_tests_test_one_element_operation_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Queue] GObject properties", _queue_tests_test_gobject_properties_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void queue_tests_test_capacity_bound (QueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + GeeQueue* _tmp2_; + GeeQueue* _tmp3_; + gint _tmp4_; + gint _tmp5_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _tmp2_ = test_queue; + _vala_assert (_tmp2_ != NULL, "test_queue != null"); + _tmp3_ = test_queue; + _tmp4_ = gee_queue_get_capacity (_tmp3_); + _tmp5_ = _tmp4_; + if (_tmp5_ == GEE_QUEUE_UNBOUNDED_CAPACITY) { + GeeQueue* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeQueue* _tmp9_; + gboolean _tmp10_; + gboolean _tmp11_; + _tmp6_ = test_queue; + _tmp7_ = gee_queue_get_remaining_capacity (_tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == GEE_QUEUE_UNBOUNDED_CAPACITY, "test_queue.remaining_capacity == Gee.Queue.UNBOUNDED_CAPACITY"); + _tmp9_ = test_queue; + _tmp10_ = gee_queue_get_is_full (_tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (!_tmp11_, "! test_queue.is_full"); + } else { + GeeQueue* _tmp12_; + gboolean _tmp13_; + gboolean _tmp14_; + GeeQueue* _tmp15_; + gint _tmp16_; + gint _tmp17_; + gint capacity; + GeeQueue* _tmp33_; + gboolean _tmp34_; + gboolean _tmp35_; + GeeQueue* _tmp51_; + gboolean _tmp52_; + gboolean _tmp53_; + _tmp12_ = test_queue; + _tmp13_ = gee_collection_get_is_empty ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_, "test_queue.is_empty"); + _tmp15_ = test_queue; + _tmp16_ = gee_queue_get_capacity (_tmp15_); + _tmp17_ = _tmp16_; + capacity = _tmp17_; + { + gint i; + i = 1; + { + gboolean _tmp18_; + _tmp18_ = TRUE; + while (TRUE) { + gboolean _tmp19_; + gint _tmp21_; + gint _tmp22_; + GeeQueue* _tmp23_; + gboolean _tmp24_; + gboolean _tmp25_; + GeeQueue* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeQueue* _tmp28_; + gint _tmp29_; + gint _tmp30_; + gint _tmp31_; + gint _tmp32_; + _tmp19_ = _tmp18_; + if (!_tmp19_) { + gint _tmp20_; + _tmp20_ = i; + i = _tmp20_ + 1; + } + _tmp18_ = FALSE; + _tmp21_ = i; + _tmp22_ = capacity; + if (!(_tmp21_ <= _tmp22_)) { + break; + } + _tmp23_ = test_queue; + _tmp24_ = gee_queue_get_is_full (_tmp23_); + _tmp25_ = _tmp24_; + _vala_assert (!_tmp25_, "! test_queue.is_full"); + _tmp26_ = test_queue; + _tmp27_ = gee_queue_offer (_tmp26_, "one"); + _vala_assert (_tmp27_, "test_queue.offer (\"one\")"); + _tmp28_ = test_queue; + _tmp29_ = gee_queue_get_remaining_capacity (_tmp28_); + _tmp30_ = _tmp29_; + _tmp31_ = capacity; + _tmp32_ = i; + _vala_assert (_tmp30_ == (_tmp31_ - _tmp32_), "test_queue.remaining_capacity == capacity - i"); + } + } + } + _tmp33_ = test_queue; + _tmp34_ = gee_queue_get_is_full (_tmp33_); + _tmp35_ = _tmp34_; + _vala_assert (_tmp35_, "test_queue.is_full"); + { + gint i; + i = 1; + { + gboolean _tmp36_; + _tmp36_ = TRUE; + while (TRUE) { + gboolean _tmp37_; + gint _tmp39_; + gint _tmp40_; + GeeQueue* _tmp41_; + gpointer _tmp42_ = NULL; + gchar* _tmp43_; + GeeQueue* _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + GeeQueue* _tmp47_; + gint _tmp48_; + gint _tmp49_; + gint _tmp50_; + _tmp37_ = _tmp36_; + if (!_tmp37_) { + gint _tmp38_; + _tmp38_ = i; + i = _tmp38_ + 1; + } + _tmp36_ = FALSE; + _tmp39_ = i; + _tmp40_ = capacity; + if (!(_tmp39_ <= _tmp40_)) { + break; + } + _tmp41_ = test_queue; + _tmp42_ = gee_queue_poll (_tmp41_); + _tmp43_ = (gchar*) _tmp42_; + _vala_assert (g_strcmp0 (_tmp43_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp43_); + _tmp44_ = test_queue; + _tmp45_ = gee_queue_get_is_full (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (!_tmp46_, "! test_queue.is_full"); + _tmp47_ = test_queue; + _tmp48_ = gee_queue_get_remaining_capacity (_tmp47_); + _tmp49_ = _tmp48_; + _tmp50_ = i; + _vala_assert (_tmp49_ == _tmp50_, "test_queue.remaining_capacity == i"); + } + } + } + _tmp51_ = test_queue; + _tmp52_ = gee_collection_get_is_empty ((GeeCollection*) _tmp51_); + _tmp53_ = _tmp52_; + _vala_assert (_tmp53_, "test_queue.is_empty"); + } + _g_object_unref0 (test_queue); +} + + +void queue_tests_test_one_element_operation (QueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + GeeArrayList* _tmp2_; + GeeArrayList* recipient; + gboolean _tmp3_ = FALSE; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gint _tmp6_; + gint _tmp7_; + gboolean _tmp8_; + gboolean _tmp9_; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gint _tmp12_; + gint _tmp13_; + gboolean _tmp14_; + gboolean _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gboolean _tmp20_ = FALSE; + gint _tmp21_ = 0; + gint _tmp22_; + gint _tmp23_; + gboolean _tmp24_; + gboolean _tmp25_; + gint _tmp26_; + gint _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + gint _tmp30_ = 0; + gint _tmp31_; + gint _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + gint _tmp35_; + gint _tmp36_; + gboolean _tmp37_ = FALSE; + gint _tmp38_ = 0; + gint _tmp39_; + gint _tmp40_; + gboolean _tmp41_; + gboolean _tmp42_; + gint _tmp43_; + gint _tmp44_; + gpointer _tmp45_ = NULL; + gchar* _tmp46_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + recipient = _tmp2_; + _vala_assert (test_queue != NULL, "test_queue != null"); + _tmp3_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp3_, "test_queue.offer (\"one\")"); + _tmp4_ = gee_queue_peek (test_queue); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "one") == 0, "test_queue.peek () == \"one\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp7_ = _tmp6_; + _vala_assert (_tmp7_ == 1, "test_queue.size == 1"); + _tmp8_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp9_ = _tmp8_; + _vala_assert (!_tmp9_, "! test_queue.is_empty"); + _tmp10_ = gee_queue_poll (test_queue); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_queue.poll () == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_ == 0, "test_queue.size == 0"); + _tmp14_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_, "test_queue.is_empty"); + _tmp16_ = gee_queue_peek (test_queue); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (_tmp17_ == NULL, "test_queue.peek () == null"); + _g_free0 (_tmp17_); + _tmp18_ = gee_queue_poll (test_queue); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (_tmp19_ == NULL, "test_queue.poll () == null"); + _g_free0 (_tmp19_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp20_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp20_, "test_queue.offer (\"one\")"); + _tmp21_ = gee_queue_drain (test_queue, (GeeCollection*) recipient, 1); + _vala_assert (_tmp21_ == 1, "test_queue.drain (recipient, 1) == 1"); + _tmp22_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp23_ = _tmp22_; + _vala_assert (_tmp23_ == 0, "test_queue.size == 0"); + _tmp24_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_, "test_queue.is_empty"); + _tmp26_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp27_ = _tmp26_; + _vala_assert (_tmp27_ == 1, "recipient.size == 1"); + _tmp28_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "recipient.get (0) == \"one\""); + _g_free0 (_tmp29_); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp30_ = gee_queue_drain (test_queue, (GeeCollection*) recipient, 1); + _vala_assert (_tmp30_ == 0, "test_queue.drain (recipient, 1) == 0"); + _tmp31_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 0, "test_queue.size == 0"); + _tmp33_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_, "test_queue.is_empty"); + _tmp35_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 0, "recipient.size == 0"); + gee_abstract_collection_clear ((GeeAbstractCollection*) recipient); + _tmp37_ = gee_queue_offer (test_queue, "one"); + _vala_assert (_tmp37_, "test_queue.offer (\"one\")"); + _tmp38_ = gee_queue_drain (test_queue, (GeeCollection*) recipient, -1); + _vala_assert (_tmp38_ == 1, "test_queue.drain (recipient) == 1"); + _tmp39_ = gee_collection_get_size ((GeeCollection*) test_queue); + _tmp40_ = _tmp39_; + _vala_assert (_tmp40_ == 0, "test_queue.size == 0"); + _tmp41_ = gee_collection_get_is_empty ((GeeCollection*) test_queue); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_, "test_queue.is_empty"); + _tmp43_ = gee_abstract_collection_get_size ((GeeCollection*) recipient); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "recipient.size == 1"); + _tmp45_ = gee_abstract_list_get ((GeeAbstractList*) recipient, 0); + _tmp46_ = (gchar*) _tmp45_; + _vala_assert (g_strcmp0 (_tmp46_, "one") == 0, "recipient.get (0) == \"one\""); + _g_free0 (_tmp46_); + _g_object_unref0 (recipient); + _g_object_unref0 (test_queue); +} + + +void queue_tests_test_gobject_properties (QueueTests* self) { + GeeCollection* _tmp0_; + GeeQueue* _tmp1_; + GeeQueue* test_queue; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + gint _tmp4_ = 0; + gint _tmp5_; + gint _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + gint _tmp9_ = 0; + gint _tmp10_; + gint _tmp11_; + GValue _tmp12_ = {0}; + GValue _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_; + gboolean _tmp16_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_QUEUE) ? ((GeeQueue*) _tmp0_) : NULL); + test_queue = _tmp1_; + _vala_assert (test_queue != NULL, "test_queue != null"); + g_value_init (&_tmp2_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_queue, "capacity", &value); + _tmp4_ = g_value_get_int (&value); + _tmp5_ = gee_queue_get_capacity (test_queue); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == _tmp6_, "value.get_int () == test_queue.capacity"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_INT); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_queue, "remaining-capacity", &value); + _tmp9_ = g_value_get_int (&value); + _tmp10_ = gee_queue_get_remaining_capacity (test_queue); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == _tmp11_, "value.get_int () == test_queue.remaining_capacity"); + g_value_unset (&value); + g_value_init (&_tmp12_, G_TYPE_BOOLEAN); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp12_; + _tmp13_ = value; + g_object_get_property ((GObject*) test_queue, "is-full", &value); + _tmp14_ = g_value_get_boolean (&value); + _tmp15_ = gee_queue_get_is_full (test_queue); + _tmp16_ = _tmp15_; + _vala_assert (_tmp14_ == _tmp16_, "value.get_boolean () == test_queue.is_full"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_queue); +} + + +static void queue_tests_class_init (QueueTestsClass * klass) { + queue_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void queue_tests_instance_init (QueueTests * self) { +} + + +GType queue_tests_get_type (void) { + static volatile gsize queue_tests_type_id__volatile = 0; + if (g_once_init_enter (&queue_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (QueueTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) queue_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QueueTests), 0, (GInstanceInitFunc) queue_tests_instance_init, NULL }; + GType queue_tests_type_id; + queue_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "QueueTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&queue_tests_type_id__volatile, queue_tests_type_id); + } + return queue_tests_type_id__volatile; +} + + + diff --git a/tests/testqueue.vala b/tests/testqueue.vala new file mode 100644 index 0000000..aaeb545 --- /dev/null +++ b/tests/testqueue.vala @@ -0,0 +1,137 @@ +/* testqueue.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public abstract class QueueTests : CollectionTests { + + public QueueTests (string name) { + base (name); + add_test ("[Queue] capacity bound", test_capacity_bound); + add_test ("[Queue] one element operation", test_one_element_operation); + add_test ("[Queue] GObject properties", test_gobject_properties); + } + + public void test_capacity_bound () { + var test_queue = test_collection as Gee.Queue<string>; + + // Check the test queue is not null + assert (test_queue != null); + + if (test_queue.capacity == Gee.Queue.UNBOUNDED_CAPACITY) { + // Unbounded capacity + assert (test_queue.remaining_capacity == Gee.Queue.UNBOUNDED_CAPACITY); + assert (! test_queue.is_full); + } else { + // Bounded capacity + assert (test_queue.is_empty); + + // Check that we can fill it completely + int capacity = test_queue.capacity; + for (int i = 1; i <= capacity; i++) { + assert (! test_queue.is_full); + assert (test_queue.offer ("one")); + assert (test_queue.remaining_capacity == capacity - i); + } + assert (test_queue.is_full); + + // Check that we can empty it completely + for (int i = 1; i <= capacity; i++) { + assert (test_queue.poll () == "one"); + assert (! test_queue.is_full); + assert (test_queue.remaining_capacity == i); + } + assert (test_queue.is_empty); + } + } + + public void test_one_element_operation () { + var test_queue = test_collection as Gee.Queue<string>; + ArrayList<string> recipient = new ArrayList<string> (); + + // Check the test queue is not null + assert (test_queue != null); + + // Check offer one element when there is none yet + assert (test_queue.offer ("one")); + assert (test_queue.peek () == "one"); + assert (test_queue.size == 1); + assert (! test_queue.is_empty); + + // Check poll when there is one element + assert (test_queue.poll () == "one"); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + + // Check poll when there is no element + assert (test_queue.peek () == null); + assert (test_queue.poll () == null); + + // Check drain one element when there is one + recipient.clear (); + assert (test_queue.offer ("one")); + assert (test_queue.drain (recipient, 1) == 1); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + assert (recipient.size == 1); + assert (recipient.get (0) == "one"); + + // Check drain one element when there is none + recipient.clear (); + assert (test_queue.drain (recipient, 1) == 0); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + assert (recipient.size == 0); + + // Check drain all elements when there is one + recipient.clear (); + assert (test_queue.offer ("one")); + assert (test_queue.drain (recipient) == 1); + assert (test_queue.size == 0); + assert (test_queue.is_empty); + assert (recipient.size == 1); + assert (recipient.get (0) == "one"); + } + + public new void test_gobject_properties () { + var test_queue = test_collection as Gee.Queue<string>; + + // Check the list exists + assert (test_queue != null); + Value value; + + value = Value (typeof (int)); + test_queue.get_property ("capacity", ref value); + assert (value.get_int () == test_queue.capacity); + value.unset (); + + value = Value (typeof (int)); + test_queue.get_property ("remaining-capacity", ref value); + assert (value.get_int () == test_queue.remaining_capacity); + value.unset (); + + value = Value (typeof (bool)); + test_queue.get_property ("is-full", ref value); + assert (value.get_boolean () == test_queue.is_full); + value.unset (); + } +} diff --git a/tests/testreadonlycollection.c b/tests/testreadonlycollection.c new file mode 100644 index 0000000..96122b6 --- /dev/null +++ b/tests/testreadonlycollection.c @@ -0,0 +1,780 @@ +/* testreadonlycollection.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlycollection.vala, do not modify */ + +/* testreadonlycollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl <quikee@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; +typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyCollectionTests { + GeeTestCase parent_instance; + ReadOnlyCollectionTestsPrivate * priv; + GeeCollection* test_collection; + GeeCollection* ro_collection; +}; + +struct _ReadOnlyCollectionTestsClass { + GeeTestCaseClass parent_class; + GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection); +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer read_only_collection_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_COLLECTION_TESTS_DUMMY_PROPERTY +}; +ReadOnlyCollectionTests* read_only_collection_tests_new (void); +ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type); +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name); +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void read_only_collection_tests_test_unique_read_only_view_instance (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self); +void read_only_collection_tests_test_immutable_iterator (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self); +void read_only_collection_tests_test_immutable (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_immutable_gee_test_case_test_method (gpointer self); +void read_only_collection_tests_test_accurate_view (ReadOnlyCollectionTests* self); +static void _read_only_collection_tests_test_accurate_view_gee_test_case_test_method (gpointer self); +static void read_only_collection_tests_real_set_up (GeeTestCase* base); +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_collection_tests_real_tear_down (GeeTestCase* base); +static GeeCollection* read_only_collection_tests_real_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_collection_tests_finalize (GObject* obj); + + +ReadOnlyCollectionTests* read_only_collection_tests_construct (GType object_type) { + ReadOnlyCollectionTests * self = NULL; + self = (ReadOnlyCollectionTests*) read_only_collection_tests_construct_with_name (object_type, "ReadOnlyCollection"); + return self; +} + + +ReadOnlyCollectionTests* read_only_collection_tests_new (void) { + return read_only_collection_tests_construct (TYPE_READ_ONLY_COLLECTION_TESTS); +} + + +static void _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_unique_read_only_view_instance (self); +} + + +static void _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_immutable_iterator (self); +} + + +static void _read_only_collection_tests_test_immutable_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_immutable (self); +} + + +static void _read_only_collection_tests_test_accurate_view_gee_test_case_test_method (gpointer self) { + read_only_collection_tests_test_accurate_view (self); +} + + +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name) { + ReadOnlyCollectionTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (ReadOnlyCollectionTests*) gee_test_case_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] unique read-only view instance", _read_only_collection_tests_test_unique_read_only_view_instance_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] immutable iterator", _read_only_collection_tests_test_immutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] immutable", _read_only_collection_tests_test_immutable_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyCollection] accurate view", _read_only_collection_tests_test_accurate_view_gee_test_case_test_method, self); + return self; +} + + +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name) { + return read_only_collection_tests_construct_with_name (TYPE_READ_ONLY_COLLECTION_TESTS, name); +} + + +static void read_only_collection_tests_real_set_up (GeeTestCase* base) { + ReadOnlyCollectionTests * self; + GeeHashMultiSet* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_ = NULL; + self = (ReadOnlyCollectionTests*) base; + _tmp0_ = gee_hash_multi_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (self->test_collection); + self->test_collection = (GeeCollection*) _tmp0_; + _tmp1_ = self->test_collection; + _tmp2_ = read_only_collection_tests_get_ro_view (self, _tmp1_); + _g_object_unref0 (self->ro_collection); + self->ro_collection = _tmp2_; +} + + +static void read_only_collection_tests_real_tear_down (GeeTestCase* base) { + ReadOnlyCollectionTests * self; + self = (ReadOnlyCollectionTests*) base; + _g_object_unref0 (self->test_collection); + self->test_collection = NULL; + _g_object_unref0 (self->ro_collection); + self->ro_collection = NULL; +} + + +static GeeCollection* read_only_collection_tests_real_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection) { + GeeCollection* result = NULL; + GeeCollection* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_; + g_return_val_if_fail (collection != NULL, NULL); + _tmp0_ = collection; + _tmp1_ = gee_collection_get_read_only_view (_tmp0_); + _tmp2_ = _tmp1_; + result = _tmp2_; + return result; +} + + +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection) { + g_return_val_if_fail (self != NULL, NULL); + return READ_ONLY_COLLECTION_TESTS_GET_CLASS (self)->get_ro_view (self, collection); +} + + +void read_only_collection_tests_test_unique_read_only_view_instance (ReadOnlyCollectionTests* self) { + GeeCollection* _tmp0_; + GeeCollection* _tmp1_ = NULL; + GeeCollection* another_ro_collection; + GeeCollection* _tmp2_; + GeeCollection* _tmp3_; + GeeCollection* _tmp4_; + GObject* _tmp5_; + GeeCollection* _tmp6_; + gconstpointer _tmp7_ = NULL; + GeeCollection* _tmp8_; + GeeCollection* _tmp9_ = NULL; + GeeCollection* _tmp10_; + gconstpointer _tmp11_ = NULL; + GeeCollection* _tmp12_; + GeeCollection* _tmp13_; + GeeCollection* _tmp14_ = NULL; + GeeCollection* _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _tmp1_ = read_only_collection_tests_get_ro_view (self, _tmp0_); + another_ro_collection = _tmp1_; + _tmp2_ = self->ro_collection; + _tmp3_ = another_ro_collection; + _vala_assert (_tmp2_ == _tmp3_, "ro_collection == another_ro_collection"); + _tmp4_ = self->ro_collection; + _tmp5_ = g_object_new (G_TYPE_OBJECT, NULL); + g_object_set_data_full ((GObject*) _tmp4_, "marker", _tmp5_, g_object_unref); + _tmp6_ = another_ro_collection; + _tmp7_ = g_object_get_data ((GObject*) _tmp6_, "marker"); + _vala_assert (((GObject*) _tmp7_) != NULL, "another_ro_collection.get_data<Object> (\"marker\") != null"); + _g_object_unref0 (another_ro_collection); + another_ro_collection = NULL; + _g_object_unref0 (self->ro_collection); + self->ro_collection = NULL; + _tmp8_ = self->test_collection; + _tmp9_ = read_only_collection_tests_get_ro_view (self, _tmp8_); + _g_object_unref0 (another_ro_collection); + another_ro_collection = _tmp9_; + _tmp10_ = another_ro_collection; + _tmp11_ = g_object_get_data ((GObject*) _tmp10_, "marker"); + _vala_assert (((GObject*) _tmp11_) == NULL, "another_ro_collection.get_data<Object> (\"marker\") == null"); + _tmp12_ = another_ro_collection; + _tmp13_ = another_ro_collection; + _tmp14_ = read_only_collection_tests_get_ro_view (self, _tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp12_ == _tmp15_, "another_ro_collection == get_ro_view (another_ro_collection)"); + _g_object_unref0 (_tmp15_); + _g_object_unref0 (another_ro_collection); +} + + +void read_only_collection_tests_test_immutable_iterator (ReadOnlyCollectionTests* self) { + GeeCollection* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeCollection* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeCollection* _tmp4_; + gint _tmp5_; + gint _tmp6_; + GeeCollection* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeCollection* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeCollection* _tmp11_; + GeeIterator* _tmp12_ = NULL; + GeeIterator* iterator; + gboolean one_found; + gboolean two_found; + gboolean _tmp22_; + gboolean _tmp23_; + GeeIterator* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeIterator* _tmp28_; + gboolean _tmp29_ = FALSE; + gboolean _tmp30_ = FALSE; + GeeCollection* _tmp32_; + gint _tmp33_; + gint _tmp34_; + GeeCollection* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeCollection* _tmp37_; + gboolean _tmp38_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _tmp1_ = gee_collection_add (_tmp0_, "one"); + _vala_assert (_tmp1_, "test_collection.add (\"one\")"); + _tmp2_ = self->test_collection; + _tmp3_ = gee_collection_add (_tmp2_, "two"); + _vala_assert (_tmp3_, "test_collection.add (\"two\")"); + _tmp4_ = self->ro_collection; + _tmp5_ = gee_collection_get_size (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_ == 2, "ro_collection.size == 2"); + _tmp7_ = self->ro_collection; + _tmp8_ = gee_collection_contains (_tmp7_, "one"); + _vala_assert (_tmp8_, "ro_collection.contains (\"one\")"); + _tmp9_ = self->ro_collection; + _tmp10_ = gee_collection_contains (_tmp9_, "two"); + _vala_assert (_tmp10_, "ro_collection.contains (\"two\")"); + _tmp11_ = self->ro_collection; + _tmp12_ = gee_iterable_iterator ((GeeIterable*) _tmp11_); + iterator = _tmp12_; + one_found = FALSE; + two_found = FALSE; + while (TRUE) { + GeeIterator* _tmp13_; + gboolean _tmp14_ = FALSE; + GeeIterator* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + GQuark _tmp19_ = 0U; + static GQuark _tmp18_label0 = 0; + static GQuark _tmp18_label1 = 0; + _tmp13_ = iterator; + _tmp14_ = gee_iterator_next (_tmp13_); + if (!_tmp14_) { + break; + } + _tmp15_ = iterator; + _tmp16_ = gee_iterator_get (_tmp15_); + _tmp17_ = (gchar*) _tmp16_; + _tmp19_ = (NULL == _tmp17_) ? 0 : g_quark_from_string (_tmp17_); + g_free (_tmp17_); + if (_tmp19_ == ((0 != _tmp18_label0) ? _tmp18_label0 : (_tmp18_label0 = g_quark_from_static_string ("one")))) { + switch (0) { + default: + { + gboolean _tmp20_; + _tmp20_ = one_found; + _vala_assert (!_tmp20_, "! one_found"); + one_found = TRUE; + break; + } + } + } else if (_tmp19_ == ((0 != _tmp18_label1) ? _tmp18_label1 : (_tmp18_label1 = g_quark_from_static_string ("two")))) { + switch (0) { + default: + { + gboolean _tmp21_; + _tmp21_ = two_found; + _vala_assert (!_tmp21_, "! two_found"); + two_found = TRUE; + break; + } + } + } else { + switch (0) { + default: + { + g_assert_not_reached (); + } + } + } + } + _tmp22_ = one_found; + _vala_assert (_tmp22_, "one_found"); + _tmp23_ = two_found; + _vala_assert (_tmp23_, "two_found"); + _tmp24_ = iterator; + _tmp25_ = gee_iterator_has_next (_tmp24_); + _vala_assert (!_tmp25_, "! iterator.has_next ()"); + _tmp26_ = iterator; + _tmp27_ = gee_iterator_next (_tmp26_); + _vala_assert (!_tmp27_, "! iterator.next ()"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_first (_tmp28_); + _vala_assert (_tmp29_, "iterator.first ()"); + _tmp30_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp30_) { + GeeIterator* _tmp31_; + _tmp31_ = iterator; + gee_iterator_remove (_tmp31_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp32_ = self->ro_collection; + _tmp33_ = gee_collection_get_size (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 2, "ro_collection.size == 2"); + _tmp35_ = self->ro_collection; + _tmp36_ = gee_collection_contains (_tmp35_, "one"); + _vala_assert (_tmp36_, "ro_collection.contains (\"one\")"); + _tmp37_ = self->ro_collection; + _tmp38_ = gee_collection_contains (_tmp37_, "two"); + _vala_assert (_tmp38_, "ro_collection.contains (\"two\")"); + _g_object_unref0 (iterator); +} + + +void read_only_collection_tests_test_immutable (ReadOnlyCollectionTests* self) { + GeeCollection* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeCollection* _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeCollection* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeArrayList* _tmp7_; + GeeCollection* dummy; + GeeCollection* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeCollection* _tmp10_; + gboolean _tmp11_ = FALSE; + gboolean _tmp12_ = FALSE; + GeeCollection* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeCollection* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeCollection* _tmp22_; + gint _tmp23_; + gint _tmp24_; + GeeCollection* _tmp25_; + gboolean _tmp26_ = FALSE; + gboolean _tmp27_ = FALSE; + GeeCollection* _tmp30_; + gint _tmp31_; + gint _tmp32_; + GeeCollection* _tmp33_; + gboolean _tmp34_ = FALSE; + gboolean _tmp35_ = FALSE; + GeeCollection* _tmp39_; + gint _tmp40_; + gint _tmp41_; + GeeCollection* _tmp42_; + gboolean _tmp43_ = FALSE; + gboolean _tmp44_ = FALSE; + GeeCollection* _tmp48_; + gint _tmp49_; + gint _tmp50_; + GeeCollection* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeCollection* _tmp53_; + gboolean _tmp54_ = FALSE; + gboolean _tmp55_ = FALSE; + GeeCollection* _tmp59_; + gint _tmp60_; + gint _tmp61_; + GeeCollection* _tmp62_; + gboolean _tmp63_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_collection; + _tmp1_ = gee_collection_add (_tmp0_, "one"); + _vala_assert (_tmp1_, "test_collection.add (\"one\")"); + _tmp2_ = self->ro_collection; + _tmp3_ = gee_collection_get_size (_tmp2_); + _tmp4_ = _tmp3_; + _vala_assert (_tmp4_ == 1, "ro_collection.size == 1"); + _tmp5_ = self->ro_collection; + _tmp6_ = gee_collection_contains (_tmp5_, "one"); + _vala_assert (_tmp6_, "ro_collection.contains (\"one\")"); + _tmp7_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp7_; + _tmp8_ = dummy; + _tmp9_ = gee_collection_add (_tmp8_, "one"); + _vala_assert (_tmp9_, "dummy.add (\"one\")"); + _tmp10_ = dummy; + _tmp11_ = gee_collection_add (_tmp10_, "two"); + _vala_assert (_tmp11_, "dummy.add (\"two\")"); + _tmp12_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp12_) { + GeeCollection* _tmp13_; + gboolean _tmp14_ = FALSE; + _tmp13_ = self->ro_collection; + _tmp14_ = gee_collection_add (_tmp13_, "two"); + _vala_assert (_tmp14_, "ro_collection.add (\"two\")"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp15_ = self->ro_collection; + _tmp16_ = gee_collection_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "ro_collection.size == 1"); + _tmp18_ = self->ro_collection; + _tmp19_ = gee_collection_contains (_tmp18_, "one"); + _vala_assert (_tmp19_, "ro_collection.contains (\"one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeCollection* _tmp21_; + _tmp21_ = self->ro_collection; + gee_collection_clear (_tmp21_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp22_ = self->ro_collection; + _tmp23_ = gee_collection_get_size (_tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (_tmp24_ == 1, "ro_collection.size == 1"); + _tmp25_ = self->ro_collection; + _tmp26_ = gee_collection_contains (_tmp25_, "one"); + _vala_assert (_tmp26_, "ro_collection.contains (\"one\")"); + _tmp27_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp27_) { + GeeCollection* _tmp28_; + gboolean _tmp29_ = FALSE; + _tmp28_ = self->ro_collection; + _tmp29_ = gee_collection_remove (_tmp28_, "one"); + _vala_assert (_tmp29_, "ro_collection.remove (\"one\")"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp30_ = self->ro_collection; + _tmp31_ = gee_collection_get_size (_tmp30_); + _tmp32_ = _tmp31_; + _vala_assert (_tmp32_ == 1, "ro_collection.size == 1"); + _tmp33_ = self->ro_collection; + _tmp34_ = gee_collection_contains (_tmp33_, "one"); + _vala_assert (_tmp34_, "ro_collection.contains (\"one\")"); + _tmp35_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp35_) { + GeeCollection* _tmp36_; + GeeCollection* _tmp37_; + gboolean _tmp38_ = FALSE; + _tmp36_ = self->ro_collection; + _tmp37_ = dummy; + _tmp38_ = gee_collection_add_all (_tmp36_, _tmp37_); + _vala_assert (_tmp38_, "ro_collection.add_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp39_ = self->ro_collection; + _tmp40_ = gee_collection_get_size (_tmp39_); + _tmp41_ = _tmp40_; + _vala_assert (_tmp41_ == 1, "ro_collection.size == 1"); + _tmp42_ = self->ro_collection; + _tmp43_ = gee_collection_contains (_tmp42_, "one"); + _vala_assert (_tmp43_, "ro_collection.contains (\"one\")"); + _tmp44_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp44_) { + GeeCollection* _tmp45_; + GeeCollection* _tmp46_; + gboolean _tmp47_ = FALSE; + _tmp45_ = self->ro_collection; + _tmp46_ = dummy; + _tmp47_ = gee_collection_remove_all (_tmp45_, _tmp46_); + _vala_assert (_tmp47_, "ro_collection.remove_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp48_ = self->ro_collection; + _tmp49_ = gee_collection_get_size (_tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 1, "ro_collection.size == 1"); + _tmp51_ = self->ro_collection; + _tmp52_ = gee_collection_contains (_tmp51_, "one"); + _vala_assert (_tmp52_, "ro_collection.contains (\"one\")"); + _tmp53_ = dummy; + _tmp54_ = gee_collection_remove (_tmp53_, "one"); + _vala_assert (_tmp54_, "dummy.remove (\"one\")"); + _tmp55_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp55_) { + GeeCollection* _tmp56_; + GeeCollection* _tmp57_; + gboolean _tmp58_ = FALSE; + _tmp56_ = self->ro_collection; + _tmp57_ = dummy; + _tmp58_ = gee_collection_retain_all (_tmp56_, _tmp57_); + _vala_assert (_tmp58_, "ro_collection.retain_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp59_ = self->ro_collection; + _tmp60_ = gee_collection_get_size (_tmp59_); + _tmp61_ = _tmp60_; + _vala_assert (_tmp61_ == 1, "ro_collection.size == 1"); + _tmp62_ = self->ro_collection; + _tmp63_ = gee_collection_contains (_tmp62_, "one"); + _vala_assert (_tmp63_, "ro_collection.contains (\"one\")"); + _g_object_unref0 (dummy); +} + + +void read_only_collection_tests_test_accurate_view (ReadOnlyCollectionTests* self) { + GeeArrayList* _tmp0_; + GeeCollection* dummy; + gboolean _tmp1_ = FALSE; + gboolean _tmp2_ = FALSE; + GeeCollection* _tmp3_; + GType _tmp4_; + GType _tmp5_; + GeeCollection* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeCollection* _tmp9_; + gboolean _tmp10_; + gboolean _tmp11_; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeCollection* _tmp16_; + gint _tmp17_; + gint _tmp18_; + GeeCollection* _tmp19_; + gboolean _tmp20_; + gboolean _tmp21_; + GeeCollection* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeCollection* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeCollection* _tmp26_; + gint _tmp27_; + gint _tmp28_; + GeeCollection* _tmp29_; + gboolean _tmp30_; + gboolean _tmp31_; + GeeCollection* _tmp32_; + gboolean _tmp33_ = FALSE; + GeeCollection* _tmp34_; + gboolean _tmp35_ = FALSE; + GeeCollection* _tmp36_; + gboolean _tmp37_ = FALSE; + GeeCollection* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeCollection* _tmp40_; + gint _tmp41_; + gint _tmp42_; + GeeCollection* _tmp43_; + gboolean _tmp44_; + gboolean _tmp45_; + GeeCollection* _tmp46_; + gboolean _tmp47_ = FALSE; + GeeCollection* _tmp48_; + gboolean _tmp49_ = FALSE; + GeeCollection* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeCollection* _tmp52_; + GeeCollection* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeCollection* _tmp56_; + gboolean _tmp57_; + gboolean _tmp58_; + GeeCollection* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeCollection* _tmp61_; + gboolean _tmp62_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp0_; + _tmp1_ = gee_collection_add (dummy, "one"); + _vala_assert (_tmp1_, "dummy.add (\"one\")"); + _tmp2_ = gee_collection_add (dummy, "two"); + _vala_assert (_tmp2_, "dummy.add (\"two\")"); + _tmp3_ = self->ro_collection; + _tmp4_ = gee_iterable_get_element_type ((GeeIterable*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == G_TYPE_STRING, "ro_collection.element_type == typeof (string)"); + _tmp6_ = self->ro_collection; + _tmp7_ = gee_collection_get_size (_tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 0, "ro_collection.size == 0"); + _tmp9_ = self->ro_collection; + _tmp10_ = gee_collection_get_is_empty (_tmp9_); + _tmp11_ = _tmp10_; + _vala_assert (_tmp11_, "ro_collection.is_empty"); + _tmp12_ = self->ro_collection; + _tmp13_ = gee_collection_contains (_tmp12_, "one"); + _vala_assert (!_tmp13_, "! ro_collection.contains (\"one\")"); + _tmp14_ = self->test_collection; + _tmp15_ = gee_collection_add (_tmp14_, "one"); + _vala_assert (_tmp15_, "test_collection.add (\"one\")"); + _tmp16_ = self->ro_collection; + _tmp17_ = gee_collection_get_size (_tmp16_); + _tmp18_ = _tmp17_; + _vala_assert (_tmp18_ == 1, "ro_collection.size == 1"); + _tmp19_ = self->ro_collection; + _tmp20_ = gee_collection_get_is_empty (_tmp19_); + _tmp21_ = _tmp20_; + _vala_assert (!_tmp21_, "! ro_collection.is_empty"); + _tmp22_ = self->ro_collection; + _tmp23_ = gee_collection_contains (_tmp22_, "one"); + _vala_assert (_tmp23_, "ro_collection.contains (\"one\")"); + _tmp24_ = self->test_collection; + _tmp25_ = gee_collection_add (_tmp24_, "two"); + _vala_assert (_tmp25_, "test_collection.add (\"two\")"); + _tmp26_ = self->ro_collection; + _tmp27_ = gee_collection_get_size (_tmp26_); + _tmp28_ = _tmp27_; + _vala_assert (_tmp28_ == 2, "ro_collection.size == 2"); + _tmp29_ = self->ro_collection; + _tmp30_ = gee_collection_get_is_empty (_tmp29_); + _tmp31_ = _tmp30_; + _vala_assert (!_tmp31_, "! ro_collection.is_empty"); + _tmp32_ = self->ro_collection; + _tmp33_ = gee_collection_contains (_tmp32_, "one"); + _vala_assert (_tmp33_, "ro_collection.contains (\"one\")"); + _tmp34_ = self->ro_collection; + _tmp35_ = gee_collection_contains (_tmp34_, "two"); + _vala_assert (_tmp35_, "ro_collection.contains (\"two\")"); + _tmp36_ = self->ro_collection; + _tmp37_ = gee_collection_contains_all (_tmp36_, dummy); + _vala_assert (_tmp37_, "ro_collection.contains_all (dummy)"); + _tmp38_ = self->test_collection; + _tmp39_ = gee_collection_remove (_tmp38_, "one"); + _vala_assert (_tmp39_, "test_collection.remove (\"one\")"); + _tmp40_ = self->ro_collection; + _tmp41_ = gee_collection_get_size (_tmp40_); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_ == 1, "ro_collection.size == 1"); + _tmp43_ = self->ro_collection; + _tmp44_ = gee_collection_get_is_empty (_tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (!_tmp45_, "! ro_collection.is_empty"); + _tmp46_ = self->ro_collection; + _tmp47_ = gee_collection_contains (_tmp46_, "one"); + _vala_assert (!_tmp47_, "! ro_collection.contains (\"one\")"); + _tmp48_ = self->ro_collection; + _tmp49_ = gee_collection_contains (_tmp48_, "two"); + _vala_assert (_tmp49_, "ro_collection.contains (\"two\")"); + _tmp50_ = self->ro_collection; + _tmp51_ = gee_collection_contains_all (_tmp50_, dummy); + _vala_assert (!_tmp51_, "! ro_collection.contains_all (dummy)"); + _tmp52_ = self->test_collection; + gee_collection_clear (_tmp52_); + _tmp53_ = self->ro_collection; + _tmp54_ = gee_collection_get_size (_tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 0, "ro_collection.size == 0"); + _tmp56_ = self->ro_collection; + _tmp57_ = gee_collection_get_is_empty (_tmp56_); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_, "ro_collection.is_empty"); + _tmp59_ = self->ro_collection; + _tmp60_ = gee_collection_contains (_tmp59_, "one"); + _vala_assert (!_tmp60_, "! ro_collection.contains (\"one\")"); + _tmp61_ = self->ro_collection; + _tmp62_ = gee_collection_contains (_tmp61_, "two"); + _vala_assert (!_tmp62_, "! ro_collection.contains (\"two\")"); + _g_object_unref0 (dummy); +} + + +static void read_only_collection_tests_class_init (ReadOnlyCollectionTestsClass * klass) { + read_only_collection_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_collection_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_collection_tests_real_tear_down; + READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_collection_tests_real_get_ro_view; + G_OBJECT_CLASS (klass)->finalize = read_only_collection_tests_finalize; +} + + +static void read_only_collection_tests_instance_init (ReadOnlyCollectionTests * self) { +} + + +static void read_only_collection_tests_finalize (GObject* obj) { + ReadOnlyCollectionTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests); + _g_object_unref0 (self->test_collection); + _g_object_unref0 (self->ro_collection); + G_OBJECT_CLASS (read_only_collection_tests_parent_class)->finalize (obj); +} + + +GType read_only_collection_tests_get_type (void) { + static volatile gsize read_only_collection_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_collection_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyCollectionTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_collection_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyCollectionTests), 0, (GInstanceInitFunc) read_only_collection_tests_instance_init, NULL }; + GType read_only_collection_tests_type_id; + read_only_collection_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "ReadOnlyCollectionTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_collection_tests_type_id__volatile, read_only_collection_tests_type_id); + } + return read_only_collection_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlycollection.vala b/tests/testreadonlycollection.vala new file mode 100644 index 0000000..42134f5 --- /dev/null +++ b/tests/testreadonlycollection.vala @@ -0,0 +1,225 @@ +/* testreadonlycollection.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl <quikee@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class ReadOnlyCollectionTests : Gee.TestCase { + + public ReadOnlyCollectionTests () { + this.with_name ("ReadOnlyCollection"); + } + + public ReadOnlyCollectionTests.with_name (string name) { + base (name); + add_test ("[ReadOnlyCollection] unique read-only view instance", + test_unique_read_only_view_instance); + add_test ("[ReadOnlyCollection] immutable iterator", test_immutable_iterator); + add_test ("[ReadOnlyCollection] immutable", test_immutable); + add_test ("[ReadOnlyCollection] accurate view", test_accurate_view); + } + + protected Collection<string> test_collection; + protected Collection<string> ro_collection; + + public override void set_up () { + test_collection = new HashMultiSet<string> (); + ro_collection = get_ro_view (test_collection); + } + + public override void tear_down () { + test_collection = null; + ro_collection = null; + } + + protected virtual Collection<string> get_ro_view (Collection<string> collection) { + return collection.read_only_view; + } + + public void test_unique_read_only_view_instance () { + var another_ro_collection = get_ro_view (test_collection); + assert (ro_collection == another_ro_collection); + + ro_collection.set_data ("marker", new Object ()); + assert (another_ro_collection.get_data<Object> ("marker") != null); + + another_ro_collection = null; + ro_collection = null; + + another_ro_collection = get_ro_view (test_collection); + assert (another_ro_collection.get_data<Object> ("marker") == null); + + // Check that the read-only view of the view is itself + assert (another_ro_collection == get_ro_view (another_ro_collection)); + } + + public void test_immutable_iterator () { + assert (test_collection.add ("one")); + assert (test_collection.add ("two")); + + assert (ro_collection.size == 2); + assert (ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + + Iterator<string> iterator = ro_collection.iterator (); + + bool one_found = false; + bool two_found = false; + + while (iterator.next ()) { + switch(iterator.get ()) { + case "one": + assert (! one_found); + one_found = true; + break; + case "two": + assert (! two_found); + two_found = true; + break; + default: + assert_not_reached (); + } + } + + assert (one_found); + assert (two_found); + + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.first ()); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (ro_collection.size == 2); + assert (ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + } + + public void test_immutable () { + assert (test_collection.add ("one")); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + Collection<string> dummy = new ArrayList<string> (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.add ("two")); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_collection.clear (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.remove ("one")); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.add_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.remove_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + + assert (dummy.remove ("one")); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_collection.retain_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_collection.size == 1); + assert (ro_collection.contains ("one")); + } + + public void test_accurate_view () { + Collection<string> dummy = new ArrayList<string> (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (ro_collection.element_type == typeof (string)); + + assert (ro_collection.size == 0); + assert (ro_collection.is_empty); + assert (! ro_collection.contains ("one")); + + assert (test_collection.add ("one")); + assert (ro_collection.size == 1); + assert (! ro_collection.is_empty); + assert (ro_collection.contains ("one")); + + assert (test_collection.add ("two")); + assert (ro_collection.size == 2); + assert (! ro_collection.is_empty); + assert (ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + assert (ro_collection.contains_all (dummy)); + + assert (test_collection.remove ("one")); + assert (ro_collection.size == 1); + assert (! ro_collection.is_empty); + assert (! ro_collection.contains ("one")); + assert (ro_collection.contains ("two")); + assert (! ro_collection.contains_all (dummy)); + + test_collection.clear (); + assert (ro_collection.size == 0); + assert (ro_collection.is_empty); + assert (! ro_collection.contains ("one")); + assert (! ro_collection.contains ("two")); + } +} diff --git a/tests/testreadonlylist.c b/tests/testreadonlylist.c new file mode 100644 index 0000000..9a53a3c --- /dev/null +++ b/tests/testreadonlylist.c @@ -0,0 +1,904 @@ +/* testreadonlylist.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlylist.vala, do not modify */ + +/* testreadonlylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl <quikee@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; +typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate; + +#define TYPE_READ_ONLY_LIST_TESTS (read_only_list_tests_get_type ()) +#define READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTests)) +#define READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) +#define IS_READ_ONLY_LIST_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_LIST_TESTS)) +#define IS_READ_ONLY_LIST_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_LIST_TESTS)) +#define READ_ONLY_LIST_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_LIST_TESTS, ReadOnlyListTestsClass)) + +typedef struct _ReadOnlyListTests ReadOnlyListTests; +typedef struct _ReadOnlyListTestsClass ReadOnlyListTestsClass; +typedef struct _ReadOnlyListTestsPrivate ReadOnlyListTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyCollectionTests { + GeeTestCase parent_instance; + ReadOnlyCollectionTestsPrivate * priv; + GeeCollection* test_collection; + GeeCollection* ro_collection; +}; + +struct _ReadOnlyCollectionTestsClass { + GeeTestCaseClass parent_class; + GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection); +}; + +struct _ReadOnlyListTests { + ReadOnlyCollectionTests parent_instance; + ReadOnlyListTestsPrivate * priv; +}; + +struct _ReadOnlyListTestsClass { + ReadOnlyCollectionTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer read_only_list_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +GType read_only_list_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_LIST_TESTS_DUMMY_PROPERTY +}; +ReadOnlyListTests* read_only_list_tests_new (void); +ReadOnlyListTests* read_only_list_tests_construct (GType object_type); +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name); +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void read_only_list_tests_test_immutable_iterator (ReadOnlyListTests* self); +static void _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self); +void read_only_list_tests_test_immutable (ReadOnlyListTests* self); +static void _read_only_list_tests_test_immutable_gee_test_case_test_method (gpointer self); +void read_only_list_tests_test_accurate_view (ReadOnlyListTests* self); +static void _read_only_list_tests_test_accurate_view_gee_test_case_test_method (gpointer self); +static void read_only_list_tests_real_set_up (GeeTestCase* base); +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_list_tests_real_tear_down (GeeTestCase* base); +static GeeCollection* read_only_list_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection); + + +static void _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) { + read_only_list_tests_test_immutable_iterator (self); +} + + +static void _read_only_list_tests_test_immutable_gee_test_case_test_method (gpointer self) { + read_only_list_tests_test_immutable (self); +} + + +static void _read_only_list_tests_test_accurate_view_gee_test_case_test_method (gpointer self) { + read_only_list_tests_test_accurate_view (self); +} + + +ReadOnlyListTests* read_only_list_tests_construct (GType object_type) { + ReadOnlyListTests * self = NULL; + self = (ReadOnlyListTests*) read_only_collection_tests_construct_with_name (object_type, "ReadOnlyList"); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] immutable iterator", _read_only_list_tests_test_immutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] immutable", _read_only_list_tests_test_immutable_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyList] accurate view", _read_only_list_tests_test_accurate_view_gee_test_case_test_method, self); + return self; +} + + +ReadOnlyListTests* read_only_list_tests_new (void) { + return read_only_list_tests_construct (TYPE_READ_ONLY_LIST_TESTS); +} + + +static void read_only_list_tests_real_set_up (GeeTestCase* base) { + ReadOnlyListTests * self; + GeeArrayList* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_ = NULL; + self = (ReadOnlyListTests*) base; + _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; + _tmp1_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp2_ = read_only_collection_tests_get_ro_view ((ReadOnlyCollectionTests*) self, _tmp1_); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = _tmp2_; +} + + +static void read_only_list_tests_real_tear_down (GeeTestCase* base) { + ReadOnlyListTests * self; + self = (ReadOnlyListTests*) base; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = NULL; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = NULL; +} + + +static GeeCollection* read_only_list_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection) { + ReadOnlyListTests * self; + GeeCollection* result = NULL; + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* _tmp2_; + self = (ReadOnlyListTests*) base; + g_return_val_if_fail (collection != NULL, NULL); + _tmp0_ = collection; + _tmp1_ = gee_list_get_read_only_view (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_LIST, GeeList)); + _tmp2_ = _tmp1_; + result = (GeeCollection*) _tmp2_; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void read_only_list_tests_test_immutable_iterator (ReadOnlyListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeCollection* _tmp2_; + GeeList* _tmp3_; + GeeList* ro_list; + GeeList* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeList* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeList* _tmp8_; + gint _tmp9_; + gint _tmp10_; + GeeList* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + GeeList* _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + GeeList* _tmp17_; + GeeListIterator* _tmp18_ = NULL; + GeeListIterator* iterator; + GeeListIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeListIterator* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeListIterator* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeListIterator* _tmp26_; + gint _tmp27_ = 0; + GeeListIterator* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeListIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeListIterator* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* _tmp34_; + GeeListIterator* _tmp35_; + gint _tmp36_ = 0; + GeeListIterator* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeListIterator* _tmp39_; + gboolean _tmp40_ = FALSE; + GeeListIterator* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeListIterator* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeListIterator* _tmp45_; + gpointer _tmp46_ = NULL; + gchar* _tmp47_; + GeeListIterator* _tmp48_; + gint _tmp49_ = 0; + GeeListIterator* _tmp50_; + gboolean _tmp51_ = FALSE; + GeeListIterator* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeListIterator* _tmp55_; + gint _tmp56_ = 0; + GeeListIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeListIterator* _tmp59_; + gpointer _tmp60_ = NULL; + gchar* _tmp61_; + GeeListIterator* _tmp62_; + gint _tmp63_ = 0; + gboolean _tmp64_ = FALSE; + GeeList* _tmp66_; + gint _tmp67_; + gint _tmp68_; + GeeList* _tmp69_; + gpointer _tmp70_ = NULL; + gchar* _tmp71_; + GeeList* _tmp72_; + gpointer _tmp73_ = NULL; + gchar* _tmp74_; + GeeListIterator* _tmp75_; + gint _tmp76_ = 0; + gboolean _tmp77_ = FALSE; + GeeList* _tmp79_; + gint _tmp80_; + gint _tmp81_; + GeeList* _tmp82_; + gpointer _tmp83_ = NULL; + gchar* _tmp84_; + GeeList* _tmp85_; + gpointer _tmp86_ = NULL; + gchar* _tmp87_; + GeeListIterator* _tmp88_; + gint _tmp89_ = 0; + gboolean _tmp90_ = FALSE; + GeeList* _tmp92_; + gint _tmp93_; + gint _tmp94_; + GeeList* _tmp95_; + gpointer _tmp96_ = NULL; + gchar* _tmp97_; + GeeList* _tmp98_; + gpointer _tmp99_ = NULL; + gchar* _tmp100_; + GeeListIterator* _tmp101_; + gint _tmp102_ = 0; + gboolean _tmp103_ = FALSE; + GeeList* _tmp105_; + gint _tmp106_; + gint _tmp107_; + GeeList* _tmp108_; + gpointer _tmp109_ = NULL; + gchar* _tmp110_; + GeeList* _tmp111_; + gpointer _tmp112_ = NULL; + gchar* _tmp113_; + GeeListIterator* _tmp114_; + gint _tmp115_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL); + ro_list = _tmp3_; + _tmp4_ = test_list; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "one"); + _vala_assert (_tmp5_, "test_list.add (\"one\")"); + _tmp6_ = test_list; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "two"); + _vala_assert (_tmp7_, "test_list.add (\"two\")"); + _tmp8_ = ro_list; + _tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 2, "ro_list.size == 2"); + _tmp11_ = ro_list; + _tmp12_ = gee_list_get (_tmp11_, 0); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = ro_list; + _tmp15_ = gee_list_get (_tmp14_, 1); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp16_); + _tmp17_ = ro_list; + _tmp18_ = gee_list_list_iterator (_tmp17_); + iterator = _tmp18_; + _tmp19_ = iterator; + _tmp20_ = gee_iterator_has_next ((GeeIterator*) _tmp19_); + _vala_assert (_tmp20_, "iterator.has_next ()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_next ((GeeIterator*) _tmp21_); + _vala_assert (_tmp22_, "iterator.next ()"); + _tmp23_ = iterator; + _tmp24_ = gee_iterator_get ((GeeIterator*) _tmp23_); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp25_); + _tmp26_ = iterator; + _tmp27_ = gee_list_iterator_index (_tmp26_); + _vala_assert (_tmp27_ == 0, "iterator.index () == 0"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_has_next ((GeeIterator*) _tmp28_); + _vala_assert (_tmp29_, "iterator.has_next ()"); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_next ((GeeIterator*) _tmp30_); + _vala_assert (_tmp31_, "iterator.next ()"); + _tmp32_ = iterator; + _tmp33_ = gee_iterator_get ((GeeIterator*) _tmp32_); + _tmp34_ = (gchar*) _tmp33_; + _vala_assert (g_strcmp0 (_tmp34_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp34_); + _tmp35_ = iterator; + _tmp36_ = gee_list_iterator_index (_tmp35_); + _vala_assert (_tmp36_ == 1, "iterator.index () == 1"); + _tmp37_ = iterator; + _tmp38_ = gee_iterator_has_next ((GeeIterator*) _tmp37_); + _vala_assert (!_tmp38_, "! iterator.has_next ()"); + _tmp39_ = iterator; + _tmp40_ = gee_iterator_next ((GeeIterator*) _tmp39_); + _vala_assert (!_tmp40_, "! iterator.next ()"); + _tmp41_ = iterator; + _tmp42_ = gee_bidir_iterator_has_previous ((GeeBidirIterator*) _tmp41_); + _vala_assert (_tmp42_, "iterator.has_previous ()"); + _tmp43_ = iterator; + _tmp44_ = gee_bidir_iterator_previous ((GeeBidirIterator*) _tmp43_); + _vala_assert (_tmp44_, "iterator.previous ()"); + _tmp45_ = iterator; + _tmp46_ = gee_iterator_get ((GeeIterator*) _tmp45_); + _tmp47_ = (gchar*) _tmp46_; + _vala_assert (g_strcmp0 (_tmp47_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp47_); + _tmp48_ = iterator; + _tmp49_ = gee_list_iterator_index (_tmp48_); + _vala_assert (_tmp49_ == 0, "iterator.index () == 0"); + _tmp50_ = iterator; + _tmp51_ = gee_bidir_iterator_last ((GeeBidirIterator*) _tmp50_); + _vala_assert (_tmp51_, "iterator.last ()"); + _tmp52_ = iterator; + _tmp53_ = gee_iterator_get ((GeeIterator*) _tmp52_); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp54_); + _tmp55_ = iterator; + _tmp56_ = gee_list_iterator_index (_tmp55_); + _vala_assert (_tmp56_ == 1, "iterator.index () == 1"); + _tmp57_ = iterator; + _tmp58_ = gee_iterator_first ((GeeIterator*) _tmp57_); + _vala_assert (_tmp58_, "iterator.first ()"); + _tmp59_ = iterator; + _tmp60_ = gee_iterator_get ((GeeIterator*) _tmp59_); + _tmp61_ = (gchar*) _tmp60_; + _vala_assert (g_strcmp0 (_tmp61_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp61_); + _tmp62_ = iterator; + _tmp63_ = gee_list_iterator_index (_tmp62_); + _vala_assert (_tmp63_ == 0, "iterator.index () == 0"); + _tmp64_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp64_) { + GeeListIterator* _tmp65_; + _tmp65_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp65_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp66_ = ro_list; + _tmp67_ = gee_collection_get_size ((GeeCollection*) _tmp66_); + _tmp68_ = _tmp67_; + _vala_assert (_tmp68_ == 2, "ro_list.size == 2"); + _tmp69_ = ro_list; + _tmp70_ = gee_list_get (_tmp69_, 0); + _tmp71_ = (gchar*) _tmp70_; + _vala_assert (g_strcmp0 (_tmp71_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp71_); + _tmp72_ = ro_list; + _tmp73_ = gee_list_get (_tmp72_, 1); + _tmp74_ = (gchar*) _tmp73_; + _vala_assert (g_strcmp0 (_tmp74_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp74_); + _tmp75_ = iterator; + _tmp76_ = gee_list_iterator_index (_tmp75_); + _vala_assert (_tmp76_ == 0, "iterator.index () == 0"); + _tmp77_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp77_) { + GeeListIterator* _tmp78_; + _tmp78_ = iterator; + gee_list_iterator_set (_tmp78_, "three"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp79_ = ro_list; + _tmp80_ = gee_collection_get_size ((GeeCollection*) _tmp79_); + _tmp81_ = _tmp80_; + _vala_assert (_tmp81_ == 2, "ro_list.size == 2"); + _tmp82_ = ro_list; + _tmp83_ = gee_list_get (_tmp82_, 0); + _tmp84_ = (gchar*) _tmp83_; + _vala_assert (g_strcmp0 (_tmp84_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp84_); + _tmp85_ = ro_list; + _tmp86_ = gee_list_get (_tmp85_, 1); + _tmp87_ = (gchar*) _tmp86_; + _vala_assert (g_strcmp0 (_tmp87_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp87_); + _tmp88_ = iterator; + _tmp89_ = gee_list_iterator_index (_tmp88_); + _vala_assert (_tmp89_ == 0, "iterator.index () == 0"); + _tmp90_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp90_) { + GeeListIterator* _tmp91_; + _tmp91_ = iterator; + gee_list_iterator_insert (_tmp91_, "three"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp92_ = ro_list; + _tmp93_ = gee_collection_get_size ((GeeCollection*) _tmp92_); + _tmp94_ = _tmp93_; + _vala_assert (_tmp94_ == 2, "ro_list.size == 2"); + _tmp95_ = ro_list; + _tmp96_ = gee_list_get (_tmp95_, 0); + _tmp97_ = (gchar*) _tmp96_; + _vala_assert (g_strcmp0 (_tmp97_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp97_); + _tmp98_ = ro_list; + _tmp99_ = gee_list_get (_tmp98_, 1); + _tmp100_ = (gchar*) _tmp99_; + _vala_assert (g_strcmp0 (_tmp100_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp100_); + _tmp101_ = iterator; + _tmp102_ = gee_list_iterator_index (_tmp101_); + _vala_assert (_tmp102_ == 0, "iterator.index () == 0"); + _tmp103_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp103_) { + GeeListIterator* _tmp104_; + _tmp104_ = iterator; + gee_list_iterator_add (_tmp104_, "three"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp105_ = ro_list; + _tmp106_ = gee_collection_get_size ((GeeCollection*) _tmp105_); + _tmp107_ = _tmp106_; + _vala_assert (_tmp107_ == 2, "ro_list.size == 2"); + _tmp108_ = ro_list; + _tmp109_ = gee_list_get (_tmp108_, 0); + _tmp110_ = (gchar*) _tmp109_; + _vala_assert (g_strcmp0 (_tmp110_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp110_); + _tmp111_ = ro_list; + _tmp112_ = gee_list_get (_tmp111_, 1); + _tmp113_ = (gchar*) _tmp112_; + _vala_assert (g_strcmp0 (_tmp113_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp113_); + _tmp114_ = iterator; + _tmp115_ = gee_list_iterator_index (_tmp114_); + _vala_assert (_tmp115_ == 0, "iterator.index () == 0"); + _g_object_unref0 (iterator); + _g_object_unref0 (ro_list); + _g_object_unref0 (test_list); +} + + +void read_only_list_tests_test_immutable (ReadOnlyListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeCollection* _tmp2_; + GeeList* _tmp3_; + GeeList* ro_list; + GeeList* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeList* _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeList* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeArrayList* _tmp11_; + GeeCollection* dummy; + GeeCollection* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeCollection* _tmp14_; + gboolean _tmp15_ = FALSE; + gboolean _tmp16_ = FALSE; + GeeList* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeList* _tmp21_; + gboolean _tmp22_ = FALSE; + gboolean _tmp23_ = FALSE; + GeeList* _tmp25_; + gint _tmp26_; + gint _tmp27_; + GeeList* _tmp28_; + gboolean _tmp29_ = FALSE; + gboolean _tmp30_ = FALSE; + GeeList* _tmp34_; + gint _tmp35_; + gint _tmp36_; + GeeList* _tmp37_; + gboolean _tmp38_ = FALSE; + gboolean _tmp39_ = FALSE; + GeeList* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeList* _tmp45_; + gboolean _tmp46_ = FALSE; + gboolean _tmp47_ = FALSE; + GeeList* _tmp49_; + gint _tmp50_; + gint _tmp51_; + GeeList* _tmp52_; + gboolean _tmp53_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL); + ro_list = _tmp3_; + _tmp4_ = test_list; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "one"); + _vala_assert (_tmp5_, "test_list.add (\"one\")"); + _tmp6_ = ro_list; + _tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == 1, "ro_list.size == 1"); + _tmp9_ = ro_list; + _tmp10_ = gee_collection_contains ((GeeCollection*) _tmp9_, "one"); + _vala_assert (_tmp10_, "ro_list.contains (\"one\")"); + _tmp11_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp11_; + _tmp12_ = dummy; + _tmp13_ = gee_collection_add (_tmp12_, "one"); + _vala_assert (_tmp13_, "dummy.add (\"one\")"); + _tmp14_ = dummy; + _tmp15_ = gee_collection_add (_tmp14_, "two"); + _vala_assert (_tmp15_, "dummy.add (\"two\")"); + _tmp16_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp16_) { + GeeList* _tmp17_; + _tmp17_ = ro_list; + gee_list_set (_tmp17_, 0, "two"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp18_ = ro_list; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 1, "ro_list.size == 1"); + _tmp21_ = ro_list; + _tmp22_ = gee_collection_contains ((GeeCollection*) _tmp21_, "one"); + _vala_assert (_tmp22_, "ro_list.contains (\"one\")"); + _tmp23_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp23_) { + GeeList* _tmp24_; + _tmp24_ = ro_list; + gee_list_insert (_tmp24_, 1, "two"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp25_ = ro_list; + _tmp26_ = gee_collection_get_size ((GeeCollection*) _tmp25_); + _tmp27_ = _tmp26_; + _vala_assert (_tmp27_ == 1, "ro_list.size == 1"); + _tmp28_ = ro_list; + _tmp29_ = gee_collection_contains ((GeeCollection*) _tmp28_, "one"); + _vala_assert (_tmp29_, "ro_list.contains (\"one\")"); + _tmp30_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp30_) { + GeeList* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + _tmp31_ = ro_list; + _tmp32_ = gee_list_remove_at (_tmp31_, 1); + _tmp33_ = (gchar*) _tmp32_; + _g_free0 (_tmp33_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp34_ = ro_list; + _tmp35_ = gee_collection_get_size ((GeeCollection*) _tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (_tmp36_ == 1, "ro_list.size == 1"); + _tmp37_ = ro_list; + _tmp38_ = gee_collection_contains ((GeeCollection*) _tmp37_, "one"); + _vala_assert (_tmp38_, "ro_list.contains (\"one\")"); + _tmp39_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp39_) { + GeeList* _tmp40_; + GeeCollection* _tmp41_; + _tmp40_ = ro_list; + _tmp41_ = dummy; + gee_list_insert_all (_tmp40_, 1, _tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp42_ = ro_list; + _tmp43_ = gee_collection_get_size ((GeeCollection*) _tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "ro_list.size == 1"); + _tmp45_ = ro_list; + _tmp46_ = gee_collection_contains ((GeeCollection*) _tmp45_, "one"); + _vala_assert (_tmp46_, "ro_list.contains (\"one\")"); + _tmp47_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp47_) { + GeeList* _tmp48_; + _tmp48_ = ro_list; + gee_list_sort (_tmp48_, NULL); + exit (0); + } + g_test_trap_assert_failed (); + _tmp49_ = ro_list; + _tmp50_ = gee_collection_get_size ((GeeCollection*) _tmp49_); + _tmp51_ = _tmp50_; + _vala_assert (_tmp51_ == 1, "ro_list.size == 1"); + _tmp52_ = ro_list; + _tmp53_ = gee_collection_contains ((GeeCollection*) _tmp52_, "one"); + _vala_assert (_tmp53_, "ro_list.contains (\"one\")"); + _g_object_unref0 (dummy); + _g_object_unref0 (ro_list); + _g_object_unref0 (test_list); +} + + +void read_only_list_tests_test_accurate_view (ReadOnlyListTests* self) { + GeeCollection* _tmp0_; + GeeList* _tmp1_; + GeeList* test_list; + GeeCollection* _tmp2_; + GeeList* _tmp3_; + GeeList* ro_list; + GeeArrayList* _tmp4_; + GeeCollection* dummy; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + GType _tmp7_; + GType _tmp8_; + gint _tmp9_; + gint _tmp10_; + gboolean _tmp11_; + gboolean _tmp12_; + gboolean _tmp13_ = FALSE; + gint _tmp14_ = 0; + gboolean _tmp15_ = FALSE; + gint _tmp16_; + gint _tmp17_; + gboolean _tmp18_; + gboolean _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gint _tmp22_ = 0; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + gboolean _tmp27_ = FALSE; + gint _tmp28_; + gint _tmp29_; + gboolean _tmp30_; + gboolean _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + gint _tmp34_ = 0; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gint _tmp37_ = 0; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + gboolean _tmp42_ = FALSE; + gint _tmp43_; + gint _tmp44_; + gboolean _tmp45_; + gboolean _tmp46_; + gboolean _tmp47_ = FALSE; + gint _tmp48_ = 0; + gboolean _tmp49_ = FALSE; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + gint _tmp52_ = 0; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + gint _tmp57_; + gint _tmp58_; + gboolean _tmp59_; + gboolean _tmp60_; + gint _tmp61_ = 0; + gint _tmp62_ = 0; + g_return_if_fail (self != NULL); + _tmp0_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_LIST) ? ((GeeList*) _tmp0_) : NULL); + test_list = _tmp1_; + _tmp2_ = ((ReadOnlyCollectionTests*) self)->ro_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_LIST) ? ((GeeList*) _tmp2_) : NULL); + ro_list = _tmp3_; + _tmp4_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + dummy = (GeeCollection*) _tmp4_; + _tmp5_ = gee_collection_add (dummy, "one"); + _vala_assert (_tmp5_, "dummy.add (\"one\")"); + _tmp6_ = gee_collection_add (dummy, "two"); + _vala_assert (_tmp6_, "dummy.add (\"two\")"); + _tmp7_ = gee_iterable_get_element_type ((GeeIterable*) ro_list); + _tmp8_ = _tmp7_; + _vala_assert (_tmp8_ == G_TYPE_STRING, "ro_list.element_type == typeof (string)"); + _tmp9_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp10_ = _tmp9_; + _vala_assert (_tmp10_ == 0, "ro_list.size == 0"); + _tmp11_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp12_ = _tmp11_; + _vala_assert (_tmp12_, "ro_list.is_empty"); + _tmp13_ = gee_collection_contains ((GeeCollection*) ro_list, "one"); + _vala_assert (!_tmp13_, "! ro_list.contains (\"one\")"); + _tmp14_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp14_ == (-1), "ro_list.index_of (\"one\") == -1"); + _tmp15_ = gee_collection_add ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp15_, "test_list.add (\"one\")"); + _tmp16_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "ro_list.size == 1"); + _tmp18_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp19_ = _tmp18_; + _vala_assert (!_tmp19_, "! ro_list.is_empty"); + _tmp20_ = gee_list_get (ro_list, 0); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp22_ == 0, "ro_list.index_of (\"one\") == 0"); + _tmp23_ = gee_list_first (ro_list); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "one") == 0, "ro_list.first () == \"one\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_list_last (ro_list); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "one") == 0, "ro_list.last () == \"one\""); + _g_free0 (_tmp26_); + _tmp27_ = gee_collection_add ((GeeCollection*) test_list, "two"); + _vala_assert (_tmp27_, "test_list.add (\"two\")"); + _tmp28_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp29_ = _tmp28_; + _vala_assert (_tmp29_ == 2, "ro_list.size == 2"); + _tmp30_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp31_ = _tmp30_; + _vala_assert (!_tmp31_, "! ro_list.is_empty"); + _tmp32_ = gee_list_get (ro_list, 0); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "one") == 0, "ro_list.get (0) == \"one\""); + _g_free0 (_tmp33_); + _tmp34_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp34_ == 0, "ro_list.index_of (\"one\") == 0"); + _tmp35_ = gee_list_get (ro_list, 1); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "two") == 0, "ro_list.get (1) == \"two\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_list_index_of (ro_list, "two"); + _vala_assert (_tmp37_ == 1, "ro_list.index_of (\"two\") == 1"); + _tmp38_ = gee_list_first (ro_list); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "one") == 0, "ro_list.first () == \"one\""); + _g_free0 (_tmp39_); + _tmp40_ = gee_list_last (ro_list); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "two") == 0, "ro_list.last () == \"two\""); + _g_free0 (_tmp41_); + _tmp42_ = gee_collection_remove ((GeeCollection*) test_list, "one"); + _vala_assert (_tmp42_, "test_list.remove (\"one\")"); + _tmp43_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "ro_list.size == 1"); + _tmp45_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp46_ = _tmp45_; + _vala_assert (!_tmp46_, "! ro_list.is_empty"); + _tmp47_ = gee_collection_contains ((GeeCollection*) ro_list, "one"); + _vala_assert (!_tmp47_, "! ro_list.contains (\"one\")"); + _tmp48_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp48_ == (-1), "ro_list.index_of (\"one\") == -1"); + _tmp49_ = gee_collection_contains ((GeeCollection*) ro_list, "two"); + _vala_assert (_tmp49_, "ro_list.contains (\"two\")"); + _tmp50_ = gee_list_get (ro_list, 0); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "two") == 0, "ro_list.get (0) == \"two\""); + _g_free0 (_tmp51_); + _tmp52_ = gee_list_index_of (ro_list, "two"); + _vala_assert (_tmp52_ == 0, "ro_list.index_of (\"two\") == 0"); + _tmp53_ = gee_list_first (ro_list); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "two") == 0, "ro_list.first () == \"two\""); + _g_free0 (_tmp54_); + _tmp55_ = gee_list_last (ro_list); + _tmp56_ = (gchar*) _tmp55_; + _vala_assert (g_strcmp0 (_tmp56_, "two") == 0, "ro_list.last () == \"two\""); + _g_free0 (_tmp56_); + gee_collection_clear ((GeeCollection*) test_list); + _tmp57_ = gee_collection_get_size ((GeeCollection*) ro_list); + _tmp58_ = _tmp57_; + _vala_assert (_tmp58_ == 0, "ro_list.size == 0"); + _tmp59_ = gee_collection_get_is_empty ((GeeCollection*) ro_list); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_, "ro_list.is_empty"); + _tmp61_ = gee_list_index_of (ro_list, "one"); + _vala_assert (_tmp61_ == (-1), "ro_list.index_of (\"one\") == -1"); + _tmp62_ = gee_list_index_of (ro_list, "two"); + _vala_assert (_tmp62_ == (-1), "ro_list.index_of (\"two\") == -1"); + _g_object_unref0 (dummy); + _g_object_unref0 (ro_list); + _g_object_unref0 (test_list); +} + + +static void read_only_list_tests_class_init (ReadOnlyListTestsClass * klass) { + read_only_list_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_list_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_list_tests_real_tear_down; + READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_list_tests_real_get_ro_view; +} + + +static void read_only_list_tests_instance_init (ReadOnlyListTests * self) { +} + + +GType read_only_list_tests_get_type (void) { + static volatile gsize read_only_list_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_list_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyListTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_list_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyListTests), 0, (GInstanceInitFunc) read_only_list_tests_instance_init, NULL }; + GType read_only_list_tests_type_id; + read_only_list_tests_type_id = g_type_register_static (TYPE_READ_ONLY_COLLECTION_TESTS, "ReadOnlyListTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_list_tests_type_id__volatile, read_only_list_tests_type_id); + } + return read_only_list_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlylist.vala b/tests/testreadonlylist.vala new file mode 100644 index 0000000..d1b2220 --- /dev/null +++ b/tests/testreadonlylist.vala @@ -0,0 +1,243 @@ +/* testreadonlylist.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl <quikee@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public class ReadOnlyListTests : ReadOnlyCollectionTests { + + public ReadOnlyListTests () { + base.with_name ("ReadOnlyList"); + add_test ("[ReadOnlyList] immutable iterator", test_immutable_iterator); + add_test ("[ReadOnlyList] immutable", test_immutable); + add_test ("[ReadOnlyList] accurate view", test_accurate_view); + } + + public override void set_up () { + test_collection = new ArrayList<string> (); + ro_collection = get_ro_view (test_collection); + } + + public override void tear_down () { + test_collection = null; + ro_collection = null; + } + + protected override Collection<string> get_ro_view (Collection<string> collection) { + return ((Gee.List) collection).read_only_view; + } + + public new void test_immutable_iterator () { + var test_list = test_collection as Gee.List<string>; + var ro_list = ro_collection as Gee.List<string>; + + assert (test_list.add ("one")); + assert (test_list.add ("two")); + + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + + ListIterator<string> iterator = ro_list.list_iterator (); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.index () == 1); + + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + + assert (iterator.last ()); + assert (iterator.get () == "two"); + assert (iterator.index () == 1); + + assert (iterator.first ()); + assert (iterator.get () == "one"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.set ("three"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.insert ("three"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.add ("three"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 2); + assert (ro_list.get (0) == "one"); + assert (ro_list.get (1) == "two"); + assert (iterator.index () == 0); + } + + public new void test_immutable () { + var test_list = test_collection as Gee.List<string>; + var ro_list = ro_collection as Gee.List<string>; + + assert (test_list.add ("one")); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + Collection<string> dummy = new ArrayList<string> (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.set (0, "two"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.insert (1, "two"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.remove_at (1); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.insert_all (1, dummy); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_list.sort (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_list.size == 1); + assert (ro_list.contains ("one")); + } + + public new void test_accurate_view () { + var test_list = test_collection as Gee.List<string>; + var ro_list = ro_collection as Gee.List<string>; + + Collection<string> dummy = new ArrayList<string> (); + assert (dummy.add ("one")); + assert (dummy.add ("two")); + + assert (ro_list.element_type == typeof (string)); + + assert (ro_list.size == 0); + assert (ro_list.is_empty); + assert (! ro_list.contains ("one")); + assert (ro_list.index_of ("one") == -1); + + assert (test_list.add ("one")); + assert (ro_list.size == 1); + assert (! ro_list.is_empty); + assert (ro_list.get (0) == "one"); + assert (ro_list.index_of ("one") == 0); + assert (ro_list.first () == "one"); + assert (ro_list.last () == "one"); + + assert (test_list.add ("two")); + assert (ro_list.size == 2); + assert (! ro_list.is_empty); + assert (ro_list.get (0) == "one"); + assert (ro_list.index_of ("one") == 0); + assert (ro_list.get (1) == "two"); + assert (ro_list.index_of ("two") == 1); + assert (ro_list.first () == "one"); + assert (ro_list.last () == "two"); + + assert (test_list.remove ("one")); + assert (ro_list.size == 1); + assert (! ro_list.is_empty); + assert (! ro_list.contains ("one")); + assert (ro_list.index_of ("one") == -1); + assert (ro_list.contains ("two")); + assert (ro_list.get (0) == "two"); + assert (ro_list.index_of ("two") == 0); + assert (ro_list.first () == "two"); + assert (ro_list.last () == "two"); + + test_list.clear (); + assert (ro_list.size == 0); + assert (ro_list.is_empty); + assert (ro_list.index_of ("one") == -1); + assert (ro_list.index_of ("two") == -1); + } +} diff --git a/tests/testreadonlymap.c b/tests/testreadonlymap.c new file mode 100644 index 0000000..67b82f1 --- /dev/null +++ b/tests/testreadonlymap.c @@ -0,0 +1,825 @@ +/* testreadonlymap.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlymap.vala, do not modify */ + +/* testreadonlymap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_MAP_TESTS (read_only_map_tests_get_type ()) +#define READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTests)) +#define READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) +#define IS_READ_ONLY_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_MAP_TESTS)) +#define IS_READ_ONLY_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_MAP_TESTS)) +#define READ_ONLY_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTestsClass)) + +typedef struct _ReadOnlyMapTests ReadOnlyMapTests; +typedef struct _ReadOnlyMapTestsClass ReadOnlyMapTestsClass; +typedef struct _ReadOnlyMapTestsPrivate ReadOnlyMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyMapTests { + GeeTestCase parent_instance; + ReadOnlyMapTestsPrivate * priv; + GeeMap* test_map; + GeeMap* ro_map; +}; + +struct _ReadOnlyMapTestsClass { + GeeTestCaseClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer read_only_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_map_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_MAP_TESTS_DUMMY_PROPERTY +}; +ReadOnlyMapTests* read_only_map_tests_new (void); +ReadOnlyMapTests* read_only_map_tests_construct (GType object_type); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void read_only_map_tests_test_unique_read_only_view_instance (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self); +void read_only_map_tests_test_immutable_iterator (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self); +void read_only_map_tests_test_immutable (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_immutable_gee_test_case_test_method (gpointer self); +void read_only_map_tests_test_accurate_view (ReadOnlyMapTests* self); +static void _read_only_map_tests_test_accurate_view_gee_test_case_test_method (gpointer self); +static void read_only_map_tests_real_set_up (GeeTestCase* base); +static void read_only_map_tests_real_tear_down (GeeTestCase* base); +static void read_only_map_tests_finalize (GObject* obj); + + +static void _read_only_map_tests_test_unique_read_only_view_instance_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_unique_read_only_view_instance (self); +} + + +static void _read_only_map_tests_test_immutable_iterator_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_immutable_iterator (self); +} + + +static void _read_only_map_tests_test_immutable_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_immutable (self); +} + + +static void _read_only_map_tests_test_accurate_view_gee_test_case_test_method (gpointer self) { + read_only_map_tests_test_accurate_view (self); +} + + +ReadOnlyMapTests* read_only_map_tests_construct (GType object_type) { + ReadOnlyMapTests * self = NULL; + self = (ReadOnlyMapTests*) gee_test_case_construct (object_type, "ReadOnlyMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] unique read-only view instance", _read_only_map_tests_test_unique_read_only_view_instance_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] immutable iterator", _read_only_map_tests_test_immutable_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] immutable", _read_only_map_tests_test_immutable_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[ReadOnlyMap] accurate view", _read_only_map_tests_test_accurate_view_gee_test_case_test_method, self); + return self; +} + + +ReadOnlyMapTests* read_only_map_tests_new (void) { + return read_only_map_tests_construct (TYPE_READ_ONLY_MAP_TESTS); +} + + +static void read_only_map_tests_real_set_up (GeeTestCase* base) { + ReadOnlyMapTests * self; + GeeTreeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + GeeMap* _tmp3_; + self = (ReadOnlyMapTests*) base; + _tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (self->test_map); + self->test_map = (GeeMap*) _tmp0_; + _tmp1_ = self->test_map; + _tmp2_ = gee_map_get_read_only_view (_tmp1_); + _tmp3_ = _tmp2_; + _g_object_unref0 (self->ro_map); + self->ro_map = _tmp3_; +} + + +static void read_only_map_tests_real_tear_down (GeeTestCase* base) { + ReadOnlyMapTests * self; + self = (ReadOnlyMapTests*) base; + _g_object_unref0 (self->test_map); + self->test_map = NULL; + _g_object_unref0 (self->ro_map); + self->ro_map = NULL; +} + + +void read_only_map_tests_test_unique_read_only_view_instance (ReadOnlyMapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + GeeMap* another_ro_map; + GeeMap* _tmp3_; + GeeMap* _tmp4_; + GeeMap* _tmp5_; + GObject* _tmp6_; + GeeMap* _tmp7_; + gconstpointer _tmp8_ = NULL; + GeeMap* _tmp9_; + GeeMap* _tmp10_; + GeeMap* _tmp11_; + GeeMap* _tmp12_; + gconstpointer _tmp13_ = NULL; + GeeMap* _tmp14_; + GeeMap* _tmp15_; + GeeMap* _tmp16_; + GeeMap* _tmp17_; + GeeMap* _tmp18_; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + _tmp1_ = gee_map_get_read_only_view (_tmp0_); + _tmp2_ = _tmp1_; + another_ro_map = _tmp2_; + _tmp3_ = self->ro_map; + _tmp4_ = another_ro_map; + _vala_assert (_tmp3_ == _tmp4_, "ro_map == another_ro_map"); + _tmp5_ = self->ro_map; + _tmp6_ = g_object_new (G_TYPE_OBJECT, NULL); + g_object_set_data_full ((GObject*) _tmp5_, "marker", _tmp6_, g_object_unref); + _tmp7_ = another_ro_map; + _tmp8_ = g_object_get_data ((GObject*) _tmp7_, "marker"); + _vala_assert (((GObject*) _tmp8_) != NULL, "another_ro_map.get_data<Object> (\"marker\") != null"); + _g_object_unref0 (another_ro_map); + another_ro_map = NULL; + _g_object_unref0 (self->ro_map); + self->ro_map = NULL; + _tmp9_ = self->test_map; + _tmp10_ = gee_map_get_read_only_view (_tmp9_); + _tmp11_ = _tmp10_; + _g_object_unref0 (another_ro_map); + another_ro_map = _tmp11_; + _tmp12_ = another_ro_map; + _tmp13_ = g_object_get_data ((GObject*) _tmp12_, "marker"); + _vala_assert (((GObject*) _tmp13_) == NULL, "another_ro_map.get_data<Object> (\"marker\") == null"); + _tmp14_ = another_ro_map; + _tmp15_ = another_ro_map; + _tmp16_ = gee_map_get_read_only_view (_tmp15_); + _tmp17_ = _tmp16_; + _tmp18_ = _tmp17_; + _vala_assert (_tmp14_ == _tmp18_, "another_ro_map == another_ro_map.read_only_view"); + _g_object_unref0 (_tmp18_); + _g_object_unref0 (another_ro_map); +} + + +void read_only_map_tests_test_immutable_iterator (ReadOnlyMapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + GeeMap* _tmp2_; + gint _tmp3_; + gint _tmp4_; + GeeMap* _tmp5_; + gboolean _tmp6_ = FALSE; + GeeMap* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeMap* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeMap* _tmp11_; + gboolean _tmp12_ = FALSE; + GeeMap* _tmp13_; + GeeSet* _tmp14_; + GeeSet* _tmp15_; + GeeSet* _tmp16_; + GeeIterator* _tmp17_ = NULL; + GeeIterator* _tmp18_; + GeeIterator* iterator; + GeeIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeIterator* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeIterator* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + GeeIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeIterator* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeIterator* _tmp30_; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + GeeIterator* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeIterator* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeIterator* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeIterator* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + gboolean _tmp42_ = FALSE; + GeeMap* _tmp44_; + gint _tmp45_; + gint _tmp46_; + GeeMap* _tmp47_; + gboolean _tmp48_ = FALSE; + GeeMap* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeMap* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeMap* _tmp53_; + gboolean _tmp54_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + gee_map_set (_tmp0_, "one", "one"); + _tmp1_ = self->test_map; + gee_map_set (_tmp1_, "two", "two"); + _tmp2_ = self->ro_map; + _tmp3_ = gee_map_get_size (_tmp2_); + _tmp4_ = _tmp3_; + _vala_assert (_tmp4_ == 2, "ro_map.size == 2"); + _tmp5_ = self->ro_map; + _tmp6_ = gee_map_has_key (_tmp5_, "one"); + _vala_assert (_tmp6_, "ro_map.has_key (\"one\")"); + _tmp7_ = self->ro_map; + _tmp8_ = gee_map_has (_tmp7_, "one", "one"); + _vala_assert (_tmp8_, "ro_map.has (\"one\", \"one\")"); + _tmp9_ = self->ro_map; + _tmp10_ = gee_map_has_key (_tmp9_, "two"); + _vala_assert (_tmp10_, "ro_map.has_key (\"two\")"); + _tmp11_ = self->ro_map; + _tmp12_ = gee_map_has (_tmp11_, "two", "two"); + _vala_assert (_tmp12_, "ro_map.has (\"two\", \"two\")"); + _tmp13_ = self->ro_map; + _tmp14_ = gee_map_get_keys (_tmp13_); + _tmp15_ = _tmp14_; + _tmp16_ = _tmp15_; + _tmp17_ = gee_iterable_iterator ((GeeIterable*) _tmp16_); + _tmp18_ = _tmp17_; + _g_object_unref0 (_tmp16_); + iterator = _tmp18_; + _tmp19_ = iterator; + _tmp20_ = gee_iterator_has_next (_tmp19_); + _vala_assert (_tmp20_, "iterator.has_next ()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_next (_tmp21_); + _vala_assert (_tmp22_, "iterator.next ()"); + _tmp23_ = iterator; + _tmp24_ = gee_iterator_get (_tmp23_); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp25_); + _tmp26_ = iterator; + _tmp27_ = gee_iterator_has_next (_tmp26_); + _vala_assert (_tmp27_, "iterator.has_next ()"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_next (_tmp28_); + _vala_assert (_tmp29_, "iterator.next ()"); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_get (_tmp30_); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp32_); + _tmp33_ = iterator; + _tmp34_ = gee_iterator_has_next (_tmp33_); + _vala_assert (!_tmp34_, "! iterator.has_next ()"); + _tmp35_ = iterator; + _tmp36_ = gee_iterator_next (_tmp35_); + _vala_assert (!_tmp36_, "! iterator.next ()"); + _tmp37_ = iterator; + _tmp38_ = gee_iterator_first (_tmp37_); + _vala_assert (_tmp38_, "iterator.first ()"); + _tmp39_ = iterator; + _tmp40_ = gee_iterator_get (_tmp39_); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp41_); + _tmp42_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp42_) { + GeeIterator* _tmp43_; + _tmp43_ = iterator; + gee_iterator_remove (_tmp43_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp44_ = self->ro_map; + _tmp45_ = gee_map_get_size (_tmp44_); + _tmp46_ = _tmp45_; + _vala_assert (_tmp46_ == 2, "ro_map.size == 2"); + _tmp47_ = self->ro_map; + _tmp48_ = gee_map_has_key (_tmp47_, "one"); + _vala_assert (_tmp48_, "ro_map.has_key (\"one\")"); + _tmp49_ = self->ro_map; + _tmp50_ = gee_map_has (_tmp49_, "one", "one"); + _vala_assert (_tmp50_, "ro_map.has (\"one\", \"one\")"); + _tmp51_ = self->ro_map; + _tmp52_ = gee_map_has_key (_tmp51_, "two"); + _vala_assert (_tmp52_, "ro_map.has_key (\"two\")"); + _tmp53_ = self->ro_map; + _tmp54_ = gee_map_has (_tmp53_, "two", "two"); + _vala_assert (_tmp54_, "ro_map.has (\"two\", \"two\")"); + _g_object_unref0 (iterator); +} + + +void read_only_map_tests_test_immutable (ReadOnlyMapTests* self) { + GeeMap* _tmp0_; + GeeMap* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeMap* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeMap* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeHashMap* _tmp8_; + GeeMap* dummy; + GeeMap* _tmp9_; + GeeMap* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeMap* _tmp13_; + gint _tmp14_; + gint _tmp15_; + GeeMap* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeMap* _tmp18_; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + GeeMap* _tmp22_; + gint _tmp23_; + gint _tmp24_; + GeeMap* _tmp25_; + gboolean _tmp26_ = FALSE; + GeeMap* _tmp27_; + gboolean _tmp28_ = FALSE; + gboolean _tmp29_ = FALSE; + GeeMap* _tmp32_; + gint _tmp33_; + gint _tmp34_; + GeeMap* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeMap* _tmp37_; + gboolean _tmp38_ = FALSE; + gboolean _tmp39_ = FALSE; + GeeMap* _tmp42_; + gint _tmp43_; + gint _tmp44_; + GeeMap* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeMap* _tmp47_; + gboolean _tmp48_ = FALSE; + gboolean _tmp49_ = FALSE; + GeeMap* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeMap* _tmp56_; + gboolean _tmp57_ = FALSE; + GeeMap* _tmp58_; + gboolean _tmp59_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = self->test_map; + gee_map_set (_tmp0_, "one", "one"); + _tmp1_ = self->ro_map; + _tmp2_ = gee_map_get_size (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == 1, "ro_map.size == 1"); + _tmp4_ = self->ro_map; + _tmp5_ = gee_map_has_key (_tmp4_, "one"); + _vala_assert (_tmp5_, "ro_map.has_key (\"one\")"); + _tmp6_ = self->ro_map; + _tmp7_ = gee_map_has (_tmp6_, "one", "one"); + _vala_assert (_tmp7_, "ro_map.has (\"one\", \"one\")"); + _tmp8_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); + dummy = (GeeMap*) _tmp8_; + _tmp9_ = dummy; + gee_map_set (_tmp9_, "one", "one"); + _tmp10_ = dummy; + gee_map_set (_tmp10_, "two", "two"); + _tmp11_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp11_) { + GeeMap* _tmp12_; + _tmp12_ = self->ro_map; + gee_map_set (_tmp12_, "two", "two"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp13_ = self->ro_map; + _tmp14_ = gee_map_get_size (_tmp13_); + _tmp15_ = _tmp14_; + _vala_assert (_tmp15_ == 1, "ro_map.size == 1"); + _tmp16_ = self->ro_map; + _tmp17_ = gee_map_has_key (_tmp16_, "one"); + _vala_assert (_tmp17_, "ro_map.has_key (\"one\")"); + _tmp18_ = self->ro_map; + _tmp19_ = gee_map_has (_tmp18_, "one", "one"); + _vala_assert (_tmp19_, "ro_map.has (\"one\", \"one\")"); + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeMap* _tmp21_; + _tmp21_ = self->ro_map; + gee_map_clear (_tmp21_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp22_ = self->ro_map; + _tmp23_ = gee_map_get_size (_tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (_tmp24_ == 1, "ro_map.size == 1"); + _tmp25_ = self->ro_map; + _tmp26_ = gee_map_has_key (_tmp25_, "one"); + _vala_assert (_tmp26_, "ro_map.has_key (\"one\")"); + _tmp27_ = self->ro_map; + _tmp28_ = gee_map_has (_tmp27_, "one", "one"); + _vala_assert (_tmp28_, "ro_map.has (\"one\", \"one\")"); + _tmp29_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp29_) { + GeeMap* _tmp30_; + gboolean _tmp31_ = FALSE; + _tmp30_ = self->ro_map; + _tmp31_ = gee_map_unset (_tmp30_, "one", NULL); + _vala_assert (_tmp31_, "ro_map.unset (\"one\")"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp32_ = self->ro_map; + _tmp33_ = gee_map_get_size (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (_tmp34_ == 1, "ro_map.size == 1"); + _tmp35_ = self->ro_map; + _tmp36_ = gee_map_has_key (_tmp35_, "one"); + _vala_assert (_tmp36_, "ro_map.has_key (\"one\")"); + _tmp37_ = self->ro_map; + _tmp38_ = gee_map_has (_tmp37_, "one", "one"); + _vala_assert (_tmp38_, "ro_map.has (\"one\", \"one\")"); + _tmp39_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp39_) { + GeeMap* _tmp40_; + GeeMap* _tmp41_; + _tmp40_ = self->ro_map; + _tmp41_ = dummy; + gee_map_set_all (_tmp40_, _tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp42_ = self->ro_map; + _tmp43_ = gee_map_get_size (_tmp42_); + _tmp44_ = _tmp43_; + _vala_assert (_tmp44_ == 1, "ro_map.size == 1"); + _tmp45_ = self->ro_map; + _tmp46_ = gee_map_has_key (_tmp45_, "one"); + _vala_assert (_tmp46_, "ro_map.has_key (\"one\")"); + _tmp47_ = self->ro_map; + _tmp48_ = gee_map_has (_tmp47_, "one", "one"); + _vala_assert (_tmp48_, "ro_map.has (\"one\", \"one\")"); + _tmp49_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp49_) { + GeeMap* _tmp50_; + GeeMap* _tmp51_; + gboolean _tmp52_ = FALSE; + _tmp50_ = self->ro_map; + _tmp51_ = dummy; + _tmp52_ = gee_map_unset_all (_tmp50_, _tmp51_); + _vala_assert (_tmp52_, "ro_map.unset_all (dummy)"); + exit (0); + } + g_test_trap_assert_failed (); + _tmp53_ = self->ro_map; + _tmp54_ = gee_map_get_size (_tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 1, "ro_map.size == 1"); + _tmp56_ = self->ro_map; + _tmp57_ = gee_map_has_key (_tmp56_, "one"); + _vala_assert (_tmp57_, "ro_map.has_key (\"one\")"); + _tmp58_ = self->ro_map; + _tmp59_ = gee_map_has (_tmp58_, "one", "one"); + _vala_assert (_tmp59_, "ro_map.has (\"one\", \"one\")"); + _g_object_unref0 (dummy); +} + + +void read_only_map_tests_test_accurate_view (ReadOnlyMapTests* self) { + GeeHashMap* _tmp0_; + GeeMap* dummy; + GeeMap* _tmp1_; + gint _tmp2_; + gint _tmp3_; + GeeMap* _tmp4_; + gboolean _tmp5_; + gboolean _tmp6_; + GeeMap* _tmp7_; + gboolean _tmp8_ = FALSE; + GeeMap* _tmp9_; + gboolean _tmp10_ = FALSE; + GeeMap* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + GeeMap* _tmp14_; + GeeMap* _tmp15_; + gint _tmp16_; + gint _tmp17_; + GeeMap* _tmp18_; + gboolean _tmp19_; + gboolean _tmp20_; + GeeMap* _tmp21_; + gboolean _tmp22_ = FALSE; + GeeMap* _tmp23_; + gboolean _tmp24_ = FALSE; + GeeMap* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + GeeMap* _tmp28_; + GeeMap* _tmp29_; + gint _tmp30_; + gint _tmp31_; + GeeMap* _tmp32_; + gboolean _tmp33_; + gboolean _tmp34_; + GeeMap* _tmp35_; + gboolean _tmp36_ = FALSE; + GeeMap* _tmp37_; + gboolean _tmp38_ = FALSE; + GeeMap* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + GeeMap* _tmp42_; + gboolean _tmp43_ = FALSE; + GeeMap* _tmp44_; + gboolean _tmp45_ = FALSE; + GeeMap* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeMap* _tmp49_; + gboolean _tmp50_ = FALSE; + GeeMap* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeMap* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeMap* _tmp56_; + gboolean _tmp57_; + gboolean _tmp58_; + GeeMap* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeMap* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeMap* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeMap* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeMap* _tmp68_; + gboolean _tmp69_ = FALSE; + GeeMap* _tmp70_; + gpointer _tmp71_ = NULL; + gchar* _tmp72_; + GeeMap* _tmp73_; + gboolean _tmp74_ = FALSE; + GeeMap* _tmp75_; + GeeMap* _tmp76_; + gint _tmp77_; + gint _tmp78_; + GeeMap* _tmp79_; + gboolean _tmp80_; + gboolean _tmp81_; + GeeMap* _tmp82_; + gboolean _tmp83_ = FALSE; + GeeMap* _tmp84_; + gboolean _tmp85_ = FALSE; + GeeMap* _tmp86_; + gpointer _tmp87_ = NULL; + gchar* _tmp88_; + GeeMap* _tmp89_; + gpointer _tmp90_ = NULL; + gchar* _tmp91_; + g_return_if_fail (self != NULL); + _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL); + dummy = (GeeMap*) _tmp0_; + gee_map_set (dummy, "one", "one"); + gee_map_set (dummy, "two", "two"); + _tmp1_ = self->ro_map; + _tmp2_ = gee_map_get_size (_tmp1_); + _tmp3_ = _tmp2_; + _vala_assert (_tmp3_ == 0, "ro_map.size == 0"); + _tmp4_ = self->ro_map; + _tmp5_ = gee_map_get_is_empty (_tmp4_); + _tmp6_ = _tmp5_; + _vala_assert (_tmp6_, "ro_map.is_empty"); + _tmp7_ = self->ro_map; + _tmp8_ = gee_map_has_key (_tmp7_, "one"); + _vala_assert (!_tmp8_, "! ro_map.has_key (\"one\")"); + _tmp9_ = self->ro_map; + _tmp10_ = gee_map_has (_tmp9_, "one", "one"); + _vala_assert (!_tmp10_, "! ro_map.has (\"one\", \"one\")"); + _tmp11_ = self->ro_map; + _tmp12_ = gee_map_get (_tmp11_, "one"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (_tmp13_ == NULL, "ro_map.get (\"one\") == null"); + _g_free0 (_tmp13_); + _tmp14_ = self->test_map; + gee_map_set (_tmp14_, "one", "one"); + _tmp15_ = self->ro_map; + _tmp16_ = gee_map_get_size (_tmp15_); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 1, "ro_map.size == 1"); + _tmp18_ = self->ro_map; + _tmp19_ = gee_map_get_is_empty (_tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (!_tmp20_, "! ro_map.is_empty"); + _tmp21_ = self->ro_map; + _tmp22_ = gee_map_has_key (_tmp21_, "one"); + _vala_assert (_tmp22_, "ro_map.has_key (\"one\")"); + _tmp23_ = self->ro_map; + _tmp24_ = gee_map_has (_tmp23_, "one", "one"); + _vala_assert (_tmp24_, "ro_map.has (\"one\", \"one\")"); + _tmp25_ = self->ro_map; + _tmp26_ = gee_map_get (_tmp25_, "one"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "one") == 0, "ro_map.get (\"one\") == \"one\""); + _g_free0 (_tmp27_); + _tmp28_ = self->test_map; + gee_map_set (_tmp28_, "two", "two"); + _tmp29_ = self->ro_map; + _tmp30_ = gee_map_get_size (_tmp29_); + _tmp31_ = _tmp30_; + _vala_assert (_tmp31_ == 2, "ro_map.size == 2"); + _tmp32_ = self->ro_map; + _tmp33_ = gee_map_get_is_empty (_tmp32_); + _tmp34_ = _tmp33_; + _vala_assert (!_tmp34_, "! ro_map.is_empty"); + _tmp35_ = self->ro_map; + _tmp36_ = gee_map_has_key (_tmp35_, "one"); + _vala_assert (_tmp36_, "ro_map.has_key (\"one\")"); + _tmp37_ = self->ro_map; + _tmp38_ = gee_map_has (_tmp37_, "one", "one"); + _vala_assert (_tmp38_, "ro_map.has (\"one\", \"one\")"); + _tmp39_ = self->ro_map; + _tmp40_ = gee_map_get (_tmp39_, "one"); + _tmp41_ = (gchar*) _tmp40_; + _vala_assert (g_strcmp0 (_tmp41_, "one") == 0, "ro_map.get (\"one\") == \"one\""); + _g_free0 (_tmp41_); + _tmp42_ = self->ro_map; + _tmp43_ = gee_map_has_key (_tmp42_, "two"); + _vala_assert (_tmp43_, "ro_map.has_key (\"two\")"); + _tmp44_ = self->ro_map; + _tmp45_ = gee_map_has (_tmp44_, "two", "two"); + _vala_assert (_tmp45_, "ro_map.has (\"two\", \"two\")"); + _tmp46_ = self->ro_map; + _tmp47_ = gee_map_get (_tmp46_, "two"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "two") == 0, "ro_map.get (\"two\") == \"two\""); + _g_free0 (_tmp48_); + _tmp49_ = self->ro_map; + _tmp50_ = gee_map_has_all (_tmp49_, dummy); + _vala_assert (_tmp50_, "ro_map.has_all (dummy)"); + _tmp51_ = self->test_map; + _tmp52_ = gee_map_unset (_tmp51_, "one", NULL); + _vala_assert (_tmp52_, "test_map.unset (\"one\")"); + _tmp53_ = self->ro_map; + _tmp54_ = gee_map_get_size (_tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 1, "ro_map.size == 1"); + _tmp56_ = self->ro_map; + _tmp57_ = gee_map_get_is_empty (_tmp56_); + _tmp58_ = _tmp57_; + _vala_assert (!_tmp58_, "! ro_map.is_empty"); + _tmp59_ = self->ro_map; + _tmp60_ = gee_map_has_key (_tmp59_, "one"); + _vala_assert (!_tmp60_, "! ro_map.has_key (\"one\")"); + _tmp61_ = self->ro_map; + _tmp62_ = gee_map_has (_tmp61_, "one", "one"); + _vala_assert (!_tmp62_, "! ro_map.has (\"one\", \"one\")"); + _tmp63_ = self->ro_map; + _tmp64_ = gee_map_get (_tmp63_, "one"); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (_tmp65_ == NULL, "ro_map.get (\"one\") == null"); + _g_free0 (_tmp65_); + _tmp66_ = self->ro_map; + _tmp67_ = gee_map_has_key (_tmp66_, "two"); + _vala_assert (_tmp67_, "ro_map.has_key (\"two\")"); + _tmp68_ = self->ro_map; + _tmp69_ = gee_map_has (_tmp68_, "two", "two"); + _vala_assert (_tmp69_, "ro_map.has (\"two\", \"two\")"); + _tmp70_ = self->ro_map; + _tmp71_ = gee_map_get (_tmp70_, "two"); + _tmp72_ = (gchar*) _tmp71_; + _vala_assert (g_strcmp0 (_tmp72_, "two") == 0, "ro_map.get (\"two\") == \"two\""); + _g_free0 (_tmp72_); + _tmp73_ = self->ro_map; + _tmp74_ = gee_map_has_all (_tmp73_, dummy); + _vala_assert (!_tmp74_, "! ro_map.has_all (dummy)"); + _tmp75_ = self->test_map; + gee_map_clear (_tmp75_); + _tmp76_ = self->ro_map; + _tmp77_ = gee_map_get_size (_tmp76_); + _tmp78_ = _tmp77_; + _vala_assert (_tmp78_ == 0, "ro_map.size == 0"); + _tmp79_ = self->ro_map; + _tmp80_ = gee_map_get_is_empty (_tmp79_); + _tmp81_ = _tmp80_; + _vala_assert (_tmp81_, "ro_map.is_empty"); + _tmp82_ = self->ro_map; + _tmp83_ = gee_map_has (_tmp82_, "one", "one"); + _vala_assert (!_tmp83_, "! ro_map.has (\"one\", \"one\")"); + _tmp84_ = self->ro_map; + _tmp85_ = gee_map_has (_tmp84_, "two", "two"); + _vala_assert (!_tmp85_, "! ro_map.has (\"two\", \"two\")"); + _tmp86_ = self->ro_map; + _tmp87_ = gee_map_get (_tmp86_, "one"); + _tmp88_ = (gchar*) _tmp87_; + _vala_assert (_tmp88_ == NULL, "ro_map.get (\"one\") == null"); + _g_free0 (_tmp88_); + _tmp89_ = self->ro_map; + _tmp90_ = gee_map_get (_tmp89_, "two"); + _tmp91_ = (gchar*) _tmp90_; + _vala_assert (_tmp91_ == NULL, "ro_map.get (\"two\") == null"); + _g_free0 (_tmp91_); + _g_object_unref0 (dummy); +} + + +static void read_only_map_tests_class_init (ReadOnlyMapTestsClass * klass) { + read_only_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_map_tests_real_tear_down; + G_OBJECT_CLASS (klass)->finalize = read_only_map_tests_finalize; +} + + +static void read_only_map_tests_instance_init (ReadOnlyMapTests * self) { +} + + +static void read_only_map_tests_finalize (GObject* obj) { + ReadOnlyMapTests * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_READ_ONLY_MAP_TESTS, ReadOnlyMapTests); + _g_object_unref0 (self->test_map); + _g_object_unref0 (self->ro_map); + G_OBJECT_CLASS (read_only_map_tests_parent_class)->finalize (obj); +} + + +GType read_only_map_tests_get_type (void) { + static volatile gsize read_only_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlyMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlyMapTests), 0, (GInstanceInitFunc) read_only_map_tests_instance_init, NULL }; + GType read_only_map_tests_type_id; + read_only_map_tests_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "ReadOnlyMapTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_map_tests_type_id__volatile, read_only_map_tests_type_id); + } + return read_only_map_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlymap.vala b/tests/testreadonlymap.vala new file mode 100644 index 0000000..c32f763 --- /dev/null +++ b/tests/testreadonlymap.vala @@ -0,0 +1,216 @@ +/* testreadonlymap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public class ReadOnlyMapTests : Gee.TestCase { + + public ReadOnlyMapTests () { + base ("ReadOnlyMap"); + add_test ("[ReadOnlyMap] unique read-only view instance", + test_unique_read_only_view_instance); + add_test ("[ReadOnlyMap] immutable iterator", test_immutable_iterator); + add_test ("[ReadOnlyMap] immutable", test_immutable); + add_test ("[ReadOnlyMap] accurate view", test_accurate_view); + } + + protected Map<string,string> test_map; + protected Map<string,string> ro_map; + + public override void set_up () { + test_map = new TreeMap<string,string> (); + ro_map = test_map.read_only_view; + } + + public override void tear_down () { + test_map = null; + ro_map = null; + } + + public void test_unique_read_only_view_instance () { + var another_ro_map = test_map.read_only_view; + assert (ro_map == another_ro_map); + + ro_map.set_data ("marker", new Object ()); + assert (another_ro_map.get_data<Object> ("marker") != null); + + another_ro_map = null; + ro_map = null; + + another_ro_map = test_map.read_only_view; + assert (another_ro_map.get_data<Object> ("marker") == null); + + // Check that the read-only view of the view is itself + assert (another_ro_map == another_ro_map.read_only_view); + } + + public void test_immutable_iterator () { + test_map.set ("one", "one"); + test_map.set ("two", "two"); + + assert (ro_map.size == 2); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + + Iterator<string> iterator = ro_map.keys.iterator (); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "one"); + + assert (iterator.has_next ()); + assert (iterator.next ()); + assert (iterator.get () == "two"); + + assert (! iterator.has_next ()); + assert (! iterator.next ()); + + assert (iterator.first ()); + assert (iterator.get () == "one"); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (ro_map.size == 2); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + } + + public void test_immutable () { + test_map.set ("one", "one"); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + Map<string,string> dummy = new HashMap<string,string> (); + dummy.set ("one", "one"); + dummy.set ("two", "two"); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_map.set ("two", "two"); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_map.clear (); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_map.unset ("one")); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + ro_map.set_all (dummy); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + assert (ro_map.unset_all (dummy)); + Posix.exit (0); + } + Test.trap_assert_failed (); + assert (ro_map.size == 1); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + } + + public void test_accurate_view () { + Map<string,string> dummy = new HashMap<string,string> (); + dummy.set ("one", "one"); + dummy.set ("two", "two"); + + assert (ro_map.size == 0); + assert (ro_map.is_empty); + assert (! ro_map.has_key ("one")); + assert (! ro_map.has ("one", "one")); + assert (ro_map.get ("one") == null); + + test_map.set ("one", "one"); + assert (ro_map.size == 1); + assert (! ro_map.is_empty); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.get ("one") == "one"); + + test_map.set ("two", "two"); + assert (ro_map.size == 2); + assert (! ro_map.is_empty); + assert (ro_map.has_key ("one")); + assert (ro_map.has ("one", "one")); + assert (ro_map.get ("one") == "one"); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + assert (ro_map.get ("two") == "two"); + assert (ro_map.has_all (dummy)); + + assert (test_map.unset ("one")); + assert (ro_map.size == 1); + assert (! ro_map.is_empty); + assert (! ro_map.has_key ("one")); + assert (! ro_map.has ("one", "one")); + assert (ro_map.get ("one") == null); + assert (ro_map.has_key ("two")); + assert (ro_map.has ("two", "two")); + assert (ro_map.get ("two") == "two"); + assert (! ro_map.has_all (dummy)); + + test_map.clear (); + assert (ro_map.size == 0); + assert (ro_map.is_empty); + assert (! ro_map.has ("one", "one")); + assert (! ro_map.has ("two", "two")); + assert (ro_map.get ("one") == null); + assert (ro_map.get ("two") == null); + } +} diff --git a/tests/testreadonlyset.c b/tests/testreadonlyset.c new file mode 100644 index 0000000..fe8d420 --- /dev/null +++ b/tests/testreadonlyset.c @@ -0,0 +1,198 @@ +/* testreadonlyset.c generated by valac 0.18.0, the Vala compiler + * generated from testreadonlyset.vala, do not modify */ + +/* testreadonlyset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl <quikee@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_READ_ONLY_COLLECTION_TESTS (read_only_collection_tests_get_type ()) +#define READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTests)) +#define READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) +#define IS_READ_ONLY_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define IS_READ_ONLY_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_COLLECTION_TESTS)) +#define READ_ONLY_COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_COLLECTION_TESTS, ReadOnlyCollectionTestsClass)) + +typedef struct _ReadOnlyCollectionTests ReadOnlyCollectionTests; +typedef struct _ReadOnlyCollectionTestsClass ReadOnlyCollectionTestsClass; +typedef struct _ReadOnlyCollectionTestsPrivate ReadOnlyCollectionTestsPrivate; + +#define TYPE_READ_ONLY_SET_TESTS (read_only_set_tests_get_type ()) +#define READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTests)) +#define READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) +#define IS_READ_ONLY_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_READ_ONLY_SET_TESTS)) +#define IS_READ_ONLY_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_READ_ONLY_SET_TESTS)) +#define READ_ONLY_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_READ_ONLY_SET_TESTS, ReadOnlySetTestsClass)) + +typedef struct _ReadOnlySetTests ReadOnlySetTests; +typedef struct _ReadOnlySetTestsClass ReadOnlySetTestsClass; +typedef struct _ReadOnlySetTestsPrivate ReadOnlySetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _ReadOnlyCollectionTests { + GeeTestCase parent_instance; + ReadOnlyCollectionTestsPrivate * priv; + GeeCollection* test_collection; + GeeCollection* ro_collection; +}; + +struct _ReadOnlyCollectionTestsClass { + GeeTestCaseClass parent_class; + GeeCollection* (*get_ro_view) (ReadOnlyCollectionTests* self, GeeCollection* collection); +}; + +struct _ReadOnlySetTests { + ReadOnlyCollectionTests parent_instance; + ReadOnlySetTestsPrivate * priv; +}; + +struct _ReadOnlySetTestsClass { + ReadOnlyCollectionTestsClass parent_class; +}; + + +static gpointer read_only_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType read_only_collection_tests_get_type (void) G_GNUC_CONST; +GType read_only_set_tests_get_type (void) G_GNUC_CONST; +enum { + READ_ONLY_SET_TESTS_DUMMY_PROPERTY +}; +ReadOnlySetTests* read_only_set_tests_new (void); +ReadOnlySetTests* read_only_set_tests_construct (GType object_type); +ReadOnlyCollectionTests* read_only_collection_tests_new_with_name (const gchar* name); +ReadOnlyCollectionTests* read_only_collection_tests_construct_with_name (GType object_type, const gchar* name); +static void read_only_set_tests_real_set_up (GeeTestCase* base); +GeeCollection* read_only_collection_tests_get_ro_view (ReadOnlyCollectionTests* self, GeeCollection* collection); +static void read_only_set_tests_real_tear_down (GeeTestCase* base); +static GeeCollection* read_only_set_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection); + + +ReadOnlySetTests* read_only_set_tests_construct (GType object_type) { + ReadOnlySetTests * self = NULL; + self = (ReadOnlySetTests*) read_only_collection_tests_construct_with_name (object_type, "ReadOnlySet"); + return self; +} + + +ReadOnlySetTests* read_only_set_tests_new (void) { + return read_only_set_tests_construct (TYPE_READ_ONLY_SET_TESTS); +} + + +static void read_only_set_tests_real_set_up (GeeTestCase* base) { + ReadOnlySetTests * self; + GeeHashSet* _tmp0_; + GeeCollection* _tmp1_; + GeeCollection* _tmp2_ = NULL; + self = (ReadOnlySetTests*) base; + _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; + _tmp1_ = ((ReadOnlyCollectionTests*) self)->test_collection; + _tmp2_ = read_only_collection_tests_get_ro_view ((ReadOnlyCollectionTests*) self, _tmp1_); + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = _tmp2_; +} + + +static void read_only_set_tests_real_tear_down (GeeTestCase* base) { + ReadOnlySetTests * self; + self = (ReadOnlySetTests*) base; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->test_collection); + ((ReadOnlyCollectionTests*) self)->test_collection = NULL; + _g_object_unref0 (((ReadOnlyCollectionTests*) self)->ro_collection); + ((ReadOnlyCollectionTests*) self)->ro_collection = NULL; +} + + +static GeeCollection* read_only_set_tests_real_get_ro_view (ReadOnlyCollectionTests* base, GeeCollection* collection) { + ReadOnlySetTests * self; + GeeCollection* result = NULL; + GeeCollection* _tmp0_; + GeeSet* _tmp1_; + GeeSet* _tmp2_; + self = (ReadOnlySetTests*) base; + g_return_val_if_fail (collection != NULL, NULL); + _tmp0_ = collection; + _tmp1_ = gee_set_get_read_only_view (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_SET, GeeSet)); + _tmp2_ = _tmp1_; + result = (GeeCollection*) _tmp2_; + return result; +} + + +static void read_only_set_tests_class_init (ReadOnlySetTestsClass * klass) { + read_only_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = read_only_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = read_only_set_tests_real_tear_down; + READ_ONLY_COLLECTION_TESTS_CLASS (klass)->get_ro_view = read_only_set_tests_real_get_ro_view; +} + + +static void read_only_set_tests_instance_init (ReadOnlySetTests * self) { +} + + +GType read_only_set_tests_get_type (void) { + static volatile gsize read_only_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&read_only_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (ReadOnlySetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) read_only_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ReadOnlySetTests), 0, (GInstanceInitFunc) read_only_set_tests_instance_init, NULL }; + GType read_only_set_tests_type_id; + read_only_set_tests_type_id = g_type_register_static (TYPE_READ_ONLY_COLLECTION_TESTS, "ReadOnlySetTests", &g_define_type_info, 0); + g_once_init_leave (&read_only_set_tests_type_id__volatile, read_only_set_tests_type_id); + } + return read_only_set_tests_type_id__volatile; +} + + + diff --git a/tests/testreadonlyset.vala b/tests/testreadonlyset.vala new file mode 100644 index 0000000..a573cda --- /dev/null +++ b/tests/testreadonlyset.vala @@ -0,0 +1,46 @@ +/* testreadonlyset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Tomaž Vajngerl <quikee@gmail.com> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class ReadOnlySetTests : ReadOnlyCollectionTests { + + public ReadOnlySetTests () { + base.with_name ("ReadOnlySet"); + } + + public override void set_up () { + test_collection = new HashSet<string> (); + ro_collection = get_ro_view (test_collection); + } + + public override void tear_down () { + test_collection = null; + ro_collection = null; + } + + protected override Collection<string> get_ro_view (Collection<string> collection) { + return ((Gee.Set) collection).read_only_view; + } +} diff --git a/tests/tests.vala.stamp b/tests/tests.vala.stamp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/tests.vala.stamp diff --git a/tests/testset.c b/tests/testset.c new file mode 100644 index 0000000..2b29b70 --- /dev/null +++ b/tests/testset.c @@ -0,0 +1,225 @@ +/* testset.c generated by valac 0.18.0, the Vala compiler + * generated from testset.vala, do not modify */ + +/* testset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +enum { + SET_TESTS_DUMMY_PROPERTY +}; +SetTests* set_tests_construct (GType object_type, const gchar* name); +CollectionTests* collection_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void set_tests_test_duplicates_are_ignored (SetTests* self); +static void _set_tests_test_duplicates_are_ignored_gee_test_case_test_method (gpointer self); +static void set_tests_real_test_duplicates_are_ignored (SetTests* self); + + +static void _set_tests_test_duplicates_are_ignored_gee_test_case_test_method (gpointer self) { + set_tests_test_duplicates_are_ignored (self); +} + + +SetTests* set_tests_construct (GType object_type, const gchar* name) { + SetTests * self = NULL; + const gchar* _tmp0_; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (SetTests*) collection_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[Set] duplicates are ignored", _set_tests_test_duplicates_are_ignored_gee_test_case_test_method, self); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void set_tests_real_test_duplicates_are_ignored (SetTests* self) { + GeeCollection* _tmp0_; + GeeSet* _tmp1_; + GeeSet* test_set; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gint _tmp4_; + gint _tmp5_; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gint _tmp8_; + gint _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_ = FALSE; + gint _tmp12_; + gint _tmp13_; + gboolean _tmp14_ = FALSE; + gboolean _tmp15_ = FALSE; + gint _tmp16_; + gint _tmp17_; + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SET) ? ((GeeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + _tmp2_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp2_, "test_set.add (\"one\")"); + _tmp3_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp3_, "test_set.contains (\"one\")"); + _tmp4_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 1, "test_set.size == 1"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp6_, "! test_set.add (\"one\")"); + _tmp7_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp7_, "test_set.contains (\"one\")"); + _tmp8_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp9_ = _tmp8_; + _vala_assert (_tmp9_ == 1, "test_set.size == 1"); + _tmp10_ = gee_collection_remove ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp10_, "test_set.remove (\"one\")"); + _tmp11_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp11_, "! test_set.contains (\"one\")"); + _tmp12_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp13_ = _tmp12_; + _vala_assert (_tmp13_ == 0, "test_set.size == 0"); + _tmp14_ = gee_collection_remove ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp14_, "! test_set.remove (\"one\")"); + _tmp15_ = gee_collection_contains ((GeeCollection*) test_set, "one"); + _vala_assert (!_tmp15_, "! test_set.contains (\"one\")"); + _tmp16_ = gee_collection_get_size ((GeeCollection*) test_set); + _tmp17_ = _tmp16_; + _vala_assert (_tmp17_ == 0, "test_set.size == 0"); + _g_object_unref0 (test_set); +} + + +void set_tests_test_duplicates_are_ignored (SetTests* self) { + g_return_if_fail (self != NULL); + SET_TESTS_GET_CLASS (self)->test_duplicates_are_ignored (self); +} + + +static void set_tests_class_init (SetTestsClass * klass) { + set_tests_parent_class = g_type_class_peek_parent (klass); + SET_TESTS_CLASS (klass)->test_duplicates_are_ignored = set_tests_real_test_duplicates_are_ignored; +} + + +static void set_tests_instance_init (SetTests * self) { +} + + +GType set_tests_get_type (void) { + static volatile gsize set_tests_type_id__volatile = 0; + if (g_once_init_enter (&set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SetTests), 0, (GInstanceInitFunc) set_tests_instance_init, NULL }; + GType set_tests_type_id; + set_tests_type_id = g_type_register_static (TYPE_COLLECTION_TESTS, "SetTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&set_tests_type_id__volatile, set_tests_type_id); + } + return set_tests_type_id__volatile; +} + + + diff --git a/tests/testset.vala b/tests/testset.vala new file mode 100644 index 0000000..e2fc83f --- /dev/null +++ b/tests/testset.vala @@ -0,0 +1,58 @@ +/* testset.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using GLib; +using Gee; + +public abstract class SetTests : CollectionTests { + + public SetTests (string name) { + base (name); + add_test ("[Set] duplicates are ignored", test_duplicates_are_ignored); + } + + public virtual void test_duplicates_are_ignored () { + var test_set = test_collection as Set<string>; + + // Check the test list is not null + assert (test_set != null); + + assert (test_set.add ("one")); + assert (test_set.contains ("one")); + assert (test_set.size == 1); + + assert (! test_set.add ("one")); + assert (test_set.contains ("one")); + assert (test_set.size == 1); + + assert (test_set.remove ("one")); + assert (! test_set.contains ("one")); + assert (test_set.size == 0); + + assert (! test_set.remove ("one")); + assert (! test_set.contains ("one")); + assert (test_set.size == 0); + } +} diff --git a/tests/testsortedset.c b/tests/testsortedset.c new file mode 100644 index 0000000..5b09260 --- /dev/null +++ b/tests/testsortedset.c @@ -0,0 +1,4740 @@ +/* testsortedset.c generated by valac 0.18.0, the Vala compiler + * generated from testsortedset.vala, do not modify */ + +/* testsortedset.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka <uzytkownik2@gmail.com> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; + +#define TYPE_SORTED_SET_TESTS (sorted_set_tests_get_type ()) +#define SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SORTED_SET_TESTS, SortedSetTests)) +#define SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) +#define IS_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SORTED_SET_TESTS)) +#define IS_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SORTED_SET_TESTS)) +#define SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) + +typedef struct _SortedSetTests SortedSetTests; +typedef struct _SortedSetTestsClass SortedSetTestsClass; +typedef struct _SortedSetTestsPrivate SortedSetTestsPrivate; + +#define SORTED_SET_TESTS_SUB_SET_TYPE_TYPE (sorted_set_tests_sub_set_type_get_type ()) + +#define SORTED_SET_TESTS_TYPE_SUB_SET (sorted_set_tests_sub_set_get_type ()) +#define SORTED_SET_TESTS_SUB_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSet)) +#define SORTED_SET_TESTS_SUB_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSetClass)) +#define SORTED_SET_TESTS_IS_SUB_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SORTED_SET_TESTS_TYPE_SUB_SET)) +#define SORTED_SET_TESTS_IS_SUB_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SORTED_SET_TESTS_TYPE_SUB_SET)) +#define SORTED_SET_TESTS_SUB_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSetClass)) + +typedef struct _SortedSetTestsSubSet SortedSetTestsSubSet; +typedef struct _SortedSetTestsSubSetClass SortedSetTestsSubSetClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +typedef struct _SortedSetTestsSubSetPrivate SortedSetTestsSubSetPrivate; +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +struct _SortedSetTests { + SetTests parent_instance; + SortedSetTestsPrivate * priv; +}; + +struct _SortedSetTestsClass { + SetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); +typedef enum { + SORTED_SET_TESTS_SUB_SET_TYPE_HEAD, + SORTED_SET_TESTS_SUB_SET_TYPE_TAIL, + SORTED_SET_TESTS_SUB_SET_TYPE_SUB, + SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY +} SortedSetTestsSubSetType; + +struct _SortedSetTestsSubSet { + GeeTestCase parent_instance; + SortedSetTestsSubSetPrivate * priv; +}; + +struct _SortedSetTestsSubSetClass { + GeeTestCaseClass parent_class; +}; + +struct _SortedSetTestsSubSetPrivate { + GeeSortedSet* master; + GeeSortedSet* subset; + SortedSetTests* test; + SortedSetTestsSubSetType type; +}; + + +static gpointer sorted_set_tests_parent_class = NULL; +static gpointer sorted_set_tests_sub_set_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +GType sorted_set_tests_get_type (void) G_GNUC_CONST; +enum { + SORTED_SET_TESTS_DUMMY_PROPERTY +}; +SortedSetTests* sorted_set_tests_construct (GType object_type, const gchar* name); +SetTests* set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void sorted_set_tests_test_first (SortedSetTests* self); +static void _sorted_set_tests_test_first_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_last (SortedSetTests* self); +static void _sorted_set_tests_test_last_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_ordering (SortedSetTests* self); +static void _sorted_set_tests_test_ordering_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_iterator_at (SortedSetTests* self); +static void _sorted_set_tests_test_iterator_at_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_lower (SortedSetTests* self); +static void _sorted_set_tests_test_lower_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_higher (SortedSetTests* self); +static void _sorted_set_tests_test_higher_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_floor (SortedSetTests* self); +static void _sorted_set_tests_test_floor_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_ceil (SortedSetTests* self); +static void _sorted_set_tests_test_ceil_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_bidir_iterator_can_go_backward (SortedSetTests* self); +static void _sorted_set_tests_test_bidir_iterator_can_go_backward_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_mutable_bidir_iterator (SortedSetTests* self); +static void _sorted_set_tests_test_mutable_bidir_iterator_gee_test_case_test_method (gpointer self); +void sorted_set_tests_test_bidir_iterator_last (SortedSetTests* self); +static void _sorted_set_tests_test_bidir_iterator_last_gee_test_case_test_method (gpointer self); +GTestSuite* gee_test_case_get_suite (GeeTestCase* self); +GType sorted_set_tests_sub_set_type_get_type (void) G_GNUC_CONST; +SortedSetTestsSubSet* sorted_set_tests_sub_set_new (SortedSetTests* test, SortedSetTestsSubSetType type); +SortedSetTestsSubSet* sorted_set_tests_sub_set_construct (GType object_type, SortedSetTests* test, SortedSetTestsSubSetType type); +GType sorted_set_tests_sub_set_get_type (void) G_GNUC_CONST; +#define SORTED_SET_TESTS_SUB_SET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSetPrivate)) +enum { + SORTED_SET_TESTS_SUB_SET_DUMMY_PROPERTY +}; +const gchar* sorted_set_tests_sub_set_type_to_string (SortedSetTestsSubSetType self); +GeeTestCase* gee_test_case_construct (GType object_type, const gchar* name); +void sorted_set_tests_sub_set_test_size (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_size_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_contains (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_contains_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_add (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_add_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_remove (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_remove_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_iterator (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_iterator_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_clear (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_clear_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_iterator_at (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_iterator_at_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_lower (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_lower_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_higher (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_higher_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_ceil (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_ceil_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_floor (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_floor_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_subsets (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_subsets_gee_test_case_test_method (gpointer self); +void sorted_set_tests_sub_set_test_boundaries (SortedSetTestsSubSet* self); +static void _sorted_set_tests_sub_set_test_boundaries_gee_test_case_test_method (gpointer self); +static void sorted_set_tests_sub_set_real_set_up (GeeTestCase* base); +void gee_test_case_set_up (GeeTestCase* self); +static void sorted_set_tests_sub_set_real_tear_down (GeeTestCase* base); +void gee_test_case_tear_down (GeeTestCase* self); +static void sorted_set_tests_sub_set_finalize (GObject* obj); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _sorted_set_tests_test_first_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_first (self); +} + + +static void _sorted_set_tests_test_last_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_last (self); +} + + +static void _sorted_set_tests_test_ordering_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_ordering (self); +} + + +static void _sorted_set_tests_test_iterator_at_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_iterator_at (self); +} + + +static void _sorted_set_tests_test_lower_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_lower (self); +} + + +static void _sorted_set_tests_test_higher_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_higher (self); +} + + +static void _sorted_set_tests_test_floor_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_floor (self); +} + + +static void _sorted_set_tests_test_ceil_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_ceil (self); +} + + +static void _sorted_set_tests_test_bidir_iterator_can_go_backward_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_bidir_iterator_can_go_backward (self); +} + + +static void _sorted_set_tests_test_mutable_bidir_iterator_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_mutable_bidir_iterator (self); +} + + +static void _sorted_set_tests_test_bidir_iterator_last_gee_test_case_test_method (gpointer self) { + sorted_set_tests_test_bidir_iterator_last (self); +} + + +SortedSetTests* sorted_set_tests_construct (GType object_type, const gchar* name) { + SortedSetTests * self = NULL; + const gchar* _tmp0_; + GTestSuite* _tmp1_ = NULL; + SortedSetTestsSubSet* _tmp2_; + SortedSetTestsSubSet* _tmp3_; + GTestSuite* _tmp4_ = NULL; + GTestSuite* _tmp5_ = NULL; + SortedSetTestsSubSet* _tmp6_; + SortedSetTestsSubSet* _tmp7_; + GTestSuite* _tmp8_ = NULL; + GTestSuite* _tmp9_ = NULL; + SortedSetTestsSubSet* _tmp10_; + SortedSetTestsSubSet* _tmp11_; + GTestSuite* _tmp12_ = NULL; + GTestSuite* _tmp13_ = NULL; + SortedSetTestsSubSet* _tmp14_; + SortedSetTestsSubSet* _tmp15_; + GTestSuite* _tmp16_ = NULL; + g_return_val_if_fail (name != NULL, NULL); + _tmp0_ = name; + self = (SortedSetTests*) set_tests_construct (object_type, _tmp0_); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] first", _sorted_set_tests_test_first_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] last", _sorted_set_tests_test_last_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] ordering", _sorted_set_tests_test_ordering_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] iterator at", _sorted_set_tests_test_iterator_at_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] lower", _sorted_set_tests_test_lower_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] higher", _sorted_set_tests_test_higher_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] floor", _sorted_set_tests_test_floor_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] ceil", _sorted_set_tests_test_ceil_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] bi-directional iterators can go backward", _sorted_set_tests_test_bidir_iterator_can_go_backward_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] bi-directional iterators are mutable", _sorted_set_tests_test_mutable_bidir_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] bi-directional iterators can to end", _sorted_set_tests_test_bidir_iterator_last_gee_test_case_test_method, self); + _tmp1_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp2_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_HEAD); + _tmp3_ = _tmp2_; + _tmp4_ = gee_test_case_get_suite ((GeeTestCase*) _tmp3_); + g_test_suite_add_suite (_tmp1_, _tmp4_); + _g_object_unref0 (_tmp3_); + _tmp5_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp6_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_TAIL); + _tmp7_ = _tmp6_; + _tmp8_ = gee_test_case_get_suite ((GeeTestCase*) _tmp7_); + g_test_suite_add_suite (_tmp5_, _tmp8_); + _g_object_unref0 (_tmp7_); + _tmp9_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp10_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_SUB); + _tmp11_ = _tmp10_; + _tmp12_ = gee_test_case_get_suite ((GeeTestCase*) _tmp11_); + g_test_suite_add_suite (_tmp9_, _tmp12_); + _g_object_unref0 (_tmp11_); + _tmp13_ = gee_test_case_get_suite ((GeeTestCase*) self); + _tmp14_ = sorted_set_tests_sub_set_new (self, SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY); + _tmp15_ = _tmp14_; + _tmp16_ = gee_test_case_get_suite ((GeeTestCase*) _tmp15_); + g_test_suite_add_suite (_tmp13_, _tmp16_); + _g_object_unref0 (_tmp15_); + return self; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void sorted_set_tests_test_ordering (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeIterator* _tmp2_ = NULL; + GeeIterator* iterator; + gboolean _tmp3_ = FALSE; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + gboolean _tmp6_ = FALSE; + gpointer _tmp7_ = NULL; + gchar* _tmp8_; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gboolean _tmp12_ = FALSE; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + gboolean _tmp15_ = FALSE; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gboolean _tmp18_ = FALSE; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + gboolean _tmp21_ = FALSE; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gboolean _tmp24_ = FALSE; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + gboolean _tmp27_ = FALSE; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + gboolean _tmp30_ = FALSE; + gpointer _tmp31_ = NULL; + gchar* _tmp32_; + gboolean _tmp33_ = FALSE; + gpointer _tmp34_ = NULL; + gchar* _tmp35_; + gboolean _tmp36_ = FALSE; + gpointer _tmp37_ = NULL; + gchar* _tmp38_; + gboolean _tmp39_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + gee_collection_add ((GeeCollection*) test_set, "one"); + gee_collection_add ((GeeCollection*) test_set, "two"); + gee_collection_add ((GeeCollection*) test_set, "three"); + gee_collection_add ((GeeCollection*) test_set, "four"); + gee_collection_add ((GeeCollection*) test_set, "five"); + gee_collection_add ((GeeCollection*) test_set, "six"); + gee_collection_add ((GeeCollection*) test_set, "seven"); + gee_collection_add ((GeeCollection*) test_set, "eight"); + gee_collection_add ((GeeCollection*) test_set, "nine"); + gee_collection_add ((GeeCollection*) test_set, "ten"); + gee_collection_add ((GeeCollection*) test_set, "eleven"); + gee_collection_add ((GeeCollection*) test_set, "twelve"); + _tmp2_ = gee_iterable_iterator ((GeeIterable*) test_set); + iterator = _tmp2_; + _tmp3_ = gee_iterator_next (iterator); + _vala_assert (_tmp3_, "iterator.next ()"); + _tmp4_ = gee_iterator_get (iterator); + _tmp5_ = (gchar*) _tmp4_; + _vala_assert (g_strcmp0 (_tmp5_, "eight") == 0, "iterator.get () == \"eight\""); + _g_free0 (_tmp5_); + _tmp6_ = gee_iterator_next (iterator); + _vala_assert (_tmp6_, "iterator.next ()"); + _tmp7_ = gee_iterator_get (iterator); + _tmp8_ = (gchar*) _tmp7_; + _vala_assert (g_strcmp0 (_tmp8_, "eleven") == 0, "iterator.get () == \"eleven\""); + _g_free0 (_tmp8_); + _tmp9_ = gee_iterator_next (iterator); + _vala_assert (_tmp9_, "iterator.next ()"); + _tmp10_ = gee_iterator_get (iterator); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_iterator_next (iterator); + _vala_assert (_tmp12_, "iterator.next ()"); + _tmp13_ = gee_iterator_get (iterator); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp14_); + _tmp15_ = gee_iterator_next (iterator); + _vala_assert (_tmp15_, "iterator.next ()"); + _tmp16_ = gee_iterator_get (iterator); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "nine") == 0, "iterator.get () == \"nine\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_iterator_next (iterator); + _vala_assert (_tmp18_, "iterator.next ()"); + _tmp19_ = gee_iterator_get (iterator); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp20_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp20_); + _tmp21_ = gee_iterator_next (iterator); + _vala_assert (_tmp21_, "iterator.next ()"); + _tmp22_ = gee_iterator_get (iterator); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "seven") == 0, "iterator.get () == \"seven\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_iterator_next (iterator); + _vala_assert (_tmp24_, "iterator.next ()"); + _tmp25_ = gee_iterator_get (iterator); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp26_); + _tmp27_ = gee_iterator_next (iterator); + _vala_assert (_tmp27_, "iterator.next ()"); + _tmp28_ = gee_iterator_get (iterator); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "ten") == 0, "iterator.get () == \"ten\""); + _g_free0 (_tmp29_); + _tmp30_ = gee_iterator_next (iterator); + _vala_assert (_tmp30_, "iterator.next ()"); + _tmp31_ = gee_iterator_get (iterator); + _tmp32_ = (gchar*) _tmp31_; + _vala_assert (g_strcmp0 (_tmp32_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp32_); + _tmp33_ = gee_iterator_next (iterator); + _vala_assert (_tmp33_, "iterator.next ()"); + _tmp34_ = gee_iterator_get (iterator); + _tmp35_ = (gchar*) _tmp34_; + _vala_assert (g_strcmp0 (_tmp35_, "twelve") == 0, "iterator.get () == \"twelve\""); + _g_free0 (_tmp35_); + _tmp36_ = gee_iterator_next (iterator); + _vala_assert (_tmp36_, "iterator.next ()"); + _tmp37_ = gee_iterator_get (iterator); + _tmp38_ = (gchar*) _tmp37_; + _vala_assert (g_strcmp0 (_tmp38_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp38_); + _tmp39_ = gee_iterator_next (iterator); + _vala_assert (_tmp39_ == FALSE, "iterator.next () == false"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_first (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gboolean _tmp2_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp2_) { + GeeSortedSet* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + _tmp3_ = test_set; + _tmp4_ = gee_sorted_set_first (_tmp3_); + _tmp5_ = (gchar*) _tmp4_; + _g_free0 (_tmp5_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp6_ = test_set; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_set.add (\"one\")"); + _tmp8_ = test_set; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_set.add (\"two\")"); + _tmp10_ = test_set; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "test_set.add (\"three\")"); + _tmp12_ = test_set; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "test_set.add (\"four\")"); + _tmp14_ = test_set; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "test_set.add (\"five\")"); + _tmp16_ = test_set; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "test_set.add (\"six\")"); + _tmp18_ = test_set; + _tmp19_ = gee_sorted_set_first (_tmp18_); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp20_, "five") == 0, "test_set.first () == \"five\""); + _g_free0 (_tmp20_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_last (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gboolean _tmp2_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + gpointer _tmp19_ = NULL; + gchar* _tmp20_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp2_) { + GeeSortedSet* _tmp3_; + gpointer _tmp4_ = NULL; + gchar* _tmp5_; + _tmp3_ = test_set; + _tmp4_ = gee_sorted_set_last (_tmp3_); + _tmp5_ = (gchar*) _tmp4_; + _g_free0 (_tmp5_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp6_ = test_set; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_set.add (\"one\")"); + _tmp8_ = test_set; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_set.add (\"two\")"); + _tmp10_ = test_set; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "test_set.add (\"three\")"); + _tmp12_ = test_set; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "test_set.add (\"four\")"); + _tmp14_ = test_set; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "test_set.add (\"five\")"); + _tmp16_ = test_set; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "test_set.add (\"six\")"); + _tmp18_ = test_set; + _tmp19_ = gee_sorted_set_last (_tmp18_); + _tmp20_ = (gchar*) _tmp19_; + _vala_assert (g_strcmp0 (_tmp20_, "two") == 0, "test_set.last () == \"two\""); + _g_free0 (_tmp20_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_iterator_at (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gboolean _tmp2_ = FALSE; + gboolean _tmp3_ = FALSE; + gboolean _tmp4_ = FALSE; + GeeBidirIterator* _tmp5_ = NULL; + GeeBidirIterator* iter; + GeeBidirIterator* _tmp6_; + GeeBidirIterator* _tmp7_; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + GeeBidirIterator* _tmp10_ = NULL; + GeeBidirIterator* _tmp11_; + GeeBidirIterator* _tmp12_; + gpointer _tmp13_ = NULL; + gchar* _tmp14_; + GeeBidirIterator* _tmp15_ = NULL; + GeeBidirIterator* _tmp16_; + GeeBidirIterator* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + GeeBidirIterator* _tmp20_ = NULL; + GeeBidirIterator* _tmp21_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp2_, "test_set.add (\"one\")"); + _tmp3_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp3_, "test_set.add (\"two\")"); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp4_, "test_set.add (\"three\")"); + _tmp5_ = gee_sorted_set_iterator_at (test_set, "one"); + iter = _tmp5_; + _tmp6_ = iter; + _vala_assert (_tmp6_ != NULL, "iter != null"); + _tmp7_ = iter; + _tmp8_ = gee_iterator_get ((GeeIterator*) _tmp7_); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "one") == 0, "iter.get () == \"one\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_sorted_set_iterator_at (test_set, "two"); + _g_object_unref0 (iter); + iter = _tmp10_; + _tmp11_ = iter; + _vala_assert (_tmp11_ != NULL, "iter != null"); + _tmp12_ = iter; + _tmp13_ = gee_iterator_get ((GeeIterator*) _tmp12_); + _tmp14_ = (gchar*) _tmp13_; + _vala_assert (g_strcmp0 (_tmp14_, "two") == 0, "iter.get () == \"two\""); + _g_free0 (_tmp14_); + _tmp15_ = gee_sorted_set_iterator_at (test_set, "three"); + _g_object_unref0 (iter); + iter = _tmp15_; + _tmp16_ = iter; + _vala_assert (_tmp16_ != NULL, "iter != null"); + _tmp17_ = iter; + _tmp18_ = gee_iterator_get ((GeeIterator*) _tmp17_); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "three") == 0, "iter.get () == \"three\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_iterator_at (test_set, "zero"); + _g_object_unref0 (iter); + iter = _tmp20_; + _tmp21_ = iter; + _vala_assert (_tmp21_ == NULL, "iter == null"); + _g_object_unref0 (iter); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_lower (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_lower (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.lower (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_lower (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "four") == 0, "test_set.lower (\"one\") == \"four\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_lower (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "four") == 0, "test_set.lower (\"o\") == \"four\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_lower (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "three") == 0, "test_set.lower (\"two\") == \"three\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_lower (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_set.lower (\"t\") == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_lower (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "six") == 0, "test_set.lower (\"three\") == \"six\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_lower (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "five") == 0, "test_set.lower (\"four\") == \"five\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_lower (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (_tmp23_ == NULL, "test_set.lower (\"f\") == null"); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_lower (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (_tmp25_ == NULL, "test_set.lower (\"five\") == null"); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_lower (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "one") == 0, "test_set.lower (\"six\") == \"one\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_lower (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "test_set.lower (\"s\") == \"one\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_higher (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_higher (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.higher (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_higher (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "six") == 0, "test_set.higher (\"one\") == \"six\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_higher (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_set.higher (\"o\") == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_higher (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (_tmp15_ == NULL, "test_set.higher (\"two\") == null"); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_higher (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "three") == 0, "test_set.higher (\"t\") == \"three\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_higher (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "two") == 0, "test_set.higher (\"three\") == \"two\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_higher (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "one") == 0, "test_set.higher (\"four\") == \"one\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_higher (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "five") == 0, "test_set.higher (\"f\") == \"five\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_higher (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "four") == 0, "test_set.higher (\"five\") == \"four\""); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_higher (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "three") == 0, "test_set.higher (\"six\") == \"three\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_higher (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "six") == 0, "test_set.higher (\"s\") == \"six\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_floor (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_floor (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.floor (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_floor (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_set.floor (\"one\") == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_floor (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "four") == 0, "test_set.floor (\"o\") == \"four\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_floor (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "two") == 0, "test_set.floor (\"two\") == \"two\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_floor (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "six") == 0, "test_set.floor (\"t\") == \"six\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_floor (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "three") == 0, "test_set.floor (\"three\") == \"three\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_floor (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "test_set.floor (\"four\") == \"four\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_floor (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (_tmp23_ == NULL, "test_set.floor (\"f\") == null"); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_floor (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "five") == 0, "test_set.floor (\"five\") == \"five\""); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_floor (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "six") == 0, "test_set.floor (\"six\") == \"six\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_floor (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "one") == 0, "test_set.floor (\"s\") == \"one\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_ceil (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + gpointer _tmp2_ = NULL; + gchar* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gpointer _tmp10_ = NULL; + gchar* _tmp11_; + gpointer _tmp12_ = NULL; + gchar* _tmp13_; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gpointer _tmp16_ = NULL; + gchar* _tmp17_; + gpointer _tmp18_ = NULL; + gchar* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + gpointer _tmp24_ = NULL; + gchar* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gpointer _tmp28_ = NULL; + gchar* _tmp29_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_ceil (test_set, "one"); + _tmp3_ = (gchar*) _tmp2_; + _vala_assert (_tmp3_ == NULL, "test_set.ceil (\"one\") == null"); + _g_free0 (_tmp3_); + _tmp4_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp4_, "test_set.add (\"one\")"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp5_, "test_set.add (\"two\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp6_, "test_set.add (\"three\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp7_, "test_set.add (\"four\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp8_, "test_set.add (\"five\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp9_, "test_set.add (\"six\")"); + _tmp10_ = gee_sorted_set_ceil (test_set, "one"); + _tmp11_ = (gchar*) _tmp10_; + _vala_assert (g_strcmp0 (_tmp11_, "one") == 0, "test_set.ceil (\"one\") == \"one\""); + _g_free0 (_tmp11_); + _tmp12_ = gee_sorted_set_ceil (test_set, "o"); + _tmp13_ = (gchar*) _tmp12_; + _vala_assert (g_strcmp0 (_tmp13_, "one") == 0, "test_set.ceil (\"o\") == \"one\""); + _g_free0 (_tmp13_); + _tmp14_ = gee_sorted_set_ceil (test_set, "two"); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "two") == 0, "test_set.ceil (\"two\") == \"two\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_sorted_set_ceil (test_set, "t"); + _tmp17_ = (gchar*) _tmp16_; + _vala_assert (g_strcmp0 (_tmp17_, "three") == 0, "test_set.ceil (\"t\") == \"three\""); + _g_free0 (_tmp17_); + _tmp18_ = gee_sorted_set_ceil (test_set, "three"); + _tmp19_ = (gchar*) _tmp18_; + _vala_assert (g_strcmp0 (_tmp19_, "three") == 0, "test_set.ceil (\"three\") == \"three\""); + _g_free0 (_tmp19_); + _tmp20_ = gee_sorted_set_ceil (test_set, "four"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "test_set.ceil (\"four\") == \"four\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_sorted_set_ceil (test_set, "f"); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "five") == 0, "test_set.ceil (\"f\") == \"five\""); + _g_free0 (_tmp23_); + _tmp24_ = gee_sorted_set_ceil (test_set, "five"); + _tmp25_ = (gchar*) _tmp24_; + _vala_assert (g_strcmp0 (_tmp25_, "five") == 0, "test_set.ceil (\"five\") == \"five\""); + _g_free0 (_tmp25_); + _tmp26_ = gee_sorted_set_ceil (test_set, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "six") == 0, "test_set.ceil (\"six\") == \"six\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_sorted_set_ceil (test_set, "s"); + _tmp29_ = (gchar*) _tmp28_; + _vala_assert (g_strcmp0 (_tmp29_, "six") == 0, "test_set.ceil (\"s\") == \"six\""); + _g_free0 (_tmp29_); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_bidir_iterator_can_go_backward (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeBidirIterator* _tmp2_ = NULL; + GeeBidirIterator* iterator; + GeeBidirIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gboolean _tmp10_ = FALSE; + GeeBidirIterator* _tmp11_ = NULL; + GeeBidirIterator* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeBidirIterator* _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + GeeBidirIterator* _tmp17_; + gboolean _tmp18_ = FALSE; + GeeBidirIterator* _tmp19_; + gboolean _tmp20_ = FALSE; + GeeBidirIterator* _tmp21_; + gpointer _tmp22_ = NULL; + gchar* _tmp23_; + GeeBidirIterator* _tmp24_; + gboolean _tmp25_ = FALSE; + GeeBidirIterator* _tmp26_; + gboolean _tmp27_ = FALSE; + GeeBidirIterator* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeBidirIterator* _tmp31_; + gboolean _tmp32_ = FALSE; + GeeBidirIterator* _tmp33_; + gboolean _tmp34_ = FALSE; + GeeBidirIterator* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + GeeBidirIterator* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeBidirIterator* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeBidirIterator* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + GeeBidirIterator* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeBidirIterator* _tmp47_; + gboolean _tmp48_ = FALSE; + GeeBidirIterator* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeBidirIterator* _tmp52_; + gboolean _tmp53_ = FALSE; + GeeBidirIterator* _tmp54_; + gboolean _tmp55_ = FALSE; + GeeBidirIterator* _tmp56_; + gboolean _tmp57_ = FALSE; + GeeBidirIterator* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + GeeBidirIterator* _tmp61_; + gboolean _tmp62_ = FALSE; + GeeBidirIterator* _tmp63_; + gpointer _tmp64_ = NULL; + gchar* _tmp65_; + GeeBidirIterator* _tmp66_; + gboolean _tmp67_ = FALSE; + GeeBidirIterator* _tmp68_; + gpointer _tmp69_ = NULL; + gchar* _tmp70_; + GeeBidirIterator* _tmp71_; + gboolean _tmp72_ = FALSE; + GeeBidirIterator* _tmp73_; + gpointer _tmp74_ = NULL; + gchar* _tmp75_; + GeeBidirIterator* _tmp76_; + gboolean _tmp77_ = FALSE; + GeeBidirIterator* _tmp78_; + gpointer _tmp79_ = NULL; + gchar* _tmp80_; + GeeBidirIterator* _tmp81_; + gboolean _tmp82_ = FALSE; + GeeBidirIterator* _tmp83_; + gpointer _tmp84_ = NULL; + gchar* _tmp85_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_bidir_iterator (test_set); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_bidir_iterator_has_previous (_tmp3_); + _vala_assert (!_tmp4_, "!iterator.has_previous ()"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp5_, "test_set.add (\"one\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp6_, "test_set.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp7_, "test_set.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp8_, "test_set.add (\"four\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp9_, "test_set.add (\"five\")"); + _tmp10_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp10_, "test_set.add (\"six\")"); + _tmp11_ = gee_sorted_set_bidir_iterator (test_set); + _g_object_unref0 (iterator); + iterator = _tmp11_; + _tmp12_ = iterator; + _tmp13_ = gee_iterator_next ((GeeIterator*) _tmp12_); + _vala_assert (_tmp13_, "iterator.next ()"); + _tmp14_ = iterator; + _tmp15_ = gee_iterator_get ((GeeIterator*) _tmp14_); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp16_); + _tmp17_ = iterator; + _tmp18_ = gee_bidir_iterator_has_previous (_tmp17_); + _vala_assert (!_tmp18_, "!iterator.has_previous ()"); + _tmp19_ = iterator; + _tmp20_ = gee_iterator_next ((GeeIterator*) _tmp19_); + _vala_assert (_tmp20_, "iterator.next ()"); + _tmp21_ = iterator; + _tmp22_ = gee_iterator_get ((GeeIterator*) _tmp21_); + _tmp23_ = (gchar*) _tmp22_; + _vala_assert (g_strcmp0 (_tmp23_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp23_); + _tmp24_ = iterator; + _tmp25_ = gee_bidir_iterator_has_previous (_tmp24_); + _vala_assert (_tmp25_, "iterator.has_previous ()"); + _tmp26_ = iterator; + _tmp27_ = gee_iterator_next ((GeeIterator*) _tmp26_); + _vala_assert (_tmp27_, "iterator.next ()"); + _tmp28_ = iterator; + _tmp29_ = gee_iterator_get ((GeeIterator*) _tmp28_); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp30_); + _tmp31_ = iterator; + _tmp32_ = gee_bidir_iterator_has_previous (_tmp31_); + _vala_assert (_tmp32_, "iterator.has_previous ()"); + _tmp33_ = iterator; + _tmp34_ = gee_iterator_next ((GeeIterator*) _tmp33_); + _vala_assert (_tmp34_, "iterator.next ()"); + _tmp35_ = iterator; + _tmp36_ = gee_iterator_get ((GeeIterator*) _tmp35_); + _tmp37_ = (gchar*) _tmp36_; + _vala_assert (g_strcmp0 (_tmp37_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp37_); + _tmp38_ = iterator; + _tmp39_ = gee_bidir_iterator_has_previous (_tmp38_); + _vala_assert (_tmp39_, "iterator.has_previous ()"); + _tmp40_ = iterator; + _tmp41_ = gee_iterator_next ((GeeIterator*) _tmp40_); + _vala_assert (_tmp41_, "iterator.next ()"); + _tmp42_ = iterator; + _tmp43_ = gee_iterator_get ((GeeIterator*) _tmp42_); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp44_); + _tmp45_ = iterator; + _tmp46_ = gee_bidir_iterator_has_previous (_tmp45_); + _vala_assert (_tmp46_, "iterator.has_previous ()"); + _tmp47_ = iterator; + _tmp48_ = gee_iterator_next ((GeeIterator*) _tmp47_); + _vala_assert (_tmp48_, "iterator.next ()"); + _tmp49_ = iterator; + _tmp50_ = gee_iterator_get ((GeeIterator*) _tmp49_); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp51_); + _tmp52_ = iterator; + _tmp53_ = gee_bidir_iterator_has_previous (_tmp52_); + _vala_assert (_tmp53_, "iterator.has_previous ()"); + _tmp54_ = iterator; + _tmp55_ = gee_iterator_next ((GeeIterator*) _tmp54_); + _vala_assert (!_tmp55_, "!iterator.next ()"); + _tmp56_ = iterator; + _tmp57_ = gee_bidir_iterator_previous (_tmp56_); + _vala_assert (_tmp57_, "iterator.previous ()"); + _tmp58_ = iterator; + _tmp59_ = gee_iterator_get ((GeeIterator*) _tmp58_); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (g_strcmp0 (_tmp60_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp60_); + _tmp61_ = iterator; + _tmp62_ = gee_bidir_iterator_previous (_tmp61_); + _vala_assert (_tmp62_, "iterator.previous ()"); + _tmp63_ = iterator; + _tmp64_ = gee_iterator_get ((GeeIterator*) _tmp63_); + _tmp65_ = (gchar*) _tmp64_; + _vala_assert (g_strcmp0 (_tmp65_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp65_); + _tmp66_ = iterator; + _tmp67_ = gee_bidir_iterator_previous (_tmp66_); + _vala_assert (_tmp67_, "iterator.previous ()"); + _tmp68_ = iterator; + _tmp69_ = gee_iterator_get ((GeeIterator*) _tmp68_); + _tmp70_ = (gchar*) _tmp69_; + _vala_assert (g_strcmp0 (_tmp70_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp70_); + _tmp71_ = iterator; + _tmp72_ = gee_bidir_iterator_previous (_tmp71_); + _vala_assert (_tmp72_, "iterator.previous ()"); + _tmp73_ = iterator; + _tmp74_ = gee_iterator_get ((GeeIterator*) _tmp73_); + _tmp75_ = (gchar*) _tmp74_; + _vala_assert (g_strcmp0 (_tmp75_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp75_); + _tmp76_ = iterator; + _tmp77_ = gee_bidir_iterator_previous (_tmp76_); + _vala_assert (_tmp77_, "iterator.previous ()"); + _tmp78_ = iterator; + _tmp79_ = gee_iterator_get ((GeeIterator*) _tmp78_); + _tmp80_ = (gchar*) _tmp79_; + _vala_assert (g_strcmp0 (_tmp80_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp80_); + _tmp81_ = iterator; + _tmp82_ = gee_bidir_iterator_previous (_tmp81_); + _vala_assert (!_tmp82_, "!iterator.previous ()"); + _tmp83_ = iterator; + _tmp84_ = gee_iterator_get ((GeeIterator*) _tmp83_); + _tmp85_ = (gchar*) _tmp84_; + _vala_assert (g_strcmp0 (_tmp85_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp85_); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_bidir_iterator_last (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeBidirIterator* _tmp2_ = NULL; + GeeBidirIterator* iterator; + GeeBidirIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp5_ = FALSE; + gboolean _tmp6_ = FALSE; + gboolean _tmp7_ = FALSE; + gboolean _tmp8_ = FALSE; + gboolean _tmp9_ = FALSE; + gboolean _tmp10_ = FALSE; + GeeBidirIterator* _tmp11_ = NULL; + GeeBidirIterator* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeBidirIterator* _tmp14_; + gpointer _tmp15_ = NULL; + gchar* _tmp16_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = gee_sorted_set_bidir_iterator (test_set); + iterator = _tmp2_; + _tmp3_ = iterator; + _tmp4_ = gee_bidir_iterator_last (_tmp3_); + _vala_assert (!_tmp4_, "!iterator.last ()"); + _tmp5_ = gee_collection_add ((GeeCollection*) test_set, "one"); + _vala_assert (_tmp5_, "test_set.add (\"one\")"); + _tmp6_ = gee_collection_add ((GeeCollection*) test_set, "two"); + _vala_assert (_tmp6_, "test_set.add (\"two\")"); + _tmp7_ = gee_collection_add ((GeeCollection*) test_set, "three"); + _vala_assert (_tmp7_, "test_set.add (\"three\")"); + _tmp8_ = gee_collection_add ((GeeCollection*) test_set, "four"); + _vala_assert (_tmp8_, "test_set.add (\"four\")"); + _tmp9_ = gee_collection_add ((GeeCollection*) test_set, "five"); + _vala_assert (_tmp9_, "test_set.add (\"five\")"); + _tmp10_ = gee_collection_add ((GeeCollection*) test_set, "six"); + _vala_assert (_tmp10_, "test_set.add (\"six\")"); + _tmp11_ = gee_sorted_set_bidir_iterator (test_set); + _g_object_unref0 (iterator); + iterator = _tmp11_; + _tmp12_ = iterator; + _tmp13_ = gee_bidir_iterator_last (_tmp12_); + _vala_assert (_tmp13_, "iterator.last ()"); + _tmp14_ = iterator; + _tmp15_ = gee_iterator_get ((GeeIterator*) _tmp14_); + _tmp16_ = (gchar*) _tmp15_; + _vala_assert (g_strcmp0 (_tmp16_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp16_); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +void sorted_set_tests_test_mutable_bidir_iterator (SortedSetTests* self) { + GeeCollection* _tmp0_; + GeeSortedSet* _tmp1_; + GeeSortedSet* test_set; + GeeSortedSet* _tmp2_; + GeeBidirIterator* _tmp3_ = NULL; + GeeBidirIterator* iterator; + GeeBidirIterator* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + GeeBidirIterator* _tmp19_ = NULL; + gboolean _tmp20_ = FALSE; + GeeBidirIterator* _tmp22_; + gboolean _tmp23_ = FALSE; + GeeBidirIterator* _tmp24_; + gpointer _tmp25_ = NULL; + gchar* _tmp26_; + GeeBidirIterator* _tmp27_; + GeeSortedSet* _tmp28_; + gboolean _tmp29_ = FALSE; + GeeBidirIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeBidirIterator* _tmp32_; + gboolean _tmp33_ = FALSE; + gboolean _tmp34_ = FALSE; + GeeBidirIterator* _tmp38_; + gboolean _tmp39_ = FALSE; + GeeBidirIterator* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeBidirIterator* _tmp42_; + gpointer _tmp43_ = NULL; + gchar* _tmp44_; + GeeBidirIterator* _tmp45_; + gboolean _tmp46_ = FALSE; + GeeBidirIterator* _tmp47_; + gpointer _tmp48_ = NULL; + gchar* _tmp49_; + GeeBidirIterator* _tmp50_; + GeeSortedSet* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeBidirIterator* _tmp53_; + gboolean _tmp54_ = FALSE; + GeeBidirIterator* _tmp55_; + gboolean _tmp56_ = FALSE; + GeeBidirIterator* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeBidirIterator* _tmp59_; + gpointer _tmp60_ = NULL; + gchar* _tmp61_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = test_set; + _tmp3_ = gee_sorted_set_bidir_iterator (_tmp2_); + iterator = _tmp3_; + _tmp4_ = iterator; + _tmp5_ = gee_bidir_iterator_has_previous (_tmp4_); + _vala_assert (!_tmp5_, "!iterator.has_previous ()"); + _tmp6_ = test_set; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "test_set.add (\"one\")"); + _tmp8_ = test_set; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "test_set.add (\"two\")"); + _tmp10_ = test_set; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "test_set.add (\"three\")"); + _tmp12_ = test_set; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "test_set.add (\"four\")"); + _tmp14_ = test_set; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "test_set.add (\"five\")"); + _tmp16_ = test_set; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "test_set.add (\"six\")"); + _tmp18_ = test_set; + _tmp19_ = gee_sorted_set_bidir_iterator (_tmp18_); + _g_object_unref0 (iterator); + iterator = _tmp19_; + _tmp20_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp20_) { + GeeBidirIterator* _tmp21_; + _tmp21_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp21_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp22_ = iterator; + _tmp23_ = gee_iterator_next ((GeeIterator*) _tmp22_); + _vala_assert (_tmp23_, "iterator.next ()"); + _tmp24_ = iterator; + _tmp25_ = gee_iterator_get ((GeeIterator*) _tmp24_); + _tmp26_ = (gchar*) _tmp25_; + _vala_assert (g_strcmp0 (_tmp26_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp26_); + _tmp27_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp27_); + _tmp28_ = test_set; + _tmp29_ = gee_collection_contains ((GeeCollection*) _tmp28_, "five"); + _vala_assert (!_tmp29_, "!test_set.contains (\"five\")"); + _tmp30_ = iterator; + _tmp31_ = gee_iterator_has_next ((GeeIterator*) _tmp30_); + _vala_assert (_tmp31_, "iterator.has_next ()"); + _tmp32_ = iterator; + _tmp33_ = gee_bidir_iterator_has_previous (_tmp32_); + _vala_assert (!_tmp33_, "!iterator.has_previous ()"); + _tmp34_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp34_) { + GeeBidirIterator* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + _tmp35_ = iterator; + _tmp36_ = gee_iterator_get ((GeeIterator*) _tmp35_); + _tmp37_ = (gchar*) _tmp36_; + _g_free0 (_tmp37_); + exit (0); + } + _tmp38_ = iterator; + _tmp39_ = gee_bidir_iterator_previous (_tmp38_); + _vala_assert (!_tmp39_, "!iterator.previous ()"); + _tmp40_ = iterator; + _tmp41_ = gee_iterator_next ((GeeIterator*) _tmp40_); + _vala_assert (_tmp41_, "iterator.next ()"); + _tmp42_ = iterator; + _tmp43_ = gee_iterator_get ((GeeIterator*) _tmp42_); + _tmp44_ = (gchar*) _tmp43_; + _vala_assert (g_strcmp0 (_tmp44_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp44_); + _tmp45_ = iterator; + _tmp46_ = gee_iterator_next ((GeeIterator*) _tmp45_); + _vala_assert (_tmp46_, "iterator.next ()"); + _tmp47_ = iterator; + _tmp48_ = gee_iterator_get ((GeeIterator*) _tmp47_); + _tmp49_ = (gchar*) _tmp48_; + _vala_assert (g_strcmp0 (_tmp49_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp49_); + _tmp50_ = iterator; + gee_iterator_remove ((GeeIterator*) _tmp50_); + _tmp51_ = test_set; + _tmp52_ = gee_collection_contains ((GeeCollection*) _tmp51_, "one"); + _vala_assert (!_tmp52_, "!test_set.contains (\"one\")"); + _tmp53_ = iterator; + _tmp54_ = gee_iterator_has_next ((GeeIterator*) _tmp53_); + _vala_assert (_tmp54_, "iterator.has_next ()"); + _tmp55_ = iterator; + _tmp56_ = gee_bidir_iterator_has_previous (_tmp55_); + _vala_assert (_tmp56_, "iterator.has_previous ()"); + _tmp57_ = iterator; + _tmp58_ = gee_bidir_iterator_previous (_tmp57_); + _vala_assert (_tmp58_, "iterator.previous ()"); + _tmp59_ = iterator; + _tmp60_ = gee_iterator_get ((GeeIterator*) _tmp59_); + _tmp61_ = (gchar*) _tmp60_; + _vala_assert (g_strcmp0 (_tmp61_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp61_); + _g_object_unref0 (iterator); + _g_object_unref0 (test_set); +} + + +const gchar* sorted_set_tests_sub_set_type_to_string (SortedSetTestsSubSetType self) { + const gchar* result = NULL; + switch (self) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + result = "Head"; + return result; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + result = "Tail"; + return result; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + result = "Range"; + return result; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + result = "Empty"; + return result; + } + default: + { + g_assert_not_reached (); + } + } +} + + +GType sorted_set_tests_sub_set_type_get_type (void) { + static volatile gsize sorted_set_tests_sub_set_type_type_id__volatile = 0; + if (g_once_init_enter (&sorted_set_tests_sub_set_type_type_id__volatile)) { + static const GEnumValue values[] = {{SORTED_SET_TESTS_SUB_SET_TYPE_HEAD, "SORTED_SET_TESTS_SUB_SET_TYPE_HEAD", "head"}, {SORTED_SET_TESTS_SUB_SET_TYPE_TAIL, "SORTED_SET_TESTS_SUB_SET_TYPE_TAIL", "tail"}, {SORTED_SET_TESTS_SUB_SET_TYPE_SUB, "SORTED_SET_TESTS_SUB_SET_TYPE_SUB", "sub"}, {SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY, "SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY", "empty"}, {0, NULL, NULL}}; + GType sorted_set_tests_sub_set_type_type_id; + sorted_set_tests_sub_set_type_type_id = g_enum_register_static ("SortedSetTestsSubSetType", values); + g_once_init_leave (&sorted_set_tests_sub_set_type_type_id__volatile, sorted_set_tests_sub_set_type_type_id); + } + return sorted_set_tests_sub_set_type_type_id__volatile; +} + + +static void _sorted_set_tests_sub_set_test_size_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_size (self); +} + + +static void _sorted_set_tests_sub_set_test_contains_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_contains (self); +} + + +static void _sorted_set_tests_sub_set_test_add_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_add (self); +} + + +static void _sorted_set_tests_sub_set_test_remove_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_remove (self); +} + + +static void _sorted_set_tests_sub_set_test_iterator_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_iterator (self); +} + + +static void _sorted_set_tests_sub_set_test_clear_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_clear (self); +} + + +static void _sorted_set_tests_sub_set_test_iterator_at_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_iterator_at (self); +} + + +static void _sorted_set_tests_sub_set_test_lower_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_lower (self); +} + + +static void _sorted_set_tests_sub_set_test_higher_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_higher (self); +} + + +static void _sorted_set_tests_sub_set_test_ceil_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_ceil (self); +} + + +static void _sorted_set_tests_sub_set_test_floor_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_floor (self); +} + + +static void _sorted_set_tests_sub_set_test_subsets_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_subsets (self); +} + + +static void _sorted_set_tests_sub_set_test_boundaries_gee_test_case_test_method (gpointer self) { + sorted_set_tests_sub_set_test_boundaries (self); +} + + +SortedSetTestsSubSet* sorted_set_tests_sub_set_construct (GType object_type, SortedSetTests* test, SortedSetTestsSubSetType type) { + SortedSetTestsSubSet * self = NULL; + SortedSetTestsSubSetType _tmp0_; + const gchar* _tmp1_ = NULL; + gchar* _tmp2_ = NULL; + gchar* _tmp3_; + SortedSetTests* _tmp4_; + SortedSetTests* _tmp5_; + SortedSetTestsSubSetType _tmp6_; + g_return_val_if_fail (test != NULL, NULL); + _tmp0_ = type; + _tmp1_ = sorted_set_tests_sub_set_type_to_string (_tmp0_); + _tmp2_ = g_strdup_printf ("%s Subset", _tmp1_); + _tmp3_ = _tmp2_; + self = (SortedSetTestsSubSet*) gee_test_case_construct (object_type, _tmp3_); + _g_free0 (_tmp3_); + _tmp4_ = test; + _tmp5_ = _g_object_ref0 (_tmp4_); + _g_object_unref0 (self->priv->test); + self->priv->test = _tmp5_; + _tmp6_ = type; + self->priv->type = _tmp6_; + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] size", _sorted_set_tests_sub_set_test_size_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] contains", _sorted_set_tests_sub_set_test_contains_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] add", _sorted_set_tests_sub_set_test_add_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] remove", _sorted_set_tests_sub_set_test_remove_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] iterator", _sorted_set_tests_sub_set_test_iterator_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[Collection] clear", _sorted_set_tests_sub_set_test_clear_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] iterator at", _sorted_set_tests_sub_set_test_iterator_at_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] lower", _sorted_set_tests_sub_set_test_lower_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] higher", _sorted_set_tests_sub_set_test_higher_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] ceil", _sorted_set_tests_sub_set_test_ceil_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] floor", _sorted_set_tests_sub_set_test_floor_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] subsets", _sorted_set_tests_sub_set_test_subsets_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[SortedSet] boundaries", _sorted_set_tests_sub_set_test_boundaries_gee_test_case_test_method, self); + return self; +} + + +SortedSetTestsSubSet* sorted_set_tests_sub_set_new (SortedSetTests* test, SortedSetTestsSubSetType type) { + return sorted_set_tests_sub_set_construct (SORTED_SET_TESTS_TYPE_SUB_SET, test, type); +} + + +static void sorted_set_tests_sub_set_real_set_up (GeeTestCase* base) { + SortedSetTestsSubSet * self; + SortedSetTests* _tmp0_; + SortedSetTests* _tmp1_; + GeeCollection* _tmp2_; + GeeSortedSet* _tmp3_; + SortedSetTestsSubSetType _tmp4_; + self = (SortedSetTestsSubSet*) base; + _tmp0_ = self->priv->test; + gee_test_case_set_up ((GeeTestCase*) _tmp0_); + _tmp1_ = self->priv->test; + _tmp2_ = ((CollectionTests*) _tmp1_)->test_collection; + _tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GEE_TYPE_SORTED_SET) ? ((GeeSortedSet*) _tmp2_) : NULL); + _g_object_unref0 (self->priv->master); + self->priv->master = _tmp3_; + _tmp4_ = self->priv->type; + switch (_tmp4_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp5_; + GeeSortedSet* _tmp6_ = NULL; + _tmp5_ = self->priv->master; + _tmp6_ = gee_sorted_set_head_set (_tmp5_, "one"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp6_; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp7_; + GeeSortedSet* _tmp8_ = NULL; + _tmp7_ = self->priv->master; + _tmp8_ = gee_sorted_set_tail_set (_tmp7_, "six"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp8_; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp9_; + GeeSortedSet* _tmp10_ = NULL; + _tmp9_ = self->priv->master; + _tmp10_ = gee_sorted_set_sub_set (_tmp9_, "four", "three"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp10_; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp11_; + GeeSortedSet* _tmp12_ = NULL; + _tmp11_ = self->priv->master; + _tmp12_ = gee_sorted_set_sub_set (_tmp11_, "three", "four"); + _g_object_unref0 (self->priv->subset); + self->priv->subset = _tmp12_; + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static void sorted_set_tests_sub_set_real_tear_down (GeeTestCase* base) { + SortedSetTestsSubSet * self; + SortedSetTests* _tmp0_; + self = (SortedSetTestsSubSet*) base; + _tmp0_ = self->priv->test; + gee_test_case_tear_down ((GeeTestCase*) _tmp0_); +} + + +void sorted_set_tests_sub_set_test_size (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_; + gboolean _tmp2_; + GeeSortedSet* _tmp3_; + gint _tmp4_; + gint _tmp5_; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gboolean _tmp13_ = FALSE; + GeeSortedSet* _tmp14_; + gboolean _tmp15_ = FALSE; + GeeSortedSet* _tmp16_; + gboolean _tmp17_ = FALSE; + GeeSortedSet* _tmp18_; + gint _tmp19_; + gint _tmp20_; + SortedSetTestsSubSetType _tmp21_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->subset; + _tmp1_ = gee_collection_get_is_empty ((GeeCollection*) _tmp0_); + _tmp2_ = _tmp1_; + _vala_assert (_tmp2_, "subset.is_empty"); + _tmp3_ = self->priv->subset; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _vala_assert (_tmp5_ == 0, "subset.size == 0"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "one"); + _vala_assert (_tmp7_, "master.add (\"one\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "two"); + _vala_assert (_tmp9_, "master.add (\"two\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "three"); + _vala_assert (_tmp11_, "master.add (\"three\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_add ((GeeCollection*) _tmp12_, "four"); + _vala_assert (_tmp13_, "master.add (\"four\")"); + _tmp14_ = self->priv->master; + _tmp15_ = gee_collection_add ((GeeCollection*) _tmp14_, "five"); + _vala_assert (_tmp15_, "master.add (\"five\")"); + _tmp16_ = self->priv->master; + _tmp17_ = gee_collection_add ((GeeCollection*) _tmp16_, "six"); + _vala_assert (_tmp17_, "master.add (\"six\")"); + _tmp18_ = self->priv->master; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 6, "master.size == 6"); + _tmp21_ = self->priv->type; + switch (_tmp21_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp22_; + gboolean _tmp23_; + gboolean _tmp24_; + GeeSortedSet* _tmp25_; + gint _tmp26_; + gint _tmp27_; + _tmp22_ = self->priv->subset; + _tmp23_ = gee_collection_get_is_empty ((GeeCollection*) _tmp22_); + _tmp24_ = _tmp23_; + _vala_assert (!_tmp24_, "!subset.is_empty"); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_collection_get_size ((GeeCollection*) _tmp25_); + _tmp27_ = _tmp26_; + _vala_assert (_tmp27_ == 2, "subset.size == 2"); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gboolean _tmp29_; + gboolean _tmp30_; + GeeSortedSet* _tmp31_; + gint _tmp32_; + gint _tmp33_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_collection_get_is_empty ((GeeCollection*) _tmp28_); + _tmp30_ = _tmp29_; + _vala_assert (!_tmp30_, "!subset.is_empty"); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_collection_get_size ((GeeCollection*) _tmp31_); + _tmp33_ = _tmp32_; + _vala_assert (_tmp33_ == 3, "subset.size == 3"); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp34_; + gboolean _tmp35_; + gboolean _tmp36_; + GeeSortedSet* _tmp37_; + gint _tmp38_; + gint _tmp39_; + _tmp34_ = self->priv->subset; + _tmp35_ = gee_collection_get_is_empty ((GeeCollection*) _tmp34_); + _tmp36_ = _tmp35_; + _vala_assert (!_tmp36_, "!subset.is_empty"); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_collection_get_size ((GeeCollection*) _tmp37_); + _tmp39_ = _tmp38_; + _vala_assert (_tmp39_ == 3, "subset.size == 3"); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp40_; + gboolean _tmp41_; + gboolean _tmp42_; + GeeSortedSet* _tmp43_; + gint _tmp44_; + gint _tmp45_; + _tmp40_ = self->priv->subset; + _tmp41_ = gee_collection_get_is_empty ((GeeCollection*) _tmp40_); + _tmp42_ = _tmp41_; + _vala_assert (_tmp42_, "subset.is_empty"); + _tmp43_ = self->priv->subset; + _tmp44_ = gee_collection_get_size ((GeeCollection*) _tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (_tmp45_ == 0, "subset.size == 0"); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_contains (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp53_; + gint _tmp53__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeSortedSet* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + _tmp50_ = self->priv->subset; + _tmp51_ = s; + _tmp52_ = gee_collection_contains ((GeeCollection*) _tmp50_, _tmp51_); + _vala_assert (_tmp52_, "subset.contains (s)"); + _g_free0 (s); + } + } + } + _tmp53_ = not_contains; + _tmp53__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp53_; + s_collection_length1 = _tmp53__length1; + for (s_it = 0; s_it < _tmp53__length1; s_it = s_it + 1) { + gchar* _tmp54_; + gchar* s = NULL; + _tmp54_ = g_strdup (s_collection[s_it]); + s = _tmp54_; + { + GeeSortedSet* _tmp55_; + const gchar* _tmp56_; + gboolean _tmp57_ = FALSE; + _tmp55_ = self->priv->subset; + _tmp56_ = s; + _tmp57_ = gee_collection_contains ((GeeCollection*) _tmp55_, _tmp56_); + _vala_assert (!_tmp57_, "!subset.contains (s)"); + _g_free0 (s); + } + } + } + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_add (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** success = NULL; + gint success_length1 = 0; + gint _success_size_ = 0; + gchar** fail = NULL; + gint fail_length1 = 0; + gint _fail_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp40_; + gint _tmp40__length1; + gchar** _tmp51_; + gint _tmp51__length1; + GeeSortedSet* _tmp62_; + gint _tmp63_; + gint _tmp64_; + gchar** _tmp65_; + gint _tmp65__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar** _tmp21_ = NULL; + _tmp16_ = g_strdup ("a"); + _tmp17_ = g_strdup ("o"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp18_; + success_length1 = 2; + _success_size_ = success_length1; + _tmp19_ = g_strdup ("oz"); + _tmp20_ = g_strdup ("z"); + _tmp21_ = g_new0 (gchar*, 2 + 1); + _tmp21_[0] = _tmp19_; + _tmp21_[1] = _tmp20_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp21_; + fail_length1 = 2; + _fail_size_ = fail_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp22_; + gchar* _tmp23_; + gchar** _tmp24_ = NULL; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + _tmp22_ = g_strdup ("siz"); + _tmp23_ = g_strdup ("z"); + _tmp24_ = g_new0 (gchar*, 2 + 1); + _tmp24_[0] = _tmp22_; + _tmp24_[1] = _tmp23_; + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp24_; + success_length1 = 2; + _success_size_ = success_length1; + _tmp25_ = g_strdup ("sia"); + _tmp26_ = g_strdup ("a"); + _tmp27_ = g_new0 (gchar*, 2 + 1); + _tmp27_[0] = _tmp25_; + _tmp27_[1] = _tmp26_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp27_; + fail_length1 = 2; + _fail_size_ = fail_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp28_; + gchar* _tmp29_; + gchar** _tmp30_ = NULL; + gchar* _tmp31_; + gchar* _tmp32_; + gchar** _tmp33_ = NULL; + _tmp28_ = g_strdup ("o"); + _tmp29_ = g_strdup ("th"); + _tmp30_ = g_new0 (gchar*, 2 + 1); + _tmp30_[0] = _tmp28_; + _tmp30_[1] = _tmp29_; + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp30_; + success_length1 = 2; + _success_size_ = success_length1; + _tmp31_ = g_strdup ("f"); + _tmp32_ = g_strdup ("u"); + _tmp33_ = g_new0 (gchar*, 2 + 1); + _tmp33_[0] = _tmp31_; + _tmp33_[1] = _tmp32_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp33_; + fail_length1 = 2; + _fail_size_ = fail_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp34_ = NULL; + gchar* _tmp35_; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp34_ = g_new0 (gchar*, 0 + 1); + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); + success = _tmp34_; + success_length1 = 0; + _success_size_ = success_length1; + _tmp35_ = g_strdup ("o"); + _tmp36_ = g_strdup ("th"); + _tmp37_ = g_strdup ("f"); + _tmp38_ = g_strdup ("u"); + _tmp39_ = g_new0 (gchar*, 4 + 1); + _tmp39_[0] = _tmp35_; + _tmp39_[1] = _tmp36_; + _tmp39_[2] = _tmp37_; + _tmp39_[3] = _tmp38_; + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + fail = _tmp39_; + fail_length1 = 4; + _fail_size_ = fail_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp40_ = success; + _tmp40__length1 = success_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp40_; + s_collection_length1 = _tmp40__length1; + for (s_it = 0; s_it < _tmp40__length1; s_it = s_it + 1) { + gchar* _tmp41_; + gchar* s = NULL; + _tmp41_ = g_strdup (s_collection[s_it]); + s = _tmp41_; + { + GeeSortedSet* _tmp42_; + const gchar* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeSortedSet* _tmp45_; + const gchar* _tmp46_; + gboolean _tmp47_ = FALSE; + GeeSortedSet* _tmp48_; + const gchar* _tmp49_; + gboolean _tmp50_ = FALSE; + _tmp42_ = self->priv->subset; + _tmp43_ = s; + _tmp44_ = gee_collection_add ((GeeCollection*) _tmp42_, _tmp43_); + _vala_assert (_tmp44_, "subset.add (s)"); + _tmp45_ = self->priv->subset; + _tmp46_ = s; + _tmp47_ = gee_collection_contains ((GeeCollection*) _tmp45_, _tmp46_); + _vala_assert (_tmp47_, "subset.contains (s)"); + _tmp48_ = self->priv->master; + _tmp49_ = s; + _tmp50_ = gee_collection_contains ((GeeCollection*) _tmp48_, _tmp49_); + _vala_assert (_tmp50_, "master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp51_ = fail; + _tmp51__length1 = fail_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp51_; + s_collection_length1 = _tmp51__length1; + for (s_it = 0; s_it < _tmp51__length1; s_it = s_it + 1) { + gchar* _tmp52_; + gchar* s = NULL; + _tmp52_ = g_strdup (s_collection[s_it]); + s = _tmp52_; + { + GeeSortedSet* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + GeeSortedSet* _tmp56_; + const gchar* _tmp57_; + gboolean _tmp58_ = FALSE; + GeeSortedSet* _tmp59_; + const gchar* _tmp60_; + gboolean _tmp61_ = FALSE; + _tmp53_ = self->priv->subset; + _tmp54_ = s; + _tmp55_ = gee_collection_add ((GeeCollection*) _tmp53_, _tmp54_); + _vala_assert (!_tmp55_, "!subset.add (s)"); + _tmp56_ = self->priv->subset; + _tmp57_ = s; + _tmp58_ = gee_collection_contains ((GeeCollection*) _tmp56_, _tmp57_); + _vala_assert (!_tmp58_, "!subset.contains (s)"); + _tmp59_ = self->priv->master; + _tmp60_ = s; + _tmp61_ = gee_collection_contains ((GeeCollection*) _tmp59_, _tmp60_); + _vala_assert (!_tmp61_, "!master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp62_ = self->priv->master; + _tmp63_ = gee_collection_get_size ((GeeCollection*) _tmp62_); + _tmp64_ = _tmp63_; + _tmp65_ = success; + _tmp65__length1 = success_length1; + _vala_assert (_tmp64_ == (6 + _tmp65__length1), "master.size == 6 + success.length"); + fail = (_vala_array_free (fail, fail_length1, (GDestroyNotify) g_free), NULL); + success = (_vala_array_free (success, success_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_remove (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp56_; + gint _tmp56__length1; + GeeSortedSet* _tmp64_; + gint _tmp65_; + gint _tmp66_; + gchar** _tmp67_; + gint _tmp67__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeSortedSet* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeSortedSet* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + _tmp50_ = self->priv->subset; + _tmp51_ = s; + _tmp52_ = gee_collection_remove ((GeeCollection*) _tmp50_, _tmp51_); + _vala_assert (_tmp52_, "subset.remove (s)"); + _tmp53_ = self->priv->master; + _tmp54_ = s; + _tmp55_ = gee_collection_contains ((GeeCollection*) _tmp53_, _tmp54_); + _vala_assert (!_tmp55_, "!master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp56_ = not_contains; + _tmp56__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp56_; + s_collection_length1 = _tmp56__length1; + for (s_it = 0; s_it < _tmp56__length1; s_it = s_it + 1) { + gchar* _tmp57_; + gchar* s = NULL; + _tmp57_ = g_strdup (s_collection[s_it]); + s = _tmp57_; + { + GeeSortedSet* _tmp58_; + const gchar* _tmp59_; + gboolean _tmp60_ = FALSE; + GeeSortedSet* _tmp61_; + const gchar* _tmp62_; + gboolean _tmp63_ = FALSE; + _tmp58_ = self->priv->subset; + _tmp59_ = s; + _tmp60_ = gee_collection_remove ((GeeCollection*) _tmp58_, _tmp59_); + _vala_assert (!_tmp60_, "!subset.remove (s)"); + _tmp61_ = self->priv->master; + _tmp62_ = s; + _tmp63_ = gee_collection_contains ((GeeCollection*) _tmp61_, _tmp62_); + _vala_assert (_tmp63_, "master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp64_ = self->priv->master; + _tmp65_ = gee_collection_get_size ((GeeCollection*) _tmp64_); + _tmp66_ = _tmp65_; + _tmp67_ = contains; + _tmp67__length1 = contains_length1; + _vala_assert (_tmp66_ == (6 - _tmp67__length1), "master.size == 6 - contains.length"); + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_iterator (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + guint i; + guint _tmp38_; + gchar** _tmp39_; + gint _tmp39__length1; + GeeSortedSet* _tmp40_; + GeeBidirIterator* _tmp41_ = NULL; + GeeBidirIterator* iter; + SortedSetTestsSubSetType _tmp42_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + _tmp16_ = g_strdup ("five"); + _tmp17_ = g_strdup ("four"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar** _tmp22_ = NULL; + _tmp19_ = g_strdup ("six"); + _tmp20_ = g_strdup ("three"); + _tmp21_ = g_strdup ("two"); + _tmp22_ = g_new0 (gchar*, 3 + 1); + _tmp22_[0] = _tmp19_; + _tmp22_[1] = _tmp20_; + _tmp22_[2] = _tmp21_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp22_; + contains_length1 = 3; + _contains_size_ = contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar** _tmp26_ = NULL; + _tmp23_ = g_strdup ("four"); + _tmp24_ = g_strdup ("one"); + _tmp25_ = g_strdup ("six"); + _tmp26_ = g_new0 (gchar*, 3 + 1); + _tmp26_[0] = _tmp23_; + _tmp26_[1] = _tmp24_; + _tmp26_[2] = _tmp25_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp26_; + contains_length1 = 3; + _contains_size_ = contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp27_ = NULL; + _tmp27_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 0; + _contains_size_ = contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + i = (guint) 0; + { + GeeSortedSet* _tmp28_; + GeeIterator* _tmp29_ = NULL; + GeeIterator* _e_it; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_iterable_iterator ((GeeIterable*) _tmp28_); + _e_it = _tmp29_; + while (TRUE) { + GeeIterator* _tmp30_; + gboolean _tmp31_ = FALSE; + GeeIterator* _tmp32_; + gpointer _tmp33_ = NULL; + gchar* e; + const gchar* _tmp34_; + gchar** _tmp35_; + gint _tmp35__length1; + guint _tmp36_; + const gchar* _tmp37_; + _tmp30_ = _e_it; + _tmp31_ = gee_iterator_next (_tmp30_); + if (!_tmp31_) { + break; + } + _tmp32_ = _e_it; + _tmp33_ = gee_iterator_get (_tmp32_); + e = (gchar*) _tmp33_; + _tmp34_ = e; + _tmp35_ = contains; + _tmp35__length1 = contains_length1; + _tmp36_ = i; + i = _tmp36_ + 1; + _tmp37_ = _tmp35_[_tmp36_]; + _vala_assert (g_strcmp0 (_tmp34_, _tmp37_) == 0, "e == contains[i++]"); + _g_free0 (e); + } + _g_object_unref0 (_e_it); + } + _tmp38_ = i; + _tmp39_ = contains; + _tmp39__length1 = contains_length1; + _vala_assert (_tmp38_ == ((guint) _tmp39__length1), "i == contains.length"); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_bidir_iterator (_tmp40_); + iter = _tmp41_; + _tmp42_ = self->priv->type; + if (_tmp42_ != SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY) { + GeeBidirIterator* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeBidirIterator* _tmp45_; + gpointer _tmp46_ = NULL; + gchar* _tmp47_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp49_; + gint _tmp49__length1; + const gchar* _tmp50_; + GeeBidirIterator* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeBidirIterator* _tmp53_; + gpointer _tmp54_ = NULL; + gchar* _tmp55_; + gchar** _tmp56_; + gint _tmp56__length1; + const gchar* _tmp57_; + GeeBidirIterator* _tmp58_; + gboolean _tmp59_ = FALSE; + GeeBidirIterator* _tmp60_; + gboolean _tmp61_ = FALSE; + GeeBidirIterator* _tmp62_; + gpointer _tmp63_ = NULL; + gchar* _tmp64_; + gchar** _tmp65_; + gint _tmp65__length1; + const gchar* _tmp66_; + GeeBidirIterator* _tmp67_; + gboolean _tmp68_ = FALSE; + GeeBidirIterator* _tmp69_; + GeeBidirIterator* _tmp70_; + gboolean _tmp71_ = FALSE; + SortedSetTestsSubSetType _tmp72_; + GeeBidirIterator* _tmp77_; + gboolean _tmp78_ = FALSE; + GeeBidirIterator* _tmp79_; + gpointer _tmp80_ = NULL; + gchar* _tmp81_; + gchar** _tmp82_; + gint _tmp82__length1; + const gchar* _tmp83_; + _tmp43_ = iter; + _tmp44_ = gee_bidir_iterator_last (_tmp43_); + _vala_assert (_tmp44_, "iter.last ()"); + _tmp45_ = iter; + _tmp46_ = gee_iterator_get ((GeeIterator*) _tmp45_); + _tmp47_ = (gchar*) _tmp46_; + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + _tmp49_ = contains; + _tmp49__length1 = contains_length1; + _tmp50_ = _tmp48_[_tmp49__length1 - 1]; + _vala_assert (g_strcmp0 (_tmp47_, _tmp50_) == 0, "iter.get () == contains[contains.length - 1]"); + _g_free0 (_tmp47_); + _tmp51_ = iter; + _tmp52_ = gee_iterator_first ((GeeIterator*) _tmp51_); + _vala_assert (_tmp52_, "iter.first ()"); + _tmp53_ = iter; + _tmp54_ = gee_iterator_get ((GeeIterator*) _tmp53_); + _tmp55_ = (gchar*) _tmp54_; + _tmp56_ = contains; + _tmp56__length1 = contains_length1; + _tmp57_ = _tmp56_[0]; + _vala_assert (g_strcmp0 (_tmp55_, _tmp57_) == 0, "iter.get () == contains[0]"); + _g_free0 (_tmp55_); + _tmp58_ = iter; + _tmp59_ = gee_iterator_has_next ((GeeIterator*) _tmp58_); + _vala_assert (_tmp59_, "iter.has_next ()"); + _tmp60_ = iter; + _tmp61_ = gee_iterator_next ((GeeIterator*) _tmp60_); + _vala_assert (_tmp61_, "iter.next ()"); + _tmp62_ = iter; + _tmp63_ = gee_iterator_get ((GeeIterator*) _tmp62_); + _tmp64_ = (gchar*) _tmp63_; + _tmp65_ = contains; + _tmp65__length1 = contains_length1; + _tmp66_ = _tmp65_[1]; + _vala_assert (g_strcmp0 (_tmp64_, _tmp66_) == 0, "iter.get () == contains[1]"); + _g_free0 (_tmp64_); + _tmp67_ = iter; + _tmp68_ = gee_bidir_iterator_has_previous (_tmp67_); + _vala_assert (_tmp68_, "iter.has_previous ()"); + _tmp69_ = iter; + gee_iterator_remove ((GeeIterator*) _tmp69_); + _tmp70_ = iter; + _tmp71_ = gee_bidir_iterator_has_previous (_tmp70_); + _vala_assert (_tmp71_, "iter.has_previous ()"); + _tmp72_ = self->priv->type; + if (_tmp72_ != SORTED_SET_TESTS_SUB_SET_TYPE_HEAD) { + GeeBidirIterator* _tmp73_; + gboolean _tmp74_ = FALSE; + _tmp73_ = iter; + _tmp74_ = gee_iterator_has_next ((GeeIterator*) _tmp73_); + _vala_assert (_tmp74_, "iter.has_next ()"); + } else { + GeeBidirIterator* _tmp75_; + gboolean _tmp76_ = FALSE; + _tmp75_ = iter; + _tmp76_ = gee_iterator_has_next ((GeeIterator*) _tmp75_); + _vala_assert (!_tmp76_, "!iter.has_next ()"); + } + _tmp77_ = iter; + _tmp78_ = gee_bidir_iterator_previous (_tmp77_); + _vala_assert (_tmp78_, "iter.previous ()"); + _tmp79_ = iter; + _tmp80_ = gee_iterator_get ((GeeIterator*) _tmp79_); + _tmp81_ = (gchar*) _tmp80_; + _tmp82_ = contains; + _tmp82__length1 = contains_length1; + _tmp83_ = _tmp82_[0]; + _vala_assert (g_strcmp0 (_tmp81_, _tmp83_) == 0, "iter.get () == contains[0]"); + _g_free0 (_tmp81_); + } else { + GeeBidirIterator* _tmp84_; + gboolean _tmp85_ = FALSE; + gboolean _tmp86_ = FALSE; + _tmp84_ = iter; + _tmp85_ = gee_iterator_first ((GeeIterator*) _tmp84_); + _vala_assert (!_tmp85_, "!iter.first ()"); + _tmp86_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp86_) { + GeeBidirIterator* _tmp87_; + _tmp87_ = iter; + gee_iterator_remove ((GeeIterator*) _tmp87_); + exit (0); + } + g_test_trap_assert_failed (); + } + _g_object_unref0 (iter); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_clear (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + GeeSortedSet* _tmp48_; + gchar** _tmp49_; + gint _tmp49__length1; + gchar** _tmp54_; + gint _tmp54__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = self->priv->subset; + gee_collection_clear ((GeeCollection*) _tmp48_); + _tmp49_ = contains; + _tmp49__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp49_; + s_collection_length1 = _tmp49__length1; + for (s_it = 0; s_it < _tmp49__length1; s_it = s_it + 1) { + gchar* _tmp50_; + gchar* s = NULL; + _tmp50_ = g_strdup (s_collection[s_it]); + s = _tmp50_; + { + GeeSortedSet* _tmp51_; + const gchar* _tmp52_; + gboolean _tmp53_ = FALSE; + _tmp51_ = self->priv->master; + _tmp52_ = s; + _tmp53_ = gee_collection_contains ((GeeCollection*) _tmp51_, _tmp52_); + _vala_assert (!_tmp53_, "!master.contains (s)"); + _g_free0 (s); + } + } + } + _tmp54_ = not_contains; + _tmp54__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp54_; + s_collection_length1 = _tmp54__length1; + for (s_it = 0; s_it < _tmp54__length1; s_it = s_it + 1) { + gchar* _tmp55_; + gchar* s = NULL; + _tmp55_ = g_strdup (s_collection[s_it]); + s = _tmp55_; + { + GeeSortedSet* _tmp56_; + const gchar* _tmp57_; + gboolean _tmp58_ = FALSE; + _tmp56_ = self->priv->master; + _tmp57_ = s; + _tmp58_ = gee_collection_contains ((GeeCollection*) _tmp56_, _tmp57_); + _vala_assert (_tmp58_, "master.contains (s)"); + _g_free0 (s); + } + } + } + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_boundaries (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_first (_tmp16_); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "five") == 0, "subset.first () == \"five\""); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_last (_tmp19_); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "subset.last () == \"four\""); + _g_free0 (_tmp21_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_first (_tmp22_); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "six") == 0, "subset.first () == \"six\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_last (_tmp25_); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "two") == 0, "subset.last () == \"two\""); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_first (_tmp28_); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "four") == 0, "subset.first () == \"four\""); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_last (_tmp31_); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "six") == 0, "subset.last () == \"six\""); + _g_free0 (_tmp33_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gboolean _tmp34_ = FALSE; + gboolean _tmp38_ = FALSE; + _tmp34_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp34_) { + GeeSortedSet* _tmp35_; + gpointer _tmp36_ = NULL; + gchar* _tmp37_; + _tmp35_ = self->priv->subset; + _tmp36_ = gee_sorted_set_first (_tmp35_); + _tmp37_ = (gchar*) _tmp36_; + _g_free0 (_tmp37_); + exit (0); + } + g_test_trap_assert_failed (); + _tmp38_ = g_test_trap_fork ((guint64) 0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR); + if (_tmp38_) { + GeeSortedSet* _tmp39_; + gpointer _tmp40_ = NULL; + gchar* _tmp41_; + _tmp39_ = self->priv->subset; + _tmp40_ = gee_sorted_set_last (_tmp39_); + _tmp41_ = (gchar*) _tmp40_; + _g_free0 (_tmp41_); + exit (0); + } + g_test_trap_assert_failed (); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_iterator_at (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + gchar** contains = NULL; + gint contains_length1 = 0; + gint _contains_size_ = 0; + gchar** not_contains = NULL; + gint not_contains_length1 = 0; + gint _not_contains_size_ = 0; + SortedSetTestsSubSetType _tmp15_; + gchar** _tmp48_; + gint _tmp48__length1; + gchar** _tmp58_; + gint _tmp58__length1; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + gchar* _tmp16_; + gchar* _tmp17_; + gchar** _tmp18_ = NULL; + gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar** _tmp23_ = NULL; + _tmp16_ = g_strdup ("four"); + _tmp17_ = g_strdup ("five"); + _tmp18_ = g_new0 (gchar*, 2 + 1); + _tmp18_[0] = _tmp16_; + _tmp18_[1] = _tmp17_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp18_; + contains_length1 = 2; + _contains_size_ = contains_length1; + _tmp19_ = g_strdup ("one"); + _tmp20_ = g_strdup ("two"); + _tmp21_ = g_strdup ("three"); + _tmp22_ = g_strdup ("six"); + _tmp23_ = g_new0 (gchar*, 4 + 1); + _tmp23_[0] = _tmp19_; + _tmp23_[1] = _tmp20_; + _tmp23_[2] = _tmp21_; + _tmp23_[3] = _tmp22_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp23_; + not_contains_length1 = 4; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar** _tmp27_ = NULL; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar** _tmp31_ = NULL; + _tmp24_ = g_strdup ("two"); + _tmp25_ = g_strdup ("three"); + _tmp26_ = g_strdup ("six"); + _tmp27_ = g_new0 (gchar*, 3 + 1); + _tmp27_[0] = _tmp24_; + _tmp27_[1] = _tmp25_; + _tmp27_[2] = _tmp26_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp27_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp28_ = g_strdup ("one"); + _tmp29_ = g_strdup ("four"); + _tmp30_ = g_strdup ("five"); + _tmp31_ = g_new0 (gchar*, 3 + 1); + _tmp31_[0] = _tmp28_; + _tmp31_[1] = _tmp29_; + _tmp31_[2] = _tmp30_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp31_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar** _tmp35_ = NULL; + gchar* _tmp36_; + gchar* _tmp37_; + gchar* _tmp38_; + gchar** _tmp39_ = NULL; + _tmp32_ = g_strdup ("one"); + _tmp33_ = g_strdup ("four"); + _tmp34_ = g_strdup ("six"); + _tmp35_ = g_new0 (gchar*, 3 + 1); + _tmp35_[0] = _tmp32_; + _tmp35_[1] = _tmp33_; + _tmp35_[2] = _tmp34_; + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp35_; + contains_length1 = 3; + _contains_size_ = contains_length1; + _tmp36_ = g_strdup ("two"); + _tmp37_ = g_strdup ("three"); + _tmp38_ = g_strdup ("five"); + _tmp39_ = g_new0 (gchar*, 3 + 1); + _tmp39_[0] = _tmp36_; + _tmp39_[1] = _tmp37_; + _tmp39_[2] = _tmp38_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp39_; + not_contains_length1 = 3; + _not_contains_size_ = not_contains_length1; + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + gchar** _tmp40_ = NULL; + gchar* _tmp41_; + gchar* _tmp42_; + gchar* _tmp43_; + gchar* _tmp44_; + gchar* _tmp45_; + gchar* _tmp46_; + gchar** _tmp47_ = NULL; + _tmp40_ = g_new0 (gchar*, 0 + 1); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); + contains = _tmp40_; + contains_length1 = 0; + _contains_size_ = contains_length1; + _tmp41_ = g_strdup ("one"); + _tmp42_ = g_strdup ("two"); + _tmp43_ = g_strdup ("three"); + _tmp44_ = g_strdup ("four"); + _tmp45_ = g_strdup ("five"); + _tmp46_ = g_strdup ("six"); + _tmp47_ = g_new0 (gchar*, 6 + 1); + _tmp47_[0] = _tmp41_; + _tmp47_[1] = _tmp42_; + _tmp47_[2] = _tmp43_; + _tmp47_[3] = _tmp44_; + _tmp47_[4] = _tmp45_; + _tmp47_[5] = _tmp46_; + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + not_contains = _tmp47_; + not_contains_length1 = 6; + _not_contains_size_ = not_contains_length1; + break; + } + default: + { + g_assert_not_reached (); + } + } + _tmp48_ = contains; + _tmp48__length1 = contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeSortedSet* _tmp50_; + const gchar* _tmp51_; + GeeBidirIterator* _tmp52_ = NULL; + GeeBidirIterator* iter; + GeeBidirIterator* _tmp53_; + GeeBidirIterator* _tmp54_; + gpointer _tmp55_ = NULL; + gchar* _tmp56_; + const gchar* _tmp57_; + _tmp50_ = self->priv->subset; + _tmp51_ = s; + _tmp52_ = gee_sorted_set_iterator_at (_tmp50_, _tmp51_); + iter = _tmp52_; + _tmp53_ = iter; + _vala_assert (_tmp53_ != NULL, "iter != null"); + _tmp54_ = iter; + _tmp55_ = gee_iterator_get ((GeeIterator*) _tmp54_); + _tmp56_ = (gchar*) _tmp55_; + _tmp57_ = s; + _vala_assert (g_strcmp0 (_tmp56_, _tmp57_) == 0, "iter.get () == s"); + _g_free0 (_tmp56_); + _g_object_unref0 (iter); + _g_free0 (s); + } + } + } + _tmp58_ = not_contains; + _tmp58__length1 = not_contains_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp58_; + s_collection_length1 = _tmp58__length1; + for (s_it = 0; s_it < _tmp58__length1; s_it = s_it + 1) { + gchar* _tmp59_; + gchar* s = NULL; + _tmp59_ = g_strdup (s_collection[s_it]); + s = _tmp59_; + { + GeeSortedSet* _tmp60_; + const gchar* _tmp61_; + GeeBidirIterator* _tmp62_ = NULL; + GeeBidirIterator* iter; + GeeBidirIterator* _tmp63_; + _tmp60_ = self->priv->subset; + _tmp61_ = s; + _tmp62_ = gee_sorted_set_iterator_at (_tmp60_, _tmp61_); + iter = _tmp62_; + _tmp63_ = iter; + _vala_assert (_tmp63_ == NULL, "iter == null"); + _g_object_unref0 (iter); + _g_free0 (s); + } + } + } + not_contains = (_vala_array_free (not_contains, not_contains_length1, (GDestroyNotify) g_free), NULL); + contains = (_vala_array_free (contains, contains_length1, (GDestroyNotify) g_free), NULL); +} + + +void sorted_set_tests_sub_set_test_lower (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_lower (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (_tmp18_ == NULL, "subset.lower (\"a\") == null"); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_lower (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (_tmp21_ == NULL, "subset.lower (\"five\") == null"); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_lower (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "five") == 0, "subset.lower (\"four\") == \"five\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_lower (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "four") == 0, "subset.lower (\"six\") == \"four\""); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_lower (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (_tmp30_ == NULL, "subset.lower (\"one\") == null"); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_lower (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (_tmp33_ == NULL, "subset.lower (\"six\") == null"); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_lower (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "six") == 0, "subset.lower (\"three\") == \"six\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_lower (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "three") == 0, "subset.lower (\"two\") == \"three\""); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_lower (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "two") == 0, "subset.lower (\"z\") == \"two\""); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_lower (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (_tmp45_ == NULL, "subset.lower (\"five\") == null"); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_lower (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (_tmp48_ == NULL, "subset.lower (\"four\") == null"); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_lower (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "four") == 0, "subset.lower (\"one\") == \"four\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_lower (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "one") == 0, "subset.lower (\"six\") == \"one\""); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_lower (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (g_strcmp0 (_tmp57_, "six") == 0, "subset.lower (\"three\") == \"six\""); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_lower (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.lower (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_higher (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_higher (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "five") == 0, "subset.higher (\"a\") == \"five\""); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_higher (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "four") == 0, "subset.higher (\"five\") == \"four\""); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_higher (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (_tmp24_ == NULL, "subset.higher (\"four\") == null"); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_higher (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (_tmp27_ == NULL, "subset.higher (\"six\") == null"); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_higher (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "six") == 0, "subset.higher (\"one\") == \"six\""); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_higher (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "three") == 0, "subset.higher (\"six\") == \"three\""); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_higher (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "two") == 0, "subset.higher (\"three\") == \"two\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_higher (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (_tmp39_ == NULL, "subset.higher (\"two\") == null"); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_higher (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "subset.higher (\"z\") == null"); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_higher (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (g_strcmp0 (_tmp45_, "four") == 0, "subset.higher (\"five\") == \"four\""); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_higher (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "one") == 0, "subset.higher (\"four\") == \"one\""); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_higher (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "six") == 0, "subset.higher (\"one\") == \"six\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_higher (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (_tmp54_ == NULL, "subset.higher (\"six\") == null"); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_higher (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (_tmp57_ == NULL, "subset.higher (\"three\") == null"); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_higher (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.higher (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_floor (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_floor (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (_tmp18_ == NULL, "subset.floor (\"a\") == null"); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_floor (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "five") == 0, "subset.floor (\"five\") == \"five\""); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_floor (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "four") == 0, "subset.floor (\"four\") == \"four\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_floor (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "four") == 0, "subset.floor (\"six\") == \"four\""); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_floor (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (_tmp30_ == NULL, "subset.floor (\"one\") == null"); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_floor (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "six") == 0, "subset.floor (\"six\") == \"six\""); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_floor (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "three") == 0, "subset.floor (\"three\") == \"three\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_floor (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "two") == 0, "subset.floor (\"two\") == \"two\""); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_floor (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "two") == 0, "subset.floor (\"z\") == \"two\""); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_floor (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (_tmp45_ == NULL, "subset.floor (\"five\") == null"); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_floor (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "four") == 0, "subset.floor (\"four\") == \"four\""); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_floor (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "one") == 0, "subset.floor (\"one\") == \"one\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_floor (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "six") == 0, "subset.floor (\"six\") == \"six\""); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_floor (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (g_strcmp0 (_tmp57_, "six") == 0, "subset.floor (\"three\") == \"six\""); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_floor (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.floor (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_ceil (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + GeeSortedSet* _tmp19_; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + GeeSortedSet* _tmp22_; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + GeeSortedSet* _tmp25_; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_ceil (_tmp16_, "a"); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "five") == 0, "subset.ceil (\"a\") == \"five\""); + _g_free0 (_tmp18_); + _tmp19_ = self->priv->subset; + _tmp20_ = gee_sorted_set_ceil (_tmp19_, "five"); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "five") == 0, "subset.ceil (\"five\") == \"five\""); + _g_free0 (_tmp21_); + _tmp22_ = self->priv->subset; + _tmp23_ = gee_sorted_set_ceil (_tmp22_, "four"); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "four") == 0, "subset.ceil (\"four\") == \"four\""); + _g_free0 (_tmp24_); + _tmp25_ = self->priv->subset; + _tmp26_ = gee_sorted_set_ceil (_tmp25_, "six"); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (_tmp27_ == NULL, "subset.ceil (\"six\") == null"); + _g_free0 (_tmp27_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp28_; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + GeeSortedSet* _tmp31_; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + GeeSortedSet* _tmp34_; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + GeeSortedSet* _tmp37_; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + GeeSortedSet* _tmp40_; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + _tmp28_ = self->priv->subset; + _tmp29_ = gee_sorted_set_ceil (_tmp28_, "one"); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "six") == 0, "subset.ceil (\"one\") == \"six\""); + _g_free0 (_tmp30_); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_ceil (_tmp31_, "six"); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "six") == 0, "subset.ceil (\"six\") == \"six\""); + _g_free0 (_tmp33_); + _tmp34_ = self->priv->subset; + _tmp35_ = gee_sorted_set_ceil (_tmp34_, "three"); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "three") == 0, "subset.ceil (\"three\") == \"three\""); + _g_free0 (_tmp36_); + _tmp37_ = self->priv->subset; + _tmp38_ = gee_sorted_set_ceil (_tmp37_, "two"); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "two") == 0, "subset.ceil (\"two\") == \"two\""); + _g_free0 (_tmp39_); + _tmp40_ = self->priv->subset; + _tmp41_ = gee_sorted_set_ceil (_tmp40_, "z"); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (_tmp42_ == NULL, "subset.ceil (\"z\") == null"); + _g_free0 (_tmp42_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp43_; + gpointer _tmp44_ = NULL; + gchar* _tmp45_; + GeeSortedSet* _tmp46_; + gpointer _tmp47_ = NULL; + gchar* _tmp48_; + GeeSortedSet* _tmp49_; + gpointer _tmp50_ = NULL; + gchar* _tmp51_; + GeeSortedSet* _tmp52_; + gpointer _tmp53_ = NULL; + gchar* _tmp54_; + GeeSortedSet* _tmp55_; + gpointer _tmp56_ = NULL; + gchar* _tmp57_; + _tmp43_ = self->priv->subset; + _tmp44_ = gee_sorted_set_ceil (_tmp43_, "five"); + _tmp45_ = (gchar*) _tmp44_; + _vala_assert (g_strcmp0 (_tmp45_, "four") == 0, "subset.ceil (\"five\") == \"four\""); + _g_free0 (_tmp45_); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_ceil (_tmp46_, "four"); + _tmp48_ = (gchar*) _tmp47_; + _vala_assert (g_strcmp0 (_tmp48_, "four") == 0, "subset.ceil (\"four\") == \"four\""); + _g_free0 (_tmp48_); + _tmp49_ = self->priv->subset; + _tmp50_ = gee_sorted_set_ceil (_tmp49_, "one"); + _tmp51_ = (gchar*) _tmp50_; + _vala_assert (g_strcmp0 (_tmp51_, "one") == 0, "subset.ceil (\"one\") == \"one\""); + _g_free0 (_tmp51_); + _tmp52_ = self->priv->subset; + _tmp53_ = gee_sorted_set_ceil (_tmp52_, "six"); + _tmp54_ = (gchar*) _tmp53_; + _vala_assert (g_strcmp0 (_tmp54_, "six") == 0, "subset.ceil (\"six\") == \"six\""); + _g_free0 (_tmp54_); + _tmp55_ = self->priv->subset; + _tmp56_ = gee_sorted_set_ceil (_tmp55_, "three"); + _tmp57_ = (gchar*) _tmp56_; + _vala_assert (_tmp57_ == NULL, "subset.ceil (\"three\") == null"); + _g_free0 (_tmp57_); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp58_; + gpointer _tmp59_ = NULL; + gchar* _tmp60_; + _tmp58_ = self->priv->subset; + _tmp59_ = gee_sorted_set_ceil (_tmp58_, "six"); + _tmp60_ = (gchar*) _tmp59_; + _vala_assert (_tmp60_ == NULL, "subset.ceil (\"six\") == null"); + _g_free0 (_tmp60_); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +void sorted_set_tests_sub_set_test_subsets (SortedSetTestsSubSet* self) { + GeeSortedSet* _tmp0_; + gboolean _tmp1_ = FALSE; + GeeSortedSet* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeSortedSet* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeSortedSet* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeSortedSet* _tmp8_; + gboolean _tmp9_ = FALSE; + GeeSortedSet* _tmp10_; + gboolean _tmp11_ = FALSE; + GeeSortedSet* _tmp12_; + gint _tmp13_; + gint _tmp14_; + SortedSetTestsSubSetType _tmp15_; + g_return_if_fail (self != NULL); + _tmp0_ = self->priv->master; + _tmp1_ = gee_collection_add ((GeeCollection*) _tmp0_, "one"); + _vala_assert (_tmp1_, "master.add (\"one\")"); + _tmp2_ = self->priv->master; + _tmp3_ = gee_collection_add ((GeeCollection*) _tmp2_, "two"); + _vala_assert (_tmp3_, "master.add (\"two\")"); + _tmp4_ = self->priv->master; + _tmp5_ = gee_collection_add ((GeeCollection*) _tmp4_, "three"); + _vala_assert (_tmp5_, "master.add (\"three\")"); + _tmp6_ = self->priv->master; + _tmp7_ = gee_collection_add ((GeeCollection*) _tmp6_, "four"); + _vala_assert (_tmp7_, "master.add (\"four\")"); + _tmp8_ = self->priv->master; + _tmp9_ = gee_collection_add ((GeeCollection*) _tmp8_, "five"); + _vala_assert (_tmp9_, "master.add (\"five\")"); + _tmp10_ = self->priv->master; + _tmp11_ = gee_collection_add ((GeeCollection*) _tmp10_, "six"); + _vala_assert (_tmp11_, "master.add (\"six\")"); + _tmp12_ = self->priv->master; + _tmp13_ = gee_collection_get_size ((GeeCollection*) _tmp12_); + _tmp14_ = _tmp13_; + _vala_assert (_tmp14_ == 6, "master.size == 6"); + _tmp15_ = self->priv->type; + switch (_tmp15_) { + case SORTED_SET_TESTS_SUB_SET_TYPE_HEAD: + { + GeeSortedSet* _tmp16_; + GeeSortedSet* _tmp17_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp18_; + gint _tmp19_; + gint _tmp20_; + GeeSortedSet* _tmp21_; + GeeSortedSet* _tmp22_ = NULL; + GeeSortedSet* _tmp23_; + gint _tmp24_; + gint _tmp25_; + GeeSortedSet* _tmp26_; + GeeSortedSet* _tmp27_ = NULL; + GeeSortedSet* _tmp28_; + gint _tmp29_; + gint _tmp30_; + GeeSortedSet* _tmp31_; + GeeSortedSet* _tmp32_ = NULL; + GeeSortedSet* _tmp33_; + gint _tmp34_; + gint _tmp35_; + _tmp16_ = self->priv->subset; + _tmp17_ = gee_sorted_set_head_set (_tmp16_, "four"); + subsubset = _tmp17_; + _tmp18_ = subsubset; + _tmp19_ = gee_collection_get_size ((GeeCollection*) _tmp18_); + _tmp20_ = _tmp19_; + _vala_assert (_tmp20_ == 1, "subsubset.size == 1"); + _tmp21_ = self->priv->subset; + _tmp22_ = gee_sorted_set_tail_set (_tmp21_, "four"); + _g_object_unref0 (subsubset); + subsubset = _tmp22_; + _tmp23_ = subsubset; + _tmp24_ = gee_collection_get_size ((GeeCollection*) _tmp23_); + _tmp25_ = _tmp24_; + _vala_assert (_tmp25_ == 1, "subsubset.size == 1"); + _tmp26_ = self->priv->subset; + _tmp27_ = gee_sorted_set_sub_set (_tmp26_, "four", "one"); + _g_object_unref0 (subsubset); + subsubset = _tmp27_; + _tmp28_ = subsubset; + _tmp29_ = gee_collection_get_size ((GeeCollection*) _tmp28_); + _tmp30_ = _tmp29_; + _vala_assert (_tmp30_ == 1, "subsubset.size == 1"); + _tmp31_ = self->priv->subset; + _tmp32_ = gee_sorted_set_sub_set (_tmp31_, "four", "four"); + _g_object_unref0 (subsubset); + subsubset = _tmp32_; + _tmp33_ = subsubset; + _tmp34_ = gee_collection_get_size ((GeeCollection*) _tmp33_); + _tmp35_ = _tmp34_; + _vala_assert (_tmp35_ == 0, "subsubset.size == 0"); + _g_object_unref0 (subsubset); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_TAIL: + { + GeeSortedSet* _tmp36_; + GeeSortedSet* _tmp37_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp38_; + gint _tmp39_; + gint _tmp40_; + GeeSortedSet* _tmp41_; + GeeSortedSet* _tmp42_ = NULL; + GeeSortedSet* _tmp43_; + gint _tmp44_; + gint _tmp45_; + GeeSortedSet* _tmp46_; + GeeSortedSet* _tmp47_ = NULL; + GeeSortedSet* _tmp48_; + gint _tmp49_; + gint _tmp50_; + _tmp36_ = self->priv->subset; + _tmp37_ = gee_sorted_set_head_set (_tmp36_, "two"); + subsubset = _tmp37_; + _tmp38_ = subsubset; + _tmp39_ = gee_collection_get_size ((GeeCollection*) _tmp38_); + _tmp40_ = _tmp39_; + _vala_assert (_tmp40_ == 2, "subsubset.size == 2"); + _tmp41_ = self->priv->subset; + _tmp42_ = gee_sorted_set_tail_set (_tmp41_, "three"); + _g_object_unref0 (subsubset); + subsubset = _tmp42_; + _tmp43_ = subsubset; + _tmp44_ = gee_collection_get_size ((GeeCollection*) _tmp43_); + _tmp45_ = _tmp44_; + _vala_assert (_tmp45_ == 2, "subsubset.size == 2"); + _tmp46_ = self->priv->subset; + _tmp47_ = gee_sorted_set_sub_set (_tmp46_, "three", "two"); + _g_object_unref0 (subsubset); + subsubset = _tmp47_; + _tmp48_ = subsubset; + _tmp49_ = gee_collection_get_size ((GeeCollection*) _tmp48_); + _tmp50_ = _tmp49_; + _vala_assert (_tmp50_ == 1, "subsubset.size == 1"); + _g_object_unref0 (subsubset); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_SUB: + { + GeeSortedSet* _tmp51_; + GeeSortedSet* _tmp52_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp53_; + gint _tmp54_; + gint _tmp55_; + GeeSortedSet* _tmp56_; + GeeSortedSet* _tmp57_ = NULL; + GeeSortedSet* _tmp58_; + gint _tmp59_; + gint _tmp60_; + GeeSortedSet* _tmp61_; + GeeSortedSet* _tmp62_ = NULL; + GeeSortedSet* _tmp63_; + gint _tmp64_; + gint _tmp65_; + GeeSortedSet* _tmp66_; + GeeSortedSet* _tmp67_ = NULL; + GeeSortedSet* _tmp68_; + gint _tmp69_; + gint _tmp70_; + _tmp51_ = self->priv->subset; + _tmp52_ = gee_sorted_set_head_set (_tmp51_, "six"); + subsubset = _tmp52_; + _tmp53_ = subsubset; + _tmp54_ = gee_collection_get_size ((GeeCollection*) _tmp53_); + _tmp55_ = _tmp54_; + _vala_assert (_tmp55_ == 2, "subsubset.size == 2"); + _tmp56_ = self->priv->subset; + _tmp57_ = gee_sorted_set_tail_set (_tmp56_, "one"); + _g_object_unref0 (subsubset); + subsubset = _tmp57_; + _tmp58_ = subsubset; + _tmp59_ = gee_collection_get_size ((GeeCollection*) _tmp58_); + _tmp60_ = _tmp59_; + _vala_assert (_tmp60_ == 2, "subsubset.size == 2"); + _tmp61_ = self->priv->subset; + _tmp62_ = gee_sorted_set_sub_set (_tmp61_, "one", "six"); + _g_object_unref0 (subsubset); + subsubset = _tmp62_; + _tmp63_ = subsubset; + _tmp64_ = gee_collection_get_size ((GeeCollection*) _tmp63_); + _tmp65_ = _tmp64_; + _vala_assert (_tmp65_ == 1, "subsubset.size == 1"); + _tmp66_ = self->priv->subset; + _tmp67_ = gee_sorted_set_sub_set (_tmp66_, "five", "two"); + _g_object_unref0 (subsubset); + subsubset = _tmp67_; + _tmp68_ = subsubset; + _tmp69_ = gee_collection_get_size ((GeeCollection*) _tmp68_); + _tmp70_ = _tmp69_; + _vala_assert (_tmp70_ == 3, "subsubset.size == 3"); + _g_object_unref0 (subsubset); + break; + } + case SORTED_SET_TESTS_SUB_SET_TYPE_EMPTY: + { + GeeSortedSet* _tmp71_; + GeeSortedSet* _tmp72_ = NULL; + GeeSortedSet* subsubset; + GeeSortedSet* _tmp73_; + gint _tmp74_; + gint _tmp75_; + GeeSortedSet* _tmp76_; + GeeSortedSet* _tmp77_ = NULL; + GeeSortedSet* _tmp78_; + gint _tmp79_; + gint _tmp80_; + GeeSortedSet* _tmp81_; + GeeSortedSet* _tmp82_ = NULL; + GeeSortedSet* _tmp83_; + gint _tmp84_; + gint _tmp85_; + _tmp71_ = self->priv->subset; + _tmp72_ = gee_sorted_set_head_set (_tmp71_, "six"); + subsubset = _tmp72_; + _tmp73_ = subsubset; + _tmp74_ = gee_collection_get_size ((GeeCollection*) _tmp73_); + _tmp75_ = _tmp74_; + _vala_assert (_tmp75_ == 0, "subsubset.size == 0"); + _tmp76_ = self->priv->subset; + _tmp77_ = gee_sorted_set_tail_set (_tmp76_, "three"); + _g_object_unref0 (subsubset); + subsubset = _tmp77_; + _tmp78_ = subsubset; + _tmp79_ = gee_collection_get_size ((GeeCollection*) _tmp78_); + _tmp80_ = _tmp79_; + _vala_assert (_tmp80_ == 0, "subsubset.size == 0"); + _tmp81_ = self->priv->subset; + _tmp82_ = gee_sorted_set_sub_set (_tmp81_, "one", "six"); + _g_object_unref0 (subsubset); + subsubset = _tmp82_; + _tmp83_ = subsubset; + _tmp84_ = gee_collection_get_size ((GeeCollection*) _tmp83_); + _tmp85_ = _tmp84_; + _vala_assert (_tmp85_ == 0, "subsubset.size == 0"); + _g_object_unref0 (subsubset); + break; + } + default: + { + g_assert_not_reached (); + } + } +} + + +static void sorted_set_tests_sub_set_class_init (SortedSetTestsSubSetClass * klass) { + sorted_set_tests_sub_set_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (SortedSetTestsSubSetPrivate)); + GEE_TEST_CASE_CLASS (klass)->set_up = sorted_set_tests_sub_set_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = sorted_set_tests_sub_set_real_tear_down; + G_OBJECT_CLASS (klass)->finalize = sorted_set_tests_sub_set_finalize; +} + + +static void sorted_set_tests_sub_set_instance_init (SortedSetTestsSubSet * self) { + self->priv = SORTED_SET_TESTS_SUB_SET_GET_PRIVATE (self); +} + + +static void sorted_set_tests_sub_set_finalize (GObject* obj) { + SortedSetTestsSubSet * self; + self = G_TYPE_CHECK_INSTANCE_CAST (obj, SORTED_SET_TESTS_TYPE_SUB_SET, SortedSetTestsSubSet); + _g_object_unref0 (self->priv->master); + _g_object_unref0 (self->priv->subset); + _g_object_unref0 (self->priv->test); + G_OBJECT_CLASS (sorted_set_tests_sub_set_parent_class)->finalize (obj); +} + + +GType sorted_set_tests_sub_set_get_type (void) { + static volatile gsize sorted_set_tests_sub_set_type_id__volatile = 0; + if (g_once_init_enter (&sorted_set_tests_sub_set_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SortedSetTestsSubSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sorted_set_tests_sub_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SortedSetTestsSubSet), 0, (GInstanceInitFunc) sorted_set_tests_sub_set_instance_init, NULL }; + GType sorted_set_tests_sub_set_type_id; + sorted_set_tests_sub_set_type_id = g_type_register_static (GEE_TYPE_TEST_CASE, "SortedSetTestsSubSet", &g_define_type_info, 0); + g_once_init_leave (&sorted_set_tests_sub_set_type_id__volatile, sorted_set_tests_sub_set_type_id); + } + return sorted_set_tests_sub_set_type_id__volatile; +} + + +static void sorted_set_tests_class_init (SortedSetTestsClass * klass) { + sorted_set_tests_parent_class = g_type_class_peek_parent (klass); +} + + +static void sorted_set_tests_instance_init (SortedSetTests * self) { +} + + +GType sorted_set_tests_get_type (void) { + static volatile gsize sorted_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&sorted_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (SortedSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sorted_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SortedSetTests), 0, (GInstanceInitFunc) sorted_set_tests_instance_init, NULL }; + GType sorted_set_tests_type_id; + sorted_set_tests_type_id = g_type_register_static (TYPE_SET_TESTS, "SortedSetTests", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); + g_once_init_leave (&sorted_set_tests_type_id__volatile, sorted_set_tests_type_id); + } + return sorted_set_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testsortedset.vala b/tests/testsortedset.vala new file mode 100644 index 0000000..a5172b4 --- /dev/null +++ b/tests/testsortedset.vala @@ -0,0 +1,979 @@ +/* testsortedset.vala + * + * Copyright (C) 2009 Maciej Piechotka + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Maciej Piechotka <uzytkownik2@gmail.com> + */ + +using GLib; +using Gee; + +public abstract class SortedSetTests : SetTests { + + public SortedSetTests (string name) { + base (name); + add_test ("[SortedSet] first", test_first); + add_test ("[SortedSet] last", test_last); + add_test ("[SortedSet] ordering", test_ordering); + add_test ("[SortedSet] iterator at", test_iterator_at); + add_test ("[SortedSet] lower", test_lower); + add_test ("[SortedSet] higher", test_higher); + add_test ("[SortedSet] floor", test_floor); + add_test ("[SortedSet] ceil", test_ceil); + add_test ("[SortedSet] bi-directional iterators can go backward", + test_bidir_iterator_can_go_backward); + add_test ("[SortedSet] bi-directional iterators are mutable", + test_mutable_bidir_iterator); + add_test ("[SortedSet] bi-directional iterators can to end", + test_bidir_iterator_last); + get_suite ().add_suite (new SubSet (this, SubSet.Type.HEAD).get_suite ()); + get_suite ().add_suite (new SubSet (this, SubSet.Type.TAIL).get_suite ()); + get_suite ().add_suite (new SubSet (this, SubSet.Type.SUB).get_suite ()); + get_suite ().add_suite (new SubSet (this, SubSet.Type.EMPTY).get_suite ()); + } + + public void test_ordering () { + var test_set = test_collection as SortedSet<string>; + + // Check the set exists + assert (test_set != null); + + test_set.add ("one"); + test_set.add ("two"); + test_set.add ("three"); + test_set.add ("four"); + test_set.add ("five"); + test_set.add ("six"); + test_set.add ("seven"); + test_set.add ("eight"); + test_set.add ("nine"); + test_set.add ("ten"); + test_set.add ("eleven"); + test_set.add ("twelve"); + + Iterator<string> iterator = test_set.iterator (); + assert (iterator.next ()); + assert (iterator.get () == "eight"); + assert (iterator.next ()); + assert (iterator.get () == "eleven"); + assert (iterator.next ()); + assert (iterator.get () == "five"); + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.next ()); + assert (iterator.get () == "nine"); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.next ()); + assert (iterator.get () == "seven"); + assert (iterator.next ()); + assert (iterator.get () == "six"); + assert (iterator.next ()); + assert (iterator.get () == "ten"); + assert (iterator.next ()); + assert (iterator.get () == "three"); + assert (iterator.next ()); + assert (iterator.get () == "twelve"); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.next () == false); + } + + public void test_first () { + var test_set = test_collection as SortedSet<string>; + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_set.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.first () == "five"); + } + + public void test_last () { + var test_set = test_collection as SortedSet<string>; + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + test_set.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.last () == "two"); + } + + public void test_iterator_at () { + var test_set = test_collection as SortedSet<string>; + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + + var iter = test_set.iterator_at ("one"); + assert (iter != null); + assert (iter.get () == "one"); + + iter = test_set.iterator_at ("two"); + assert (iter != null); + assert (iter.get () == "two"); + + iter = test_set.iterator_at ("three"); + assert (iter != null); + assert (iter.get () == "three"); + + iter = test_set.iterator_at ("zero"); + assert (iter == null); + } + + public void test_lower () { + var test_set = test_collection as SortedSet<string>; + + assert (test_set.lower ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.lower ("one") == "four"); + assert (test_set.lower ("o") == "four"); + assert (test_set.lower ("two") == "three"); + assert (test_set.lower ("t") == "six"); + assert (test_set.lower ("three") == "six"); + assert (test_set.lower ("four") == "five"); + assert (test_set.lower ("f") == null); + assert (test_set.lower ("five") == null); + assert (test_set.lower ("six") == "one"); + assert (test_set.lower ("s") == "one"); + } + + public void test_higher () { + var test_set = test_collection as SortedSet<string>; + + assert (test_set.higher ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.higher ("one") == "six"); + assert (test_set.higher ("o") == "one"); + assert (test_set.higher ("two") == null); + assert (test_set.higher ("t") == "three"); + assert (test_set.higher ("three") == "two"); + assert (test_set.higher ("four") == "one"); + assert (test_set.higher ("f") == "five"); + assert (test_set.higher ("five") == "four"); + assert (test_set.higher ("six") == "three"); + assert (test_set.higher ("s") == "six"); + } + + public void test_floor () { + var test_set = test_collection as SortedSet<string>; + + assert (test_set.floor ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.floor ("one") == "one"); + assert (test_set.floor ("o") == "four"); + assert (test_set.floor ("two") == "two"); + assert (test_set.floor ("t") == "six"); + assert (test_set.floor ("three") == "three"); + assert (test_set.floor ("four") == "four"); + assert (test_set.floor ("f") == null); + assert (test_set.floor ("five") == "five"); + assert (test_set.floor ("six") == "six"); + assert (test_set.floor ("s") == "one"); + } + + public void test_ceil () { + var test_set = test_collection as SortedSet<string>; + + assert (test_set.ceil ("one") == null); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + assert (test_set.ceil ("one") == "one"); + assert (test_set.ceil ("o") == "one"); + assert (test_set.ceil ("two") == "two"); + assert (test_set.ceil ("t") == "three"); + assert (test_set.ceil ("three") == "three"); + assert (test_set.ceil ("four") == "four"); + assert (test_set.ceil ("f") == "five"); + assert (test_set.ceil ("five") == "five"); + assert (test_set.ceil ("six") == "six"); + assert (test_set.ceil ("s") == "six"); + } + + public void test_bidir_iterator_can_go_backward () { + var test_set = test_collection as SortedSet<string>; + + var iterator = test_set.bidir_iterator (); + assert (!iterator.has_previous ()); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + iterator = test_set.bidir_iterator (); + assert (iterator.next ()); + assert (iterator.get () == "five"); + assert (!iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "six"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "three"); + assert (iterator.has_previous ()); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.has_previous ()); + assert (!iterator.next ()); + assert (iterator.previous ()); + assert (iterator.get () == "three"); + assert (iterator.previous ()); + assert (iterator.get () == "six"); + assert (iterator.previous ()); + assert (iterator.get () == "one"); + assert (iterator.previous ()); + assert (iterator.get () == "four"); + assert (iterator.previous ()); + assert (iterator.get () == "five"); + assert (!iterator.previous ()); + assert (iterator.get () == "five"); + } + + public void test_bidir_iterator_last () { + var test_set = test_collection as SortedSet<string>; + + var iterator = test_set.bidir_iterator (); + + assert (!iterator.last ()); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + iterator = test_set.bidir_iterator (); + assert (iterator.last ()); + assert (iterator.get () == "two"); + } + + public void test_mutable_bidir_iterator () { + var test_set = test_collection as SortedSet<string>; + + var iterator = test_set.bidir_iterator (); + assert (!iterator.has_previous ()); + + assert (test_set.add ("one")); + assert (test_set.add ("two")); + assert (test_set.add ("three")); + assert (test_set.add ("four")); + assert (test_set.add ("five")); + assert (test_set.add ("six")); + + iterator = test_set.bidir_iterator (); + + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + + assert (iterator.next ()); + assert (iterator.get () == "five"); + iterator.remove (); + assert (!test_set.contains ("five")); + assert (iterator.has_next ()); + assert (!iterator.has_previous ()); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iterator.get (); + Posix.exit (0); + } + assert (!iterator.previous ()); + + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.next ()); + assert (iterator.get () == "one"); + iterator.remove (); + assert (!test_set.contains ("one")); + assert (iterator.has_next ()); + assert (iterator.has_previous ()); + assert (iterator.previous ()); + assert (iterator.get () == "four"); + } + + public class SubSet : Gee.TestCase { + private SortedSet<string> master; + private SortedSet<string> subset; + private SortedSetTests test; + public enum Type { + HEAD, + TAIL, + SUB, + EMPTY; + public unowned string to_string () { + switch (this) { + case Type.HEAD: return "Head"; + case Type.TAIL: return "Tail"; + case Type.SUB: return "Range"; + case Type.EMPTY: return "Empty"; + default: assert_not_reached (); + } + } + } + private Type type; + + public SubSet (SortedSetTests test, Type type) { + base ("%s Subset".printf (type.to_string ())); + this.test = test; + this.type = type; + add_test ("[Collection] size", test_size); + add_test ("[Collection] contains", test_contains); + add_test ("[Collection] add", test_add); + add_test ("[Collection] remove", test_remove); + add_test ("[Collection] iterator", test_iterator); + add_test ("[Collection] clear", test_clear); + add_test ("[SortedSet] iterator at", test_iterator_at); + add_test ("[SortedSet] lower", test_lower); + add_test ("[SortedSet] higher", test_higher); + add_test ("[SortedSet] ceil", test_ceil); + add_test ("[SortedSet] floor", test_floor); + add_test ("[SortedSet] subsets", test_subsets); + add_test ("[SortedSet] boundaries", test_boundaries); + } + + public override void set_up () { + test.set_up (); + master = test.test_collection as SortedSet<string>; + switch (type) { + case Type.HEAD: + subset = master.head_set ("one"); break; + case Type.TAIL: + subset = master.tail_set ("six"); break; + case Type.SUB: + subset = master.sub_set ("four", "three"); break; + case Type.EMPTY: + subset = master.sub_set ("three", "four"); break; + default: + assert_not_reached (); + } + } + + public override void tear_down () { + test.tear_down (); + } + + public void test_size () { + assert (subset.is_empty); + assert (subset.size == 0); + + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (!subset.is_empty); + assert (subset.size == 2); + break; + case Type.TAIL: + assert (!subset.is_empty); + assert (subset.size == 3); + break; + case Type.SUB: + assert (!subset.is_empty); + assert (subset.size == 3); + break; + case Type.EMPTY: + assert (subset.is_empty); + assert (subset.size == 0); + break; + default: + assert_not_reached (); + } + } + + public void test_contains () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in contains) + assert (subset.contains (s)); + foreach (var s in not_contains) + assert (!subset.contains (s)); + } + + public void test_add () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] success, fail; + switch (type) { + case Type.HEAD: + success = {"a", "o"}; + fail = {"oz", "z"}; + break; + case Type.TAIL: + success = {"siz", "z"}; + fail = {"sia", "a"}; + break; + case Type.SUB: + success = {"o", "th"}; + fail = {"f", "u"}; + break; + case Type.EMPTY: + success = {}; + fail = {"o", "th", "f", "u"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in success) { + assert (subset.add (s)); + assert (subset.contains (s)); + assert (master.contains (s)); + } + + foreach (var s in fail) { + assert (!subset.add (s)); + assert (!subset.contains (s)); + assert (!master.contains (s)); + } + + assert (master.size == 6 + success.length); + } + + public void test_remove () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in contains) { + assert (subset.remove (s)); + assert (!master.contains (s)); + } + foreach (var s in not_contains) { + assert (!subset.remove (s)); + assert (master.contains (s)); + } + + assert (master.size == 6 - contains.length); + } + + public void test_iterator () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains; + switch (type) { + case Type.HEAD: + contains = {"five", "four"}; + break; + case Type.TAIL: + contains = {"six", "three", "two"}; + break; + case Type.SUB: + contains = {"four", "one", "six"}; + break; + case Type.EMPTY: + contains = {}; + break; + default: + assert_not_reached (); + } + + uint i = 0; + foreach (var e in subset) { + assert (e == contains[i++]); + } + assert (i == contains.length); + + + var iter = subset.bidir_iterator (); + if (type != Type.EMPTY) { + assert (iter.last ()); + assert (iter.get () == contains[contains.length - 1]); + assert (iter.first ()); + + assert (iter.get () == contains[0]); + assert (iter.has_next ()); + assert (iter.next ()); + assert (iter.get () == contains[1]); + assert (iter.has_previous ()); + iter.remove (); + assert (iter.has_previous ()); + if (type != Type.HEAD) + assert (iter.has_next ()); + else + assert (!iter.has_next ()); + assert (iter.previous ()); + assert (iter.get () == contains[0]); + } else { + assert (!iter.first ()); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + iter.remove (); + Posix.exit (0); + } + Test.trap_assert_failed (); + } + } + + public void test_clear () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + subset.clear (); + foreach (var s in contains) + assert (!master.contains (s)); + foreach (var s in not_contains) + assert (master.contains (s)); + } + + public void test_boundaries () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.first () == "five"); + assert (subset.last () == "four"); + break; + case Type.TAIL: + assert (subset.first () == "six"); + assert (subset.last () == "two"); + break; + case Type.SUB: + assert (subset.first () == "four"); + assert (subset.last () == "six"); + break; + case Type.EMPTY: + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + subset.first (); + Posix.exit (0); + } + Test.trap_assert_failed (); + if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | + TestTrapFlags.SILENCE_STDERR)) { + subset.last (); + Posix.exit (0); + } + Test.trap_assert_failed (); + break; + default: + assert_not_reached (); + } + } + + public void test_iterator_at () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + string[] contains, not_contains; + switch (type) { + case Type.HEAD: + contains = {"four", "five"}; + not_contains = {"one", "two", "three", "six"}; + break; + case Type.TAIL: + contains = {"two", "three", "six"}; + not_contains = {"one", "four", "five"}; + break; + case Type.SUB: + contains = {"one", "four", "six"}; + not_contains = {"two", "three", "five"}; + break; + case Type.EMPTY: + contains = {}; + not_contains = {"one", "two", "three", "four", "five", "six"}; + break; + default: + assert_not_reached (); + } + + foreach (var s in contains) { + var iter = subset.iterator_at (s); + assert (iter != null); + assert (iter.get () == s); + } + foreach (var s in not_contains) { + var iter = subset.iterator_at (s); + assert (iter == null); + } + } + + public void test_lower () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.lower ("a") == null); + assert (subset.lower ("five") == null); + assert (subset.lower ("four") == "five"); + assert (subset.lower ("six") == "four"); + break; + case Type.TAIL: + assert (subset.lower ("one") == null); + assert (subset.lower ("six") == null); + assert (subset.lower ("three") == "six"); + assert (subset.lower ("two") == "three"); + assert (subset.lower ("z") == "two"); + break; + case Type.SUB: + assert (subset.lower ("five") == null); + assert (subset.lower ("four") == null); + assert (subset.lower ("one") == "four"); + assert (subset.lower ("six") == "one"); + assert (subset.lower ("three") == "six"); + break; + case Type.EMPTY: + assert (subset.lower ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_higher () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.higher ("a") == "five"); + assert (subset.higher ("five") == "four"); + assert (subset.higher ("four") == null); + assert (subset.higher ("six") == null); + break; + case Type.TAIL: + assert (subset.higher ("one") == "six"); + assert (subset.higher ("six") == "three"); + assert (subset.higher ("three") == "two"); + assert (subset.higher ("two") == null); + assert (subset.higher ("z") == null); + break; + case Type.SUB: + assert (subset.higher ("five") == "four"); + assert (subset.higher ("four") == "one"); + assert (subset.higher ("one") == "six"); + assert (subset.higher ("six") == null); + assert (subset.higher ("three") == null); + break; + case Type.EMPTY: + assert (subset.higher ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_floor () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.floor ("a") == null); + assert (subset.floor ("five") == "five"); + assert (subset.floor ("four") == "four"); + assert (subset.floor ("six") == "four"); + break; + case Type.TAIL: + assert (subset.floor ("one") == null); + assert (subset.floor ("six") == "six"); + assert (subset.floor ("three") == "three"); + assert (subset.floor ("two") == "two"); + assert (subset.floor ("z") == "two"); + break; + case Type.SUB: + assert (subset.floor ("five") == null); + assert (subset.floor ("four") == "four"); + assert (subset.floor ("one") == "one"); + assert (subset.floor ("six") == "six"); + assert (subset.floor ("three") == "six"); + break; + case Type.EMPTY: + assert (subset.floor ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_ceil () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + assert (subset.ceil ("a") == "five"); + assert (subset.ceil ("five") == "five"); + assert (subset.ceil ("four") == "four"); + assert (subset.ceil ("six") == null); + break; + case Type.TAIL: + assert (subset.ceil ("one") == "six"); + assert (subset.ceil ("six") == "six"); + assert (subset.ceil ("three") == "three"); + assert (subset.ceil ("two") == "two"); + assert (subset.ceil ("z") == null); + break; + case Type.SUB: + assert (subset.ceil ("five") == "four"); + assert (subset.ceil ("four") == "four"); + assert (subset.ceil ("one") == "one"); + assert (subset.ceil ("six") == "six"); + assert (subset.ceil ("three") == null); + break; + case Type.EMPTY: + assert (subset.ceil ("six") == null); + break; + default: + assert_not_reached (); + } + } + + public void test_subsets () { + assert (master.add ("one")); + assert (master.add ("two")); + assert (master.add ("three")); + assert (master.add ("four")); + assert (master.add ("five")); + assert (master.add ("six")); + assert (master.size == 6); + + switch (type) { + case Type.HEAD: + var subsubset = subset.head_set ("four"); + assert (subsubset.size == 1); + subsubset = subset.tail_set ("four"); + assert (subsubset.size == 1); + subsubset = subset.sub_set ("four", "one"); + assert (subsubset.size == 1); + subsubset = subset.sub_set ("four", "four"); + assert (subsubset.size == 0); + break; + case Type.TAIL: + var subsubset = subset.head_set ("two"); + assert (subsubset.size == 2); + subsubset = subset.tail_set ("three"); + assert (subsubset.size == 2); + subsubset = subset.sub_set ("three", "two"); + assert (subsubset.size == 1); + break; + case Type.SUB: + var subsubset = subset.head_set ("six"); + assert (subsubset.size == 2); + subsubset = subset.tail_set ("one"); + assert (subsubset.size == 2); + subsubset = subset.sub_set ("one", "six"); + assert (subsubset.size == 1); + subsubset = subset.sub_set ("five", "two"); + assert (subsubset.size == 3); + break; + case Type.EMPTY: + var subsubset = subset.head_set ("six"); + assert (subsubset.size == 0); + subsubset = subset.tail_set ("three"); + assert (subsubset.size == 0); + subsubset = subset.sub_set ("one", "six"); + assert (subsubset.size == 0); + break; + default: + assert_not_reached (); + } + } + } +} + diff --git a/tests/testtreemap.c b/tests/testtreemap.c new file mode 100644 index 0000000..6e5b107 --- /dev/null +++ b/tests/testtreemap.c @@ -0,0 +1,422 @@ +/* testtreemap.c generated by valac 0.18.0, the Vala compiler + * generated from testtreemap.vala, do not modify */ + +/* testtreemap.vala + * + * Copyright (C) 2008 Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MAP_TESTS (map_tests_get_type ()) +#define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests)) +#define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass)) +#define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS)) +#define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS)) +#define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass)) + +typedef struct _MapTests MapTests; +typedef struct _MapTestsClass MapTestsClass; +typedef struct _MapTestsPrivate MapTestsPrivate; + +#define TYPE_TREE_MAP_TESTS (tree_map_tests_get_type ()) +#define TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MAP_TESTS, TreeMapTests)) +#define TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) +#define IS_TREE_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MAP_TESTS)) +#define IS_TREE_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MAP_TESTS)) +#define TREE_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MAP_TESTS, TreeMapTestsClass)) + +typedef struct _TreeMapTests TreeMapTests; +typedef struct _TreeMapTestsClass TreeMapTestsClass; +typedef struct _TreeMapTestsPrivate TreeMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MapTests { + GeeTestCase parent_instance; + MapTestsPrivate * priv; + GeeMap* test_map; +}; + +struct _MapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _TreeMapTests { + MapTests parent_instance; + TreeMapTestsPrivate * priv; +}; + +struct _TreeMapTestsClass { + MapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType map_tests_get_type (void) G_GNUC_CONST; +GType tree_map_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_MAP_TESTS_DUMMY_PROPERTY +}; +TreeMapTests* tree_map_tests_new (void); +TreeMapTests* tree_map_tests_construct (GType object_type); +MapTests* map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void tree_map_tests_test_selected_functions (TreeMapTests* self); +static void _tree_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void tree_map_tests_test_gobject_properties (TreeMapTests* self); +static void _tree_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +void tree_map_tests_test_key_ordering (TreeMapTests* self); +static void _tree_map_tests_test_key_ordering_gee_test_case_test_method (gpointer self); +static void tree_map_tests_real_set_up (GeeTestCase* base); +static void tree_map_tests_real_tear_down (GeeTestCase* base); + + +static void _tree_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_map_tests_test_selected_functions (self); +} + + +static void _tree_map_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + tree_map_tests_test_gobject_properties (self); +} + + +static void _tree_map_tests_test_key_ordering_gee_test_case_test_method (gpointer self) { + tree_map_tests_test_key_ordering (self); +} + + +TreeMapTests* tree_map_tests_construct (GType object_type) { + TreeMapTests * self = NULL; + self = (TreeMapTests*) map_tests_construct (object_type, "TreeMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMap] selected functions", _tree_map_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMap] GObject properties", _tree_map_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMap] key ordering", _tree_map_tests_test_key_ordering_gee_test_case_test_method, self); + return self; +} + + +TreeMapTests* tree_map_tests_new (void) { + return tree_map_tests_construct (TYPE_TREE_MAP_TESTS); +} + + +static void tree_map_tests_real_set_up (GeeTestCase* base) { + TreeMapTests * self; + GeeTreeMap* _tmp0_; + self = (TreeMapTests*) base; + _tmp0_ = gee_tree_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = (GeeMap*) _tmp0_; +} + + +static void tree_map_tests_real_tear_down (GeeTestCase* base) { + TreeMapTests * self; + self = (TreeMapTests*) base; + _g_object_unref0 (((MapTests*) self)->test_map); + ((MapTests*) self)->test_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void tree_map_tests_test_selected_functions (TreeMapTests* self) { + GeeMap* _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* test_tree_map; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + GEqualFunc _tmp5_; + GEqualFunc _tmp6_; + GEqualFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MAP) ? ((GeeTreeMap*) _tmp0_) : NULL); + test_tree_map = _tmp1_; + _vala_assert (test_tree_map != NULL, "test_tree_map != null"); + _tmp2_ = gee_tree_map_get_key_compare_func (test_tree_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_tree_map.key_compare_func == (CompareFunc) strcmp"); + _tmp5_ = gee_tree_map_get_value_equal_func (test_tree_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_str_equal; + _vala_assert (_tmp6_ == _tmp7_, "test_tree_map.value_equal_func == str_equal"); + _g_object_unref0 (test_tree_map); +} + + +void tree_map_tests_test_gobject_properties (TreeMapTests* self) { + GeeMap* _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* test_tree_map; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + GValue _tmp7_ = {0}; + GValue _tmp8_; + void* _tmp9_ = NULL; + GEqualFunc _tmp10_; + GEqualFunc _tmp11_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MAP) ? ((GeeTreeMap*) _tmp0_) : NULL); + test_tree_map = _tmp1_; + _vala_assert (test_tree_map != NULL, "test_tree_map != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_tree_map, "key-compare-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_tree_map_get_key_compare_func (test_tree_map); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_tree_map.key_compare_func"); + g_value_unset (&value); + g_value_init (&_tmp7_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp7_; + _tmp8_ = value; + g_object_get_property ((GObject*) test_tree_map, "value-equal-func", &value); + _tmp9_ = g_value_get_pointer (&value); + _tmp10_ = gee_tree_map_get_value_equal_func (test_tree_map); + _tmp11_ = _tmp10_; + _vala_assert (_tmp9_ == ((void*) _tmp11_), "value.get_pointer () == (void*) test_tree_map.value_equal_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_tree_map); +} + + +void tree_map_tests_test_key_ordering (TreeMapTests* self) { + GeeMap* _tmp0_; + GeeTreeMap* _tmp1_; + GeeTreeMap* test_tree_map; + GeeSet* _tmp2_; + GeeSet* _tmp3_; + GeeSet* _tmp4_; + GeeIterator* _tmp5_ = NULL; + GeeIterator* _tmp6_; + GeeIterator* iterator; + gboolean _tmp7_ = FALSE; + gpointer _tmp8_ = NULL; + gchar* _tmp9_; + gboolean _tmp10_ = FALSE; + gpointer _tmp11_ = NULL; + gchar* _tmp12_; + gboolean _tmp13_ = FALSE; + gpointer _tmp14_ = NULL; + gchar* _tmp15_; + gboolean _tmp16_ = FALSE; + gpointer _tmp17_ = NULL; + gchar* _tmp18_; + gboolean _tmp19_ = FALSE; + gpointer _tmp20_ = NULL; + gchar* _tmp21_; + gboolean _tmp22_ = FALSE; + gpointer _tmp23_ = NULL; + gchar* _tmp24_; + gboolean _tmp25_ = FALSE; + gpointer _tmp26_ = NULL; + gchar* _tmp27_; + gboolean _tmp28_ = FALSE; + gpointer _tmp29_ = NULL; + gchar* _tmp30_; + gboolean _tmp31_ = FALSE; + gpointer _tmp32_ = NULL; + gchar* _tmp33_; + gboolean _tmp34_ = FALSE; + gpointer _tmp35_ = NULL; + gchar* _tmp36_; + gboolean _tmp37_ = FALSE; + gpointer _tmp38_ = NULL; + gchar* _tmp39_; + gboolean _tmp40_ = FALSE; + gpointer _tmp41_ = NULL; + gchar* _tmp42_; + gboolean _tmp43_ = FALSE; + g_return_if_fail (self != NULL); + _tmp0_ = ((MapTests*) self)->test_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MAP) ? ((GeeTreeMap*) _tmp0_) : NULL); + test_tree_map = _tmp1_; + _vala_assert (test_tree_map != NULL, "test_tree_map != null"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "one", "one"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "two", "two"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "three", "three"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "four", "four"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "five", "five"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "six", "six"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "seven", "seven"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "eight", "eight"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "nine", "nine"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "ten", "ten"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "eleven", "eleven"); + gee_abstract_map_set ((GeeAbstractMap*) test_tree_map, "twelve", "twelve"); + _tmp2_ = gee_abstract_map_get_keys ((GeeMap*) test_tree_map); + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_; + _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_); + _tmp6_ = _tmp5_; + _g_object_unref0 (_tmp4_); + iterator = _tmp6_; + _tmp7_ = gee_iterator_next (iterator); + _vala_assert (_tmp7_, "iterator.next ()"); + _tmp8_ = gee_iterator_get (iterator); + _tmp9_ = (gchar*) _tmp8_; + _vala_assert (g_strcmp0 (_tmp9_, "eight") == 0, "iterator.get () == \"eight\""); + _g_free0 (_tmp9_); + _tmp10_ = gee_iterator_next (iterator); + _vala_assert (_tmp10_, "iterator.next ()"); + _tmp11_ = gee_iterator_get (iterator); + _tmp12_ = (gchar*) _tmp11_; + _vala_assert (g_strcmp0 (_tmp12_, "eleven") == 0, "iterator.get () == \"eleven\""); + _g_free0 (_tmp12_); + _tmp13_ = gee_iterator_next (iterator); + _vala_assert (_tmp13_, "iterator.next ()"); + _tmp14_ = gee_iterator_get (iterator); + _tmp15_ = (gchar*) _tmp14_; + _vala_assert (g_strcmp0 (_tmp15_, "five") == 0, "iterator.get () == \"five\""); + _g_free0 (_tmp15_); + _tmp16_ = gee_iterator_next (iterator); + _vala_assert (_tmp16_, "iterator.next ()"); + _tmp17_ = gee_iterator_get (iterator); + _tmp18_ = (gchar*) _tmp17_; + _vala_assert (g_strcmp0 (_tmp18_, "four") == 0, "iterator.get () == \"four\""); + _g_free0 (_tmp18_); + _tmp19_ = gee_iterator_next (iterator); + _vala_assert (_tmp19_, "iterator.next ()"); + _tmp20_ = gee_iterator_get (iterator); + _tmp21_ = (gchar*) _tmp20_; + _vala_assert (g_strcmp0 (_tmp21_, "nine") == 0, "iterator.get () == \"nine\""); + _g_free0 (_tmp21_); + _tmp22_ = gee_iterator_next (iterator); + _vala_assert (_tmp22_, "iterator.next ()"); + _tmp23_ = gee_iterator_get (iterator); + _tmp24_ = (gchar*) _tmp23_; + _vala_assert (g_strcmp0 (_tmp24_, "one") == 0, "iterator.get () == \"one\""); + _g_free0 (_tmp24_); + _tmp25_ = gee_iterator_next (iterator); + _vala_assert (_tmp25_, "iterator.next ()"); + _tmp26_ = gee_iterator_get (iterator); + _tmp27_ = (gchar*) _tmp26_; + _vala_assert (g_strcmp0 (_tmp27_, "seven") == 0, "iterator.get () == \"seven\""); + _g_free0 (_tmp27_); + _tmp28_ = gee_iterator_next (iterator); + _vala_assert (_tmp28_, "iterator.next ()"); + _tmp29_ = gee_iterator_get (iterator); + _tmp30_ = (gchar*) _tmp29_; + _vala_assert (g_strcmp0 (_tmp30_, "six") == 0, "iterator.get () == \"six\""); + _g_free0 (_tmp30_); + _tmp31_ = gee_iterator_next (iterator); + _vala_assert (_tmp31_, "iterator.next ()"); + _tmp32_ = gee_iterator_get (iterator); + _tmp33_ = (gchar*) _tmp32_; + _vala_assert (g_strcmp0 (_tmp33_, "ten") == 0, "iterator.get () == \"ten\""); + _g_free0 (_tmp33_); + _tmp34_ = gee_iterator_next (iterator); + _vala_assert (_tmp34_, "iterator.next ()"); + _tmp35_ = gee_iterator_get (iterator); + _tmp36_ = (gchar*) _tmp35_; + _vala_assert (g_strcmp0 (_tmp36_, "three") == 0, "iterator.get () == \"three\""); + _g_free0 (_tmp36_); + _tmp37_ = gee_iterator_next (iterator); + _vala_assert (_tmp37_, "iterator.next ()"); + _tmp38_ = gee_iterator_get (iterator); + _tmp39_ = (gchar*) _tmp38_; + _vala_assert (g_strcmp0 (_tmp39_, "twelve") == 0, "iterator.get () == \"twelve\""); + _g_free0 (_tmp39_); + _tmp40_ = gee_iterator_next (iterator); + _vala_assert (_tmp40_, "iterator.next ()"); + _tmp41_ = gee_iterator_get (iterator); + _tmp42_ = (gchar*) _tmp41_; + _vala_assert (g_strcmp0 (_tmp42_, "two") == 0, "iterator.get () == \"two\""); + _g_free0 (_tmp42_); + _tmp43_ = gee_iterator_next (iterator); + _vala_assert (_tmp43_ == FALSE, "iterator.next () == false"); + _g_object_unref0 (iterator); + _g_object_unref0 (test_tree_map); +} + + +static void tree_map_tests_class_init (TreeMapTestsClass * klass) { + tree_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_map_tests_real_tear_down; +} + + +static void tree_map_tests_instance_init (TreeMapTests * self) { +} + + +GType tree_map_tests_get_type (void) { + static volatile gsize tree_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeMapTests), 0, (GInstanceInitFunc) tree_map_tests_instance_init, NULL }; + GType tree_map_tests_type_id; + tree_map_tests_type_id = g_type_register_static (TYPE_MAP_TESTS, "TreeMapTests", &g_define_type_info, 0); + g_once_init_leave (&tree_map_tests_type_id__volatile, tree_map_tests_type_id); + } + return tree_map_tests_type_id__volatile; +} + + + diff --git a/tests/testtreemap.vala b/tests/testtreemap.vala new file mode 100644 index 0000000..993c67e --- /dev/null +++ b/tests/testtreemap.vala @@ -0,0 +1,118 @@ +/* testtreemap.vala + * + * Copyright (C) 2008 Maciej Piechotka + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class TreeMapTests : MapTests { + + public TreeMapTests () { + base ("TreeMap"); + add_test ("[TreeMap] selected functions", test_selected_functions); + add_test ("[TreeMap] GObject properties", test_gobject_properties); + add_test ("[TreeMap] key ordering", test_key_ordering); + } + + public override void set_up () { + test_map = new TreeMap<string,string> (); + } + + public override void tear_down () { + test_map = null; + } + + public void test_selected_functions () { + var test_tree_map = test_map as TreeMap<string,string>; + + // Check the map exists + assert (test_tree_map != null); + + // Check the selected compare and equal functions + assert (test_tree_map.key_compare_func == (CompareFunc) strcmp); + assert (test_tree_map.value_equal_func == str_equal); + } + + public new void test_gobject_properties () { + var test_tree_map = test_map as TreeMap<string,string>; + + // Check the list exists + assert (test_tree_map != null); + Value value; + + value = Value (typeof (CompareFunc)); + test_tree_map.get_property ("key-compare-func", ref value); + assert (value.get_pointer () == (void*) test_tree_map.key_compare_func); + value.unset (); + + value = Value (typeof (EqualFunc)); + test_tree_map.get_property ("value-equal-func", ref value); + assert (value.get_pointer () == (void*) test_tree_map.value_equal_func); + value.unset (); + } + + public void test_key_ordering () { + var test_tree_map = test_map as TreeMap<string,string>; + + // Check the map exists + assert (test_tree_map != null); + + test_tree_map.set ("one", "one"); + test_tree_map.set ("two", "two"); + test_tree_map.set ("three", "three"); + test_tree_map.set ("four", "four"); + test_tree_map.set ("five", "five"); + test_tree_map.set ("six", "six"); + test_tree_map.set ("seven", "seven"); + test_tree_map.set ("eight", "eight"); + test_tree_map.set ("nine", "nine"); + test_tree_map.set ("ten", "ten"); + test_tree_map.set ("eleven", "eleven"); + test_tree_map.set ("twelve", "twelve"); + + Iterator<string> iterator = test_tree_map.keys.iterator (); + assert (iterator.next ()); + assert (iterator.get () == "eight"); + assert (iterator.next ()); + assert (iterator.get () == "eleven"); + assert (iterator.next ()); + assert (iterator.get () == "five"); + assert (iterator.next ()); + assert (iterator.get () == "four"); + assert (iterator.next ()); + assert (iterator.get () == "nine"); + assert (iterator.next ()); + assert (iterator.get () == "one"); + assert (iterator.next ()); + assert (iterator.get () == "seven"); + assert (iterator.next ()); + assert (iterator.get () == "six"); + assert (iterator.next ()); + assert (iterator.get () == "ten"); + assert (iterator.next ()); + assert (iterator.get () == "three"); + assert (iterator.next ()); + assert (iterator.get () == "twelve"); + assert (iterator.next ()); + assert (iterator.get () == "two"); + assert (iterator.next () == false); + } +} diff --git a/tests/testtreemultimap.c b/tests/testtreemultimap.c new file mode 100644 index 0000000..6959a1a --- /dev/null +++ b/tests/testtreemultimap.c @@ -0,0 +1,212 @@ +/* testtreemultimap.c generated by valac 0.18.0, the Vala compiler + * generated from testtreemultimap.vala, do not modify */ + +/* testtreemultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ()) +#define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests)) +#define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) +#define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS)) +#define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS)) +#define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass)) + +typedef struct _MultiMapTests MultiMapTests; +typedef struct _MultiMapTestsClass MultiMapTestsClass; +typedef struct _MultiMapTestsPrivate MultiMapTestsPrivate; + +#define TYPE_TREE_MULTI_MAP_TESTS (tree_multi_map_tests_get_type ()) +#define TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTests)) +#define TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) +#define IS_TREE_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_MAP_TESTS)) +#define IS_TREE_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_MAP_TESTS)) +#define TREE_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_MAP_TESTS, TreeMultiMapTestsClass)) + +typedef struct _TreeMultiMapTests TreeMultiMapTests; +typedef struct _TreeMultiMapTestsClass TreeMultiMapTestsClass; +typedef struct _TreeMultiMapTestsPrivate TreeMultiMapTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _MultiMapTests { + GeeTestCase parent_instance; + MultiMapTestsPrivate * priv; + GeeMultiMap* test_multi_map; +}; + +struct _MultiMapTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _TreeMultiMapTests { + MultiMapTests parent_instance; + TreeMultiMapTestsPrivate * priv; +}; + +struct _TreeMultiMapTestsClass { + MultiMapTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_multi_map_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType multi_map_tests_get_type (void) G_GNUC_CONST; +GType tree_multi_map_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_MULTI_MAP_TESTS_DUMMY_PROPERTY +}; +TreeMultiMapTests* tree_multi_map_tests_new (void); +TreeMultiMapTests* tree_multi_map_tests_construct (GType object_type); +MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void tree_multi_map_tests_test_selected_functions (TreeMultiMapTests* self); +static void _tree_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void tree_multi_map_tests_real_set_up (GeeTestCase* base); +static void tree_multi_map_tests_real_tear_down (GeeTestCase* base); + + +static void _tree_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_multi_map_tests_test_selected_functions (self); +} + + +TreeMultiMapTests* tree_multi_map_tests_construct (GType object_type) { + TreeMultiMapTests * self = NULL; + self = (TreeMultiMapTests*) multi_map_tests_construct (object_type, "TreeMultiMap"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMultiMap] selected functions", _tree_multi_map_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +TreeMultiMapTests* tree_multi_map_tests_new (void) { + return tree_multi_map_tests_construct (TYPE_TREE_MULTI_MAP_TESTS); +} + + +static void tree_multi_map_tests_real_set_up (GeeTestCase* base) { + TreeMultiMapTests * self; + GeeTreeMultiMap* _tmp0_; + self = (TreeMultiMapTests*) base; + _tmp0_ = gee_tree_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = (GeeMultiMap*) _tmp0_; +} + + +static void tree_multi_map_tests_real_tear_down (GeeTestCase* base) { + TreeMultiMapTests * self; + self = (TreeMultiMapTests*) base; + _g_object_unref0 (((MultiMapTests*) self)->test_multi_map); + ((MultiMapTests*) self)->test_multi_map = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void tree_multi_map_tests_test_selected_functions (TreeMultiMapTests* self) { + GeeMultiMap* _tmp0_; + GeeTreeMultiMap* _tmp1_; + GeeTreeMultiMap* test_tree_multi_map; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + GCompareFunc _tmp7_; + g_return_if_fail (self != NULL); + _tmp0_ = ((MultiMapTests*) self)->test_multi_map; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MULTI_MAP) ? ((GeeTreeMultiMap*) _tmp0_) : NULL); + test_tree_multi_map = _tmp1_; + _vala_assert (test_tree_multi_map != NULL, "test_tree_multi_map != null"); + _tmp2_ = gee_tree_multi_map_get_key_compare_func (test_tree_multi_map); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_tree_multi_map.key_compare_func == (CompareFunc) strcmp"); + _tmp5_ = gee_tree_multi_map_get_value_compare_func (test_tree_multi_map); + _tmp6_ = _tmp5_; + _tmp7_ = g_strcmp0; + _vala_assert (_tmp6_ == ((GCompareFunc) _tmp7_), "test_tree_multi_map.value_compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_tree_multi_map); +} + + +static void tree_multi_map_tests_class_init (TreeMultiMapTestsClass * klass) { + tree_multi_map_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_multi_map_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_multi_map_tests_real_tear_down; +} + + +static void tree_multi_map_tests_instance_init (TreeMultiMapTests * self) { +} + + +GType tree_multi_map_tests_get_type (void) { + static volatile gsize tree_multi_map_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_multi_map_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeMultiMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_multi_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeMultiMapTests), 0, (GInstanceInitFunc) tree_multi_map_tests_instance_init, NULL }; + GType tree_multi_map_tests_type_id; + tree_multi_map_tests_type_id = g_type_register_static (TYPE_MULTI_MAP_TESTS, "TreeMultiMapTests", &g_define_type_info, 0); + g_once_init_leave (&tree_multi_map_tests_type_id__volatile, tree_multi_map_tests_type_id); + } + return tree_multi_map_tests_type_id__volatile; +} + + + diff --git a/tests/testtreemultimap.vala b/tests/testtreemultimap.vala new file mode 100644 index 0000000..34374a9 --- /dev/null +++ b/tests/testtreemultimap.vala @@ -0,0 +1,53 @@ +/* testtreemultimap.vala + * + * Copyright (C) 2008 Jürg Billeter + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Jürg Billeter <j@bitron.ch> + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class TreeMultiMapTests : MultiMapTests { + + public TreeMultiMapTests () { + base ("TreeMultiMap"); + add_test ("[TreeMultiMap] selected functions", test_selected_functions); + } + + public override void set_up () { + test_multi_map = new TreeMultiMap<string,string> (); + } + + public override void tear_down () { + test_multi_map = null; + } + + private void test_selected_functions () { + var test_tree_multi_map = test_multi_map as TreeMultiMap<string,string>; + + // Check the map exists + assert (test_tree_multi_map != null); + + // Check the selected compare functions + assert (test_tree_multi_map.key_compare_func == (CompareFunc) strcmp); + assert (test_tree_multi_map.value_compare_func == (CompareFunc) strcmp); + } +} diff --git a/tests/testtreemultiset.c b/tests/testtreemultiset.c new file mode 100644 index 0000000..212111f --- /dev/null +++ b/tests/testtreemultiset.c @@ -0,0 +1,223 @@ +/* testtreemultiset.c generated by valac 0.18.0, the Vala compiler + * generated from testtreemultiset.vala, do not modify */ + +/* testtreemultiset.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_MULTI_SET_TESTS (multi_set_tests_get_type ()) +#define MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_SET_TESTS, MultiSetTests)) +#define MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) +#define IS_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_SET_TESTS)) +#define IS_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_SET_TESTS)) +#define MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_SET_TESTS, MultiSetTestsClass)) + +typedef struct _MultiSetTests MultiSetTests; +typedef struct _MultiSetTestsClass MultiSetTestsClass; +typedef struct _MultiSetTestsPrivate MultiSetTestsPrivate; + +#define TYPE_TREE_MULTI_SET_TESTS (tree_multi_set_tests_get_type ()) +#define TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTests)) +#define TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) +#define IS_TREE_MULTI_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_MULTI_SET_TESTS)) +#define IS_TREE_MULTI_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_MULTI_SET_TESTS)) +#define TREE_MULTI_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_MULTI_SET_TESTS, TreeMultiSetTestsClass)) + +typedef struct _TreeMultiSetTests TreeMultiSetTests; +typedef struct _TreeMultiSetTestsClass TreeMultiSetTestsClass; +typedef struct _TreeMultiSetTestsPrivate TreeMultiSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _MultiSetTests { + CollectionTests parent_instance; + MultiSetTestsPrivate * priv; +}; + +struct _MultiSetTestsClass { + CollectionTestsClass parent_class; +}; + +struct _TreeMultiSetTests { + MultiSetTests parent_instance; + TreeMultiSetTestsPrivate * priv; +}; + +struct _TreeMultiSetTestsClass { + MultiSetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_multi_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType multi_set_tests_get_type (void) G_GNUC_CONST; +GType tree_multi_set_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_MULTI_SET_TESTS_DUMMY_PROPERTY +}; +TreeMultiSetTests* tree_multi_set_tests_new (void); +TreeMultiSetTests* tree_multi_set_tests_construct (GType object_type); +MultiSetTests* multi_set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +static void tree_multi_set_tests_test_selected_functions (TreeMultiSetTests* self); +static void _tree_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +static void tree_multi_set_tests_real_set_up (GeeTestCase* base); +static void tree_multi_set_tests_real_tear_down (GeeTestCase* base); + + +static void _tree_multi_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_multi_set_tests_test_selected_functions (self); +} + + +TreeMultiSetTests* tree_multi_set_tests_construct (GType object_type) { + TreeMultiSetTests * self = NULL; + self = (TreeMultiSetTests*) multi_set_tests_construct (object_type, "TreeMultiSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeMultiSet] selected functions", _tree_multi_set_tests_test_selected_functions_gee_test_case_test_method, self); + return self; +} + + +TreeMultiSetTests* tree_multi_set_tests_new (void) { + return tree_multi_set_tests_construct (TYPE_TREE_MULTI_SET_TESTS); +} + + +static void tree_multi_set_tests_real_set_up (GeeTestCase* base) { + TreeMultiSetTests * self; + GeeTreeMultiSet* _tmp0_; + self = (TreeMultiSetTests*) base; + _tmp0_ = gee_tree_multi_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void tree_multi_set_tests_real_tear_down (GeeTestCase* base) { + TreeMultiSetTests * self; + self = (TreeMultiSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void tree_multi_set_tests_test_selected_functions (TreeMultiSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeMultiSet* _tmp1_; + GeeTreeMultiSet* test_multi_set; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_MULTI_SET) ? ((GeeTreeMultiSet*) _tmp0_) : NULL); + test_multi_set = _tmp1_; + _vala_assert (test_multi_set != NULL, "test_multi_set != null"); + _tmp2_ = gee_tree_multi_set_get_compare_func (test_multi_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_multi_set.compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_multi_set); +} + + +static void tree_multi_set_tests_class_init (TreeMultiSetTestsClass * klass) { + tree_multi_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_multi_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_multi_set_tests_real_tear_down; +} + + +static void tree_multi_set_tests_instance_init (TreeMultiSetTests * self) { +} + + +GType tree_multi_set_tests_get_type (void) { + static volatile gsize tree_multi_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_multi_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeMultiSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_multi_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeMultiSetTests), 0, (GInstanceInitFunc) tree_multi_set_tests_instance_init, NULL }; + GType tree_multi_set_tests_type_id; + tree_multi_set_tests_type_id = g_type_register_static (TYPE_MULTI_SET_TESTS, "TreeMultiSetTests", &g_define_type_info, 0); + g_once_init_leave (&tree_multi_set_tests_type_id__volatile, tree_multi_set_tests_type_id); + } + return tree_multi_set_tests_type_id__volatile; +} + + + diff --git a/tests/testtreemultiset.vala b/tests/testtreemultiset.vala new file mode 100644 index 0000000..da86ca2 --- /dev/null +++ b/tests/testtreemultiset.vala @@ -0,0 +1,49 @@ +/* testtreemultiset.vala + * + * Copyright (C) 2009 Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois <ptitjes@free.fr> + */ + +using Gee; + +public class TreeMultiSetTests : MultiSetTests { + + public TreeMultiSetTests () { + base ("TreeMultiSet"); + add_test ("[TreeMultiSet] selected functions", test_selected_functions); + } + + public override void set_up () { + test_collection = new TreeMultiSet<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + private void test_selected_functions () { + var test_multi_set = test_collection as TreeMultiSet<string>; + + // Check the collection exists + assert (test_multi_set != null); + + // Check the selected compare functions + assert (test_multi_set.compare_func == (CompareFunc) strcmp); + } +} diff --git a/tests/testtreeset.c b/tests/testtreeset.c new file mode 100644 index 0000000..81d757b --- /dev/null +++ b/tests/testtreeset.c @@ -0,0 +1,720 @@ +/* testtreeset.c generated by valac 0.18.0, the Vala compiler + * generated from testtreeset.vala, do not modify */ + +/* testtreeset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +#include <glib.h> +#include <glib-object.h> +#include <gee.h> +#include <stdlib.h> +#include <string.h> + + +#define GEE_TYPE_TEST_CASE (gee_test_case_get_type ()) +#define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase)) +#define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) +#define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE)) +#define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE)) +#define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass)) + +typedef struct _GeeTestCase GeeTestCase; +typedef struct _GeeTestCaseClass GeeTestCaseClass; +typedef struct _GeeTestCasePrivate GeeTestCasePrivate; + +#define TYPE_COLLECTION_TESTS (collection_tests_get_type ()) +#define COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COLLECTION_TESTS, CollectionTests)) +#define COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COLLECTION_TESTS, CollectionTestsClass)) +#define IS_COLLECTION_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COLLECTION_TESTS)) +#define IS_COLLECTION_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COLLECTION_TESTS)) +#define COLLECTION_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_COLLECTION_TESTS, CollectionTestsClass)) + +typedef struct _CollectionTests CollectionTests; +typedef struct _CollectionTestsClass CollectionTestsClass; +typedef struct _CollectionTestsPrivate CollectionTestsPrivate; + +#define TYPE_SET_TESTS (set_tests_get_type ()) +#define SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SET_TESTS, SetTests)) +#define SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SET_TESTS, SetTestsClass)) +#define IS_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SET_TESTS)) +#define IS_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SET_TESTS)) +#define SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SET_TESTS, SetTestsClass)) + +typedef struct _SetTests SetTests; +typedef struct _SetTestsClass SetTestsClass; +typedef struct _SetTestsPrivate SetTestsPrivate; + +#define TYPE_SORTED_SET_TESTS (sorted_set_tests_get_type ()) +#define SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SORTED_SET_TESTS, SortedSetTests)) +#define SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) +#define IS_SORTED_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SORTED_SET_TESTS)) +#define IS_SORTED_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SORTED_SET_TESTS)) +#define SORTED_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SORTED_SET_TESTS, SortedSetTestsClass)) + +typedef struct _SortedSetTests SortedSetTests; +typedef struct _SortedSetTestsClass SortedSetTestsClass; +typedef struct _SortedSetTestsPrivate SortedSetTestsPrivate; + +#define TYPE_TREE_SET_TESTS (tree_set_tests_get_type ()) +#define TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TREE_SET_TESTS, TreeSetTests)) +#define TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) +#define IS_TREE_SET_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TREE_SET_TESTS)) +#define IS_TREE_SET_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TREE_SET_TESTS)) +#define TREE_SET_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TREE_SET_TESTS, TreeSetTestsClass)) + +typedef struct _TreeSetTests TreeSetTests; +typedef struct _TreeSetTestsClass TreeSetTestsClass; +typedef struct _TreeSetTestsPrivate TreeSetTestsPrivate; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); + +struct _GeeTestCase { + GObject parent_instance; + GeeTestCasePrivate * priv; +}; + +struct _GeeTestCaseClass { + GObjectClass parent_class; + void (*set_up) (GeeTestCase* self); + void (*tear_down) (GeeTestCase* self); +}; + +struct _CollectionTests { + GeeTestCase parent_instance; + CollectionTestsPrivate * priv; + GeeCollection* test_collection; +}; + +struct _CollectionTestsClass { + GeeTestCaseClass parent_class; +}; + +struct _SetTests { + CollectionTests parent_instance; + SetTestsPrivate * priv; +}; + +struct _SetTestsClass { + CollectionTestsClass parent_class; + void (*test_duplicates_are_ignored) (SetTests* self); +}; + +struct _SortedSetTests { + SetTests parent_instance; + SortedSetTestsPrivate * priv; +}; + +struct _SortedSetTestsClass { + SetTestsClass parent_class; +}; + +struct _TreeSetTests { + SortedSetTests parent_instance; + TreeSetTestsPrivate * priv; +}; + +struct _TreeSetTestsClass { + SortedSetTestsClass parent_class; +}; + +typedef void (*GeeTestCaseTestMethod) (void* user_data); + +static gpointer tree_set_tests_parent_class = NULL; + +GType gee_test_case_get_type (void) G_GNUC_CONST; +GType collection_tests_get_type (void) G_GNUC_CONST; +GType set_tests_get_type (void) G_GNUC_CONST; +GType sorted_set_tests_get_type (void) G_GNUC_CONST; +GType tree_set_tests_get_type (void) G_GNUC_CONST; +enum { + TREE_SET_TESTS_DUMMY_PROPERTY +}; +TreeSetTests* tree_set_tests_new (void); +TreeSetTests* tree_set_tests_construct (GType object_type); +SortedSetTests* sorted_set_tests_construct (GType object_type, const gchar* name); +void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target); +void tree_set_tests_test_selected_functions (TreeSetTests* self); +static void _tree_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self); +void tree_set_tests_test_gobject_properties (TreeSetTests* self); +static void _tree_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self); +void tree_set_tests_test_add_remove (TreeSetTests* self); +static void _tree_set_tests_test_add_remove_gee_test_case_test_method (gpointer self); +static void tree_set_tests_real_set_up (GeeTestCase* base); +static void tree_set_tests_real_tear_down (GeeTestCase* base); +void collection_tests_test_remove_all (CollectionTests* self); +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); + + +static void _tree_set_tests_test_selected_functions_gee_test_case_test_method (gpointer self) { + tree_set_tests_test_selected_functions (self); +} + + +static void _tree_set_tests_test_gobject_properties_gee_test_case_test_method (gpointer self) { + tree_set_tests_test_gobject_properties (self); +} + + +static void _tree_set_tests_test_add_remove_gee_test_case_test_method (gpointer self) { + tree_set_tests_test_add_remove (self); +} + + +TreeSetTests* tree_set_tests_construct (GType object_type) { + TreeSetTests * self = NULL; + self = (TreeSetTests*) sorted_set_tests_construct (object_type, "TreeSet"); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeSet] selected functions", _tree_set_tests_test_selected_functions_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeSet] GObject properties", _tree_set_tests_test_gobject_properties_gee_test_case_test_method, self); + gee_test_case_add_test ((GeeTestCase*) self, "[TreeSet] add and remove", _tree_set_tests_test_add_remove_gee_test_case_test_method, self); + return self; +} + + +TreeSetTests* tree_set_tests_new (void) { + return tree_set_tests_construct (TYPE_TREE_SET_TESTS); +} + + +static void tree_set_tests_real_set_up (GeeTestCase* base) { + TreeSetTests * self; + GeeTreeSet* _tmp0_; + self = (TreeSetTests*) base; + _tmp0_ = gee_tree_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = (GeeCollection*) _tmp0_; +} + + +static void tree_set_tests_real_tear_down (GeeTestCase* base) { + TreeSetTests * self; + self = (TreeSetTests*) base; + _g_object_unref0 (((CollectionTests*) self)->test_collection); + ((CollectionTests*) self)->test_collection = NULL; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +void tree_set_tests_test_selected_functions (TreeSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* test_set; + GCompareFunc _tmp2_; + GCompareFunc _tmp3_; + GCompareFunc _tmp4_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_SET) ? ((GeeTreeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + _tmp2_ = gee_tree_set_get_compare_func (test_set); + _tmp3_ = _tmp2_; + _tmp4_ = g_strcmp0; + _vala_assert (_tmp3_ == ((GCompareFunc) _tmp4_), "test_set.compare_func == (CompareFunc) strcmp"); + _g_object_unref0 (test_set); +} + + +void tree_set_tests_test_gobject_properties (TreeSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* test_set; + GValue value = {0}; + GValue _tmp2_ = {0}; + GValue _tmp3_; + void* _tmp4_ = NULL; + GCompareFunc _tmp5_; + GCompareFunc _tmp6_; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_SET) ? ((GeeTreeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _vala_assert (test_set != NULL, "test_set != null"); + g_value_init (&_tmp2_, G_TYPE_POINTER); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + value = _tmp2_; + _tmp3_ = value; + g_object_get_property ((GObject*) test_set, "compare-func", &value); + _tmp4_ = g_value_get_pointer (&value); + _tmp5_ = gee_tree_set_get_compare_func (test_set); + _tmp6_ = _tmp5_; + _vala_assert (_tmp4_ == ((void*) _tmp6_), "value.get_pointer () == (void*) test_set.compare_func"); + g_value_unset (&value); + G_IS_VALUE (&value) ? (g_value_unset (&value), NULL) : NULL; + _g_object_unref0 (test_set); +} + + +void tree_set_tests_test_add_remove (TreeSetTests* self) { + GeeCollection* _tmp0_; + GeeTreeSet* _tmp1_; + GeeTreeSet* test_set; + GeeTreeSet* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + gchar* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gchar* _tmp14_; + gchar* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + gchar** _tmp19_ = NULL; + gchar** to_add; + gint to_add_length1; + gint _to_add_size_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + gchar* _tmp23_; + gchar* _tmp24_; + gchar* _tmp25_; + gchar* _tmp26_; + gchar* _tmp27_; + gchar* _tmp28_; + gchar* _tmp29_; + gchar* _tmp30_; + gchar* _tmp31_; + gchar* _tmp32_; + gchar* _tmp33_; + gchar* _tmp34_; + gchar* _tmp35_; + gchar** _tmp36_ = NULL; + gchar** to_remove; + gint to_remove_length1; + gint _to_remove_size_; + gchar** _tmp37_; + gint _tmp37__length1; + gchar** _tmp48_; + gint _tmp48__length1; + gchar* _tmp59_; + gchar* _tmp60_; + gchar* _tmp61_; + gchar* _tmp62_; + gchar* _tmp63_; + gchar* _tmp64_; + gchar* _tmp65_; + gchar* _tmp66_; + gchar* _tmp67_; + gchar* _tmp68_; + gchar* _tmp69_; + gchar* _tmp70_; + gchar* _tmp71_; + gchar* _tmp72_; + gchar* _tmp73_; + gchar* _tmp74_; + gchar** _tmp75_ = NULL; + gchar* _tmp76_; + gchar* _tmp77_; + gchar* _tmp78_; + gchar* _tmp79_; + gchar* _tmp80_; + gchar* _tmp81_; + gchar* _tmp82_; + gchar* _tmp83_; + gchar* _tmp84_; + gchar* _tmp85_; + gchar* _tmp86_; + gchar* _tmp87_; + gchar* _tmp88_; + gchar* _tmp89_; + gchar* _tmp90_; + gchar* _tmp91_; + gchar** _tmp92_ = NULL; + gchar** _tmp93_; + gint _tmp93__length1; + gchar** _tmp104_; + gint _tmp104__length1; + g_return_if_fail (self != NULL); + _tmp0_ = ((CollectionTests*) self)->test_collection; + _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_TREE_SET) ? ((GeeTreeSet*) _tmp0_) : NULL); + test_set = _tmp1_; + _tmp2_ = test_set; + _vala_assert (_tmp2_ != NULL, "test_set != null"); + collection_tests_test_remove_all ((CollectionTests*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SORTED_SET_TESTS, SortedSetTests)); + _tmp3_ = g_strdup ("3"); + _tmp4_ = g_strdup ("10"); + _tmp5_ = g_strdup ("5"); + _tmp6_ = g_strdup ("6"); + _tmp7_ = g_strdup ("13"); + _tmp8_ = g_strdup ("8"); + _tmp9_ = g_strdup ("12"); + _tmp10_ = g_strdup ("11"); + _tmp11_ = g_strdup ("1"); + _tmp12_ = g_strdup ("0"); + _tmp13_ = g_strdup ("9"); + _tmp14_ = g_strdup ("2"); + _tmp15_ = g_strdup ("14"); + _tmp16_ = g_strdup ("7"); + _tmp17_ = g_strdup ("15"); + _tmp18_ = g_strdup ("4"); + _tmp19_ = g_new0 (gchar*, 16 + 1); + _tmp19_[0] = _tmp3_; + _tmp19_[1] = _tmp4_; + _tmp19_[2] = _tmp5_; + _tmp19_[3] = _tmp6_; + _tmp19_[4] = _tmp7_; + _tmp19_[5] = _tmp8_; + _tmp19_[6] = _tmp9_; + _tmp19_[7] = _tmp10_; + _tmp19_[8] = _tmp11_; + _tmp19_[9] = _tmp12_; + _tmp19_[10] = _tmp13_; + _tmp19_[11] = _tmp14_; + _tmp19_[12] = _tmp15_; + _tmp19_[13] = _tmp16_; + _tmp19_[14] = _tmp17_; + _tmp19_[15] = _tmp18_; + to_add = _tmp19_; + to_add_length1 = 16; + _to_add_size_ = to_add_length1; + _tmp20_ = g_strdup ("11"); + _tmp21_ = g_strdup ("13"); + _tmp22_ = g_strdup ("1"); + _tmp23_ = g_strdup ("12"); + _tmp24_ = g_strdup ("4"); + _tmp25_ = g_strdup ("0"); + _tmp26_ = g_strdup ("2"); + _tmp27_ = g_strdup ("5"); + _tmp28_ = g_strdup ("6"); + _tmp29_ = g_strdup ("3"); + _tmp30_ = g_strdup ("14"); + _tmp31_ = g_strdup ("10"); + _tmp32_ = g_strdup ("7"); + _tmp33_ = g_strdup ("15"); + _tmp34_ = g_strdup ("8"); + _tmp35_ = g_strdup ("9"); + _tmp36_ = g_new0 (gchar*, 16 + 1); + _tmp36_[0] = _tmp20_; + _tmp36_[1] = _tmp21_; + _tmp36_[2] = _tmp22_; + _tmp36_[3] = _tmp23_; + _tmp36_[4] = _tmp24_; + _tmp36_[5] = _tmp25_; + _tmp36_[6] = _tmp26_; + _tmp36_[7] = _tmp27_; + _tmp36_[8] = _tmp28_; + _tmp36_[9] = _tmp29_; + _tmp36_[10] = _tmp30_; + _tmp36_[11] = _tmp31_; + _tmp36_[12] = _tmp32_; + _tmp36_[13] = _tmp33_; + _tmp36_[14] = _tmp34_; + _tmp36_[15] = _tmp35_; + to_remove = _tmp36_; + to_remove_length1 = 16; + _to_remove_size_ = to_remove_length1; + _tmp37_ = to_add; + _tmp37__length1 = to_add_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp37_; + s_collection_length1 = _tmp37__length1; + for (s_it = 0; s_it < _tmp37__length1; s_it = s_it + 1) { + gchar* _tmp38_; + gchar* s = NULL; + _tmp38_ = g_strdup (s_collection[s_it]); + s = _tmp38_; + { + GeeTreeSet* _tmp39_; + const gchar* _tmp40_; + gboolean _tmp41_ = FALSE; + GeeTreeSet* _tmp42_; + const gchar* _tmp43_; + gboolean _tmp44_ = FALSE; + GeeTreeSet* _tmp45_; + const gchar* _tmp46_; + gboolean _tmp47_ = FALSE; + _tmp39_ = test_set; + _tmp40_ = s; + _tmp41_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp39_, _tmp40_); + _vala_assert (!_tmp41_, "!test_set.contains (s)"); + _tmp42_ = test_set; + _tmp43_ = s; + _tmp44_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp42_, _tmp43_); + _vala_assert (_tmp44_, "test_set.add (s)"); + _tmp45_ = test_set; + _tmp46_ = s; + _tmp47_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp45_, _tmp46_); + _vala_assert (_tmp47_, "test_set.contains (s)"); + _g_free0 (s); + } + } + } + _tmp48_ = to_remove; + _tmp48__length1 = to_remove_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp48_; + s_collection_length1 = _tmp48__length1; + for (s_it = 0; s_it < _tmp48__length1; s_it = s_it + 1) { + gchar* _tmp49_; + gchar* s = NULL; + _tmp49_ = g_strdup (s_collection[s_it]); + s = _tmp49_; + { + GeeTreeSet* _tmp50_; + const gchar* _tmp51_; + gboolean _tmp52_ = FALSE; + GeeTreeSet* _tmp53_; + const gchar* _tmp54_; + gboolean _tmp55_ = FALSE; + GeeTreeSet* _tmp56_; + const gchar* _tmp57_; + gboolean _tmp58_ = FALSE; + _tmp50_ = test_set; + _tmp51_ = s; + _tmp52_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp50_, _tmp51_); + _vala_assert (_tmp52_, "test_set.contains (s)"); + _tmp53_ = test_set; + _tmp54_ = s; + _tmp55_ = gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp53_, _tmp54_); + _vala_assert (_tmp55_, "test_set.remove (s)"); + _tmp56_ = test_set; + _tmp57_ = s; + _tmp58_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp56_, _tmp57_); + _vala_assert (!_tmp58_, "!test_set.contains (s)"); + _g_free0 (s); + } + } + } + _tmp59_ = g_strdup ("2"); + _tmp60_ = g_strdup ("9"); + _tmp61_ = g_strdup ("13"); + _tmp62_ = g_strdup ("7"); + _tmp63_ = g_strdup ("12"); + _tmp64_ = g_strdup ("14"); + _tmp65_ = g_strdup ("8"); + _tmp66_ = g_strdup ("1"); + _tmp67_ = g_strdup ("5"); + _tmp68_ = g_strdup ("6"); + _tmp69_ = g_strdup ("11"); + _tmp70_ = g_strdup ("15"); + _tmp71_ = g_strdup ("3"); + _tmp72_ = g_strdup ("10"); + _tmp73_ = g_strdup ("0"); + _tmp74_ = g_strdup ("4"); + _tmp75_ = g_new0 (gchar*, 16 + 1); + _tmp75_[0] = _tmp59_; + _tmp75_[1] = _tmp60_; + _tmp75_[2] = _tmp61_; + _tmp75_[3] = _tmp62_; + _tmp75_[4] = _tmp63_; + _tmp75_[5] = _tmp64_; + _tmp75_[6] = _tmp65_; + _tmp75_[7] = _tmp66_; + _tmp75_[8] = _tmp67_; + _tmp75_[9] = _tmp68_; + _tmp75_[10] = _tmp69_; + _tmp75_[11] = _tmp70_; + _tmp75_[12] = _tmp71_; + _tmp75_[13] = _tmp72_; + _tmp75_[14] = _tmp73_; + _tmp75_[15] = _tmp74_; + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); + to_add = _tmp75_; + to_add_length1 = 16; + _to_add_size_ = to_add_length1; + _tmp76_ = g_strdup ("11"); + _tmp77_ = g_strdup ("10"); + _tmp78_ = g_strdup ("14"); + _tmp79_ = g_strdup ("6"); + _tmp80_ = g_strdup ("13"); + _tmp81_ = g_strdup ("4"); + _tmp82_ = g_strdup ("3"); + _tmp83_ = g_strdup ("15"); + _tmp84_ = g_strdup ("8"); + _tmp85_ = g_strdup ("5"); + _tmp86_ = g_strdup ("7"); + _tmp87_ = g_strdup ("0"); + _tmp88_ = g_strdup ("12"); + _tmp89_ = g_strdup ("2"); + _tmp90_ = g_strdup ("9"); + _tmp91_ = g_strdup ("1"); + _tmp92_ = g_new0 (gchar*, 16 + 1); + _tmp92_[0] = _tmp76_; + _tmp92_[1] = _tmp77_; + _tmp92_[2] = _tmp78_; + _tmp92_[3] = _tmp79_; + _tmp92_[4] = _tmp80_; + _tmp92_[5] = _tmp81_; + _tmp92_[6] = _tmp82_; + _tmp92_[7] = _tmp83_; + _tmp92_[8] = _tmp84_; + _tmp92_[9] = _tmp85_; + _tmp92_[10] = _tmp86_; + _tmp92_[11] = _tmp87_; + _tmp92_[12] = _tmp88_; + _tmp92_[13] = _tmp89_; + _tmp92_[14] = _tmp90_; + _tmp92_[15] = _tmp91_; + to_remove = (_vala_array_free (to_remove, to_remove_length1, (GDestroyNotify) g_free), NULL); + to_remove = _tmp92_; + to_remove_length1 = 16; + _to_remove_size_ = to_remove_length1; + _tmp93_ = to_add; + _tmp93__length1 = to_add_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp93_; + s_collection_length1 = _tmp93__length1; + for (s_it = 0; s_it < _tmp93__length1; s_it = s_it + 1) { + gchar* _tmp94_; + gchar* s = NULL; + _tmp94_ = g_strdup (s_collection[s_it]); + s = _tmp94_; + { + GeeTreeSet* _tmp95_; + const gchar* _tmp96_; + gboolean _tmp97_ = FALSE; + GeeTreeSet* _tmp98_; + const gchar* _tmp99_; + gboolean _tmp100_ = FALSE; + GeeTreeSet* _tmp101_; + const gchar* _tmp102_; + gboolean _tmp103_ = FALSE; + _tmp95_ = test_set; + _tmp96_ = s; + _tmp97_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp95_, _tmp96_); + _vala_assert (!_tmp97_, "!test_set.contains (s)"); + _tmp98_ = test_set; + _tmp99_ = s; + _tmp100_ = gee_abstract_collection_add ((GeeAbstractCollection*) _tmp98_, _tmp99_); + _vala_assert (_tmp100_, "test_set.add (s)"); + _tmp101_ = test_set; + _tmp102_ = s; + _tmp103_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp101_, _tmp102_); + _vala_assert (_tmp103_, "test_set.contains (s)"); + _g_free0 (s); + } + } + } + _tmp104_ = to_remove; + _tmp104__length1 = to_remove_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp104_; + s_collection_length1 = _tmp104__length1; + for (s_it = 0; s_it < _tmp104__length1; s_it = s_it + 1) { + gchar* _tmp105_; + gchar* s = NULL; + _tmp105_ = g_strdup (s_collection[s_it]); + s = _tmp105_; + { + GeeTreeSet* _tmp106_; + const gchar* _tmp107_; + gboolean _tmp108_ = FALSE; + GeeTreeSet* _tmp109_; + const gchar* _tmp110_; + gboolean _tmp111_ = FALSE; + GeeTreeSet* _tmp112_; + const gchar* _tmp113_; + gboolean _tmp114_ = FALSE; + _tmp106_ = test_set; + _tmp107_ = s; + _tmp108_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp106_, _tmp107_); + _vala_assert (_tmp108_, "test_set.contains (s)"); + _tmp109_ = test_set; + _tmp110_ = s; + _tmp111_ = gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp109_, _tmp110_); + _vala_assert (_tmp111_, "test_set.remove (s)"); + _tmp112_ = test_set; + _tmp113_ = s; + _tmp114_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp112_, _tmp113_); + _vala_assert (!_tmp114_, "!test_set.contains (s)"); + _g_free0 (s); + } + } + } + to_remove = (_vala_array_free (to_remove, to_remove_length1, (GDestroyNotify) g_free), NULL); + to_add = (_vala_array_free (to_add, to_add_length1, (GDestroyNotify) g_free), NULL); + _g_object_unref0 (test_set); +} + + +static void tree_set_tests_class_init (TreeSetTestsClass * klass) { + tree_set_tests_parent_class = g_type_class_peek_parent (klass); + GEE_TEST_CASE_CLASS (klass)->set_up = tree_set_tests_real_set_up; + GEE_TEST_CASE_CLASS (klass)->tear_down = tree_set_tests_real_tear_down; +} + + +static void tree_set_tests_instance_init (TreeSetTests * self) { +} + + +GType tree_set_tests_get_type (void) { + static volatile gsize tree_set_tests_type_id__volatile = 0; + if (g_once_init_enter (&tree_set_tests_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TreeSetTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tree_set_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TreeSetTests), 0, (GInstanceInitFunc) tree_set_tests_instance_init, NULL }; + GType tree_set_tests_type_id; + tree_set_tests_type_id = g_type_register_static (TYPE_SORTED_SET_TESTS, "TreeSetTests", &g_define_type_info, 0); + g_once_init_leave (&tree_set_tests_type_id__volatile, tree_set_tests_type_id); + } + return tree_set_tests_type_id__volatile; +} + + +static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) { + if ((array != NULL) && (destroy_func != NULL)) { + int i; + for (i = 0; i < array_length; i = i + 1) { + if (((gpointer*) array)[i] != NULL) { + destroy_func (((gpointer*) array)[i]); + } + } + } +} + + +static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) { + _vala_array_destroy (array, array_length, destroy_func); + g_free (array); +} + + + diff --git a/tests/testtreeset.vala b/tests/testtreeset.vala new file mode 100644 index 0000000..6d754bc --- /dev/null +++ b/tests/testtreeset.vala @@ -0,0 +1,111 @@ +/* testtreeset.vala + * + * Copyright (C) 2009 Didier Villevalois, Julien Peeters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + + * This library 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 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes' Villevalois <ptitjes@free.fr> + * Julien Peeters <contact@julienpeeters.fr> + */ + +using Gee; + +public class TreeSetTests : SortedSetTests { + + public TreeSetTests () { + base ("TreeSet"); + add_test ("[TreeSet] selected functions", test_selected_functions); + add_test ("[TreeSet] GObject properties", test_gobject_properties); + add_test ("[TreeSet] add and remove", test_add_remove); + } + + public override void set_up () { + test_collection = new TreeSet<string> (); + } + + public override void tear_down () { + test_collection = null; + } + + public void test_selected_functions () { + var test_set = test_collection as TreeSet<string>; + + // Check the set exists + assert (test_set != null); + + // Check the selected compare function + assert (test_set.compare_func == (CompareFunc) strcmp); + } + + public new void test_gobject_properties () { + var test_set = test_collection as TreeSet<string>; + + // Check the set exists + assert (test_set != null); + Value value; + + value = Value (typeof (CompareFunc)); + test_set.get_property ("compare-func", ref value); + assert (value.get_pointer () == (void*) test_set.compare_func); + value.unset (); + } + + public new void test_add_remove () { + var test_set = test_collection as TreeSet<string>; + + // Check the set exists + assert (test_set != null); + + base.test_remove_all (); + + var to_add = new string[] { + "3", "10", "5", "6", "13", "8", "12", "11", "1", "0", "9", "2", "14", "7", "15", "4" + }; + var to_remove = new string[] { + "11", "13", "1", "12", "4", "0", "2", "5", "6", "3", "14", "10", "7", "15", "8", "9" + }; + + foreach (var s in to_add) { + assert (!test_set.contains (s)); + assert (test_set.add (s)); + assert (test_set.contains (s)); + } + foreach (var s in to_remove) { + assert (test_set.contains (s)); + assert (test_set.remove (s)); + + assert (!test_set.contains (s)); + } + + to_add = new string[] { + "2", "9", "13", "7", "12", "14", "8", "1", "5", "6", "11", "15", "3", "10", "0", "4" + }; + to_remove = new string[] { + "11", "10", "14", "6", "13", "4", "3", "15", "8", "5", "7", "0", "12", "2", "9", "1" + }; + + foreach (var s in to_add) { + assert (!test_set.contains (s)); + assert (test_set.add (s)); + assert (test_set.contains (s)); + } + foreach (var s in to_remove) { + assert (test_set.contains (s)); + assert (test_set.remove (s)); + assert (!test_set.contains (s)); + } + } +} |