A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/3a3d69768b80ab131e633ea869b9c29167a1916c below:

Change upb C generated map iteration function to not hand out MapEntr… · protocolbuffers/protobuf@3a3d697 · GitHub

@@ -505,15 +505,16 @@ static void check_string_map_empty(

505 505

0,

506 506

protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_size(

507 507

msg));

508 + 509 +

upb_StringView key;

510 +

upb_StringView val;

508 511

EXPECT_FALSE(

509 512

protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next(

510 -

msg, &iter));

513 +

msg, &key, &val, &iter));

511 514

}

512 515 513 516

static void check_string_map_one_entry(

514 517

protobuf_test_messages_proto3_TestAllTypesProto3* msg) {

515 -

const protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry*

516 -

const_ent;

517 518

size_t iter;

518 519

upb_StringView str;

519 520

@@ -532,23 +533,15 @@ static void check_string_map_one_entry(

532 533 533 534

/* Test that iteration reveals a single k/v pair in the map. */

534 535

iter = kUpb_Map_Begin;

535 -

const_ent =

536 -

protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next(

537 -

msg, &iter);

538 -

ASSERT_NE(nullptr, const_ent);

539 -

EXPECT_TRUE(upb_StringView_IsEqual(

540 -

test_str_view,

541 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_key(

542 -

const_ent)));

543 -

EXPECT_TRUE(upb_StringView_IsEqual(

544 -

test_str_view2,

545 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_value(

546 -

const_ent)));

547 - 548 -

const_ent =

536 +

upb_StringView key;

537 +

upb_StringView val;

538 +

protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next(

539 +

msg, &key, &val, &iter);

540 +

EXPECT_TRUE(upb_StringView_IsEqual(test_str_view, key));

541 +

EXPECT_TRUE(upb_StringView_IsEqual(test_str_view2, val));

542 +

EXPECT_FALSE(

549 543

protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next(

550 -

msg, &iter);

551 -

EXPECT_EQ(nullptr, const_ent);

544 +

msg, &key, &val, &iter));

552 545

}

553 546 554 547

TEST(GeneratedCode, StringDoubleMap) {

@@ -580,8 +573,6 @@ TEST(GeneratedCode, StringMap) {

580 573

upb_Arena* arena = upb_Arena_New();

581 574

protobuf_test_messages_proto3_TestAllTypesProto3* msg =

582 575

protobuf_test_messages_proto3_TestAllTypesProto3_new(arena);

583 -

const protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry*

584 -

const_ent;

585 576

size_t iter, count;

586 577 587 578

check_string_map_empty(msg);

@@ -615,18 +606,11 @@ TEST(GeneratedCode, StringMap) {

615 606

/* Test iteration */

616 607

iter = kUpb_Map_Begin;

617 608

count = 0;

618 - 609 +

upb_StringView key;

610 +

upb_StringView val;

619 611

while (

620 -

(const_ent =

621 -

protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next(

622 -

msg, &iter)) != nullptr) {

623 -

upb_StringView key =

624 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_key(

625 -

const_ent);

626 -

upb_StringView val =

627 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapStringStringEntry_value(

628 -

const_ent);

629 - 612 +

protobuf_test_messages_proto3_TestAllTypesProto3_map_string_string_next(

613 +

msg, &key, &val, &iter)) {

630 614

count++;

631 615

if (upb_StringView_IsEqual(key, test_str_view)) {

632 616

EXPECT_TRUE(upb_StringView_IsEqual(val, test_str_view2));

@@ -652,16 +636,18 @@ static void check_int32_map_empty(

652 636

EXPECT_EQ(

653 637

0, protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_size(

654 638

msg));

639 + 640 +

int32_t key;

641 +

int32_t val;

655 642

EXPECT_FALSE(

656 643

protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next(

657 -

msg, &iter));

644 +

msg, &key, &val, &iter));

658 645

}

659 646 660 647

static void check_int32_map_one_entry(

661 648

protobuf_test_messages_proto3_TestAllTypesProto3* msg) {

662 -

const protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry*

663 -

const_ent;

664 649

size_t iter;

650 +

int32_t key;

665 651

int32_t val;

666 652 667 653

EXPECT_EQ(

@@ -678,31 +664,20 @@ static void check_int32_map_one_entry(

678 664 679 665

/* Test that iteration reveals a single k/v pair in the map. */

680 666

iter = kUpb_Map_Begin;

681 -

const_ent =

667 +

EXPECT_TRUE(

682 668

protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next(

683 -

msg, &iter);

684 -

ASSERT_NE(nullptr, const_ent);

685 -

EXPECT_EQ(

686 -

test_int32,

687 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_key(

688 -

const_ent));

689 -

EXPECT_EQ(

690 -

test_int32_2,

691 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_value(

692 -

const_ent));

693 - 694 -

const_ent =

669 +

msg, &key, &val, &iter));

670 +

EXPECT_EQ(test_int32, key);

671 +

EXPECT_EQ(test_int32_2, val);

672 +

EXPECT_FALSE(

695 673

protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next(

696 -

msg, &iter);

697 -

EXPECT_EQ(nullptr, const_ent);

674 +

msg, &key, &val, &iter));

698 675

}

699 676 700 677

TEST(GeneratedCode, Int32Map) {

701 678

upb_Arena* arena = upb_Arena_New();

702 679

protobuf_test_messages_proto3_TestAllTypesProto3* msg =

703 680

protobuf_test_messages_proto3_TestAllTypesProto3_new(arena);

704 -

const protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry*

705 -

const_ent;

706 681

size_t iter, count;

707 682 708 683

check_int32_map_empty(msg);

@@ -751,18 +726,10 @@ TEST(GeneratedCode, Int32Map) {

751 726

/* Test iteration */

752 727

iter = kUpb_Map_Begin;

753 728

count = 0;

754 - 755 -

while (

756 -

(const_ent =

757 -

protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next(

758 -

msg, &iter)) != nullptr) {

759 -

int32_t key =

760 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_key(

761 -

const_ent);

762 -

int32_t val =

763 -

protobuf_test_messages_proto3_TestAllTypesProto3_MapInt32Int32Entry_value(

764 -

const_ent);

765 - 729 +

int32_t key;

730 +

int32_t val;

731 +

while (protobuf_test_messages_proto3_TestAllTypesProto3_map_int32_int32_next(

732 +

msg, &key, &val, &iter)) {

766 733

count++;

767 734

if (key == test_int32) {

768 735

EXPECT_EQ(val, test_int32_2);


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4