1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766
|
/* testarraylist.c generated by valac 0.19.0.4-d6d4, 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);
}
|