From b8a6103f2b132ed68785e1f448b7b6e747d604fd Mon Sep 17 00:00:00 2001 From: Sergey Date: Sat, 31 Aug 2024 04:39:43 +0300 Subject: [PATCH] chore: removed more legacy --- pkg/utils/utils.go | 15 --------------- pkg/utils/utils_test.go | 38 +------------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index d15fbe5..5333768 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -1,7 +1,6 @@ package utils import ( - "bytes" "encoding/hex" "fmt" "math" @@ -160,20 +159,6 @@ func MakeShuffledArray(length int) []int { return array } -func CompareTwoBech32(first, second string) (bool, error) { - _, firstBytes, err := bech32.Decode(first) - if err != nil { - return false, err - } - - _, secondBytes, err := bech32.Decode(second) - if err != nil { - return false, err - } - - return bytes.Equal(firstBytes, secondBytes), nil -} - func MustDecodeBech32(addr string) string { _, bech32Bytes, err := bech32.Decode(addr) if err != nil { diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index c312fd5..d29bc4f 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -105,43 +105,7 @@ func TestMakeShuffledArray(t *testing.T) { assert.Len(t, array, 10, "Array should have 10 entries!") } -func TestCompareTwoBech32FirstInvalid(t *testing.T) { - t.Parallel() - - _, err := CompareTwoBech32("test", "cosmos1xqz9pemz5e5zycaa89kys5aw6m8rhgsvtp9lt2") - require.Error(t, err, "Error should be present!") -} - -func TestCompareTwoBech32SecondInvalid(t *testing.T) { - t.Parallel() - - _, err := CompareTwoBech32("cosmos1xqz9pemz5e5zycaa89kys5aw6m8rhgsvtp9lt2", "test") - require.Error(t, err, "Error should be present!") -} - -func TestCompareTwoBech32SecondEqual(t *testing.T) { - t.Parallel() - - equal, err := CompareTwoBech32( - "cosmos1xqz9pemz5e5zycaa89kys5aw6m8rhgsvtp9lt2", - "cosmosvaloper1xqz9pemz5e5zycaa89kys5aw6m8rhgsvw4328e", - ) - require.NoError(t, err, "Error should not be present!") - assert.True(t, equal, "Bech addresses should be equal!") -} - -func TestCompareTwoBech32SecondNotEqual(t *testing.T) { - t.Parallel() - - equal, err := CompareTwoBech32( - "cosmos1xqz9pemz5e5zycaa89kys5aw6m8rhgsvtp9lt2", - "cosmos1c4k24jzduc365kywrsvf5ujz4ya6mwymy8vq4q", - ) - require.NoError(t, err, "Error should not be present!") - assert.False(t, equal, "Bech addresses should not be equal!") -} - -func TestCompareBoolToFloat64(t *testing.T) { +func TestBoolToFloat64(t *testing.T) { t.Parallel() assert.InDelta(t, float64(1), BoolToFloat64(true), 0.001, "Value mismatch!") assert.InDelta(t, float64(0), BoolToFloat64(false), 0.001, "Value mismatch!")