From ac05140b500d81b6bbd259c1509e0ec0e4a30dcb Mon Sep 17 00:00:00 2001 From: Etuloser <1494136313@qq.com> Date: Thu, 10 Feb 2022 11:21:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dpkg/nazareflect?= =?UTF-8?q?=E5=8C=85=E4=B8=AD=E6=97=A0=E7=AC=A6=E5=8F=B7=E6=95=B4=E5=9E=8B?= =?UTF-8?q?=E6=AF=94=E8=BE=83=E9=80=BB=E8=BE=91=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/nazareflect/value.go | 2 +- pkg/nazareflect/value_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/nazareflect/value.go b/pkg/nazareflect/value.go index 98d4732..e927fb9 100644 --- a/pkg/nazareflect/value.go +++ b/pkg/nazareflect/value.go @@ -60,7 +60,7 @@ func EqualInteger(a, b interface{}) bool { buv, buok := tryUint(b) if auok && buok { // a,b都是无符号整型 (1) - return auv == auv + return auv == buv } if aiok && buok { // a是有符号整型,b是无符号整型 (1) if aiv < 0 { diff --git a/pkg/nazareflect/value_test.go b/pkg/nazareflect/value_test.go index d26443d..85c08a3 100644 --- a/pkg/nazareflect/value_test.go +++ b/pkg/nazareflect/value_test.go @@ -57,6 +57,7 @@ func TestEqualInteger(t *testing.T) { sure(t, !EqualInteger(1, 0)) sure(t, !EqualInteger(0, "aaa")) sure(t, !EqualInteger(-1, uint(0))) + sure(t, !EqualInteger(int32(0), int16(1))) sure(t, !EqualInteger(uint16(0), int32(-1))) }