github.com/TTWShell/algorithms@v0.0.0-20210910033257-59bd94c188be/leetcode/math/nthUglyNumber_test.go (about)

     1  package lmath
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/stretchr/testify/assert"
     6  	"testing"
     7  )
     8  
     9  func Test_nthUglyNumber(t *testing.T) {
    10  	assert := assert.New(t)
    11  
    12  	for i, num := range []int{1, 2, 3, 4, 5, 6, 8, 9, 10, 12} {
    13  		assert.Equal(num, nthUglyNumber(i+1), fmt.Sprintf("%d:%d", i, num))
    14  	}
    15  }
    16  
    17  func Benchmark_nthUglyNumber(t *testing.B) {
    18  	assert := assert.New(t)
    19  
    20  	assert.Equal(2123366400, nthUglyNumber(1690))
    21  }