�����JFIF��XX����������    $.' ",#(7),01444'9=82<.342  2!!22222222222222222222222222222222222222222222222222�����"����4���������������������������� ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������,�PG"Z_�4�˷����kjز�Z�,F+��_z�,�© �����zh6�٨�ic�fu������������������������������������#ډb���_�N��?�����������wQ���5-�~�I���8���������������������������������TK<5o�Iv-������������������k�_U_������������������������������~b�M��d��������Ӝ�U�Hh��?]��E�w��Q���k�{��_}qFW7HTՑ��Y��F�����?_�'ϔ��_�Ջt������������������������=||I �����6�έ"�����D���/[�k�9����Y�8������ds|\���Ҿp6�Ҵ���]��.����6���z<�v��@]�i%������������������������$j��~����g��J>��no����pM[me�i$[�����������s�o�ᘨ�˸ nɜG-�ĨU�ycP���3.DB�li�;���������������������hj���x����7Z^�N�h��������N3u{�:j�����x�힞��#M��&��jL P@��_���� P�������������������&��o8��������9������@Sz���6�t7#O�ߋ �����s}Yf�T������lmr����Z)'N��k�۞p�����w\�T���������������ȯ?�8`���O��i{wﭹW�[�r�� ��Q4F�׊������3m&L�=��h3�������z~��#����\�l :�F,j@�� ʱ�wQT����8�"kJO����6�֚l������������������}����R�>ډK���]��y����&����p�}b������;N�1�m�r$����|��7�>e�@���B�TM*-i�H��g�D�)� E�m�|�ؘbҗ�a���Ҿ����������������t4�����o���G��*oCN�rP���Q��@z,|?W[0���������:�n,j���WiE��W������$~/�hp\��?��{(�0���+�Y8rΟ�+����>S-S���������������VN;���}�s?.����� w��9��˟<���Mq4�Wv'������{)0�1mB����V����W[��������8�/<� �%���wT^�5���b��)iM� p�g�N�&ݝ������������VO~��q���u���9��� ����!��J27�����$����O-���! �:���%H��� ـ�������y�ΠM=t{!S�� �oK8�������t<����è��������:a��������[������ա�H���~��w��Qz`�p����o�^ ������Q��n����� �,uu�C��$ ^���,�������8�#��:�6��e�|~�����������!�3��3.�\0�����q��o�4`.|� ����y�Q�`~;�d�ׯ,��O�Zw�������`73�v�܋�<�����Ȏ�� ـ4k��5�K�a�u�=9Yd��$>x�A�&�� j0� ���vF��� Y���|�y��� ~�6�@c��1vOp��������Ig�����4��l�OD�����L����� R���c���j�_�uX�6��3?nk��Wy�f;^*B� ��@���~a�`��Eu�������+�����6�L��.ü>��}y���}_�O�6�͐�:�Yr���G�X��kG������l^w����������~㒶sy���Iu�!���� W ��X��N�7BV��O��!X�2����wvG�R�f�T#�����t�/?���%8�^�W�aT����G�cL�M���I��(J����1~�8�?aT ���]����AS�E��(��*E}� 2������#I/�׍qz��^t�̔���������b�Yz4x����t�){ OH�����+(E��A&�N�������XT��o��"�XC����'���)}�J�z�p� ����~5�}�^����+�6����w��c��Q�|�Lp�d�H��}�(�.|����k��c4^�����"�����Z?ȕ ��a<�������L�!0�39C� �Eu�����C�F�Ew�ç ;�n?�*o���B�8�bʝ���'#Rqf����M}7����]�������s2tcS{�\icTx;�\��7K���P������ʇ Z O-��~�������c>"��?��������P�����E��O�8��@�8��G��Q�g�a�Վ���󁶠��䧘��_%#r�>�����1�z�a���eb��qcP��ѵ��n���#L��� =��׀t� L�7�`�����V����A{�C:�g���e@�����w1 Xp�3�c3�ġ�������p��M"'-�@n4���fG���B3�DJ�8[Jo�ߐ���gK)ƛ��$���� �������8�3�����+���� �����6�ʻ���� ���S�kI�*KZlT _`�������?��K�����QK�d���������B`�s}�>���`������*�>��,*@J�d�oF*�����弝��O}�k��s��]��y�ߘ�������c1G�V���<=�7��7����6��q�PT��tXԀ�!9*4�4Tހ���3XΛex�46�������Y��D ����� ����BdemDa����\�_l,����G�/���֌7���Y�](�xTt^%�GE�����4�}bT����ڹ�����;��Y)���B�Q��u��>J/J ���⮶.�XԄ��j�ݳ������+E��d ���r�5�_D�����1 ���o�� �B�x�΢�#����<��W�����8���R6�@���g�M�.��� dr�D��>(otU��@�x=��~v���2� ӣ�d�oBd�����3�eO�6�㣷����������ݜ�6��6Y��Qz`����S��{���\P��~z m5{J/L��1������<�e�ͅPu���b�]�ϔ��������'�������f�b� Zpw��c`"��i���BD@:)ִ�:�]��h���v�E��w���T�l�������P����"Ju�}��وV ��J��G6��. J/�Qgl߭�e�����@�z�Zev2u����)]կ���������7x�������s�M�-<ɯ�c��r��v�����@��$�ޮ}lk���a����'����>x��O\�Z������Fu>������ck#��&:��`�$��ai�>2Δ����l���oF[h�������lE�ܺ�Π���k:)���`������� $[6�����9�����kOw�\|�����8}������ބ:��񶐕��������I�A1/���=�2[�,�!��.}gN#�u����b���� ~���������݊��}34q�����d�E��L��������c��$���"�[q�U�硬g^��%B ��z���r�p�������J�ru%v\h�����1Y�ne`������ǥ:g����pQM~�^��Xi� ��`S�:V2������9.�P���V������?B�k�� ��������AEvw%�_�9C�Q����wKekP�ؠ�\������;Io d�{ ߞo�c1eP�����\� `����E=���@K<�Y��������eڼ�J����w����{av�F�'�M�@��������������/J��+9p����|]���������Iw &`���8���&�M�hg���[�{�������Xj���%��Ӓ�������������������$��(�����ʹN�������<>�I���RY�����K2�NPlL�ɀ�)��&e��������B+ь����(������������������� � �JTx����_?EZ� }@���� 6�U���뙢ط�z��dWI��n` D����噥�[��uV��"�G&�����Ú����2�g�}&m���������������������?ċ���"����Om#�������������������������� ��{���������������������ON��"S�X���Ne��ysQ���@�������������Fn��Vg�����dX�~nj����������������������]J�<�K]:����FW���b�������62����������=��5f����JKw����bf�X������������������������55��~J �%^�������:�-�QIE��P��v�nZum� z � ~ə ���� ���ة����;�f��\v�������g�8�1��f2�������������������������4;�V���ǔ�)�������������������9���1\������������������������������c��v�/'Ƞ�w������������������$�4�R-��t����������������������������������� e�6�/�ġ �̕Ecy�J���u�B���<�W�ַ~�w[B1L۲�-JS΂�{���΃�������������������������������������������A��20�c#���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@���� 0!1@AP"#2Q`$3V�%45a6�FRUq����� ������^7ׅ,$n��������+��F�`��2X'��0vM��p�L=�������5��8������u�p~���.�`r�����\����O��,ư�0oS ��_�M�����l���4�kv\JSd���x���SW�<��Ae�IX����������$I���w�:S���y���›R��9�Q[���,�5�;�@]�%���u�@ *ro�lbI �� ��+���%m:�͇ZV�����u�̉����θau<�fc�.����{�4Ա� �Q����*�Sm��8\ujqs]{kN���)qO�y�_*dJ�b�7���yQqI&9�ԌK!�M}�R�;�������S�T���1���i[U�ɵz�]��U)V�S6���3$K{��ߊ<�(� E]Զ[ǼENg�����'�\?#)Dkf��J���o��v���'�%ƞ�&K�u��!��b�35LX�Ϸ��63$K�a�;�9>,R��W��3�3� d�JeTYE.Mϧ��-�o�j3+y��y^�c�������VO�9NV\nd�1 ��!͕_)a�v;����թ�M�lWR1��)El��P;��yوÏ�u 3�k�5Pr6<�⒲l�!˞*��u־�n�!�l:����UNW ��%��Chx8vL'��X�@��*��)���̮��ˍ��� ����D-M�+J�U�kvK����+�x8��cY������?�Ԡ��~3mo��|�u@[XeY�C�\Kp�x8�oC�C�&����N�~3-H���� ��MX�s�u<`���~"WL��$8ξ��3���a�)|:@�m�\���^�`�@ҷ)�5p+��6���p�%i)P M���ngc�����#0Aruz���RL+xSS?���ʮ}()#�t��mˇ!��0}}y����<�e� �-ή�Ԩ��X������ MF���ԙ~l L.3���}�V뽺�v������멬��Nl�)�2����^�Iq��a��M��qG��T�����c3#������3U�Ǎ���}��לS�|qa��ڃ�+���-��2�f����/��bz��ڐ�� �ݼ[2�ç����k�X�2�* �Z�d���J�G����M*9W���s{��w���T��x��y,�in�O�v��]���n����P�$��JB@=4�OTI�n��e�22a\����q�d���%�$��(���:���: /*�K[PR�fr\nڙdN���F�n�$�4��[�� U�zƶ����� �mʋ���,�ao�u 3�z� �x��Kn����\[��VFmbE;�_U��&V�Gg�]L�۪&#n%�$ɯ��dG���D�TI=�%+AB�Ru#��b4�1�»x�cs�YzڙJG��f��Il���d�eF'T� iA��T���uC�$����Y��H?����[!G`}���ͪ� �纤Hv\������j�Ex�K���!���OiƸ�Yj�+u-<���'q����uN�*�r\��+�]���<�wOZ.fp�ێ��,-*)V?j-kÊ#�`�r��dV����(�ݽBk�����G�ƛk�QmUڗe��Z���f}|����8�8��a���i��3'J�����~G_�^���d�8w������ R�`(�~�.��u���l�s+g�bv���W���lGc}��u���afE~1�Ue������Z�0�8�=e�� f@/�jqEKQQ�J���oN��J���W5~M>$6�Lt�;$ʳ{���^��6�{����v6���ķܰg�V�cnn �~z�x�«�,2�u�?cE+Ș�H؎�%�Za�)���X>uW�Tz�Nyo����s���FQƤ��$��*�&�LLXL)�1�" L��eO��ɟ�9=���:t��Z���c��Ž���Y?�ӭV�wv�~,Y��r�ۗ�|�y��GaF�����C�����.�+� ���v1���fήJ�����]�S��T��B��n5sW}y�$��~z�'�c ��8 ��� ,! �p��VN�S��N�N�q��y8z˱�A��4��*��'������2n<�s���^ǧ˭P�Jޮɏ�U�G�L�J�*#��<�V��t7�8����TĜ>��i}K%,���)[��z�21z ?�N�i�n1?T�I�R#��m-�����������������1����lA�`��fT5+��ܐ�c�q՝��ʐ��,���3�f2U�եmab��#ŠdQ�y>\��)�SLY����w#��.���ʑ�f��� ,"+�w�~�N�'�c�O�3F�������N<���)j��&��,-� �љ���֊�_�zS���TǦ����w�>��?�������n��U仆�V���e�����0���$�C�d���rP �m�׈e�Xm�Vu� �L��.�bֹ��� �[Դaզ���*��\y�8�Է:�Ez\�0�Kq�C b��̘��cө���Q��=0Y��s�N��S.����3.���O�o:���#���v7�[#߫ ��5�܎�L���Er4���9n��COWlG�^��0k�%<���ZB���aB_���������'=��{i�v�l�$�uC���mƎҝ{�c㱼�y]���W�i ��ߧc��m�H� m�"�"�����;Y�ߝ�Z�Ǔ�����:S#��|}�y�,/k�Ld� TA�(�AI$+I3��;Y*���Z��}|��ӧO��d�v��..#:n��f>�>���ȶI�TX��� 8��y����"d�R�|�)0���=���n4��6ⲑ�+��r<�O�܂~zh�z����7ܓ�HH�Ga롏���nCo�>������a ���~]���R���̲c?�6(�q�;5%� |�uj�~z8R�=X��I�V=�|{v�Gj\gc��q����z�؋%M�ߍ����1y��#��@f^���^�>N������#x#۹��6�Y~�?�dfPO��{��P�4��V��u1E1J �*|���%����JN��`eWu�zk M6���q t[�� ��g�G���v��WIG��u_ft����5�j�"�Y�:T��ɐ���*�;� e5���4����q$C��2d�}���� _S�L#m�Yp��O�.�C�;��c����Hi#֩%+) �Ӎ��ƲV���SYź��g |���tj��3�8���r|���V��1#;.SQ�A[���S������#���`n�+���$��$�I �P\[�@�s��(�ED�z���P��])8�G#��0B��[ى��X�II�q<��9�~[Z멜�Z�⊔IWU&A>�P~�#��dp<�?����7���c��'~���5 ��+$���lx@�M�dm��n<=e�dyX��?{�|Aef ,|n3�<~z�ƃ�uۧ�����P��Y,�ӥQ�*g�#먙R�\���;T��i,��[9Qi歉����c>]9�� ��"�c��P�� �Md?٥��If�ت�u��k��/����F��9�c*9��Ǎ:�ØF���z�n*�@|I�ށ9����N3{'��[�'ͬ�Ҳ4��#}��!�V� Fu��,�,mTIk���v C�7v���B�6k�T9��1�*l� '~��ƞF��lU��'�M ����][ΩũJ_�{�i�I�n��$����L�� j��O�dx�����kza۪��#�E��Cl����x˘�o�����V���ɞ�ljr��)�/,�߬h�L��#��^��L�ф�,íMƁe�̩�NB�L�����iL����q�}��(��q��6IçJ$�W�E$��:������=#����(�K�B����zђ <��K(�N�۫K�w��^O{!����)��H���>x�������lx�?>Պ�+�>�W���,Ly!_�D���Ō�l���Q�!�[ �S����J��1��Ɛ�Y}��b,+�Lo�x�ɓ)����=�y�oh�@�꥟/��I��ѭ=��P�y9��� �ۍYӘ�e+�p�Jnϱ?V\SO%�(�t� ���=?MR�[Ș�����d�/ ��n�l��B�7j� ��!�;ӥ�/�[-���A�>��dN�sLj ��,ɪv��=1c�.SQ�O3�U���ƀ�ܽ�E����������̻��9G�ϷD�7(�}��Ävӌ\��y�_0[w ���<΍>����a_��[0+�L��F.�޺��f�>oN�T����q;���y\��bՃ��y�jH�<|q-eɏ�_?_9+P���Hp$�����[ux�K w�Mw��N�ی'$Y2�=��q���KB��P��~�������Yul:�[<����F1�2�O���5=d����]Y�sw:���Ϯ���E��j,_Q��X��z`H1,#II ��d�wr��P˂@�ZJV����y$�\y�{}��^~���[:N����ߌ�U�������O��d�����ؾe��${p>G��3c���Ė�lʌ�� ת��[��`ϱ�-W����dg�I��ig2��� ��}s ��ؤ(%#sS@���~���3�X�nRG�~\jc3�v��ӍL��M[JB�T��s3}��j�Nʖ��W����;7���ç?=X�F=-�=����q�ߚ���#���='�c��7���ڑW�I(O+=:uxq�������������e2�zi+�kuG�R��������0�&e�n���iT^J����~\jy���p'dtG��s����O��3����9* �b#Ɋ�� p������[Bws�T�>d4�ۧs���nv�n���U���_�~,�v����ƜJ1��s�� �QIz���)�(lv8M���U=�;����56��G���s#�K���MP�=��LvyGd��}�VwWBF�'�à �?MH�U�g2�� ����!�p�7Q��j��ڴ����=��j�u��� Jn�A s���uM������e��Ɔ�Ҕ�!)�'��8Ϣ�ٔ���ޝ(��Vp���צ֖d=�IC�J�Ǡ{q������kԭ�߸���i��@K����u�|�p=..�*+����x�����z[Aqġ#s2a�Ɗ���RR�)*HRsi�~�a &f��M��P����-K�L@��Z��Xy�'x�{}��Zm+���:�)�) IJ�-i�u���� ���ܒH��'��L(7�y�GӜq���� j��� 6ߌg1�g�o���,kر���tY�?W,���p���e���f�OQS��!K�۟cҒA�|ս�j�>��=⬒��˧L[�� �߿2JaB~R��u�:��Q�] �0H~���]�7��Ƽ�I���(�}��cq '�ήET���q�?f�ab���ӥvr� �)o��-Q��_'����ᴎo��K������;��V���o��%���~OK ����*��b�f:���-ťIR��`B�5!RB@���ï�� �u �̯e\�_U�_������� g�ES��3��������QT��a�����x����U<~�c?�*�#]�MW,[8O�a�x��]�1bC|踤�P��lw5V%�)�{t�<��d��5���0i�XSU��m:��Z�┵�i�"��1�^B�-��P�hJ��&)O��*�D��c�W��vM��)����}���P��ܗ-q����\mmζZ-l@�}��a��E�6��F�@��&Sg@���ݚ�M����� ȹ 4����#p�\H����dYDo�H���"��\��..R�B�H�z_�/5˘����6��KhJR��P�mƶi�m���3��,#c�co��q�a)*P�t����R�m�k�7x�D�E�\Y�閣_X�<���~�)���c[[�BP����6�Yq���S��0����%_����;��Àv�~�| VS؇ ��'O0��F0��\���U�-�d@�����7�SJ*z��3n��y��P����O����������m�~�P�3|Y��ʉr#�C�<�G~�.,! ���bqx���h~0=��!ǫ�jy����l��O,�[B��~��|9��ٱ����Xly�#�i�B��g%�S��������tˋ���e���ې��\[d�t)��.+u�|1 ������#�~Oj����hS�%��i.�~X���I�H�m��0n���c�1uE�q��cF�RF�o���7� �O�ꮧ� ���ۛ{��ʛi5�rw?׌#Qn�TW��~?y$��m\�\o����%W� ?=>S�N@�� �Ʈ���R����N�)�r"C�:��:����� �����#��qb��Y�. �6[��2K����2u�Ǧ�HYR��Q�MV��� �G�$��Q+.>�����nNH��q�^��� ����q��mM��V��D�+�-�#*�U�̒ ���p욳��u:�������IB���m����PV@O���r[b= �� ��1U�E��_Nm�yKbN�O���U�}�the�`�|6֮P>�\2�P�V���I�D�i�P�O;�9�r�mAHG�W�S]��J*�_�G��+kP�2����Ka�Z���H�'K�x�W�MZ%�O�YD�Rc+o��?�q��Ghm��d�S�oh�\�D�|:W������UA�Qc yT�q��������~^�H��/��#p�CZ���T�I�1�ӏT����4��"�ČZ�����}��`w�#�*,ʹ�� ��0�i��課�Om�*�da��^gJ݅{���l�e9uF#T�ֲ��̲�ٞC"�q���ߍ ոޑ�o#�XZTp����@ o�8��(jd��xw�]�,f���`~��|,s��^����f�1���t��|��m�򸄭/ctr��5s��7�9Q�4�H1꠲BB@�l9@���C�����+�wp�xu�£Yc�9��?`@#�o�mH�s2��)�=��2�.�l����jg�9$�Y�S�%*L������R�Y������7Z���,*=�䷘$�������arm�o�ϰ���UW.|�r�uf����IGw�t����Zwo��~5 ��YյhO+=8fF�)�W�7�L9lM�̘·Y���֘YLf�큹�pRF���99.A �"wz��=E\Z���'a� 2��Ǚ�#;�'}�G���*��l��^"q��+2FQ� hj��kŦ��${���ޮ-�T�٭cf�|�3#~�RJ����t��$b�(R��(����r���dx� >U b�&9,>���%E\� Ά�e�$��'�q't��*�א���ެ�b��-|d���SB�O�O��$�R+�H�)�܎�K��1m`;�J�2�Y~9��O�g8=vqD`K[�F)k�[���1m޼c��n���]s�k�z$@��)!I �x՝"v��9=�ZA=`Ɠi �:�E��)`�7��vI��}d�YI�_ �o�:ob���o ���3Q��&D&�2=�� �Ά��;>�h����y.*ⅥS������Ӭ�+q&����j|UƧ�����}���J0��WW< ۋS�)jQR�j���Ư��rN)�Gű�4Ѷ(�S)Ǣ�8��i��W52���No˓� ۍ%�5brOn�L�;�n��\G����=�^U�dI���8$�&���h��'���+�(������cȁ߫k�l��S^���cƗjԌE�ꭔ��gF���Ȓ��@���}O���*;e�v�WV���YJ\�]X'5��ղ�k�F��b 6R�o՜m��i N�i�����>J����?��lPm�U��}>_Z&�KK��q�r��I�D�Չ~�q�3fL�:S�e>���E���-G���{L�6p�e,8��������QI��h��a�Xa��U�A'���ʂ���s�+טIjP�-��y�8ۈZ?J$��W�P� ��R�s�]��|�l(�ԓ��sƊi��o(��S0���Y� 8�T97.�����WiL��c�~�dxc�E|�2!�X�K�Ƙਫ਼�$((�6�~|d9u+�qd�^3�89��Y�6L�.I�����?���iI�q���9�)O/뚅����O���X��X�V��ZF[�یgQ�L��K1���RҖr@v�#��X�l��F���Нy�S�8�7�kF!A��sM���^rkp�jP�DyS$N���q���nxҍ!U�f�!eh�i�2�m����`�Y�I�9r�6� �TF���C}/�y�^���Η���5d�'��9A-��J��>{�_l+�`��A���[�'��յ�ϛ#w:݅�%��X�}�&�PSt�Q�"�-��\縵�/����$Ɨh�Xb�*�y��BS����;W�ջ_mc�����vt?2}1�;qS�d�d~u:2k5�2�R�~�z+|HE!)�Ǟl��7`��0�<�,�2*���Hl-��x�^����'_TV�gZA�'j� ^�2Ϊ��N7t�����?w�� �x1��f��Iz�C-Ȗ��K�^q�;���-W�DvT�7��8�Z�������� hK�(P:��Q- �8�n�Z���܃e貾�<�1�YT<�,�����"�6{�/ �?�͟��|1�:�#g��W�>$����d��J��d�B���=��jf[��%rE^��il:��B���x���Sּ�1հ��,�=��*�7 fcG��#q� �eh?��2�7�����,�!7x��6�n�LC�4x��},Geǝ�tC.��vS �F�43��zz\��;QYC,6����~;RYS/6���|2���5���v��T��i����������mlv��������&� �nRh^ejR�LG�f���? �ۉҬܦƩ��|��Ȱ����>3����!v��i�ʯ�>�v��オ�X3e���_1z�Kȗ\<������!�8���V��]��?b�k41�Re��T�q��mz��TiOʦ�Z��Xq���L������q"+���2ۨ��8}�&N7XU7Ap�d�X��~�׿��&4e�o�F��� �H�����O���č�c�� 懴�6���͉��+)��v;j��ݷ�� �UV�� i��� j���Y9GdÒJ1��詞�����V?h��l�����l�cGs�ځ�������y�Ac������\V3�? �� ܙg�>qH�S,�E�W�[�㺨�uch�⍸�O�}���a��>�q�6�n6�����N6�q��������N� ���! 1AQaq�0@����"2BRb�#Pr���3C`��Scst���$4D���%Td���� ?�����N����a��3��m���C���w��������xA�m�q�m����m������$����4n淿t'��C"w��zU=D�\R+w�p+Y�T�&�պ@��ƃ��3ޯ?�Aﶂ��aŘ���@-�����Q�=���9D��ռ�ѻ@��M�V��P��܅�G5�f�Y<�u=,EC)�<�Fy'�"�&�չ�X~f��l�KԆV��?�� �W�N����=(� �;���{�r����ٌ�Y���h{�١������jW����P���Tc�����X�K�r��}���w�R��%��?���E��m�� �Y�q|����\lEE4����r���}�lsI�Y������f�$�=�d�yO����p�����yBj8jU�o�/�S��?�U��*������ˍ�0�������u�q�m [�?f����a�� )Q�>����6#������� ?����0UQ����,IX���(6ڵ[�DI�MNލ�c&���υ�j\��X�R|,4��� j������T�hA�e��^���d���b<����n�� �즇�=!���3�^�`j�h�ȓr��jẕ�c�,ٞX����-����a�ﶔ���#�$��]w�O��Ӫ�1y%��L�Y<�wg#�ǝ�̗`�x�xa�t�w��»1���o7o5��>�m뭛C���Uƃߜ}�C���y1Xνm�F8�jI���]����H���ۺиE@I�i;r�8ӭ�����V�F�Շ| ��&?�3|x�B�MuS�Ge�=Ӕ�#BE5G������Y!z��_e��q�р/W>|-�Ci߇�t�1ޯќd�R3�u��g�=0 5��[?�#͏��q�cf���H��{ ?u�=?�?ǯ���}Z��z���hmΔ�BFTW�����<�q��(v� ��!��z���iW]*�J�V�z��gX֧A�q�&��/w���u�gYӘa���; �i=����g:��?2�dž6�ى�k�4�>�Pxs����}������G�9���3 ���)gG�R<>r h�$��'nc�h�P��Bj��J�ҧH� -��N1���N��?��~��}-q!=��_2hc�M��l�vY%UE�@|�v����M2�.Y[|y�"Eï��K�ZF,�ɯ?,q�?v�M 80jx�"�;�9vk�����+ ֧�� �ȺU��?�%�vcV��mA�6��Qg^M�����A}�3�nl� QRN�l8�kkn�'�����(��M�7m9و�q���%ޟ���*h$Zk"��$�9��: �?U8�Sl��,,|ɒ��xH(ѷ����Gn�/Q�4�P��G�%��Ա8�N��!� �&�7�;���eKM7�4��9R/%����l�c>�x;������>��C�:�����t��h?aKX�bhe�ᜋ^�$�Iհ �hr7%F$�E��Fd���t��5���+�(M6�t����Ü�UU|zW�=a�Ts�Tg������dqP�Q����b'�m���1{|Y����X�N��b �P~��F^F:����k6�"�j!�� �I�r�`��1&�-$�Bevk:y���#y�w��I0��x��=D�4��tU���P�ZH��ڠ底taP��6����b>�xa�����Q�#� WeF��ŮNj�p�J* mQ�N�����*I�-*�ȩ�F�g�3 �5��V�ʊ�ɮ�a��5F���O@{���NX��?����H�]3��1�Ri_u��������ѕ�� ����0��� F��~��:60�p�͈�S��qX#a�5>���`�o&+�<2�D����: �������ڝ�$�nP���*)�N�|y�Ej�F�5ټ�e���ihy�Z �>���k�bH�a�v��h�-#���!�Po=@k̆IEN��@��}Ll?j�O������߭�ʞ���Q|A07x���wt!xf���I2?Z��<ץ�T���cU�j��]���陎Ltl �}5�ϓ��$�,��O�mˊ�;�@O��jE��j(�ا,��LX���LO���Ц�90�O �.����a��nA���7������j4 ��W��_ٓ���zW�jcB������y՗+EM�)d���N�g6�y1_x��p�$Lv�:��9�"z��p���ʙ$��^��JԼ*�ϭ����o���=x�Lj�6�J��u82�A�H�3$�ٕ@�=Vv�]�'�qEz�;I˼��)��=��ɯ���x �/�W(V���p�����$ �m�������u�����񶤑Oqˎ�T����r��㠚x�sr�GC��byp�G��1ߠ�w e�8�$⿄����/�M{*}��W�]˷.�CK\�ުx���/$�WP�w���r� |i���&�}�{�X� �>��$-��l���?-z���g����lΆ���(F���h�vS*���b���߲ڡn,|)mrH[���a�3�ר�[1��3o_�U�3�TC�$��(�=�)0�kgP���� ��u�^=��4 �WYCҸ:��vQ�ר�X�à��tk�m,�t*��^�,�}D*�� �"(�I��9R����>`�`��[~Q]�#af��i6l��8���6�:,s�s�N6�j"�A4���IuQ��6E,�GnH��zS�HO�uk�5$�I�4��ؤ�Q9�@��C����wp��BGv[]�u�Ov����0I4���\��y�����Q�Ѹ��~>Z��8�T��a��q�ޣ;z��a���/��S��I:�ܫ_�|������>=Z����8:�S��U�I�J��"IY���8%b8���H��:�QO�6�;7�I�S��J��ҌAά3��>c���E+&jf$eC+�z�;��V����� �r���ʺ������my�e���aQ�f&��6�ND���.:��NT�vm�<- u���ǝ\MvZY�N�NT��-A�>jr!S��n�O 1�3�Ns�%�3D@���`������ܟ 1�^c<���� �a�ɽ�̲�Xë#�w�|y�cW�=�9I*H8�p�^(4���՗�k��arOcW�tO�\�ƍR��8����'�K���I�Q�����?5�>[�}��yU�ײ -h��=��% q�ThG�2�)���"ו3]�!kB��*p�FDl�A���,�eEi�H�f�Ps�����5�H:�Փ~�H�0Dت�D�I����h�F3�������c��2���E��9�H��5�zԑ�ʚ�i�X�=:m�xg�hd(�v����׊�9iS��O��d@0ڽ���:�p�5�h-��t�&���X�q�ӕ,��ie�|���7A�2���O%P��E��htj��Y1��w�Ѓ!����  ���� ࢽ��My�7�\�a�@�ţ�J ��4�Ȼ�F�@o�̒?4�wx��)��]�P��~�����u�����5�����7X ��9��^ܩ�U;Iꭆ 5 �������eK2�7(�{|��Y׎ �V��\"���Z�1� Z�����}��(�Ǝ"�1S���_�vE30>���p;� ΝD��%x�W�?W?v����o�^V�i�d��r[��/&>�~`�9Wh��y�;���R���� ;;ɮT��?����r$�g1�K����A��C��c��K��l:�'��3 c�ﳯ*"t8�~l��)���m��+U,z��`(��>yJ�?����h>��]��v��ЍG*�{`��;y]��I�T� ;c��NU�fo¾h���/$���|NS���1�S�"�H��V���T���4��uhǜ�]�v;���5�͠x��'C\�SBpl���h}�N����� A�Bx���%��ޭ�l��/����T��w�ʽ]D�=����K���ž�r㻠l4�S�O?=�k �M:� ��c�C�a�#ha���)�ѐxc�s���gP�iG���{+���x���Q���I= �� z��ԫ+ �8"�k�ñ�j=|����c ��y��CF��/���*9ж�h{ �?4�o� ��k�m�Q�N�x��;�Y��4膚�a�w?�6�>�e]�����Q�r�:����g�,i"�����ԩA��*M�<�G��b�if��l^M��5�� �Ҩ�{����6J��ZJ�����P�*�����Y���ݛu�_4�9�I8�7���������,^ToR���m4�H��?�N�S�ѕw��/S��甍�@�9H�S�T��t�ƻ���ʒU��*{Xs�@����f������֒Li�K{H�w^���������Ϥm�tq���s� ���ք��f:��o~s��g�r��ט� �S�ѱC�e]�x���a��) ���(b-$(�j>�7q�B?ӕ�F��hV25r[7 Y� }L�R��}����*sg+��x�r�2�U=�*'WS��ZDW]�WǞ�<��叓���{�$�9Ou4��y�90-�1�'*D`�c�^o?(�9��u���ݐ��'PI&� f�Jݮ�������:wS����jfP1F:X �H�9dԯ����˝[�_54 �}*;@�ܨ�� ð�yn�T���?�ןd�#���4rG�ͨ��H�1�|-#���Mr�S3��G�3�����)�.᧏3v�z֑��r����$G"�`j �1t��x0<Ɔ�Wh6�y�6��,œ�Ga��gA����y��b��)���h�D��ß�_�m��ü �gG;��e�v��ݝ�nQ� ��C����-�*��o���y�a��M��I�>�<���]obD��"�:���G�A��-\%LT�8���c�)��+y76���o�Q�#*{�(F�⽕�y����=���rW�\p���۩�c���A���^e6��K������ʐ�cVf5$�'->���ՉN"���F�"�UQ@�f��Gb~��#�&�M=��8�ט�JNu9��D��[̤�s�o�~������� G��9T�tW^g5y$b��Y'��س�Ǵ�=��U-2 #�MC�t(�i� �lj�@Q 5�̣i�*�O����s�x�K�f��}\��M{E�V�{�υ��Ƈ�����);�H����I��fe�Lȣr�2��>��W��I�Ȃ6������i��k�� �5�YOxȺ����>��Y�f5'��|��H+��98pj�n�.O�y�������jY��~��i�w'������l�;�s�2��Y��:'lg�ꥴ)o#'Sa�a�K��Z� �m��}�`169�n���"���x��I ��*+� }F<��cГ���F�P�������ֹ*�PqX�x۩��,� ��N�� �4<-����%����:��7����W���u�`����� $�?�I��&����o��o��`v�>��P��"��l���4��5'�Z�gE���8���?��[�X�7(��.Q�-��*���ތL@̲����v��.5���[��=�t\+�CNܛ��,g�SQnH����}*F�G16���&:�t��4ُ"A��̣��$�b �|����#rs��a�����T�� ]�<�j��B�S�('$�ɻ� �wP;�/�n��?�ݜ��x�F��yUn�~mL*-�������Xf�wd^�a�}��f�,=t�׵i�.2/wpN�Ep8�OР���•��R�FJ� 55TZ��T �ɭ�<��]��/�0�r�@�f��V��V����Nz�G��^���7hZi����k��3�,kN�e|�vg�1{9]_i��X5y7� 8e]�U����'�-2,���e"����]ot�I��Y_��n�(JҼ��1�O ]bXc���Nu�No��pS���Q_���_�?i�~�x h5d'�(qw52] ��'ޤ�q��o1�R!���`ywy�A4u���h<קy���\[~�4�\ X�Wt/� 6�����n�F�a8��f���z �3$�t(���q��q�x��^�XWeN'p<-v�!�{�(>ӽDP7��ո0�y)�e$ٕv�Ih'Q�EA�m*�H��RI��=:��� ���4牢) �%_iN�ݧ�l]� �Nt���G��H�L��� ɱ�g<���1V�,�J~�ٹ�"K��Q�� 9�HS�9�?@��k����r�;we݁�]I�!{ �@�G�[�"��`���J:�n]�{�cA�E����V��ʆ���#��U9�6����j�#Y�m\��q�e4h�B�7��C�������d<�?J����1g:ٳ���=Y���D�p�ц� ׈ǔ��1�]26؜oS�'��9�V�FVu�P�h�9�xc�oq�X��p�o�5��Ա5$�9W�V(�[Ak�aY錎qf;�'�[�|���b�6�Ck��)��#a#a˙��8���=äh�4��2��C��4tm^ �n'c����]GQ$[Wҿ��i���vN�{Fu ��1�gx��1┷���N�m��{j-,��x�� Ūm�ЧS�[�s���Gna���䑴�� x�p 8<������97�Q���ϴ�v�aϚG��Rt�Һ׈�f^\r��WH�JU�7Z���y)�vg=����n��4�_)y��D'y�6�]�c�5̪��\� �PF�k����&�c;��cq�$~T�7j ���nç]�<�g ":�to�t}�159�<�/�8������m�b�K#g'I'.W������6��I/��>v��\�MN��g���m�A�yQL�4u�Lj�j9��#44�t��l^�}L����n��R��!��t��±]��r��h6ٍ>�yҏ�N��fU�� ���� Fm@�8}�/u��jb9������he:A�y�ծw��GpΧh�5����l}�3p468��)U��d��c����;Us/�֔�YX�1�O2��uq�s��`hwg�r~�{ R��mhN��؎*q 42�*th��>�#���E����#��Hv�O����q�}������6�e��\�,Wk�#���X��b>��p}�դ��3���T5��†��6��[��@��P�y*n��|'f�֧>�lư΂�̺����SU�'*�q�p�_S�����M�� '��c�6������m�� ySʨ;M��r���Ƌ�m�Kxo,���Gm�P��A�G�:��i��w�9�}M(�^�V��$ǒ�ѽ�9���|���� �a����J�SQ�a���r�B;����}���ٻ֢�2�%U���c�#�g���N�a�ݕ�'�v�[�OY'��3L�3�;,p�]@�S��{ls��X�'���c�jw��k'a�.��}�}&�� �dP�*�bK=ɍ!����;3n�gΊU�ߴmt�'*{,=SzfD� A��ko~�G�aoq�_mi}#�m�������P�Xhύ�����mxǍ�΂���巿zf��Q���c���|kc�����?���W��Y�$���_Lv����l߶��c���`?����l�j�ݲˏ!V��6����U�Ђ(A���4y)H���p�Z_�x��>���e���R��$�/�`^'3qˏ�-&Q�=?��CFVR �D�fV�9��{�8g�������n�h�(P"��6�[�D���< E�����~0<@�`�G�6����Hг�cc�� �c�K.5��D��d�B���`?�XQ��2��ٿyqo&+�1^� DW�0�ꊩ���G�#��Q�nL3��c���������/��x ��1�1�[y�x�პCW��C�c�UĨ80�m�e�4.{�m��u���I=��f�����0QRls9���f���������9���~f�����Ǩ��a�"@�8���ȁ�Q����#c�ic������G��$���G���r/$W�(��W���V�"��m�7�[m�A�m����bo��D� j����۳� l���^�k�h׽����� ��#� iXn�v��eT�k�a�^Y�4�BN���ĕ���0������� !01@Q"2AaPq3BR�������?�����@4�Q�����T3,���㺠�W�[=JK�Ϟ���2�r^7��vc�:�9 �E�ߴ�w�S#d���Ix��u��:��Hp��9E!�� V 2;73|F��9Y���*ʬ�F��D����u&���y؟��^EA��A��(ɩ���^��GV:ݜDy�`��Jr29ܾ�㝉��[���E;Fzx��YG��U�e�Y�C���� ����v-tx����I�sם�Ę�q��Eb�+P\ :>�i�C'�;�����k|z�رn�y]�#ǿb��Q��������w�����(�r|ӹs��[�D��2v-%��@;�8<a���[\o[ϧw��I!��*0�krs)�[�J9^��ʜ��p1)� "��/_>��o��<1����A�E�y^�C��`�x1'ܣn�p��s`l���fQ��):�l����b>�Me�jH^?�kl3(�z:���1ŠK&?Q�~�{�ٺ�h�y���/�[��V�|6��}�KbX����mn[-��7�5q�94�������dm���c^���h� X��5��<�eޘ>G���-�}�دB�ޟ� ��|�rt�M��V+�]�c?�-#ڛ��^ǂ}���Lkr���O��u�>�-D�ry� D?:ޞ�U��ǜ�7�V��?瓮�"�#���r��չģVR;�n���/_� ؉v�ݶe5d�b9��/O��009�G���5n�W����JpA�*�r9�>�1��.[t���s�F���nQ� V 77R�]�ɫ8����_0<՜�IF�u(v��4��F�k�3��E)��N:��yڮe��P�`�1}�$WS��J�SQ�N�j��ٺ��޵�#l���ј(�5=��5�lǏmoW�v-�1����v,W�mn��߀$x�<����v�j(����c]��@#��1������Ǔ���o'��u+����;G�#�޸��v-lη��/(`i⣍Pm^����ԯ̾9Z��F��������n��1��� ��]�[��)�'�������:�֪�W��FC����� �B9،!?���]��V��A�Վ�M��b�w��G F>_DȬ0¤�#�QR�[V��kz���m�w�"��9ZG�7'[��=�Q����j8R?�zf�\a�=��O�U����*oB�A�|G���2�54 �p��.w7� �� ���&������ξxGHp� B%��$g�����t�Џ򤵍z���HN�u�Я�-�'4��0���;_���3������� !01"@AQa2Pq#3BR�������?����ʩca��en��^��8���<�u#��m*08r��y�N"�<�Ѳ0��@\�p��� �����Kv�D��J8�Fҽ� �f�Y��-m�ybX�NP����}�!*8t(�OqѢ��Q�wW�K��ZD��Δ^e��!� ��B�K��p~�����e*l}z#9ң�k���q#�Ft�o��S�R����-�w�!�S���Ӥß|M�l޶V��!eˈ�8Y���c�ЮM2��tk���� ������J�fS����Ö*i/2�����n]�k�\���|4yX�8��U�P.���Ы[���l��@"�t�<������5�lF���vU�����W��W��;�b�cД^6[#7@vU�xgZv��F�6��Q,K�v��� �+Ъ��n��Ǣ��Ft���8��0��c�@�!�Zq s�v�t�;#](B��-�nῃ~���3g������5�J�%���O������n�kB�ĺ�.r��+���#�N$?�q�/�s�6��p��a����a��J/��M�8��6�ܰ"�*������ɗud"\w���aT(����[��F��U՛����RT�b���n�*��6���O��SJ�.�ij<�v�MT��R\c��5l�sZB>F��<7�;EA��{��E���Ö��1U/�#��d1�a�n.1ě����0�ʾR�h��|�R��Ao�3�m3 ��%�� ���28Q�� ��y��φ���H�To�7�lW>����#i`�q���c����a��� �m,B�-j����݋�'mR1Ήt�>��V��p���s�0IbI�C.���1R�ea�����]H�6�����������4B>��o��](��$B���m�����a�!=���?�B� K�Ǿ+�Ծ"�n���K��*��+��[T#�{�E�J�S����Q�����s�5�:�U�\wĐ�f�3����܆&�)�����I���Ԇw��E T�lrTf6Q|R�h:��[K�� �z��c֧�G�C��%\��_�a��84��HcO�bi��ؖV��7H �)*ģK~Xhչ0��4?�0��� �E<���}3���#���u�?�� ��|g�S�6ꊤ�|�I#Hڛ� �ա��w�X��9��7���Ŀ%�SL��y6č��|�F�a 8���b���$�sק�h���b9RAu7�˨p�Č�_\*w��묦��F ����4D~�f����|(�"m���NK��i�S�>�$d7SlA��/�²����SL��|6N�}���S�˯���g��]6��; �#�.��<���q'Q�1|KQ$�����񛩶"�$r�b:���N8�w@��8$�� �AjfG|~�9F ���Y��ʺ��Bwؒ������M:I岎�G��`s�YV5����6��A �b:�W���G�q%l�����F��H���7�������Fsv7���k�� 403WebShell
403Webshell
Server IP : 93.127.173.68  /  Your IP : 216.73.216.150
Web Server : LiteSpeed
System : Linux in-mum-web1874.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User : u862839997 ( 862839997)
PHP Version : 8.2.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/go/pkg/mod/google.golang.org/protobuf@v1.35.2/internal/impl/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/go/pkg/mod/google.golang.org/protobuf@v1.35.2/internal/impl/message_reflect_test.go
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package impl_test

