Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8fd7744

Browse files
committedJan 22, 2024
Make testsuite emu/plugins/tdl pass on >= go1.20
Prior to Go 1.20 the pseudo-random number generator was seeded like Seed(1) at program startup, but in later releases the generator is seeded randomly. Since the testcase "typeDef1" uses the "rand" op the testcase output does not always match the expected file: unit-test/exp/typeDef1.json This is due to the different random order in Go 1.20+. By setting seed=1, as previously done by Go itself, we get the same result in all Go version. - Testcase "params": { "size": 6, "offset": 0, "op": "rand", "list": ["TRex", "Cisco", "Golang"] } - Go doc: https://pkg.go.dev/math/rand@master#Seed
1 parent e1bef8e commit 8fd7744

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed
 

‎src/emu/plugins/tdl/tdl_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ func TestTypeDef1(t *testing.T) {
561561
initJSON: [][]byte{[]byte(initJson)},
562562
duration: 10 * time.Second,
563563
clientsToSim: 1,
564+
seed: 1,
564565
}
565566
a.Run(t, true)
566567
}

0 commit comments

Comments
 (0)
Please sign in to comment.