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 TestEnvironRun(t *testing.T) { stdout := &bytes.Buffer{} stderr := &bytes.Buffer{} e := &BasicRunner{ dir: "/tmp", env: []string{"A=1"}, stdout: stdout, stderr: stderr, } err := e.Run("/bin/echo", "hello, gke") if assert.NoError(t, err) { assert.Equal(t, "hello, gke\n", stdout.String()) assert.Equal(t, "", stderr.String()) } }
explode_data.jsonl/3142
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 1702, 2772, 6727, 1155, 353, 8840, 836, 8, 341, 6736, 411, 1669, 609, 9651, 22622, 16094, 6736, 615, 1669, 609, 9651, 22622, 31483, 7727, 1669, 609, 15944, 19486, 515, 197, 48532, 25, 262, 3521, 5173, 756, 197, 57538, 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 TestService_Initialize(t *testing.T) { t.Run("success: already initialized", func(t *testing.T) { prov := &protocol.MockProvider{ ServiceMap: map[string]interface{}{ mediator.Coordination: &mockroute.MockMediatorSvc{}, }, } svc, err := New(prov) require.NoError(t, err) require.NoError(t, svc.Initialize(prov)) }) t.Run("fail: provider of wrong type", func(t *testing.T) { prov := "this is not a provider" svc := Service{} err := svc.Initialize(prov) require.Error(t, err) require.Contains(t, err.Error(), "expected provider of type") }) }
explode_data.jsonl/30515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 1860, 62, 9928, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5630, 25, 2669, 17271, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 42947, 1669, 609, 17014, 24664, 5179, 515, 298, 91619, 2227, 25, 2415, 14032, 31344,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPostOnly(t *testing.T) { tt := []struct { methodType string keyword string expectedStatus string expectedStatusCode int }{ {http.MethodPost, "μ•„μ£ΌλŒ€ν•™κ΅μž…κ΅¬", "StatusOK", http.StatusOK}, {http.MethodGet, "μ•„μ£ΌλŒ€ν•™κ΅μž…κ΅¬", "StatusMethodNotAllowed", http.StatusMethodNotAllowed}, {http.MethodPut, "μ•„μ£ΌλŒ€ν•™κ΅μž…κ΅¬", "StatusMethodNotAllowed", http.StatusMethodNotAllowed}, } for _, tc := range tt { rawBody := SearchInput{tc.keyword} jsonBody, err := json.Marshal(rawBody) if err != nil { t.Fatalf("could not parsed json data: %v", err) } reqBody := bytes.NewBufferString(string(jsonBody)) req, err := http.NewRequest(tc.methodType, "localhost:51234/user/search?type=station", reqBody) if err != nil { t.Fatalf("could not created request: %v", err) } rec := httptest.NewRecorder() h := PostOnly(SearchHandler) h(rec, req) res := rec.Result() defer res.Body.Close() if res.StatusCode != tc.expectedStatusCode { t.Fatalf("expected %v; got %v", tc.expectedStatus, res.Status) } } }
explode_data.jsonl/75700
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 463 }
[ 2830, 3393, 4133, 7308, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 42257, 929, 260, 914, 198, 197, 197, 19863, 310, 914, 198, 197, 42400, 2522, 257, 914, 198, 197, 42400, 15872, 526, 198, 197, 59403, 197, 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...
5
func TestMapProxy_ContainsValueWithNonSerializableValue(t *testing.T) { _, err := mp.ContainsValue(student{}) AssertErrorNotNil(t, err, "containsValue did not return an error for nonserializable value") mp.Clear() }
explode_data.jsonl/57053
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 2227, 16219, 62, 23805, 1130, 2354, 8121, 29268, 1130, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10490, 11545, 1130, 39004, 37790, 18017, 1454, 96144, 1155, 11, 1848, 11, 330, 13372, 1130, 1521, 537, 470, 458, 146...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStringToVMDetails(t *testing.T) { response := stringToVMDetails("(us-central-1) app-central-as72") expected := vmDetails{Zone: "us-central-1", Name: "app-central-as72"} assert.Equal(t, expected, response) }
explode_data.jsonl/13300
{ "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, 703, 1249, 53, 6076, 2237, 1155, 353, 8840, 836, 8, 341, 21735, 1669, 914, 1249, 53, 6076, 2237, 31732, 355, 84081, 12, 16, 8, 906, 84081, 32434, 22, 17, 5130, 42400, 1669, 10995, 7799, 90, 15363, 25, 330, 355, 84081, 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
func TestTemplate(t *testing.T) { vm := otto.New() tplFunc := ` var Tpl={}; Tpl.funcs={}; Tpl.funcs.world=function(name){ return name+",world" } Tpl.getTplFuncs=function(){ var rst=[] for (var prop in Tpl.funcs){ if (Tpl.funcs.hasOwnProperty(prop)){ rst.push(prop) } } return rst } ` _, err := vm.Eval(tplFunc) if err != nil { t.Error(err) } tpl := &Template{Otto: vm} tpl = tpl.New() sample := `{{"hello"|world}}` tp, err := tpl.Parse(sample) if err != nil { t.Error(err) } buf := &bytes.Buffer{} err = tp.Execute(buf, nil) if err != nil { t.Error(err) } if buf.String() != "hello,world" { t.Errorf("expected hello,world got %s", buf) } }
explode_data.jsonl/18209
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 7275, 1155, 353, 8840, 836, 8, 341, 54879, 1669, 14147, 983, 7121, 741, 3244, 500, 9626, 1669, 22074, 947, 350, 500, 1165, 2440, 87137, 19449, 82, 1165, 2440, 87137, 19449, 82, 22882, 29486, 3153, 1264, 853, 829, 44056, 1461...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSaveUploadedOpenFailed(t *testing.T) { buf := new(bytes.Buffer) mw := multipart.NewWriter(buf) mw.Close() c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", buf) c.Request.Header.Set("Content-Type", mw.FormDataContentType()) f := &multipart.FileHeader{ Filename: "file", } assert.Error(t, c.SaveUploadedFile(f, "test")) }
explode_data.jsonl/26740
{ "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, 8784, 62061, 5002, 9408, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 501, 23158, 22622, 340, 2109, 86, 1669, 68058, 7121, 6492, 10731, 340, 2109, 86, 10421, 2822, 1444, 11, 716, 1669, 4230, 2271, 1972, 73392, 83, 70334, 7121,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMakeRequestsTagID(t *testing.T) { var w, h int = 300, 250 var width, height int64 = int64(w), int64(h) bidder, buildErr := Builder(openrtb_ext.BidderAMX, config.Adapter{ Endpoint: amxTestEndpoint}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) } type testCase struct { tagID string extAdUnitID string expectedTagID string blankNil bool } tests := []testCase{ {tagID: "tag-id", extAdUnitID: "ext.adUnitID", expectedTagID: "ext.adUnitID", blankNil: false}, {tagID: "tag-id", extAdUnitID: "", expectedTagID: "tag-id", blankNil: false}, {tagID: "tag-id", extAdUnitID: "", expectedTagID: "tag-id", blankNil: true}, {tagID: "", extAdUnitID: "", expectedTagID: "", blankNil: true}, {tagID: "", extAdUnitID: "", expectedTagID: "", blankNil: false}, {tagID: "", extAdUnitID: "ext.adUnitID", expectedTagID: "ext.adUnitID", blankNil: true}, {tagID: "", extAdUnitID: "ext.adUnitID", expectedTagID: "ext.adUnitID", blankNil: false}, } for _, tc := range tests { imp1 := openrtb2.Imp{ ID: "sample_imp_1", Banner: &openrtb2.Banner{ W: &width, H: &height, Format: []openrtb2.Format{ {W: 300, H: 250}, }, }} if tc.extAdUnitID != "" || !tc.blankNil { imp1.Ext = json.RawMessage( fmt.Sprintf(`{"bidder":{"adUnitId":"%s"}}`, tc.extAdUnitID)) } if tc.tagID != "" || !tc.blankNil { imp1.TagID = tc.tagID } inputRequest := openrtb2.BidRequest{ User: &openrtb2.User{}, Imp: []openrtb2.Imp{imp1}, Site: &openrtb2.Site{}, } actualAdapterRequests, err := bidder.MakeRequests(&inputRequest, &adapters.ExtraRequestInfo{}) assert.Len(t, actualAdapterRequests, 1) assert.Empty(t, err) var body openrtb2.BidRequest assert.Nil(t, json.Unmarshal(actualAdapterRequests[0].Body, &body)) assert.Equal(t, tc.expectedTagID, body.Imp[0].TagID) } }
explode_data.jsonl/7172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 833 }
[ 2830, 3393, 8078, 35295, 5668, 915, 1155, 353, 8840, 836, 8, 341, 2405, 289, 11, 305, 526, 284, 220, 18, 15, 15, 11, 220, 17, 20, 15, 198, 2405, 2374, 11, 2608, 526, 21, 19, 284, 526, 21, 19, 3622, 701, 526, 21, 19, 3203, 692,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNonContiguousUndirectedMultiplex(t *testing.T) { g := simple.NewUndirectedGraph() for _, e := range []simple.Edge{ {F: simple.Node(0), T: simple.Node(1)}, {F: simple.Node(4), T: simple.Node(5)}, } { g.SetEdge(e) } func() { defer func() { r := recover() if r != nil { t.Error("unexpected panic with non-contiguous ID range") } }() ModularizeMultiplex(UndirectedLayers{g}, nil, nil, true, nil) }() }
explode_data.jsonl/80621
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 8121, 818, 27029, 19957, 74612, 57251, 2571, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 4285, 7121, 19957, 74612, 11212, 741, 2023, 8358, 384, 1669, 2088, 3056, 22944, 13, 11656, 515, 197, 197, 90, 37, 25, 4285, 21714, 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, 1...
2
func TestValidateLabels(t *testing.T) { cases := []struct { name string labels map[string]string pass bool }{ { name: "happy case", pass: true, }, { name: "reject reserved label", labels: map[string]string{ decorate.Labels()[0]: "anything", }, }, { name: "reject bad label key", labels: map[string]string{ "_underscore-prefix": "annoying", }, }, { name: "reject bad label value", labels: map[string]string{ "whatever": "_private-is-rejected", }, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { switch err := validateLabels(tc.labels); { case err == nil && !tc.pass: t.Error("validation failed to raise an error") case err != nil && tc.pass: t.Errorf("validation should have passed, got: %v", err) } }) } }
explode_data.jsonl/8075
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 17926, 23674, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 95143, 2415, 14032, 30953, 198, 197, 41431, 256, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 565...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteMaterial(t *testing.T) { body := []byte(`{"media_id":"MEDIA_ID"}`) resp := &http.Response{ StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader([]byte(`{"errcode":0,"errmsg":"ok"}`))), } ctrl := gomock.NewController(t) defer ctrl.Finish() client := mock.NewMockHTTPClient(ctrl) client.EXPECT().Do(gomock.AssignableToTypeOf(context.TODO()), http.MethodPost, "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token=ACCESS_TOKEN", body).Return(resp, nil) oa := New("APPID", "APPSECRET") oa.SetClient(wx.WithHTTPClient(client)) err := oa.Do(context.TODO(), "ACCESS_TOKEN", DeleteMaterial("MEDIA_ID")) assert.Nil(t, err) }
explode_data.jsonl/20868
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 278 }
[ 2830, 3393, 6435, 13415, 1155, 353, 8840, 836, 8, 341, 35402, 1669, 3056, 3782, 5809, 4913, 7399, 842, 3252, 80120, 3450, 1, 5541, 692, 34653, 1669, 609, 1254, 12574, 515, 197, 197, 15872, 25, 1758, 52989, 345, 197, 197, 5444, 25, 981...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRegister(t *testing.T) { opts := []grpc.ServerOption{} grpcServer := grpc.NewServer(opts...) server := AuthorizationServer{} h := &Handler{} server.Register(grpcServer, h) if h != server.handler { t.Errorf("want: %v, got: %v", h, server.handler) } grpcServer.Stop() }
explode_data.jsonl/73185
{ "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, 8690, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 3056, 56585, 22997, 5341, 16094, 197, 56585, 5475, 1669, 47900, 7121, 5475, 30885, 31218, 41057, 1669, 30562, 5475, 16094, 9598, 1669, 609, 3050, 16094, 41057, 19983, 35963, 3992,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTermBytes(t *testing.T) { defer func() { if r := recover(); r != nil { debug.PrintStack() t.Fatal("unexpected panic:", r) } }() f, err := os.Open("../../src/term_strz.bin") if err != nil { t.Fatal(err) } s := kaitai.NewStream(f) var r TermBytes err = r.Read(s, &r, &r) if err != nil { t.Fatal(err) } assert.EqualValues(t, []uint8{102, 111, 111}, r.S1) assert.EqualValues(t, []uint8{98, 97, 114}, r.S2) assert.EqualValues(t, []uint8{124, 98, 97, 122, 64}, r.S3) }
explode_data.jsonl/73370
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 241 }
[ 2830, 3393, 17249, 7078, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 743, 435, 1669, 11731, 2129, 435, 961, 2092, 341, 298, 39730, 7918, 4336, 741, 298, 3244, 26133, 445, 53859, 21975, 12147, 435, 340, 197, 197, 532, 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...
2
func TestArgsKeys(t *testing.T) { const SCRIPT = ` function testArgs2(x, y, z) { // Properties of the arguments object are enumerable. return Object.keys(arguments); } testArgs2(1,2).length ` testScript1(SCRIPT, intToValue(2), t) }
explode_data.jsonl/10464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 4117, 8850, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 7527, 1273, 4117, 17, 2075, 11, 379, 11, 1147, 8, 341, 7782, 197, 322, 11831, 315, 279, 5977, 1633, 525, 43942, 624, 7782, 853, 3002, 9123, 30467, 317, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProvider_CreateAccount(t *testing.T) { t.Parallel() now := time.Now() testCases := []struct { name string users []entity.User email string userName string expectedHasErr bool }{ { name: "successfully created account", users: []entity.User{}, email: "alpha@example.com", userName: "Alpha", expectedHasErr: false, }, { name: "account exists", users: []entity.User{ {Email: "alpha@example.com"}, }, email: "alpha@example.com", userName: "Alpha", expectedHasErr: true, }, } for _, testCase := range testCases { testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() fakeUserRepo := repository.NewUserFake(testCase.users) fakeTimer := mdtest.NewTimerFake(now) accountProvider := NewProvider(&fakeUserRepo, fakeTimer) err := accountProvider.CreateAccount(testCase.email, testCase.userName) if testCase.expectedHasErr { mdtest.NotEqual(t, nil, err) isEmailExist, err := fakeUserRepo.IsEmailExist(testCase.email) mdtest.Equal(t, nil, err) mdtest.Equal(t, true, isEmailExist) return } mdtest.Equal(t, nil, err) }) } }
explode_data.jsonl/48016
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 566 }
[ 2830, 3393, 5179, 34325, 7365, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 80922, 1669, 882, 13244, 2822, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 90896, 688, 3056, 2996, 7344, 198, 197, 57549, 68...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadConfig(t *testing.T) { // Parse a valid file that sets a global scrape timeout. This tests whether parsing // an overwritten default field in the global config permanently changes the default. _, err := LoadFile("testdata/global_timeout.good.yml") testutil.Ok(t, err) c, err := LoadFile("testdata/conf.good.yml") testutil.Ok(t, err) expectedConf.original = c.original testutil.Equals(t, expectedConf, c) }
explode_data.jsonl/74670
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 5879, 2648, 1155, 353, 8840, 836, 8, 341, 197, 322, 14775, 264, 2697, 1034, 429, 7289, 264, 3644, 57128, 9632, 13, 1096, 7032, 3425, 22314, 198, 197, 322, 458, 59173, 1638, 2070, 304, 279, 3644, 2193, 30759, 4344, 279, 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...
1
func TestRouterParamOrdering(t *testing.T) { api := []*Route{ {http.MethodGet, "/:a/:b/:c/:id", ""}, {http.MethodGet, "/:a/:id", ""}, {http.MethodGet, "/:a/:e/:id", ""}, } testRouterAPI(t, api) api2 := []*Route{ {http.MethodGet, "/:a/:id", ""}, {http.MethodGet, "/:a/:e/:id", ""}, {http.MethodGet, "/:a/:b/:c/:id", ""}, } testRouterAPI(t, api2) api3 := []*Route{ {http.MethodGet, "/:a/:b/:c/:id", ""}, {http.MethodGet, "/:a/:e/:id", ""}, {http.MethodGet, "/:a/:id", ""}, } testRouterAPI(t, api3) }
explode_data.jsonl/47134
{ "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, 9523, 2001, 4431, 287, 1155, 353, 8840, 836, 8, 341, 54299, 1669, 29838, 4899, 515, 197, 197, 90, 1254, 20798, 1949, 11, 3521, 25, 64, 11315, 65, 11315, 66, 11315, 307, 497, 77496, 197, 197, 90, 1254, 20798, 1949, 11, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDistribute(t *testing.T) { framework.NewTest(t). Run(func(ctx framework.TestContext) { ns := namespace.NewOrFail(ctx, ctx, namespace.Config{ Prefix: "locality-distribute-eds", Inject: true, }) var a, b, c echo.Instance echoboot.NewBuilderOrFail(ctx, ctx). With(&a, echoConfig(ns, "a")). With(&b, echoConfig(ns, "b")). With(&c, echoConfig(ns, "c")). BuildOrFail(ctx) fakeHostname := fmt.Sprintf("fake-eds-external-service-%v.com", r.Int()) // First, deploy across multiple zones deploy(ctx, ctx, ns, serviceConfig{ Name: "distribute-eds", Host: fakeHostname, Namespace: ns.Name(), Resolution: "STATIC", // Add a fake service with no locality to ensure we don't route there NonExistantService: "1.1.1.1", NonExistantServiceLocality: "", ServiceBAddress: b.Address(), ServiceBLocality: "region/zone/subzone", ServiceCAddress: c.Address(), ServiceCLocality: "notregion/notzone/notsubzone", }, a, distributeTemplate) log.Infof("Sending traffic to local service (EDS) via %v", fakeHostname) if err := retry.UntilSuccess(func() error { e := sendTraffic(a, fakeHostname, map[string]int{ "b": 20, "c": 80, }) scopes.Framework.Errorf("%v: ", e) return e }, retry.Timeout(time.Second*5)); err != nil { ctx.Fatal(err) } // Set a to no locality, b to matching locality, and c to non-matching. // Expect all to get even traffic after disabling locality lb. deploy(ctx, ctx, ns, serviceConfig{ Name: "distribute-eds", Host: fakeHostname, Namespace: ns.Name(), Resolution: "STATIC", NonExistantService: a.Address(), NonExistantServiceLocality: "", ServiceBAddress: b.Address(), ServiceBLocality: "region/zone/subzone", ServiceCAddress: c.Address(), ServiceCLocality: "notregion/notzone/notsubzone", }, a, disabledTemplate) log.Infof("Sending without locality enabled traffic to local service (EDS) via %v", fakeHostname) if err := retry.UntilSuccess(func() error { e := sendTraffic(a, fakeHostname, map[string]int{ "a": 33, "b": 33, "c": 33, }) scopes.Framework.Errorf("%v: ", e) return e }, retry.Delay(time.Second*5)); err != nil { ctx.Fatal(err) } }) }
explode_data.jsonl/53172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1157 }
[ 2830, 3393, 35, 80133, 1155, 353, 8840, 836, 8, 341, 1166, 5794, 7121, 2271, 1155, 4292, 197, 85952, 18552, 7502, 12626, 8787, 1972, 8, 341, 298, 84041, 1669, 4473, 7121, 46059, 7502, 11, 5635, 11, 4473, 10753, 515, 571, 10025, 5060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAllServersCache_InvalidateCache(t *testing.T) { srv := &hcloud.Server{ ID: 54321, Name: "cache-hit", PrivateNet: []hcloud.ServerPrivateNet{ { IP: net.ParseIP("10.0.0.3"), }, }, } cacheOps := newAllServersCacheOps(t, srv) tmpl := allServersCacheTestCase{ SetUp: func(t *testing.T, tt *allServersCacheTestCase) { tt.ServerClient. On("All", mock.Anything). Return([]*hcloud.Server{srv}, nil). Times(2) // Perform any cache op to initialize caches if _, err := tt.Cache.ByName(srv.Name); err != nil { t.Fatalf("SetUp: %v", err) } // Invalidate Cache tt.Cache.InvalidateCache() // Perform a second cache lookup if _, err := tt.Cache.ByName(srv.Name); err != nil { t.Fatalf("SetUp: %v", err) } }, Assert: func(t *testing.T, tt *allServersCacheTestCase) { // All must be called twice. This call has happened during the // test SetUp method. tt.ServerClient.AssertNumberOfCalls(t, "All", 2) }, Expected: srv, } runAllServersCacheTests(t, "Cache hit", tmpl, cacheOps) }
explode_data.jsonl/5919
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 466 }
[ 2830, 3393, 2403, 78139, 8233, 25972, 7067, 8233, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 1669, 609, 71, 12361, 22997, 515, 197, 29580, 25, 256, 220, 20, 19, 18, 17, 16, 345, 197, 21297, 25, 330, 9360, 69101, 756, 197, 197, 16787...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListZoneFlavors(t *testing.T) { zoneName := "cn-bj-b" queryArgs := &ListZoneFlavorsArgs{ ZoneName: zoneName, } if res, err := BBC_CLIENT.ListZoneFlavors(queryArgs); err != nil { fmt.Println("Get the specific zone flavor failed: ", err) } else { fmt.Println("Get the specific zone flavor success, result: ", res) } }
explode_data.jsonl/4069
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 127 }
[ 2830, 3393, 852, 15363, 3882, 50485, 1155, 353, 8840, 836, 8, 341, 197, 8684, 675, 1669, 330, 14271, 1455, 73, 1455, 698, 27274, 4117, 1669, 609, 852, 15363, 3882, 50485, 4117, 515, 197, 197, 15363, 675, 25, 10143, 675, 345, 197, 532,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOrdinals(t *testing.T) { testList{ {"0", Ordinal(0), "th"}, {"1", Ordinal(1), "st"}, {"2", Ordinal(2), "nd"}, {"3", Ordinal(3), "rd"}, {"4", Ordinal(4), "th"}, {"10", Ordinal(10), "th"}, {"11", Ordinal(11), "th"}, {"12", Ordinal(12), "th"}, {"13", Ordinal(13), "th"}, {"101", Ordinal(101), "st"}, {"102", Ordinal(102), "nd"}, {"103", Ordinal(103), "rd"}, }.validate(t) }
explode_data.jsonl/14391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 24621, 23695, 1155, 353, 8840, 836, 8, 341, 18185, 852, 515, 197, 197, 4913, 15, 497, 30037, 977, 7, 15, 701, 330, 339, 7115, 197, 197, 4913, 16, 497, 30037, 977, 7, 16, 701, 330, 267, 7115, 197, 197, 4913, 17, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultipleCertificates(t *testing.T) { clientConfig := testConfig.Clone() clientConfig.CipherSuites = []uint16{TLS_RSA_WITH_AES_128_GCM_SHA256} clientConfig.MaxVersion = VersionTLS12 serverConfig := testConfig.Clone() serverConfig.Certificates = []Certificate{{ Certificate: [][]byte{testECDSACertificate}, PrivateKey: testECDSAPrivateKey, }, { Certificate: [][]byte{testRSACertificate}, PrivateKey: testRSAPrivateKey, }} _, clientState, err := testHandshake(t, clientConfig, serverConfig) if err != nil { t.Fatal(err) } if got := clientState.PeerCertificates[0].PublicKeyAlgorithm; got != x509.RSA { t.Errorf("expected RSA certificate, got %v", got) } }
explode_data.jsonl/36358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 259 }
[ 2830, 3393, 32089, 97140, 1155, 353, 8840, 836, 8, 341, 25291, 2648, 1669, 1273, 2648, 64463, 741, 25291, 2648, 727, 10558, 62898, 288, 284, 3056, 2496, 16, 21, 90, 45439, 76994, 23929, 69381, 62, 16, 17, 23, 2646, 9985, 38096, 17, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestYAMLLoader_LoadFile(t *testing.T) { type args struct { filePath string } tests := []struct { name string args args want []map[string]interface{} wantErr bool }{ { name: "load .yaml file", args: args{ filePath: "testdata/testfile.yaml", }, want: testYAMLFile, wantErr: false, }, { name: "load .yml file", args: args{ filePath: "testdata/testfile.yml", }, want: testYMLFile, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { yl := &YAMLLoader{} got, err := yl.LoadFile(tt.args.filePath) if (err != nil) != tt.wantErr { t.Errorf("YAMLLoader.LoadFile() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("YAMLLoader.LoadFile() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/33676
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 439 }
[ 2830, 3393, 56, 1402, 4086, 39966, 19553, 1703, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 17661, 1820, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 5078...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVerifyECSignature(t *testing.T) { t.Parallel() fName := "TestVerifySignature" defer cleanup(fName) writeOldFile(fName, t) opts := Options{TargetPath: fName} err := opts.SetPublicKeyPEM([]byte(ecdsaPublicKey)) if err != nil { t.Fatalf("Could not parse public key: %v", err) } opts.Signature = signec(ecdsaPrivateKey, newFile, t) err = Apply(bytes.NewReader(newFile), opts) validateUpdate(fName, err, t) }
explode_data.jsonl/73987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 32627, 36, 6412, 622, 1568, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1166, 675, 1669, 330, 2271, 32627, 25088, 698, 16867, 21290, 955, 675, 340, 24945, 18284, 1703, 955, 675, 11, 259, 692, 64734, 1669, 14566, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDedupQueueParallel(t *testing.T) { // Make a store that counts the requests to it var requests int64 store := &TestStore{ GetChunkFunc: func(ChunkID) (*Chunk, error) { time.Sleep(time.Millisecond) // make it artificially slow to not complete too early atomic.AddInt64(&requests, 1) return NewChunkFromUncompressed([]byte{0}), nil }, } q := NewDedupQueue(store) var ( wg sync.WaitGroup start = make(chan struct{}) ) // Start several goroutines all asking for the same chunk from the store for i := 0; i < 10; i++ { wg.Add(1) go func() { <-start q.GetChunk(ChunkID{0}) wg.Done() }() } close(start) wg.Wait() // There should ideally be just one requests that was done on the upstream store if requests > 1 { t.Fatalf("%d requests to the store; want 1", requests) } }
explode_data.jsonl/40110
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 322 }
[ 2830, 3393, 35, 291, 454, 7554, 16547, 1155, 353, 8840, 836, 8, 341, 197, 322, 7405, 264, 3553, 429, 14579, 279, 7388, 311, 432, 198, 2405, 7388, 526, 21, 19, 198, 57279, 1669, 609, 2271, 6093, 515, 197, 37654, 28304, 9626, 25, 2915...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRefreshConfig_Http(t *testing.T) { tc := testutils.Setup(t) testutils.LoadFixtures(t, tc.FixturePath()) // user with config:refresh scope user, token, err := tc.UserWithScopes("foo", "config:refresh") assert.Equal(t, user.GithubLogin, "foo") assert.NoError(t, err) // Mocks the time jwt.TimeFunc = testutils.Now // DB is populated using text fixture, so it has by default value `testChecksum` in table config := &model.Config{} err = tc.DB().First(config).Error assert.NoError(t, err) assert.Equal(t, "testChecksum", config.Checksum) RefreshConfigChecker(tc).Test(t, http.MethodPost, "/system/config/refresh"). WithHeader("Authorization", token).Check(). HasStatus(200).Cb(func(r *http.Response) { b, readErr := ioutil.ReadAll(r.Body) assert.NoError(t, readErr) defer r.Body.Close() res := admin.RefreshConfigResult{} marshallErr := json.Unmarshal([]byte(b), &res) assert.NoError(t, marshallErr) // compute checksum of test config file which is reloaded checksum, err := computeChecksum() assert.NoError(t, err) assert.Equal(t, checksum, res.Checksum) scope := model.Scope{Name: "test:scope"} err = tc.DB().Where(&scope).First(&scope).Error assert.NoError(t, err) user := model.User{GithubLogin: "test-user"} err = tc.DB().Where(&user).First(&user).Error assert.NoError(t, err) }) }
explode_data.jsonl/9420
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 519 }
[ 2830, 3393, 14567, 2648, 2039, 1209, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 1273, 6031, 39820, 1155, 340, 18185, 6031, 13969, 25958, 18513, 1155, 11, 17130, 991, 12735, 1820, 12367, 197, 322, 1196, 448, 2193, 25, 17168, 6891, 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...
1
func TestSANInvalidEmail(t *testing.T) { inputPath := "SANWithInvalidEmail.pem" expected := lint.Error out := test.TestLint("e_ext_san_rfc822_format_invalid", inputPath) if out.Status != expected { t.Errorf("%s: expected %s, got %s", inputPath, expected, out.Status) } }
explode_data.jsonl/37737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 106 }
[ 2830, 3393, 68691, 7928, 4781, 1155, 353, 8840, 836, 8, 341, 22427, 1820, 1669, 330, 68691, 2354, 7928, 4781, 49373, 698, 42400, 1669, 57920, 6141, 198, 13967, 1669, 1273, 8787, 47556, 445, 68, 9927, 87866, 1710, 8316, 23, 17, 17, 8955,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeriveKeyInvalid(t *testing.T) { bogusPass := []byte("bogus") if err := key.DeriveKey(&bogusPass); err != ErrInvalidPassword { t.Errorf("unexpected DeriveKey key failure: %v", err) } }
explode_data.jsonl/17472
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 22171, 533, 1592, 7928, 1155, 353, 8840, 836, 8, 341, 2233, 538, 355, 12187, 1669, 3056, 3782, 445, 65, 538, 355, 1138, 743, 1848, 1669, 1376, 909, 261, 533, 1592, 2099, 65, 538, 355, 12187, 1215, 1848, 961, 15495, 7928, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParse_CanceledAccountNotification(t *testing.T) { result := MustParseFile("testdata/canceled_account_notification.xml") if n, ok := result.(*webhooks.AccountNotification); !ok { t.Fatalf("unexpected type: %T, result", n) } else if diff := cmp.Diff(n, &webhooks.AccountNotification{ Type: webhooks.CanceledAccount, Account: webhooks.Account{ XMLName: xml.Name{Local: "account"}, Code: "1", Email: "verena@example.com", FirstName: "Verena", LastName: "Example", }, }); diff != "" { t.Fatal(diff) } }
explode_data.jsonl/76098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 14463, 920, 38392, 7365, 11196, 1155, 353, 8840, 836, 8, 341, 9559, 1669, 15465, 14463, 1703, 445, 92425, 2899, 38392, 13500, 34296, 9028, 1138, 743, 308, 11, 5394, 1669, 1102, 41399, 2911, 38560, 30877, 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 TestCreatePKIAssetsWithSparseCerts(t *testing.T) { for _, test := range certstestutil.GetSparseCertTestCases(t) { t.Run(test.Name, func(t *testing.T) { tmpdir := testutil.SetupTempDir(t) defer os.RemoveAll(tmpdir) cfg := testutil.GetDefaultInternalConfig(t) cfg.ClusterConfiguration.CertificatesDir = tmpdir certstestutil.WritePKIFiles(t, tmpdir, test.Files) err := CreatePKIAssets(cfg) if err != nil { if test.ExpectError { return } t.Fatalf("Unexpected error: %v", err) } if test.ExpectError { t.Fatal("Expected error from CreatePKIAssets, got none") } assertCertsExist(t, tmpdir) }) } }
explode_data.jsonl/60267
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 286 }
[ 2830, 3393, 4021, 22242, 40, 26879, 2354, 98491, 34, 15546, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 2777, 267, 477, 1314, 2234, 98491, 36934, 2271, 37302, 1155, 8, 341, 197, 3244, 16708, 8623, 2967, 11, 2915, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValueBinder_GetValues(t *testing.T) { var testCases = []struct { name string whenValuesFunc func(sourceParam string) []string expect []int64 expectError string }{ { name: "ok, default implementation", expect: []int64{1, 101}, }, { name: "ok, values returns nil", whenValuesFunc: func(sourceParam string) []string { return nil }, expect: []int64(nil), }, { name: "ok, values returns empty slice", whenValuesFunc: func(sourceParam string) []string { return []string{} }, expect: []int64(nil), }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { c := createTestContext("/search?nr=en&id=1&id=101", nil, nil) b := QueryParamsBinder(c) if tc.whenValuesFunc != nil { b.ValuesFunc = tc.whenValuesFunc } var IDs []int64 err := b.Int64s("id", &IDs).BindError() assert.Equal(t, tc.expect, IDs) if tc.expectError != "" { assert.EqualError(t, err, tc.expectError) } else { assert.NoError(t, err) } }) } }
explode_data.jsonl/82534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 1130, 44055, 13614, 6227, 1155, 353, 8840, 836, 8, 341, 2405, 1273, 37302, 284, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 60180, 6227, 9626, 2915, 12437, 2001, 914, 8, 3056, 917, 198, 197, 24952, 260, 3056, 396, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadRegions(t *testing.T) { mockDB, mock, err := sqlmock.New() if err != nil { t.Fatalf("an error '%s' was not expected when opening a stub database connection", err) } defer mockDB.Close() db := sqlx.NewDb(mockDB, "sqlmock") defer db.Close() testRegions := getTestRegions() cols := test.ColsFromStructByTag("db", tc.Region{}) rows := sqlmock.NewRows(cols) for _, ts := range testRegions { rows = rows.AddRow( ts.Division, ts.ID, ts.LastUpdated, ts.Name, ) } mock.ExpectBegin() mock.ExpectQuery("SELECT").WillReturnRows(rows) mock.ExpectCommit() reqInfo := api.APIInfo{Tx: db.MustBegin(), Params: map[string]string{"id": "1"}} obj := TORegion{ api.APIInfoImpl{&reqInfo}, tc.Region{}, } regions, userErr, sysErr, _, _ := obj.Read(nil, false) if userErr != nil || sysErr != nil { t.Errorf("Read expected: no errors, actual: %v %v", userErr, sysErr) } if len(regions) != 2 { t.Errorf("region.Read expected: len(regions) == 2, actual: %v", len(regions)) } }
explode_data.jsonl/46892
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 431 }
[ 2830, 3393, 4418, 79284, 1155, 353, 8840, 836, 8, 1476, 77333, 3506, 11, 7860, 11, 1848, 1669, 5704, 16712, 7121, 741, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 276, 1465, 7677, 82, 6, 572, 537, 3601, 979, 8568, 264, 13633, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScheduleNextRunFromNow(t *testing.T) { now := time.Now() sched := NewScheduler() sched.ChangeLoc(time.UTC) job := sched.Every(1).Hour().From(NextTick()) job.Do(task) next := job.NextScheduledTime() nextRounded := time.Date(next.Year(), next.Month(), next.Day(), next.Hour(), next.Minute(), next.Second(), 0, time.UTC) expected := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second(), 0, time.UTC).Add(time.Second) assert.Exactly(t, expected, nextRounded) }
explode_data.jsonl/63496
{ "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, 32210, 5847, 6727, 3830, 7039, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 882, 13244, 2822, 1903, 2397, 1669, 1532, 38878, 741, 1903, 2397, 39348, 9152, 9730, 87069, 692, 68577, 1669, 5575, 5142, 1204, 7, 16, 568, 30254, 100...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdd(t *testing.T) { var e1, e2 float32 e := createRandomObject(e1) if v, ok := e.(float32); ok { e1 = v } e = createRandomObject(e2) if v, ok := e.(float32); ok { e2 = v } s := New() s.Add(e1) s.Add(e2) if len(s.m) != 2 { t.Errorf("expected 2 entries, got %d", len(s.m)) } }
explode_data.jsonl/35003
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 2212, 1155, 353, 8840, 836, 8, 341, 2405, 384, 16, 11, 384, 17, 2224, 18, 17, 198, 7727, 1669, 1855, 13999, 1190, 2026, 16, 340, 743, 348, 11, 5394, 1669, 384, 12832, 3649, 18, 17, 1215, 5394, 341, 197, 7727, 16, 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...
4
func TestKazaamNoTransform(t *testing.T) { jsonOut := `{"rating":{"example":{"value":3},"primary":{"value":3}}}` var spec string kazaamTransform, _ := kazaam.NewKazaam(spec) kazaamOut, _ := kazaamTransform.TransformJSONStringToString(testJSONInput) areEqual, _ := checkJSONStringsEqual(kazaamOut, jsonOut) if !areEqual { t.Error("Transformed data does not match expectation.") t.Log("Expected: ", jsonOut) t.Log("Actual: ", kazaamOut) t.FailNow() } }
explode_data.jsonl/11854
{ "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, 42, 12707, 309, 2753, 8963, 1155, 353, 8840, 836, 8, 341, 30847, 2662, 1669, 1565, 4913, 21931, 22317, 8687, 22317, 957, 788, 18, 51193, 6545, 22317, 957, 788, 18, 3417, 31257, 2405, 1398, 914, 271, 16463, 12707, 309, 8963, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildsExportError(t *testing.T) { testClient(t, func(e *cli.Engine, i *mocksdk.Interface) { i.On("BuildExport", "app1", "build1", mock.Anything).Return(fmt.Errorf("err1")) res, err := testExecute(e, "builds export build1 -a app1 -f /dev/null", nil) require.NoError(t, err) require.Equal(t, 1, res.Code) res.RequireStderr(t, []string{"ERROR: err1"}) res.RequireStdout(t, []string{"Exporting build... "}) }) }
explode_data.jsonl/65793
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 11066, 82, 16894, 1454, 1155, 353, 8840, 836, 8, 341, 18185, 2959, 1155, 11, 2915, 2026, 353, 19521, 54424, 11, 600, 353, 16712, 51295, 41065, 8, 341, 197, 8230, 8071, 445, 11066, 16894, 497, 330, 676, 16, 497, 330, 5834, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEvalIssetAndTernaryExpression(t *testing.T) { var data = make(VarMap) data.Set("title", "title") RunJetTest(t, nil, nil, "IssetExpression_1", `{{isset(value)}}`, "false") RunJetTest(t, data, nil, "IssetExpression_2", `{{isset(title)}}`, "true") user := &User{ "JosΓ© Santos", "email@example.com", } RunJetTest(t, nil, user, "IssetExpression_3", `{{isset(.Name)}}`, "true") RunJetTest(t, nil, user, "IssetExpression_4", `{{isset(.Names)}}`, "false") RunJetTest(t, data, user, "IssetExpression_5", `{{isset(title)}}`, "true") RunJetTest(t, data, user, "IssetExpression_6", `{{isset(title.Get)}}`, "false") RunJetTest(t, nil, user, "TernaryExpression_4", `{{isset(.Names)?"All names":"no names"}}`, "no names") RunJetTest(t, nil, user, "TernaryExpression_5", `{{isset(.Name)?"All names":"no names"}}`, "All names") RunJetTest(t, data, user, "TernaryExpression_6", `{{ isset(form) ? form.Get("value") : "no form" }}`, "no form") }
explode_data.jsonl/22898
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 395 }
[ 2830, 3393, 54469, 3872, 746, 3036, 51, 932, 658, 9595, 1155, 353, 8840, 836, 8, 341, 2405, 821, 284, 1281, 7, 3962, 2227, 340, 8924, 4202, 445, 2102, 497, 330, 2102, 1138, 85952, 35641, 2271, 1155, 11, 2092, 11, 2092, 11, 330, 3872...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_InWithInput(t *testing.T) { expected := []byte(foo) actual, err := cmder.New(cat).In([]byte(foo)...).Output() if err != nil { t.Error(err) } msg := fmt.Sprintf("Expected %s. Got %s.", expected, actual) assert.Equal(t, expected, actual, msg) }
explode_data.jsonl/70661
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 25972, 2354, 2505, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 3056, 3782, 71880, 692, 88814, 11, 1848, 1669, 9961, 1107, 7121, 53600, 568, 641, 10556, 3782, 71880, 39025, 568, 5097, 741, 743, 1848, 961, 2092, 341, 197, 3244,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriterPersistentError(t *testing.T) { t.Parallel() d, err := ioutil.ReadFile("testdata/Isaac.Newton-Opticks.txt") if err != nil { t.Fatalf("ReadFile: %v", err) } d = d[:10000] // Keep this test short zw, err := NewWriter(nil, DefaultCompression) if err != nil { t.Fatalf("NewWriter: %v", err) } // Sweep over the threshold at which an error is returned. // The variable i makes it such that the ith call to failWriter.Write will // return errIO. Since failWriter errors are not persistent, we must ensure // that flate.Writer errors are persistent. for i := 0; i < 1000; i++ { fw := &failWriter{i} zw.Reset(fw) _, werr := zw.Write(d) cerr := zw.Close() if werr != errIO && werr != nil { t.Errorf("test %d, mismatching Write error: got %v, want %v", i, werr, errIO) } if cerr != errIO && fw.n < 0 { t.Errorf("test %d, mismatching Close error: got %v, want %v", i, cerr, errIO) } if fw.n >= 0 { // At this point, the failure threshold was sufficiently high enough // that we wrote the whole stream without any errors. return } } }
explode_data.jsonl/81414
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 6492, 53194, 1454, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2698, 11, 1848, 1669, 43144, 78976, 445, 92425, 14, 3872, 64705, 7121, 777, 12, 21367, 5788, 3909, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClusterConfig_translateAddressAndPort_Success(t *testing.T) { cfg := NewCluster() cfg.AddressTranslator = staticAddressTranslator(net.ParseIP("10.10.10.10"), 5432) newAddr, newPort := cfg.translateAddressPort(net.ParseIP("10.0.0.1"), 2345) assertTrue(t, "translated address", net.ParseIP("10.10.10.10").Equal(newAddr)) assertEqual(t, "translated port", 5432, newPort) }
explode_data.jsonl/36657
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 28678, 2648, 66381, 4286, 3036, 7084, 87161, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 1532, 28678, 741, 50286, 26979, 51653, 284, 1099, 4286, 51653, 30723, 8937, 3298, 445, 16, 15, 13, 16, 15, 13, 16, 15, 13, 16, 15, 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 TestRuntimeRegisterRPCWithPayloadEndToEnd(t *testing.T) { modules := map[string]string{ "test": ` test={} -- Get the mean value of a table function test.printWorld(ctx, payload) print("Hello World") print(ctx.ExecutionMode) return payload end print("Test Module Loaded") return test`, "http-invoke": ` local nakama = require("nakama") local test = require("test") nakama.register_rpc(test.printWorld, "helloworld")`, } runtime, err := runtimeWithModules(t, modules) if err != nil { t.Fatal(err.Error()) } db := NewDB(t) pipeline := server.NewPipeline(logger, config, db, jsonpbMarshaler, jsonpbUnmarshaler, nil, nil, nil, nil, nil, runtime) apiServer := server.StartApiServer(logger, logger, db, jsonpbMarshaler, jsonpbUnmarshaler, config, nil, nil, nil, nil, nil, nil, nil, nil, pipeline, runtime) defer apiServer.Stop() payload := "\"Hello World\"" client := &http.Client{} request, _ := http.NewRequest("POST", "http://localhost:7350/v2/rpc/helloworld?http_key=defaulthttpkey", strings.NewReader(payload)) request.Header.Add("Content-Type", "Application/JSON") res, err := client.Do(request) if err != nil { t.Fatal(err) } b, err := ioutil.ReadAll(res.Body) if err != nil { t.Fatal(err) } if string(b) != "{\"payload\":"+payload+"}" { t.Fatal("Invocation failed. Return result not expected: ", string(b)) } }
explode_data.jsonl/59781
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 504 }
[ 2830, 3393, 15123, 8690, 29528, 2354, 29683, 3727, 66573, 1155, 353, 8840, 836, 8, 341, 42228, 2425, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 1944, 788, 22074, 1944, 58627, 313, 2126, 279, 3076, 897, 315, 264, 1965, 198, 1688, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNUpCommand(t *testing.T) { for _, tt := range []struct { msg string inFiles []string outFile string selectedPages []string desc string n int isImg bool }{ {"TestNUpFromPDF", []string{filepath.Join(inDir, "Acroforms2.pdf")}, filepath.Join(outDir, "Acroforms2.pdf"), nil, "", 4, false}, {"TestNUpFromSingleImage", []string{filepath.Join(resDir, "pdfchip3.png")}, filepath.Join(outDir, "out.pdf"), nil, "f:A3L", 9, true}, {"TestNUpFromImages", []string{ filepath.Join(resDir, "pdfchip3.png"), filepath.Join(resDir, "demo.png"), filepath.Join(resDir, "snow.jpg"), }, filepath.Join(outDir, "out1.pdf"), nil, "f:Tabloid, b:off, m:0", 6, true}, } { testNUp(t, tt.msg, tt.inFiles, tt.outFile, tt.selectedPages, tt.desc, tt.n, tt.isImg) } }
explode_data.jsonl/3276
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 45, 2324, 4062, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 21169, 1843, 914, 198, 197, 17430, 10809, 981, 3056, 917, 198, 197, 13967, 1703, 981, 914, 198, 197, 70631, 17713, 3056, 91...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuntime_TextCanary(t *testing.T) { // test that it can make a simple text request // and get the response for it. result := "1: task 1 content; 2: task 2 content" server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { rw.Header().Add(httpkit.HeaderContentType, httpkit.TextMime) rw.WriteHeader(http.StatusOK) rw.Write([]byte(result)) })) defer server.Close() rwrtr := client.RequestWriterFunc(func(req client.Request, _ strfmt.Registry) error { return nil }) hu, _ := url.Parse(server.URL) runtime := New(hu.Host, "/", []string{"http"}) res, err := runtime.Submit(&client.Operation{ ID: "getTasks", Method: "GET", PathPattern: "/", Params: rwrtr, Reader: client.ResponseReaderFunc(func(response client.Response, consumer httpkit.Consumer) (interface{}, error) { if response.Code() == 200 { var result string if err := consumer.Consume(response.Body(), &result); err != nil { return nil, err } return result, nil } return nil, errors.New("Generic error") }), }) if assert.NoError(t, err) { assert.IsType(t, "", res) actual := res.(string) assert.EqualValues(t, result, actual) } }
explode_data.jsonl/53819
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 470 }
[ 2830, 3393, 15123, 20550, 6713, 658, 1155, 353, 8840, 836, 8, 341, 197, 322, 1273, 429, 432, 646, 1281, 264, 4285, 1467, 1681, 198, 197, 322, 323, 633, 279, 2033, 369, 432, 624, 9559, 1669, 330, 16, 25, 3383, 220, 16, 2213, 26, 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 TestIgnoreDeletionMarkFilter_Filter(t *testing.T) { objtesting.ForeachStore(t, func(t *testing.T, bkt objstore.Bucket) { ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() now := time.Now() f := &IgnoreDeletionMarkFilter{ logger: log.NewNopLogger(), bkt: objstore.WithNoopInstr(bkt), delay: 48 * time.Hour, } shouldFetch := &metadata.DeletionMark{ ID: ULID(1), DeletionTime: now.Add(-15 * time.Hour).Unix(), Version: 1, } shouldIgnore := &metadata.DeletionMark{ ID: ULID(2), DeletionTime: now.Add(-60 * time.Hour).Unix(), Version: 1, } var buf bytes.Buffer testutil.Ok(t, json.NewEncoder(&buf).Encode(&shouldFetch)) testutil.Ok(t, bkt.Upload(ctx, path.Join(shouldFetch.ID.String(), metadata.DeletionMarkFilename), &buf)) testutil.Ok(t, json.NewEncoder(&buf).Encode(&shouldIgnore)) testutil.Ok(t, bkt.Upload(ctx, path.Join(shouldIgnore.ID.String(), metadata.DeletionMarkFilename), &buf)) testutil.Ok(t, bkt.Upload(ctx, path.Join(ULID(3).String(), metadata.DeletionMarkFilename), bytes.NewBufferString("not a valid deletion-mark.json"))) input := map[ulid.ULID]*metadata.Meta{ ULID(1): {}, ULID(2): {}, ULID(3): {}, ULID(4): {}, } expected := map[ulid.ULID]*metadata.Meta{ ULID(1): {}, ULID(3): {}, ULID(4): {}, } m := newTestFetcherMetrics() testutil.Ok(t, f.Filter(ctx, input, m.synced)) testutil.Equals(t, 1.0, promtest.ToFloat64(m.synced.WithLabelValues(markedForDeletionMeta))) testutil.Equals(t, expected, input) }) }
explode_data.jsonl/67642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 705 }
[ 2830, 3393, 12497, 1912, 52625, 8949, 5632, 68935, 1155, 353, 8840, 836, 8, 341, 22671, 8840, 991, 8539, 6093, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 293, 5840, 2839, 4314, 1785, 11152, 8, 341, 197, 20985, 11, 9121, 1669, 2266, 261...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreate(t *testing.T) { simpleStorage := &SimpleRESTStorage{} handler := New(map[string]RESTStorage{ "foo": simpleStorage, }, "/prefix/version") server := httptest.NewServer(handler) client := http.Client{} simple := Simple{Name: "foo"} data, _ := api.Encode(simple) request, err := http.NewRequest("POST", server.URL+"/prefix/version/foo", bytes.NewBuffer(data)) expectNoError(t, err) response, err := client.Do(request) expectNoError(t, err) if response.StatusCode != http.StatusAccepted { t.Errorf("Unexpected response %#v", response) } var itemOut api.Status body, err := extractBody(response, &itemOut) expectNoError(t, err) if itemOut.Status != api.StatusWorking || itemOut.Details == "" { t.Errorf("Unexpected status: %#v (%s)", itemOut, string(body)) } }
explode_data.jsonl/30464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 4021, 1155, 353, 8840, 836, 8, 341, 1903, 6456, 5793, 1669, 609, 16374, 38307, 5793, 16094, 53326, 1669, 1532, 9147, 14032, 60, 38307, 5793, 515, 197, 197, 1, 7975, 788, 4285, 5793, 345, 197, 2137, 3521, 11849, 64413, 1138, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCachedChartsRefreshChart(t *testing.T) { // Stubs Download and processing DownloadAndExtractChartTarballOrig := charthelper.DownloadAndExtractChartTarball defer func() { charthelper.DownloadAndExtractChartTarball = DownloadAndExtractChartTarballOrig }() charthelper.DownloadAndExtractChartTarball = func(chart *swaggermodels.ChartPackage, repoURL string) error { return nil } DownloadAndProcessChartIconOrig := charthelper.DownloadAndProcessChartIcon defer func() { charthelper.DownloadAndProcessChartIcon = DownloadAndProcessChartIconOrig }() charthelper.DownloadAndProcessChartIcon = func(chart *swaggermodels.ChartPackage) error { return nil } err := chartsImplementation.RefreshChart("stable", "datadog") assert.NoErr(t, err) }
explode_data.jsonl/37973
{ "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, 70293, 64878, 14567, 14488, 1155, 353, 8840, 836, 8, 341, 197, 322, 794, 15738, 8577, 323, 8692, 198, 197, 11377, 3036, 28959, 14488, 62733, 3959, 62726, 1669, 1161, 339, 2947, 61204, 3036, 28959, 14488, 62733, 3959, 198, 1686...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimpleAddSettleWorkflow(t *testing.T) { t.Parallel() for _, tweakless := range []bool{true, false} { tweakless := tweakless t.Run(fmt.Sprintf("tweakless=%v", tweakless), func(t *testing.T) { testAddSettleWorkflow(t, tweakless) }) } }
explode_data.jsonl/72453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 106 }
[ 2830, 3393, 16374, 2212, 1649, 11239, 62768, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2023, 8358, 51043, 1717, 1669, 2088, 3056, 2641, 90, 1866, 11, 895, 92, 341, 197, 3244, 13150, 1717, 1669, 51043, 1717, 198, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFilterChain(t *testing.T) { fc := FilterChain{} // If there are no filters then we keep by default assert.True(t, fc.Want(&msg1)) assert.True(t, fc.Want(&msg2)) fc.AddFilter(FilterByTransport([]string{"kernel", "syslog", "stdout"})) assert.True(t, fc.Want(&msg1)) assert.False(t, fc.Want(&msg2)) fc = FilterChain{} assert.True(t, fc.Want(&msg1)) assert.True(t, fc.Want(&msg2)) fc.AddFilter(ExcludeBySystemDUnit([]string{"test.service"})) assert.True(t, fc.Want(&msg1)) assert.True(t, fc.Want(&msg2)) assert.False(t, fc.Want(&msg3)) }
explode_data.jsonl/64625
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 235 }
[ 2830, 3393, 5632, 18837, 1155, 353, 8840, 836, 8, 341, 1166, 66, 1669, 12339, 18837, 31483, 197, 322, 1416, 1052, 525, 902, 13406, 1221, 582, 2506, 553, 1638, 198, 6948, 32443, 1155, 11, 25563, 1175, 517, 2099, 3236, 16, 1171, 6948, 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 TestEventPage_GetAllEventResults_EventQuery(t *testing.T) { s := graphql.NewMockSubServer(t, graphql.AddVarNamesToQuery(eventQuerySubscription, Query, Metadata, Options), map[string]interface{}{Query: "query", Metadata: nil, Options: nil}, &eventQueryResult{EventQueryResults: testEventQueryResultsOne}, &eventQueryResult{EventQueryResults: testEventQueryResultsTwo}, &eventQueryResult{EventQueryResults: testEventQueryResultsThree}, //Result with RUNNING status &eventQueryResult{EventQueryResults: testClosureEventQueryResult}, //testClosureEventQueryResult is the signal that all events have been returned. (what the sdk will return in a live situation) ) defer s.Close() svc := New(s.URL, client.WithHTTPTimeout(5*time.Second)) sub, err := svc.EventQuery(context.Background(), "query", nil, nil) require.NoError(t, err) defer sub.Close() c, next, err := sub.GetAllEventResults(context.Background()) require.NoError(t, err) expectedData, err := json.Marshal(Results{testEventQueryResultsOne, testEventQueryResultsTwo}) require.NoError(t, err) actualData, err := json.Marshal(c) require.JSONEq(t, string(expectedData), string(actualData)) require.Equal(t, &testNextPage, next) }
explode_data.jsonl/36559
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 385 }
[ 2830, 3393, 1556, 2665, 13614, 2403, 1556, 9801, 39354, 2859, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 48865, 7121, 11571, 3136, 5475, 1155, 345, 197, 197, 38294, 1904, 3962, 7980, 1249, 2859, 6235, 2859, 33402, 11, 11361, 11, 33589, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigurableService(t *testing.T) { p := getProgram("serviceable", "1.0") operator := getTestOperator(t, downloadPath, installPath, p) if err := operator.start(p, nil); err != nil { t.Fatal(err) } defer operator.stop(p) // failure catch, to ensure no sub-process stays running // emulating a service, so we need to start the binary here in the test spec := p.Spec() cmd := exec.Command(spec.BinaryPath, fmt.Sprintf("%d", p.ServicePort())) cmd.Env = append(cmd.Env, os.Environ()...) cmd.Dir = filepath.Dir(spec.BinaryPath) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd.Start(); err != nil { t.Fatal(err) } waitFor(t, func() error { items := operator.State() item, ok := items[p.ID()] if !ok { return fmt.Errorf("no state for process") } if item.Status != state.Running { return fmt.Errorf("process never went to running") } return nil }) // try to configure cfg := make(map[string]interface{}) tstFilePath := filepath.Join(os.TempDir(), fmt.Sprintf("tmp%d", rand.Uint32())) cfg["TestFile"] = tstFilePath if err := operator.pushConfig(p, cfg); err != nil { t.Fatalf("failed to config: %v", err) } waitFor(t, func() error { if s, err := os.Stat(tstFilePath); err != nil || s == nil { return fmt.Errorf("failed to create a file using Config call %s", tstFilePath) } return nil }) items := operator.State() item0, ok := items[p.ID()] if !ok || item0.Status != state.Running { t.Fatalf("Process no longer running after config %#v", items) } // stop the process if err := operator.stop(p); err != nil { t.Fatalf("Failed to stop service: %v", err) } if err := cmd.Wait(); err != nil { t.Fatalf("Process failed: %v", err) } }
explode_data.jsonl/38848
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 657 }
[ 2830, 3393, 2648, 18329, 1860, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 633, 10690, 445, 7936, 480, 497, 330, 16, 13, 15, 5130, 83041, 1669, 633, 2271, 18461, 1155, 11, 4139, 1820, 11, 4582, 1820, 11, 281, 340, 743, 1848, 1669, 567...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommandWithEnvToKeep(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } options := DefaultAttachOptions options.ClearEnv = true options.EnvToKeep = []string{"TERM"} args := []string{"/bin/sh", "-c", fmt.Sprintf("test $TERM = '%s'", os.Getenv("TERM"))} ok, err := c.RunCommand(args, DefaultAttachOptions) if err != nil { t.Errorf(err.Error()) } if ok != true { t.Errorf("Expected success") } }
explode_data.jsonl/2796
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 4062, 2354, 14359, 1249, 19434, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 3964, 6141, 2398, 197, 630, 35500, 1669, 7899, 30485, 3798, 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...
4
func TestClient_RawBulkLookup(t *testing.T) { server := testBulkHTTPServer() defer func() { server.CloseClientConnections() server.Close() }() client := &Client{ c: newHTTPClient(), e: "http://127.0.0.1:9085/", } tests := []struct { name string ips []string setKey string serverURL string wantStatus int wantBody string err string }{ { name: "no_api_key", err: "error building bulk lookup request: apiKey cannot be an empty string", }, { name: "no_ips", setKey: "badAPIkey", err: "error building bulk lookup request: must provide at least one IP", }, { name: "bad_host", ips: []string{"1.1.1.1", "8.8.8.8"}, err: `http request to "http://127.0.0.1:9085/bulk" failed: Post http://127.0.0.1:9085/bulk?api-key=badAPIkey: dial tcp 127.0.0.1:9085: connect: connection refused`, }, { name: "bad_api_key", ips: []string{"1.1.1.1", "8.8.8.8"}, serverURL: server.URL + "/", err: `You have either exceeded your quota or that API key does not exist. Get a free API Key at https://ipdata.co/registration.html or contact support@ipdata.co to upgrade or register for a paid plan at https://ipdata.co/pricing.html.`, }, { name: "bad_json", ips: []string{"1.1.1.1", "8.8.4.4"}, setKey: "testAPIkey", err: `request failed (unexpected response): 403 Forbidden: invalid character 'i' looking for beginning of object key string`, }, { name: "good_ips", ips: []string{"1.1.1.1", "8.8.8.8"}, wantStatus: 200, wantBody: testBulkJSONValid, }, { name: "good_ips_with_localhost", ips: []string{"1.1.1.1", "8.8.8.8", "127.0.0.1"}, wantStatus: 200, wantBody: testBulkJSONWithLocalhost, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if tt.setKey != "" { client.k = tt.setKey } if tt.serverURL != "" { client.e = tt.serverURL } got, err := client.RawBulkLookup(tt.ips) if cont := testErrCheck(t, "client.RawBulkLookup()", tt.err, err); !cont { return } defer func() { _, _ = io.Copy(ioutil.Discard, got.Body) _ = got.Body.Close() }() if got.StatusCode != tt.wantStatus { t.Fatalf("got.StatusCode = %d, want %d", got.StatusCode, tt.wantStatus) } body, err := ioutil.ReadAll(got.Body) testErrCheck(t, "ioutil.ReadAll()", "", err) if b := string(body); b != tt.wantBody { t.Fatalf("got.Body = %q, want %q", b, tt.wantBody) } }) } }
explode_data.jsonl/76429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1173 }
[ 2830, 3393, 2959, 2568, 672, 88194, 34247, 1155, 353, 8840, 836, 8, 341, 41057, 1669, 1273, 88194, 9230, 5475, 2822, 16867, 2915, 368, 341, 197, 41057, 10421, 2959, 54751, 741, 197, 41057, 10421, 741, 197, 66816, 25291, 1669, 609, 2959, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_underscore_arrays_3(t *testing.T) { tt(t, func() { test, _ := test_() test(` test("last", function() { equal(_.last([1,2,3]), 3, 'can pull out the last element of an array'); equal(_.last([1,2,3], 0).join(', '), "", 'can pass an index to last'); equal(_.last([1,2,3], 2).join(', '), '2, 3', 'can pass an index to last'); equal(_.last([1,2,3], 5).join(', '), '1, 2, 3', 'can pass an index to last'); var result = (function(){ return _(arguments).last(); })(1, 2, 3, 4); equal(result, 4, 'works on an arguments object'); result = _.map([[1,2,3],[1,2,3]], _.last); equal(result.join(','), '3,3', 'works well with _.map'); equal(_.last(null), undefined, 'handles nulls'); }); `) }) }
explode_data.jsonl/68897
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 62, 53933, 68983, 62, 18, 1155, 353, 8840, 836, 8, 972, 3244, 83, 1155, 11, 2915, 368, 972, 197, 18185, 11, 716, 1669, 1273, 62, 18005, 197, 18185, 5809, 319, 220, 1273, 445, 4259, 497, 729, 368, 972, 262, 6144, 27191, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Ajax(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.NextPage(), `<a class="GPageLink" href="javascript:LoadPage('/user/list/3')" title="">></a>`) t.Assert(page.PrevPage(), `<a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title=""><</a>`) t.Assert(page.FirstPage(), `<a class="GPageLink" href="javascript:LoadPage('/user/list/1')" title="">|<</a>`) t.Assert(page.LastPage(), `<a class="GPageLink" href="javascript:LoadPage('/user/list/5')" title="">>|</a>`) t.Assert(page.PageBar(), `<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>`) }) }
explode_data.jsonl/55798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 413 }
[ 2830, 3393, 1566, 14518, 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, 2708...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTx_CopyFile_Error_Normal(t *testing.T) { db := MustOpenDB() defer db.MustClose() if err := db.Update(func(tx *bolt.Tx) error { b, err := tx.CreateBucket([]byte("widgets")) if err != nil { t.Fatal(err) } if err := b.Put([]byte("foo"), []byte("bar")); err != nil { t.Fatal(err) } if err := b.Put([]byte("baz"), []byte("bat")); err != nil { t.Fatal(err) } return nil }); err != nil { t.Fatal(err) } if err := db.View(func(tx *bolt.Tx) error { return tx.Copy(&failWriter{3 * db.Info().PageSize}) }); err == nil || err.Error() != "error injected for tests" { t.Fatalf("unexpected error: %v", err) } }
explode_data.jsonl/1704
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 31584, 77637, 1703, 28651, 74900, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 15465, 5002, 3506, 741, 16867, 2927, 50463, 7925, 741, 743, 1848, 1669, 2927, 16689, 18552, 27301, 353, 52433, 81362, 8, 1465, 341, 197, 2233, 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...
4
func TestFindAllStringSubmatchIndex(t *testing.T) { for _, test := range findTests { testFindAllSubmatchIndex(&test, MustCompile(test.pat).FindAllStringSubmatchIndex(test.text, -1), t) } }
explode_data.jsonl/55099
{ "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, 9885, 2403, 703, 3136, 6347, 1552, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 1477, 18200, 341, 197, 18185, 9885, 2403, 3136, 6347, 1552, 2099, 1944, 11, 15465, 46126, 8623, 96534, 568, 9885, 2403, 703, 3136...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewOpenFSFile(t *testing.T) { tf, err := ioutil.TempFile("", testTempPattern) require.NoError(t, err) defer tf.Close() f := newOpenFSFile(tf.Name(), tf) require.NotNil(t, f) assert.Equal(t, tf.Name(), f.fullPath) assert.Equal(t, tf, f.f) }
explode_data.jsonl/21330
{ "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, 3564, 5002, 8485, 1703, 1155, 353, 8840, 836, 8, 341, 3244, 69, 11, 1848, 1669, 43144, 65009, 1703, 19814, 1273, 12151, 15760, 340, 17957, 35699, 1155, 11, 1848, 340, 16867, 6409, 10421, 2822, 1166, 1669, 501, 5002, 8485, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVppArpTerminationTableEntryMacError(t *testing.T) { ctx, bdHandler, _ := bdTestSetup(t) defer ctx.TeardownTestCtx() ctx.MockVpp.MockReply(&vpp_l2.BdIPMacAddDelReply{}) err := bdHandler.AddArpTerminationTableEntry(4, "in:va:li:d:ma:c", "192.168.4.4") Expect(err).Should(HaveOccurred()) err = bdHandler.RemoveArpTerminationTableEntry(4, "in:va:li:d:ma:c", "192.168.4.4") Expect(err).Should(HaveOccurred()) }
explode_data.jsonl/12048
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 53, 602, 6953, 79, 21209, 32096, 2556, 5874, 19552, 1454, 1155, 353, 8840, 836, 8, 341, 20985, 11, 21486, 3050, 11, 716, 1669, 21486, 2271, 21821, 1155, 340, 16867, 5635, 94849, 37496, 2271, 23684, 2822, 20985, 24664, 53, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestActionModTransportPort(t *testing.T) { var tests = []struct { desc string a Action out string }{ { desc: "destination port OK", a: ModTransportDestinationPort(65535), out: "mod_tp_dst:65535", }, { desc: "source port OK", a: ModTransportSourcePort(65535), out: "mod_tp_src:65535", }, } for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { action, _ := tt.a.MarshalText() if want, got := tt.out, string(action); want != got { t.Fatalf("unexpected Action:\n- want: %q\n- got: %q", want, got) } }) } }
explode_data.jsonl/49511
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 2512, 4459, 27560, 7084, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 41653, 914, 198, 197, 11323, 262, 5586, 198, 197, 13967, 220, 914, 198, 197, 59403, 197, 197, 515, 298, 41653, 25, 330, 17997, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetRule(t *testing.T) { client := NewTestClientForDebug() args := &SetRuleArgs{ RegionId: common.Beijing, RuleId: "rule-2zexlb2k7fybx", VServerGroupId: "rsp-2zef5v6xvfyug", } err := client.SetRule(args) if err != nil { t.Fatalf("failed to set rule error %++v", err) } t.Logf("set rule ok") }
explode_data.jsonl/66889
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 1649, 11337, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 1532, 2271, 2959, 2461, 7939, 2822, 31215, 1669, 609, 1649, 11337, 4117, 515, 197, 197, 14091, 764, 25, 981, 4185, 70923, 23649, 345, 197, 11143, 1111, 764, 25, 260, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenericEndpoint_loadKubernetesSecrets(t *testing.T) { loader := &FakeSecretLoader{} tests := []struct { name string creds genericEndpointCredentials wantRawUsername string wantRawPassword string wantRawToken string wantErr string }{ { "credential type bogus", genericEndpointCredentials{Type: "X", SecretName: "__t"}, "", "", "", "unknown or unsupported credential type", }, // Type 'none' { "credential type none, secretName set", genericEndpointCredentials{Type: "none", SecretName: "u__"}, "", "", "", "none: secretName should not be set", }, // Type 'basic { "credential type basic, secretName missing", genericEndpointCredentials{Type: "basic", SecretName: "missing"}, "", "", "", "secret key not found", }, { "credential type basic, secretName has username", genericEndpointCredentials{Type: "basic", SecretName: "u__"}, "", "", "", "basic: password missing", }, { "credential type basic, secretName has password", genericEndpointCredentials{Type: "basic", SecretName: "_p_"}, "", "", "", "basic: username missing", }, { "credential type basic, secretName has username password", genericEndpointCredentials{Type: "basic", SecretName: "up_"}, "foo", "bar", "", "", }, // Type 'bearer' { "credential type bearer, secretName has token", genericEndpointCredentials{Type: "bearer", SecretName: "__t"}, "", "", "baz", "", }, { "credential type bearer, secretName has no token", genericEndpointCredentials{Type: "bearer", SecretName: "___"}, "", "", "", "bearer: token missing in secret", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ep := &GenericEndpoint{ endpointType: "jenkins", endpointName: "j1", config: genericEndpointConfig{ URL: "http://example.com", Credentials: tt.creds, }, } err := ep.loadKubernetesSecrets(loader) if tt.wantErr != "" { if err == nil { t.Errorf("GenericEndpoint.loadKubernetesSecrets() error = %v, wantErr %v", err, tt.wantErr) } else { if !strings.Contains(err.Error(), tt.wantErr) { t.Errorf("Error %v should contain %s", err, tt.wantErr) } } } else if err != nil { t.Errorf("GenericEndpoint.loadKubernetesSecrets() error = %v, wantErr %v", err, tt.wantErr) } compareBytes(t, tt.wantRawUsername, ep.config.Credentials.rawUsername, "rawUsername") compareBytes(t, tt.wantRawPassword, ep.config.Credentials.rawPassword, "rawPassword") compareBytes(t, tt.wantRawToken, ep.config.Credentials.rawToken, "rawToken") }) } }
explode_data.jsonl/67228
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1138 }
[ 2830, 3393, 19964, 27380, 12411, 42, 29827, 19773, 82, 1155, 353, 8840, 836, 8, 341, 197, 8355, 1669, 609, 52317, 19773, 9181, 31483, 78216, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 197, 85734, 1843, 13954, 27380, 27025, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHas_PlaceholderFormats(t *testing.T) { sql, args, err := bob.HasTable("users").HasColumn("name").PlaceholderFormat(bob.Dollar).ToSql() if err != nil { t.Fatal(err.Error()) } result := "SELECT * FROM information_schema.columns WHERE table_name = $1 AND column_name = $2 AND table_schema = current_schema();" if sql != result { t.Fatal("sql is not equal with result:", sql) } argsResult := []interface{}{"users", "name"} if !reflect.DeepEqual(args, argsResult) { t.Fatal("args is not equal with argsResult:", args) } }
explode_data.jsonl/61171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 10281, 1088, 26536, 4251, 44599, 1155, 353, 8840, 836, 8, 341, 30633, 11, 2827, 11, 1848, 1669, 35192, 16152, 2556, 445, 4218, 1827, 10281, 2933, 445, 606, 1827, 48305, 4061, 1883, 674, 909, 21295, 568, 1249, 8269, 741, 743,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransactionOperationID(t *testing.T) { tt := assert.New(t) transaction := BuildLedgerTransaction( t, TestTransaction{ Index: 1, EnvelopeXDR: "AAAAABpcjiETZ0uhwxJJhgBPYKWSVJy2TZ2LI87fqV1cUf/UAAAAZAAAADcAAAABAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAGlyOIRNnS6HDEkmGAE9gpZJUnLZNnYsjzt+pXVxR/9QAAAAAAAAAAAX14QAAAAAAAAAAAVxR/9QAAABAK6pcXYMzAEmH08CZ1LWmvtNDKauhx+OImtP/Lk4hVTMJRVBOebVs5WEPj9iSrgGT0EswuDCZ2i5AEzwgGof9Ag==", ResultXDR: "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=", MetaXDR: "AAAAAQAAAAIAAAADAAAAOAAAAAAAAAAAGlyOIRNnS6HDEkmGAE9gpZJUnLZNnYsjzt+pXVxR/9QAAAACVAvjnAAAADcAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAOAAAAAAAAAAAGlyOIRNnS6HDEkmGAE9gpZJUnLZNnYsjzt+pXVxR/9QAAAACVAvjnAAAADcAAAABAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA==", FeeChangesXDR: "AAAAAgAAAAMAAAA3AAAAAAAAAAAaXI4hE2dLocMSSYYAT2ClklSctk2diyPO36ldXFH/1AAAAAJUC+QAAAAANwAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAAA4AAAAAAAAAAAaXI4hE2dLocMSSYYAT2ClklSctk2diyPO36ldXFH/1AAAAAJUC+OcAAAANwAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==", Hash: "2a805712c6d10f9e74bb0ccf54ae92a2b4b1e586451fe8133a2433816f6b567c", }, ) operation := transactionOperationWrapper{ index: 0, transaction: transaction, operation: transaction.Envelope.Operations()[0], ledgerSequence: 56, } tt.Equal(int64(240518172673), operation.ID()) }
explode_data.jsonl/17222
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 688 }
[ 2830, 3393, 8070, 8432, 915, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 2060, 7121, 1155, 340, 197, 13528, 1669, 7854, 60850, 1389, 8070, 1006, 197, 3244, 345, 197, 73866, 8070, 515, 298, 197, 1552, 25, 260, 220, 16, 345, 298, 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 TestPropertyLimit(t *testing.T) { // GIVEN graphName := "mygraph" g := NewGraph(graphName) require.NotNil(t, g) v := NewVertexG(g) require.NotNil(t, v) p := NewPropertyV(v) require.NotNil(t, p) limit := 1234 // WHEN edge := p.Limit(limit) // THEN assert.NotNil(t, edge) assert.Equal(t, fmt.Sprintf(`%s.limit(%d)`, graphName, limit), p.String()) }
explode_data.jsonl/38219
{ "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, 3052, 16527, 1155, 353, 8840, 836, 8, 1476, 197, 322, 89836, 198, 66616, 675, 1669, 330, 2408, 4439, 698, 3174, 1669, 1532, 11212, 24312, 675, 340, 17957, 93882, 1155, 11, 342, 340, 5195, 1669, 1532, 8320, 38, 3268, 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 TestMissingTLSCertcfgg(t *testing.T) { cfg := initTest() cfg.Core.SSL = true cfg.Core.Port = "8087" cfg.Core.CertPath = "" cfg.Core.KeyPath = "" cfg.Core.CertBase64 = "" cfg.Core.KeyBase64 = "" err := RunHTTPServer(context.Background(), cfg, q) assert.Error(t, RunHTTPServer(context.Background(), cfg, q)) assert.Equal(t, "missing https cert config", err.Error()) }
explode_data.jsonl/67605
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 25080, 13470, 3540, 529, 14072, 70, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 2930, 2271, 2822, 50286, 12777, 808, 7984, 284, 830, 198, 50286, 12777, 43013, 284, 330, 23, 15, 23, 22, 698, 50286, 12777, 727, 529, 1820, 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...
1
func TestCanRead_codebase(t *testing.T) { cases := []struct { name string isAuthenticated bool isMember bool codebaseIsPublic bool isMemberOfOrganization bool expected bool }{ { name: "anon-private-codebase-no-access", isAuthenticated: false, isMember: false, codebaseIsPublic: false, expected: false, }, { name: "anon-public-codebase-has-access", isAuthenticated: false, isMember: false, codebaseIsPublic: true, expected: true, }, { name: "user-private-codebase-no-member-no-access", isAuthenticated: true, isMember: false, codebaseIsPublic: false, expected: false, }, { name: "user-private-codebase-is-member-has-access", isAuthenticated: true, isMember: true, codebaseIsPublic: false, expected: true, }, { name: "user-public-codebase-no-member-has-access", isAuthenticated: true, isMember: false, codebaseIsPublic: true, expected: true, }, { name: "user-public-codebase-is-member-has-access", isAuthenticated: true, isMember: true, codebaseIsPublic: true, expected: true, }, { name: "user-can-read-private-codebase-member-of-organization", isAuthenticated: true, isMember: false, isMemberOfOrganization: true, codebaseIsPublic: false, expected: true, }, } codebaseRepo := inmemory.NewInMemoryCodebaseRepo() codebaseUserRepo := inmemory.NewInMemoryCodebaseUserRepo() analyticsService := service_analytics.New(zap.NewNop(), disabled.NewClient(zap.NewNop())) codebaseService := service_codebase.New(codebaseRepo, codebaseUserRepo, nil, nil, nil, nil, nil, analyticsService) organizationRepo := inmemory.NewInMemoryOrganizationRepo() organizationMemberRepo := inmemory.NewInMemoryOrganizationMemberRepository() organizationService := service_organization.New(organizationRepo, organizationMemberRepo, analyticsService) authService := service_auth.New( codebaseService, nil, nil, nil, organizationService, ) for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { orgID := uuid.NewString() cb := codebase.Codebase{ID: uuid.NewString(), IsPublic: tc.codebaseIsPublic} if tc.isMemberOfOrganization { cb.OrganizationID = &orgID } assert.NoError(t, codebaseRepo.Create(cb)) userID := uuid.NewString() if tc.isMember { cbu := codebase.CodebaseUser{ID: uuid.NewString(), CodebaseID: cb.ID, UserID: userID} assert.NoError(t, codebaseUserRepo.Create(cbu)) } if tc.isMemberOfOrganization { org := organization.Organization{ID: orgID} assert.NoError(t, organizationRepo.Create(context.Background(), org)) orgmember := organization.Member{ID: uuid.NewString(), OrganizationID: org.ID, UserID: userID} assert.NoError(t, organizationMemberRepo.Create(context.Background(), orgmember)) } ctx := context.Background() if tc.isAuthenticated { ctx = auth.NewContext(ctx, &auth.Subject{ID: userID, Type: auth.SubjectUser}) } else { ctx = auth.NewContext(ctx, &auth.Subject{Type: auth.SubjectAnonymous}) } hasAccessErr := authService.CanRead(ctx, cb) if tc.expected { assert.NoError(t, hasAccessErr) } else { assert.Error(t, hasAccessErr) } }) } }
explode_data.jsonl/73366
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1297 }
[ 2830, 3393, 6713, 4418, 4136, 3152, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 914, 271, 197, 19907, 26712, 220, 1807, 198, 197, 19907, 9366, 260, 1807, 198, 197, 43343, 3152, 3872, 12676, 1807, 271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLen(t *testing.T) { imsg := &IMsg{} if imsg.Len() != HeaderSizeInBytes { t.Fatalf("empty imsg length (%d) should match header length (%d)", imsg.Len(), HeaderSizeInBytes) } }
explode_data.jsonl/1345
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 11271, 1155, 353, 8840, 836, 8, 341, 54892, 1991, 1669, 609, 1791, 1991, 31483, 743, 732, 1991, 65819, 368, 961, 12104, 1695, 641, 7078, 341, 197, 3244, 30762, 445, 3194, 732, 1991, 3084, 13456, 67, 8, 1265, 2432, 4247, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetWords(t *testing.T) { fmt.Println("-- getWords --") // Valid case 1 request, err := client.Get(getWordsUrl) // Create request with JSON body if err != nil { t.Error(err.Error()) } defer request.Body.Close() if request.StatusCode != http.StatusOK { t.Errorf("Success expected: %d", request.StatusCode) // HTTP request failed: Test failed } }
explode_data.jsonl/74521
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 1949, 23489, 1155, 353, 8840, 836, 8, 341, 11009, 12419, 21549, 633, 23489, 1177, 5130, 197, 322, 7818, 1142, 220, 16, 271, 23555, 11, 1848, 1669, 2943, 2234, 5433, 23489, 2864, 8, 442, 4230, 1681, 448, 4718, 2487, 198, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestObjectsDirectory(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionWithObjectHeaders(t) defer rollback() err := c.ObjectPutString(ctx, CONTAINER, "directory", "", "application/directory") if err != nil { t.Fatal(err) } defer func() { _ = c.ObjectDelete(ctx, CONTAINER, "directory") }() // Look for the directory object and check we aren't confusing // it with a pseudo directory object objects, err := c.Objects(ctx, CONTAINER, &swift.ObjectsOpts{Delimiter: '/'}) if err != nil { t.Fatal(err) } if len(objects) != 2 { t.Fatal("Should only be 2 objects") } found := false for i := range objects { object := objects[i] if object.Name == "directory" { found = true if object.Bytes != 0 || object.ContentType != "application/directory" || object.Hash != "d41d8cd98f00b204e9800998ecf8427e" || object.PseudoDirectory != false || object.SubDir != "" { t.Error("Bad object info", object) } checkTime(t, object.LastModified, -10, 10) } } if !found { t.Error("Didn't find directory object") } }
explode_data.jsonl/12699
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 400 }
[ 2830, 3393, 11543, 9310, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 2354, 1190, 10574, 1155, 340, 16867, 60414, 741, 9859, 1669, 272, 8348, 19103, 703, 7502, 11, 16120, 34521, 11, 330...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGoBuildUmask(t *testing.T) { // Do not use tg.parallel; avoid other tests seeing umask manipulation. mask := syscall.Umask(0077) // prohibit low bits defer syscall.Umask(mask) tg := testgo(t) defer tg.cleanup() tg.tempFile("x.go", `package main; func main() {}`) // Make sure artifact will be output to /tmp/... in case the user // has POSIX acl's on their go source tree. // See issue 17909. exe := tg.path("x") tg.creatingTemp(exe) tg.run("build", "-o", exe, tg.path("x.go")) fi, err := os.Stat(exe) if err != nil { t.Fatal(err) } if mode := fi.Mode(); mode&0077 != 0 { t.Fatalf("wrote x with mode=%v, wanted no 0077 bits", mode) } }
explode_data.jsonl/74039
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 10850, 11066, 52, 11258, 1155, 353, 8840, 836, 8, 341, 197, 322, 3155, 537, 990, 53188, 71457, 26, 5648, 1008, 7032, 9120, 4443, 1073, 33686, 624, 74912, 1669, 49345, 5255, 11258, 7, 15, 15, 22, 22, 8, 442, 47386, 3347, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetOpenAPISchema(t *testing.T) { server, err := openapiSchemaFakeServer(t) if err != nil { t.Errorf("unexpected error starting fake server: %v", err) } defer server.Close() client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL}) got, err := client.OpenAPISchema() if err != nil { t.Fatalf("unexpected error getting openapi: %v", err) } if e, a := returnedOpenAPI(), got; !golangproto.Equal(e, a) { t.Errorf("expected \n%v, got \n%v", e, a) } }
explode_data.jsonl/19752
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 1949, 5002, 2537, 1637, 3416, 1155, 353, 8840, 836, 8, 341, 41057, 11, 1848, 1669, 1787, 2068, 8632, 52317, 5475, 1155, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 53859, 1465, 5916, 12418, 3538, 25, 1018, 85, 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 TestIsMultipartFormData(t *testing.T) { req, err := createRequest(http.MethodPost, "/api/chartrepo/charts") if err != nil { t.Fatal(err) } req.Header.Set(headerContentType, "application/json") if isMultipartFormData(req) { t.Fatal("expect false result but got true") } req.Header.Set(headerContentType, contentTypeMultipart) if !isMultipartFormData(req) { t.Fatalf("expect %s result but got %s", contentTypeMultipart, req.Header.Get(headerContentType)) } }
explode_data.jsonl/74123
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 3872, 44, 18204, 55966, 1155, 353, 8840, 836, 8, 341, 24395, 11, 1848, 1669, 1855, 1900, 19886, 20798, 4133, 11, 3521, 2068, 73941, 23476, 21284, 7038, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSlaveStorage_checkAndAdd(t *testing.T) { assert := assert.New(t) slaveStorage := newSlaveStorage() assert.Equal(0, len(slaveStorage.slaves)) slaveId := "slave1" slaveHostname := "slave1Hostname" slaveStorage.checkAndAdd(slaveId, slaveHostname) assert.Equal(1, len(slaveStorage.getSlaveIds())) slaveStorage.checkAndAdd(slaveId, slaveHostname) assert.Equal(1, len(slaveStorage.getSlaveIds())) }
explode_data.jsonl/63769
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 95960, 5793, 7200, 3036, 2212, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 78626, 523, 5793, 1669, 501, 95960, 5793, 741, 6948, 12808, 7, 15, 11, 2422, 55691, 523, 5793, 25101, 4693, 4390, 78626, 523, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDelayMustBeGreaterOrEqualThanTimeout(t *testing.T) { _, err := monitors.Create(fake.ServiceClient(), monitors.CreateOpts{ Type: "HTTP", Delay: 1, Timeout: 10, MaxRetries: 5, URLPath: "/check", ExpectedCodes: "200-299", }).Extract() if err == nil { t.Fatalf("Expected error, got none") } _, err = monitors.Update(fake.ServiceClient(), "453105b9-1754-413f-aab1-55f1af620750", monitors.UpdateOpts{ Delay: 1, Timeout: 10, }).Extract() if err == nil { t.Fatalf("Expected error, got none") } }
explode_data.jsonl/7654
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 256 }
[ 2830, 3393, 20039, 31776, 3430, 41366, 2195, 2993, 26067, 7636, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 36477, 7251, 74138, 13860, 2959, 1507, 36477, 7251, 43451, 515, 197, 27725, 25, 688, 330, 9230, 756, 197, 10957, 6895, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidate_lt(t *testing.T) { assert := assert.New(t) type User struct { Age *int64 `validate:"lt=2"` } assert.NoError( v.Validate(User{}, valis.EachFields(tagrule.Validate)), ) assert.NoError( v.Validate(User{Age: henge.ToIntPtr(1)}, valis.EachFields(tagrule.Validate)), ) assert.EqualError( v.Validate(User{Age: henge.ToIntPtr(2)}, valis.EachFields(tagrule.Validate)), "(lt) .Age must be less than 2", ) assert.EqualError( v.Validate(User{Age: henge.ToIntPtr(20)}, valis.EachFields(tagrule.Validate)), "(lt) .Age must be less than 2", ) }
explode_data.jsonl/17251
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 17926, 39164, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 13158, 2657, 2036, 341, 197, 197, 16749, 353, 396, 21, 19, 1565, 7067, 2974, 4832, 28, 17, 8805, 197, 532, 6948, 35699, 1006, 197, 5195, 47667,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImportImportScheme(t *testing.T) { th := Setup(t) defer th.TearDown() // Mark the phase 2 permissions migration as completed. th.App.Srv.Store.System().Save(&model.System{Name: model.MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2, Value: "true"}) defer func() { th.App.Srv.Store.System().PermanentDeleteByName(model.MIGRATION_KEY_ADVANCED_PERMISSIONS_PHASE_2) }() // Try importing an invalid scheme in dryRun mode. data := SchemeImportData{ Name: ptrStr(model.NewId()), Scope: ptrStr("team"), DefaultTeamGuestRole: &RoleImportData{ Name: ptrStr(model.NewId()), DisplayName: ptrStr(model.NewId()), }, DefaultTeamUserRole: &RoleImportData{ Name: ptrStr(model.NewId()), DisplayName: ptrStr(model.NewId()), }, DefaultTeamAdminRole: &RoleImportData{ Name: ptrStr(model.NewId()), DisplayName: ptrStr(model.NewId()), }, DefaultChannelGuestRole: &RoleImportData{ Name: ptrStr(model.NewId()), DisplayName: ptrStr(model.NewId()), }, DefaultChannelUserRole: &RoleImportData{ Name: ptrStr(model.NewId()), DisplayName: ptrStr(model.NewId()), }, DefaultChannelAdminRole: &RoleImportData{ Name: ptrStr(model.NewId()), DisplayName: ptrStr(model.NewId()), }, Description: ptrStr("description"), } err := th.App.importScheme(&data, true) require.NotNil(t, err, "Should have failed to import.") _, err = th.App.Srv.Store.Scheme().GetByName(*data.Name) require.NotNil(t, err, "Scheme should not have imported.") // Try importing a valid scheme in dryRun mode. data.DisplayName = ptrStr("display name") err = th.App.importScheme(&data, true) require.Nil(t, err, "Should have succeeded.") _, err = th.App.Srv.Store.Scheme().GetByName(*data.Name) require.NotNil(t, err, "Scheme should not have imported.") // Try importing an invalid scheme. data.DisplayName = nil err = th.App.importScheme(&data, false) require.NotNil(t, err, "Should have failed to import.") _, err = th.App.Srv.Store.Scheme().GetByName(*data.Name) require.NotNil(t, err, "Scheme should not have imported.") // Try importing a valid scheme with all params set. data.DisplayName = ptrStr("display name") err = th.App.importScheme(&data, false) require.Nil(t, err, "Should have succeeded.") scheme, err := th.App.Srv.Store.Scheme().GetByName(*data.Name) require.Nil(t, err, "Failed to import scheme: %v", err) assert.Equal(t, *data.Name, scheme.Name) assert.Equal(t, *data.DisplayName, scheme.DisplayName) assert.Equal(t, *data.Description, scheme.Description) assert.Equal(t, *data.Scope, scheme.Scope) role, err := th.App.Srv.Store.Role().GetByName(scheme.DefaultTeamAdminRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultTeamAdminRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultTeamUserRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultTeamUserRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultTeamGuestRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultTeamGuestRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultChannelAdminRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultChannelAdminRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultChannelUserRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultChannelUserRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultChannelGuestRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultChannelGuestRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) // Try modifying all the fields and re-importing. data.DisplayName = ptrStr("new display name") data.Description = ptrStr("new description") err = th.App.importScheme(&data, false) require.Nil(t, err, "Should have succeeded: %v", err) scheme, err = th.App.Srv.Store.Scheme().GetByName(*data.Name) require.Nil(t, err, "Failed to import scheme: %v", err) assert.Equal(t, *data.Name, scheme.Name) assert.Equal(t, *data.DisplayName, scheme.DisplayName) assert.Equal(t, *data.Description, scheme.Description) assert.Equal(t, *data.Scope, scheme.Scope) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultTeamAdminRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultTeamAdminRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultTeamUserRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultTeamUserRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultTeamGuestRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultTeamGuestRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultChannelAdminRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultChannelAdminRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultChannelUserRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultChannelUserRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) role, err = th.App.Srv.Store.Role().GetByName(scheme.DefaultChannelGuestRole) require.Nil(t, err, "Should have found the imported role.") assert.Equal(t, *data.DefaultChannelGuestRole.DisplayName, role.DisplayName) assert.False(t, role.BuiltIn) assert.True(t, role.SchemeManaged) // Try changing the scope of the scheme and reimporting. data.Scope = ptrStr("channel") err = th.App.importScheme(&data, false) require.NotNil(t, err, "Should have failed to import.") scheme, err = th.App.Srv.Store.Scheme().GetByName(*data.Name) require.Nil(t, err, "Failed to import scheme: %v", err) assert.Equal(t, *data.Name, scheme.Name) assert.Equal(t, *data.DisplayName, scheme.DisplayName) assert.Equal(t, *data.Description, scheme.Description) assert.Equal(t, "team", scheme.Scope) }
explode_data.jsonl/67133
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2623 }
[ 2830, 3393, 11511, 11511, 28906, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 340, 16867, 270, 836, 682, 4454, 2822, 197, 322, 4389, 279, 10262, 220, 17, 8541, 11906, 438, 8145, 624, 70479, 5105, 808, 10553, 38047, 16620, 100...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssuanceOptionalSetAttributes(t *testing.T) { req := getNameIssuanceRequest() req.Credentials[0].Attributes["prefix"] = "van" sessionHelper(t, req, "issue", nil) }
explode_data.jsonl/69995
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 61 }
[ 2830, 3393, 28216, 84, 681, 15309, 1649, 10516, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 20299, 28216, 84, 681, 1900, 741, 24395, 727, 15735, 58, 15, 936, 10516, 1183, 11849, 1341, 284, 330, 15649, 698, 25054, 5511, 1155, 11, 4232, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnescapePatternError(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) testCases := []struct { pattern string escapeToken string }{ {`\`, `\`}, {`\\`, `\\`}, {`ABC\`, `\`}, {`ABC\\`, `\\`}, {`ABC\\\`, `\`}, {`ABC\\\\\\`, `\\`}, } const errorMessage = "LIKE pattern must not end with escape character" for _, tc := range testCases { t.Run(fmt.Sprintf("Pattern=%s Escape=%s", tc.pattern, tc.escapeToken), func(t *testing.T) { actual, err := unescapePattern(tc.pattern, tc.escapeToken, true /* emitEscapeCharacterLastError */) if err == nil { t.Fatalf("error not raised. expected error message: %s\ngot unescaped pattern: %s\n", errorMessage, actual) } if err.Error() != errorMessage { t.Errorf("expected error message: %s\ngot error message: %s\n", errorMessage, err.Error()) } }) } }
explode_data.jsonl/24152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 357 }
[ 2830, 3393, 1806, 12998, 15760, 1454, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 340, 18185, 37302, 1669, 3056, 1235, 341, 197, 3223, 3227, 257, 914, 198, 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 TestConfig_WrongFieldType(t *testing.T) { c := NewConfig() err := c.LoadConfig("./testdata/wrong_field_type.toml") require.Error(t, err, "invalid field type") require.Equal(t, "Error loading config file ./testdata/wrong_field_type.toml: error parsing http_listener_v2, line 2: (config.MockupInputPlugin.Port) cannot unmarshal TOML string into int", err.Error()) c = NewConfig() err = c.LoadConfig("./testdata/wrong_field_type2.toml") require.Error(t, err, "invalid field type2") require.Equal(t, "Error loading config file ./testdata/wrong_field_type2.toml: error parsing http_listener_v2, line 2: (config.MockupInputPlugin.Methods) cannot unmarshal TOML string into []string", err.Error()) }
explode_data.jsonl/72172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 2648, 2763, 14347, 63733, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 2648, 741, 9859, 1669, 272, 13969, 2648, 13988, 92425, 6324, 14347, 5013, 1819, 73494, 75, 1138, 17957, 6141, 1155, 11, 1848, 11, 330, 11808, 2070, 94...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJsReturnArrayBuffer(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() res, err := ctx.Eval(`new ArrayBuffer(5)`, "undefined.js") if err != nil { t.Fatalf("Error evaluating javascript, err: %v", err) } b := res.Bytes() if b == nil { t.Errorf("Expected non-nil byte array but got nil buffer") } if len(b) != 5 { t.Errorf("Expected byte array of length 5 but got %d", len(b)) } }
explode_data.jsonl/81546
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 30480, 5598, 1857, 4095, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 741, 10202, 11, 1848, 1669, 5635, 5142, 831, 5809, 931, 83005, 7, 20, 8, 7808, 330, 9614, 285...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPodSpecLogForAllPods(t *testing.T) { cancel, controller := newController() defer cancel() ctx := context.Background() assert.NotNil(t, controller) controller.Config.PodSpecLogStrategy.AllPods = true wf := unmarshalWF(nestedOptionalOutputArtifacts) wfcset := controller.wfclientset.ArgoprojV1alpha1().Workflows("") wf, err := wfcset.Create(ctx, wf, metav1.CreateOptions{}) assert.NoError(t, err) woc := newWorkflowOperationCtx(wf, controller) assert.NotNil(t, woc) woc.operate(ctx) woc = newWorkflowOperationCtx(woc.wf, controller) woc.operate(ctx) for _, node := range woc.wf.Status.Nodes { assert.True(t, woc.shouldPrintPodSpec(node)) } }
explode_data.jsonl/71002
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 264 }
[ 2830, 3393, 23527, 8327, 2201, 2461, 2403, 23527, 82, 1155, 353, 8840, 836, 8, 341, 84441, 11, 6461, 1669, 501, 2051, 741, 16867, 9121, 2822, 20985, 1669, 2266, 19047, 741, 6948, 93882, 1155, 11, 6461, 340, 61615, 10753, 88823, 8327, 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...
2
func TestKpiMeasureRemove(t *testing.T) { keeper, ctx := keepertest.PmKeeper(t) items := createNKpiMeasure(keeper, ctx, 10) for _, item := range items { keeper.RemoveKpiMeasure(ctx, item.Index, ) _, found := keeper.GetKpiMeasure(ctx, item.Index, ) require.False(t, found) } }
explode_data.jsonl/45265
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 42, 2493, 32236, 13021, 1155, 353, 8840, 836, 8, 341, 197, 18861, 11, 5635, 1669, 2506, 83386, 1069, 76, 77233, 1155, 340, 46413, 1669, 1855, 76180, 2493, 32236, 7, 18861, 11, 5635, 11, 220, 16, 15, 340, 2023, 8358, 1509, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsForwarded(t *testing.T) { caseTests := []struct { message *tgbotapi.Message // Message from the received update. expected bool // Result expected. }{ { // nil message. message: nil, expected: false, }, { // Regular message. message: &tgbotapi.Message{ Text: "something here", }, expected: false, }, { // Forwarded message with ForwardFrom. message: &tgbotapi.Message{ ForwardFrom: &tgbotapi.User{ ID: 42, FirstName: "Foo", LastName: "Bar", }, Text: "A simple forwarded message", }, expected: true, }, { // Forwarded message with ForwardFromChat. message: &tgbotapi.Message{ ForwardFromChat: &tgbotapi.Chat{ ID: 42, Type: "channel", Title: "Foo Bar", }, Text: "Another forwarded message", }, expected: true, }, } for _, tt := range caseTests { if isForwarded(tt.message) != tt.expected { t.Errorf("isForwarded handled %v incorrectly; expected: %v, got: %v", tt.message, tt.expected, !tt.expected) } } }
explode_data.jsonl/55807
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 478 }
[ 2830, 3393, 3872, 25925, 291, 1155, 353, 8840, 836, 8, 341, 2722, 18200, 1669, 3056, 1235, 341, 197, 24753, 220, 353, 41428, 6331, 2068, 8472, 442, 4856, 504, 279, 3949, 2647, 624, 197, 42400, 1807, 1060, 442, 5714, 3601, 624, 197, 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, 1, 1, 1, 1, 1, 1, 1...
3
func TestSearchTeamsByName(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() id := model.NewId() name := "name" + id displayName := "Name " + id th.CheckCommand(t, "team", "create", "--name", name, "--display_name", displayName) output := th.CheckCommand(t, "team", "search", name) assert.Contains(t, output, name, "should have the created team") }
explode_data.jsonl/59044
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 5890, 60669, 16898, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 15710, 1669, 1614, 7121, 764, 741, 11609, 1669, 330, 606, 1, 488, 877, 198, 31271, 675, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_SystemData_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip of SystemData_Status via JSON returns original", prop.ForAll(RunJSONSerializationTestForSystemDataStatus, SystemDataStatusGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) }
explode_data.jsonl/39623
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 25363, 1043, 36449, 62, 4498, 77521, 78967, 98054, 2848, 4756, 2121, 2993, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284, 220, 16, 15, 198, 869...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccSecretAclResource(t *testing.T) { // TODO: refactor for common instance pool & AZ CLI if _, ok := os.LookupEnv("CLOUD_ENV"); !ok { t.Skip("Acceptance tests skipped unless env 'CLOUD_ENV' is set") } //var secretScope Secre var secretACL ACLItem // generate a random name for each tokenInfo test run, to avoid // collisions from multiple concurrent tests. // the acctest package includes many helpers such as RandStringFromCharSet // See https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/acctest //scope := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) scope := "terraform_acc_test_acl" principal := "users" permission := "READ" acceptance.AccTest(t, resource.TestCase{ CheckDestroy: testSecretACLResourceDestroy, Steps: []resource.TestStep{ { // use a dynamic configuration with the random name from above Config: testSecretACLResource(scope, principal, permission), // compose a basic test, checking both remote and local values Check: resource.ComposeTestCheckFunc( // query the API to retrieve the tokenInfo object testSecretACLResourceExists("databricks_secret_acl.my_secret_acl", &secretACL, t), // verify remote values testSecretACLValues(t, &secretACL, permission, principal), // verify local values resource.TestCheckResourceAttr("databricks_secret_acl.my_secret_acl", "scope", scope), resource.TestCheckResourceAttr("databricks_secret_acl.my_secret_acl", "principal", principal), resource.TestCheckResourceAttr("databricks_secret_acl.my_secret_acl", "permission", permission), ), }, { PreConfig: func() { client := common.CommonEnvironmentClient() err := NewSecretAclsAPI(client).Delete(scope, principal) assert.NoError(t, err, err) }, // use a dynamic configuration with the random name from above Config: testSecretACLResource(scope, principal, permission), // compose a basic test, checking both remote and local values Check: resource.ComposeTestCheckFunc( // query the API to retrieve the tokenInfo object testSecretACLResourceExists("databricks_secret_acl.my_secret_acl", &secretACL, t), // verify remote values testSecretACLValues(t, &secretACL, permission, principal), // verify local values resource.TestCheckResourceAttr("databricks_secret_acl.my_secret_acl", "scope", scope), resource.TestCheckResourceAttr("databricks_secret_acl.my_secret_acl", "principal", principal), resource.TestCheckResourceAttr("databricks_secret_acl.my_secret_acl", "permission", permission), ), }, }, }) }
explode_data.jsonl/6770
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 912 }
[ 2830, 3393, 14603, 19773, 32, 564, 4783, 1155, 353, 8840, 836, 8, 341, 197, 322, 5343, 25, 92295, 369, 4185, 2867, 7314, 609, 30876, 39277, 198, 743, 8358, 5394, 1669, 2643, 79261, 14359, 445, 34, 47645, 22027, 5038, 753, 562, 341, 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 TestIssue20(t *testing.T) { jsonStr := `{ "name": "FirstName", "name1": "FirstName1", ` + `"address": "address1", "addressDetails": "address2", }` paths := []string{"name", "name1", "address", "addressDetails"} expected := []string{"FirstName", "FirstName1", "address1", "address2"} t.Run("SingleMany", func(t *testing.T) { testMany(t, jsonStr, paths, expected) }) }
explode_data.jsonl/43440
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 42006, 17, 15, 1155, 353, 8840, 836, 8, 341, 30847, 2580, 1669, 53692, 330, 606, 788, 330, 26584, 497, 330, 606, 16, 788, 330, 26584, 16, 497, 1565, 3610, 197, 197, 63, 1, 4995, 788, 330, 4995, 16, 497, 330, 4995, 7799...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPut(t *testing.T) { index, err := Open("Doc") if err != nil { t.Fatalf("err from Open: %v", err) } c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { expectedIn := &pb.IndexDocumentRequest{ Params: &pb.IndexDocumentParams{ Document: []*pb.Document{ {Field: protoFields, OrderId: proto.Int32(42)}, }, IndexSpec: &pb.IndexSpec{ Name: proto.String("Doc"), }, }, } if !proto.Equal(in, expectedIn) { return fmt.Errorf("unsupported argument:\ngot %v\nwant %v", in, expectedIn) } *out = pb.IndexDocumentResponse{ Status: []*pb.RequestStatus{ {Code: pb.SearchServiceError_OK.Enum()}, }, DocId: []string{ "doc_id", }, } return nil }) id, err := index.Put(c, "", &FieldListWithMeta{ Meta: searchMeta, Fields: searchFields, }) if err != nil { t.Fatal(err) } if want := "doc_id"; id != want { t.Errorf("Got doc ID %q, want %q", id, want) } }
explode_data.jsonl/27959
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 447 }
[ 2830, 3393, 19103, 1155, 353, 8840, 836, 8, 341, 26327, 11, 1848, 1669, 5264, 445, 9550, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 615, 504, 5264, 25, 1018, 85, 497, 1848, 340, 197, 630, 1444, 1669, 264, 57824, 287, 99...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSTMSerializableSnapshotPut(t *testing.T) { clus := NewClusterV3(t, &ClusterConfig{Size: 1}) defer clus.Terminate(t) cli := clus.Client(0) // key with lower create/mod revision than keys being updated _, err := cli.Put(context.TODO(), "a", "0") testutil.AssertNil(t, err) tries := 0 applyf := func(stm concurrency.STM) error { if tries > 2 { return fmt.Errorf("too many retries") } tries++ stm.Get("a") stm.Put("b", "1") return nil } iso := concurrency.WithIsolation(concurrency.SerializableSnapshot) _, err = concurrency.NewSTM(cli, applyf, iso) testutil.AssertNil(t, err) _, err = concurrency.NewSTM(cli, applyf, iso) testutil.AssertNil(t, err) resp, err := cli.Get(context.TODO(), "b") testutil.AssertNil(t, err) if resp.Kvs[0].Version != 2 { t.Fatalf("bad version. got %+v, expected version 2", resp) } }
explode_data.jsonl/51054
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 361 }
[ 2830, 3393, 784, 4826, 2848, 8335, 15009, 19103, 1155, 353, 8840, 836, 8, 341, 197, 4163, 1669, 1532, 28678, 53, 18, 1155, 11, 609, 28678, 2648, 90, 1695, 25, 220, 16, 3518, 16867, 1185, 355, 836, 261, 34016, 1155, 692, 86448, 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...
2
func TestFetchDataFeed(t *testing.T) { // Read mock data from CSV csvContent, err := readCSVFileContents("testdata/data_feed.csv") if err != nil { t.Fatalf("coult not parse csv file '%v'", err) } var b bytes.Buffer gz := gzip.NewWriter(&b) if _, err := gz.Write([]byte(csvContent)); err != nil { t.Error(err) } if err := gz.Flush(); err != nil { t.Error(err) } if err := gz.Close(); err != nil { t.Error(err) } // Create mock response response := &http.Response{ StatusCode: 200, Body: ioutil.NopCloser(bytes.NewBuffer(b.Bytes())), } // Create test client to run tests on awinClient := awin.NewAwinClient(&http.Client{Transport: mockRoundTripper{response: response, requestTestFunc: func(r *http.Request) error { expectedUrl := "https://productdata.awin.com/datafeed/download/apikey/apiKey/language/en/fid/fid1,fid2/columns/aw_deep_link,product_name,aw_product_id,merchant_product_id,merchant_image_url,description,merchant_category,search_price,merchant_name,merchant_id,category_name,category_id,aw_image_url,currency,store_price,delivery_cost,merchant_deep_link,language,last_updated,display_price,data_feed_id,brand_name,brand_id,colour,product_short_description,specifications,condition,product_model,model_number,dimensions,keywords,promotional_text,product_type,commission_group,merchant_product_category_path,merchant_product_second_category,merchant_product_third_category,rrp_price,saving,savings_percent,base_price,base_price_amount,base_price_text,product_price_old,delivery_restrictions,delivery_weight,warranty,terms_of_contract,delivery_time,in_stock,stock_quantity,valid_from,valid_to,is_for_sale,web_offer,pre_order,stock_status,size_stock_status,size_stock_amount,merchant_thumb_url,large_image,alternate_image,aw_thumb_url,alternate_image_two,alternate_image_three,alternate_image_four,reviews,average_rating,rating,number_available,custom_1,custom_2,custom_3,custom_4,custom_5,custom_6,custom_7,custom_8,custom_9,ean,isbn,upc,mpn,parent_product_id,product_GTIN,basket_link/format/csv/delimiter/,/compression/gzip/adultcontent/1/" if r.URL.String() != expectedUrl { err := errors.New(fmt.Sprintf("invalid url found in test\nexpected '%s'\nfound '%s'", expectedUrl, r.URL.String())) t.Error(err) return err } expectedMethod := "GET" if r.Method != expectedMethod { err := errors.New(fmt.Sprintf("invalid request method in test\nexpected '%s'\nfound '%s'", expectedMethod, r.Method)) t.Error(err) return err } return nil }}}) result, err := awinClient.FetchDataFeed(&awin.DataFeedOptions{ ApiKey: "apiKey", FeedIds: []string{"fid1", "fid2"}, Language: "en", ShowAdultContent: true, }) if err != nil { t.Fatalf("err is not null '%v'", err) } if len(*result) != 10 { t.Fatalf("Invalid amount of data rows received %d", len(*result)) } // Check if received rows and expected rows match expectedRows, _ := parseCSVToDataFeedEntry(csvContent) for i, expectedRow := range *expectedRows { receivedRow := (*result)[i] if expectedRow != receivedRow { eJson, _ := json.Marshal(expectedRow) rJson, _ := json.Marshal(receivedRow) t.Fatalf("Invalid row parsed\nexpected '%v'\nreceived '%v'", string(eJson), string(rJson)) } } }
explode_data.jsonl/40125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1246 }
[ 2830, 3393, 20714, 1043, 28916, 1155, 353, 8840, 836, 8, 341, 197, 322, 4457, 7860, 821, 504, 27445, 198, 1444, 3492, 2762, 11, 1848, 1669, 1349, 44209, 1703, 14803, 445, 92425, 13167, 42390, 11219, 1138, 743, 1848, 961, 2092, 341, 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 TestGetConfig(t *testing.T) { // Reset memory counters helpers.ResetMemoryStats() code := fmt.Sprintf(` d = datadog_agent.get_config("foo") with open(r'%s', 'w') as f: f.write("{}:{}:{}".format(d.get('name'), d.get('body'), d.get('time'))) `, tmpfile.Name()) out, err := run(code) if err != nil { t.Fatal(err) } if out != "foo:Hello:123456" { t.Errorf("Unexpected printed value: '%s'", out) } // Check for leaks helpers.AssertMemoryUsage(t) }
explode_data.jsonl/24540
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 1949, 2648, 1155, 353, 8840, 836, 8, 341, 197, 322, 16932, 4938, 31532, 198, 197, 21723, 36660, 10642, 16635, 2822, 43343, 1669, 8879, 17305, 61528, 2698, 284, 3258, 329, 538, 25730, 670, 5332, 445, 7975, 1138, 46948, 1787, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIDEncodeDecode(t *testing.T) { codec := kbfscodec.NewMsgpack() id := FakeID(1, Public) encodedID, err := codec.Encode(id) require.NoError(t, err) // See // https://github.com/msgpack/msgpack/blob/master/spec.md#formats-bin // for why there are two bytes of overhead. const overhead = 2 require.Equal(t, idByteLen+overhead, len(encodedID)) var id2 ID err = codec.Decode(encodedID, &id2) require.NoError(t, err) require.Equal(t, id, id2) }
explode_data.jsonl/65970
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 189 }
[ 2830, 3393, 915, 32535, 32564, 1155, 353, 8840, 836, 8, 341, 43343, 66, 1669, 38653, 3848, 34607, 7121, 6611, 4748, 741, 15710, 1669, 36965, 915, 7, 16, 11, 3066, 692, 197, 19329, 915, 11, 1848, 1669, 34647, 50217, 3724, 340, 17957, 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 TestVolumesFrom(t *testing.T) { taskEngine, done, _ := setupWithDefaultConfig(t) defer done() stateChangeEvents := taskEngine.StateChangeEvents() testTask := createTestTask("testVolumeContainer") testTask.Containers[0].Image = testVolumeImage testTask.Containers = append(testTask.Containers, createTestContainer()) testTask.Containers[1].Name = "test2" testTask.Containers[1].Image = testVolumeImage testTask.Containers[1].VolumesFrom = []apicontainer.VolumeFrom{{SourceContainer: testTask.Containers[0].Name}} testTask.Containers[1].Command = []string{"-c", "$output= (cat /data/test-file); if ($output -eq \"test\") { Exit 42 } else { Exit 1 }"} go taskEngine.AddTask(testTask) err := verifyTaskIsRunning(stateChangeEvents, testTask) require.NoError(t, err) verifyTaskIsStopped(stateChangeEvents, testTask) assert.Equal(t, *testTask.Containers[1].GetKnownExitCode(), 42) }
explode_data.jsonl/20161
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 96325, 3830, 1155, 353, 8840, 836, 8, 341, 49115, 4571, 11, 2814, 11, 716, 1669, 6505, 2354, 3675, 2648, 1155, 340, 16867, 2814, 2822, 24291, 4072, 7900, 1669, 3383, 4571, 18942, 4072, 7900, 2822, 18185, 6262, 1669, 1855, 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 TestIsMSI(t *testing.T) { var v *Value v = &Value{data: map[string]interface{}(map[string]interface{}{"name": "Tyler"})} assert.True(t, v.IsMSI()) v = &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} assert.True(t, v.IsMSISlice()) }
explode_data.jsonl/23386
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 3872, 4826, 40, 1155, 353, 8840, 836, 8, 1476, 2405, 348, 353, 1130, 271, 5195, 284, 609, 1130, 90, 691, 25, 2415, 14032, 31344, 6257, 7, 2186, 14032, 31344, 6257, 4913, 606, 788, 330, 99124, 80154, 532, 6948, 32443, 1155,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdminServer_UndeleteTreeErrors(t *testing.T) { ctx := context.Background() ts, err := setupAdminServer(ctx, t) if err != nil { t.Fatalf("setupAdminServer() failed: %v", err) } defer ts.closeAll() tree, err := ts.adminClient.CreateTree(ctx, &trillian.CreateTreeRequest{Tree: testonly.LogTree}) if err != nil { t.Fatalf("CreateTree() returned err = %v", err) } tests := []struct { desc string req *trillian.UndeleteTreeRequest wantCode codes.Code }{ { desc: "unknownTree", req: &trillian.UndeleteTreeRequest{TreeId: 12345}, wantCode: codes.NotFound, }, { desc: "notDeleted", req: &trillian.UndeleteTreeRequest{TreeId: tree.TreeId}, wantCode: codes.FailedPrecondition, }, } for _, test := range tests { _, err := ts.adminClient.UndeleteTree(ctx, test.req) if s, ok := status.FromError(err); !ok || s.Code() != test.wantCode { t.Errorf("%v: UndeleteTree() returned err = %v, wantCode = %s", test.desc, err, test.wantCode) } } }
explode_data.jsonl/43984
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 425 }
[ 2830, 3393, 7210, 5475, 6665, 42341, 1617, 6533, 13877, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 57441, 11, 1848, 1669, 6505, 7210, 5475, 7502, 11, 259, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 15188, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSokuonM(t *testing.T) { const want = "mmammimmummemmo" for _, v := range []string{"っまっみっむっめっも", "γƒƒγƒžγƒƒγƒŸγƒƒγƒ γƒƒγƒ‘γƒƒγƒ’"} { got, err := KanaToRomaji(v) assert.Equal(t, want, got) assert.Nil(t, err) } }
explode_data.jsonl/11353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 50, 16493, 263, 44, 1155, 353, 8840, 836, 8, 341, 4777, 1366, 284, 330, 3821, 8666, 12543, 372, 10536, 6355, 1837, 2023, 8358, 348, 1669, 2088, 3056, 917, 4913, 41791, 16714, 41791, 63021, 41791, 125471, 41791, 60904, 41791, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseVolumeAnonymousVolume(t *testing.T) { for _, path := range []string{"/path", "/path/foo"} { volume, err := parseVolume(path) expected := types.ServiceVolumeConfig{Type: "volume", Target: path} assert.NoError(t, err) assert.Equal(t, expected, volume) } }
explode_data.jsonl/70092
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 14463, 18902, 32684, 18902, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1815, 1669, 2088, 3056, 917, 90, 3115, 2343, 497, 3521, 2343, 60555, 9207, 341, 197, 5195, 4661, 11, 1848, 1669, 4715, 18902, 5581, 340, 197, 42400, 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...
2
func TestDroneQueenImpl_ReleaseDuts(t *testing.T) { t.Parallel() t.Run("release all DUTs", func(t *testing.T) { t.Parallel() ctx := gaetesting.TestingContextWithAppID("go-test") datastore.GetTestable(ctx).Consistent(true) k := entities.DUTGroupKey(ctx) duts := []*entities.DUT{ {ID: "ionasal", Group: k, AssignedDrone: "earthes"}, {ID: "nayaflask", Group: k, AssignedDrone: "earthes"}, } if err := datastore.Put(ctx, duts); err != nil { t.Fatal(err) } var d DroneQueenImpl _, err := d.ReleaseDuts(ctx, &api.ReleaseDutsRequest{ DroneUuid: "earthes", Duts: []string{"ionasal", "nayaflask"}, }) if err != nil { t.Fatal(err) } want := []*entities.DUT{ {ID: "ionasal", Group: k}, {ID: "nayaflask", Group: k}, } assertDatastoreDUTs(ctx, t, want) }) t.Run("release partial DUTs", func(t *testing.T) { t.Parallel() ctx := gaetesting.TestingContextWithAppID("go-test") datastore.GetTestable(ctx).Consistent(true) k := entities.DUTGroupKey(ctx) duts := []*entities.DUT{ {ID: "ionasal", Group: k, AssignedDrone: "earthes"}, {ID: "nayaflask", Group: k, AssignedDrone: "earthes"}, } if err := datastore.Put(ctx, duts); err != nil { t.Fatal(err) } var d DroneQueenImpl _, err := d.ReleaseDuts(ctx, &api.ReleaseDutsRequest{ DroneUuid: "earthes", Duts: []string{"nayaflask"}, }) if err != nil { t.Fatal(err) } want := []*entities.DUT{ {ID: "ionasal", Group: k, AssignedDrone: "earthes"}, {ID: "nayaflask", Group: k}, } assertDatastoreDUTs(ctx, t, want) }) t.Run("release unassigned duts", func(t *testing.T) { t.Parallel() ctx := gaetesting.TestingContextWithAppID("go-test") datastore.GetTestable(ctx).Consistent(true) k := entities.DUTGroupKey(ctx) duts := []*entities.DUT{ {ID: "ionasal", Group: k}, } if err := datastore.Put(ctx, duts); err != nil { t.Fatal(err) } var d DroneQueenImpl _, err := d.ReleaseDuts(ctx, &api.ReleaseDutsRequest{ DroneUuid: "earthes", Duts: []string{"ionasal"}, }) if err != nil { t.Fatal(err) } assertDatastoreDUTs(ctx, t, duts) }) t.Run("release DUTs of another drone", func(t *testing.T) { t.Parallel() ctx := gaetesting.TestingContextWithAppID("go-test") datastore.GetTestable(ctx).Consistent(true) k := entities.DUTGroupKey(ctx) duts := []*entities.DUT{ {ID: "casty", Group: k, AssignedDrone: "delta"}, } if err := datastore.Put(ctx, duts); err != nil { t.Fatal(err) } var d DroneQueenImpl _, err := d.ReleaseDuts(ctx, &api.ReleaseDutsRequest{ DroneUuid: "earthes", Duts: []string{"casty"}, }) if err != nil { t.Fatal(err) } assertDatastoreDUTs(ctx, t, duts) }) t.Run("release nonexistent DUT", func(t *testing.T) { t.Parallel() ctx := gaetesting.TestingContextWithAppID("go-test") datastore.GetTestable(ctx).Consistent(true) k := entities.DUTGroupKey(ctx) duts := []*entities.DUT{ {ID: "casty", Group: k, AssignedDrone: "delta"}, } if err := datastore.Put(ctx, duts); err != nil { t.Fatal(err) } var d DroneQueenImpl _, err := d.ReleaseDuts(ctx, &api.ReleaseDutsRequest{ DroneUuid: "earthes", Duts: []string{"nelo"}, }) if err != nil { t.Fatal(err) } assertDatastoreDUTs(ctx, t, duts) }) t.Run("omit drone UUID", func(t *testing.T) { t.Parallel() ctx := gaetesting.TestingContextWithAppID("go-test") datastore.GetTestable(ctx).Consistent(true) var d DroneQueenImpl _, err := d.ReleaseDuts(ctx, &api.ReleaseDutsRequest{}) if err == nil { t.Errorf("Expected error, got no error") } }) }
explode_data.jsonl/36001
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1678 }
[ 2830, 3393, 8847, 603, 52006, 9673, 85573, 35, 6128, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3244, 16708, 445, 22998, 678, 422, 1381, 82, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 41288, 7957, 741, 197, 20985, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommentsCreateWithMissingParams(t *testing.T) { err := logger.Init() if err != nil { t.Errorf("Comments.CreateRoute: failed to init logger. Error: %s", err.Error()) } router := handlers.NewRouter() srv := httptest.NewServer(router) defer srv.Close() var testsWithMissingParams = []struct { body string missingField string }{ {"text=TestComment", comments.TaskIDField}, {fmt.Sprintf("taskId=%s", uuid.New().String()), comments.CommentTextField}, } for _, test := range testsWithMissingParams { requestBody := strings.NewReader(test.body) res, err := http.Post(srv.URL+"/comments/create", "application/x-www-form-urlencoded", requestBody) if err != nil { t.Errorf("Comments.CreateRoute: expected request without errors. Got %s", err.Error()) } reader := bufio.NewReader(res.Body) line, err := reader.ReadString('\n') if err != nil && err != io.EOF { t.Errorf("Comments.CreateRoute: expected response reading without errors. Got %s", err.Error()) } if !strings.Contains(line, httpErrors.BadRequestMessage) { t.Errorf("Comments.CreateRoute: expected bad request. Got %s", line) } if !strings.Contains(line, httpErrors.GetMissingParameterErrorMessage(test.missingField)) { t.Errorf("Comments.CreateRoute: expected missing parameter %s. Got %s", test.missingField, line) } res.Body.Close() } }
explode_data.jsonl/44675
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 487 }
[ 2830, 3393, 17373, 4021, 2354, 25080, 4870, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 5925, 26849, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 17373, 7251, 4899, 25, 4641, 311, 2930, 5925, 13, 4600, 25, 1018, 82, 497, 1848,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadWeekdays(t *testing.T) { type args struct { in string } tests := []struct { name string args args want []models.Weekday wantErr bool }{ {"", args{"1,3,5"}, []models.Weekday{models.Monday, models.Wednesday, models.Friday}, false}, {"", args{""}, []models.Weekday{}, false}, {"", args{"7,6,5,4,3,2,1"}, []models.Weekday{models.Monday, models.Tuesday, models.Wednesday, models.Thursday, models.Friday, models.Saturday, models.Sunday}, false}, {"", args{"1,,2"}, nil, true}, {"", args{","}, nil, true}, {"", args{"100"}, nil, true}, {"", args{"3"}, []models.Weekday{models.Wednesday}, false}, {"", args{"6,6,6"}, []models.Weekday{models.Saturday}, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := models.LoadWeekdays(tt.args.in) if (err != nil) != tt.wantErr { t.Errorf("LoadWeekdays() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("LoadWeekdays() got = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/74978
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 447 }
[ 2830, 3393, 5879, 17053, 13778, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 17430, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 50780, 262, 3056, 6507, 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...
3