import (
	"fmt"
	"math"
	"reflect"
	"runtime"
	"strings"
	"sync"
	"testing"

	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"

	"google.golang.org/protobuf/encoding/prototext"
	pimpl "google.golang.org/protobuf/internal/impl"
	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/reflect/protodesc"
	"google.golang.org/protobuf/reflect/protoreflect"
	"google.golang.org/protobuf/reflect/protoregistry"
	"google.golang.org/protobuf/testing/protopack"

	proto2_20180125 "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20180125_92554152"
	testpb "google.golang.org/protobuf/internal/testprotos/test"
	"google.golang.org/protobuf/types/descriptorpb"
)

// List of test operations to perform on messages, lists, or maps.
type (
	messageOp  interface{ isMessageOp() }
	messageOps []messageOp

	listOp  interface{ isListOp() }
	listOps []listOp

	mapOp  interface{ isMapOp() }
	mapOps []mapOp
)

// Test operations performed on a message.
type (
	// check that the message contents match
	equalMessage struct{ protoreflect.Message }
	// check presence for specific fields in the message
	hasFields map[protoreflect.FieldNumber]bool
	// check that specific message fields match
	getFields map[protoreflect.FieldNumber]protoreflect.Value
	// set specific message fields
	setFields map[protoreflect.FieldNumber]protoreflect.Value
	// clear specific fields in the message
	clearFields []protoreflect.FieldNumber
	// check for the presence of specific oneof member fields.
	whichOneofs map[protoreflect.Name]protoreflect.FieldNumber
	// apply messageOps on each specified message field
	messageFields        map[protoreflect.FieldNumber]messageOps
	messageFieldsMutable map[protoreflect.FieldNumber]messageOps
	// apply listOps on each specified list field
	listFields        map[protoreflect.FieldNumber]listOps
	listFieldsMutable map[protoreflect.FieldNumber]listOps
	// apply mapOps on each specified map fields
	mapFields        map[protoreflect.FieldNumber]mapOps
	mapFieldsMutable map[protoreflect.FieldNumber]mapOps
	// range through all fields and check that they match
	rangeFields map[protoreflect.FieldNumber]protoreflect.Value
)

