-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gen/tables): passing seed to tables generator (#4866)
* fix(gen/tables): passing seed to tables generator Adding seed to tables generator to get the very same sequence each time(helpful in writing test) at the moment the seed defaults to the current time, which generates a different sequence each time. useful in #4307 * fix: passing pointer for Seed so that it defaults to nil not zero
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package gen | ||
|
||
|
||
import "array" | ||
import "testing" | ||
import "internal/gen" | ||
import "internal/debug" | ||
|
||
option now = () => 2030-01-01T00:00:00Z | ||
|
||
testcase gen_tables_seed { | ||
got = | ||
gen.tables(n: 5, seed: 123) | ||
|> drop(columns: ["_time"]) | ||
|
||
want = | ||
array.from( | ||
rows: [ | ||
{_value: -39.7289264835779}, | ||
{_value: 3.561659508431711}, | ||
{_value: 34.956531511845476}, | ||
{_value: -53.72013420347799}, | ||
{_value: 49.20701082669753}, | ||
], | ||
) | ||
|
||
testing.diff(got: got, want: want) | ||
} |