| 634 | } |
| 635 | |
| 636 | void add_tests_for_toggle_queue() { |
| 637 | #define ADD_TOGGLE_QUEUE_TEST(path, f) \ |
| 638 | g_test_add("/toggle-queue/" path, GjsUnitTestFixture, nullptr, TQ::setup, \ |
| 639 | f, TQ::teardown); |
| 640 | |
| 641 | ADD_TOGGLE_QUEUE_TEST("spin-lock/unlock-empty", |
| 642 | test_toggle_queue_unlock_empty); |
| 643 | ADD_TOGGLE_QUEUE_TEST("spin-lock/unlock-same-thread", |
| 644 | test_toggle_queue_unlock_same_thread); |
| 645 | ADD_TOGGLE_QUEUE_TEST("spin-lock/blocks-other-thread", |
| 646 | test_toggle_blocks_other_thread); |
| 647 | |
| 648 | ADD_TOGGLE_QUEUE_TEST("empty", test_toggle_queue_empty); |
| 649 | ADD_TOGGLE_QUEUE_TEST("empty_cancel", test_toggle_queue_empty_cancel); |
| 650 | ADD_TOGGLE_QUEUE_TEST("enqueue_one", test_toggle_queue_enqueue_one); |
| 651 | ADD_TOGGLE_QUEUE_TEST("enqueue_one_cancel", |
| 652 | test_toggle_queue_enqueue_one_cancel); |
| 653 | ADD_TOGGLE_QUEUE_TEST("enqueue_many_equal", |
| 654 | test_toggle_queue_enqueue_many_equal); |
| 655 | ADD_TOGGLE_QUEUE_TEST("enqueue_many_equal_cancel", |
| 656 | test_toggle_queue_enqueue_many_equal_cancel); |
| 657 | ADD_TOGGLE_QUEUE_TEST("enqueue_more_up", test_toggle_queue_enqueue_more_up); |
| 658 | ADD_TOGGLE_QUEUE_TEST("enqueue_only_up", test_toggle_queue_enqueue_only_up); |
| 659 | ADD_TOGGLE_QUEUE_TEST("enqueue_only_up_cancel", |
| 660 | test_toggle_queue_enqueue_only_up_cancel); |
| 661 | ADD_TOGGLE_QUEUE_TEST("handle_more_up", test_toggle_queue_handle_more_up); |
| 662 | ADD_TOGGLE_QUEUE_TEST("handle_only_up", test_toggle_queue_handle_only_up); |
| 663 | |
| 664 | ADD_TOGGLE_QUEUE_TEST("object/not-enqueued_main_thread", |
| 665 | test_toggle_queue_object_from_main_thread); |
| 666 | ADD_TOGGLE_QUEUE_TEST( |
| 667 | "object/already_enqueued_main_thread", |
| 668 | test_toggle_queue_object_from_main_thread_already_enqueued); |
| 669 | ADD_TOGGLE_QUEUE_TEST( |
| 670 | "object/already_enqueued_unref_main_thread", |
| 671 | test_toggle_queue_object_from_main_thread_unref_already_enqueued); |
| 672 | ADD_TOGGLE_QUEUE_TEST("object/ref_unref_other_thread", |
| 673 | test_toggle_queue_object_from_other_thread_ref_unref); |
| 674 | ADD_TOGGLE_QUEUE_TEST("object/handle_up", |
| 675 | test_toggle_queue_object_handle_up); |
| 676 | ADD_TOGGLE_QUEUE_TEST("object/handle_up_down", |
| 677 | test_toggle_queue_object_handle_up_down); |
| 678 | ADD_TOGGLE_QUEUE_TEST("object/handle_up_down_delayed", |
| 679 | test_toggle_queue_object_handle_up_down_delayed); |
| 680 | ADD_TOGGLE_QUEUE_TEST("object/handle_up_down_on_gc", |
| 681 | test_toggle_queue_object_handle_up_down_on_gc); |
| 682 | ADD_TOGGLE_QUEUE_TEST("object/handle_many_up", |
| 683 | test_toggle_queue_object_handle_many_up); |
| 684 | ADD_TOGGLE_QUEUE_TEST("object/handle_many_up_and_down", |
| 685 | test_toggle_queue_object_handle_many_up_and_down); |
| 686 | |
| 687 | #undef ADD_TOGGLE_QUEUE_TEST |
| 688 | } |
| 689 | |
| 690 | } // namespace Gjs::Test |