func (equalMessage) isMessageOp()         {}
func (hasFields) isMessageOp()            {}
func (getFields) isMessageOp()            {}
func (setFields) isMessageOp()            {}
func (clearFields) isMessageOp()          {}
func (whichOneofs) isMessageOp()          {}
func (messageFields) isMessageOp()        {}
func (messageFieldsMutable) isMessageOp() {}
func (listFields) isMessageOp()           {}
func (listFieldsMutable) isMessageOp()    {}
func (mapFields) isMessageOp()            {}
func (mapFieldsMutable) isMessageOp()     {}
func (rangeFields) isMessageOp()          {}

// Test operations performed on a list.
type (
	// check that the list contents match
	equalList struct{ protoreflect.List }
	// check that list length matches
	lenList int
	// check that specific list entries match
	getList map[int]protoreflect.Value
	// set specific list entries
	setList map[int]protoreflect.Value
	// append entries to the list
	appendList []protoreflect.Value
	// apply messageOps on a newly appended message
	appendMessageList messageOps
	// truncate the list to the specified length
	truncList int
)

func (equalList) isListOp()         {}
func (lenList) isListOp()           {}
func (getList) isListOp()           {}
func (setList) isListOp()           {}
func (appendList) isListOp()        {}
func (appendMessageList) isListOp() {}
func (truncList) isListOp()         {}

