github.com/MetalBlockchain/metalgo@v1.11.9/utils/formatting/int_format_test.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package formatting
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func TestIntFormat(t *testing.T) {
    13  	require := require.New(t)
    14  
    15  	require.Equal("%01d", IntFormat(0))
    16  	require.Equal("%01d", IntFormat(9))
    17  	require.Equal("%02d", IntFormat(10))
    18  	require.Equal("%02d", IntFormat(99))
    19  	require.Equal("%03d", IntFormat(100))
    20  	require.Equal("%03d", IntFormat(999))
    21  	require.Equal("%04d", IntFormat(1000))
    22  	require.Equal("%04d", IntFormat(9999))
    23  	require.Equal("%05d", IntFormat(10000))
    24  	require.Equal("%05d", IntFormat(99999))
    25  	require.Equal("%06d", IntFormat(100000))
    26  	require.Equal("%06d", IntFormat(999999))
    27  }