How to test the equivalence of maps in Golang?

前端 未结 8 1449
情歌与酒
情歌与酒 2021-01-30 00:55

I have a table-driven test case like this one:

func CountWords(s string) map[string]int

func TestCountWords(t *testing.T) {
  var tests = []struct {
    input s         


        
8条回答
  •  难免孤独
    2021-01-30 01:13

    One of the options is to fix rng:

    rand.Reader = mathRand.New(mathRand.NewSource(0xDEADBEEF))
    

提交回复
热议问题