// Test operations performed on a map.
type (
	// check that the map contents match
	equalMap struct{ protoreflect.Map }
	// check that map length matches
	lenMap int
	// check presence for specific entries in the map
	hasMap map[any]bool
	// check that specific map entries match
	getMap map[any]protoreflect.Value
	// set specific map entries
	setMap map[any]protoreflect.Value
	// clear specific entries in the map
	clearMap []any
	// apply messageOps on each specified message entry
	messageMap map[any]messageOps
	// range through all entries and check that they match
	rangeMap map[any]protoreflect.Value
)

func (equalMap) isMapOp()   {}
func (lenMap) isMapOp()     {}
func (hasMap) isMapOp()     {}
func (getMap) isMapOp()     {}
func (setMap) isMapOp()     {}
func (clearMap) isMapOp()   {}
func (messageMap) isMapOp() {}
func (rangeMap) isMapOp()   {}

type ScalarProto2 struct {
	Bool    *bool    `protobuf:"1"`
	Int32   *int32   `protobuf:"2"`
	Int64   *int64   `protobuf:"3"`
	Uint32  *uint32  `protobuf:"4"`
	Uint64  *uint64  `protobuf:"5"`
	Float32 *float32 `protobuf:"6"`
	Float64 *float64 `protobuf:"7"`
	String  *string  `protobuf:"8"`
	StringA []byte   `protobuf:"9"`
	Bytes   []byte   `protobuf:"10"`
	BytesA  *string  `protobuf:"11"`

	MyBool    *MyBool    `protobuf:"12"`
	MyInt32   *MyInt32   `protobuf:"13"`
	MyInt64   *MyInt64   `protobuf:"14"`
	MyUint32  *MyUint32  `protobuf:"15"`
	MyUint64  *MyUint64  `protobuf:"16"`
	MyFloat32 *MyFloat32 `protobuf:"17"`
	MyFloat64 *MyFloat64 `protobuf:"18"`
	MyString  *MyString  `protobuf:"19"`
	MyStringA MyBytes    `protobuf:"20"`
	MyBytes   MyBytes    `protobuf:"21"`
	MyBytesA  *MyString  `protobuf:"22"`
}

func mustMakeEnumDesc(path string, syntax protoreflect.Syntax, enumDesc string) protoreflect.EnumDescriptor {
	s := fmt.Sprintf(`name:%q syntax:%q enum_type:[{%s}]`, path, syntax, enumDesc)
	pb := new(descriptorpb.FileDescriptorProto)
	if err := prototext.Unmarshal([]byte(s), pb); err != nil {
		panic(err)
	}
	fd, err := protodesc.NewFile(pb, nil)
	if err != nil {
		panic(err)
	}
	return fd.Enums().Get(0)
}

func mustMakeMessageDesc(path string, syntax protoreflect.Syntax, fileDesc, msgDesc string, r protodesc.Resolver) protoreflect.MessageDescriptor {
	s := fmt.Sprintf(`name:%q syntax:%q %s message_type:[{%s}]`, path, syntax, fileDesc, msgDesc)
	pb := new(descriptorpb.FileDescriptorProto)
	if err := prototext.Unmarshal([]byte(s), pb); err != nil {
		panic(err)
	}
	fd, err := protodesc.NewFile(pb, r)
	if err != nil {
		panic(err)
	}
	return fd.Messages().Get(0)
}

var V = protoreflect.ValueOf
var VE = func(n protoreflect.EnumNumber) protoreflect.Value { return V(n) }

type (
	MyBool    bool
	MyInt32   int32
	MyInt64   int64
	MyUint32  uint32
	MyUint64  uint64
	MyFloat32 float32
	MyFloat64 float64
	MyString  string
	MyBytes   []byte

	ListStrings []MyString
	ListBytes   []MyBytes

	MapStrings map[MyString]MyString
	MapBytes   map[MyString]MyBytes
)

var scalarProto2Type = pimpl.MessageInfo{GoReflectType: reflect.TypeOf(new(ScalarProto2)), Desc: mustMakeMessageDesc("scalar2.proto", protoreflect.Proto2, "", `
		name: "ScalarProto2"
		field: [
			{name:"f1"  number:1  label:LABEL_OPTIONAL type:TYPE_BOOL   default_value:"true"},
			{name:"f2"  number:2  label:LABEL_OPTIONAL type:TYPE_INT32  default_value:"2"},
			{name:"f3"  number:3  label:LABEL_OPTIONAL type:TYPE_INT64  default_value:"3"},
			{name:"f4"  number:4  label:LABEL_OPTIONAL type:TYPE_UINT32 default_value:"4"},
			{name:"f5"  number:5  label:LABEL_OPTIONAL type:TYPE_UINT64 default_value:"5"},
			{name:"f6"  number:6  label:LABEL_OPTIONAL type:TYPE_FLOAT  default_value:"6"},
			{name:"f7"  number:7  label:LABEL_OPTIONAL type:TYPE_DOUBLE default_value:"7"},
			{name:"f8"  number:8  label:LABEL_OPTIONAL type:TYPE_STRING default_value:"8"},
			{name:"f9"  number:9  label:LABEL_OPTIONAL type:TYPE_STRING default_value:"9"},
			{name:"f10" number:10 label:LABEL_OPTIONAL type:TYPE_BYTES  default_value:"10"},
			{name:"f11" number:11 label:LABEL_OPTIONAL type:TYPE_BYTES  default_value:"11"},

			{name:"f12" number:12 label:LABEL_OPTIONAL type:TYPE_BOOL   default_value:"true"},
			{name:"f13" number:13 label:LABEL_OPTIONAL type:TYPE_INT32  default_value:"13"},
			{name:"f14" number:14 label:LABEL_OPTIONAL type:TYPE_INT64  default_value:"14"},
			{name:"f15" number:15 label:LABEL_OPTIONAL type:TYPE_UINT32 default_value:"15"},
			{name:"f16" number:16 label:LABEL_OPTIONAL type:TYPE_UINT64 default_value:"16"},
			{name:"f17" number:17 label:LABEL_OPTIONAL type:TYPE_FLOAT  default_value:"17"},
			{name:"f18" number:18 label:LABEL_OPTIONAL type:TYPE_DOUBLE default_value:"18"},
			{name:"f19" number:19 label:LABEL_OPTIONAL type:TYPE_STRING default_value:"19"},
			{name:"f20" number:20 label:LABEL_OPTIONAL type:TYPE_STRING default_value:"20"},
			{name:"f21" number:21 label:LABEL_OPTIONAL type:TYPE_BYTES  default_value:"21"},
			{name:"f22" number:22 label:LABEL_OPTIONAL type:TYPE_BYTES  default_value:"22"}
		]
	`, nil),
}

func (m *ScalarProto2) ProtoReflect() protoreflect.Message { return scalarProto2Type.MessageOf(m) }

func TestScalarProto2(t *testing.T) {
	testMessage(t, nil, new(ScalarProto2).ProtoReflect(), messageOps{
		hasFields{
			1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false,
			12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false, 20: false, 21: false, 22: false,
		},
		getFields{
			1: V(bool(true)), 2: V(int32(2)), 3: V(int64(3)), 4: V(uint32(4)), 5: V(uint64(5)), 6: V(float32(6)), 7: V(float64(7)), 8: V(string("8")), 9: V(string("9")), 10: V([]byte("10")), 11: V([]byte("11")),
			12: V(bool(true)), 13: V(int32(13)), 14: V(int64(14)), 15: V(uint32(15)), 16: V(uint64(16)), 17: V(float32(17)), 18: V(float64(18)), 19: V(string("19")), 20: V(string("20")), 21: V([]byte("21")), 22: V([]byte("22")),
		},
		setFields{
			1: V(bool(false)), 2: V(int32(0)), 3: V(int64(0)), 4: V(uint32(0)), 5: V(uint64(0)), 6: V(float32(0)), 7: V(float64(0)), 8: V(string("")), 9: V(string("")), 10: V([]byte(nil)), 11: V([]byte(nil)),
			12: V(bool(false)), 13: V(int32(0)), 14: V(int64(0)), 15: V(uint32(0)), 16: V(uint64(0)), 17: V(float32(0)), 18: V(float64(0)), 19: V(string("")), 20: V(string("")), 21: V([]byte(nil)), 22: V([]byte(nil)),
		},
		hasFields{
			1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true, 9: true, 10: true, 11: true,
			12: true, 13: true, 14: true, 15: true, 16: true, 17: true, 18: true, 19: true, 20: true, 21: true, 22: true,
		},
		equalMessage{(&ScalarProto2{
			new(bool), new(int32), new(int64), new(uint32), new(uint64), new(float32), new(float64), new(string), []byte{}, []byte{}, new(string),
			new(MyBool), new(MyInt32), new(MyInt64), new(MyUint32), new(MyUint64), new(MyFloat32), new(MyFloat64), new(MyString), MyBytes{}, MyBytes{}, new(MyString),
		}).ProtoReflect()},
		clearFields{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22},
		equalMessage{new(ScalarProto2).ProtoReflect()},

		// Setting a bytes field nil empty bytes should preserve presence.
		setFields{10: V([]byte(nil)), 11: V([]byte(nil)), 21: V([]byte(nil)), 22: V([]byte(nil))},
		getFields{10: V([]byte{}), 11: V([]byte(nil)), 21: V([]byte{}), 22: V([]byte(nil))},
		hasFields{10: true, 11: true, 21: true, 22: true},
	})

	// Test read-only operations on nil message.
	testMessage(t, nil, (*ScalarProto2)(nil).ProtoReflect(), messageOps{
		hasFields{
			1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false,
			12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false, 20: false, 21: false, 22: false,
		},
		getFields{
			1: V(bool(true)), 2: V(int32(2)), 3: V(int64(3)), 4: V(uint32(4)), 5: V(uint64(5)), 6: V(float32(6)), 7: V(float64(7)), 8: V(string("8")), 9: V(string("9")), 10: V([]byte("10")), 11: V([]byte("11")),
			12: V(bool(true)), 13: V(int32(13)), 14: V(int64(14)), 15: V(uint32(15)), 16: V(uint64(16)), 17: V(float32(17)), 18: V(float64(18)), 19: V(string("19")), 20: V(string("20")), 21: V([]byte("21")), 22: V([]byte("22")),
		},
	})
}

type ScalarProto3 struct {
	Bool    bool    `protobuf:"1"`
	Int32   int32   `protobuf:"2"`
	Int64   int64   `protobuf:"3"`
	Uint32  uint32  `protobuf:"4"`
	Uint64  uint64  `protobuf:"5"`
	Float32 float32 `protobuf:"6"`
	Float64 float64 `protobuf:"7"`
	String  string  `protobuf:"8"`
	StringA []byte  `protobuf:"9"`
	Bytes   []byte  `protobuf:"10"`
	BytesA  string  `protobuf:"11"`

	MyBool    MyBool    `protobuf:"12"`
	MyInt32   MyInt32   `protobuf:"13"`
	MyInt64   MyInt64   `protobuf:"14"`
	MyUint32  MyUint32  `protobuf:"15"`
	MyUint64  MyUint64  `protobuf:"16"`
	MyFloat32 MyFloat32 `protobuf:"17"`
	MyFloat64 MyFloat64 `protobuf:"18"`
	MyString  MyString  `protobuf:"19"`
	MyStringA MyBytes   `protobuf:"20"`
	MyBytes   MyBytes   `protobuf:"21"`
	MyBytesA  MyString  `protobuf:"22"`
}

var scalarProto3Type = pimpl.MessageInfo{GoReflectType: reflect.TypeOf(new(ScalarProto3)), Desc: mustMakeMessageDesc("scalar3.proto", protoreflect.Proto3, "", `
		name: "ScalarProto3"
		field: [
			{name:"f1"  number:1  label:LABEL_OPTIONAL type:TYPE_BOOL},
			{name:"f2"  number:2  label:LABEL_OPTIONAL type:TYPE_INT32},
			{name:"f3"  number:3  label:LABEL_OPTIONAL type:TYPE_INT64},
			{name:"f4"  number:4  label:LABEL_OPTIONAL type:TYPE_UINT32},
			{name:"f5"  number:5  label:LABEL_OPTIONAL type:TYPE_UINT64},
			{name:"f6"  number:6  label:LABEL_OPTIONAL type:TYPE_FLOAT},
			{name:"f7"  number:7  label:LABEL_OPTIONAL type:TYPE_DOUBLE},
			{name:"f8"  number:8  label:LABEL_OPTIONAL type:TYPE_STRING},
			{name:"f9"  number:9  label:LABEL_OPTIONAL type:TYPE_STRING},
			{name:"f10" number:10 label:LABEL_OPTIONAL type:TYPE_BYTES},
			{name:"f11" number:11 label:LABEL_OPTIONAL type:TYPE_BYTES},

			{name:"f12" number:12 label:LABEL_OPTIONAL type:TYPE_BOOL},
			{name:"f13" number:13 label:LABEL_OPTIONAL type:TYPE_INT32},
			{name:"f14" number:14 label:LABEL_OPTIONAL type:TYPE_INT64},
			{name:"f15" number:15 label:LABEL_OPTIONAL type:TYPE_UINT32},
			{name:"f16" number:16 label:LABEL_OPTIONAL type:TYPE_UINT64},
			{name:"f17" number:17 label:LABEL_OPTIONAL type:TYPE_FLOAT},
			{name:"f18" number:18 label:LABEL_OPTIONAL type:TYPE_DOUBLE},
			{name:"f19" number:19 label:LABEL_OPTIONAL type:TYPE_STRING},
			{name:"f20" number:20 label:LABEL_OPTIONAL type:TYPE_STRING},
			{name:"f21" number:21 label:LABEL_OPTIONAL type:TYPE_BYTES},
			{name:"f22" number:22 label:LABEL_OPTIONAL type:TYPE_BYTES}
		]
	`, nil),
}

func (m *ScalarProto3) ProtoReflect() protoreflect.Message { return scalarProto3Type.MessageOf(m) }

