File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ There is a file "generate_large.go" which generates ~150MB file for tests.
2+ The reason it's written in go is that it takes infinite RAM to do it in python
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import "fmt"
4+ import "strings"
5+ import "encoding/json"
6+ import "io/ioutil"
7+
8+ type Test struct {
9+ Input string `json:"input"`
10+ Output string `json:"output"`
11+ }
12+
13+ func main () {
14+ var a strings.Builder
15+ a .Grow (1000 * 1000 * 10 )
16+ for i := 0 ; i < 1000 * 1000 * 10 ; i ++ {
17+ fmt .Fprintf (& a , "%d " , i )
18+ }
19+ as := a .String ()
20+ var b strings.Builder
21+ b .Grow (20 * 1000 * 1000 )
22+ fmt .Fprintf (& b , "%s\n %s" , as , as )
23+ t := Test {Input : b .String (), Output : "4999999.5" }
24+
25+ file , _ := json .Marshal (t )
26+ err := ioutil .WriteFile ("test/test_large_go" , file , 0666 )
27+ if err != nil {
28+ fmt .Println (err .Error ())
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments