Skip to content

Commit

Permalink
Add a simple test for asset case sorting in ascii (#4876)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Bellamy authored May 19, 2023
1 parent d92f1f5 commit c05dcf6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xdr/asset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ func TestAssetLessThan(t *testing.T) {
assert.False(t, assetIssuerB.LessThan(assetIssuerA))
assert.False(t, assetIssuerB.LessThan(assetIssuerB))
})

t.Run("test if codes with upper-case letters are sorted before lower-case letters", func(t *testing.T) {
// All upper-case letters should come before any lower-case ones
assetA, err := NewCreditAsset("B", "GA7NLOF4EHWMJF6DBXXV2H6AYI7IHYWNFZR6R52BYBLY7TE5Q74AIDRA")
require.NoError(t, err)
assetB, err := NewCreditAsset("a", "GA7NLOF4EHWMJF6DBXXV2H6AYI7IHYWNFZR6R52BYBLY7TE5Q74AIDRA")
require.NoError(t, err)

assert.True(t, assetA.LessThan(assetB))
})
}

func BenchmarkAssetString(b *testing.B) {
Expand Down

0 comments on commit c05dcf6

Please sign in to comment.