func TestScalarProto3(t *testing.T) {
	testMessage(t, nil, new(ScalarProto3).ProtoReflect(), messageOps{
		hasFields{
			1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false,
			12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false, 20: false, 21: false, 22: false,
		},
		getFields{
			1: V(bool(false)), 2: V(int32(0)), 3: V(int64(0)), 4: V(uint32(0)), 5: V(uint64(0)), 6: V(float32(0)), 7: V(float64(0)), 8: V(string("")), 9: V(string("")), 10: V([]byte(nil)), 11: V([]byte(nil)),
			12: V(bool(false)), 13: V(int32(0)), 14: V(int64(0)), 15: V(uint32(0)), 16: V(uint64(0)), 17: V(float32(0)), 18: V(float64(0)), 19: V(string("")), 20: V(string("")), 21: V([]byte(nil)), 22: V([]byte(nil)),
		},
		setFields{
			1: V(bool(false)), 2: V(int32(0)), 3: V(int64(0)), 4: V(uint32(0)), 5: V(uint64(0)), 6: V(float32(0)), 7: V(float64(0)), 8: V(string("")), 9: V(string("")), 10: V([]byte(nil)), 11: V([]byte(nil)),
			12: V(bool(false)), 13: V(int32(0)), 14: V(int64(0)), 15: V(uint32(0)), 16: V(uint64(0)), 17: V(float32(0)), 18: V(float64(0)), 19: V(string("")), 20: V(string("")), 21: V([]byte(nil)), 22: V([]byte(nil)),
		},
		hasFields{
			1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false,
			12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false, 20: false, 21: false, 22: false,
		},
		equalMessage{new(ScalarProto3).ProtoReflect()},
		setFields{
			1: V(bool(true)), 2: V(int32(2)), 3: V(int64(3)), 4: V(uint32(4)), 5: V(uint64(5)), 6: V(float32(6)), 7: V(float64(7)), 8: V(string("8")), 9: V(string("9")), 10: V([]byte("10")), 11: V([]byte("11")),
			12: V(bool(true)), 13: V(int32(13)), 14: V(int64(14)), 15: V(uint32(15)), 16: V(uint64(16)), 17: V(float32(17)), 18: V(float64(18)), 19: V(string("19")), 20: V(string("20")), 21: V([]byte("21")), 22: V([]byte("22")),
		},
		hasFields{
			1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true, 9: true, 10: true, 11: true,
			12: true, 13: true, 14: true, 15: true, 16: true, 17: true, 18: true, 19: true, 20: true, 21: true, 22: true,
		},
		equalMessage{(&ScalarProto3{
			true, 2, 3, 4, 5, 6, 7, "8", []byte("9"), []byte("10"), "11",
			true, 13, 14, 15, 16, 17, 18, "19", []byte("20"), []byte("21"), "22",
		}).ProtoReflect()},
		setFields{
			2: V(int32(-2)), 3: V(int64(-3)), 6: V(float32(math.Inf(-1))), 7: V(float64(math.NaN())),
		},
		hasFields{
			2: true, 3: true, 6: true, 7: true,
		},
		clearFields{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22},
		equalMessage{new(ScalarProto3).ProtoReflect()},

		// Verify that -0 triggers proper Has behavior.
		hasFields{6: false, 7: false},
		setFields{6: V(float32(math.Copysign(0, -1))), 7: V(float64(math.Copysign(0, -1)))},
		hasFields{6: true, 7: true},

		// Setting a bytes field to non-nil empty bytes should not preserve presence.
		setFields{10: V([]byte{}), 11: V([]byte{}), 21: V([]byte{}), 22: V([]byte{})},
		getFields{10: V([]byte(nil)), 11: V([]byte(nil)), 21: V([]byte(nil)), 22: V([]byte(nil))},
		hasFields{10: false, 11: false, 21: false, 22: false},
	})

	// Test read-only operations on nil message.
	testMessage(t, nil, (*ScalarProto3)(nil).ProtoReflect(), messageOps{
		hasFields{
			1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false,
			12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false, 20: false, 21: false, 22: false,
		},
		getFields{
			1: V(bool(false)), 2: V(int32(0)), 3: V(int64(0)), 4: V(uint32(0)), 5: V(uint64(0)), 6: V(float32(0)), 7: V(float64(0)), 8: V(string("")), 9: V(string("")), 10: V([]byte(nil)), 11: V([]byte(nil)),
			12: V(bool(false)), 13: V(int32(0)), 14: V(int64(0)), 15: V(uint32(0)), 16: V(uint64(0)), 17: V(float32(0)), 18: V(float64(0)), 19: V(string("")), 20: V(string("")), 21: V([]byte(nil)), 22: V([]byte(nil)),
		},
	})
}

type ListScalars struct {
	Bools    []bool    `protobuf:"1"`
	Int32s   []int32   `protobuf:"2"`
	Int64s   []int64   `protobuf:"3"`
	Uint32s  []uint32  `protobuf:"4"`
	Uint64s  []uint64  `protobuf:"5"`
	Float32s []float32 `protobuf:"6"`
	Float64s []float64 `protobuf:"7"`
	Strings  []string  `protobuf:"8"`
	StringsA [][]byte  `protobuf:"9"`
	Bytes    [][]byte  `protobuf:"10"`
	BytesA   []string  `protobuf:"11"`

	MyStrings1 []MyString `protobuf:"12"`
	MyStrings2 []MyBytes  `protobuf:"13"`
	MyBytes1   []MyBytes  `protobuf:"14"`
	MyBytes2   []MyString `protobuf:"15"`

	MyStrings3 ListStrings `protobuf:"16"`
	MyStrings4 ListBytes   `protobuf:"17"`
	MyBytes3   ListBytes   `protobuf:"18"`
	MyBytes4   ListStrings `protobuf:"19"`
}

var listScalarsType = pimpl.MessageInfo{GoReflectType: reflect.TypeOf(new(ListScalars)), Desc: mustMakeMessageDesc("list-scalars.proto", protoreflect.Proto2, "", `
		name: "ListScalars"
		field: [
			{name:"f1"  number:1  label:LABEL_REPEATED type:TYPE_BOOL},
			{name:"f2"  number:2  label:LABEL_REPEATED type:TYPE_INT32},
			{name:"f3"  number:3  label:LABEL_REPEATED type:TYPE_INT64},
			{name:"f4"  number:4  label:LABEL_REPEATED type:TYPE_UINT32},
			{name:"f5"  number:5  label:LABEL_REPEATED type:TYPE_UINT64},
			{name:"f6"  number:6  label:LABEL_REPEATED type:TYPE_FLOAT},
			{name:"f7"  number:7  label:LABEL_REPEATED type:TYPE_DOUBLE},
			{name:"f8"  number:8  label:LABEL_REPEATED type:TYPE_STRING},
			{name:"f9"  number:9  label:LABEL_REPEATED type:TYPE_STRING},
			{name:"f10" number:10 label:LABEL_REPEATED type:TYPE_BYTES},
			{name:"f11" number:11 label:LABEL_REPEATED type:TYPE_BYTES},

			{name:"f12" number:12 label:LABEL_REPEATED type:TYPE_STRING},
			{name:"f13" number:13 label:LABEL_REPEATED type:TYPE_STRING},
			{name:"f14" number:14 label:LABEL_REPEATED type:TYPE_BYTES},
			{name:"f15" number:15 label:LABEL_REPEATED type:TYPE_BYTES},

			{name:"f16" number:16 label:LABEL_REPEATED type:TYPE_STRING},
			{name:"f17" number:17 label:LABEL_REPEATED type:TYPE_STRING},
			{name:"f18" number:18 label:LABEL_REPEATED type:TYPE_BYTES},
			{name:"f19" number:19 label:LABEL_REPEATED type:TYPE_BYTES}
		]
	`, nil),
}

func (m *ListScalars) ProtoReflect() protoreflect.Message { return listScalarsType.MessageOf(m) }

func TestListScalars(t *testing.T) {
	empty := new(ListScalars).ProtoReflect()
	want := (&ListScalars{
		Bools:    []bool{true, false, true},
		Int32s:   []int32{2, math.MinInt32, math.MaxInt32},
		Int64s:   []int64{3, math.MinInt64, math.MaxInt64},
		Uint32s:  []uint32{4, math.MaxUint32 / 2, math.MaxUint32},
		Uint64s:  []uint64{5, math.MaxUint64 / 2, math.MaxUint64},
		Float32s: []float32{6, math.SmallestNonzeroFloat32, float32(math.NaN()), math.MaxFloat32},
		Float64s: []float64{7, math.SmallestNonzeroFloat64, float64(math.NaN()), math.MaxFloat64},
		Strings:  []string{"8", "", "eight"},
		StringsA: [][]byte{[]byte("9"), nil, []byte("nine")},
		Bytes:    [][]byte{[]byte("10"), nil, []byte("ten")},
		BytesA:   []string{"11", "", "eleven"},

		MyStrings1: []MyString{"12", "", "twelve"},
		MyStrings2: []MyBytes{[]byte("13"), nil, []byte("thirteen")},
		MyBytes1:   []MyBytes{[]byte("14"), nil, []byte("fourteen")},
		MyBytes2:   []MyString{"15", "", "fifteen"},

		MyStrings3: ListStrings{"16", "", "sixteen"},
		MyStrings4: ListBytes{[]byte("17"), nil, []byte("seventeen")},
		MyBytes3:   ListBytes{[]byte("18"), nil, []byte("eighteen")},
		MyBytes4:   ListStrings{"19", "", "nineteen"},
	}).ProtoReflect()

	testMessage(t, nil, new(ListScalars).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false},
		getFields{1: getField(empty, 1), 3: getField(empty, 3), 5: getField(empty, 5), 7: getField(empty, 7), 9: getField(empty, 9), 11: getField(empty, 11), 13: getField(empty, 13), 15: getField(empty, 15), 17: getField(empty, 17), 19: getField(empty, 19)},
		setFields{1: getField(want, 1), 3: getField(want, 3), 5: getField(want, 5), 7: getField(want, 7), 9: getField(want, 9), 11: getField(want, 11), 13: getField(want, 13), 15: getField(want, 15), 17: getField(want, 17), 19: getField(want, 19)},
		listFieldsMutable{
			2: {
				lenList(0),
				appendList{V(int32(2)), V(int32(math.MinInt32)), V(int32(math.MaxInt32))},
				getList{0: V(int32(2)), 1: V(int32(math.MinInt32)), 2: V(int32(math.MaxInt32))},
				equalList{getField(want, 2).List()},
			},
			4: {
				appendList{V(uint32(0)), V(uint32(0)), V(uint32(0))},
				setList{0: V(uint32(4)), 1: V(uint32(math.MaxUint32 / 2)), 2: V(uint32(math.MaxUint32))},
				lenList(3),
			},
			6: {
				appendList{V(float32(6)), V(float32(math.SmallestNonzeroFloat32)), V(float32(math.NaN())), V(float32(math.MaxFloat32))},
				equalList{getField(want, 6).List()},
			},
			8: {
				appendList{V(""), V(""), V(""), V(""), V(""), V("")},
				lenList(6),
				setList{0: V("8"), 2: V("eight")},
				truncList(3),
				equalList{getField(want, 8).List()},
			},
			10: {
				appendList{V([]byte(nil)), V([]byte(nil))},
				setList{0: V([]byte("10"))},
				appendList{V([]byte("wrong"))},
				setList{2: V([]byte("ten"))},
				equalList{getField(want, 10).List()},
			},
			12: {
				appendList{V("12"), V("wrong"), V("twelve")},
				setList{1: V("")},
				equalList{getField(want, 12).List()},
			},
			14: {
				appendList{V([]byte("14")), V([]byte(nil)), V([]byte("fourteen"))},
				equalList{getField(want, 14).List()},
			},
			16: {
				appendList{V("16"), V(""), V("sixteen"), V("extra")},
				truncList(3),
				equalList{getField(want, 16).List()},
			},
			18: {
				appendList{V([]byte("18")), V([]byte(nil)), V([]byte("eighteen"))},
				equalList{getField(want, 18).List()},
			},
		},
		hasFields{1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true, 9: true, 10: true, 11: true, 12: true, 13: true, 14: true, 15: true, 16: true, 17: true, 18: true, 19: true},
		equalMessage{want},
		clearFields{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19},
		equalMessage{empty},
	})

	// Test read-only operations on nil message.
	testMessage(t, nil, (*ListScalars)(nil).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false},
		listFields{2: {lenList(0)}, 4: {lenList(0)}, 6: {lenList(0)}, 8: {lenList(0)}, 10: {lenList(0)}, 12: {lenList(0)}, 14: {lenList(0)}, 16: {lenList(0)}, 18: {lenList(0)}},
	})
}

type MapScalars struct {
	KeyBools   map[bool]string   `protobuf:"1"`
	KeyInt32s  map[int32]string  `protobuf:"2"`
	KeyInt64s  map[int64]string  `protobuf:"3"`
	KeyUint32s map[uint32]string `protobuf:"4"`
	KeyUint64s map[uint64]string `protobuf:"5"`
	KeyStrings map[string]string `protobuf:"6"`

	ValBools    map[string]bool    `protobuf:"7"`
	ValInt32s   map[string]int32   `protobuf:"8"`
	ValInt64s   map[string]int64   `protobuf:"9"`
	ValUint32s  map[string]uint32  `protobuf:"10"`
	ValUint64s  map[string]uint64  `protobuf:"11"`
	ValFloat32s map[string]float32 `protobuf:"12"`
	ValFloat64s map[string]float64 `protobuf:"13"`
	ValStrings  map[string]string  `protobuf:"14"`
	ValStringsA map[string][]byte  `protobuf:"15"`
	ValBytes    map[string][]byte  `protobuf:"16"`
	ValBytesA   map[string]string  `protobuf:"17"`

	MyStrings1 map[MyString]MyString `protobuf:"18"`
	MyStrings2 map[MyString]MyBytes  `protobuf:"19"`
	MyBytes1   map[MyString]MyBytes  `protobuf:"20"`
	MyBytes2   map[MyString]MyString `protobuf:"21"`

	MyStrings3 MapStrings `protobuf:"22"`
	MyStrings4 MapBytes   `protobuf:"23"`
	MyBytes3   MapBytes   `protobuf:"24"`
	MyBytes4   MapStrings `protobuf:"25"`
}

var mapScalarsType = pimpl.MessageInfo{GoReflectType: reflect.TypeOf(new(MapScalars)), Desc: mustMakeMessageDesc("map-scalars.proto", protoreflect.Proto2, "", `
		name: "MapScalars"
		field: [
			{name:"f1"  number:1  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F1Entry"},
			{name:"f2"  number:2  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F2Entry"},
			{name:"f3"  number:3  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F3Entry"},
			{name:"f4"  number:4  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F4Entry"},
			{name:"f5"  number:5  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F5Entry"},
			{name:"f6"  number:6  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F6Entry"},

			{name:"f7"  number:7  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F7Entry"},
			{name:"f8"  number:8  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F8Entry"},
			{name:"f9"  number:9  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F9Entry"},
			{name:"f10" number:10 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F10Entry"},
			{name:"f11" number:11 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F11Entry"},
			{name:"f12" number:12 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F12Entry"},
			{name:"f13" number:13 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F13Entry"},
			{name:"f14" number:14 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F14Entry"},
			{name:"f15" number:15 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F15Entry"},
			{name:"f16" number:16 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F16Entry"},
			{name:"f17" number:17 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F17Entry"},

			{name:"f18" number:18 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F18Entry"},
			{name:"f19" number:19 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F19Entry"},
			{name:"f20" number:20 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F20Entry"},
			{name:"f21" number:21 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F21Entry"},

			{name:"f22" number:22 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F22Entry"},
			{name:"f23" number:23 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F23Entry"},
			{name:"f24" number:24 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F24Entry"},
			{name:"f25" number:25 label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".MapScalars.F25Entry"}
		]
		nested_type: [
			{name:"F1Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_BOOL},   {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F2Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_INT32},  {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F3Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_INT64},  {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F4Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_UINT32}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F5Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_UINT64}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F6Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},

			{name:"F7Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_BOOL}]   options:{map_entry:true}},
			{name:"F8Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_INT32}]  options:{map_entry:true}},
			{name:"F9Entry"  field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_INT64}]  options:{map_entry:true}},
			{name:"F10Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_UINT32}] options:{map_entry:true}},
			{name:"F11Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_UINT64}] options:{map_entry:true}},
			{name:"F12Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_FLOAT}]  options:{map_entry:true}},
			{name:"F13Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_DOUBLE}] options:{map_entry:true}},
			{name:"F14Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F15Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F16Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_BYTES}]  options:{map_entry:true}},
			{name:"F17Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_BYTES}]  options:{map_entry:true}},

			{name:"F18Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F19Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F20Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_BYTES}]  options:{map_entry:true}},
			{name:"F21Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_BYTES}]  options:{map_entry:true}},

			{name:"F22Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F23Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_STRING}] options:{map_entry:true}},
			{name:"F24Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_BYTES}]  options:{map_entry:true}},
			{name:"F25Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_BYTES}]  options:{map_entry:true}}
		]
	`, nil),
}

