text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
func TestDay11GetLocation(t *testing.T) { d := &Day11{} grid := `ab cd ef gh` width, height := d.getDims(grid) assert.Equal(t, "a", d.getLocation(grid, 0, 0, width, height)) assert.Equal(t, "d", d.getLocation(grid, 1, 1, width, height)) assert.Equal(t, "d", d.getLocation(grid, 1, 3, width, height)) }
explode_data.jsonl/48597
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 10159, 16, 16, 1949, 4707, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 609, 10159, 16, 16, 16094, 49018, 1669, 1565, 370, 198, 4385, 198, 823, 198, 866, 3989, 24219, 11, 2608, 1669, 294, 670, 87117, 25319, 340, 6948, 12808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetConfigKeysByGroup(t *testing.T) { file, err := initFileData(t) assert.Nil(t, err) group := "dubbogo" value := "Test Value" err = file.PublishConfig(key, group, value) assert.NoError(t, err) gs, err := file.GetConfigKeysByGroup(group) assert.NoError(t, err) assert.Equal(t, 1, gs.Size()) assert.Equal(t, key, gs.Values()[0]) // remove need wait a moment time.Sleep(time.Second) defer destroy(file.rootPath, file) }
explode_data.jsonl/16360
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 1949, 2648, 8850, 1359, 2808, 1155, 353, 8840, 836, 8, 341, 17661, 11, 1848, 1669, 2930, 1703, 1043, 1155, 340, 6948, 59678, 1155, 11, 1848, 340, 44260, 1669, 330, 67, 20683, 23500, 698, 16309, 1669, 330, 2271, 5162, 698, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPrinto(t *testing.T) { t.Run("enabled output", func(t *testing.T) { pterm.Output = true for _, randomString := range internal.RandomStrings { out := captureStdout(func(w io.Writer) { pterm.Printo(randomString) }) testza.AssertEqual(t, "\r"+randomString, out) } }) t.Run("disabled output", func(t *testing.T) { pterm.Output = false for _, randomString := range internal.RandomStrings { out := captureStdout(func(w io.Writer) { pterm.Printo(randomString) }) testza.AssertEqual(t, "", out) } pterm.Output = false }) }
explode_data.jsonl/49139
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 240 }
[ 2830, 3393, 8994, 78, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 15868, 2550, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 60796, 4195, 34246, 284, 830, 198, 197, 2023, 8358, 4194, 703, 1669, 2088, 5306, 26709, 20859, 341, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnicodeLastIndexOf(t *testing.T) { const SCRIPT = ` "абвабаб".lastIndexOf("аб", 3) ` testScript1(SCRIPT, intToValue(3), t) }
explode_data.jsonl/10453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 33920, 5842, 27376, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 197, 1, 37622, 5474, 37622, 37622, 3263, 4259, 27376, 445, 37622, 497, 220, 18, 340, 197, 19324, 18185, 5910, 16, 7, 24787, 11, 526, 1249, 1130, 7,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestCrossSiteHandler(t *testing.T) { cases := []struct { Cors cors.Options Request fakeRequest }{ { Cors: cors.Options{ AllowedOrigins: []string{"*"}, }, Request: fakeRequest{ URI: fakeAuthAllURL, Headers: map[string]string{ "Origin": "127.0.0.1", }, ExpectedHeaders: map[string]string{ "Access-Control-Allow-Origin": "*", }, }, }, { Cors: cors.Options{ AllowedOrigins: []string{"*", "https://examples.com"}, }, Request: fakeRequest{ URI: fakeAuthAllURL, Headers: map[string]string{ "Origin": "127.0.0.1", }, ExpectedHeaders: map[string]string{ "Access-Control-Allow-Origin": "*", }, }, }, { Cors: cors.Options{ AllowedOrigins: []string{"*"}, AllowedMethods: []string{"GET", "POST"}, }, Request: fakeRequest{ URI: fakeAuthAllURL, Method: http.MethodOptions, Headers: map[string]string{ "Origin": "127.0.0.1", "Access-Control-Request-Method": "GET", }, ExpectedHeaders: map[string]string{ "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET", }, }, }, } for _, c := range cases { cfg := newFakeKeycloakConfig() cfg.CorsCredentials = c.Cors.AllowCredentials cfg.CorsExposedHeaders = c.Cors.ExposedHeaders cfg.CorsHeaders = c.Cors.AllowedHeaders cfg.CorsMaxAge = time.Duration(c.Cors.MaxAge) * time.Second cfg.CorsMethods = c.Cors.AllowedMethods cfg.CorsOrigins = c.Cors.AllowedOrigins newFakeProxy(cfg).RunTests(t, []fakeRequest{c.Request}) } }
explode_data.jsonl/14758
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 748 }
[ 2830, 3393, 28501, 17597, 3050, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 6258, 1087, 262, 43911, 22179, 198, 197, 73806, 12418, 1900, 198, 197, 59403, 197, 197, 515, 298, 6258, 1087, 25, 43911, 22179, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSCSSWithThemeOverrides(t *testing.T) { if !scss.Supports() { t.Skip("Skip SCSS") } assert := require.New(t) workDir, clean, err := createTempDir("hugo-scss-include") assert.NoError(err) defer clean() theme := "mytheme" themesDir := filepath.Join(workDir, "themes") themeDirs := filepath.Join(themesDir, theme) v := viper.New() v.Set("workingDir", workDir) v.Set("theme", theme) b := newTestSitesBuilder(t).WithLogger(loggers.NewWarningLogger()) b.WithViper(v) b.WithWorkingDir(workDir) // Need to use OS fs for this. b.Fs = hugofs.NewDefault(v) fooDir := filepath.Join(workDir, "node_modules", "foo") scssDir := filepath.Join(workDir, "assets", "scss") scssThemeDir := filepath.Join(themeDirs, "assets", "scss") assert.NoError(os.MkdirAll(fooDir, 0777)) assert.NoError(os.MkdirAll(filepath.Join(workDir, "content", "sect"), 0777)) assert.NoError(os.MkdirAll(filepath.Join(workDir, "data"), 0777)) assert.NoError(os.MkdirAll(filepath.Join(workDir, "i18n"), 0777)) assert.NoError(os.MkdirAll(filepath.Join(workDir, "layouts", "shortcodes"), 0777)) assert.NoError(os.MkdirAll(filepath.Join(workDir, "layouts", "_default"), 0777)) assert.NoError(os.MkdirAll(filepath.Join(scssDir, "components"), 0777)) assert.NoError(os.MkdirAll(filepath.Join(scssThemeDir, "components"), 0777)) b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_imports.scss"), ` @import "moo"; @import "_boo"; `) b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_moo.scss"), ` $moolor: #fff; moo { color: $moolor; } `) b.WithSourceFile(filepath.Join(scssThemeDir, "components", "_boo.scss"), ` $boolor: orange; boo { color: $boolor; } `) b.WithSourceFile(filepath.Join(scssThemeDir, "main.scss"), ` @import "components/imports"; `) b.WithSourceFile(filepath.Join(scssDir, "components", "_moo.scss"), ` $moolor: #ccc; moo { color: $moolor; } `) b.WithSourceFile(filepath.Join(scssDir, "components", "_boo.scss"), ` $boolor: green; boo { color: $boolor; } `) b.WithTemplatesAdded("index.html", ` {{ $cssOpts := (dict "includePaths" (slice "node_modules/foo" ) ) }} {{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }} T1: {{ $r.Content }} `) b.Build(BuildCfg{}) b.AssertFileContent(filepath.Join(workDir, "public/index.html"), `T1: moo{color:#ccc}boo{color:green}`) }
explode_data.jsonl/79722
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 982 }
[ 2830, 3393, 3540, 1220, 2354, 12594, 80010, 1155, 353, 8840, 836, 8, 341, 743, 753, 63298, 79990, 82, 368, 341, 197, 3244, 57776, 445, 35134, 7531, 1220, 1138, 197, 532, 6948, 1669, 1373, 7121, 1155, 340, 97038, 6184, 11, 4240, 11, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTrackCargo(t *testing.T) { var cargos mockCargoRepository var events mock.HandlingEventRepository events.QueryHandlingHistoryFn = func(cargo.TrackingID) cargo.HandlingHistory { return cargo.HandlingHistory{} } s := NewService(&cargos, &events) c := cargo.New("TEST", cargo.RouteSpecification{ Origin: "SESTO", Destination: "FIHEL", ArrivalDeadline: time.Date(2005, 12, 4, 0, 0, 0, 0, time.UTC), }) cargos.Store(c) logger := log.NewLogfmtLogger(ioutil.Discard) h := MakeHandler(s, logger) req, _ := http.NewRequest("GET", "http://example.com/tracking/v1/cargos/TEST", nil) rec := httptest.NewRecorder() h.ServeHTTP(rec, req) if rec.Code != http.StatusOK { t.Errorf("rec.Code = %d; want = %d", rec.Code, http.StatusOK) } if content := rec.Header().Get("Content-Type"); content != "application/json; charset=utf-8" { t.Errorf("Content-Type = %q; want = %q", content, "application/json; charset=utf-8") } var response trackCargoResponse if err := json.NewDecoder(rec.Body).Decode(&response); err != nil { t.Error(err) } if response.Err != nil { t.Errorf("response.Err = %q", response.Err) } var eta time.Time want := Cargo{ TrackingID: "TEST", Origin: "SESTO", Destination: "FIHEL", ArrivalDeadline: time.Date(2005, 12, 4, 0, 0, 0, 0, time.UTC), ETA: eta.In(time.UTC), StatusText: "Not received", NextExpectedActivity: "There are currently no expected activities for this cargo.", Events: nil, } if !reflect.DeepEqual(want, *response.Cargo) { t.Errorf("response.Cargo = %#v; want = %#v", response.Cargo, want) } }
explode_data.jsonl/69181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 724 }
[ 2830, 3393, 15667, 98228, 1155, 353, 8840, 836, 8, 341, 2405, 61662, 436, 7860, 98228, 4624, 271, 2405, 4357, 7860, 35308, 2718, 1556, 4624, 198, 90873, 15685, 38606, 13424, 24911, 284, 2915, 1337, 12088, 8240, 8985, 915, 8, 25652, 35308,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTimeResult(t *testing.T) { assert(t, Get(basicJSON, "created").String() == Get(basicJSON, "created").Time().Format(time.RFC3339Nano)) }
explode_data.jsonl/43416
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 54 }
[ 2830, 3393, 1462, 2077, 1155, 353, 8840, 836, 8, 341, 6948, 1155, 11, 2126, 1883, 5971, 5370, 11, 330, 7120, 1827, 703, 368, 47761, 197, 37654, 1883, 5971, 5370, 11, 330, 7120, 1827, 1462, 1005, 4061, 9730, 2013, 6754, 18, 18, 18, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestParsersRabbitMQMultilineLog(t *testing.T) { t.Skip("Flaky test: https://github.com/elastic/beats/issues/27893") env := newInputTestingEnvironment(t) testlogName := "test.log" inp := env.mustCreateInput(map[string]interface{}{ "paths": []string{env.abspath(testlogName)}, "prospector.scanner.check_interval": "1ms", "parsers": []map[string]interface{}{ map[string]interface{}{ "multiline": map[string]interface{}{ "type": "pattern", "pattern": "^=[A-Z]+", "negate": true, "match": "after", "timeout": "100ms", // set to lower value to speed up test }, }, }, }) testlines := []byte(`=ERROR REPORT==== 3-Feb-2016::03:10:32 === connection <0.23893.109>, channel 3 - soft error: {amqp_error,not_found, "no queue 'bucket-1' in vhost '/'", 'queue.declare'} =ERROR REPORT==== 3-Feb-2016::03:10:32 === connection <0.23893.109>, channel 3 - soft error: {amqp_error,not_found, "no queue 'bucket-1' in vhost '/'", 'queue.declare'} `) env.mustWriteLinesToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) env.waitUntilEventCount(2) env.requireOffsetInRegistry(testlogName, len(testlines)) cancelInput() env.waitUntilInputStops() }
explode_data.jsonl/14918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 587 }
[ 2830, 3393, 47, 40488, 49, 19949, 35169, 40404, 26560, 2201, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 3882, 28100, 1273, 25, 3703, 1110, 5204, 905, 14, 61964, 58689, 1862, 38745, 14, 17, 22, 23, 24, 18, 5130, 57538, 1669, 501, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFindImportStdlib(t *testing.T) { tests := []struct { pkg string symbols []string want string }{ {"http", []string{"Get"}, "net/http"}, {"http", []string{"Get", "Post"}, "net/http"}, {"http", []string{"Get", "Foo"}, ""}, {"bytes", []string{"Buffer"}, "bytes"}, {"ioutil", []string{"Discard"}, "io/ioutil"}, } for _, tt := range tests { got, rename, ok := findImportStdlib(tt.pkg, strSet(tt.symbols)) if (got != "") != ok { t.Error("findImportStdlib return value inconsistent") } if got != tt.want || rename { t.Errorf("findImportStdlib(%q, %q) = %q, %t; want %q, false", tt.pkg, tt.symbols, got, rename, tt.want) } } }
explode_data.jsonl/12430
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 9885, 11511, 22748, 2740, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 3223, 7351, 257, 914, 198, 197, 1903, 11786, 3056, 917, 198, 197, 50780, 262, 914, 198, 197, 59403, 197, 197, 4913, 1254, 497, 3056...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestValidateWafMetricName(t *testing.T) { validNames := []string{ "testrule", "testRule", "testRule123", } for _, v := range validNames { _, errors := validateWafMetricName(v, "name") if len(errors) != 0 { t.Fatalf("%q should be a valid WAF metric name: %q", v, errors) } } invalidNames := []string{ "!", "/", " ", ":", ";", "white space", "/slash-at-the-beginning", "slash-at-the-end/", } for _, v := range invalidNames { _, errors := validateWafMetricName(v, "name") if len(errors) == 0 { t.Fatalf("%q should be an invalid WAF metric name", v) } } }
explode_data.jsonl/78626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 17926, 54, 2577, 54310, 675, 1155, 353, 8840, 836, 8, 341, 56322, 7980, 1669, 3056, 917, 515, 197, 197, 1, 1944, 12937, 756, 197, 197, 1, 1944, 11337, 756, 197, 197, 1, 1944, 11337, 16, 17, 18, 756, 197, 532, 2023, 835...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestAPIRequest_Token(t *testing.T) { kp := types.CreateKeyPair() adiUrl := "redwagon" tokenUrl := adiUrl + "/MyTokens" message, err := createToken(tokenUrl) if err != nil { t.Fatal(err) } params := createRequest(t, adiUrl, &kp, message) validate, err := protocol.NewValidator() require.NoError(t, err) req := &APIRequestRaw{} // unmarshal req if err = json.Unmarshal(params, &req); err != nil { t.Fatal(err) } // validate request if err = validate.Struct(req); err != nil { t.Fatal(err) } data := &protocol.CreateToken{} // parse req.tx.data err = mapstructure.Decode(req.Tx.Data, data) if err == nil { //in this case we are EXPECTING failure because the mapstructure doesn't decode the hex encoded strings from data t.Fatal(err) } rawreq := APIRequestRaw{} err = json.Unmarshal(params, &rawreq) if err != nil { t.Fatal(err) } err = json.Unmarshal(*rawreq.Tx.Data, data) if err != nil { t.Fatal(err) } // validate request data if err = validate.Struct(data); err != nil { //the data should have been unmarshalled correctly and the data is should be valid t.Fatal(err) } }
explode_data.jsonl/16534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 437 }
[ 2830, 3393, 7082, 1900, 1139, 1679, 1155, 353, 8840, 836, 8, 341, 16463, 79, 1669, 4494, 7251, 1592, 12443, 2822, 197, 2767, 2864, 1669, 330, 1151, 93119, 698, 43947, 2864, 1669, 993, 72, 2864, 488, 3521, 5050, 29300, 1837, 24753, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestValidate_FragmentsOnCompositeTypes_InlineFragmentWithoutTypeIsValid(t *testing.T) { testutil.ExpectPassesRule(t, graphql.FragmentsOnCompositeTypesRule, ` fragment validFragment on Pet { ... { name } } `) }
explode_data.jsonl/56010
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 17926, 1400, 41956, 1925, 41685, 4173, 62, 25324, 9488, 26040, 929, 55470, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 81893, 12187, 288, 11337, 1155, 11, 48865, 991, 41956, 1925, 41685, 4173, 11337, 11, 22074, 414, 12289, 2697...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func Test_PredefinedContent(t *testing.T) { gtest.C(t, func(t *gtest.T) { page := gpage.New(5, 1, 2, `/user/list/{.page}`) page.AjaxActionName = "LoadPage" t.Assert(page.GetContent(1), `<a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="">上一页</a> <span class="current">2</span> <a class="GPageLink" href="javascript:LoadPage('/user/list/3')" title="">下一页</a>`) t.Assert(page.GetContent(2), `<a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="">首页</a><a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title=""><<上一页</a><span class="current">[第2页]</span><a class="GPageLink" href="javascript:LoadPage('/user/list/3')" title="">下一页>></a><a class="GPageLink" href="javascript:LoadPage('/user/list/5')" title="">尾页</a>第<select name="GPageSelect" onchange="window.location.href=this.value"><option value="/user/list/1">1</option><option value="/user/list/2" selected>2</option><option value="/user/list/3">3</option><option value="/user/list/4">4</option><option value="/user/list/5">5</option></select>页`) t.Assert(page.GetContent(3), `<a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="">首页</a><a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="">上一页</a><a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="1">1</a><span class="GPageSpan">2</span><a class="GPageLink" href="javascript:LoadPage('/user/list/3')" title="3">3</a><a class="GPageLink" href="javascript:LoadPage('/user/list/4')" title="4">4</a><a class="GPageLink" href="javascript:LoadPage('/user/list/5')" title="5">5</a><a class="GPageLink" href="javascript:LoadPage('/user/list/3')" title="">下一页</a><a class="GPageLink" href="javascript:LoadPage('/user/list/5')" title="">尾页</a><span>当前页2/5</span> <span>共5条</span>`) t.Assert(page.GetContent(4), `<a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="">首页</a><a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="">上一页</a><a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="1">1</a><span class="GPageSpan">2</span><a class="GPageLink" href="javascript:LoadPage('/user/list/3')" title="3">3</a><a class="GPageLink" href="javascript:LoadPage('/user/list/4')" title="4">4</a><a class="GPageLink" href="javascript:LoadPage('/user/list/5')" title="5">5</a><a class="GPageLink" href="javascript:LoadPage('/user/list/3')" title="">下一页</a><a class="GPageLink" href="javascript:LoadPage('/user/list/5')" title="">尾页</a>`) t.Assert(page.GetContent(5), ``) }) }
explode_data.jsonl/55799
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1059 }
[ 2830, 3393, 79561, 9711, 2762, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 35272, 1669, 342, 2893, 7121, 7, 20, 11, 220, 16, 11, 220, 17, 11, 37301, 872, 20936, 9388, 13, 2893...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandlePreflightInvlaidOriginAbortion(t *testing.T) { s := New(Options{ AllowedOrigins: []string{"http://foo.com"}, }) res := httptest.NewRecorder() req, _ := http.NewRequest("OPTIONS", "http://example.com/foo", nil) req.Header.Add("Origin", "http://example.com/") s.handlePreflight(res, req) assertHeaders(t, res.Header(), map[string]string{ "Vary": "Origin, Access-Control-Request-Method, Access-Control-Request-Headers", }) }
explode_data.jsonl/57636
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 6999, 29978, 4145, 641, 14536, 3779, 13298, 5830, 25886, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1532, 7, 3798, 515, 197, 197, 35382, 62726, 1330, 25, 3056, 917, 4913, 1254, 1110, 7975, 905, 7115, 197, 3518, 10202, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCircuitBreaker_Close_Open_HalfOpen_Open_HalfOpen_Close(t *testing.T) { retryTimeout := 5 * time.Millisecond waitRetryTimeout := 7 * time.Millisecond set := Setting{FailureThreshold: uint(1), RetryTimeout: retryTimeout, RetrySuccessThreshold: 2, MaxRetryExecutionThreshold: 2} cb, err := New("test", set) assert.NoError(t, err) _, err = cb.Execute(testSuccessAction) assert.NoError(t, err) assert.Equal(t, uint(0), cb.failures) assert.Equal(t, uint(0), cb.executions) assert.Equal(t, uint(0), cb.retries) assert.True(t, cb.isClose()) assert.Equal(t, tsFuture, cb.nextRetry) // will transition to open _, err = cb.Execute(testFailureAction) assert.EqualError(t, err, "Test error") assert.Equal(t, uint(0), cb.failures) assert.Equal(t, uint(0), cb.executions) assert.Equal(t, uint(0), cb.retries) assert.True(t, cb.isOpen()) assert.True(t, cb.nextRetry < tsFuture) // open, returns err immediately _, err = cb.Execute(testSuccessAction) assert.EqualError(t, err, "circuit is open") assert.Equal(t, uint(0), cb.failures) assert.Equal(t, uint(0), cb.executions) assert.Equal(t, uint(0), cb.retries) assert.True(t, cb.isOpen()) assert.True(t, cb.nextRetry < tsFuture) // should be half open now and will stay in there time.Sleep(waitRetryTimeout) _, err = cb.Execute(testFailureAction) assert.EqualError(t, err, "Test error") assert.Equal(t, uint(1), cb.failures) assert.Equal(t, uint(1), cb.executions) assert.Equal(t, uint(0), cb.retries) assert.True(t, cb.isHalfOpen()) assert.True(t, cb.nextRetry < tsFuture) // should be half open now and will transition to open _, err = cb.Execute(testFailureAction) assert.EqualError(t, err, "Test error") assert.Equal(t, uint(0), cb.failures) assert.Equal(t, uint(0), cb.executions) assert.Equal(t, uint(0), cb.retries) assert.True(t, cb.isOpen()) assert.True(t, cb.nextRetry < tsFuture) // should be half open now and will transition to close time.Sleep(waitRetryTimeout) _, err = cb.Execute(testSuccessAction) assert.NoError(t, err) assert.Equal(t, uint(0), cb.failures) assert.Equal(t, uint(1), cb.executions) assert.Equal(t, uint(1), cb.retries) assert.True(t, cb.isHalfOpen()) assert.True(t, cb.nextRetry < tsFuture) _, err = cb.Execute(testSuccessAction) assert.NoError(t, err) assert.Equal(t, uint(0), cb.failures) assert.Equal(t, uint(0), cb.executions) assert.Equal(t, uint(0), cb.retries) assert.True(t, cb.isClose()) assert.Equal(t, tsFuture, cb.nextRetry) }
explode_data.jsonl/24254
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1034 }
[ 2830, 3393, 34, 37268, 22524, 261, 68185, 51747, 2039, 3104, 5002, 51747, 2039, 3104, 5002, 68185, 1155, 353, 8840, 836, 8, 341, 17200, 1539, 7636, 1669, 220, 20, 353, 882, 71482, 198, 48750, 51560, 7636, 1669, 220, 22, 353, 882, 71482,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestItConvertsTheURLSuccessfully(t *testing.T) { expectedResults := map[string]string{ "https://continuous-pipe.firebaseio.com/raws/1234": "/raws/1234", "https://continuous-pipe.firebaseio.com/raws/1234.json": "/raws/1234", "/raws/1234.json": "/raws/1234", "https://continuous-pipe.firebaseio.com/raws/1234/.json": "/raws/1234", "https://continuous-pipe.firebaseio.com/raws/1234/.json?foo=bar": "/raws/1234", } for input, expected := range expectedResults { if expected != FirebasePathFromUrl(input) { t.Errorf("Expected '%s' but got '%s' for '%s'", expected, FirebasePathFromUrl(input), input) } } }
explode_data.jsonl/65362
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 305 }
[ 2830, 3393, 2132, 12012, 82, 785, 3144, 35959, 1155, 353, 8840, 836, 8, 341, 262, 3601, 9801, 1669, 2415, 14032, 30953, 515, 286, 330, 2428, 1110, 78589, 2268, 3444, 80522, 905, 75909, 82, 14, 16, 17, 18, 19, 788, 3521, 1041, 82, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestUpdateSubscriptionNoContent(t *testing.T) { ts := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { if strings.HasSuffix(r.URL.Path, "/v2") { apiResourcesHandler(w, r) } else { w.WriteHeader(http.StatusNoContent) } })) defer ts.Close() cli, err := client.NewNgsiV2Client(client.SetUrl(ts.URL)) if err != nil { t.Fatalf("Unexpected error: '%v'", err) } et := time.Now() if err := cli.UpdateSubscription("abcde12345", &model.Subscription{Expires: &model.OrionTime{et}}); err != nil { t.Fatalf("Unexpected error: '%v'", err) } }
explode_data.jsonl/64669
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 263 }
[ 2830, 3393, 4289, 33402, 2753, 2762, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 1006, 197, 28080, 89164, 1006, 298, 29244, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 571, 743, 9069, 16152, 40177, 2601...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestForExplosions(t *testing.T) { for i := 0; i < 100; i++ { config := Config{ Width: 100, Height: 100, Rooms: 10, MinRoomDim: 5, MinRoomSpacing: 1, MaxAttempts: 10, } buffer := bytes.NewBuffer(nil) New(config).Draw(buffer) if buffer.Len() == 0 { t.Errorf("map expected to be written, but was found empty") } } }
explode_data.jsonl/26142
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 190 }
[ 2830, 3393, 2461, 8033, 2301, 908, 1155, 353, 8840, 836, 8, 341, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 15, 26, 600, 1027, 341, 197, 25873, 1669, 5532, 515, 298, 197, 3327, 25, 688, 220, 16, 15, 15, 345, 298, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestObjectFail(t *testing.T) { assertParseError(t, "non-terminated 1", "{foo: bar, baz: [], qux: corge") assertParseError(t, "non-terminated 2", "{foo: bar, baz: [], qux: ") assertParseError(t, "non-terminated 3", "{foo: bar, baz: [], qux ") assertParseError(t, "non-terminated 4", "{foo: bar, baz: [], ") assertParseError(t, "missing separator", "{foo: bar baz: []}") assertParseError(t, "missing start", "foo: bar, baz: [], qux: corge}") assertParseError(t, "double comma", "{a:1,,b:2}") assertParseError(t, "leading double comma", "{,,a:1}") assertParseError(t, "trailing double comma", "{a:1,,}") }
explode_data.jsonl/50455
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 1190, 19524, 1155, 353, 8840, 836, 8, 341, 6948, 14463, 1454, 1155, 11, 330, 6280, 12, 68659, 220, 16, 497, 13868, 7975, 25, 3619, 11, 50247, 25, 10071, 922, 87, 25, 1829, 709, 1138, 6948, 14463, 1454, 1155, 11, 330, 628...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLocalShardMapper(t *testing.T) { var metaClient MetaClient metaClient.ShardGroupsByTimeRangeFn = func(database, policy string, min, max time.Time) ([]meta.ShardGroupInfo, error) { if database != "db0" { t.Errorf("unexpected database: %s", database) } if policy != "rp0" { t.Errorf("unexpected retention policy: %s", policy) } return []meta.ShardGroupInfo{ {ID: 1, Shards: []meta.ShardInfo{ {ID: 1, Owners: []meta.ShardOwner{{NodeID: 0}}}, {ID: 2, Owners: []meta.ShardOwner{{NodeID: 0}}}, }}, {ID: 2, Shards: []meta.ShardInfo{ {ID: 3, Owners: []meta.ShardOwner{{NodeID: 0}}}, {ID: 4, Owners: []meta.ShardOwner{{NodeID: 0}}}, }}, }, nil } tsdbStore := &internal.TSDBStoreMock{} tsdbStore.ShardGroupFn = func(ids []uint64) tsdb.ShardGroup { if !reflect.DeepEqual(ids, []uint64{1, 2, 3, 4}) { t.Errorf("unexpected shard ids: %#v", ids) } var sh MockShard sh.CreateIteratorFn = func(ctx context.Context, measurement *influxql.Measurement, opt query.IteratorOptions) (query.Iterator, error) { if measurement.Name != "cpu" { t.Errorf("unexpected measurement: %s", measurement.Name) } return &FloatIterator{}, nil } return &sh } // Initialize the shard mapper. shardMapper := &coordinator.LocalShardMapper{ MetaClient: &metaClient, TSDBStore: tsdbStore, } // Normal measurement. measurement := &influxql.Measurement{ Database: "db0", RetentionPolicy: "rp0", Name: "cpu", } ic, err := shardMapper.MapShards([]influxql.Source{measurement}, influxql.TimeRange{}, query.SelectOptions{}) if err != nil { t.Fatalf("unexpected error: %s", err) } // This should be a LocalShardMapping. m, ok := ic.(*coordinator.LocalShardMapping) if !ok { t.Fatalf("unexpected mapping type: %T", ic) } else if len(m.ShardMap) != 1 { t.Fatalf("unexpected number of shard mappings: %d", len(m.ShardMap)) } if _, err := ic.CreateIterator(context.Background(), measurement, query.IteratorOptions{}); err != nil { t.Fatalf("unexpected error: %s", err) } // Subquery. subquery := &influxql.SubQuery{ Statement: &influxql.SelectStatement{ Sources: []influxql.Source{measurement}, }, } ic, err = shardMapper.MapShards([]influxql.Source{subquery}, influxql.TimeRange{}, query.SelectOptions{}) if err != nil { t.Fatalf("unexpected error: %s", err) } // This should be a LocalShardMapping. m, ok = ic.(*coordinator.LocalShardMapping) if !ok { t.Fatalf("unexpected mapping type: %T", ic) } else if len(m.ShardMap) != 1 { t.Fatalf("unexpected number of shard mappings: %d", len(m.ShardMap)) } if _, err := ic.CreateIterator(context.Background(), measurement, query.IteratorOptions{}); err != nil { t.Fatalf("unexpected error: %s", err) } }
explode_data.jsonl/39856
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1117 }
[ 2830, 3393, 7319, 2016, 567, 10989, 1155, 353, 8840, 836, 8, 341, 2405, 8823, 2959, 15819, 2959, 198, 84004, 2959, 10849, 567, 22173, 1359, 1462, 6046, 24911, 284, 2915, 41649, 11, 4842, 914, 11, 1308, 11, 1932, 882, 16299, 8, 34923, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRun(t *testing.T) { tests := []struct { name string value *big.Int gas uint64 code []byte config *chain.ForksInTime expected *runtime.ExecutionResult }{ { name: "should succeed because of no codes", value: big.NewInt(0), gas: 5000, code: []byte{}, expected: &runtime.ExecutionResult{ ReturnValue: nil, GasLeft: 5000, }, }, { name: "should succeed and return result", value: big.NewInt(0), gas: 5000, code: []byte{ PUSH1, 0x01, PUSH1, 0x02, ADD, PUSH1, 0x00, MSTORE8, PUSH1, 0x01, PUSH1, 0x00, RETURN, }, expected: &runtime.ExecutionResult{ ReturnValue: []uint8{0x03}, GasLeft: 4976, }, }, { name: "should fail and consume all gas by error", value: big.NewInt(0), gas: 5000, // ADD will be failed by stack underflow code: []byte{ADD}, expected: &runtime.ExecutionResult{ ReturnValue: nil, GasLeft: 0, Err: errStackUnderflow, }, }, { name: "should fail by REVERT and return remaining gas at that time", value: big.NewInt(0), gas: 5000, // Stack size and offset for return value first code: []byte{PUSH1, 0x00, PUSH1, 0x00, REVERT}, config: &chain.ForksInTime{ Byzantium: true, }, expected: &runtime.ExecutionResult{ ReturnValue: nil, // gas consumed for 2 push1 ops GasLeft: 4994, Err: errRevert, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { evm := NewEVM() contract := newMockContract(tt.value, tt.gas, tt.code) host := &mockHost{} config := tt.config if config == nil { config = &chain.ForksInTime{} } res := evm.Run(contract, host, config) assert.Equal(t, tt.expected, res) }) } }
explode_data.jsonl/51457
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 851 }
[ 2830, 3393, 6727, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 16309, 262, 353, 16154, 7371, 198, 197, 3174, 300, 414, 2622, 21, 19, 198, 197, 43343, 257, 3056, 3782, 198, 197, 25873, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestChannelArbitratorPersistence(t *testing.T) { // Start out with a log that will fail writing the set of resolutions. log := &mockArbitratorLog{ state: StateDefault, newStates: make(chan ArbitratorState, 5), failLog: true, } chanArbCtx, err := createTestChannelArbitrator(t, log) if err != nil { t.Fatalf("unable to create ChannelArbitrator: %v", err) } chanArb := chanArbCtx.chanArb if err := chanArb.Start(); err != nil { t.Fatalf("unable to start ChannelArbitrator: %v", err) } // It should start in StateDefault. chanArbCtx.AssertState(StateDefault) // Send a remote force close event. commitSpend := &chainntnfs.SpendDetail{ SpenderTxHash: &chainhash.Hash{}, } uniClose := &lnwallet.UnilateralCloseSummary{ SpendDetail: commitSpend, HtlcResolutions: &lnwallet.HtlcResolutions{}, } chanArb.cfg.ChainEvents.RemoteUnilateralClosure <- &RemoteUnilateralCloseInfo{ UnilateralCloseSummary: uniClose, } // Since writing the resolutions fail, the arbitrator should not // advance to the next state. time.Sleep(100 * time.Millisecond) if log.state != StateDefault { t.Fatalf("expected to stay in StateDefault") } // Restart the channel arb, this'll use the same long and prior // context. chanArbCtx, err = chanArbCtx.Restart(nil) if err != nil { t.Fatalf("unable to restart channel arb: %v", err) } chanArb = chanArbCtx.chanArb // Again, it should start up in the default state. chanArbCtx.AssertState(StateDefault) // Now we make the log succeed writing the resolutions, but fail when // attempting to close the channel. log.failLog = false chanArb.cfg.MarkChannelClosed = func(*channeldb.ChannelCloseSummary, ...channeldb.ChannelStatus) error { return fmt.Errorf("intentional close error") } // Send a new remote force close event. chanArb.cfg.ChainEvents.RemoteUnilateralClosure <- &RemoteUnilateralCloseInfo{ UnilateralCloseSummary: uniClose, } // Since closing the channel failed, the arbitrator should stay in the // default state. time.Sleep(100 * time.Millisecond) if log.state != StateDefault { t.Fatalf("expected to stay in StateDefault") } // Restart once again to simulate yet another restart. chanArbCtx, err = chanArbCtx.Restart(nil) if err != nil { t.Fatalf("unable to restart channel arb: %v", err) } chanArb = chanArbCtx.chanArb // Starts out in StateDefault. chanArbCtx.AssertState(StateDefault) // Now make fetching the resolutions fail. log.failFetch = fmt.Errorf("intentional fetch failure") chanArb.cfg.ChainEvents.RemoteUnilateralClosure <- &RemoteUnilateralCloseInfo{ UnilateralCloseSummary: uniClose, } // Since logging the resolutions and closing the channel now succeeds, // it should advance to StateContractClosed. chanArbCtx.AssertStateTransitions(StateContractClosed) // It should not advance further, however, as fetching resolutions // failed. time.Sleep(100 * time.Millisecond) if log.state != StateContractClosed { t.Fatalf("expected to stay in StateContractClosed") } chanArb.Stop() // Create a new arbitrator, and now make fetching resolutions succeed. log.failFetch = nil chanArbCtx, err = chanArbCtx.Restart(nil) if err != nil { t.Fatalf("unable to restart channel arb: %v", err) } defer chanArbCtx.CleanUp() // Finally it should advance to StateFullyResolved. chanArbCtx.AssertStateTransitions(StateFullyResolved) // It should also mark the channel as resolved. select { case <-chanArbCtx.resolvedChan: // Expected. case <-time.After(defaultTimeout): t.Fatalf("contract was not resolved") } }
explode_data.jsonl/3697
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1228 }
[ 2830, 3393, 9629, 6953, 4489, 81, 850, 71562, 1155, 353, 8840, 836, 8, 341, 197, 322, 5145, 700, 448, 264, 1487, 429, 686, 3690, 4378, 279, 738, 315, 42495, 624, 6725, 1669, 609, 16712, 6953, 4489, 81, 850, 2201, 515, 197, 24291, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSelectBindvarswithPrepare(t *testing.T) { executor, sbc1, sbc2, _ := createLegacyExecutorEnv() logChan := QueryLogger.Subscribe("Test") defer QueryLogger.Unsubscribe(logChan) sql := "select id from user where id = :id" _, err := executorPrepare(executor, sql, map[string]*querypb.BindVariable{ "id": sqltypes.Int64BindVariable(1), }) require.NoError(t, err) wantQueries := []*querypb.BoundQuery{{ Sql: "select id from user where 1 != 1", BindVariables: map[string]*querypb.BindVariable{"id": sqltypes.Int64BindVariable(1)}, }} if !reflect.DeepEqual(sbc1.Queries, wantQueries) { t.Errorf("sbc1.Queries: %+v, want %+v\n", sbc1.Queries, wantQueries) } if sbc2.Queries != nil { t.Errorf("sbc2.Queries: %+v, want nil\n", sbc2.Queries) } }
explode_data.jsonl/67434
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 3379, 9950, 947, 22177, 50590, 1155, 353, 8840, 836, 8, 341, 67328, 4831, 11, 7898, 66, 16, 11, 7898, 66, 17, 11, 716, 1669, 1855, 77415, 25255, 14359, 741, 6725, 46019, 1669, 11361, 7395, 82628, 445, 2271, 1138, 16867, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestIsComplex64(t *testing.T) { var v *Value v = &Value{data: complex64(1)} assert.True(t, v.IsComplex64()) v = &Value{data: []complex64{complex64(1)}} assert.True(t, v.IsComplex64Slice()) }
explode_data.jsonl/23522
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 3872, 31137, 21, 19, 1155, 353, 8840, 836, 8, 1476, 2405, 348, 353, 1130, 271, 5195, 284, 609, 1130, 90, 691, 25, 6351, 21, 19, 7, 16, 10569, 6948, 32443, 1155, 11, 348, 4506, 31137, 21, 19, 12367, 5195, 284, 609, 1130...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHomePageWithNoTitle(t *testing.T) { b := newTestSitesBuilder(t).WithConfigFile("toml", ` title = "Site Title" `) b.WithTemplatesAdded("index.html", "Title|{{ with .Title }}{{ . }}{{ end }}|") b.WithContent("_index.md", `--- description: "No title for you!" --- Content. `) b.Build(BuildCfg{}) b.AssertFileContent("public/index.html", "Title||") }
explode_data.jsonl/60635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 43311, 2354, 2753, 3851, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 501, 2271, 93690, 3297, 1155, 568, 2354, 2648, 1703, 445, 37401, 75, 497, 22074, 2102, 284, 330, 17597, 10869, 698, 24183, 2233, 26124, 51195, 19337, 445, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateDaisyInflater_File_NoExternalIP(t *testing.T) { source := fileSource{gcsPath: "gs://bucket/vmdk"} inflater := createDaisyInflaterSafe(t, ImageImportRequest{ Source: source, NoExternalIP: true, }, imagefile.Metadata{}) daisyutils.CheckEnvironment(inflater.worker, func(env daisyutils.EnvironmentSettings) { assert.True(t, env.NoExternalIP) }) }
explode_data.jsonl/75632
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 4021, 35, 49056, 12342, 34061, 36989, 25913, 3298, 1155, 353, 8840, 836, 8, 341, 47418, 1669, 1034, 3608, 90, 70, 4837, 1820, 25, 330, 5857, 1110, 30410, 5457, 2277, 74, 16707, 17430, 11729, 1669, 1855, 35, 49056, 12342, 256...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestShutdown(t *testing.T) { vdrs := validators.NewSet() err := vdrs.AddWeight(ids.GenerateTestNodeID(), 1) assert.NoError(t, err) benchlist := benchlist.NewNoBenchlist() tm, err := timeout.NewManager( &timer.AdaptiveTimeoutConfig{ InitialTimeout: time.Millisecond, MinimumTimeout: time.Millisecond, MaximumTimeout: 10 * time.Second, TimeoutCoefficient: 1.25, TimeoutHalflife: 5 * time.Minute, }, benchlist, "", prometheus.NewRegistry(), ) if err != nil { t.Fatal(err) } go tm.Dispatch() chainRouter := ChainRouter{} metrics := prometheus.NewRegistry() mc, err := message.NewCreator(metrics, true, "dummyNamespace", 10*time.Second) assert.NoError(t, err) err = chainRouter.Initialize(ids.EmptyNodeID, logging.NoLog{}, mc, tm, time.Second, ids.Set{}, nil, HealthConfig{}, "", prometheus.NewRegistry()) assert.NoError(t, err) shutdownCalled := make(chan struct{}, 1) ctx := snow.DefaultConsensusContextTest() resourceTracker, err := tracker.NewResourceTracker(prometheus.NewRegistry(), resource.NoUsage, meter.ContinuousFactory{}, time.Second) assert.NoError(t, err) handler, err := handler.New( mc, ctx, vdrs, nil, nil, time.Second, resourceTracker, ) assert.NoError(t, err) bootstrapper := &common.BootstrapperTest{ BootstrapableTest: common.BootstrapableTest{ T: t, }, EngineTest: common.EngineTest{ T: t, }, } bootstrapper.Default(true) bootstrapper.CantGossip = false bootstrapper.ContextF = func() *snow.ConsensusContext { return ctx } bootstrapper.ShutdownF = func() error { shutdownCalled <- struct{}{}; return nil } bootstrapper.ConnectedF = func(nodeID ids.NodeID, nodeVersion version.Application) error { return nil } bootstrapper.HaltF = func() {} handler.SetBootstrapper(bootstrapper) engine := &common.EngineTest{T: t} engine.Default(true) engine.CantGossip = false engine.ContextF = func() *snow.ConsensusContext { return ctx } engine.ShutdownF = func() error { shutdownCalled <- struct{}{}; return nil } engine.ConnectedF = func(nodeID ids.NodeID, nodeVersion version.Application) error { return nil } engine.HaltF = func() {} handler.SetConsensus(engine) ctx.SetState(snow.NormalOp) // assumed bootstrap is done chainRouter.AddChain(handler) bootstrapper.StartF = func(startReqID uint32) error { return nil } handler.Start(false) chainRouter.Shutdown() ticker := time.NewTicker(250 * time.Millisecond) select { case <-ticker.C: t.Fatalf("Handler shutdown was not called or timed out after 250ms during chainRouter shutdown") case <-shutdownCalled: } select { case <-handler.Stopped(): default: t.Fatal("handler shutdown but never closed its closing channel") } }
explode_data.jsonl/76076
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 990 }
[ 2830, 3393, 62004, 1155, 353, 8840, 836, 8, 341, 5195, 93246, 1669, 38588, 7121, 1649, 741, 9859, 1669, 348, 93246, 1904, 8295, 43448, 57582, 2271, 1955, 915, 1507, 220, 16, 340, 6948, 35699, 1155, 11, 1848, 340, 2233, 19762, 1607, 1669...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidateIntFromString(t *testing.T) { input := "404" _, errMsg := validateIntFromString(input) if errMsg != "" { t.Errorf("validateIntFromString() returned errors %v for valid input %v", errMsg, input) } }
explode_data.jsonl/65876
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 17926, 1072, 44491, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 330, 19, 15, 19, 698, 197, 6878, 60078, 1669, 9593, 1072, 44491, 5384, 692, 743, 60078, 961, 1591, 341, 197, 3244, 13080, 445, 7067, 1072, 44491, 368, 5927, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestFilesetStructuralValidatorWrongType(t *testing.T) { collection := testResource("bs646cd8717.json") validator := NewFilesetStructuralValidator(newMockRepository(collection)) err := validator.ValidateResource(testFilesetResource(collection.ID())) assert.NotNil(t, err) }
explode_data.jsonl/16716
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 1703, 746, 9422, 4176, 14256, 29185, 929, 1155, 353, 8840, 836, 8, 341, 1444, 1908, 1669, 1273, 4783, 445, 1279, 21, 19, 21, 4385, 23, 22, 16, 22, 4323, 1138, 197, 16112, 1669, 1532, 1703, 746, 9422, 4176, 14256, 1755, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParse_FailedPaymentNotification(t *testing.T) { result := MustParseFile("testdata/failed_payment_notification.xml") if n, ok := result.(*webhooks.PaymentNotification); !ok { t.Fatalf("unexpected type: %T, result", n) } else if diff := cmp.Diff(n, &webhooks.PaymentNotification{ Type: webhooks.FailedPayment, Account: webhooks.Account{ XMLName: xml.Name{Local: "account"}, Code: "1", Username: "verena", Email: "verena@example.com", FirstName: "Verena", LastName: "Example", CompanyName: "Company, Inc.", }, Transaction: webhooks.Transaction{ XMLName: xml.Name{Local: "transaction"}, UUID: "a5143c1d3a6f4a8287d0e2cc1d4c0427", InvoiceNumber: 2059, SubscriptionUUID: "1974a098jhlkjasdfljkha898326881c", Action: "purchase", PaymentMethod: "credit_card", AmountInCents: 1000, Status: "Declined", Message: "This transaction has been declined", FailureType: "Declined by the gateway", Reference: "reference", Source: "subscription", Test: recurly.NewBool(true), Voidable: recurly.NewBool(false), Refundable: recurly.NewBool(false), }, }); diff != "" { t.Fatal(diff) } }
explode_data.jsonl/76115
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 625 }
[ 2830, 3393, 14463, 1400, 5687, 20188, 11196, 1155, 353, 8840, 836, 8, 341, 9559, 1669, 15465, 14463, 1703, 445, 92425, 14, 16091, 26696, 34296, 9028, 1138, 743, 308, 11, 5394, 1669, 1102, 41399, 2911, 38560, 70123, 11196, 1215, 753, 562, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetZeroValueUnix(t *testing.T) { expect := int64(-62135596800) actual := GetZeroValueUnix() assert.Equal(t, actual, expect) }
explode_data.jsonl/67157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 52 }
[ 2830, 3393, 1949, 17999, 1130, 55832, 1155, 353, 8840, 836, 8, 341, 24952, 1669, 526, 21, 19, 4080, 21, 17, 16, 18, 20, 20, 24, 21, 23, 15, 15, 340, 88814, 1669, 2126, 17999, 1130, 55832, 741, 6948, 12808, 1155, 11, 5042, 11, 1720...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestGenerateName(t *testing.T) { t.Run("Invalid params", func(t *testing.T) { _, _, _, err := generateName(nil, nil) assert.Error(t, err) }) t.Run("wfID full", func(t *testing.T) { name, generateName, _, err := generateName(&core.Identifier{ Name: "myworkflow", Project: "myproject", Domain: "development", }, nil) assert.NoError(t, err) assert.Empty(t, name) assert.Equal(t, "myproject-development-myworkflow-", generateName) }) t.Run("wfID missing project domain", func(t *testing.T) { name, generateName, _, err := generateName(&core.Identifier{ Name: "myworkflow", }, nil) assert.NoError(t, err) assert.Empty(t, name) assert.Equal(t, "myworkflow-", generateName) }) t.Run("wfID too long", func(t *testing.T) { name, generateName, _, err := generateName(&core.Identifier{ Name: "workflowsomethingsomethingsomething", Project: "myproject", Domain: "development", }, nil) assert.NoError(t, err) assert.Empty(t, name) assert.Equal(t, "myproject-development-workflowso-", generateName) }) t.Run("execID full", func(t *testing.T) { name, generateName, _, err := generateName(nil, &core.WorkflowExecutionIdentifier{ Name: "myexecution", Project: "myproject", Domain: "development", }) assert.NoError(t, err) assert.Empty(t, generateName) assert.Equal(t, "myexecution", name) }) t.Run("execID missing project domain", func(t *testing.T) { name, generateName, _, err := generateName(nil, &core.WorkflowExecutionIdentifier{ Name: "myexecution", }) assert.NoError(t, err) assert.Empty(t, generateName) assert.Equal(t, "myexecution", name) }) }
explode_data.jsonl/26897
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 671 }
[ 2830, 3393, 31115, 675, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 7928, 3628, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 6878, 8358, 8358, 1848, 1669, 6923, 675, 27907, 11, 2092, 340, 197, 6948, 6141, 1155, 11, 1848, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSkipWithGrant(t *testing.T) { store, clean := realtikvtest.CreateMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) save2 := privileges.SkipWithGrant privileges.SkipWithGrant = false require.False(t, tk.Session().Auth(&auth.UserIdentity{Username: "user_not_exist"}, []byte("yyy"), []byte("zzz"))) privileges.SkipWithGrant = true require.True(t, tk.Session().Auth(&auth.UserIdentity{Username: "xxx", Hostname: `%`}, []byte("yyy"), []byte("zzz"))) require.True(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: `%`}, []byte(""), []byte(""))) tk.MustExec("use test") tk.MustExec("create table t (id int)") tk.MustExec("create role r_1") tk.MustExec("grant r_1 to root") tk.MustExec("set role all") tk.MustExec("show grants for root") privileges.SkipWithGrant = save2 }
explode_data.jsonl/5734
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 35134, 2354, 67971, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1931, 83, 1579, 85, 1944, 7251, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 741, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsRouteMatch(t *testing.T) { namespaces := map[string]*corev1.Namespace{ "select": {ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"selected": "true"}, }}, "not-select": {ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"selected": "false"}, }}, } cases := []struct { name string cfg config.Config gateway config.Meta routes k8s.RouteBindingSelector expected bool }{ { name: "defaults, same namespace", cfg: config.Config{ Meta: config.Meta{Namespace: "default", GroupVersionKind: gvk.HTTPRoute}, }, gateway: config.Meta{Name: "gateway", Namespace: "default"}, routes: k8s.RouteBindingSelector{ Kind: gvk.HTTPRoute.Kind, Group: StrPointer(gvk.HTTPRoute.Group), }, // Default for both selectors will match everything in the same namespace expected: true, }, { name: "defaults, different namespace", cfg: config.Config{ Meta: config.Meta{Namespace: "default", GroupVersionKind: gvk.HTTPRoute}, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Kind: gvk.HTTPRoute.Kind, Group: StrPointer(gvk.HTTPRoute.Group), }, // Default for both selectors will match everything in the same namespace expected: false, }, { name: "route all, gateway all", cfg: config.Config{ Meta: config.Meta{Namespace: "default", GroupVersionKind: gvk.HTTPRoute}, Spec: &k8s.HTTPRouteSpec{ Gateways: &k8s.RouteGateways{Allow: &gatewayAll}, }, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Namespaces: &k8s.RouteNamespaces{From: &routeAll}, Group: StrPointer(gvk.HTTPRoute.Group), Kind: gvk.HTTPRoute.Kind, }, // Both allow cross namespace, this is allowed expected: true, }, { name: "route all, gateway same", cfg: config.Config{ Meta: config.Meta{Namespace: "default", GroupVersionKind: gvk.HTTPRoute}, Spec: &k8s.HTTPRouteSpec{ Gateways: &k8s.RouteGateways{Allow: &gatewayAll}, }, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Group: StrPointer(gvk.HTTPRoute.Group), Kind: gvk.HTTPRoute.Kind, }, // Gateway isn't looking in other namespaces expected: false, }, { name: "route same, gateway all", cfg: config.Config{ Meta: config.Meta{Namespace: "default", GroupVersionKind: gvk.HTTPRoute}, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Namespaces: &k8s.RouteNamespaces{From: &routeAll}, Group: StrPointer(gvk.HTTPRoute.Group), Kind: gvk.HTTPRoute.Kind, }, // Route doesn't allow cross namespace expected: false, }, { name: "route references match", cfg: config.Config{ Meta: config.Meta{Namespace: "default", GroupVersionKind: gvk.HTTPRoute}, Spec: &k8s.HTTPRouteSpec{ Gateways: &k8s.RouteGateways{Allow: &gatewayAll, GatewayRefs: []k8s.GatewayReference{ {Name: "gateway", Namespace: "not-default"}, }}, }, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Namespaces: &k8s.RouteNamespaces{From: &routeAll}, Group: StrPointer(gvk.HTTPRoute.Group), Kind: gvk.HTTPRoute.Kind, }, // direct reference matches expected: true, }, { name: "route references no match", cfg: config.Config{ Meta: config.Meta{Namespace: "default", GroupVersionKind: gvk.HTTPRoute}, Spec: &k8s.HTTPRouteSpec{ Gateways: &k8s.RouteGateways{ Allow: func() *k8s.GatewayAllowType { x := k8s.GatewayAllowFromList return &x }(), GatewayRefs: []k8s.GatewayReference{ {Name: "not-gateway", Namespace: "not-default"}, }, }, }, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Namespaces: &k8s.RouteNamespaces{From: &routeAll}, Group: StrPointer(gvk.HTTPRoute.Group), Kind: gvk.HTTPRoute.Kind, }, // direct reference does not match expected: false, }, { name: "gateway selector matches", cfg: config.Config{ Meta: config.Meta{Namespace: "select", GroupVersionKind: gvk.HTTPRoute}, Spec: &k8s.HTTPRouteSpec{ Gateways: &k8s.RouteGateways{Allow: &routeAllow}, }, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Namespaces: &k8s.RouteNamespaces{ From: func() *k8s.RouteSelectType { x := k8s.RouteSelectSelector return &x }(), Selector: &metav1.LabelSelector{MatchLabels: map[string]string{ "selected": "true", }}, }, Group: StrPointer(gvk.HTTPRoute.Group), Kind: gvk.HTTPRoute.Kind, }, // selector matches namespace label expected: true, }, { name: "gateway selector no match", cfg: config.Config{ Meta: config.Meta{Namespace: "not-select", GroupVersionKind: gvk.HTTPRoute}, Spec: &k8s.HTTPRouteSpec{ Gateways: &k8s.RouteGateways{Allow: &gatewayAll}, }, }, gateway: config.Meta{Name: "gateway", Namespace: "not-default"}, routes: k8s.RouteBindingSelector{ Namespaces: &k8s.RouteNamespaces{ From: func() *k8s.RouteSelectType { x := k8s.RouteSelectSelector return &x }(), Selector: &metav1.LabelSelector{MatchLabels: map[string]string{ "selected": "true", }}, }, Group: StrPointer(gvk.HTTPRoute.Group), Kind: gvk.HTTPRoute.Kind, }, // selector does not match namespace expected: false, }, } for _, tt := range cases { t.Run(tt.name, func(t *testing.T) { got := isRouteMatch(tt.cfg, tt.gateway, tt.routes, namespaces) if got != tt.expected { t.Fatalf("expected match=%v, got match=%v", tt.expected, got) } }) } }
explode_data.jsonl/73942
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2701 }
[ 2830, 3393, 3872, 4899, 8331, 1155, 353, 8840, 836, 8, 341, 93940, 27338, 1669, 2415, 14032, 8465, 98645, 16, 46011, 515, 197, 197, 1, 1742, 788, 314, 1190, 12175, 25, 77520, 16, 80222, 515, 298, 197, 23674, 25, 2415, 14032, 30953, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGenPrivKeySecp256k1(t *testing.T) { // curve oder N N := underlyingSecp256k1.S256().N tests := []struct { name string secret []byte }{ {"empty secret", []byte{}}, { "some long secret", []byte("We live in a society exquisitely dependent on science and technology, " + "in which hardly anyone knows anything about science and technology."), }, {"another seed used in cosmos tests #1", []byte{0}}, {"another seed used in cosmos tests #2", []byte("mySecret")}, {"another seed used in cosmos tests #3", []byte("")}, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { gotPrivKey := secp256k1.GenPrivKeySecp256k1(tt.secret) require.NotNil(t, gotPrivKey) // interpret as a big.Int and make sure it is a valid field element: fe := new(big.Int).SetBytes(gotPrivKey[:]) require.True(t, fe.Cmp(N) < 0) require.True(t, fe.Sign() > 0) }) } }
explode_data.jsonl/49295
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 9967, 32124, 1592, 8430, 79, 17, 20, 21, 74, 16, 1155, 353, 8840, 836, 8, 341, 197, 322, 15655, 12385, 451, 198, 18317, 1669, 16533, 8430, 79, 17, 20, 21, 74, 16, 808, 17, 20, 21, 1005, 45, 198, 78216, 1669, 3056, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExtrinsicPayload(t *testing.T) { var era ExtrinsicEra err := DecodeFromHexString("0x0703", &era) assert.NoError(t, err) p := ExtrinsicPayloadV1{ Method: MustHexDecodeString( "0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c"), Era: era, Nonce: NewUCompactFromUInt(4660), TransactionPayment: types.TransactionPayment{ Tip: NewUCompactFromUInt(22136), FeeExchange: types.OptionFeeExchange{HasValue: false}, }, SpecVersion: 123, GenesisHash: NewHash(MustHexDecodeString("0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b")), BlockHash: NewHash(MustHexDecodeString("0xde8f69eeb5e065e18c6950ff708d7e551f68dc9bf59a07c52367c0280f805ec7")), } assert.Equal(t, examplaryExtrinsicPayload, p) enc, err := EncodeToHexString(examplaryExtrinsicPayload) assert.NoError(t, err) assert.Equal(t, "0x"+ "0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c"+ // Method "0703"+ // Era "d148"+ // Nonce "e2590100"+ // Tip (Transaction Payment) "00"+ // Optional Fee Exchange (Transaction Payment) "7b000000"+ // Spec version "00000000"+ // Tx version "dcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b"+ // Genesis Hash "de8f69eeb5e065e18c6950ff708d7e551f68dc9bf59a07c52367c0280f805ec7", // BlockHash enc) // b := bytes.NewBuffer(MustHexDecodeString()) var dec ExtrinsicPayloadV1 err = DecodeFromHexString(enc, &dec) assert.Error(t, err) }
explode_data.jsonl/65317
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 708 }
[ 2830, 3393, 840, 45002, 29683, 1155, 353, 8840, 836, 8, 341, 2405, 11385, 1374, 45002, 36, 956, 198, 9859, 1669, 50194, 3830, 49137, 445, 15, 87, 15, 22, 15, 18, 497, 609, 2416, 340, 6948, 35699, 1155, 11, 1848, 692, 3223, 1669, 137...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdateCity(t *testing.T) { ctx := context.Background() board := createTestBoard(ctx) city := createTestCity(ctx, board.ID) url := fmt.Sprintf("/boards/%d/cities/%d", board.ID, city.ID) newName := "New City Name" newX := 123 newY := 432 form := app.CityForm{ Name: newName, Position: app.Position{ X: newX, Y: newY, }, } body, err := json.Marshal(&form) if err != nil { panic(err) } req := httptest.NewRequest("PUT", url, bytes.NewReader(body)) req.Header.Set("Content-Type", "application/json; charset=utf-8") req.Header.Set("X-Requested-With", "XMLHttpRequest") req.Header.Set("Accept", "application/json") w := httptest.NewRecorder() router.ServeHTTP(w, req) if !httpassert.Success(t, w) { t.Log("Body:", w.Body) } httpassert.JsonContentType(t, w) var updatedCity app.City if err = json.NewDecoder(w.Body).Decode(&updatedCity); err != nil { panic(err) } if updatedCity.Name != newName { t.Error("City Name was not updated") } if updatedCity.Position.X != newX { t.Error("City Position X was not updated") } if updatedCity.Position.Y != newY { t.Error("City Position Y was not updated") } }
explode_data.jsonl/12549
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 460 }
[ 2830, 3393, 4289, 12730, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 59868, 1669, 1855, 2271, 11932, 7502, 340, 1444, 487, 1669, 1855, 2271, 12730, 7502, 11, 4479, 9910, 340, 19320, 1669, 8879, 17305, 4283, 19270, 12627, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestLinearGrowth__String(t *testing.T) { g := &tester.LinearGrowth{Increase: 3} assert.Equal(t, g.String(), "+3") g = &tester.LinearGrowth{Increase: 42} assert.Equal(t, g.String(), "+42") g = &tester.LinearGrowth{Increase: 100} assert.Equal(t, g.String(), "+100") }
explode_data.jsonl/66512
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 31898, 38, 19089, 563, 703, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 609, 73358, 33116, 38, 19089, 90, 69556, 25, 220, 18, 532, 6948, 12808, 1155, 11, 342, 6431, 1507, 6630, 18, 5130, 3174, 284, 609, 73358, 33116, 38, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMap(t *testing.T) { state := lua.NewState() defer state.Close() std.Open(state) err := state.ExecFrom(bytes.NewReader([]byte(` person = { name = "Michel", age = "31", -- weakly input pi = 3.14, x = 100, w = "San Jose", role = { { name = "Administrator" }, { name = "Operator" } } } `))) if err != nil { t.Error(err) } var person testPerson state.GetGlobal("person") v := state.Pop() if err := Map(v, &person); err != nil { t.Error(err) } errorIfNotEqual(t, "Michel", person.Name) errorIfNotEqual(t, 31, person.Age) errorIfNotEqual(t, 3.14, person.Pi) errorIfNotEqual(t, 100, person.X) errorIfNotEqual(t, "San Jose", person.WorkPlace) errorIfNotEqual(t, 2, len(person.Role)) errorIfNotEqual(t, "Administrator", person.Role[0].Name) errorIfNotEqual(t, "Operator", person.Role[1].Name) }
explode_data.jsonl/79576
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 473 }
[ 2830, 3393, 2227, 1155, 353, 8840, 836, 8, 341, 24291, 1669, 20357, 7121, 1397, 741, 16867, 1584, 10421, 741, 6736, 12953, 8390, 692, 9859, 1669, 1584, 30798, 3830, 23158, 68587, 10556, 3782, 61528, 197, 98805, 284, 341, 51370, 11609, 284...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestFieldPath(t *testing.T) { pod := &api.Pod{Spec: api.PodSpec{Containers: []api.Container{ {Name: "foo"}, {Name: "bar"}, {Name: ""}, {Name: "baz"}, }}} table := map[string]struct { pod *api.Pod container *api.Container path string success bool }{ "basic": {pod, &api.Container{Name: "foo"}, "spec.containers{foo}", true}, "basic2": {pod, &api.Container{Name: "baz"}, "spec.containers{baz}", true}, "emptyName": {pod, &api.Container{Name: ""}, "spec.containers[2]", true}, "basicSamePointer": {pod, &pod.Spec.Containers[0], "spec.containers{foo}", true}, "missing": {pod, &api.Container{Name: "qux"}, "", false}, } for name, item := range table { res, err := fieldPath(item.pod, item.container) if item.success == false { if err == nil { t.Errorf("%v: unexpected non-error", name) } continue } if err != nil { t.Errorf("%v: unexpected error: %v", name, err) continue } if e, a := item.path, res; e != a { t.Errorf("%v: wanted %v, got %v", name, e, a) } } }
explode_data.jsonl/78110
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 490 }
[ 2830, 3393, 1877, 1820, 1155, 353, 8840, 836, 8, 341, 3223, 347, 1669, 609, 2068, 88823, 90, 8327, 25, 6330, 88823, 8327, 90, 74632, 25, 3056, 2068, 33672, 515, 197, 197, 63121, 25, 330, 7975, 7115, 197, 197, 63121, 25, 330, 2257, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestIsZero(t *testing.T) { testCases := map[string]struct { a api.ResourceList expected bool }{ "empty": { a: api.ResourceList{}, expected: true, }, "zero": { a: api.ResourceList{ api.ResourceCPU: resource.MustParse("0"), api.ResourceMemory: resource.MustParse("0"), }, expected: true, }, "non-zero": { a: api.ResourceList{ api.ResourceCPU: resource.MustParse("200m"), api.ResourceMemory: resource.MustParse("1Gi"), }, expected: false, }, } for testName, testCase := range testCases { if result := IsZero(testCase.a); result != testCase.expected { t.Errorf("%s expected: %v, actual: %v", testName, testCase.expected, result) } } }
explode_data.jsonl/59929
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 3872, 17999, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 11323, 286, 6330, 20766, 852, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 1, 3194, 788, 341, 298, 11323, 25, 286, 6330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestProcess_OnAnalyzeProjectUsecase_WhenFailingToRetrieveProject_ShouldReturnError(t *testing.T) { projectRepositoryMock := projectRepositoryMock{ project: entity.Project{}, getErr: repository.ErrProjectUnexpected, } uc := usecase.NewAnalyzeProjectUsecase(projectRepositoryMock, nil, nil, nil, &entity.AnalysisConfig{}) projectID, _ := uuid.NewUUID() results, err := uc.Process(context.TODO(), projectID) assert.EqualError(t, err, usecase.ErrUnexpected.Error()) assert.Empty(t, results) }
explode_data.jsonl/64102
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 7423, 35482, 2082, 55856, 7849, 52, 5024, 519, 62, 4498, 37, 14277, 1249, 87665, 7849, 36578, 616, 5598, 1454, 1155, 353, 8840, 836, 8, 341, 72470, 4624, 11571, 1669, 2390, 4624, 11571, 515, 197, 72470, 25, 5387, 30944, 3883...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestKeyValueSetReturnsEmptyMap(t *testing.T) { input := "" expected := map[string]string{} var s KeyValueString = nil err := s.Set(input) assert.Nil(t, err) assert.Equal(t, expected, map[string]string(s)) }
explode_data.jsonl/64726
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 72082, 1649, 16446, 3522, 2227, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 8389, 42400, 1669, 2415, 14032, 30953, 16094, 2405, 274, 98620, 703, 284, 2092, 198, 9859, 1669, 274, 4202, 5384, 340, 6948, 59678, 1155, 11, 1848, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestState_UpdatePrivmsg(t *testing.T) { t.Parallel() st := setupNewState() ev := &irc.Event{ Name: irc.PRIVMSG, Sender: users[0], Args: []string{channels[0]}, NetworkInfo: testNetInfo, } st.addChannel(channels[0]) if got, ok := st.User(users[0]); ok { t.Errorf("Expected: %v to be nil.", got) } if got, ok := st.UserModes(users[0], channels[0]); ok { t.Errorf("Expected: %v to be nil.", got) } st.Update(ev) if _, ok := st.User(users[0]); !ok { t.Error("Unexpected nil.") } if _, ok := st.UserModes(users[0], channels[0]); !ok { t.Error("Unexpected nil.") } ev.Sender = network size := len(st.users) st.Update(ev) if got, exp := len(st.users), size; exp != got { t.Errorf("Expected: %v, got: %v", exp, got) } }
explode_data.jsonl/32106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 355 }
[ 2830, 3393, 1397, 47393, 32124, 3236, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18388, 1669, 6505, 3564, 1397, 741, 74837, 1669, 609, 2437, 6904, 515, 197, 21297, 25, 286, 79923, 65453, 3090, 19575, 345, 197, 7568, 1659, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestDataV1Redirection(t *testing.T) { f := newFixture(t) // Testing redirect at the root level if err := f.v1(http.MethodPut, "/data/", `{"foo": [1,2,3]}`, 301, ""); err != nil { t.Fatalf("Unexpected error from PUT: %v", err) } locHdr := f.recorder.Header().Get("Location") if strings.Compare(locHdr, "/v1/data") != 0 { t.Fatalf("Unexpected error Location header value: %v", locHdr) } RedirectedPath := strings.SplitAfter(locHdr, "/v1")[1] if err := f.v1(http.MethodPut, RedirectedPath, `{"foo": [1,2,3]}`, 204, ""); err != nil { t.Fatalf("Unexpected error from PUT: %v", err) } if err := f.v1(http.MethodGet, RedirectedPath, "", 200, `{"result": {"foo": [1,2,3]}}`); err != nil { t.Fatalf("Unexpected error from GET: %v", err) } // Now we test redirection a few levels down if err := f.v1(http.MethodPut, "/data/a/b/c/", `{"foo": [1,2,3]}`, 301, ""); err != nil { t.Fatalf("Unexpected error from PUT: %v", err) } locHdrLv := f.recorder.Header().Get("Location") if strings.Compare(locHdrLv, "/v1/data/a/b/c") != 0 { t.Fatalf("Unexpected error Location header value: %v", locHdrLv) } RedirectedPathLvl := strings.SplitAfter(locHdrLv, "/v1")[1] if err := f.v1(http.MethodPut, RedirectedPathLvl, `{"foo": [1,2,3]}`, 204, ""); err != nil { t.Fatalf("Unexpected error from PUT: %v", err) } if err := f.v1(http.MethodGet, RedirectedPathLvl, "", 200, `{"result": {"foo": [1,2,3]}}`); err != nil { t.Fatalf("Unexpected error from GET: %v", err) } }
explode_data.jsonl/78987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 624 }
[ 2830, 93200, 53, 16, 6033, 2866, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 197, 322, 26768, 6423, 518, 279, 3704, 2188, 198, 743, 1848, 1669, 282, 3133, 16, 19886, 20798, 19103, 11, 3521, 691, 28105, 1565, 4913,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func Test_orderKeyLeft(t *testing.T) { testcases := []struct { orderKey int want int }{ {orderKey: 0, want: 13}, // why 13? because of views["activity"].Ncols == 13 {orderKey: 5, want: 4}, } wg := sync.WaitGroup{} for i, tc := range testcases { t.Run(fmt.Sprintln(i), func(t *testing.T) { config := newConfig() config.view = config.views["activity"] config.view.OrderKey = tc.orderKey wg.Add(1) go func() { v := <-config.viewCh assert.Equal(t, tc.want, v.OrderKey) close(config.viewCh) wg.Done() }() fn := orderKeyLeft(config) assert.NoError(t, fn(nil, nil)) }) wg.Wait() } }
explode_data.jsonl/69222
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 295 }
[ 2830, 3393, 7869, 1592, 5415, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 42245, 1592, 526, 198, 197, 50780, 257, 526, 198, 197, 59403, 197, 197, 90, 1358, 1592, 25, 220, 15, 11, 1366, 25, 220, 16, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSchemaParser_SingleValueEnum(t *testing.T) { body := `enum Hello { WORLD }` astDoc := parse(t, body) expected := &ast.Document{ Loc: testLoc(0, 20), Definitions: []ast.Node{ &ast.EnumDefinition{ Loc: testLoc(0, 20), Name: &ast.Name{ Value: "Hello", Loc: testLoc(5, 10), }, Values: []*ast.EnumValueDefinition{ { Name: &ast.Name{ Value: "WORLD", Loc: testLoc(13, 18), }, Loc: testLoc(13, 18), }, }, }, }, } if !reflect.DeepEqual(astDoc, expected) { t.Fatalf("unexpected document, expected: %v, got: %v", expected, astDoc) } }
explode_data.jsonl/51222
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 8632, 6570, 1098, 2173, 1130, 10766, 1155, 353, 8840, 836, 8, 341, 35402, 1669, 1565, 9018, 21927, 314, 50891, 335, 3989, 88836, 9550, 1669, 4715, 1155, 11, 2487, 340, 42400, 1669, 609, 559, 26256, 515, 197, 197, 9152, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFormat_NewReaderAt(t *testing.T) { t.Run("ReadError", func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() testErr := errors.New("test error") src := NewMockReaderSource(ctrl) src.EXPECT().Size().Return(int64(8)) src.EXPECT().ReadAt(gomock.Any(), gomock.Any()).Do(func(buf []byte, offset int64) { assert.EqualValues(t, 0, offset) assert.Len(t, buf, 8) return }).Return(0, testErr) reader, meta, err := format{}.NewReaderAt(src) assert.Nil(t, reader) assert.EqualValues(t, geodbtools.Metadata{}, meta) assert.EqualError(t, err, testErr.Error()) }) t.Run("MaxmindDBError", func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() src := NewMockReaderSource(ctrl) src.EXPECT().Size().Return(int64(8)) src.EXPECT().ReadAt(gomock.Any(), gomock.Any()).Do(func(buf []byte, offset int64) { assert.EqualValues(t, 0, offset) assert.Len(t, buf, 8) return }).Return(0, nil) reader, meta, err := format{}.NewReaderAt(src) assert.Nil(t, reader) assert.EqualValues(t, geodbtools.Metadata{}, meta) assert.EqualError(t, err, "error opening database: invalid MaxMind DB file") }) t.Run("TypeLookupError", func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() typeRegistryMu.Lock() origTypeRegistry := typeRegistry typeRegistry = make(map[DatabaseTypeID]Type) typeRegistryMu.Unlock() defer func() { typeRegistryMu.Lock() defer typeRegistryMu.Unlock() typeRegistry = origTypeRegistry }() _, testFilename, _, ok := runtime.Caller(0) require.True(t, ok) testPath := filepath.Join(filepath.Dir(testFilename), "test-data", "test-data", "MaxMind-DB-test-ipv4-24.mmdb") src, err := geodbtools.NewFileReaderSource(testPath) require.NoError(t, err) reader, meta, err := format{}.NewReaderAt(src) assert.Nil(t, reader) assert.EqualValues(t, geodbtools.Metadata{}, meta) assert.EqualError(t, err, ErrTypeNotFound.Error()) }) t.Run("NewReaderError", func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() testErr := errors.New("test error") dbType := NewMockType(ctrl) dbType.EXPECT().NewReader(gomock.Any()).Return(nil, testErr) typeRegistryMu.Lock() origTypeRegistry := typeRegistry typeRegistry = map[DatabaseTypeID]Type{ "Test": dbType, } typeRegistryMu.Unlock() defer func() { typeRegistryMu.Lock() defer typeRegistryMu.Unlock() typeRegistry = origTypeRegistry }() _, testFilename, _, ok := runtime.Caller(0) require.True(t, ok) testPath := filepath.Join(filepath.Dir(testFilename), "test-data", "test-data", "MaxMind-DB-test-ipv4-24.mmdb") src, err := geodbtools.NewFileReaderSource(testPath) require.NoError(t, err) reader, meta, err := format{}.NewReaderAt(src) assert.Nil(t, reader) assert.EqualValues(t, geodbtools.Metadata{}, meta) assert.EqualError(t, err, testErr.Error()) }) t.Run("OK", func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() expectedReader := NewMockReader(ctrl) dbType := NewMockType(ctrl) dbType.EXPECT().NewReader(gomock.Any()).Return(expectedReader, nil) dbType.EXPECT().DatabaseType().Return(geodbtools.DatabaseType("test")) typeRegistryMu.Lock() origTypeRegistry := typeRegistry typeRegistry = map[DatabaseTypeID]Type{ "Test": dbType, } typeRegistryMu.Unlock() defer func() { typeRegistryMu.Lock() defer typeRegistryMu.Unlock() typeRegistry = origTypeRegistry }() _, testFilename, _, ok := runtime.Caller(0) require.True(t, ok) testPath := filepath.Join(filepath.Dir(testFilename), "test-data", "test-data", "MaxMind-DB-test-ipv4-24.mmdb") src, err := geodbtools.NewFileReaderSource(testPath) require.NoError(t, err) mmdbReader, err := maxminddb.Open(testPath) require.NoError(t, err) defer mmdbReader.Close() reader, meta, err := format{}.NewReaderAt(src) assert.EqualValues(t, expectedReader, reader) assert.EqualValues(t, geodbtools.Metadata{ Type: "test", BuildTime: time.Unix(int64(mmdbReader.Metadata.BuildEpoch), 0), Description: mmdbReader.Metadata.Description["en"], MajorFormatVersion: 2, MinorFormatVersion: 0, IPVersion: geodbtools.IPVersion4, }, meta) assert.NoError(t, err) }) }
explode_data.jsonl/37589
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1789 }
[ 2830, 3393, 4061, 39582, 5062, 1655, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4418, 1454, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 197, 16867, 23743, 991, 18176, 2822, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandleError(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} ch1 := make(chan *cdcpb.ChangeDataEvent, 10) srv1 := newMockChangeDataService(t, ch1) server1, addr1 := newMockService(ctx, t, srv1, wg) ch2 := make(chan *cdcpb.ChangeDataEvent, 10) srv2 := newMockChangeDataService(t, ch2) server2, addr2 := newMockService(ctx, t, srv2, wg) defer func() { close(ch1) server1.Stop() close(ch2) server2.Stop() wg.Wait() }() rpcClient, cluster, pdClient, err := testutils.NewMockTiKV("", mockcopr.NewCoprRPCHandler()) require.Nil(t, err) pdClient = &mockPDClient{Client: pdClient, versionGen: defaultVersionGen} kvStorage, err := tikv.NewTestTiKVStore(rpcClient, pdClient, nil, nil, 0) require.Nil(t, err) defer kvStorage.Close() //nolint:errcheck region3 := uint64(3) region4 := uint64(4) region5 := uint64(5) cluster.AddStore(1, addr1) cluster.AddStore(2, addr2) cluster.Bootstrap(region3, []uint64{1, 2}, []uint64{4, 5}, 4) // split two regions with leader on different TiKV nodes to avoid region // worker exits because of empty maintained region cluster.SplitRaw(region3, region4, []byte("b"), []uint64{6, 7}, 6) cluster.SplitRaw(region4, region5, []byte("c"), []uint64{8, 9}, 9) baseAllocatedID := currentRequestID() lockResolver := txnutil.NewLockerResolver(kvStorage, model.DefaultChangeFeedID("changefeed-test"), util.RoleTester) isPullInit := &mockPullerInit{} grpcPool := NewGrpcPoolImpl(ctx, &security.Credential{}) defer grpcPool.Close() regionCache := tikv.NewRegionCache(pdClient) defer regionCache.Close() cdcClient := NewCDCClient( ctx, pdClient, grpcPool, regionCache, pdutil.NewClock4Test(), model.DefaultChangeFeedID(""), config.GetDefaultServerConfig().KVClient) eventCh := make(chan model.RegionFeedEvent, 50) wg.Add(1) go func() { defer wg.Done() err := cdcClient.EventFeed(ctx, regionspan.ComparableSpan{Start: []byte("a"), End: []byte("d")}, 100, lockResolver, isPullInit, eventCh) require.Equal(t, context.Canceled, errors.Cause(err)) }() // wait request id allocated with: new session, new request waitRequestID(t, baseAllocatedID+1) var event model.RegionFeedEvent notLeader := &cdcpb.ChangeDataEvent{Events: []*cdcpb.Event{ { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Error{ Error: &cdcpb.Error{ NotLeader: &errorpb.NotLeader{ RegionId: 3, Leader: &metapb.Peer{ StoreId: 2, }, }, }, }, }, }} ch1 <- notLeader cluster.ChangeLeader(3, 5) // wait request id allocated with: // new session, no leader request, epoch not match request waitRequestID(t, baseAllocatedID+2) epochNotMatch := &cdcpb.ChangeDataEvent{Events: []*cdcpb.Event{ { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Error{ Error: &cdcpb.Error{ EpochNotMatch: &errorpb.EpochNotMatch{}, }, }, }, }} ch2 <- epochNotMatch waitRequestID(t, baseAllocatedID+3) regionNotFound := &cdcpb.ChangeDataEvent{Events: []*cdcpb.Event{ { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Error{ Error: &cdcpb.Error{ RegionNotFound: &errorpb.RegionNotFound{}, }, }, }, }} ch2 <- regionNotFound waitRequestID(t, baseAllocatedID+4) unknownErr := &cdcpb.ChangeDataEvent{Events: []*cdcpb.Event{ { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Error{ Error: &cdcpb.Error{}, }, }, }} ch2 <- unknownErr // `singleEventFeed` always emits a resolved event with ResolvedTs == StartTs // when it starts. consumePreResolvedTs: for { select { case event = <-eventCh: require.NotNil(t, event.Resolved) require.Equal(t, uint64(100), event.Resolved.ResolvedTs) case <-time.After(time.Second): break consumePreResolvedTs } } // wait request id allocated with: // new session, no leader request, epoch not match request, // region not found request, unknown error request, normal request waitRequestID(t, baseAllocatedID+5) initialized := mockInitializedEvent(3 /* regionID */, currentRequestID()) ch2 <- initialized makeEvent := func(ts uint64) *cdcpb.ChangeDataEvent { return &cdcpb.ChangeDataEvent{ Events: []*cdcpb.Event{ { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_ResolvedTs{ ResolvedTs: ts, }, }, }, } } // fallback resolved ts event from TiKV ch2 <- makeEvent(90) // normal resolved ts event ch2 <- makeEvent(120) select { case event = <-eventCh: case <-time.After(3 * time.Second): require.FailNow(t, "reconnection not succeed in 3 seconds") } require.NotNil(t, event.Resolved) require.Equal(t, uint64(120), event.Resolved.ResolvedTs) cancel() }
explode_data.jsonl/32863
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1944 }
[ 2830, 3393, 6999, 1454, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 72079, 1669, 609, 12996, 28384, 2808, 31483, 23049, 16, 1669, 1281, 35190, 353, 4385, 4672, 65, 39348, 1043, 1556, 11, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDecodeWithFormat(t *testing.T) { testCases := []struct { name string file string want Format }{ { name: "JPEG Decode", file: "testdata/branches.jpg", want: JPEG, }, { name: "PNG Decode", file: "testdata/branches.png", want: PNG, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { b, err := ioutil.ReadFile(tc.file) if err != nil { t.Errorf("got error %#v", err) } _, format, err := DecodeWithFormat(bytes.NewReader(b)) if format != tc.want { t.Errorf("got result %#v want %#v", formatNames[format], formatNames[tc.want]) } }) } }
explode_data.jsonl/2435
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 292 }
[ 2830, 3393, 32564, 2354, 4061, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 17661, 914, 198, 197, 50780, 15042, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 73603, 50194, 756, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSendMessage(t *testing.T) { plugin := Plugin{ Repo: Repo{ Name: "go-hello", Namespace: "appleboy", }, Commit: Commit{ Sha: "e7c4f0a63ceeb42a39ac7806f7b51f3f0d204fd2", Author: "Bo-Yi Wu", Branch: "master", Message: "update travis by drone plugin", Email: "test@gmail.com", }, Build: Build{ Tag: "1.0.0", Number: 101, Status: "success", Link: "https://github.com/appleboy/go-hello", }, Config: Config{ Token: os.Getenv("TELEGRAM_TOKEN"), To: []string{os.Getenv("TELEGRAM_TO"), os.Getenv("TELEGRAM_TO") + ":appleboy@gmail.com", "中文ID", "1234567890"}, Message: []string{"Test Telegram Chat Bot From Travis or Local", "commit message: 『{{ build.message }}』", " "}, Photo: []string{"tests/github.png", "1234", " "}, Document: []string{"tests/gophercolor.png", "1234", " "}, Sticker: []string{"tests/github-logo.png", "tests/github.png", "1234", " "}, Audio: []string{"tests/audio.mp3", "1234", " "}, Voice: []string{"tests/voice.ogg", "1234", " "}, Location: []string{"24.9163213 121.1424972", "1", " "}, Venue: []string{"35.661777 139.704051 竹北體育館 新竹縣竹北市", "24.9163213 121.1424972", "1", " "}, Video: []string{"tests/video.mp4", "1234", " "}, Debug: false, }, } err := plugin.Exec() assert.NotNil(t, err) plugin.Config.Format = formatMarkdown plugin.Config.Message = []string{"Test escape under_score"} err = plugin.Exec() assert.NotNil(t, err) // disable message plugin.Config.Message = []string{} err = plugin.Exec() assert.NotNil(t, err) }
explode_data.jsonl/17930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 737 }
[ 2830, 3393, 80863, 1155, 353, 8840, 836, 8, 341, 197, 9138, 1669, 21245, 515, 197, 197, 25243, 25, 71509, 515, 298, 21297, 25, 414, 330, 3346, 2832, 4791, 756, 298, 90823, 25, 330, 22377, 17184, 756, 197, 197, 1583, 197, 197, 33441, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestContactInfoStore(t *testing.T) { a := assertions.New(t) ctx := test.Context() now := time.Now() WithDB(t, func(t *testing.T, db *gorm.DB) { prepareTest(db, &ContactInfo{}, &Application{}) appStore := GetApplicationStore(db) app, err := appStore.CreateApplication(ctx, &ttnpb.Application{ ApplicationIdentifiers: ttnpb.ApplicationIdentifiers{ApplicationID: "foo"}, }) a.So(err, should.BeNil) s := GetContactInfoStore(db) contactInfo, err := s.GetContactInfo(ctx, app.ApplicationIdentifiers) a.So(err, should.BeNil) a.So(contactInfo, should.BeEmpty) _, err = s.SetContactInfo(ctx, app.ApplicationIdentifiers, []*ttnpb.ContactInfo{ {ContactType: ttnpb.CONTACT_TYPE_TECHNICAL, ContactMethod: ttnpb.CONTACT_METHOD_EMAIL, Value: "foo@example.com", ValidatedAt: &now}, {ContactType: ttnpb.CONTACT_TYPE_BILLING, ContactMethod: ttnpb.CONTACT_METHOD_EMAIL, Value: "admin@example.com"}, }) a.So(err, should.BeNil) contactInfo, err = s.GetContactInfo(ctx, app.ApplicationIdentifiers) a.So(err, should.BeNil) a.So(contactInfo, should.HaveLength, 2) _, err = s.SetContactInfo(ctx, app.ApplicationIdentifiers, []*ttnpb.ContactInfo{ {ContactType: ttnpb.CONTACT_TYPE_TECHNICAL, ContactMethod: ttnpb.CONTACT_METHOD_EMAIL, Value: "bar@example.com"}, {ContactType: ttnpb.CONTACT_TYPE_TECHNICAL, ContactMethod: ttnpb.CONTACT_METHOD_EMAIL, Value: "foo@example.com"}, {ContactType: ttnpb.CONTACT_TYPE_ABUSE, ContactMethod: ttnpb.CONTACT_METHOD_EMAIL, Value: "foo@example.com"}, {ContactType: ttnpb.CONTACT_TYPE_BILLING, ContactMethod: ttnpb.CONTACT_METHOD_EMAIL, Value: "admin@example.com"}, {ContactType: ttnpb.CONTACT_TYPE_BILLING, ContactMethod: ttnpb.CONTACT_METHOD_EMAIL, Value: "other_admin@example.com"}, }) a.So(err, should.BeNil) contactInfo, err = s.GetContactInfo(ctx, app.ApplicationIdentifiers) a.So(err, should.BeNil) if a.So(contactInfo, should.HaveLength, 5) { for _, contactInfo := range contactInfo { if contactInfo.ContactType == ttnpb.CONTACT_TYPE_TECHNICAL && contactInfo.Value == "foo@example.com" { a.So(contactInfo.ValidatedAt, should.NotBeNil) } } } }) }
explode_data.jsonl/55918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 847 }
[ 2830, 3393, 8732, 1731, 6093, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 54836, 7121, 1155, 340, 20985, 1669, 1273, 9328, 2822, 80922, 1669, 882, 13244, 2822, 197, 2354, 3506, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 2927, 353, 73281, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSearch__fedachPostalCodeOnlySearchRequest(t *testing.T) { u, _ := url.Parse("https://moov.io/fed/ach/search?postalCode=43724") req := readFEDSearchRequest(u) if req.PostalCode != "43724" { t.Errorf("req.Zip=%s", req.PostalCode) } if !req.postalCodeOnly() { t.Errorf("req is not postal code only") } }
explode_data.jsonl/71089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 5890, 563, 51123, 610, 43800, 2078, 7308, 5890, 1900, 1155, 353, 8840, 836, 8, 341, 10676, 11, 716, 1669, 2515, 8937, 445, 2428, 1110, 6355, 859, 4245, 6663, 291, 14, 610, 23167, 30, 33170, 2078, 28, 19, 18, 22, 17, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestValidateProjectDBNameTemplate(t *testing.T) { tests := []struct { name string template string errPart string }{ { "location", "{{DB_NAME}}_hello_{{LOCATION}}", "", }, { "tenant", "{{DB_NAME}}_{{TENANT}}.sql", "", }, { "InvalidToken", "{{DB_NAME}}_{{TYPE}}", "invalid token {{TYPE}}", }, { "DatabaseNameTokenNotExists", "{{TENANT}}", "must include token {{DB_NAME}}", }, } for _, test := range tests { err := ValidateProjectDBNameTemplate(test.template) if err != nil { if !strings.Contains(err.Error(), test.errPart) { t.Errorf("%q: ValidateProjectDBNameTemplate(%q) got error %q, want errPart %q.", test.name, test.template, err.Error(), test.errPart) } } else { if test.errPart != "" { t.Errorf("%q: ValidateProjectDBNameTemplate(%q) got no error, want errPart %q.", test.name, test.template, test.errPart) } } } }
explode_data.jsonl/10284
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 398 }
[ 2830, 3393, 17926, 7849, 3506, 675, 7275, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 22832, 914, 198, 197, 9859, 5800, 220, 914, 198, 197, 59403, 197, 197, 515, 298, 197, 1, 2527, 756...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestGetAccountFees(t *testing.T) { t.Parallel() _, err := b.GetAccountFees() if err == nil { t.Error("Test Failed - GetAccountFees error") } }
explode_data.jsonl/79937
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 62 }
[ 2830, 3393, 1949, 7365, 37, 5516, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 6878, 1848, 1669, 293, 2234, 7365, 37, 5516, 741, 743, 1848, 621, 2092, 341, 197, 3244, 6141, 445, 2271, 21379, 481, 2126, 7365, 37, 5516, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestExtractWhiteout(t *testing.T) { img, err := tarball.ImageFromPath("testdata/whiteout_image.tar", nil) if err != nil { t.Errorf("Error loading image: %v", err) } tarPath, _ := filepath.Abs("img.tar") defer os.Remove(tarPath) tr := tar.NewReader(mutate.Extract(img)) for { header, err := tr.Next() if errors.Is(err, io.EOF) { break } name := header.Name for _, part := range filepath.SplitList(name) { if part == "foo" { t.Errorf("whiteout file found in tar: %v", name) } } } }
explode_data.jsonl/3086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 28959, 14075, 411, 1155, 353, 8840, 836, 8, 341, 39162, 11, 1848, 1669, 12183, 3959, 7528, 3830, 1820, 445, 92425, 14, 5782, 411, 4954, 28048, 497, 2092, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 1454, 8277, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestMarshalExtJSONAppendWithContext(t *testing.T) { t.Run("MarshalExtJSONAppendWithContext", func(t *testing.T) { dst := make([]byte, 0, 1024) type teststruct struct{ Foo int } val := teststruct{1} ec := bsoncodec.EncodeContext{Registry: DefaultRegistry} got, err := MarshalExtJSONAppendWithContext(ec, dst, val, true, false) noerr(t, err) want := []byte(`{"foo":{"$numberInt":"1"}}`) if !bytes.Equal(got, want) { t.Errorf("Bytes are not equal. got %v; want %v", got, want) t.Errorf("Bytes:\n%s\n%s", got, want) } }) }
explode_data.jsonl/12828
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 55438, 6756, 5370, 23877, 91101, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 55438, 6756, 5370, 23877, 91101, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 52051, 1669, 1281, 10556, 3782, 11, 220, 15, 11, 220, 16, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNewline(t *testing.T) { in := "GOPASS-SECRET-1.0\nFoo: bar\n\nbody" sec, err := ParseMIME([]byte(in)) require.NoError(t, err) assert.Equal(t, "body", sec.GetBody()) assert.Equal(t, "bar", sec.Get("Foo")) assert.Equal(t, in, string(sec.Bytes())) }
explode_data.jsonl/27743
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 3564, 1056, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 330, 98733, 4939, 12, 65310, 12, 16, 13, 15, 1699, 40923, 25, 3619, 1699, 1699, 2599, 698, 197, 5024, 11, 1848, 1669, 14775, 44, 5660, 10556, 3782, 5900, 1171, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNeighborWrite(t *testing.T) { a, b, teardown := newPipe() defer teardown() neighborA := newTestNeighbor("A", a) defer neighborA.Close() neighborA.Listen() neighborB := newTestNeighbor("B", b) defer neighborB.Close() var count uint32 neighborB.Events.ReceiveMessage.Attach(events.NewClosure(func(data []byte) { assert.Equal(t, testData, data) atomic.AddUint32(&count, 1) })) neighborB.Listen() _, err := neighborA.Write(testData) require.NoError(t, err) assert.Eventually(t, func() bool { return atomic.LoadUint32(&count) == 1 }, time.Second, 10*time.Millisecond) }
explode_data.jsonl/20517
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 88109, 7985, 1155, 353, 8840, 836, 8, 341, 11323, 11, 293, 11, 49304, 1669, 501, 34077, 741, 16867, 49304, 2822, 197, 36469, 32, 1669, 501, 2271, 88109, 445, 32, 497, 264, 340, 16867, 9565, 32, 10421, 741, 197, 36469, 32, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestList_Iterator(t *testing.T) { gtest.C(t, func(t *gtest.T) { l := New() a1 := []interface{}{"a", "b", "c", "d", "e"} l.PushFronts(a1) e1 := l.Back() fun1 := func(e *Element) bool { if gconv.String(e1.Value) > "c" { return true } return false } checkList(t, l, []interface{}{"e", "d", "c", "b", "a"}) l.Iterator(fun1) checkList(t, l, []interface{}{"e", "d", "c", "b", "a"}) }) }
explode_data.jsonl/30914
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 852, 7959, 465, 850, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 8810, 1669, 1532, 741, 197, 11323, 16, 1669, 3056, 4970, 6257, 4913, 64, 497, 330, 65, 497, 330, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRunAndWaitForTerminalState(t *testing.T) { defer leaktest.AfterTest(t)() // Intentionally share the server between subtests, so job records // accumulate over time. ctx := context.Background() s, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{}) defer s.Stopper().Stop(ctx) mockJob := jobs.Record{Details: jobspb.BackupDetails{}, Progress: jobspb.BackupProgress{}} tests := []struct { name string status jobs.Status err string execFn func(context.Context) error }{ { "non-job execFn", "", "no jobs found", func(_ context.Context) error { return nil }, }, { "pre-job error", "", "exec failed before job was created.*pre-job error", func(_ context.Context) error { return errors.New("pre-job error") }, }, { "job succeeded", jobs.StatusSucceeded, "", func(_ context.Context) error { registry := s.JobRegistry().(*jobs.Registry) job := registry.NewJob(mockJob) if err := job.Created(ctx); err != nil { return err } return job.Succeeded(ctx, jobs.NoopFn) }, }, { "job failed", jobs.StatusFailed, "in-job error", func(_ context.Context) error { registry := s.JobRegistry().(*jobs.Registry) job := registry.NewJob(mockJob) if err := job.Created(ctx); err != nil { return err } err := errors.New("in-job error") if err := job.Failed(ctx, err, jobs.NoopFn); err != nil { return err } return err }, }, { "job lease transfer then succeeded", jobs.StatusSucceeded, "", func(ctx context.Context) error { registry := s.JobRegistry().(*jobs.Registry) job := registry.NewJob(mockJob) if err := job.Created(ctx); err != nil { return err } if err := job.Succeeded(ctx, jobs.NoopFn); err != nil { return err } return errors.New("lease transferred") }, }, { "job lease transfer then failed", jobs.StatusFailed, "in-job error", func(ctx context.Context) error { registry := s.JobRegistry().(*jobs.Registry) job := registry.NewJob(mockJob) if err := job.Created(ctx); err != nil { return err } if err := job.Failed(ctx, errors.New("in-job error"), jobs.NoopFn); err != nil { return err } return errors.New("lease transferred") }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { _, status, err := jobs.RunAndWaitForTerminalState(ctx, sqlDB, test.execFn) if !testutils.IsError(err, test.err) { t.Fatalf("got %v expected %v", err, test.err) } if status != test.status { t.Fatalf("got [%s] expected [%s]", status, test.status) } }) } }
explode_data.jsonl/24128
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1121 }
[ 2830, 3393, 6727, 92812, 2461, 47890, 1397, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 197, 322, 1333, 2939, 745, 4332, 279, 3538, 1948, 1186, 23841, 11, 773, 2618, 7424, 198, 197, 322, 46276, 916, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateReplicationSlot(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() conn, err := pgconn.Connect(ctx, os.Getenv("PGLOGREPL_TEST_CONN_STRING")) require.NoError(t, err) defer closeConn(t, conn) result, err := pglogrepl.CreateReplicationSlot(ctx, conn, slotName, outputPlugin, pglogrepl.CreateReplicationSlotOptions{Temporary: true}) require.NoError(t, err) assert.Equal(t, slotName, result.SlotName) assert.Equal(t, outputPlugin, result.OutputPlugin) }
explode_data.jsonl/45904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 4021, 18327, 1693, 19877, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 7636, 5378, 19047, 1507, 882, 32435, 9, 20, 340, 16867, 9121, 2822, 32917, 11, 1848, 1669, 17495, 5148, 43851, 7502, 11, 2643, 64883...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLimitedPeriodicJob(t *testing.T) { ctx := context.Background() s, err := standard.New(ctx, standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(&nullmetrics.Service{})) require.NoError(t, err) require.NotNil(t, s) run := 0 runFunc := func(ctx context.Context, data interface{}) { run++ } runtimeFunc := func(ctx context.Context, data interface{}) (time.Time, error) { if run == 3 { return time.Now(), scheduler.ErrNoMoreInstances } return time.Now().Add(10 * time.Millisecond), nil } require.NoError(t, s.SchedulePeriodicJob(ctx, "Test", "Test job", runtimeFunc, nil, runFunc, nil)) require.Len(t, s.ListJobs(ctx), 1) require.Equal(t, 0, run) time.Sleep(time.Duration(50) * time.Millisecond) assert.Equal(t, 3, run) require.Len(t, s.ListJobs(ctx), 0) }
explode_data.jsonl/44219
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 313 }
[ 2830, 3393, 74477, 23750, 292, 12245, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1903, 11, 1848, 1669, 5297, 7121, 7502, 11, 5297, 26124, 72676, 7, 7070, 1609, 89576, 701, 5297, 26124, 30098, 2099, 2921, 43262, 13860, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewDeleteClusterStep(t *testing.T) { s, err := NewDeleteClusterStep() if err != nil { t.Errorf("unexpected error %v", err) } if s == nil { t.Error("Step must not be nil") } if s.getComputeSvc == nil { t.Errorf("get compute service must not be nil") } if client, err := s.getComputeSvc(context.Background(), steps.GCEConfig{}); client == nil || err != nil { t.Errorf("Unexpected values %v %v", client, err) } }
explode_data.jsonl/30783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 3564, 6435, 28678, 8304, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 1532, 6435, 28678, 8304, 2822, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 53859, 1465, 1018, 85, 497, 1848, 340, 197, 630, 743, 274, 621, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestIsNeFieldValidation(t *testing.T) { validate := New() var j uint64 var k float64 s := "abcd" i := 1 j = 1 k = 1.543 arr := []string{"test"} now := time.Now().UTC() var j2 uint64 var k2 float64 s2 := "abcdef" i2 := 3 j2 = 2 k2 = 1.5434456 arr2 := []string{"test", "test2"} arr3 := []string{"test"} now2 := now errs := validate.VarWithValue(s, s2, "nefield") Equal(t, errs, nil) errs = validate.VarWithValue(i2, i, "nefield") Equal(t, errs, nil) errs = validate.VarWithValue(j2, j, "nefield") Equal(t, errs, nil) errs = validate.VarWithValue(k2, k, "nefield") Equal(t, errs, nil) errs = validate.VarWithValue(arr2, arr, "nefield") Equal(t, errs, nil) errs = validate.VarWithValue(now2, now, "nefield") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "nefield") errs = validate.VarWithValue(arr3, arr, "nefield") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "nefield") type Test struct { Start *time.Time `validate:"nefield=End"` End *time.Time } sv := &Test{ Start: &now, End: &now, } errs = validate.Struct(sv) NotEqual(t, errs, nil) AssertError(t, errs, "Test.Start", "Test.Start", "Start", "Start", "nefield") now3 := time.Now().UTC() sv = &Test{ Start: &now, End: &now3, } errs = validate.Struct(sv) Equal(t, errs, nil) errs = validate.VarWithValue(nil, 1, "nefield") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "nefield") errs = validate.VarWithValue(sv, now, "nefield") Equal(t, errs, nil) type Test2 struct { Start *time.Time `validate:"nefield=NonExistantField"` End *time.Time } sv2 := &Test2{ Start: &now, End: &now, } errs = validate.Struct(sv2) Equal(t, errs, nil) type Other struct { Value string } type Test3 struct { Value Other Time time.Time `validate:"nefield=Value"` } tst := Test3{ Value: Other{Value: "StringVal"}, Time: now, } errs = validate.Struct(tst) Equal(t, errs, nil) }
explode_data.jsonl/77284
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 895 }
[ 2830, 3393, 3872, 8813, 1877, 13799, 1155, 353, 8840, 836, 8, 1476, 197, 7067, 1669, 1532, 2822, 2405, 502, 2622, 21, 19, 198, 2405, 595, 2224, 21, 19, 198, 1903, 1669, 330, 68644, 698, 8230, 1669, 220, 16, 198, 12428, 284, 220, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseVolume(t *testing.T) { c := &Config{} m := manager{} c.RollingVolumeSize = "1kb" m.ParseVolume(c) assert.Equal(t, int64(1024), m.thresholdSize) c.RollingVolumeSize = "2k" m.ParseVolume(c) assert.Equal(t, int64(2*1024), m.thresholdSize) c.RollingVolumeSize = "1KB" m.ParseVolume(c) assert.Equal(t, int64(1024), m.thresholdSize) c.RollingVolumeSize = "1mb" m.ParseVolume(c) assert.Equal(t, int64(1024*1024), m.thresholdSize) c.RollingVolumeSize = "1MB" m.ParseVolume(c) assert.Equal(t, int64(1024*1024), m.thresholdSize) c.RollingVolumeSize = "1Mb" m.ParseVolume(c) assert.Equal(t, int64(1024*1024), m.thresholdSize) c.RollingVolumeSize = "1gb" m.ParseVolume(c) assert.Equal(t, int64(1024*1024*1024), m.thresholdSize) c.RollingVolumeSize = "1GB" m.ParseVolume(c) assert.Equal(t, int64(1024*1024*1024), m.thresholdSize) c.RollingVolumeSize = "1g" m.ParseVolume(c) assert.Equal(t, int64(1024*1024*1024), m.thresholdSize) c.RollingVolumeSize = "1tb" m.ParseVolume(c) assert.Equal(t, int64(1024*1024*1024*1024), m.thresholdSize) c.RollingVolumeSize = "1tB" m.ParseVolume(c) assert.Equal(t, int64(1024*1024*1024*1024), m.thresholdSize) c.RollingVolumeSize = "1t" m.ParseVolume(c) assert.Equal(t, int64(1024*1024*1024*1024), m.thresholdSize) }
explode_data.jsonl/18994
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 587 }
[ 2830, 3393, 14463, 18902, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 2648, 16094, 2109, 1669, 6645, 31483, 1444, 71212, 287, 18902, 1695, 284, 330, 16, 21310, 698, 2109, 8937, 18902, 1337, 340, 6948, 12808, 1155, 11, 526, 21, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnauthorized(t *testing.T) { // the middleware to test authMiddleware, _ := New(&GinJWTMiddleware{ Realm: "test zone", Key: key, Timeout: time.Hour, MaxRefresh: time.Hour * 24, Authenticator: defaultAuthenticator, Unauthorized: func(c *gin.Context, code int, message string) { c.String(code, message) }, }) handler := ginHandler(authMiddleware) r := gofight.New() r.GET("/auth/hello"). SetHeader(gofight.H{ "Authorization": "Bearer 1234", }). Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { assert.Equal(t, http.StatusUnauthorized, r.Code) }) }
explode_data.jsonl/64445
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 277 }
[ 2830, 3393, 51181, 1155, 353, 8840, 836, 8, 341, 197, 322, 279, 29679, 311, 1273, 198, 78011, 24684, 11, 716, 1669, 1532, 2099, 38, 258, 55172, 24684, 515, 197, 197, 64290, 25, 260, 330, 1944, 10143, 756, 197, 55242, 25, 1843, 1376, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateNumberHostname(t *testing.T) { eng := NewTestEngine(t) defer mkDaemonFromEngine(eng, t).Nuke() config, _, _, err := runconfig.Parse([]string{"-h", "web.0", unitTestImageID, "echo test"}, nil) if err != nil { t.Fatal(err) } createTestContainer(eng, config, t) }
explode_data.jsonl/1590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 4021, 2833, 88839, 1155, 353, 8840, 836, 8, 341, 197, 826, 1669, 1532, 2271, 4571, 1155, 340, 16867, 23789, 89177, 3830, 4571, 7, 826, 11, 259, 568, 45, 10430, 2822, 25873, 11, 8358, 8358, 1848, 1669, 1598, 1676, 8937, 105...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTaskAtFuture(t *testing.T) { // Create new scheduler to have clean test env s := NewScheduler() now := time.Now() // Schedule to run in next minute nextMinuteTime := now.Add(time.Duration(1 * time.Minute)) startAt := fmt.Sprintf("%02d:%02d", nextMinuteTime.Hour(), nextMinuteTime.Minute()) dayJob := s.Every(1).Day().At(startAt) shouldBeFalse := false dayJob.Do(func() { shouldBeFalse = true }) // Check first run expectedStartTime := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Add(time.Minute).Minute(), 0, 0, loc) nextRun := dayJob.NextScheduledTime() assert.Equal(t, expectedStartTime, nextRun) s.RunPending() // Check next run's scheduled time nextRun = dayJob.NextScheduledTime() assert.Equal(t, expectedStartTime, nextRun) assert.Equal(t, false, shouldBeFalse, "Day job was not expected to run as it was in the future") }
explode_data.jsonl/63502
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 6262, 1655, 24206, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 501, 28809, 311, 614, 4240, 1273, 6105, 198, 1903, 1669, 1532, 38878, 2822, 80922, 1669, 882, 13244, 2822, 197, 322, 23512, 311, 1598, 304, 1790, 9383, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestByteSizeString(t *testing.T) { tests := []struct { n ByteSize want string }{ {0, "0"}, {1, "1b"}, {999, "999b"}, {1000, "1,000b"}, {1023, "1,023b"}, {1024, "1Kb"}, {12345, "12.1Kb"}, {12851, "12.5Kb"}, // 12.54980 {12852, "12.6Kb"}, // 12.55078 {123456, "120.6Kb"}, {1234567, "1.2Mb"}, {12345678, "11.8Mb"}, {123456789, "117.7Mb"}, {1234567890, "1.1Gb"}, {12345678900, "11.5Gb"}, {123456789000, "115Gb"}, {1234567890000, "1.1Tb"}, {12345678900000, "11.2Tb"}, {123456789000000, "112.3Tb"}, {1234567890000000, "1,122.8Tb"}, {12345678900000000, "11,228.3Tb"}, {123456789000000000, "112,283.3Tb"}, {1234567890000000000, "n/a"}, } for _, tt := range tests { t.Run(fmt.Sprintf("%d", tt.n), func(t *testing.T) { assert.Equal(t, tt.want, tt.n.String()) }) } }
explode_data.jsonl/37383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 460 }
[ 2830, 3393, 7153, 1695, 703, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 9038, 262, 10906, 1695, 198, 197, 50780, 914, 198, 197, 59403, 197, 197, 90, 15, 11, 330, 15, 7115, 197, 197, 90, 16, 11, 330, 16, 65, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDefaultUnaryInterceptorAuthFailure(t *testing.T) { // prepare authCalled := false expectedErr := fmt.Errorf("not authenticated") authFunc := func(context.Context, map[string][]string) (context.Context, error) { authCalled = true return context.Background(), expectedErr } handler := func(ctx context.Context, req interface{}) (interface{}, error) { assert.FailNow(t, "the handler should not have been called on auth failure!") return nil, nil } ctx := metadata.NewIncomingContext(context.Background(), metadata.Pairs("authorization", "some-auth-data")) // test res, err := authUnaryServerInterceptor(ctx, nil, &grpc.UnaryServerInfo{}, handler, authFunc) // verify assert.Nil(t, res) assert.Equal(t, expectedErr, err) assert.True(t, authCalled) }
explode_data.jsonl/80339
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 3675, 94545, 32786, 5087, 17507, 1155, 353, 8840, 836, 8, 341, 197, 322, 10549, 198, 78011, 20960, 1669, 895, 198, 42400, 7747, 1669, 8879, 13080, 445, 1921, 37260, 1138, 78011, 9626, 1669, 2915, 5378, 9328, 11, 2415, 14032, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDefaultReceiverExists(t *testing.T) { in := ` route: group_wait: 30s ` _, err := Load(in) expected := "root route must specify a default receiver" if err == nil { t.Fatalf("no error returned, expected:\n%v", expected) } if err.Error() != expected { t.Errorf("\nexpected:\n%v\ngot:\n%v", expected, err.Error()) } }
explode_data.jsonl/72893
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 3675, 25436, 15575, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 22074, 8966, 510, 256, 1874, 18760, 25, 220, 18, 15, 82, 198, 3989, 197, 6878, 1848, 1669, 8893, 5900, 692, 42400, 1669, 330, 2888, 6021, 1969, 13837, 264, 163...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLimitRangeGet(t *testing.T) { ns := api.NamespaceDefault limitRange := &api.LimitRange{ ObjectMeta: api.ObjectMeta{ Name: "abc", }, Spec: api.LimitRangeSpec{ Limits: []api.LimitRangeItem{ { Type: api.LimitTypePod, Max: api.ResourceList{ api.ResourceCPU: resource.MustParse("100"), api.ResourceMemory: resource.MustParse("10000"), }, Min: api.ResourceList{ api.ResourceCPU: resource.MustParse("0"), api.ResourceMemory: resource.MustParse("100"), }, }, }, }, } c := &testClient{ Request: testRequest{ Method: "GET", Path: testapi.ResourcePath(getLimitRangesResourceName(), ns, "abc"), Query: buildQueryValues(nil), Body: nil, }, Response: Response{StatusCode: 200, Body: limitRange}, } response, err := c.Setup().LimitRanges(ns).Get("abc") c.Validate(t, response, err) }
explode_data.jsonl/69628
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 16527, 6046, 1949, 1155, 353, 8840, 836, 8, 341, 84041, 1669, 6330, 46011, 3675, 198, 8810, 2353, 6046, 1669, 609, 2068, 1214, 2353, 6046, 515, 197, 23816, 12175, 25, 6330, 80222, 515, 298, 21297, 25, 330, 13683, 756, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSetupInstance(t *testing.T) { var d packet.Discovery var macs []packet.MACAddr d, macs, _ = MakeHardwareWithInstance() j := &Job{mac: macs[1].HardwareAddr()} j.setup(&d) mode := d.Mode() wantMode := "instance" if mode != wantMode { t.Fatalf("incorect mode, want: %v, got: %v\n", wantMode, mode) } netConfig := d.GetIP(macs[1].HardwareAddr()) if !netConfig.Address.Equal(j.dhcp.Address()) { t.Fatalf("incorrect Address, want: %v, got: %v\n", netConfig.Address, j.dhcp.Address()) } if !netConfig.Netmask.Equal(j.dhcp.Netmask()) { t.Fatalf("incorrect Netmask, want: %v, got: %v\n", netConfig.Netmask, j.dhcp.Netmask()) } if !netConfig.Gateway.Equal(j.dhcp.Gateway()) { t.Fatalf("incorrect Gateway, want: %v, got: %v\n", netConfig.Gateway, j.dhcp.Gateway()) } if d.Instance().Hostname != j.dhcp.Hostname() { t.Fatalf("incorrect Hostname, want: %v, got: %v\n", d.Instance().Hostname, j.dhcp.Hostname()) } }
explode_data.jsonl/70883
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 399 }
[ 2830, 3393, 21821, 2523, 1155, 353, 8840, 836, 8, 341, 2405, 294, 10151, 10166, 7449, 198, 2405, 8978, 82, 3056, 24829, 1321, 1706, 13986, 198, 2698, 11, 8978, 82, 11, 716, 284, 7405, 66862, 2354, 2523, 2822, 12428, 1669, 609, 12245, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestMissingRequired(t *testing.T) { var args struct { Foo string `arg:"required"` X []string `arg:"positional"` } err := parse("x", &args) assert.Error(t, err) }
explode_data.jsonl/13011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 25080, 8164, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 12727, 2624, 914, 256, 1565, 858, 2974, 6279, 8805, 197, 22123, 256, 3056, 917, 1565, 858, 2974, 966, 3005, 8805, 197, 532, 9859, 1669, 4715, 445, 87, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestFuncConsumerGroupStaticMembership_Basic(t *testing.T) { checkKafkaVersion(t, "2.3.0") setupFunctionalTest(t) defer teardownFunctionalTest(t) groupID := testFuncConsumerGroupID(t) t.Helper() config1 := NewTestConfig() config1.ClientID = "M1" config1.Version = V2_3_0_0 config1.Consumer.Offsets.Initial = OffsetNewest config1.Consumer.Group.InstanceId = "Instance1" m1 := runTestFuncConsumerGroupMemberWithConfig(t, groupID, 100, config1, nil, "test.4") defer m1.Close() config2 := NewTestConfig() config2.ClientID = "M2" config2.Version = V2_3_0_0 config2.Consumer.Offsets.Initial = OffsetNewest config2.Consumer.Group.InstanceId = "Instance2" m2 := runTestFuncConsumerGroupMemberWithConfig(t, groupID, 100, config2, nil, "test.4") defer m2.Close() m1.WaitForState(2) m2.WaitForState(2) err := testFuncConsumerGroupProduceMessage("test.4", 1000) if err != nil { t.Fatal(err) } admin, err := NewClusterAdmin(FunctionalTestEnv.KafkaBrokerAddrs, config1) if err != nil { t.Fatal(err) } res, err := admin.DescribeConsumerGroups([]string{groupID}) if err != nil { t.Fatal(err) } if len(res) != 1 { t.Errorf("group description should be only 1, got %v\n", len(res)) } if len(res[0].Members) != 2 { t.Errorf("should have 2 members in group , got %v\n", len(res[0].Members)) } m1.WaitForState(4) m2.WaitForState(4) m1.AssertCleanShutdown() m2.AssertCleanShutdown() }
explode_data.jsonl/54827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 575 }
[ 2830, 3393, 9626, 29968, 2808, 11690, 80904, 1668, 5971, 1155, 353, 8840, 836, 8, 341, 25157, 42, 21883, 5637, 1155, 11, 330, 17, 13, 18, 13, 15, 1138, 84571, 71271, 2271, 1155, 340, 16867, 49304, 71271, 2271, 1155, 340, 44260, 915, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestFB_ProcessSections(t *testing.T) { f := FB{} f.Init() f.Sections(1, 101, 13) f.ProcessSections() if ok, v := fizzBuzzTest(f); !ok { fmt.Printf("Failed at:%v\n", v) t.FailNow() } fmt.Printf("%v\n", f.m) }
explode_data.jsonl/19482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 16208, 70241, 38122, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 31921, 16094, 1166, 26849, 2822, 1166, 5732, 5136, 7, 16, 11, 220, 16, 15, 16, 11, 220, 16, 18, 340, 1166, 29012, 38122, 2822, 743, 5394, 11, 348, 1669, 8697...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFirestoreCreateDocumentError(t *testing.T) { errCode := codes.PermissionDenied mockFirestore.err = gstatus.Error(errCode, "test error") var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") var collectionId string = "collectionId-821242276" var documentId string = "documentId506676927" var document *firestorepb.Document = &firestorepb.Document{} var request = &firestorepb.CreateDocumentRequest{ Parent: formattedParent, CollectionId: collectionId, DocumentId: documentId, Document: document, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } resp, err := c.CreateDocument(context.Background(), request) if st, ok := gstatus.FromError(err); !ok { t.Errorf("got error %v, expected grpc error", err) } else if c := st.Code(); c != errCode { t.Errorf("got error code %q, want %q", c, errCode) } _ = resp }
explode_data.jsonl/27375
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 355 }
[ 2830, 3393, 48513, 4021, 7524, 1454, 1155, 353, 8840, 836, 8, 341, 9859, 2078, 1669, 13912, 73409, 54481, 198, 77333, 48513, 18441, 284, 342, 2829, 6141, 3964, 2078, 11, 330, 1944, 1465, 5130, 2405, 23126, 8387, 914, 284, 8879, 17305, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestWWWUpgrade(t *testing.T) { t.Parallel() type testEntry struct { URL string Host string Status int Location string } tests := []testEntry{ // redirect with no header {URL: "http://example.com", Status: 307, Location: "http://www.example.com"}, {URL: "http://example.com/", Status: 307, Location: "http://www.example.com/"}, // no redirect with no header {URL: "http://www.example.com", Status: 404}, {URL: "http://www.example.com/", Status: 404}, // redirect with header {URL: "http://localhost", Host: "example.com", Status: 307, Location: "http://www.example.com"}, {URL: "http://localhost/", Host: "example.com", Status: 307, Location: "http://www.example.com/"}, // no redirect with header {URL: "http://localhost", Host: "www.example.com", Status: 404}, {URL: "http://localhost/", Host: "www.example.com", Status: 404}, // https not stripped {URL: "https://example.com", Status: 307, Location: "https://www.example.com"}, {URL: "https://example.com/", Status: 307, Location: "https://www.example.com/"}, // ip address not prepended {URL: "http://127.0.0.1", Status: 404}, {URL: "http://127.0.0.1/", Status: 404}, {URL: "https://127.0.0.1", Status: 404}, {URL: "https://127.0.0.1/", Status: 404}, // with port {URL: "http://example.com:8080", Status: 307, Location: "http://www.example.com:8080"}, {URL: "http://www.example.com:8080", Status: 404}, {URL: "http://localhost:8080", Host: "example.com", Status: 307, Location: "http://www.example.com:8080"}, {URL: "http://localhost:8080", Host: "www.example.com", Status: 404}, {URL: "https://example.com:8080", Status: 307, Location: "https://www.example.com:8080"}, {URL: "http://127.0.0.1:8080", Status: 404}, } handler := httpd.NewRedirectHandler(false, true) for n, item := range tests { test := item t.Run(fmt.Sprintf("Test%d", n), func(t *testing.T) { t.Parallel() w := httptest.NewRecorder() r := newRedirectRequest(t, test.URL, test.Host, "") handler.ServeHTTP(w, r) if w.Code != test.Status { t.Errorf("wrong status code: %d != %d", w.Code, test.Status) } location := w.HeaderMap.Get("Location") if test.Status == 307 && location != test.Location { t.Errorf("wrong Location: %s != %s", location, test.Location) } }) } }
explode_data.jsonl/13968
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 901 }
[ 2830, 3393, 45508, 43861, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 13158, 1273, 5874, 2036, 341, 197, 79055, 414, 914, 198, 197, 197, 9296, 257, 914, 198, 197, 58321, 256, 526, 198, 197, 197, 4707, 914, 198, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestParseDefaultPrefs(t *testing.T) { /* * Set up */ // make prefs file f, err := ioutil.TempFile("", "Testing") if err != nil { panic(fmt.Sprintf("Failed to make tempfile: %v", err)) } defer os.Remove(f.Name()) f.WriteString(gDefaultPrefsStr) f.Seek(0, 0) defer f.Close() /* * Call */ prefs, err := loadPrefs(f) /* * Test */ require.Nil(t, err) require.NotNil(t, prefs) }
explode_data.jsonl/65249
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 14463, 3675, 31434, 1155, 353, 8840, 836, 8, 341, 197, 3284, 197, 353, 2573, 705, 198, 197, 735, 197, 322, 1281, 36013, 1034, 198, 1166, 11, 1848, 1669, 43144, 65009, 1703, 19814, 330, 16451, 1138, 743, 1848, 961, 2092, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSyncJobRunPresenter_Initiators(t *testing.T) { newAddress := common.HexToAddress("0x9FBDa871d559710256a2502A2517b794B482Db40") requestID := common.HexToHash("0xcafe") txHash := common.HexToHash("0xdeadbeef") tests := []struct { initrType string rr models.RunRequest keyCount int }{ {models.InitiatorWeb, models.RunRequest{}, 1}, {models.InitiatorCron, models.RunRequest{}, 1}, {models.InitiatorRunAt, models.RunRequest{}, 1}, {models.InitiatorEthLog, models.RunRequest{TxHash: &txHash}, 2}, { models.InitiatorRunLog, models.RunRequest{ RequestID: &requestID, TxHash: &txHash, Requester: &newAddress, }, 4, }, } for _, test := range tests { t.Run(test.initrType, func(t *testing.T) { jobRun := models.JobRun{ ID: models.NewID(), JobSpecID: models.NewID(), Initiator: models.Initiator{Type: test.initrType}, RunRequest: test.rr, } p := SyncJobRunPresenter{JobRun: &jobRun} bytes, err := p.MarshalJSON() require.NoError(t, err) var data map[string]interface{} err = json.Unmarshal(bytes, &data) require.NoError(t, err) initiator, ok := data["initiator"].(map[string]interface{}) require.True(t, ok) assert.Len(t, initiator, test.keyCount) assert.Equal(t, initiator["type"], test.initrType) }) } }
explode_data.jsonl/66339
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 593 }
[ 2830, 3393, 12154, 12245, 6727, 33849, 15644, 80290, 1155, 353, 8840, 836, 8, 341, 8638, 4286, 1669, 4185, 91538, 1249, 4286, 445, 15, 87, 24, 37, 9548, 64, 23, 22, 16, 67, 20, 20, 24, 22, 16, 15, 17, 20, 21, 64, 17, 20, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHump2underline(t *testing.T) { name := "UserAnswer" result := Hump2underline(name) if result != "user_answer" { t.Errorf("conver err name=%s result=%s", name, result) } name = "Hump2underline" result = Hump2underline(name) if result != "hump2underline" { t.Errorf("conver err name=%s result=%s", name, result) } }
explode_data.jsonl/3507
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 39, 1510, 17, 45673, 1155, 353, 8840, 836, 8, 1476, 11609, 1669, 330, 1474, 16141, 698, 9559, 1669, 472, 1510, 17, 45673, 3153, 340, 743, 1102, 961, 330, 872, 28534, 1, 341, 197, 3244, 13080, 445, 443, 423, 1848, 829, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestCountDiagnosisKeys(t *testing.T) { db, mock, _ := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual)) defer db.Close() row := sqlmock.NewRows([]string{"count"}).AddRow(100) mock.ExpectQuery(`SELECT COUNT(*) FROM diagnosis_keys`).WillReturnRows(row) expectedResult := int64(100) receivedResult, receivedErr := countDiagnosisKeys(db) if err := mock.ExpectationsWereMet(); err != nil { t.Errorf("there were unfulfilled expectations: %s", err) } assert.Equal(t, expectedResult, receivedResult, "Expected to receive count of 100") assert.Nil(t, receivedErr, "Expected nil if query ran") }
explode_data.jsonl/64744
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 2507, 21685, 49815, 8850, 1155, 353, 8840, 836, 8, 341, 20939, 11, 7860, 11, 716, 1669, 5704, 16712, 7121, 13148, 16712, 15685, 37554, 5341, 13148, 16712, 15685, 37554, 2993, 1171, 16867, 2927, 10421, 2822, 33967, 1669, 5704, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestLoadYamlConfig_withDatabindAndEnvVars(t *testing.T) { yamlData := []byte(` variables: license: test: value: {{ SOME_LICENSE }} license_key: ${license} `) tmp, err := createTestFile(yamlData) require.NoError(t, err) defer os.Remove(tmp.Name()) os.Setenv("SOME_LICENSE", "XXX") cfg, err := LoadConfig(tmp.Name()) os.Unsetenv("SOME_LICENSE") require.NoError(t, err) assert.Equal(t, "XXX", cfg.License) }
explode_data.jsonl/22931
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 5879, 56, 9467, 2648, 6615, 35, 2096, 484, 3036, 14359, 28305, 1155, 353, 8840, 836, 8, 341, 14522, 9467, 1043, 1669, 3056, 3782, 61528, 18616, 510, 220, 5723, 510, 262, 1273, 510, 414, 897, 25, 5867, 65555, 57560, 8096, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTopDownEvalTermExpr(t *testing.T) { tests := []struct { note string rule string expected string }{ {"true", `p = true { true }`, "true"}, {"false", `p = true { false }`, ""}, {"number non-zero", `p = true { -3.14 }`, "true"}, {"number zero", `p = true { null }`, "true"}, {"null", `p = true { null }`, "true"}, {"string non-empty", `p = true { "abc" }`, "true"}, {"string empty", `p = true { "" }`, "true"}, {"array non-empty", `p = true { [1, 2, 3] }`, "true"}, {"array empty", `p = true { [] }`, "true"}, {"object non-empty", `p = true { {"a": 1} }`, "true"}, {"object empty", `p = true { {} }`, "true"}, {"set non-empty", `p = true { {1, 2, 3} }`, "true"}, {"set empty", `p = true { set() }`, "true"}, {"ref", `p = true { a[i] }`, "true"}, {"ref undefined", `p = true { data.deadbeef[i] }`, ""}, {"ref undefined (path)", `p = true { data.a[true] }`, ""}, {"ref false", `p = true { data.c[0].x[1] }`, ""}, {"array comprehension", `p = true { [x | x = 1] }`, "true"}, {"array comprehension empty", `p = true { [x | x = 1; x = 2] }`, "true"}, {"arbitrary position", `p = true { a[i] = x; x; i }`, "true"}, } data := loadSmallTestData() for _, tc := range tests { runTopDownTestCase(t, data, tc.note, []string{tc.rule}, tc.expected) } }
explode_data.jsonl/25195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 543 }
[ 2830, 3393, 5366, 4454, 54469, 17249, 16041, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 9038, 1272, 257, 914, 198, 197, 7000, 1111, 257, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 4913, 1866, 497, 156...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTerraformServicesSlosGroupsExample(t *testing.T) { projectId := os.Getenv("PROJECT_ID") terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ TerraformDir: "../examples/services_slos_groups", Vars: map[string]interface{}{ "project_id": projectId, }, }) defer terraform.Destroy(t, terraformOptions) terraform.InitAndApply(t, terraformOptions) }
explode_data.jsonl/78326
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 51, 13886, 627, 11025, 50, 2301, 22173, 13314, 1155, 353, 8840, 836, 8, 341, 197, 62562, 1669, 2643, 64883, 445, 41455, 3450, 5130, 197, 61385, 3798, 1669, 59561, 627, 26124, 3675, 51560, 480, 13877, 1155, 11, 609, 61385, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNormalizeAzureRegion(t *testing.T) { cases := []struct { input string expectedResult string }{ { input: "westus", expectedResult: "westus", }, { input: "West US", expectedResult: "westus", }, { input: "Eastern Africa", expectedResult: "easternafrica", }, { input: "", expectedResult: "", }, } for _, c := range cases { result := NormalizeAzureRegion(c.input) if c.expectedResult != result { t.Fatalf("NormalizeAzureRegion returned unexpected result: expected %s but got %s", c.expectedResult, result) } } }
explode_data.jsonl/7024
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 87824, 78107, 14091, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 22427, 688, 914, 198, 197, 42400, 2077, 914, 198, 197, 59403, 197, 197, 515, 298, 22427, 25, 688, 330, 11039, 355, 756, 298, 42400,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestCredentialInjection(t *testing.T) { g := gomega.NewGomegaWithT(t) scenarios := map[string]struct { sa *v1.ServiceAccount secret *v1.Secret original *appsv1.Deployment expected *appsv1.Deployment }{ "Test s3 secrets injection": { sa: &v1.ServiceAccount{ ObjectMeta: metav1.ObjectMeta{ Name: "default", Namespace: "default", }, Secrets: []v1.ObjectReference{ { Name: "s3-secret", Namespace: "default", }, }, }, secret: &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "s3-secret", Namespace: "default", Annotations: map[string]string{ s3.KFServiceS3SecretEndpointAnnotation: "s3.aws.com", }, }, Data: map[string][]byte{ "awsAccessKeyID": {}, "awsSecretAccessKey": {}, }, }, original: makeDeployment(), expected: &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", }, Spec: appsv1.DeploymentSpec{ Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ constants.ModelInitializerSourceUriInternalAnnotationKey: "gs://foo", }, }, Spec: v1.PodSpec{ Containers: []v1.Container{ { Name: "user-container", VolumeMounts: []v1.VolumeMount{ { Name: "kfserving-provision-location", MountPath: constants.DefaultModelLocalMountPath, ReadOnly: true, }, }, }, }, InitContainers: []v1.Container{ { Name: "model-initializer", Image: ModelInitializerContainerImage + ":" + ModelInitializerContainerImageVersion, Args: []string{"gs://foo", constants.DefaultModelLocalMountPath}, VolumeMounts: []v1.VolumeMount{ { Name: "kfserving-provision-location", MountPath: constants.DefaultModelLocalMountPath, }, }, Env: []v1.EnvVar{ { Name: s3.AWSAccessKeyId, ValueFrom: &v1.EnvVarSource{ SecretKeyRef: &v1.SecretKeySelector{ LocalObjectReference: v1.LocalObjectReference{ Name: "s3-secret", }, Key: "awsAccessKeyID", }, }, }, { Name: s3.AWSSecretAccessKey, ValueFrom: &v1.EnvVarSource{ SecretKeyRef: &v1.SecretKeySelector{ LocalObjectReference: v1.LocalObjectReference{ Name: "s3-secret", }, Key: "awsSecretAccessKey", }, }, }, { Name: s3.S3Endpoint, Value: "s3.aws.com", }, { Name: s3.AWSEndpointUrl, Value: "https://s3.aws.com", }, }, }, }, Volumes: []v1.Volume{ v1.Volume{ Name: "kfserving-provision-location", VolumeSource: v1.VolumeSource{ EmptyDir: &v1.EmptyDirVolumeSource{}, }, }, }, }, }, }, }, }, "Test GCS secrets injection": { sa: &v1.ServiceAccount{ ObjectMeta: metav1.ObjectMeta{ Name: "default", Namespace: "default", }, Secrets: []v1.ObjectReference{ { Name: "user-gcp-sa", Namespace: "default", }, }, }, secret: &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "user-gcp-sa", Namespace: "default", }, Data: map[string][]byte{ "gcloud-application-credentials.json": {}, }, }, original: makeDeployment(), expected: &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", }, Spec: appsv1.DeploymentSpec{ Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ constants.ModelInitializerSourceUriInternalAnnotationKey: "gs://foo", }, }, Spec: v1.PodSpec{ Containers: []v1.Container{ v1.Container{ Name: "user-container", VolumeMounts: []v1.VolumeMount{ { Name: "kfserving-provision-location", MountPath: constants.DefaultModelLocalMountPath, ReadOnly: true, }, }, }, }, InitContainers: []v1.Container{ { Name: "model-initializer", Image: ModelInitializerContainerImage + ":" + ModelInitializerContainerImageVersion, Args: []string{"gs://foo", constants.DefaultModelLocalMountPath}, VolumeMounts: []v1.VolumeMount{ { Name: "kfserving-provision-location", MountPath: constants.DefaultModelLocalMountPath, }, { Name: gcs.GCSCredentialVolumeName, ReadOnly: true, MountPath: gcs.GCSCredentialVolumeMountPath, }, }, Env: []v1.EnvVar{ { Name: gcs.GCSCredentialEnvKey, Value: gcs.GCSCredentialVolumeMountPath + "gcloud-application-credentials.json", }, }, }, }, Volumes: []v1.Volume{ { Name: "kfserving-provision-location", VolumeSource: v1.VolumeSource{ EmptyDir: &v1.EmptyDirVolumeSource{}, }, }, { Name: gcs.GCSCredentialVolumeName, VolumeSource: v1.VolumeSource{ Secret: &v1.SecretVolumeSource{ SecretName: "user-gcp-sa", }, }, }, }, }, }, }, }, }, } var configMap = &v1.ConfigMap{ Data: map[string]string{ "credentials": `{ "gcs" : {"gcsCredentialFileName": "gcloud-application-credentials.json"}, "s3" : { "s3AccessKeyIDName": "awsAccessKeyID", "s3SecretAccessKeyName": "awsSecretAccessKey" } }`, }, } builder := credentials.NewCredentialBulder(c, configMap) for name, scenario := range scenarios { g.Expect(c.Create(context.TODO(), scenario.sa)).NotTo(gomega.HaveOccurred()) g.Expect(c.Create(context.TODO(), scenario.secret)).NotTo(gomega.HaveOccurred()) injector := &ModelInitializerInjector{ credentialBuilder: builder, } if err := injector.InjectModelInitializer(scenario.original); err != nil { t.Errorf("Test %q unexpected failure [%s]", name, err.Error()) } if diff := cmp.Diff(scenario.expected.Spec, scenario.original.Spec); diff != "" { t.Errorf("Test %q unexpected result (-want +got): %v", name, diff) } g.Expect(c.Delete(context.TODO(), scenario.sa)).NotTo(gomega.HaveOccurred()) g.Expect(c.Delete(context.TODO(), scenario.secret)).NotTo(gomega.HaveOccurred()) } }
explode_data.jsonl/14729
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3599 }
[ 2830, 3393, 48265, 36653, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 340, 29928, 60494, 1669, 2415, 14032, 60, 1235, 341, 197, 1903, 64, 981, 353, 85, 16, 13860, 7365, 198, 197, 197, 20474, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCreateAppWithNoNameSpaceForGlobalResource(t *testing.T) { Given(t). Path(globalWithNoNameSpace). When(). CreateWithNoNameSpace(). Then(). And(func(app *Application) { time.Sleep(500 * time.Millisecond) app, err := AppClientset.ArgoprojV1alpha1().Applications(ArgoCDNamespace).Get(context.Background(), app.Name, metav1.GetOptions{}) assert.NoError(t, err) assert.Len(t, app.Status.Conditions, 0) }) }
explode_data.jsonl/35657
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 4021, 2164, 2354, 2753, 675, 9914, 2461, 11646, 4783, 1155, 353, 8840, 836, 8, 341, 9600, 2071, 1155, 4292, 197, 69640, 31951, 2354, 2753, 675, 9914, 4292, 197, 197, 4498, 25829, 197, 75569, 2354, 2753, 675, 9914, 25829, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFuzzFloat32(t *testing.T) { data := []byte{0x3, 0x41, 0x42, 0x43, 0x44} f := &F{Data: data, T: t} fuzzFloat32(f) }
explode_data.jsonl/69271
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 37, 8889, 5442, 18, 17, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 3056, 3782, 90, 15, 87, 18, 11, 220, 15, 87, 19, 16, 11, 220, 15, 87, 19, 17, 11, 220, 15, 87, 19, 18, 11, 220, 15, 87, 19, 19, 532, 1166, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDefaultPositionalValues(t *testing.T) { var args struct { A int `arg:"positional" default:"123"` B *int `arg:"positional" default:"123"` C string `arg:"positional" default:"abc"` D *string `arg:"positional" default:"abc"` E float64 `arg:"positional" default:"1.23"` F *float64 `arg:"positional" default:"1.23"` G bool `arg:"positional" default:"true"` H *bool `arg:"positional" default:"true"` } err := parse("456 789", &args) require.NoError(t, err) assert.Equal(t, 456, args.A) assert.Equal(t, 789, *args.B) assert.Equal(t, "abc", args.C) assert.Equal(t, "abc", *args.D) assert.Equal(t, 1.23, args.E) assert.Equal(t, 1.23, *args.F) assert.True(t, args.G) assert.True(t, args.G) }
explode_data.jsonl/13081
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 3675, 3812, 278, 6227, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 22985, 526, 414, 1565, 858, 2974, 966, 3005, 1, 1638, 2974, 16, 17, 18, 8805, 197, 12791, 353, 396, 257, 1565, 858, 2974, 966, 3005, 1, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConstrainedPrefAttachmentNeedMoreChan(t *testing.T) { t.Parallel() prand.Seed(time.Now().Unix()) const ( minChanSize = 0 maxChanSize = btcutil.Amount(btcutil.SatoshiPerBitcoin) chanLimit = 3 threshold = 0.5 ) randChanID := func() lnwire.ShortChannelID { return lnwire.NewShortChanIDFromInt(uint64(prand.Int63())) } testCases := []struct { channels []Channel walletAmt btcutil.Amount needMore bool amtAvailable btcutil.Amount numMore uint32 }{ // Many available funds, but already have too many active open // channels. { []Channel{ { ChanID: randChanID(), Capacity: btcutil.Amount(prand.Int31()), }, { ChanID: randChanID(), Capacity: btcutil.Amount(prand.Int31()), }, { ChanID: randChanID(), Capacity: btcutil.Amount(prand.Int31()), }, }, btcutil.Amount(btcutil.SatoshiPerBitcoin * 10), false, 0, 0, }, // Ratio of funds in channels and total funds meets the // threshold. { []Channel{ { ChanID: randChanID(), Capacity: btcutil.Amount(btcutil.SatoshiPerBitcoin), }, { ChanID: randChanID(), Capacity: btcutil.Amount(btcutil.SatoshiPerBitcoin), }, }, btcutil.Amount(btcutil.SatoshiPerBitcoin * 2), false, 0, 0, }, // Ratio of funds in channels and total funds is below the // threshold. We have 10 BTC allocated amongst channels and // funds, atm. We're targeting 50%, so 5 BTC should be // allocated. Only 1 BTC is atm, so 4 BTC should be // recommended. We should also request 2 more channels as the // limit is 3. { []Channel{ { ChanID: randChanID(), Capacity: btcutil.Amount(btcutil.SatoshiPerBitcoin), }, }, btcutil.Amount(btcutil.SatoshiPerBitcoin * 9), true, btcutil.Amount(btcutil.SatoshiPerBitcoin * 4), 2, }, // Ratio of funds in channels and total funds is below the // threshold. We have 14 BTC total amongst the wallet's // balance, and our currently opened channels. Since we're // targeting a 50% allocation, we should commit 7 BTC. The // current channels commit 4 BTC, so we should expected 3 BTC // to be committed. We should only request a single additional // channel as the limit is 3. { []Channel{ { ChanID: randChanID(), Capacity: btcutil.Amount(btcutil.SatoshiPerBitcoin), }, { ChanID: randChanID(), Capacity: btcutil.Amount(btcutil.SatoshiPerBitcoin * 3), }, }, btcutil.Amount(btcutil.SatoshiPerBitcoin * 10), true, btcutil.Amount(btcutil.SatoshiPerBitcoin * 3), 1, }, // Ratio of funds in channels and total funds is above the // threshold. { []Channel{ { ChanID: randChanID(), Capacity: btcutil.Amount(btcutil.SatoshiPerBitcoin), }, { ChanID: randChanID(), Capacity: btcutil.Amount(btcutil.SatoshiPerBitcoin), }, }, btcutil.Amount(btcutil.SatoshiPerBitcoin), false, 0, 0, }, } prefAttach := NewConstrainedPrefAttachment(minChanSize, maxChanSize, chanLimit, threshold) for i, testCase := range testCases { amtToAllocate, numMore, needMore := prefAttach.NeedMoreChans( testCase.channels, testCase.walletAmt, ) if amtToAllocate != testCase.amtAvailable { t.Fatalf("test #%v: expected %v, got %v", i, testCase.amtAvailable, amtToAllocate) } if needMore != testCase.needMore { t.Fatalf("test #%v: expected %v, got %v", i, testCase.needMore, needMore) } if numMore != testCase.numMore { t.Fatalf("test #%v: expected %v, got %v", i, testCase.numMore, numMore) } } }
explode_data.jsonl/28780
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1566 }
[ 2830, 3393, 1109, 57727, 29978, 33569, 23657, 7661, 46019, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 25653, 437, 5732, 291, 9730, 13244, 1005, 55832, 12367, 4777, 2399, 197, 25320, 46019, 1695, 284, 220, 15, 198, 197, 22543, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Pagination_PrevNext_PagingParent(t *testing.T) { doc := testutil.CreateHTML() body := dom.QuerySelector(doc, "body") root := testutil.CreateDiv(0) dom.AppendChild(body, root) div := testutil.CreateDiv(1) dom.SetAttribute(div, "class", "page") dom.AppendChild(root, div) anchor := testutil.CreateAnchor("page1", "dummy link") dom.AppendChild(div, anchor) // While it may seem strange that both previous and next links are the same, this test // is testing that the anchor's parents will affect its paging score even if it has a // meaningless link text like "dummy link". assertDefaultDocumenOutlink(t, doc, anchor, anchor) }
explode_data.jsonl/10827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 1088, 10353, 1088, 7282, 5847, 1088, 4118, 8387, 1155, 353, 8840, 836, 8, 341, 59536, 1669, 1273, 1314, 7251, 5835, 741, 35402, 1669, 4719, 15685, 5877, 19153, 11, 330, 2599, 5130, 33698, 1669, 1273, 1314, 7251, 12509, 7, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTSOptionalChain(t *testing.T) { expectParseError(t, "a?.<T>()", "<stdin>: error: Expected identifier but found \"<\"\n") expectPrintedTS(t, "a?.<T>()", "a?.();\n") expectParseErrorTS(t, "a?.<T>b", "<stdin>: error: Expected \"(\" but found \"b\"\n") expectParseErrorTS(t, "a?.<T>[b]", "<stdin>: error: Expected \"(\" but found \"[\"\n") expectPrintedTS(t, "a?.b.c", "a?.b.c;\n") expectPrintedTS(t, "(a?.b).c", "(a?.b).c;\n") expectPrintedTS(t, "a?.b!.c", "a?.b.c;\n") expectPrintedTS(t, "a?.b[c]", "a?.b[c];\n") expectPrintedTS(t, "(a?.b)[c]", "(a?.b)[c];\n") expectPrintedTS(t, "a?.b![c]", "a?.b[c];\n") expectPrintedTS(t, "a?.b(c)", "a?.b(c);\n") expectPrintedTS(t, "(a?.b)(c)", "(a?.b)(c);\n") expectPrintedTS(t, "a?.b!(c)", "a?.b(c);\n") expectPrintedTS(t, "a?.b<T>(c)", "a?.b(c);\n") }
explode_data.jsonl/82336
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 450 }
[ 2830, 3393, 9951, 15309, 18837, 1155, 353, 8840, 836, 8, 341, 24952, 14463, 1454, 1155, 11, 330, 64, 4607, 27, 51, 13555, 497, 4055, 51602, 26818, 1465, 25, 31021, 12816, 714, 1730, 7245, 27, 22245, 77, 1138, 24952, 8994, 291, 9951, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTreeEntry_String(t *testing.T) { v := TreeEntry{ SHA: String(""), Path: String(""), Mode: String(""), Type: String(""), Size: Int(0), Content: String(""), URL: String(""), } want := `github.TreeEntry{SHA:"", Path:"", Mode:"", Type:"", Size:0, Content:"", URL:""}` if got := v.String(); got != want { t.Errorf("TreeEntry.String = %v, want %v", got, want) } }
explode_data.jsonl/33296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 6533, 5874, 31777, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 8942, 5874, 515, 197, 7568, 17020, 25, 257, 923, 445, 4461, 197, 69640, 25, 262, 923, 445, 4461, 197, 197, 3636, 25, 262, 923, 445, 4461, 197, 27725, 25, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHMAC_Parse(t *testing.T) { newReqHeader := func(value string) *http.Request { req := httptest.NewRequest("GET", "http://corestore.io", nil) req.Header.Set(signed.HeaderContentHMAC, value) return req } tests := []struct { req *http.Request wantAlgorithm string wantHMAC []byte wantErrBhf errors.BehaviourFunc }{ { newReqHeader(`sha1 48656c6c6f20476f7068657273`), "sha1", []byte(`Hello Gophers`), nil, }, { func() *http.Request { req := httptest.NewRequest("GET", "http://corestore.io", strings.NewReader("Hello\nWorld")) req.Header.Set("Trailer", signed.HeaderContentHMAC) req.Trailer = http.Header{} req.Trailer.Set(signed.HeaderContentHMAC, "sha1 48656c6c6f20476f7068657273") return req }(), "sha1", []byte(`Hello Gophers`), nil, }, { newReqHeader(`sha1 48656c6c6f20476f7068657273`), "sha1", nil, errors.IsNotValid, // because tab }, { newReqHeader(`sha1 48656c6c6f20476f7068657273xx`), "sha1", nil, errors.IsNotValid, // because tab }, { newReqHeader(`sha1 48656c6c6f20476f7068657273`), "sha2", nil, errors.IsNotValid, }, { newReqHeader(`48656c6c6f20476f7068657273`), "sha2", nil, errors.IsNotValid, }, { newReqHeader(``), "sha2", nil, errors.IsNotFound, }, } for i, test := range tests { hm := signed.NewContentHMAC(test.wantAlgorithm) haveSig, haveErr := hm.Parse(test.req) if test.wantErrBhf != nil { assert.Nil(t, haveSig, "Index %d", i) assert.True(t, test.wantErrBhf(haveErr), "Error: %+v", haveErr) // t.Log(haveErr) continue } assert.Exactly(t, test.wantAlgorithm, hm.Algorithm, "Index %d", i) assert.Exactly(t, string(test.wantHMAC), string(haveSig), "Index %d", i) assert.NoError(t, haveErr, "Index %d: %+v", i, haveErr) } }
explode_data.jsonl/80672
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 903 }
[ 2830, 3393, 39, 25788, 77337, 1155, 353, 8840, 836, 8, 341, 8638, 27234, 4047, 1669, 2915, 3679, 914, 8, 353, 1254, 9659, 341, 197, 24395, 1669, 54320, 70334, 75274, 445, 3806, 497, 330, 1254, 1110, 2153, 4314, 4245, 497, 2092, 340, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTemplateParametersVerifier(t *testing.T) { params := []v1beta1.Parameter{ {Name: "Foo"}, {Name: "NotUsed"}, } paramFile := packages.ParamsFile{Parameters: params} templates := make(map[string]string) templates["foo.yaml"] = ` {{.Params.Foo}} {{.Params.Bar}} {{.Bar}} {{.Name}} ` operator := packages.OperatorFile{} pf := packages.Files{ Templates: templates, Operator: &operator, Params: &paramFile, } verifier := ParametersVerifier{} res := verifier.Verify(&pf) assert.Equal(t, 1, len(res.Warnings)) assert.Equal(t, `parameter "NotUsed" defined but not used.`, res.Warnings[0]) assert.Equal(t, 2, len(res.Errors)) assert.Equal(t, `parameter "Bar" in template foo.yaml is not defined`, res.Errors[0]) assert.Equal(t, `template foo.yaml defines an invalid implicit parameter "Bar"`, res.Errors[1]) }
explode_data.jsonl/44108
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 7275, 9706, 82394, 1155, 353, 8840, 836, 8, 341, 25856, 1669, 3056, 85, 16, 19127, 16, 30269, 515, 197, 197, 63121, 25, 330, 40923, 7115, 197, 197, 63121, 25, 330, 2623, 22743, 7115, 197, 532, 36037, 1703, 1669, 14185, 582...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_etcdRepository_CreateDetectionEvent(t *testing.T) { type tval struct { Timestamp int64 } prefix := "/integration_tests" repo, err := NewEtcdRepository(prefix, etcdEndpoints, log15.New()) if err != nil { t.Fatalf("failed to create etcd repository: %v", err) } r := repo.(*etcdRepository) tests := []struct { name string detectorID string deviceID string timestamp time.Time wantErr bool }{ { name: "basic", detectorID: "xxx-1", deviceID: "ddd-1", timestamp: time.Unix(0, 1000), }, { name: "basic", detectorID: "xxx-2", deviceID: "ddd-2", timestamp: time.Unix(0, 2000), }, { name: "basic", detectorID: "xxx-3", deviceID: "ddd-3", timestamp: time.Unix(0, 3000), }, } for _, test := range tests { tt := test t.Run(tt.name, func(t *testing.T) { if err := r.CreateDetectionEvent(context.Background(), tt.detectorID, tt.deviceID, tt.timestamp); (err != nil) != tt.wantErr { t.Errorf("etcdRepository.CreateDetectionEvent() error = %v, wantErr %v", err, tt.wantErr) } value := &tval{ Timestamp: tt.timestamp.UnixNano(), } assertETCDKeyExists(t, EventKey(prefix, tt.detectorID, tt.deviceID, tt.timestamp), value, &tval{}, r.cli) }) } }
explode_data.jsonl/11279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 595 }
[ 2830, 3393, 45668, 4385, 4624, 34325, 54817, 1556, 1155, 353, 8840, 836, 8, 341, 13158, 259, 831, 2036, 341, 197, 10261, 4702, 526, 21, 19, 198, 197, 532, 3223, 5060, 1669, 3521, 60168, 32509, 698, 17200, 5368, 11, 1848, 1669, 1532, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestBufferedDAG(t *testing.T) { ds := newTestDag() ctx, cancel := context.WithCancel(context.Background()) defer cancel() var bdag DAGService = NewBufferedDAG(ctx, ds) for i := 0; i < 1000; i++ { n := new(EmptyNode) if err := bdag.Add(ctx, n); err != nil { t.Fatal(err) } if _, err := bdag.Get(ctx, n.Cid()); err != nil { t.Fatal(err) } if err := bdag.Remove(ctx, n.Cid()); err != nil { t.Fatal(err) } } }
explode_data.jsonl/47777
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 208 }
[ 2830, 3393, 4095, 291, 35, 1890, 1155, 353, 8840, 836, 8, 341, 83336, 1669, 501, 2271, 35, 351, 741, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 741, 2405, 21486, 351, 79987, 1860, 284, 1532, 4095, 291, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5