1 Star 0 Fork 0

Paulden/Algorithm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
num_squares_test.go 666 Bytes
一键复制 编辑 原始数据 按行查看 历史
package algorithm
import "testing"
func TestNumSquare(t *testing.T) {
tests := []struct {
input, output int
}{
{12, 3},
{13, 2},
{1000, 2},
{999, 4},
{666, 2},
{4, 1},
{10000, 1},
}
t.Run("Test numSquares1", func(t *testing.T) {
t.Parallel()
for _, tt := range tests {
if ret := numSquares1(tt.input); ret != tt.output {
t.Errorf("Error with %d, the wrong result is %d", tt.input, ret)
}
}
})
t.Run("Test numSquares2", func(t *testing.T) {
t.Parallel()
for _, tt := range tests {
if ret := numSquares2(tt.input); ret != tt.output {
t.Errorf("Error with %d, the wrong result is %d", tt.input, ret)
}
}
})
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/guuzaa/algorithm.git
git@gitee.com:guuzaa/algorithm.git
guuzaa
algorithm
Algorithm
main

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385