func (m *MapScalars) ProtoReflect() protoreflect.Message { return mapScalarsType.MessageOf(m) }

func TestMapScalars(t *testing.T) {
	empty := new(MapScalars).ProtoReflect()
	want := (&MapScalars{
		KeyBools:   map[bool]string{true: "true", false: "false"},
		KeyInt32s:  map[int32]string{0: "zero", -1: "one", 2: "two"},
		KeyInt64s:  map[int64]string{0: "zero", -10: "ten", 20: "twenty"},
		KeyUint32s: map[uint32]string{0: "zero", 1: "one", 2: "two"},
		KeyUint64s: map[uint64]string{0: "zero", 10: "ten", 20: "twenty"},
		KeyStrings: map[string]string{"": "", "foo": "bar"},

		ValBools:    map[string]bool{"true": true, "false": false},
		ValInt32s:   map[string]int32{"one": 1, "two": 2, "three": 3},
		ValInt64s:   map[string]int64{"ten": 10, "twenty": -20, "thirty": 30},
		ValUint32s:  map[string]uint32{"0x00": 0x00, "0xff": 0xff, "0xdead": 0xdead},
		ValUint64s:  map[string]uint64{"0x00": 0x00, "0xff": 0xff, "0xdead": 0xdead},
		ValFloat32s: map[string]float32{"nan": float32(math.NaN()), "pi": float32(math.Pi)},
		ValFloat64s: map[string]float64{"nan": float64(math.NaN()), "pi": float64(math.Pi)},
		ValStrings:  map[string]string{"s1": "s1", "s2": "s2"},
		ValStringsA: map[string][]byte{"s1": []byte("s1"), "s2": []byte("s2")},
		ValBytes:    map[string][]byte{"s1": []byte("s1"), "s2": []byte("s2")},
		ValBytesA:   map[string]string{"s1": "s1", "s2": "s2"},

		MyStrings1: map[MyString]MyString{"s1": "s1", "s2": "s2"},
		MyStrings2: map[MyString]MyBytes{"s1": []byte("s1"), "s2": []byte("s2")},
		MyBytes1:   map[MyString]MyBytes{"s1": []byte("s1"), "s2": []byte("s2")},
		MyBytes2:   map[MyString]MyString{"s1": "s1", "s2": "s2"},

		MyStrings3: MapStrings{"s1": "s1", "s2": "s2"},
		MyStrings4: MapBytes{"s1": []byte("s1"), "s2": []byte("s2")},
		MyBytes3:   MapBytes{"s1": []byte("s1"), "s2": []byte("s2")},
		MyBytes4:   MapStrings{"s1": "s1", "s2": "s2"},
	}).ProtoReflect()

	testMessage(t, nil, new(MapScalars).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false, 20: false, 21: false, 22: false, 23: false, 24: false, 25: false},
		getFields{1: getField(empty, 1), 3: getField(empty, 3), 5: getField(empty, 5), 7: getField(empty, 7), 9: getField(empty, 9), 11: getField(empty, 11), 13: getField(empty, 13), 15: getField(empty, 15), 17: getField(empty, 17), 19: getField(empty, 19), 21: getField(empty, 21), 23: getField(empty, 23), 25: getField(empty, 25)},
		setFields{1: getField(want, 1), 3: getField(want, 3), 5: getField(want, 5), 7: getField(want, 7), 9: getField(want, 9), 11: getField(want, 11), 13: getField(want, 13), 15: getField(want, 15), 17: getField(want, 17), 19: getField(want, 19), 21: getField(want, 21), 23: getField(want, 23), 25: getField(want, 25)},
		mapFieldsMutable{
			2: {
				lenMap(0),
				hasMap{int32(0): false, int32(-1): false, int32(2): false},
				setMap{int32(0): V("zero")},
				lenMap(1),
				hasMap{int32(0): true, int32(-1): false, int32(2): false},
				setMap{int32(-1): V("one")},
				lenMap(2),
				hasMap{int32(0): true, int32(-1): true, int32(2): false},
				setMap{int32(2): V("two")},
				lenMap(3),
				hasMap{int32(0): true, int32(-1): true, int32(2): true},
			},
			4: {
				setMap{uint32(0): V("zero"), uint32(1): V("one"), uint32(2): V("two")},
				equalMap{getField(want, 4).Map()},
			},
			6: {
				clearMap{"noexist"},
				setMap{"foo": V("bar")},
				setMap{"": V("empty")},
				getMap{"": V("empty"), "foo": V("bar"), "noexist": V(nil)},
				setMap{"": V(""), "extra": V("extra")},
				clearMap{"extra", "noexist"},
			},
			8: {
				equalMap{getField(empty, 8).Map()},
				setMap{"one": V(int32(1)), "two": V(int32(2)), "three": V(int32(3))},
			},
			10: {
				setMap{"0x00": V(uint32(0x00)), "0xff": V(uint32(0xff)), "0xdead": V(uint32(0xdead))},
				lenMap(3),
				equalMap{getField(want, 10).Map()},
				getMap{"0x00": V(uint32(0x00)), "0xff": V(uint32(0xff)), "0xdead": V(uint32(0xdead)), "0xdeadbeef": V(nil)},
			},
			12: {
				setMap{"nan": V(float32(math.NaN())), "pi": V(float32(math.Pi)), "e": V(float32(math.E))},
				clearMap{"e", "phi"},
				rangeMap{"nan": V(float32(math.NaN())), "pi": V(float32(math.Pi))},
			},
			14: {
				equalMap{getField(empty, 14).Map()},
				setMap{"s1": V("s1"), "s2": V("s2")},
			},
			16: {
				setMap{"s1": V([]byte("s1")), "s2": V([]byte("s2"))},
				equalMap{getField(want, 16).Map()},
			},
			18: {
				hasMap{"s1": false, "s2": false, "s3": false},
				setMap{"s1": V("s1"), "s2": V("s2")},
				hasMap{"s1": true, "s2": true, "s3": false},
			},
			20: {
				equalMap{getField(empty, 20).Map()},
				setMap{"s1": V([]byte("s1")), "s2": V([]byte("s2"))},
			},
			22: {
				rangeMap{},
				setMap{"s1": V("s1"), "s2": V("s2")},
				rangeMap{"s1": V("s1"), "s2": V("s2")},
				lenMap(2),
			},
			24: {
				setMap{"s1": V([]byte("s1")), "s2": V([]byte("s2"))},
				equalMap{getField(want, 24).Map()},
			},
		},
		hasFields{1: true, 2: true, 3: true, 4: true, 5: true, 6: true, 7: true, 8: true, 9: true, 10: true, 11: true, 12: true, 13: true, 14: true, 15: true, 16: true, 17: true, 18: true, 19: true, 20: true, 21: true, 22: true, 23: true, 24: true, 25: true},
		equalMessage{want},
		clearFields{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},
		equalMessage{empty},
	})

	// Test read-only operations on nil message.
	testMessage(t, nil, (*MapScalars)(nil).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false, 13: false, 14: false, 15: false, 16: false, 17: false, 18: false, 19: false, 20: false, 21: false, 22: false, 23: false, 24: false, 25: false},
		mapFields{2: {lenMap(0)}, 4: {lenMap(0)}, 6: {lenMap(0)}, 8: {lenMap(0)}, 10: {lenMap(0)}, 12: {lenMap(0)}, 14: {lenMap(0)}, 16: {lenMap(0)}, 18: {lenMap(0)}, 20: {lenMap(0)}, 22: {lenMap(0)}, 24: {lenMap(0)}},
	})
}

type OneofScalars struct {
	Union isOneofScalars_Union `protobuf_oneof:"union"`
}

var oneofScalarsType = pimpl.MessageInfo{GoReflectType: reflect.TypeOf(new(OneofScalars)), Desc: mustMakeMessageDesc("oneof-scalars.proto", protoreflect.Proto2, "", `
		name: "OneofScalars"
		field: [
			{name:"f1"  number:1  label:LABEL_OPTIONAL type:TYPE_BOOL   default_value:"true" oneof_index:0},
			{name:"f2"  number:2  label:LABEL_OPTIONAL type:TYPE_INT32  default_value:"2"    oneof_index:0},
			{name:"f3"  number:3  label:LABEL_OPTIONAL type:TYPE_INT64  default_value:"3"    oneof_index:0},
			{name:"f4"  number:4  label:LABEL_OPTIONAL type:TYPE_UINT32 default_value:"4"    oneof_index:0},
			{name:"f5"  number:5  label:LABEL_OPTIONAL type:TYPE_UINT64 default_value:"5"    oneof_index:0},
			{name:"f6"  number:6  label:LABEL_OPTIONAL type:TYPE_FLOAT  default_value:"6"    oneof_index:0},
			{name:"f7"  number:7  label:LABEL_OPTIONAL type:TYPE_DOUBLE default_value:"7"    oneof_index:0},
			{name:"f8"  number:8  label:LABEL_OPTIONAL type:TYPE_STRING default_value:"8"    oneof_index:0},
			{name:"f9"  number:9  label:LABEL_OPTIONAL type:TYPE_STRING default_value:"9"    oneof_index:0},
			{name:"f10" number:10 label:LABEL_OPTIONAL type:TYPE_STRING default_value:"10"   oneof_index:0},
			{name:"f11" number:11 label:LABEL_OPTIONAL type:TYPE_BYTES  default_value:"11"   oneof_index:0},
			{name:"f12" number:12 label:LABEL_OPTIONAL type:TYPE_BYTES  default_value:"12"   oneof_index:0},
			{name:"f13" number:13 label:LABEL_OPTIONAL type:TYPE_BYTES  default_value:"13"   oneof_index:0}
		]
		oneof_decl: [{name:"union"}]
	`, nil),
}

func (m *OneofScalars) ProtoReflect() protoreflect.Message { return oneofScalarsType.MessageOf(m) }

func (*OneofScalars) XXX_OneofWrappers() []any {
	return []any{
		(*OneofScalars_Bool)(nil),
		(*OneofScalars_Int32)(nil),
		(*OneofScalars_Int64)(nil),
		(*OneofScalars_Uint32)(nil),
		(*OneofScalars_Uint64)(nil),
		(*OneofScalars_Float32)(nil),
		(*OneofScalars_Float64)(nil),
		(*OneofScalars_String)(nil),
		(*OneofScalars_StringA)(nil),
		(*OneofScalars_StringB)(nil),
		(*OneofScalars_Bytes)(nil),
		(*OneofScalars_BytesA)(nil),
		(*OneofScalars_BytesB)(nil),
	}
}

type (
	isOneofScalars_Union interface {
		isOneofScalars_Union()
	}
	OneofScalars_Bool struct {
		Bool bool `protobuf:"1"`
	}
	OneofScalars_Int32 struct {
		Int32 MyInt32 `protobuf:"2"`
	}
	OneofScalars_Int64 struct {
		Int64 int64 `protobuf:"3"`
	}
	OneofScalars_Uint32 struct {
		Uint32 MyUint32 `protobuf:"4"`
	}
	OneofScalars_Uint64 struct {
		Uint64 uint64 `protobuf:"5"`
	}
	OneofScalars_Float32 struct {
		Float32 MyFloat32 `protobuf:"6"`
	}
	OneofScalars_Float64 struct {
		Float64 float64 `protobuf:"7"`
	}
	OneofScalars_String struct {
		String string `protobuf:"8"`
	}
	OneofScalars_StringA struct {
		StringA []byte `protobuf:"9"`
	}
	OneofScalars_StringB struct {
		StringB MyString `protobuf:"10"`
	}
	OneofScalars_Bytes struct {
		Bytes []byte `protobuf:"11"`
	}
	OneofScalars_BytesA struct {
		BytesA string `protobuf:"12"`
	}
	OneofScalars_BytesB struct {
		BytesB MyBytes `protobuf:"13"`
	}
)

func (*OneofScalars_Bool) isOneofScalars_Union()    {}
func (*OneofScalars_Int32) isOneofScalars_Union()   {}
func (*OneofScalars_Int64) isOneofScalars_Union()   {}
func (*OneofScalars_Uint32) isOneofScalars_Union()  {}
func (*OneofScalars_Uint64) isOneofScalars_Union()  {}
func (*OneofScalars_Float32) isOneofScalars_Union() {}
func (*OneofScalars_Float64) isOneofScalars_Union() {}
func (*OneofScalars_String) isOneofScalars_Union()  {}
func (*OneofScalars_StringA) isOneofScalars_Union() {}
func (*OneofScalars_StringB) isOneofScalars_Union() {}
func (*OneofScalars_Bytes) isOneofScalars_Union()   {}
func (*OneofScalars_BytesA) isOneofScalars_Union()  {}
func (*OneofScalars_BytesB) isOneofScalars_Union()  {}

func TestOneofs(t *testing.T) {
	empty := &OneofScalars{}
	want1 := &OneofScalars{Union: &OneofScalars_Bool{true}}
	want2 := &OneofScalars{Union: &OneofScalars_Int32{20}}
	want3 := &OneofScalars{Union: &OneofScalars_Int64{30}}
	want4 := &OneofScalars{Union: &OneofScalars_Uint32{40}}
	want5 := &OneofScalars{Union: &OneofScalars_Uint64{50}}
	want6 := &OneofScalars{Union: &OneofScalars_Float32{60}}
	want7 := &OneofScalars{Union: &OneofScalars_Float64{70}}
	want8 := &OneofScalars{Union: &OneofScalars_String{string("80")}}
	want9 := &OneofScalars{Union: &OneofScalars_StringA{[]byte("90")}}
	want10 := &OneofScalars{Union: &OneofScalars_StringB{MyString("100")}}
	want11 := &OneofScalars{Union: &OneofScalars_Bytes{[]byte("110")}}
	want12 := &OneofScalars{Union: &OneofScalars_BytesA{string("120")}}
	want13 := &OneofScalars{Union: &OneofScalars_BytesB{MyBytes("130")}}

	testMessage(t, nil, new(OneofScalars).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false, 13: false},
		getFields{1: V(bool(true)), 2: V(int32(2)), 3: V(int64(3)), 4: V(uint32(4)), 5: V(uint64(5)), 6: V(float32(6)), 7: V(float64(7)), 8: V(string("8")), 9: V(string("9")), 10: V(string("10")), 11: V([]byte("11")), 12: V([]byte("12")), 13: V([]byte("13"))},
		whichOneofs{"union": 0},

		setFields{1: V(bool(true))}, hasFields{1: true}, equalMessage{want1.ProtoReflect()},
		setFields{2: V(int32(20))}, hasFields{2: true}, equalMessage{want2.ProtoReflect()},
		setFields{3: V(int64(30))}, hasFields{3: true}, equalMessage{want3.ProtoReflect()},
		setFields{4: V(uint32(40))}, hasFields{4: true}, equalMessage{want4.ProtoReflect()},
		setFields{5: V(uint64(50))}, hasFields{5: true}, equalMessage{want5.ProtoReflect()},
		setFields{6: V(float32(60))}, hasFields{6: true}, equalMessage{want6.ProtoReflect()},
		setFields{7: V(float64(70))}, hasFields{7: true}, equalMessage{want7.ProtoReflect()},

		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: true, 8: false, 9: false, 10: false, 11: false, 12: false, 13: false},
		whichOneofs{"union": 7},

		setFields{8: V(string("80"))}, hasFields{8: true}, equalMessage{want8.ProtoReflect()},
		setFields{9: V(string("90"))}, hasFields{9: true}, equalMessage{want9.ProtoReflect()},
		setFields{10: V(string("100"))}, hasFields{10: true}, equalMessage{want10.ProtoReflect()},
		setFields{11: V([]byte("110"))}, hasFields{11: true}, equalMessage{want11.ProtoReflect()},
		setFields{12: V([]byte("120"))}, hasFields{12: true}, equalMessage{want12.ProtoReflect()},
		setFields{13: V([]byte("130"))}, hasFields{13: true}, equalMessage{want13.ProtoReflect()},

		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false, 13: true},
		getFields{1: V(bool(true)), 2: V(int32(2)), 3: V(int64(3)), 4: V(uint32(4)), 5: V(uint64(5)), 6: V(float32(6)), 7: V(float64(7)), 8: V(string("8")), 9: V(string("9")), 10: V(string("10")), 11: V([]byte("11")), 12: V([]byte("12")), 13: V([]byte("130"))},
		clearFields{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
		whichOneofs{"union": 13},
		equalMessage{want13.ProtoReflect()},
		clearFields{13},
		whichOneofs{"union": 0},
		equalMessage{empty.ProtoReflect()},
	})

	// Test read-only operations on nil message.
	testMessage(t, nil, (*OneofScalars)(nil).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false, 13: false},
		getFields{1: V(bool(true)), 2: V(int32(2)), 3: V(int64(3)), 4: V(uint32(4)), 5: V(uint64(5)), 6: V(float32(6)), 7: V(float64(7)), 8: V(string("8")), 9: V(string("9")), 10: V(string("10")), 11: V([]byte("11")), 12: V([]byte("12")), 13: V([]byte("13"))},
	})
}

type EnumProto2 int32

var enumProto2Desc = mustMakeEnumDesc("enum2.proto", protoreflect.Proto2, `
	name:  "EnumProto2"
	value: [{name:"DEAD" number:0xdead}, {name:"BEEF" number:0xbeef}]
`)

func (e EnumProto2) Descriptor() protoreflect.EnumDescriptor         { return enumProto2Desc }
func (e EnumProto2) Type() protoreflect.EnumType                     { return e }
func (e EnumProto2) Enum() *EnumProto2                               { return &e }
func (e EnumProto2) Number() protoreflect.EnumNumber                 { return protoreflect.EnumNumber(e) }
func (t EnumProto2) New(n protoreflect.EnumNumber) protoreflect.Enum { return EnumProto2(n) }

type EnumProto3 int32

var enumProto3Desc = mustMakeEnumDesc("enum3.proto", protoreflect.Proto3, `
	name:  "EnumProto3",
	value: [{name:"ALPHA" number:0}, {name:"BRAVO" number:1}]
`)

func (e EnumProto3) Descriptor() protoreflect.EnumDescriptor         { return enumProto3Desc }
func (e EnumProto3) Type() protoreflect.EnumType                     { return e }
func (e EnumProto3) Enum() *EnumProto3                               { return &e }
func (e EnumProto3) Number() protoreflect.EnumNumber                 { return protoreflect.EnumNumber(e) }
func (t EnumProto3) New(n protoreflect.EnumNumber) protoreflect.Enum { return EnumProto3(n) }

type EnumMessages struct {
	EnumP2        *EnumProto2              `protobuf:"1"`
	EnumP3        *EnumProto3              `protobuf:"2"`
	MessageLegacy *proto2_20180125.Message `protobuf:"3"`
	MessageCycle  *EnumMessages            `protobuf:"4"`
	EnumList      []EnumProto2             `protobuf:"5"`
	MessageList   []*ScalarProto2          `protobuf:"6"`
	EnumMap       map[string]EnumProto3    `protobuf:"7"`
	MessageMap    map[string]*ScalarProto3 `protobuf:"8"`
	Union         isEnumMessages_Union     `protobuf_oneof:"union"`
}

var enumMessagesType = pimpl.MessageInfo{GoReflectType: reflect.TypeOf(new(EnumMessages)), Desc: mustMakeMessageDesc("enum-messages.proto", protoreflect.Proto2, `
		dependency: ["enum2.proto", "enum3.proto", "scalar2.proto", "scalar3.proto", "proto2_20180125_92554152/test.proto"]
	`, `
		name: "EnumMessages"
		field: [
			{name:"f1"  number:1  label:LABEL_OPTIONAL type:TYPE_ENUM    type_name:".EnumProto2" default_value:"BEEF"},
			{name:"f2"  number:2  label:LABEL_OPTIONAL type:TYPE_ENUM    type_name:".EnumProto3" default_value:"BRAVO"},
			{name:"f3"  number:3  label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:".google.golang.org.proto2_20180125.Message"},
			{name:"f4"  number:4  label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:".EnumMessages"},
			{name:"f5"  number:5  label:LABEL_REPEATED type:TYPE_ENUM    type_name:".EnumProto2"},
			{name:"f6"  number:6  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".ScalarProto2"},
			{name:"f7"  number:7  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".EnumMessages.F7Entry"},
			{name:"f8"  number:8  label:LABEL_REPEATED type:TYPE_MESSAGE type_name:".EnumMessages.F8Entry"},
			{name:"f9"  number:9  label:LABEL_OPTIONAL type:TYPE_ENUM    type_name:".EnumProto2"   oneof_index:0 default_value:"BEEF"},
			{name:"f10" number:10 label:LABEL_OPTIONAL type:TYPE_ENUM    type_name:".EnumProto3"   oneof_index:0 default_value:"BRAVO"},
			{name:"f11" number:11 label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:".ScalarProto2" oneof_index:0},
			{name:"f12" number:12 label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:".ScalarProto3" oneof_index:0}
		]
		oneof_decl: [{name:"union"}]
		nested_type: [
			{name:"F7Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_ENUM    type_name:".EnumProto3"}]   options:{map_entry:true}},
			{name:"F8Entry" field:[{name:"key" number:1 label:LABEL_OPTIONAL type:TYPE_STRING}, {name:"value" number:2 label:LABEL_OPTIONAL type:TYPE_MESSAGE type_name:".ScalarProto3"}] options:{map_entry:true}}
		]
	`, newFileRegistry(
	EnumProto2(0).Descriptor().ParentFile(),
	EnumProto3(0).Descriptor().ParentFile(),
	((*ScalarProto2)(nil)).ProtoReflect().Descriptor().ParentFile(),
	((*ScalarProto3)(nil)).ProtoReflect().Descriptor().ParentFile(),
	pimpl.Export{}.MessageDescriptorOf((*proto2_20180125.Message)(nil)).ParentFile(),
)),
}

func newFileRegistry(files ...protoreflect.FileDescriptor) *protoregistry.Files {
	r := new(protoregistry.Files)
	for _, file := range files {
		r.RegisterFile(file)
	}
	return r
}

func (m *EnumMessages) ProtoReflect() protoreflect.Message { return enumMessagesType.MessageOf(m) }

func (*EnumMessages) XXX_OneofWrappers() []any {
	return []any{
		(*EnumMessages_OneofE2)(nil),
		(*EnumMessages_OneofE3)(nil),
		(*EnumMessages_OneofM2)(nil),
		(*EnumMessages_OneofM3)(nil),
	}
}

type (
	isEnumMessages_Union interface {
		isEnumMessages_Union()
	}
	EnumMessages_OneofE2 struct {
		OneofE2 EnumProto2 `protobuf:"9"`
	}
	EnumMessages_OneofE3 struct {
		OneofE3 EnumProto3 `protobuf:"10"`
	}
	EnumMessages_OneofM2 struct {
		OneofM2 *ScalarProto2 `protobuf:"11"`
	}
	EnumMessages_OneofM3 struct {
		OneofM3 *ScalarProto3 `protobuf:"12"`
	}
)

func (*EnumMessages_OneofE2) isEnumMessages_Union() {}
func (*EnumMessages_OneofE3) isEnumMessages_Union() {}
func (*EnumMessages_OneofM2) isEnumMessages_Union() {}
func (*EnumMessages_OneofM3) isEnumMessages_Union() {}

func TestEnumMessages(t *testing.T) {
	emptyL := pimpl.Export{}.MessageOf(new(proto2_20180125.Message))
	emptyM := new(EnumMessages).ProtoReflect()
	emptyM2 := new(ScalarProto2).ProtoReflect()
	emptyM3 := new(ScalarProto3).ProtoReflect()

	wantL := pimpl.Export{}.MessageOf(&proto2_20180125.Message{OptionalFloat: proto.Float32(math.E)})
	wantM := (&EnumMessages{EnumP2: EnumProto2(1234).Enum()}).ProtoReflect()
	wantM2a := &ScalarProto2{Float32: proto.Float32(math.Pi)}
	wantM2b := &ScalarProto2{Float32: proto.Float32(math.Phi)}
	wantM3a := &ScalarProto3{Float32: math.Pi}
	wantM3b := &ScalarProto3{Float32: math.Ln2}

	wantList5 := getField((&EnumMessages{EnumList: []EnumProto2{333, 222}}).ProtoReflect(), 5)
	wantList6 := getField((&EnumMessages{MessageList: []*ScalarProto2{wantM2a, wantM2b}}).ProtoReflect(), 6)

	wantMap7 := getField((&EnumMessages{EnumMap: map[string]EnumProto3{"one": 1, "two": 2}}).ProtoReflect(), 7)
	wantMap8 := getField((&EnumMessages{MessageMap: map[string]*ScalarProto3{"pi": wantM3a, "ln2": wantM3b}}).ProtoReflect(), 8)

	testMessage(t, nil, new(EnumMessages).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false},
		getFields{1: VE(0xbeef), 2: VE(1), 3: V(emptyL), 4: V(emptyM), 9: VE(0xbeef), 10: VE(1)},

		// Test singular enums.
		setFields{1: VE(0xdead), 2: VE(0)},
		getFields{1: VE(0xdead), 2: VE(0)},
		hasFields{1: true, 2: true},

		// Test singular messages.
		messageFieldsMutable{3: messageOps{setFields{109: V(float32(math.E))}}},
		messageFieldsMutable{4: messageOps{setFields{1: VE(1234)}}},
		getFields{3: V(wantL), 4: V(wantM)},
		clearFields{3, 4},
		hasFields{3: false, 4: false},
		setFields{3: V(wantL), 4: V(wantM)},
		hasFields{3: true, 4: true},

		// Test list of enums and messages.
		listFieldsMutable{
			5: listOps{
				appendList{VE(111), VE(222)},
				setList{0: VE(333)},
				getList{0: VE(333), 1: VE(222)},
				lenList(2),
			},
			6: listOps{
				appendMessageList{setFields{4: V(uint32(1e6))}},
				appendMessageList{setFields{6: V(float32(math.Phi))}},
				setList{0: V(wantM2a.ProtoReflect())},
				getList{0: V(wantM2a.ProtoReflect()), 1: V(wantM2b.ProtoReflect())},
			},
		},
		getFields{5: wantList5, 6: wantList6},
		hasFields{5: true, 6: true},
		listFields{5: listOps{truncList(0)}},
		hasFields{5: false, 6: true},

		// Test maps of enums and messages.
		mapFieldsMutable{
			7: mapOps{
				setMap{"one": VE(1), "two": VE(2)},
				hasMap{"one": true, "two": true, "three": false},
				lenMap(2),
			},
			8: mapOps{
				messageMap{"pi": messageOps{setFields{6: V(float32(math.Pi))}}},
				setMap{"ln2": V(wantM3b.ProtoReflect())},
				getMap{"pi": V(wantM3a.ProtoReflect()), "ln2": V(wantM3b.ProtoReflect()), "none": V(nil)},
				lenMap(2),
			},
		},
		getFields{7: wantMap7, 8: wantMap8},
		hasFields{7: true, 8: true},
		mapFields{8: mapOps{clearMap{"pi", "ln2", "none"}}},
		hasFields{7: true, 8: false},

		// Test oneofs of enums and messages.
		setFields{9: VE(0xdead)},
		hasFields{1: true, 2: true, 9: true, 10: false, 11: false, 12: false},
		setFields{10: VE(0)},
		hasFields{1: true, 2: true, 9: false, 10: true, 11: false, 12: false},
		messageFieldsMutable{11: messageOps{setFields{6: V(float32(math.Pi))}}},
		getFields{11: V(wantM2a.ProtoReflect())},
		hasFields{1: true, 2: true, 9: false, 10: false, 11: true, 12: false},
		messageFieldsMutable{12: messageOps{setFields{6: V(float32(math.Pi))}}},
		getFields{12: V(wantM3a.ProtoReflect())},
		hasFields{1: true, 2: true, 9: false, 10: false, 11: false, 12: true},

		// Check entire message.
		rangeFields{1: VE(0xdead), 2: VE(0), 3: V(wantL), 4: V(wantM), 6: wantList6, 7: wantMap7, 12: V(wantM3a.ProtoReflect())},
		equalMessage{(&EnumMessages{
			EnumP2:        EnumProto2(0xdead).Enum(),
			EnumP3:        EnumProto3(0).Enum(),
			MessageLegacy: &proto2_20180125.Message{OptionalFloat: proto.Float32(math.E)},
			MessageCycle:  wantM.Interface().(*EnumMessages),
			MessageList:   []*ScalarProto2{wantM2a, wantM2b},
			EnumMap:       map[string]EnumProto3{"one": 1, "two": 2},
			Union:         &EnumMessages_OneofM3{wantM3a},
		}).ProtoReflect()},
		clearFields{1, 2, 3, 4, 6, 7, 12},
		equalMessage{new(EnumMessages).ProtoReflect()},
	})

	// Test read-only operations on nil message.
	testMessage(t, nil, (*EnumMessages)(nil).ProtoReflect(), messageOps{
		hasFields{1: false, 2: false, 3: false, 4: false, 5: false, 6: false, 7: false, 8: false, 9: false, 10: false, 11: false, 12: false},
		getFields{1: VE(0xbeef), 2: VE(1), 3: V(emptyL), 4: V(emptyM), 9: VE(0xbeef), 10: VE(1), 11: V(emptyM2), 12: V(emptyM3)},
		listFields{5: {lenList(0)}, 6: {lenList(0)}},
		mapFields{7: {lenMap(0)}, 8: {lenMap(0)}},
	})
}

var cmpOpts = cmp.Options{
	cmp.Comparer(func(x, y *proto2_20180125.Message) bool {
		mx := pimpl.Export{}.MessageOf(x).Interface()
		my := pimpl.Export{}.MessageOf(y).Interface()
		return proto.Equal(mx, my)
	}),
	cmp.Transformer("UnwrapValue", func(pv protoreflect.Value) any {
		switch v := pv.Interface().(type) {
		case protoreflect.Message:
			out := make(map[protoreflect.FieldNumber]protoreflect.Value)
			v.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
				out[fd.Number()] = v
				return true
			})
			return out
		case protoreflect.List:
			var out []protoreflect.Value
			for i := 0; i < v.Len(); i++ {
				out = append(out, v.Get(i))
			}
			return out
		case protoreflect.Map:
			out := make(map[any]protoreflect.Value)
			v.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
				out[k.Interface()] = v
				return true
			})
			return out
		default:
			return v
		}
	}),
	cmpopts.EquateNaNs(),
}

func testMessage(t *testing.T, p path, m protoreflect.Message, tt messageOps) {
	fieldDescs := m.Descriptor().Fields()
	oneofDescs := m.Descriptor().Oneofs()
	for i, op := range tt {
		p.Push(i)
		switch op := op.(type) {
		case equalMessage:
			if diff := cmp.Diff(V(op.Message), V(m), cmpOpts); diff != "" {
				t.Errorf("operation %v, message mismatch (-want, +got):\n%s", p, diff)
			}
		case hasFields:
			got := map[protoreflect.FieldNumber]bool{}
			want := map[protoreflect.FieldNumber]bool(op)
			for n := range want {
				fd := fieldDescs.ByNumber(n)
				got[n] = m.Has(fd)
			}
			if diff := cmp.Diff(want, got); diff != "" {
				t.Errorf("operation %v, Message.Has mismatch (-want, +got):\n%s", p, diff)
			}
		case getFields:
			got := map[protoreflect.FieldNumber]protoreflect.Value{}
			want := map[protoreflect.FieldNumber]protoreflect.Value(op)
			for n := range want {
				fd := fieldDescs.ByNumber(n)
				got[n] = m.Get(fd)
			}
			if diff := cmp.Diff(want, got, cmpOpts); diff != "" {
				t.Errorf("operation %v, Message.Get mismatch (-want, +got):\n%s", p, diff)
			}
		case setFields:
			for n, v := range op {
				fd := fieldDescs.ByNumber(n)
				m.Set(fd, v)
			}
		case clearFields:
			for _, n := range op {
				fd := fieldDescs.ByNumber(n)
				m.Clear(fd)
			}
		case whichOneofs:
			got := map[protoreflect.Name]protoreflect.FieldNumber{}
			want := map[protoreflect.Name]protoreflect.FieldNumber(op)
			for s := range want {
				od := oneofDescs.ByName(s)
				fd := m.WhichOneof(od)
				if fd == nil {
					got[s] = 0
				} else {
					got[s] = fd.Number()
				}
			}
			if diff := cmp.Diff(want, got); diff != "" {
				t.Errorf("operation %v, Message.WhichOneof mismatch (-want, +got):\n%s", p, diff)
			}
		case messageFields:
			for n, tt := range op {
				p.Push(int(n))
				fd := fieldDescs.ByNumber(n)
				testMessage(t, p, m.Get(fd).Message(), tt)
				p.Pop()
			}
		case messageFieldsMutable:
			for n, tt := range op {
				p.Push(int(n))
				fd := fieldDescs.ByNumber(n)
				testMessage(t, p, m.Mutable(fd).Message(), tt)
				p.Pop()
			}
		case listFields:
			for n, tt := range op {
				p.Push(int(n))
				fd := fieldDescs.ByNumber(n)
				testLists(t, p, m.Get(fd).List(), tt)
				p.Pop()
			}
		case listFieldsMutable:
			for n, tt := range op {
				p.Push(int(n))
				fd := fieldDescs.ByNumber(n)
				testLists(t, p, m.Mutable(fd).List(), tt)
				p.Pop()
			}
		case mapFields:
			for n, tt := range op {
				p.Push(int(n))
				fd := fieldDescs.ByNumber(n)
				testMaps(t, p, m.Get(fd).Map(), tt)
				p.Pop()
			}
		case mapFieldsMutable:
			for n, tt := range op {
				p.Push(int(n))
				fd := fieldDescs.ByNumber(n)
				testMaps(t, p, m.Mutable(fd).Map(), tt)
				p.Pop()
			}
		case rangeFields:
			got := map[protoreflect.FieldNumber]protoreflect.Value{}
			want := map[protoreflect.FieldNumber]protoreflect.Value(op)
			m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
				got[fd.Number()] = v
				return true
			})
			if diff := cmp.Diff(want, got, cmpOpts); diff != "" {
				t.Errorf("operation %v, Message.Range mismatch (-want, +got):\n%s", p, diff)
			}
		default:
			t.Fatalf("operation %v, invalid operation: %T", p, op)
		}
		p.Pop()
	}
}

func testLists(t *testing.T, p path, v protoreflect.List, tt listOps) {
	for i, op := range tt {
		p.Push(i)
		switch op := op.(type) {
		case equalList:
			if diff := cmp.Diff(V(op.List), V(v), cmpOpts); diff != "" {
				t.Errorf("operation %v, list mismatch (-want, +got):\n%s", p, diff)
			}
		case lenList:
			if got, want := v.Len(), int(op); got != want {
				t.Errorf("operation %v, List.Len = %d, want %d", p, got, want)
			}
		case getList:
			got := map[int]protoreflect.Value{}
			want := map[int]protoreflect.Value(op)
			for n := range want {
				got[n] = v.Get(n)
			}
			if diff := cmp.Diff(want, got, cmpOpts); diff != "" {
				t.Errorf("operation %v, List.Get mismatch (-want, +got):\n%s", p, diff)
			}
		case setList:
			for n, e := range op {
				v.Set(n, e)
			}
		case appendList:
			for _, e := range op {
				v.Append(e)
			}
		case appendMessageList:
			e := v.NewElement()
			v.Append(e)
			testMessage(t, p, e.Message(), messageOps(op))
		case truncList:
			v.Truncate(int(op))
		default:
			t.Fatalf("operation %v, invalid operation: %T", p, op)
		}
		p.Pop()
	}
}

func testMaps(t *testing.T, p path, m protoreflect.Map, tt mapOps) {
	for i, op := range tt {
		p.Push(i)
		switch op := op.(type) {
		case equalMap:
			if diff := cmp.Diff(V(op.Map), V(m), cmpOpts); diff != "" {
				t.Errorf("operation %v, map mismatch (-want, +got):\n%s", p, diff)
			}
		case lenMap:
			if got, want := m.Len(), int(op); got != want {
				t.Errorf("operation %v, Map.Len = %d, want %d", p, got, want)
			}
		case hasMap:
			got := map[any]bool{}
			want := map[any]bool(op)
			for k := range want {
				got[k] = m.Has(V(k).MapKey())
			}
			if diff := cmp.Diff(want, got, cmpOpts); diff != "" {
				t.Errorf("operation %v, Map.Has mismatch (-want, +got):\n%s", p, diff)
			}
		case getMap:
			got := map[any]protoreflect.Value{}
			want := map[any]protoreflect.Value(op)
			for k := range want {
				got[k] = m.Get(V(k).MapKey())
			}
			if diff := cmp.Diff(want, got, cmpOpts); diff != "" {
				t.Errorf("operation %v, Map.Get mismatch (-want, +got):\n%s", p, diff)
			}
		case setMap:
			for k, v := range op {
				m.Set(V(k).MapKey(), v)
			}
		case clearMap:
			for _, k := range op {
				m.Clear(V(k).MapKey())
			}
		case messageMap:
			for k, tt := range op {
				mk := V(k).MapKey()
				if !m.Has(mk) {
					m.Set(mk, m.NewValue())
				}
				testMessage(t, p, m.Get(mk).Message(), tt)
			}
		case rangeMap:
			got := map[any]protoreflect.Value{}
			want := map[any]protoreflect.Value(op)
			m.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
				got[k.Interface()] = v
				return true
			})
			if diff := cmp.Diff(want, got, cmpOpts); diff != "" {
				t.Errorf("operation %v, Map.Range mismatch (-want, +got):\n%s", p, diff)
			}
		default:
			t.Fatalf("operation %v, invalid operation: %T", p, op)
		}
		p.Pop()
	}
}

func getField(m protoreflect.Message, n protoreflect.FieldNumber) protoreflect.Value {
	fd := m.Descriptor().Fields().ByNumber(n)
	return m.Get(fd)
}

type path []int

func (p *path) Push(i int) { *p = append(*p, i) }
func (p *path) Pop()       { *p = (*p)[:len(*p)-1] }
func (p path) String() string {
	var ss []string
	for _, i := range p {
		ss = append(ss, fmt.Sprint(i))
	}
	return strings.Join(ss, ".")
}

type UnknownFieldsA struct {
	XXX_unrecognized []byte
}

var unknownFieldsAType = pimpl.MessageInfo{
	GoReflectType: reflect.TypeOf(new(UnknownFieldsA)),
	Desc:          mustMakeMessageDesc("unknown.proto", protoreflect.Proto2, "", `name: "UnknownFieldsA"`, nil),
}

func (m *UnknownFieldsA) ProtoReflect() protoreflect.Message { return unknownFieldsAType.MessageOf(m) }

type UnknownFieldsB struct {
	XXX_unrecognized *[]byte
}

var unknownFieldsBType = pimpl.MessageInfo{
	GoReflectType: reflect.TypeOf(new(UnknownFieldsB)),
	Desc:          mustMakeMessageDesc("unknown.proto", protoreflect.Proto2, "", `name: "UnknownFieldsB"`, nil),
}

func (m *UnknownFieldsB) ProtoReflect() protoreflect.Message { return unknownFieldsBType.MessageOf(m) }

func TestUnknownFields(t *testing.T) {
	for _, m := range []proto.Message{new(UnknownFieldsA), new(UnknownFieldsB)} {
		t.Run(reflect.TypeOf(m).Elem().Name(), func(t *testing.T) {
			want := protopack.Message{
				protopack.Tag{1, protopack.BytesType}, protopack.String("Hello, world!"),
			}.Marshal()
			m.ProtoReflect().SetUnknown(want)
			got := []byte(m.ProtoReflect().GetUnknown())
			if diff := cmp.Diff(want, got); diff != "" {
				t.Errorf("UnknownFields mismatch (-want +got):\n%s", diff)
			}
		})
	}
}

func TestReset(t *testing.T) {
	mi := new(testpb.TestAllTypes)

	// ProtoReflect is implemented using a messageState cache.
	m := mi.ProtoReflect()

	// Reset must not clear the messageState cache.
	mi.Reset()

	// If Reset accidentally cleared the messageState cache, this panics.
	m.Descriptor()
}

func TestIsValid(t *testing.T) {
	var m *testpb.TestAllTypes
	if got, want := m.ProtoReflect().IsValid(), false; got != want {
		t.Errorf("((*M)(nil)).ProtoReflect().IsValid() = %v, want %v", got, want)
	}
	m = &testpb.TestAllTypes{}
	if got, want := m.ProtoReflect().IsValid(), true; got != want {
		t.Errorf("(&M{}).ProtoReflect().IsValid() = %v, want %v", got, want)
	}
}

// The MessageState implementation makes the assumption that when a
// concrete message is unsafe casted as a *MessageState, the Go GC does
// not reclaim the memory for the remainder of the concrete message.
func TestUnsafeAssumptions(t *testing.T) {
	if !pimpl.UnsafeEnabled {
		t.Skip()
	}

	var wg sync.WaitGroup
	for i := 0; i < 10; i++ {
		wg.Add(1)
		go func() {
			var ms [10]protoreflect.Message

			// Store the message only in its reflective form.
			// Trigger the GC after each iteration.
			for j := 0; j < 10; j++ {
				ms[j] = (&testpb.TestAllTypes{
					OptionalInt32: proto.Int32(int32(j)),
					OptionalFloat: proto.Float32(float32(j)),
					RepeatedInt32: []int32{int32(j)},
					RepeatedFloat: []float32{float32(j)},
					DefaultInt32:  proto.Int32(int32(j)),
					DefaultFloat:  proto.Float32(float32(j)),
				}).ProtoReflect()
				runtime.GC()
			}

			// Convert the reflective form back into a concrete form.
			// Verify that the values written previously are still the same.
			for j := 0; j < 10; j++ {
				switch m := ms[j].Interface().(*testpb.TestAllTypes); {
				case m.GetOptionalInt32() != int32(j):
				case m.GetOptionalFloat() != float32(j):
				case m.GetRepeatedInt32()[0] != int32(j):
				case m.GetRepeatedFloat()[0] != float32(j):
				case m.GetDefaultInt32() != int32(j):
				case m.GetDefaultFloat() != float32(j):
				default:
					continue
				}
				t.Error("memory corrupted detected")
			}
			defer wg.Done()
		}()
	}
	wg.Wait()
}

func BenchmarkName(b *testing.B) {
	var sink protoreflect.FullName
	b.Run("Value", func(b *testing.B) {
		b.ReportAllocs()
		m := new(descriptorpb.FileDescriptorProto)
		for i := 0; i < b.N; i++ {
			sink = m.ProtoReflect().Descriptor().FullName()
		}
	})
	b.Run("Nil", func(b *testing.B) {
		b.ReportAllocs()
		m := (*descriptorpb.FileDescriptorProto)(nil)
		for i := 0; i < b.N; i++ {
			sink = m.ProtoReflect().Descriptor().FullName()
		}
	})
	runtime.KeepAlive(sink)
}

func BenchmarkReflect(b *testing.B) {
	m := new(testpb.TestAllTypes).ProtoReflect()
	fds := m.Descriptor().Fields()
	vs := make([]protoreflect.Value, fds.Len())
	for i := range vs {
		vs[i] = m.NewField(fds.Get(i))
	}

	b.Run("Has", func(b *testing.B) {
		b.ReportAllocs()
		for i := 0; i < b.N; i++ {
			for j := 0; j < fds.Len(); j++ {
				m.Has(fds.Get(j))
			}
		}
	})
	b.Run("Get", func(b *testing.B) {
		b.ReportAllocs()
		for i := 0; i < b.N; i++ {
			for j := 0; j < fds.Len(); j++ {
				m.Get(fds.Get(j))
			}
		}
	})
	b.Run("Set", func(b *testing.B) {
		b.ReportAllocs()
		for i := 0; i < b.N; i++ {
			for j := 0; j < fds.Len(); j++ {
				m.Set(fds.Get(j), vs[j])
			}
		}
	})
	b.Run("Clear", func(b *testing.B) {
		b.ReportAllocs()
		for i := 0; i < b.N; i++ {
			for j := 0; j < fds.Len(); j++ {
				m.Clear(fds.Get(j))
			}
		}
	})
	b.Run("Range", func(b *testing.B) {
		b.ReportAllocs()
		for i := 0; i < b.N; i++ {
			m.Range(func(protoreflect.FieldDescriptor, protoreflect.Value) bool {
				return true
			})
		}
	})
}

Youez - 2016 - github.com/yon3zu
LinuXploit