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 TestWithConstructor(t *testing.T) { g := gomega.NewGomegaWithT(t) j := New() g.Expect(j.LoadPrivateKey("testdata/private.pem")).Should(gomega.Succeed()) g.Expect(j.LoadPublicKey("testdata/public.pem")).Should(gomega.Succeed()) s, err := j.Sign(jwt.StandardClaims{ ExpiresAt: time.Now().Add(time.Minute).Unix(), Id: "my-id", }) g.Expect(err).Should(gomega.Succeed()) g.Expect(s).Should(gomega.MatchRegexp(`^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\z`)) token, err := j.Validate(s) g.Expect(err).Should(gomega.Succeed()) g.Expect(token).ShouldNot(gomega.BeNil()) g.Expect(token.Claims.(*jwt.StandardClaims).Id).Should(gomega.Equal("my-id")) sExp, err := j.Sign(jwt.StandardClaims{ ExpiresAt: time.Now().Add(time.Minute * -1).Unix(), Id: "my-id", }) g.Expect(err).Should(gomega.Succeed()) _, err = j.Validate(sExp) g.Expect(err).Should(gomega.Equal(ErrExpired)) _, err = j.Validate("bad-token") g.Expect(err).ShouldNot(gomega.Succeed()) // load the incorrect public key g.Expect(j.LoadPublicKey("testdata/bad-public.pem")).Should(gomega.Succeed()) _, err = j.Validate(s) jwtErr := err.(*jwt.ValidationError) g.Expect(jwtErr.Errors & jwt.ValidationErrorSignatureInvalid).Should(gomega.BeNumerically(">", 0)) }
explode_data.jsonl/13923
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 593 }
[ 2830, 3393, 2354, 13288, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 692, 12428, 1669, 1532, 741, 3174, 81893, 3325, 13969, 75981, 445, 92425, 81001, 49373, 15197, 14996, 3268, 32696, 808, 29264,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQuote(t *testing.T) { for _, qt := range quoteTests { act := Quote(qt.in) if act != qt.exp { t.Error(pretty.Compare(act, qt.exp)) } } }
explode_data.jsonl/69150
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 19466, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 38949, 1669, 2088, 12641, 18200, 341, 197, 92699, 1669, 24535, 10583, 83, 1858, 340, 197, 743, 1160, 961, 38949, 13754, 341, 298, 3244, 6141, 1295, 21322, 32377, 59478, 11, 38...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
3
func TestValidateRequestBody(t *testing.T) { t.Run("raw", func(t *testing.T) { validatePayloads(t, func(tracer *apm.Tracer) { tracer.SetCaptureBody(apm.CaptureBodyAll) tx := tracer.StartTransaction("name", "type") defer tx.End() body := strings.NewReader(strings.Repeat("x", 1025)) req, _ := http.NewRequest("GET", "/", body) captureBody := tracer.CaptureHTTPRequestBody(req) tx.Context.SetHTTPRequest(req) tx.Context.SetHTTPRequestBody(captureBody) }) }) t.Run("form", func(t *testing.T) { validatePayloads(t, func(tracer *apm.Tracer) { tracer.SetCaptureBody(apm.CaptureBodyAll) tx := tracer.StartTransaction("name", "type") defer tx.End() req, _ := http.NewRequest("GET", "/", strings.NewReader("x")) req.PostForm = url.Values{ "unsanitized_field": []string{strings.Repeat("x", 1025)}, } captureBody := tracer.CaptureHTTPRequestBody(req) tx.Context.SetHTTPRequest(req) tx.Context.SetHTTPRequestBody(captureBody) }) }) }
explode_data.jsonl/793
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 402 }
[ 2830, 3393, 17926, 33334, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1041, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 7067, 29683, 82, 1155, 11, 2915, 7624, 9584, 353, 391, 76, 8240, 9584, 8, 341, 298, 25583, 9584, 4202...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResourceQuotaCollector(t *testing.T) { // Fixed metadata on type and help text. We prepend this to every expected // output so we only have to modify a single place when doing adjustments. const metadata = ` # HELP kube_resourcequota Information about resource quota. # TYPE kube_resourcequota gauge # HELP kube_resourcequota_created Unix creation timestamp # TYPE kube_resourcequota_created gauge ` cases := []struct { quotas []v1.ResourceQuota metrics []string // which metrics should be checked want string }{ // Verify populating base metrics and that metrics for unset fields are skipped. { quotas: []v1.ResourceQuota{ { ObjectMeta: metav1.ObjectMeta{ Name: "quotaTest", CreationTimestamp: metav1.Time{Time: time.Unix(1500000000, 0)}, Namespace: "testNS", }, Status: v1.ResourceQuotaStatus{}, }, }, want: metadata + ` kube_resourcequota_created{namespace="testNS",resourcequota="quotaTest"} 1.5e+09 `, }, // Verify resource metrics. { quotas: []v1.ResourceQuota{ { ObjectMeta: metav1.ObjectMeta{ Name: "quotaTest", Namespace: "testNS", }, Spec: v1.ResourceQuotaSpec{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4.3"), v1.ResourceMemory: resource.MustParse("2.1G"), v1.ResourceStorage: resource.MustParse("10G"), v1.ResourcePods: resource.MustParse("9"), v1.ResourceServices: resource.MustParse("8"), v1.ResourceReplicationControllers: resource.MustParse("7"), v1.ResourceQuotas: resource.MustParse("6"), v1.ResourceSecrets: resource.MustParse("5"), v1.ResourceConfigMaps: resource.MustParse("4"), v1.ResourcePersistentVolumeClaims: resource.MustParse("3"), v1.ResourceServicesNodePorts: resource.MustParse("2"), v1.ResourceServicesLoadBalancers: resource.MustParse("1"), }, }, Status: v1.ResourceQuotaStatus{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4.3"), v1.ResourceMemory: resource.MustParse("2.1G"), v1.ResourceStorage: resource.MustParse("10G"), v1.ResourcePods: resource.MustParse("9"), v1.ResourceServices: resource.MustParse("8"), v1.ResourceReplicationControllers: resource.MustParse("7"), v1.ResourceQuotas: resource.MustParse("6"), v1.ResourceSecrets: resource.MustParse("5"), v1.ResourceConfigMaps: resource.MustParse("4"), v1.ResourcePersistentVolumeClaims: resource.MustParse("3"), v1.ResourceServicesNodePorts: resource.MustParse("2"), v1.ResourceServicesLoadBalancers: resource.MustParse("1"), }, Used: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("2.1"), v1.ResourceMemory: resource.MustParse("500M"), v1.ResourceStorage: resource.MustParse("9G"), v1.ResourcePods: resource.MustParse("8"), v1.ResourceServices: resource.MustParse("7"), v1.ResourceReplicationControllers: resource.MustParse("6"), v1.ResourceQuotas: resource.MustParse("5"), v1.ResourceSecrets: resource.MustParse("4"), v1.ResourceConfigMaps: resource.MustParse("3"), v1.ResourcePersistentVolumeClaims: resource.MustParse("2"), v1.ResourceServicesNodePorts: resource.MustParse("1"), v1.ResourceServicesLoadBalancers: resource.MustParse("0"), }, }, }, }, want: metadata + ` kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="cpu",type="hard"} 4.3 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="cpu",type="used"} 2.1 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="memory",type="hard"} 2.1e+09 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="memory",type="used"} 5e+08 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="storage",type="hard"} 1e+10 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="storage",type="used"} 9e+09 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="pods",type="hard"} 9 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="pods",type="used"} 8 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="services",type="hard"} 8 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="services",type="used"} 7 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="replicationcontrollers",type="hard"} 7 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="replicationcontrollers",type="used"} 6 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="resourcequotas",type="hard"} 6 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="resourcequotas",type="used"} 5 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="secrets",type="hard"} 5 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="secrets",type="used"} 4 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="configmaps",type="hard"} 4 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="configmaps",type="used"} 3 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="persistentvolumeclaims",type="hard"} 3 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="persistentvolumeclaims",type="used"} 2 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="services.nodeports",type="hard"} 2 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="services.nodeports",type="used"} 1 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="services.loadbalancers",type="hard"} 1 kube_resourcequota{resourcequota="quotaTest",namespace="testNS",resource="services.loadbalancers",type="used"} 0 `, }, } for _, c := range cases { dc := &resourceQuotaCollector{ store: &mockResourceQuotaStore{ list: func() (v1.ResourceQuotaList, error) { return v1.ResourceQuotaList{Items: c.quotas}, nil }, }, opts: &options.Options{}, } if err := testutils.GatherAndCompare(dc, c.want, c.metrics); err != nil { t.Errorf("unexpected collecting result:\n%s", err) } } }
explode_data.jsonl/72063
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2921 }
[ 2830, 3393, 4783, 2183, 6089, 53694, 1155, 353, 8840, 836, 8, 341, 197, 322, 20149, 11160, 389, 943, 323, 1492, 1467, 13, 1205, 73647, 419, 311, 1449, 3601, 198, 197, 322, 2550, 773, 582, 1172, 614, 311, 5602, 264, 3175, 1992, 979, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInterfaceToInt8Downcast(t *testing.T) { var out int8 var ok bool out, ok = InterfaceToInt8Downcast(int(1)) require.True(t, ok) require.Equal(t, int8(1), out) out, ok = InterfaceToInt8Downcast(float32(2)) require.True(t, ok) require.Equal(t, int8(2), out) out, ok = InterfaceToInt8Downcast(float32(2.0)) require.True(t, ok) require.Equal(t, int8(2), out) _, ok = InterfaceToInt8Downcast(float32(2.2)) require.False(t, ok) out, ok = InterfaceToInt8Downcast(float64(3)) require.True(t, ok) require.Equal(t, int8(3), out) out, ok = InterfaceToInt8Downcast(float64(3.0)) require.True(t, ok) require.Equal(t, int8(3), out) _, ok = InterfaceToInt8Downcast(float64(3.3)) require.False(t, ok) _, ok = InterfaceToInt8Downcast("test") require.False(t, ok) _, ok = InterfaceToInt8Downcast(int(999999)) require.False(t, ok) }
explode_data.jsonl/52295
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 365 }
[ 2830, 3393, 5051, 38544, 23, 4454, 3829, 1155, 353, 8840, 836, 8, 341, 2405, 700, 526, 23, 198, 2405, 5394, 1807, 271, 13967, 11, 5394, 284, 20019, 38544, 23, 4454, 3829, 1548, 7, 16, 1171, 17957, 32443, 1155, 11, 5394, 340, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_makeBoardURL(t *testing.T) { type args struct { board string page int } tests := []struct { name string args args want string }{ {"no page", args{"ezsoft", -1}, "https://www.ptt.cc/bbs/ezsoft/index.html"}, {"page1", args{"ezsoft", 1}, "https://www.ptt.cc/bbs/ezsoft/index1.html"}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := makeBoardURL(tt.args.board, tt.args.page); got != tt.want { t.Errorf("makeBoardURL() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/714
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 28230, 11932, 3144, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 59868, 914, 198, 197, 35272, 220, 526, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 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 TestNewAggregatorMixin(t *testing.T) { src := newMockAggregate("1", "foo", 1) updated := newMockAggregate("1", "foo", 2) src.UpdateState(updated) assert.Equal(t, src.Val, updated.Val) }
explode_data.jsonl/48905
{ "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, 3564, 9042, 58131, 38456, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 501, 11571, 64580, 445, 16, 497, 330, 7975, 497, 220, 16, 340, 197, 11768, 1669, 501, 11571, 64580, 445, 16, 497, 330, 7975, 497, 220, 17, 692, 41144, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIterator_FieldNumber(t *testing.T) { message := &testmsg.Packed{ I64: make([]int64, 4000), } data, err := proto.Marshal(message) if err != nil { t.Fatalf("unable to marshal: %v", err) } msg := New(data) if !msg.Next() { t.Fatalf("next is false?") } iter, err := msg.Iterator(nil) if err != nil { t.Fatalf("error getting iterator: %v", err) } if v := iter.FieldNumber(); v != 4 { t.Errorf("incorrect field number: %v", v) } }
explode_data.jsonl/61789
{ "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, 11951, 46272, 2833, 1155, 353, 8840, 836, 8, 341, 24753, 1669, 609, 1944, 3236, 1069, 11191, 515, 197, 24486, 21, 19, 25, 1281, 10556, 396, 21, 19, 11, 220, 19, 15, 15, 15, 1326, 197, 532, 8924, 11, 1848, 1669, 18433, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetObject_NilMsgPayload(t *testing.T) { t.Parallel() ctx := inslogger.TestContext(t) meta := payload.Meta{ Polymorph: uint32(payload.TypeMeta), Payload: nil, } handler := handle.NewGetObject(nil, meta, false) err := handler.Present(ctx, flow.NewFlowMock(t)) require.Error(t, err) }
explode_data.jsonl/61479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 84540, 1604, 321, 6611, 29683, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 20985, 1669, 1640, 9786, 8787, 1972, 1155, 340, 84004, 1669, 7729, 58806, 515, 197, 10025, 337, 1600, 16347, 25, 2622, 18, 17, 26772, 1018...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNginxBasic(t *testing.T) { cli, err := getDockerClient() if err != nil { t.Fatal(err) } resp, err := cli.ContainerCreate(context.Background(), &container.Config{ Image: "busybox", Cmd: []string{"sh"}, Tty: true, Labels: map[string]string{ "interlock.hostname": "test.local", }, }, nil, nil, "") if err != nil { t.Fatal(err) } id := resp.ID defer func() { if err := cli.ContainerRemove(context.Background(), id, types.ContainerRemoveOptions{ RemoveVolumes: true, RemoveLinks: false, Force: true, }); err != nil { t.Error(err) } }() }
explode_data.jsonl/1860
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 45, 8163, 14377, 5971, 1155, 353, 8840, 836, 8, 341, 86448, 11, 1848, 1669, 633, 35, 13659, 2959, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 34653, 11, 1848, 1669, 21348, 33672, 4021, 5378, 1904...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFxVerifyTransferOperationWrongUTXO(t *testing.T) { vm := secp256k1fx.TestVM{ Codec: linearcodec.NewDefault(), Log: logging.NoLog{}, } date := time.Date(2019, time.January, 19, 16, 25, 17, 3, time.UTC) vm.CLK.Set(date) fx := Fx{} if err := fx.Initialize(&vm); err != nil { t.Fatal(err) } tx := &secp256k1fx.TestTx{ Bytes: txBytes, } cred := &Credential{Credential: secp256k1fx.Credential{ Sigs: [][crypto.SECP256K1RSigLen]byte{ sigBytes, }, }} op := &TransferOperation{ Input: secp256k1fx.Input{ SigIndices: []uint32{0}, }, Output: TransferOutput{ GroupID: 1, Payload: []byte{2}, OutputOwners: secp256k1fx.OutputOwners{ Threshold: 1, Addrs: []ids.ShortID{ ids.ShortEmpty, }, }, }, } utxos := []interface{}{nil} if err := fx.VerifyOperation(tx, op, cred, utxos); err == nil { t.Fatalf("VerifyOperation should have errored due to an invalid utxo") } }
explode_data.jsonl/56458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 437 }
[ 2830, 3393, 81856, 32627, 21970, 8432, 29185, 1381, 55, 46, 1155, 353, 8840, 836, 8, 341, 54879, 1669, 511, 4672, 17, 20, 21, 74, 16, 8298, 8787, 11187, 515, 197, 197, 36913, 25, 13482, 34607, 7121, 3675, 3148, 197, 24201, 25, 256, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEnvoyStatsCompleteAndSuccessful(t *testing.T) { g := NewGomegaWithT(t) stats := "cluster_manager.cds.update_success: 1\nlistener_manager.lds.update_success: 1" server := createAndStartServer(stats) defer server.Close() err := probe.Check() g.Expect(err).NotTo(HaveOccurred()) }
explode_data.jsonl/41344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 109 }
[ 2830, 3393, 14359, 2253, 16635, 12548, 3036, 36374, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 340, 79659, 1669, 330, 18855, 12144, 520, 5356, 5317, 18632, 25, 220, 16, 1699, 35039, 12144, 13, 71033, 5317...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMessageUnmarshal(t *testing.T) { skipBigEndian(t) tests := []struct { name string b []byte m Message err error }{ { name: "empty", err: errShortMessage, }, { name: "short", b: make([]byte, 15), err: errShortMessage, }, { name: "unaligned", b: make([]byte, 17), err: errUnalignedMessage, }, { name: "fuzz crasher: length shorter than slice", b: []byte("\x1d000000000000000"), err: errShortMessage, }, { name: "fuzz crasher: length longer than slice", b: []byte("\x13\x00\x00\x000000000000000000"), err: errShortMessage, }, { name: "OK no data", b: []byte{ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, m: Message{ Header: Header{ Length: 16, }, Data: make([]byte, 0), }, }, { name: "OK data", m: Message{ Header: Header{ Length: 20, Type: HeaderTypeError, Sequence: 2, PID: 20, }, Data: []byte("abcd"), }, b: []byte{ 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x61, 0x62, 0x63, 0x64, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var m Message err := (&m).UnmarshalBinary(tt.b) if want, got := tt.err, err; want != got { t.Fatalf("unexpected error:\n- want: %v\n- got: %v", want, got) } if err != nil { return } if want, got := tt.m, m; !reflect.DeepEqual(want, got) { t.Fatalf("unexpected Message:\n- want: %#v\n- got: %#v", want, got) } }) } }
explode_data.jsonl/25584
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 925 }
[ 2830, 3393, 2052, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 15636, 43231, 1155, 692, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 2233, 262, 3056, 3782, 198, 197, 2109, 262, 4856, 198, 197, 9859, 220, 1465, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResponseWriterWithFlusher(t *testing.T) { r := httptest.NewRecorder() w := NewResponseWriter(r) s := "A little copying is better than a little dependency." t.Run("StatusReturnZero", func(t *testing.T) { equal(t, 0, w.Status()) }) t.Run("FlushReturnFalse", func(t *testing.T) { equal(t, false, r.Flushed) }) t.Run("FlushReturnTrue", func(t *testing.T) { _, err := r.WriteString(s) equal(t, nil, err) equal(t, false, r.Flushed) w.Flush() equal(t, true, r.Flushed) }) t.Run("StatusReturnDefaultOK", func(t *testing.T) { equal(t, http.StatusOK, w.Status()) }) }
explode_data.jsonl/22519
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 249 }
[ 2830, 3393, 2582, 6492, 2354, 46874, 261, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 54320, 70334, 7121, 47023, 741, 6692, 1669, 1532, 2582, 6492, 2601, 340, 1903, 1669, 330, 32, 2632, 31039, 374, 2664, 1091, 264, 2632, 24036, 2217, 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 TestResolveServers(t *testing.T) { tests := []struct { servers Servers results []string }{ { servers: nil, results: nil, }, { servers: Servers{}, results: nil, }, { servers: Servers{"A"}, results: []string{"A"}, }, { servers: Servers{"A", "B"}, results: []string{"A", "B"}, }, { servers: Servers{"A", "B", "C"}, results: []string{"A", "B", "C"}, }, } for _, test := range tests { t.Run(strings.Join(test.results, ","), func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) res, err := test.servers.Resolve(ctx) if err != nil { t.Error(err) } if !reflect.DeepEqual(res, test.results) { t.Error(res) } cancel() _, err = test.servers.Resolve(ctx) if err == nil { t.Error("bad error after the context was canceled:", err) } }) } }
explode_data.jsonl/38859
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 404 }
[ 2830, 3393, 56808, 78139, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 1903, 18729, 71797, 198, 197, 55497, 3056, 917, 198, 197, 59403, 197, 197, 515, 298, 1903, 18729, 25, 2092, 345, 298, 55497, 25, 2092, 345, 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...
4
func TestPackerDockerExampleLocal(t *testing.T) { t.Parallel() packerOptions := &packer.Options{ // The path to where the Packer template is located Template: "../examples/packer-docker-example/build.json", // Only build the Docker image for local testing Only: "ubuntu-docker", // Configure retries for intermittent errors RetryableErrors: DefaultRetryablePackerErrors, TimeBetweenRetries: DefaultTimeBetweenPackerRetries, MaxRetries: DefaultMaxPackerRetries, } // Build the Docker image using Packer packer.BuildArtifact(t, packerOptions) serverPort := 8080 expectedServerText := fmt.Sprintf("Hello, %s!", random.UniqueId()) dockerOptions := &docker.Options{ // Directory where docker-compose.yml lives WorkingDir: "../examples/packer-docker-example", // Configure the port the web app will listen on and the text it will return using environment variables EnvVars: map[string]string{ "SERVER_PORT": strconv.Itoa(serverPort), "SERVER_TEXT": expectedServerText, }, } // Make sure to shut down the Docker container at the end of the test defer docker.RunDockerCompose(t, dockerOptions, "down") // Run Docker Compose to fire up the web app. We run it in the background (-d) so it doesn't block this test. docker.RunDockerCompose(t, dockerOptions, "up", "-d") // It can take a few seconds for the Docker container boot up, so retry a few times maxRetries := 5 timeBetweenRetries := 2 * time.Second url := fmt.Sprintf("http://localhost:%d", serverPort) // Setup a TLS configuration to submit with the helper, a blank struct is acceptable tlsConfig := tls.Config{} // Verify that we get back a 200 OK with the expected text http_helper.HttpGetWithRetry(t, url, &tlsConfig, 200, expectedServerText, maxRetries, timeBetweenRetries) }
explode_data.jsonl/40699
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 570 }
[ 2830, 3393, 47, 9683, 35, 13659, 13314, 7319, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3223, 9683, 3798, 1669, 609, 4748, 261, 22179, 515, 197, 197, 322, 576, 1815, 311, 1380, 279, 393, 9683, 3811, 374, 7407, 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...
1
func TestRecursiveScannerOptions(t *testing.T) { t.Run("When erroring option is passed", ScannerTest(func(t *testing.T) { s, err := NewRecursiveScanner(func(_ *RecursiveScanner) error { return errors.New("dummy error") }) Expect(err).To(HaveOccurred()) Expect(s).To(BeNil()) })) t.Run("When no directories passed", ScannerTest(func(t *testing.T) { err := WithDirectories()(&RecursiveScanner{}) Expect(err).ToNot(HaveOccurred()) })) }
explode_data.jsonl/25347
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 78542, 31002, 3798, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4498, 1465, 287, 2999, 374, 5823, 497, 17170, 2271, 18552, 1155, 353, 8840, 836, 8, 341, 197, 1903, 11, 1848, 1669, 1532, 78542, 31002, 18552, 2490, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEventsByTimeRange(t *testing.T) { event1 := persistedEvent event2 := persistedEvent event2.Origin = event2.Origin + 20 event3 := persistedEvent event3.Origin = event3.Origin + 30 event4 := persistedEvent event4.Origin = event4.Origin + 40 event5 := persistedEvent event5.Origin = event5.Origin + 50 dic := mocks.NewMockDIC() dbClientMock := &dbMock.DBClient{} dbClientMock.On("EventsByTimeRange", int(event1.Origin), int(event5.Origin), 0, 10).Return([]models.Event{event5, event4, event3, event2, event1}, nil) dbClientMock.On("EventsByTimeRange", int(event2.Origin), int(event4.Origin), 0, 10).Return([]models.Event{event4, event3, event2}, nil) dbClientMock.On("EventsByTimeRange", int(event2.Origin), int(event4.Origin), 1, 2).Return([]models.Event{event3, event2}, nil) dbClientMock.On("EventsByTimeRange", int(event2.Origin), int(event4.Origin), 4, 2).Return(nil, errors.NewCommonEdgeX(errors.KindRangeNotSatisfiable, "query objects bounds out of range", nil)) dic.Update(di.ServiceConstructorMap{ container.DBClientInterfaceName: func(get di.Get) interface{} { return dbClientMock }, }) tests := []struct { name string start int end int offset int limit int errorExpected bool ExpectedErrKind errors.ErrKind expectedCount int expectedStatusCode int }{ {"Valid - all events", int(event1.Origin), int(event5.Origin), 0, 10, false, "", 5, http.StatusOK}, {"Valid - events trimmed by latest and oldest", int(event2.Origin), int(event4.Origin), 0, 10, false, "", 3, http.StatusOK}, {"Valid - events trimmed by latest and oldest and skipped first", int(event2.Origin), int(event4.Origin), 1, 2, false, "", 2, http.StatusOK}, {"Invalid - bounds out of range", int(event2.Origin), int(event4.Origin), 4, 2, true, errors.KindRangeNotSatisfiable, 0, http.StatusRequestedRangeNotSatisfiable}, } for _, testCase := range tests { t.Run(testCase.name, func(t *testing.T) { events, err := EventsByTimeRange(testCase.start, testCase.end, testCase.offset, testCase.limit, dic) if testCase.errorExpected { require.Error(t, err) assert.NotEmpty(t, err.Error(), "Error message is empty") assert.Equal(t, testCase.ExpectedErrKind, errors.Kind(err), "Error kind not as expected") assert.Equal(t, testCase.expectedStatusCode, err.Code(), "Status code not as expected") } else { require.NoError(t, err) assert.Equal(t, testCase.expectedCount, len(events), "Event total count is not expected") } }) } }
explode_data.jsonl/54249
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 970 }
[ 2830, 3393, 7900, 1359, 1462, 6046, 1155, 353, 8840, 836, 8, 341, 28302, 16, 1669, 52995, 1556, 198, 28302, 17, 1669, 52995, 1556, 198, 28302, 17, 13, 13298, 284, 1538, 17, 13, 13298, 488, 220, 17, 15, 198, 28302, 18, 1669, 52995, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunMigratorMigrationFinishesUp(t *testing.T) { store := NewMockStoreIface() ticker := glock.NewMockTicker(time.Second) migrator := NewMockMigrator() migrator.ProgressFunc.PushReturn(0.8, nil) // check migrator.ProgressFunc.PushReturn(0.9, nil) // after up migrator.ProgressFunc.SetDefaultReturn(1.0, nil) // after up runMigratorWrapped(store, migrator, ticker, func(migrations chan<- Migration) { migrations <- Migration{ID: 1, Progress: 0.8} tickN(ticker, 5) }) if callCount := len(migrator.UpFunc.History()); callCount != 2 { t.Errorf("unexpected number of calls to Up. want=%d have=%d", 2, callCount) } if callCount := len(migrator.DownFunc.History()); callCount != 0 { t.Errorf("unexpected number of calls to Down. want=%d have=%d", 0, callCount) } }
explode_data.jsonl/11534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 6727, 44, 5233, 850, 20168, 9134, 20527, 2324, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 1532, 11571, 6093, 40, 1564, 741, 3244, 5215, 1669, 342, 1023, 7121, 11571, 87278, 9730, 32435, 692, 2109, 5233, 850, 1669, 1532, 1157...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCryptocurrencyParseAndCheck(t *testing.T) { for i, v := range testVectors { typ, _, err := CryptocurrencyParseAndCheck(v.address) if typ != v.wantedType { t.Fatalf("Address %s (%d): got wrong CryptocurrencyTyp: %v != %v (%v)", v.address, i, typ, v.wantedType, err) } } }
explode_data.jsonl/21966
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 53367, 77480, 14463, 3036, 3973, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 348, 1669, 2088, 1273, 84744, 341, 197, 25314, 11, 8358, 1848, 1669, 37447, 77480, 14463, 3036, 3973, 3747, 13792, 340, 197, 743, 3582, 961, 348, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateDisallowedOtherClaim(t *testing.T) { b, storage := getTestBackend(t) role := "tester" err := writeRole(b, storage, role, role+".example.com", map[string]interface{}{"sub": "not allowed"}, map[string]interface{}{}) if err == nil { t.Fatalf("Create role should have failed") } err = writeRole(b, storage, role, role+".example.com", map[string]interface{}{"foo": "bar"}, map[string]interface{}{}) if err == nil { t.Fatalf("Create role should have failed") } resp, err := writeConfig(b, storage, map[string]interface{}{"allowed_claims": []string{"foo"}}) if err != nil { t.Fatalf("err:%s resp:%#v\n", err, resp) } err = writeRole(b, storage, role, role+".example.com", map[string]interface{}{"foo": "bar"}, map[string]interface{}{}) if err != nil { t.Errorf("%s\n", err) } }
explode_data.jsonl/1315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 303 }
[ 2830, 3393, 4021, 4839, 20967, 11409, 45544, 1155, 353, 8840, 836, 8, 341, 2233, 11, 5819, 1669, 633, 2271, 29699, 1155, 692, 197, 5778, 1669, 330, 73358, 1837, 9859, 1669, 3270, 9030, 1883, 11, 5819, 11, 3476, 11, 3476, 41449, 8687, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHashingAlgorithm(t *testing.T) { cc := &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{}}} assert.Error(t, cc.validateHashingAlgorithm(), "Must supply hashing algorithm") cc = &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{Name: "MD5"}}} assert.Error(t, cc.validateHashingAlgorithm(), "Bad hashing algorithm supplied") cc = &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{Name: bccsp.SHA256}}} assert.NoError(t, cc.validateHashingAlgorithm(), "Allowed hashing algorith SHA256 supplied") assert.Equal(t, reflect.ValueOf(util.ComputeSHA256).Pointer(), reflect.ValueOf(cc.HashingAlgorithm()).Pointer(), "Unexpected hashing algorithm returned") cc = &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{Name: bccsp.SHA3_256}}} assert.NoError(t, cc.validateHashingAlgorithm(), "Allowed hashing algorith SHA3_256 supplied") assert.Equal(t, reflect.ValueOf(util.ComputeSHA3256).Pointer(), reflect.ValueOf(cc.HashingAlgorithm()).Pointer(), "Unexpected hashing algorithm returned") }
explode_data.jsonl/30622
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 363 }
[ 2830, 3393, 6370, 287, 27847, 1155, 353, 8840, 836, 8, 341, 63517, 1669, 609, 9629, 2648, 90, 4391, 436, 25, 609, 9629, 12423, 436, 90, 6370, 287, 27847, 25, 609, 7221, 15103, 287, 27847, 90, 3417, 532, 6948, 6141, 1155, 11, 12527, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetConcernedFiles(t *testing.T) { data := githubFakes.FakeRepoData() actualConcernMap := GetConcernedFiles(data, test.ProjDir()) t.Logf("concerned files for PR %v:%v", data.Pr, actualConcernMap) expectedConcerns := test.MakeStringSet() for _, fileName := range []string{ "common.go", "onlySrcChange.go", "onlyTestChange.go", "newlyAddedFile.go", } { expectedConcerns.Add(path.Join(test.CovTargetDir, fileName)) } t.Logf("expected concerns=%v", expectedConcerns.AllMembers()) for fileName, actual := range *actualConcernMap { expected := expectedConcerns.Has(fileName) if actual != expected { t.Fatalf("filename=%s, isConcerned: expected=%v; actual=%v\n", fileName, expected, actual) } } }
explode_data.jsonl/11550
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 1949, 62142, 291, 10809, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 31004, 37, 2050, 991, 726, 25243, 1043, 741, 88814, 62142, 2227, 1669, 2126, 62142, 291, 10809, 2592, 11, 1273, 7763, 73, 6184, 2398, 3244, 98954, 445, 443, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_NewResourceGroup(t *testing.T) { g := NewGomegaWithT(t) ctx := context.Background() testContext, err := testContext.ForTest(t) g.Expect(err).ToNot(HaveOccurred()) resourceGroup := testContext.NewTestResourceGroup() resolved := genruntime.ConvertToARMResolvedDetails{ Name: resourceGroup.Name, ResolvedReferences: genruntime.MakeResolvedReferences(nil), } resourceGroupSpec, err := resourceGroup.Spec.ConvertToARM(resolved) g.Expect(err).ToNot(HaveOccurred()) typedResourceGroupSpec := resourceGroupSpec.(resources.ResourceGroupSpecARM) id := genericarmclient.MakeResourceGroupID(testContext.AzureSubscription, resourceGroup.Name) poller, err := testContext.AzureClient.BeginCreateOrUpdateByID(ctx, id, typedResourceGroupSpec.GetAPIVersion(), typedResourceGroupSpec) g.Expect(err).ToNot(HaveOccurred()) g.Eventually(poller).Should(testContext.AzureMatch.BeProvisioned(ctx)) // Get the resource status := resources.ResourceGroupStatus{} _, err = testContext.AzureClient.GetByID(ctx, id, typedResourceGroupSpec.GetAPIVersion(), &status) g.Expect(err).ToNot(HaveOccurred()) // Delete the deployment _, err = testContext.AzureClient.DeleteByID(ctx, id, typedResourceGroupSpec.GetAPIVersion()) g.Expect(err).ToNot(HaveOccurred()) // Ensure that the resource group is deleted g.Eventually([]string{id, typedResourceGroupSpec.GetAPIVersion()}).Should(testContext.AzureMatch.BeDeleted(ctx)) }
explode_data.jsonl/3277
{ "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, 39582, 4783, 2808, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 340, 20985, 1669, 2266, 19047, 2822, 18185, 1972, 11, 1848, 1669, 1273, 1972, 26676, 2271, 1155, 340, 3174, 81893, 3964, 568, 1249...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntArray_Shuffle(t *testing.T) { gtest.C(t, func(t *gtest.T) { a1 := []int{0, 1, 2, 3, 4, 5, 6} array1 := garray.NewIntArrayFrom(a1) t.Assert(array1.Shuffle().Len(), 7) }) }
explode_data.jsonl/47611
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 95338, 36578, 13208, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11323, 16, 1669, 3056, 396, 90, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetActiveOrders(t *testing.T) { p.SetDefaults() TestSetup(t) var getOrdersRequest = exchange.GetOrdersRequest{ OrderType: exchange.AnyOrderType, } _, err := p.GetActiveOrders(&getOrdersRequest) if areTestAPIKeysSet() && err != nil { t.Errorf("Could not get open orders: %s", err) } else if !areTestAPIKeysSet() && err == nil { t.Error("Expecting an error when no keys are set") } }
explode_data.jsonl/23569
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 1949, 5728, 24898, 1155, 353, 8840, 836, 8, 341, 3223, 4202, 16273, 741, 73866, 21821, 1155, 692, 2405, 633, 24898, 1900, 284, 9289, 2234, 24898, 1900, 515, 197, 197, 4431, 929, 25, 9289, 13311, 4431, 929, 345, 197, 630, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestIntn(t *testing.T) { ctx := context.Background() seed := "testing" newCtx := WithSeed(ctx, seed) r := Intn(newCtx, 5) if r != 2 { t.Errorf("Failed to get expected 'random' result from int: got %d instead of 2", r) } }
explode_data.jsonl/28154
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 1072, 77, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 197, 22602, 1669, 330, 8840, 1837, 8638, 23684, 1669, 3085, 41471, 7502, 11, 10320, 692, 7000, 1669, 1333, 77, 1755, 23684, 11, 220, 20, 692, 743, 435,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWalletGetDefault(t *testing.T) { app, mockApi, buffer, done := NewMockAppWithFullAPI(t, WithCategory("wallet", walletGetDefault)) defer done() ctx, cancel := context.WithCancel(context.Background()) defer cancel() addr, err := address.NewFromString("t0123") assert.NoError(t, err) mockApi.EXPECT().WalletDefaultAddress(ctx).Return(addr, nil) //stm: @CLI_WALLET_GET_DEFAULT_001 err = app.Run([]string{"wallet", "default"}) assert.NoError(t, err) assert.Contains(t, buffer.String(), addr.String()) }
explode_data.jsonl/8253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 38259, 1949, 3675, 1155, 353, 8840, 836, 8, 341, 28236, 11, 7860, 6563, 11, 4147, 11, 2814, 1669, 1532, 11571, 2164, 2354, 9432, 7082, 1155, 11, 3085, 6746, 445, 35735, 497, 15085, 1949, 3675, 1171, 16867, 2814, 2822, 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...
1
func Test_mul(t *testing.T) { numA, numB, expectedResult := 4, 8, 32 result := mul(numA, numB) if result != expectedResult { t.Fatalf("Mul error: expected %d, but got %d", expectedResult, result) } }
explode_data.jsonl/22788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 24944, 1155, 353, 8840, 836, 8, 341, 22431, 32, 11, 1629, 33, 11, 81441, 1669, 220, 19, 11, 220, 23, 11, 220, 18, 17, 198, 9559, 1669, 15602, 8068, 32, 11, 1629, 33, 340, 743, 1102, 961, 81441, 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...
2
func TestCancelRetry(t *testing.T) { assert := internal.NewAssert(t, "TestCancelRetry") ctx, cancel := context.WithCancel(context.TODO()) var number int increaseNumber := func() error { number++ if number > 3 { cancel() } return errors.New("error occurs") } err := Retry(increaseNumber, RetryDuration(time.Microsecond*50), Context(ctx), ) assert.IsNotNil(err) assert.Equal(4, number) }
explode_data.jsonl/30741
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 9269, 51560, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 5306, 7121, 8534, 1155, 11, 330, 2271, 9269, 51560, 5130, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 90988, 2398, 2405, 1372, 526, 198, 17430, 19947, 2833, 1669, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStrToUInt16(t *testing.T) { tests := []struct { flag []string expected []uint16 expected_error bool }{ { // Happy case flag: []string{"TLS_RSA_WITH_RC4_128_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_RC4_128_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"}, expected: []uint16{tls.TLS_RSA_WITH_RC4_128_SHA, tls.TLS_RSA_WITH_AES_128_CBC_SHA, tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA}, expected_error: false, }, { // One flag only flag: []string{"TLS_RSA_WITH_RC4_128_SHA"}, expected: []uint16{tls.TLS_RSA_WITH_RC4_128_SHA}, expected_error: false, }, { // Empty flag flag: []string{}, expected: nil, expected_error: false, }, { // Duplicated flag flag: []string{"TLS_RSA_WITH_RC4_128_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_RC4_128_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_RC4_128_SHA"}, expected: []uint16{tls.TLS_RSA_WITH_RC4_128_SHA, tls.TLS_RSA_WITH_AES_128_CBC_SHA, tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, tls.TLS_RSA_WITH_RC4_128_SHA}, expected_error: false, }, { // Invalid flag flag: []string{"foo"}, expected: nil, expected_error: true, }, } for i, test := range tests { uIntFlags, err := TLSCipherSuites(test.flag) if reflect.DeepEqual(uIntFlags, test.expected) == false { t.Errorf("%d: expected %+v, got %+v", i, test.expected, uIntFlags) } if test.expected_error && err == nil { t.Errorf("%d: expecting error, got %+v", i, err) } } }
explode_data.jsonl/36380
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 895 }
[ 2830, 3393, 2580, 1249, 18777, 16, 21, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 30589, 1843, 3056, 917, 198, 197, 42400, 981, 3056, 2496, 16, 21, 198, 197, 42400, 4096, 1807, 198, 197, 59403, 197, 197, 515, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestVarStringWire(t *testing.T) { pver := ProtocolVersion // str256 is a string that takes a 2-byte varint to encode. str256 := strings.Repeat("test", 64) tests := []struct { in string // String to encode out string // String to decoded value buf []byte // Wire encoding pver uint32 // Protocol version for wire encoding }{ // Latest protocol version. // Empty string {"", "", []byte{0x00}, pver}, // Single byte varint + string {"Test", "Test", append([]byte{0x04}, []byte("Test")...), pver}, // 2-byte varint + string {str256, str256, append([]byte{0xfd, 0x00, 0x01}, []byte(str256)...), pver}, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { // Encode to wire format. var buf bytes.Buffer err := WriteVarString(&buf, test.pver, test.in) if err != nil { t.Errorf("WriteVarString #%d error %v", i, err) continue } if !bytes.Equal(buf.Bytes(), test.buf) { t.Errorf("WriteVarString #%d\n got: %s want: %s", i, spew.Sdump(buf.Bytes()), spew.Sdump(test.buf)) continue } // Decode from wire format. rbuf := bytes.NewReader(test.buf) val, err := ReadVarString(rbuf, test.pver) if err != nil { t.Errorf("ReadVarString #%d error %v", i, err) continue } if val != test.out { t.Errorf("ReadVarString #%d\n got: %s want: %s", i, val, test.out) continue } } }
explode_data.jsonl/15300
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 560 }
[ 2830, 3393, 3962, 703, 37845, 1155, 353, 8840, 836, 8, 341, 3223, 423, 1669, 24572, 5637, 271, 197, 322, 607, 17, 20, 21, 374, 264, 914, 429, 4990, 264, 220, 17, 53952, 762, 396, 311, 16164, 624, 11355, 17, 20, 21, 1669, 9069, 281...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAsyncDeleteRequest(t *testing.T) { t.Log("Sending DELETE async request... (expected http code: 200)") req := NewRequest() ch := make(chan *AsyncResponse) for i := 0; i <= 100; i++ { req.AsyncDelete("http://httpbin.org/delete", ch) } for i := 0; i <= 100; i++ { aRes := <-ch if aRes.Err != nil { t.Error(aRes.Err) } if aRes.Resp.GetStatusCode() != 200 { t.Error( "For", "DELETE http://httpbin.org/delete", "expected", 200, "got", aRes.Resp.GetStatusCode(), ) } } }
explode_data.jsonl/74149
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 6525, 6435, 1900, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 445, 49282, 17197, 3312, 1681, 1112, 320, 7325, 1758, 2038, 25, 220, 17, 15, 15, 95377, 24395, 1669, 1532, 1900, 741, 23049, 1669, 1281, 35190, 353, 6525, 2582, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestValidateCognitoIdentityPoolName(t *testing.T) { validValues := []string{ "123", "1 2 3", "foo", "foo bar", "foo_bar", "1foo 2bar 3", } for _, s := range validValues { _, errors := validateCognitoIdentityPoolName(s, "identity_pool_name") if len(errors) > 0 { t.Fatalf("%q should be a valid Cognito Identity Pool Name: %v", s, errors) } } invalidValues := []string{ "1-2-3", "foo!", "foo-bar", "foo-bar", "foo1-bar2", } for _, s := range invalidValues { _, errors := validateCognitoIdentityPoolName(s, "identity_pool_name") if len(errors) == 0 { t.Fatalf("%q should not be a valid Cognito Identity Pool Name: %v", s, errors) } } }
explode_data.jsonl/78621
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 17926, 34, 63441, 18558, 10551, 675, 1155, 353, 8840, 836, 8, 341, 56322, 6227, 1669, 3056, 917, 515, 197, 197, 1, 16, 17, 18, 756, 197, 197, 1, 16, 220, 17, 220, 18, 756, 197, 197, 1, 7975, 756, 197, 197, 1, 7975, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProxyManager(t *testing.T) { Params.Init() etcdCli, err := etcd.GetEtcdClient(&Params.BaseParams) assert.Nil(t, err) defer etcdCli.Close() ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() sessKey := path.Join(Params.BaseParams.MetaRootPath, sessionutil.DefaultServiceRoot) etcdCli.Delete(ctx, sessKey, clientv3.WithPrefix()) defer etcdCli.Delete(ctx, sessKey, clientv3.WithPrefix()) s1 := sessionutil.Session{ ServerID: 100, } b1, err := json.Marshal(&s1) assert.Nil(t, err) k1 := path.Join(sessKey, typeutil.ProxyRole+"-100") _, err = etcdCli.Put(ctx, k1, string(b1)) assert.Nil(t, err) s0 := sessionutil.Session{ ServerID: 99, } b0, err := json.Marshal(&s0) assert.Nil(t, err) k0 := path.Join(sessKey, typeutil.ProxyRole+"-99") _, err = etcdCli.Put(ctx, k0, string(b0)) assert.Nil(t, err) f1 := func(sess []*sessionutil.Session) { assert.Equal(t, len(sess), 2) assert.Equal(t, int64(100), sess[0].ServerID) assert.Equal(t, int64(99), sess[1].ServerID) t.Log("get sessions", sess[0], sess[1]) } pm := newProxyManager(ctx, etcdCli, f1) assert.Nil(t, err) fa := func(sess *sessionutil.Session) { assert.Equal(t, int64(101), sess.ServerID) t.Log("add session", sess) } fd := func(sess *sessionutil.Session) { assert.Equal(t, int64(100), sess.ServerID) t.Log("del session", sess) } pm.AddSessionFunc(fa) pm.DelSessionFunc(fd) err = pm.WatchProxy() assert.Nil(t, err) t.Log("======== start watch proxy ==========") s2 := sessionutil.Session{ ServerID: 101, } b2, err := json.Marshal(&s2) assert.Nil(t, err) k2 := path.Join(sessKey, typeutil.ProxyRole+"-101") _, err = etcdCli.Put(ctx, k2, string(b2)) assert.Nil(t, err) _, err = etcdCli.Delete(ctx, k1) assert.Nil(t, err) time.Sleep(100 * time.Millisecond) pm.Stop() time.Sleep(100 * time.Millisecond) }
explode_data.jsonl/23589
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 835 }
[ 2830, 3393, 16219, 2043, 1155, 353, 8840, 836, 8, 341, 197, 4870, 26849, 2822, 197, 295, 4385, 87014, 11, 1848, 1669, 1842, 4385, 2234, 31860, 4385, 2959, 2099, 4870, 13018, 4870, 340, 6948, 59678, 1155, 11, 1848, 340, 16867, 1842, 4385...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSelectByGVK(t *testing.T) { type testCase struct { description string in Gvk filter *Gvk expected bool } testCases := []testCase{ { description: "nil filter", in: Gvk{}, filter: nil, expected: true, }, { description: "gvk matches", in: Gvk{ Group: "group1", Version: "version1", Kind: "kind1", }, filter: &Gvk{ Group: "group1", Version: "version1", Kind: "kind1", }, expected: true, }, { description: "group doesn't matches", in: Gvk{ Group: "group1", Version: "version1", Kind: "kind1", }, filter: &Gvk{ Group: "group2", Version: "version1", Kind: "kind1", }, expected: false, }, { description: "version doesn't matches", in: Gvk{ Group: "group1", Version: "version1", Kind: "kind1", }, filter: &Gvk{ Group: "group1", Version: "version2", Kind: "kind1", }, expected: false, }, { description: "kind doesn't matches", in: Gvk{ Group: "group1", Version: "version1", Kind: "kind1", }, filter: &Gvk{ Group: "group1", Version: "version1", Kind: "kind2", }, expected: false, }, { description: "no version in filter", in: Gvk{ Group: "group1", Version: "version1", Kind: "kind1", }, filter: &Gvk{ Group: "group1", Version: "", Kind: "kind1", }, expected: true, }, { description: "only kind is set in filter", in: Gvk{ Group: "group1", Version: "version1", Kind: "kind1", }, filter: &Gvk{ Group: "", Version: "", Kind: "kind1", }, expected: true, }, } for _, tc := range testCases { filtered := tc.in.IsSelected(tc.filter) assert.Equal(t, tc.expected, filtered, tc.description) } }
explode_data.jsonl/39019
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1002 }
[ 2830, 3393, 3379, 1359, 39718, 42, 1155, 353, 8840, 836, 8, 341, 13158, 54452, 2036, 341, 197, 42407, 914, 198, 197, 17430, 688, 479, 48363, 198, 197, 50108, 414, 353, 38, 48363, 198, 197, 42400, 262, 1807, 198, 197, 532, 18185, 37302...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_MostBuffer(t *testing.T) { t.Skip() ori := make([]byte, 16*1024) buffers := make([]*Buffer, 0) for i := 0; i < 1024*1024; i++ { t.Logf("No.%d buffer", i) io.ReadFull(rand.Reader, ori) buf := FromBytes(ori) buffers = append(buffers, buf) } t.Logf("total %d buffers", len(buffers)) }
explode_data.jsonl/49450
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 1245, 535, 4095, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 741, 197, 13601, 1669, 1281, 10556, 3782, 11, 220, 16, 21, 9, 16, 15, 17, 19, 340, 2233, 20342, 1669, 1281, 85288, 4095, 11, 220, 15, 692, 2023, 600, 1669, 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 TestUnresolvedIntentQueue(t *testing.T) { defer leaktest.AfterTest(t)() uiq := makeUnresolvedIntentQueue() // Test empty queue. require.Equal(t, 0, uiq.Len()) require.Nil(t, uiq.Oldest()) require.Nil(t, uiq.Before(hlc.MinTimestamp)) require.Nil(t, uiq.Before(hlc.MaxTimestamp)) // Increment a non-existent txn. txn1 := uuid.MakeV4() txn1Key := roachpb.Key("key1") txn1TS := hlc.Timestamp{WallTime: 1} adv := uiq.IncRef(txn1, txn1Key, txn1TS) require.False(t, adv) require.Equal(t, 1, uiq.Len()) require.Equal(t, txn1, uiq.Oldest().txnID) require.Equal(t, txn1Key, uiq.Oldest().txnKey) require.Equal(t, txn1TS, uiq.Oldest().timestamp) require.Equal(t, 1, uiq.Oldest().refCount) require.Equal(t, 0, len(uiq.Before(hlc.Timestamp{WallTime: 0}))) require.Equal(t, 0, len(uiq.Before(hlc.Timestamp{WallTime: 1}))) require.Equal(t, 1, len(uiq.Before(hlc.Timestamp{WallTime: 2}))) require.NotPanics(t, func() { uiq.assertOnlyPositiveRefCounts() }) // Decrement a non-existent txn. txn2 := uuid.MakeV4() txn2TS := hlc.Timestamp{WallTime: 3} adv = uiq.DecrRef(txn2, txn2TS) require.False(t, adv) require.Equal(t, 2, uiq.Len()) require.Equal(t, txn1, uiq.Oldest().txnID) require.Equal(t, 0, len(uiq.Before(hlc.Timestamp{WallTime: 1}))) require.Equal(t, 1, len(uiq.Before(hlc.Timestamp{WallTime: 3}))) require.Equal(t, 2, len(uiq.Before(hlc.Timestamp{WallTime: 5}))) require.Panics(t, func() { uiq.assertOnlyPositiveRefCounts() }) // Update a non-existent txn. txn3 := uuid.MakeV4() adv = uiq.UpdateTS(txn3, hlc.Timestamp{WallTime: 5}) require.False(t, adv) require.Equal(t, 2, uiq.Len()) // Delete a non-existent txn. txn4 := uuid.MakeV4() adv = uiq.Del(txn4) require.False(t, adv) require.Equal(t, 2, uiq.Len()) // Update txn1 with a smaller timestamp. adv = uiq.UpdateTS(txn1, hlc.Timestamp{WallTime: 0}) require.False(t, adv) require.Equal(t, 2, uiq.Len()) require.Equal(t, txn1, uiq.Oldest().txnID) require.Equal(t, txn1TS, uiq.Oldest().timestamp) // Update txn1 with an equal timestamp. adv = uiq.UpdateTS(txn1, hlc.Timestamp{WallTime: 1}) require.False(t, adv) require.Equal(t, 2, uiq.Len()) require.Equal(t, txn1, uiq.Oldest().txnID) require.Equal(t, txn1TS, uiq.Oldest().timestamp) // Update txn1 with a larger timestamp. Should advance. newTxn1TS := hlc.Timestamp{WallTime: 2} adv = uiq.UpdateTS(txn1, newTxn1TS) require.True(t, adv) require.Equal(t, 2, uiq.Len()) require.Equal(t, txn1, uiq.Oldest().txnID) require.Equal(t, newTxn1TS, uiq.Oldest().timestamp) require.Equal(t, 0, len(uiq.Before(hlc.Timestamp{WallTime: 2}))) require.Equal(t, 1, len(uiq.Before(hlc.Timestamp{WallTime: 3}))) require.Equal(t, 2, len(uiq.Before(hlc.Timestamp{WallTime: 4}))) // Update txn1 with a much larger timestamp. txn2 new oldest. newTxn1TS = hlc.Timestamp{WallTime: 4} adv = uiq.UpdateTS(txn1, newTxn1TS) require.True(t, adv) require.Equal(t, 2, uiq.Len()) require.Equal(t, txn2, uiq.Oldest().txnID) require.Equal(t, txn2TS, uiq.Oldest().timestamp) // Negative ref count ok. Indicates a re-ordering of events, which is // expected during the catch up scan and supported by the queue. require.Equal(t, -1, uiq.Oldest().refCount) require.Equal(t, 0, len(uiq.Before(hlc.Timestamp{WallTime: 2}))) require.Equal(t, 0, len(uiq.Before(hlc.Timestamp{WallTime: 3}))) require.Equal(t, 1, len(uiq.Before(hlc.Timestamp{WallTime: 4}))) require.Equal(t, 2, len(uiq.Before(hlc.Timestamp{WallTime: 5}))) // Increase txn1's ref count while increasing timestamp. newTxn1TS = hlc.Timestamp{WallTime: 5} adv = uiq.IncRef(txn1, nil, newTxn1TS) require.False(t, adv) require.Equal(t, 2, uiq.Len()) require.Equal(t, 2, uiq.txns[txn1].refCount) require.Equal(t, newTxn1TS, uiq.txns[txn1].timestamp) // Decrease txn1's ref count while increasing timestamp. newTxn1TS = hlc.Timestamp{WallTime: 6} adv = uiq.DecrRef(txn1, newTxn1TS) require.False(t, adv) require.Equal(t, 2, uiq.Len()) require.Equal(t, 1, uiq.txns[txn1].refCount) require.Equal(t, newTxn1TS, uiq.txns[txn1].timestamp) // Add new txn at much higher timestamp. Immediately delete. txn5 := uuid.MakeV4() adv = uiq.IncRef(txn5, nil, hlc.Timestamp{WallTime: 10}) require.False(t, adv) require.Equal(t, 3, uiq.Len()) require.Equal(t, txn2, uiq.Oldest().txnID) adv = uiq.Del(txn5) require.False(t, adv) require.Equal(t, 2, uiq.Len()) // Increase txn2's ref count, which results in deletion. txn1 new oldest. adv = uiq.IncRef(txn2, nil, txn2TS) require.True(t, adv) require.Equal(t, 1, uiq.Len()) require.Equal(t, txn1, uiq.Oldest().txnID) require.Equal(t, newTxn1TS, uiq.Oldest().timestamp) require.NotPanics(t, func() { uiq.assertOnlyPositiveRefCounts() }) // Decrease txn1's ref count. Should be empty again. adv = uiq.DecrRef(txn1, hlc.Timestamp{}) require.True(t, adv) require.Equal(t, 0, uiq.Len()) // Add new txn. Immediately decrement ref count. Should be empty again. txn6 := uuid.MakeV4() adv = uiq.IncRef(txn6, nil, hlc.Timestamp{WallTime: 20}) require.False(t, adv) require.Equal(t, 1, uiq.Len()) require.Equal(t, txn6, uiq.Oldest().txnID) adv = uiq.DecrRef(txn6, hlc.Timestamp{}) require.True(t, adv) require.Equal(t, 0, uiq.Len()) // Instruct the queue to disallow negative ref counts. uiq.AllowNegRefCount(false) // Decrease txn1's ref count. Should ignore because ref count // would go negative. adv = uiq.DecrRef(txn1, hlc.Timestamp{}) require.False(t, adv) require.Equal(t, 0, uiq.Len()) }
explode_data.jsonl/2007
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2410 }
[ 2830, 3393, 1806, 39747, 11536, 7554, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 37278, 80, 1669, 1281, 1806, 39747, 11536, 7554, 2822, 197, 322, 3393, 4287, 7177, 624, 17957, 12808, 1155, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestKernelMemoryLimit(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } if _, err := c.KernelMemoryLimit(); err != nil { t.Errorf(err.Error()) } }
explode_data.jsonl/2784
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 26343, 10642, 16527, 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, 743, 8358, 1848, 1669, 272, 11352, 5454, 10642, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSubsegmentDataRaceWithContextCancel(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) ctx, seg := BeginSegment(ctx, "TestSegment") wg := sync.WaitGroup{} for i := 0; i < 4; i++ { if i!=3{ wg.Add(1) } go func(i int) { if i!=3{ time.Sleep(1) defer wg.Done() } _, seg := BeginSubsegment(ctx, "TestSubsegment1") seg.Close(nil) if i== 3{ cancel() // Context is cancelled abruptly } }(i) } wg.Wait() seg.Close(nil) }
explode_data.jsonl/76223
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 3136, 23169, 1043, 55991, 91101, 9269, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 20985, 11, 4810, 1669, 18597, 21086, 7502, 11, 330, 2271, 21086, 5130, 72079, 1669, 12811, 28384...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseNameNS(t *testing.T) { tests := []struct { title string input string ns string name string expErr bool }{ {"empty string", "", "", "", true}, {"demo", "demo", "", "", true}, {"kube-system", "kube-system", "", "", true}, {"default/kube-system", "default/kube-system", "default", "kube-system", false}, } for _, test := range tests { ns, name, err := ParseNameNS(test.input) if test.expErr { if err == nil { t.Errorf("%v: expected error but returned nil", test.title) } continue } if test.ns != ns { t.Errorf("%v: expected %v but returned %v", test.title, test.ns, ns) } if test.name != name { t.Errorf("%v: expected %v but returned %v", test.title, test.name, name) } } }
explode_data.jsonl/5381
{ "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, 14463, 675, 2448, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 24751, 220, 914, 198, 197, 22427, 220, 914, 198, 197, 84041, 257, 914, 198, 197, 11609, 256, 914, 198, 197, 48558, 7747, 1807, 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...
6
func TestDeleteWithAssociations(t *testing.T) { user := GetUser("delete_with_associations", Config{Account: true, Pets: 2, Toys: 4, Company: true, Manager: true, Team: 1, Languages: 1, Friends: 1}) if err := DB.Create(user).Error; err != nil { t.Fatalf("failed to create user, got error %v", err) } if err := DB.Select(clause.Associations, "Pets.Toy").Delete(&user).Error; err != nil { t.Fatalf("failed to delete user, got error %v", err) } for key, value := range map[string]int64{"Account": 1, "Pets": 2, "Toys": 4, "Company": 1, "Manager": 1, "Team": 1, "Languages": 0, "Friends": 0} { if count := DB.Unscoped().Model(&user).Association(key).Count(); count != value { t.Errorf("user's %v expects: %v, got %v", key, value, count) } } for key, value := range map[string]int64{"Account": 0, "Pets": 0, "Toys": 0, "Company": 1, "Manager": 1, "Team": 0, "Languages": 0, "Friends": 0} { if count := DB.Model(&user).Association(key).Count(); count != value { t.Errorf("user's %v expects: %v, got %v", key, value, count) } } }
explode_data.jsonl/31681
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 397 }
[ 2830, 3393, 6435, 2354, 29815, 804, 1155, 353, 8840, 836, 8, 341, 19060, 1669, 85937, 445, 4542, 6615, 58665, 804, 497, 5532, 90, 7365, 25, 830, 11, 35886, 25, 220, 17, 11, 48381, 25, 220, 19, 11, 8188, 25, 830, 11, 10567, 25, 830...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRWPublish(t *testing.T) { var rw = &testReadWriter{ C: make(chan []byte), } var b = NewRW(rw, rw, cb) go func() { err := b.Publish("foo", []byte("[\"bar\"]")) assert.NoError(t, err) }() expected, err := json.Marshal(&IOPacket{ Event: "foo", Data: []byte("[\"bar\"]"), }) assert.NoError(t, err) res := <-rw.C assert.EqualValues(t, expected, res) }
explode_data.jsonl/31838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 173 }
[ 2830, 3393, 49, 25674, 2538, 1155, 353, 8840, 836, 8, 341, 2405, 25991, 284, 609, 1944, 4418, 6492, 515, 197, 6258, 25, 1281, 35190, 3056, 3782, 1326, 197, 532, 2405, 293, 284, 1532, 56368, 2601, 86, 11, 25991, 11, 9858, 692, 30680, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWKT(t *testing.T) { var g = goblin.Goblin(t) var areaA, areaB = 31263.0267879, 30875.6418663 var wkta = "LINESTRING ( 280 320, 300 360, 280 420, 340 460, 440 440, 440 500, 480 500, 560 400, 520 360, 620 380, 619.9847625162381 453.03751576722357, 680 400, 740 500 )" var wktb = "LINESTRING ( 280 320, 300 360, 280 420, 340 460, 440 440, 440 500, 480 500, 560 400, 520 360, 620 380, 620 480, 680 400, 740 500 )" g.Describe("Diplacement Area", func() { g.It("test displacement area", func() { g.Assert(areaA).Eql(math.Round( displacementArea(geom.NewLineStringFromWKT(wkta).Coordinates()), 7, )) g.Assert(areaB).Eql(math.Round( displacementArea(geom.NewLineStringFromWKT(wktb).Coordinates()), 7, )) }) }) }
explode_data.jsonl/80359
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 54, 33539, 1155, 353, 8840, 836, 8, 341, 2405, 342, 284, 342, 47061, 1224, 47061, 1155, 340, 2405, 3082, 32, 11, 3082, 33, 284, 220, 18, 16, 17, 21, 18, 13, 15, 17, 21, 22, 23, 22, 24, 11, 220, 18, 15, 23, 22, 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...
1
func TestClearReferencedBytesWhenClearRefsMissing(t *testing.T) { //overwrite package variable clearRefsFilePathPattern = "testdata/clear_refs%d" pids := []int{10} err := clearReferencedBytes(pids, 0, 1) assert.Nil(t, err) }
explode_data.jsonl/43793
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 14008, 47447, 5767, 7078, 4498, 14008, 82807, 25080, 1155, 353, 8840, 836, 8, 341, 197, 322, 64915, 6328, 3890, 198, 40408, 82807, 19090, 15760, 284, 330, 92425, 2899, 1547, 60638, 14841, 1837, 3223, 3365, 1669, 3056, 396, 90,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCaseInsensitiveMoveFile(t *testing.T) { ctx := context.Background() r := fstest.NewRun(t) defer r.Finalise() if !r.Fremote.Features().CaseInsensitive { return } file1 := r.WriteFile("file1", "file1 contents", t1) fstest.CheckItems(t, r.Flocal, file1) file2 := file1 file2.Path = "sub/file2" err := operations.MoveFile(ctx, r.Fremote, r.Flocal, file2.Path, file1.Path) require.NoError(t, err) fstest.CheckItems(t, r.Flocal) fstest.CheckItems(t, r.Fremote, file2) r.WriteFile("file1", "file1 contents", t1) fstest.CheckItems(t, r.Flocal, file1) err = operations.MoveFile(ctx, r.Fremote, r.Flocal, file2.Path, file1.Path) require.NoError(t, err) fstest.CheckItems(t, r.Flocal) fstest.CheckItems(t, r.Fremote, file2) file2Capitalized := file2 file2Capitalized.Path = "sub/File2" err = operations.MoveFile(ctx, r.Fremote, r.Fremote, file2Capitalized.Path, file2.Path) require.NoError(t, err) fstest.CheckItems(t, r.Flocal) fstest.CheckItems(t, r.Fremote, file2Capitalized) }
explode_data.jsonl/51940
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 425 }
[ 2830, 30573, 75293, 9860, 1703, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 7000, 1669, 48434, 477, 7121, 6727, 1155, 340, 16867, 435, 991, 977, 1064, 741, 743, 753, 81, 991, 18147, 73257, 1005, 4207, 75293, 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...
2
func TestOracleFulfillmentFunctionID20190123(t *testing.T) { assert.Equal(t, "0xeea57e70", models.OracleFulfillmentFunctionID20190123) }
explode_data.jsonl/67473
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 53 }
[ 2830, 3393, 48663, 37, 86516, 478, 5152, 915, 17, 15, 16, 24, 15, 16, 17, 18, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 330, 15, 50138, 64, 20, 22, 68, 22, 15, 497, 4119, 13, 48663, 37, 86516, 478, 5152, 915, 17, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestRouterNegative(t *testing.T) { r := newRouter() mockServer := httptest.NewServer(r) resp, err := http.Post(mockServer.URL+"/", "", nil) if err != nil { t.Fatal(err) } // We want our status to be 405 (method not allowed) if resp.StatusCode != http.StatusMethodNotAllowed { t.Errorf("Status should be 405, got %d", resp.StatusCode) } defer resp.Body.Close() }
explode_data.jsonl/10028
{ "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, 9523, 38489, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 9523, 2822, 77333, 5475, 1669, 54320, 70334, 7121, 5475, 2601, 692, 34653, 11, 1848, 1669, 1758, 23442, 30389, 5475, 20893, 27569, 497, 7342, 2092, 692, 743, 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...
3
func TestOption_WithParam(t *testing.T) { client, err := NewClient("test", "http://httpbin.org/") if err != nil { t.Fatal(err) } v := "smallfish" resp := &respCarrier{} err = client.Get(resp, "/get", WithParam("username", v)) if err != nil { t.Fatal(err) } t.Log(resp.String()) n := strings.Index(resp.String(), v) if n == -1 { t.Fatal(v + " not found in header") } }
explode_data.jsonl/68694
{ "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, 5341, 62, 2354, 2001, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 1532, 2959, 445, 1944, 497, 330, 1254, 1110, 1254, 6863, 2659, 53006, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 5195, 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...
4
func TestSubscribeStreamHandleResetError(t *testing.T) { subscription := subscriptionPartition{"projects/123456/locations/us-central1-b/subscriptions/my-sub", 0} msg := seqMsgWithOffsetAndSize(67, 100) verifiers := test.NewVerifiers(t) stream := test.NewRPCVerifier(t) stream.Push(initSubReqCommit(subscription), initSubResp(), nil) stream.Push(initFlowControlReq(), msgSubResp(msg), nil) barrier := stream.PushWithBarrier(nil, nil, makeStreamResetSignal()) verifiers.AddSubscribeStream(subscription.Path, subscription.Partition, stream) // No reconnect expected because the reset handler func will fail. mockServer.OnTestStart(verifiers) defer mockServer.OnTestEnd() sub := newTestSubscribeStream(t, subscription, testSubscriberSettings()) sub.SetResetErr(status.Error(codes.FailedPrecondition, "reset handler failed")) if gotErr := sub.StartError(); gotErr != nil { t.Errorf("Start() got err: (%v)", gotErr) } sub.Receiver.ValidateMsg(msg) barrier.Release() if gotErr := sub.FinalError(); gotErr != nil { t.Errorf("Final err: (%v), want: <nil>", gotErr) } }
explode_data.jsonl/31645
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 369 }
[ 2830, 3393, 28573, 3027, 6999, 14828, 1454, 1155, 353, 8840, 836, 8, 341, 28624, 12124, 1669, 15142, 49978, 4913, 17161, 14, 16, 17, 18, 19, 20, 21, 14, 31309, 62431, 84081, 16, 1455, 37885, 29966, 34198, 17967, 497, 220, 15, 532, 211...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetContainer(t *testing.T) { t.Parallel() a := db.Container{BlueprintID: "4567"} b := db.Container{BlueprintID: "432"} res, err := GetContainer([]db.Container{a, b}, "4567") assert.Nil(t, err) assert.Equal(t, a, res) res, err = GetContainer([]db.Container{a, b}, "456") assert.Nil(t, err) assert.Equal(t, a, res) res, err = GetContainer([]db.Container{a, b}, "45") assert.Nil(t, err) assert.Equal(t, a, res) res, err = GetContainer([]db.Container{a, b}, "432") assert.Nil(t, err) assert.Equal(t, b, res) res, err = GetContainer([]db.Container{a, b}, "43") assert.Nil(t, err) assert.Equal(t, b, res) _, err = GetContainer([]db.Container{a, b}, "4") assert.EqualError(t, err, `ambiguous blueprintIDs 4567 and 432`) _, err = GetContainer([]db.Container{a, b}, "1") assert.EqualError(t, err, `no container with blueprintID "1"`) }
explode_data.jsonl/18208
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 1949, 4502, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 11323, 1669, 2927, 33672, 90, 16203, 915, 25, 330, 19, 20, 21, 22, 16707, 2233, 1669, 2927, 33672, 90, 16203, 915, 25, 330, 19, 18, 17, 63159, 10202, 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...
1
func TestSNSTopicSubscriptionFunction(t *testing.T) { if testing.Short() { t.Skip("skipping test in short mode") } tf := ` resource "aws_sns_topic_subscription" "http" { endpoint = "some-dummy-endpoint" protocol = "http" topic_arn = "aws_sns_topic.topic.arn" } ` resourceChecks := []testutil.ResourceCheck{ { Name: "aws_sns_topic_subscription.http", CostComponentChecks: []testutil.CostComponentCheck{ { Name: "HTTP notifications", PriceHash: "0b289a170f868cdf934546d365df8097-3a73d6a2c60c01675dc5432bc383db67", MonthlyCostCheck: testutil.NilMonthlyCostCheck(), }, }, }, } tftest.ResourceTests(t, tf, schema.NewEmptyUsageMap(), resourceChecks) }
explode_data.jsonl/27439
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 348 }
[ 2830, 3393, 18966, 784, 24810, 33402, 5152, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 304, 2805, 3856, 1138, 197, 630, 3244, 69, 1669, 22074, 286, 5101, 330, 8635, 643, 4412, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewFromFile(t *testing.T) { got, err := NewFromFile("./test_data/test.wf.json") if err != nil { t.Fatal(err) } wd, err := os.Getwd() if err != nil { t.Fatal(err) } want := New() // These are difficult to validate and irrelevant, so we cheat. want.id = got.ID() want.Cancel = got.Cancel want.cleanupHooks = got.cleanupHooks want.disks = newDiskRegistry(want) want.images = newImageRegistry(want) want.instances = newInstanceRegistry(want) want.networks = newNetworkRegistry(want) want.workflowDir = filepath.Join(wd, "test_data") want.Name = "some-name" want.Project = "some-project" want.Zone = "us-central1-a" want.GCSPath = "gs://some-bucket/images" want.OAuthPath = filepath.Join(wd, "test_data", "somefile") want.Sources = map[string]string{} want.autovars = map[string]string{} want.Vars = map[string]Var{ "bootstrap_instance_name": {Value: "bootstrap-${NAME}", Required: true}, "machine_type": {Value: "n1-standard-1"}, "key1": {Value: "var1"}, "key2": {Value: "var2"}, } want.Steps = map[string]*Step{ "create-disks": { name: "create-disks", CreateDisks: &CreateDisks{ { Disk: compute.Disk{ Name: "bootstrap", SourceImage: "projects/windows-cloud/global/images/family/windows-server-2016-core", Type: "pd-ssd", }, SizeGb: "50", }, { Disk: compute.Disk{ Name: "image", SourceImage: "projects/windows-cloud/global/images/family/windows-server-2016-core", Type: "pd-standard", }, SizeGb: "50", }, }, }, "${bootstrap_instance_name}": { name: "${bootstrap_instance_name}", CreateInstances: &CreateInstances{ { Instance: compute.Instance{ Name: "${bootstrap_instance_name}", Disks: []*compute.AttachedDisk{{Source: "bootstrap"}, {Source: "image"}}, MachineType: "${machine_type}", }, StartupScript: "shutdown /h", Metadata: map[string]string{"test_metadata": "this was a test"}, }, }, }, "${bootstrap_instance_name}-stopped": { name: "${bootstrap_instance_name}-stopped", Timeout: "1h", WaitForInstancesSignal: &WaitForInstancesSignal{{Name: "${bootstrap_instance_name}", Stopped: true, Interval: "1s"}}, }, "postinstall": { name: "postinstall", CreateInstances: &CreateInstances{ { Instance: compute.Instance{ Name: "postinstall", Disks: []*compute.AttachedDisk{{Source: "image"}, {Source: "bootstrap"}}, MachineType: "${machine_type}", }, StartupScript: "shutdown /h", }, }, }, "postinstall-stopped": { name: "postinstall-stopped", WaitForInstancesSignal: &WaitForInstancesSignal{{Name: "postinstall", Stopped: true}}, }, "create-image": { name: "create-image", CreateImages: &CreateImages{{Image: compute.Image{Name: "image-from-disk", SourceDisk: "image"}}}, }, "include-workflow": { name: "include-workflow", IncludeWorkflow: &IncludeWorkflow{ Vars: map[string]string{ "key": "value", }, Path: "./test_sub.wf.json", }, }, "sub-workflow": { name: "sub-workflow", SubWorkflow: &SubWorkflow{ Vars: map[string]string{ "key": "value", }, Path: "./test_sub.wf.json", }, }, } want.Dependencies = map[string][]string{ "create-disks": {}, "bootstrap": {"create-disks"}, "bootstrap-stopped": {"bootstrap"}, "postinstall": {"bootstrap-stopped"}, "postinstall-stopped": {"postinstall"}, "create-image": {"postinstall-stopped"}, "include-workflow": {"create-image"}, "sub-workflow": {"create-image"}, } for _, s := range want.Steps { s.w = want } if diffRes := diff(got, want, 0); diffRes != "" { t.Errorf("parsed workflow does not match expectation: (-got +want)\n%s", diffRes) } }
explode_data.jsonl/8050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1834 }
[ 2830, 3393, 3564, 43633, 1155, 353, 8840, 836, 8, 341, 3174, 354, 11, 1848, 1669, 1532, 43633, 13988, 1944, 1769, 12697, 1418, 69, 4323, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 197, 6377, 11, 1848, 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...
5
func TestMessage(t *testing.T) { m := NewMessage() m.SetAddressHeader("From", "from@example.com", "Señor From") m.SetHeader("To", m.FormatAddress("to@example.com", "Señor To"), "tobis@example.com") m.SetAddressHeader("Cc", "cc@example.com", "A, B") m.SetAddressHeader("X-To", "ccbis@example.com", "à, b") m.SetDateHeader("X-Date", now()) m.SetHeader("X-Date-2", m.FormatDate(now())) m.SetHeader("Subject", "¡Hola, señor!") m.SetHeaders(map[string][]string{ "X-Headers": {"Test", "Café"}, }) m.SetBody("text/plain", "¡Hola, señor!") want := &message{ from: "from@example.com", to: []string{ "to@example.com", "tobis@example.com", "cc@example.com", }, content: "From: =?UTF-8?q?Se=C3=B1or_From?= <from@example.com>\r\n" + "To: =?UTF-8?q?Se=C3=B1or_To?= <to@example.com>, tobis@example.com\r\n" + "Cc: \"A, B\" <cc@example.com>\r\n" + "X-To: =?UTF-8?b?w6AsIGI=?= <ccbis@example.com>\r\n" + "X-Date: Wed, 25 Jun 2014 17:46:00 +0000\r\n" + "X-Date-2: Wed, 25 Jun 2014 17:46:00 +0000\r\n" + "X-Headers: Test, =?UTF-8?q?Caf=C3=A9?=\r\n" + "Subject: =?UTF-8?q?=C2=A1Hola,_se=C3=B1or!?=\r\n" + "Content-Type: text/plain; charset=UTF-8\r\n" + "Content-Transfer-Encoding: quoted-printable\r\n" + "\r\n" + "=C2=A1Hola, se=C3=B1or!", } testMessage(t, m, 0, want) }
explode_data.jsonl/31569
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 686 }
[ 2830, 3393, 2052, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1532, 2052, 741, 2109, 4202, 4286, 4047, 445, 3830, 497, 330, 1499, 35487, 905, 497, 330, 1514, 5653, 269, 5542, 1138, 2109, 4202, 4047, 445, 1249, 497, 296, 9978, 4286, 445,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEngine_CreateCursor_Ascending(t *testing.T) { t.Parallel() for _, index := range tsdb.RegisteredIndexes() { t.Run(index, func(t *testing.T) { e := MustOpenEngine(index) defer e.Close() e.MeasurementFields([]byte("cpu")).CreateFieldIfNotExists([]byte("value"), influxql.Float) e.CreateSeriesIfNotExists([]byte("cpu,host=A"), []byte("cpu"), models.NewTags(map[string]string{"host": "A"})) if err := e.WritePointsString( `cpu,host=A value=1.1 1`, `cpu,host=A value=1.2 2`, `cpu,host=A value=1.3 3`, ); err != nil { t.Fatalf("failed to write points: %s", err.Error()) } e.MustWriteSnapshot() if err := e.WritePointsString( `cpu,host=A value=10.1 10`, `cpu,host=A value=11.2 11`, `cpu,host=A value=12.3 12`, ); err != nil { t.Fatalf("failed to write points: %s", err.Error()) } q, err := e.CreateCursorIterator(context.Background()) if err != nil { t.Fatal(err) } cur, err := q.Next(context.Background(), &tsdb.CursorRequest{ Name: []byte("cpu"), Tags: models.ParseTags([]byte("cpu,host=A")), Field: "value", Ascending: true, StartTime: 2, EndTime: 12, }) if err != nil { t.Fatal(err) } defer cur.Close() fcur := cur.(tsdb.FloatArrayCursor) a := fcur.Next() if !cmp.Equal([]int64{2, 3, 10, 11}, a.Timestamps) { t.Fatal("unexpect timestamps") } if !cmp.Equal([]float64{1.2, 1.3, 10.1, 11.2}, a.Values) { t.Fatal("unexpect timestamps") } }) } }
explode_data.jsonl/28099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 726 }
[ 2830, 3393, 4571, 34325, 14543, 1566, 2388, 2459, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2023, 8358, 1922, 1669, 2088, 10591, 1999, 19983, 291, 62229, 368, 341, 197, 3244, 16708, 7195, 11, 2915, 1155, 353, 8840, 836, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestDownloadSkipObject(t *testing.T) { var ( proxyURL = tutils.RandomProxyURL(t) bck = cmn.Bck{ Name: cos.RandString(10), Provider: cmn.ProviderAIS, } objName = cos.RandString(10) link = "https://storage.googleapis.com/minikube/iso/minikube-v0.23.2.iso.sha256" expectedSize int64 = 65 expectedVersion = "1" ) tutils.CreateBucketWithCleanup(t, proxyURL, bck, nil) downloadObject(t, bck, objName, link, false /*shouldBeSkipped*/) oldProps := verifyProps(t, bck, objName, expectedSize, expectedVersion) downloadObject(t, bck, objName, link, true /*shouldBeSkipped*/) newProps := verifyProps(t, bck, objName, expectedSize, expectedVersion) tassert.Errorf( t, oldProps.Atime == newProps.Atime, "atime mismatch (%v vs %v)", oldProps.Atime, newProps.Atime, ) }
explode_data.jsonl/70393
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 11377, 35134, 1190, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 197, 22803, 3144, 284, 259, 6031, 26709, 16219, 3144, 1155, 340, 197, 2233, 377, 414, 284, 9961, 77, 1785, 377, 515, 298, 21297, 25, 257, 7960, 2013, 437, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMaxExecDepth(t *testing.T) { tmpl := Must(New("tmpl").Parse(`{{template "tmpl" .}}`)) err := tmpl.Execute(ioutil.Discard, nil) got := "<nil>" if err != nil { got = err.Error() } const want = "exceeded maximum template depth" if !strings.Contains(got, want) { t.Errorf("got error %q; want %q", got, want) } }
explode_data.jsonl/41534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 5974, 10216, 19776, 1155, 353, 8840, 836, 8, 341, 3244, 54010, 1669, 15465, 35063, 445, 71359, 1827, 14463, 5809, 2979, 4214, 330, 71359, 1, 659, 3417, 63, 1171, 9859, 1669, 79839, 13827, 1956, 30158, 909, 47560, 11, 2092, 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...
3
func TestPullListComments(t *testing.T) { defer gock.Off() gock.New("https://gitlab.com"). Get("/api/v4/projects/diaspora/diaspora/merge_requests/1/notes"). MatchParam("page", "1"). MatchParam("per_page", "30"). Reply(200). Type("application/json"). SetHeaders(mockHeaders). SetHeaders(mockPageHeaders). File("testdata/merge_notes.json") client := NewDefault() got, res, err := client.PullRequests.ListComments(context.Background(), "diaspora/diaspora", 1, scm.ListOptions{Size: 30, Page: 1}) if err != nil { t.Error(err) return } want := []*scm.Comment{} raw, _ := ioutil.ReadFile("testdata/merge_notes.json.golden") json.Unmarshal(raw, &want) if diff := cmp.Diff(got, want); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } t.Run("Request", testRequest(res)) t.Run("Rate", testRate(res)) t.Run("Page", testPage(res)) }
explode_data.jsonl/78658
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 36068, 852, 17373, 1155, 353, 8840, 836, 8, 341, 16867, 728, 377, 13, 4596, 2822, 3174, 1176, 7121, 445, 2428, 1110, 12882, 14380, 905, 38609, 197, 37654, 4283, 2068, 5457, 19, 39606, 3446, 3473, 70664, 3446, 3473, 70664, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNodeAddress(t *testing.T) { node := testSetup() if node.Address() != testNodeAddress { t.Errorf("Expected address: %s, found: %s", testNodeAddress, node.Address()) } }
explode_data.jsonl/23542
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 1955, 4286, 1155, 353, 8840, 836, 8, 341, 20831, 1669, 1273, 21821, 741, 743, 2436, 26979, 368, 961, 1273, 1955, 4286, 341, 197, 3244, 13080, 445, 18896, 2621, 25, 1018, 82, 11, 1730, 25, 1018, 82, 497, 1273, 1955, 4286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasicModelWithoutResources(t *testing.T) { e, _ := NewEnforcer("examples/basic_without_resources_model.conf", "examples/basic_without_resources_policy.csv") testEnforceWithoutUsers(t, e, "alice", "read", true) testEnforceWithoutUsers(t, e, "alice", "write", false) testEnforceWithoutUsers(t, e, "bob", "read", false) testEnforceWithoutUsers(t, e, "bob", "write", true) }
explode_data.jsonl/57120
{ "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, 15944, 1712, 26040, 11277, 1155, 353, 8840, 836, 8, 341, 7727, 11, 716, 1669, 1532, 1702, 82010, 445, 51668, 77909, 39904, 35569, 5047, 13937, 497, 330, 51668, 77909, 39904, 35569, 22773, 11219, 5130, 18185, 1702, 8833, 26040, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_perEncodingE2SmKpmIndicationHeader(t *testing.T) { ih, err := createE2SmKpmIndicationHeader() assert.NilError(t, err) per, err := encoder.PerEncodeE2SmKpmIndicationHeader(ih) assert.NilError(t, err) t.Logf("E2SM-KPM-IndicationHeader PER\n%v", hex.Dump(per)) result, err := encoder.PerDecodeE2SmKpmIndicationHeader(per) assert.NilError(t, err) assert.Assert(t, result != nil) t.Logf("E2SM-KPM-IndicationHeader PER - decoded\n%v", result) assert.Equal(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetFileFormatversion(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetFileFormatversion()) assert.Equal(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGNbDuId().GetValue(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGNbDuId().GetValue()) assert.Equal(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGNbCuUpId().GetValue(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGNbCuUpId().GetValue()) assert.DeepEqual(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGlobalGNbId().GetPlmnId().GetValue(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGlobalGNbId().GetPlmnId().GetValue()) assert.DeepEqual(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGlobalGNbId().GetGnbId().GetGnbId().GetValue(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGlobalGNbId().GetGnbId().GetGnbId().GetValue()) assert.Equal(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGlobalGNbId().GetGnbId().GetGnbId().GetLen(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetKpmNodeId().GetGNb().GetGlobalGNbId().GetGnbId().GetGnbId().GetLen()) assert.Equal(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetSenderName(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetSenderName()) assert.Equal(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetSenderType(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetSenderType()) assert.DeepEqual(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetColletStartTime().GetValue(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetColletStartTime().GetValue()) assert.Equal(t, ih.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetVendorName(), result.GetIndicationHeaderFormats().GetIndicationHeaderFormat1().GetVendorName()) }
explode_data.jsonl/70692
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 916 }
[ 2830, 3393, 5678, 14690, 36, 17, 10673, 42, 5187, 1425, 20285, 4047, 1155, 353, 8840, 836, 8, 1476, 197, 6996, 11, 1848, 1669, 1855, 36, 17, 10673, 42, 5187, 1425, 20285, 4047, 741, 6948, 59678, 1454, 1155, 11, 1848, 692, 197, 712, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGameRuntime(t *testing.T) { t.Parallel() testMatchRuntime := &TestMatchRuntime{ T: t, Game: &surrenderGame{}, Match: protocol.Match{NumberOfPlayersRequired: 2}, PlayersName: []string{"foo", "bar"}, } SetupTestMatchRuntime(t, testMatchRuntime) defer testMatchRuntime.Stop() testMatchRuntime.TestRequest("foo", protocol.ReqListRequests, protocol.ResOK) testMatchRuntime.TestRequest("foo", protocol.ReqPlayerWantToJoin, protocol.ResOK) testMatchRuntime.TestRequest("foo", protocol.ReqPlayerWantToStartTheMatch, protocol.ResForbidden) testMatchRuntime.TestRequest("bar", protocol.ReqPlayerWantToJoin, protocol.ResOK) testMatchRuntime.TestRequest("foo", protocol.ReqPlayerWantToLeave, protocol.ResOK) testMatchRuntime.TestRequest("bar", protocol.ReqPlayerWantToStartTheMatch, protocol.ResForbidden) testMatchRuntime.TestRequest("foo", protocol.ReqPlayerWantToJoin, protocol.ResOK) testMatchRuntime.TestRequest("foo", protocol.ReqPlayerWantToStartTheMatch, protocol.ResOK) testMatchRuntime.TestRequest("foo", protocol.ReqPlayerAccepts, protocol.ResOK) testMatchRuntime.TestRequest("bar", protocol.ReqPlayerAccepts, protocol.ResOK) testMatchRuntime.TestRequest("foo", protocol.ReqListRequests, protocol.ResOK) testMatchRuntime.TestRequest("foo", protocol.ReqPlayerAccepts, protocol.ResNotImplemented) }
explode_data.jsonl/44146
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 435 }
[ 2830, 3393, 4868, 15123, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 8331, 15123, 1669, 609, 2271, 8331, 15123, 515, 197, 10261, 25, 1843, 259, 345, 197, 40944, 25, 286, 609, 82, 843, 900, 4868, 38837, 197, 197, 8331...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigErrorSubmatchGroupMissing(t *testing.T) { testConfig := []byte(`metrics: - name: submatch event_matcher: - key: Message expr: Normal labels: volume: Message[1] `) _, err := NewConfig(bytes.NewBuffer(testConfig)) require.EqualError(t, err, "Configuration for metric 'submatch' invalid: Match expression for key 'Message' does not contain 1 subexpressions") }
explode_data.jsonl/36672
{ "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, 2648, 1454, 3136, 6347, 2808, 25080, 1155, 353, 8840, 836, 8, 341, 18185, 2648, 1669, 3056, 3782, 5809, 43262, 510, 12, 829, 25, 1186, 6347, 198, 220, 1538, 10708, 261, 510, 220, 481, 1376, 25, 4856, 198, 262, 15169, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestK8SServiceEnvironmentConfigMapAddsEnvVarsToPod(t *testing.T) { t.Parallel() deployment := renderK8SServiceDeploymentWithSetValues( t, map[string]string{ "configMaps.dbsettings.as": "environment", "configMaps.dbsettings.items.host.envVarName": "DB_HOST", "configMaps.dbsettings.items.port.envVarName": "DB_PORT", }, ) // Verify that there is only one container and that the environments section is empty. renderedPodContainers := deployment.Spec.Template.Spec.Containers require.Equal(t, len(renderedPodContainers), 1) appContainer := renderedPodContainers[0] environments := appContainer.Env assert.Equal(t, len(environments), 2) // Read in the configured env vars for convenient mapping of env var name renderedEnvVar := map[string]corev1.EnvVar{} for _, env := range environments { renderedEnvVar[env.Name] = env } // Verify the DB_HOST env var comes from config map host key of dbsettings assert.Equal(t, renderedEnvVar["DB_HOST"].Value, "") require.NotNil(t, renderedEnvVar["DB_HOST"].ValueFrom) require.NotNil(t, renderedEnvVar["DB_HOST"].ValueFrom.ConfigMapKeyRef) assert.Equal(t, renderedEnvVar["DB_HOST"].ValueFrom.ConfigMapKeyRef.Key, "host") assert.Equal(t, renderedEnvVar["DB_HOST"].ValueFrom.ConfigMapKeyRef.Name, "dbsettings") // Verify the DB_PORT env var comes from config map port key of dbsettings assert.Equal(t, renderedEnvVar["DB_PORT"].Value, "") require.NotNil(t, renderedEnvVar["DB_PORT"].ValueFrom) require.NotNil(t, renderedEnvVar["DB_PORT"].ValueFrom.ConfigMapKeyRef) assert.Equal(t, renderedEnvVar["DB_PORT"].ValueFrom.ConfigMapKeyRef.Key, "port") assert.Equal(t, renderedEnvVar["DB_PORT"].ValueFrom.ConfigMapKeyRef.Name, "dbsettings") }
explode_data.jsonl/59755
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 641 }
[ 2830, 3393, 42, 23, 1220, 1017, 12723, 2648, 2227, 72111, 14359, 28305, 1249, 23527, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 82213, 1669, 3141, 42, 23, 1220, 1017, 75286, 2354, 1649, 6227, 1006, 197, 3244, 345, 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 TestNonTLSListener(t *testing.T) { rh, cc, done := setup(t) defer done() // assert that without any ingress objects registered // there are no active listeners assertEqual(t, &v2.DiscoveryResponse{ VersionInfo: "0", Resources: resources(t, staticListener(), ), TypeUrl: listenerType, Nonce: "0", }, streamLDS(t, cc)) // i1 is a simple ingress, no hostname, no tls. i1 := &v1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, Spec: v1beta1.IngressSpec{ Backend: backend("backend", intstr.FromInt(80)), }, } // add it and assert that we now have a ingress_http listener rh.OnAdd(i1) assertEqual(t, &v2.DiscoveryResponse{ VersionInfo: "1", Resources: resources(t, &v2.Listener{ Name: "ingress_http", Address: *envoy.SocketAddress("0.0.0.0", 8080), FilterChains: envoy.FilterChains(envoy.HTTPConnectionManager("ingress_http", "/dev/stdout")), }, staticListener(), ), TypeUrl: listenerType, Nonce: "1", }, streamLDS(t, cc)) // i2 is the same as i1 but has the kubernetes.io/ingress.allow-http: "false" annotation i2 := &v1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", Annotations: map[string]string{ "kubernetes.io/ingress.allow-http": "false", }, }, Spec: v1beta1.IngressSpec{ Backend: backend("backend", intstr.FromInt(80)), }, } // update i1 to i2 and verify that ingress_http has gone. rh.OnUpdate(i1, i2) assertEqual(t, &v2.DiscoveryResponse{ VersionInfo: "2", Resources: resources(t, staticListener(), ), TypeUrl: listenerType, Nonce: "2", }, streamLDS(t, cc)) // i3 is similar to i2, but uses the ingress.kubernetes.io/force-ssl-redirect: "true" annotation // to force 80 -> 443 upgrade i3 := &v1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", Annotations: map[string]string{ "ingress.kubernetes.io/force-ssl-redirect": "true", }, }, Spec: v1beta1.IngressSpec{ Backend: backend("backend", intstr.FromInt(80)), }, } // update i2 to i3 and check that ingress_http has returned rh.OnUpdate(i2, i3) assertEqual(t, &v2.DiscoveryResponse{ VersionInfo: "3", Resources: resources(t, &v2.Listener{ Name: "ingress_http", Address: *envoy.SocketAddress("0.0.0.0", 8080), FilterChains: envoy.FilterChains(envoy.HTTPConnectionManager("ingress_http", "/dev/stdout")), }, staticListener(), ), TypeUrl: listenerType, Nonce: "3", }, streamLDS(t, cc)) }
explode_data.jsonl/22817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1115 }
[ 2830, 3393, 8121, 45439, 2743, 1155, 353, 8840, 836, 8, 341, 7000, 71, 11, 12527, 11, 2814, 1669, 6505, 1155, 340, 16867, 2814, 2822, 197, 322, 2060, 429, 2041, 894, 78559, 6171, 9681, 198, 197, 322, 1052, 525, 902, 4541, 23562, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConverterMapStructWithSubFieldsReqToOpt(t *testing.T) { fieldMap := make(map[string]codegen.FieldMapperEntry) fieldMap["Three.One"] = codegen.FieldMapperEntry{ QualifiedName: "Three.Two", Override: true, } fieldMap["Four.Two"] = codegen.FieldMapperEntry{ QualifiedName: "Four.One", Override: true, } lines, err := convertTypes( "Foo", "Bar", `struct NestedFoo { 1: required string one 2: optional string two } struct NestedBar { 1: required string one 2: optional string two } struct Foo { 3: optional NestedFoo three 4: required NestedFoo four } struct Bar { 3: required NestedBar three 4: optional NestedBar four }`, nil, fieldMap, ) assert.NoError(t, err) assertPrettyEqual(t, trim(` if in.Three != nil { out.Three = &structs.NestedBar{} out.Three.One = string(in.Three.One) if in.Three != nil && in.Three.Two != nil { out.Three.One = *(in.Three.Two) } out.Three.Two = (*string)(in.Three.Two) } else { out.Three = nil } if in.Four != nil { out.Four = &structs.NestedBar{} out.Four.One = string(in.Four.One) if in.Four != nil { out.Four.Two = (*string)(&(in.Four.One)) } } else { out.Four = nil } `), lines) }
explode_data.jsonl/62081
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 553 }
[ 2830, 3393, 14920, 2227, 9422, 2354, 3136, 8941, 27234, 1249, 21367, 1155, 353, 8840, 836, 8, 341, 39250, 2227, 1669, 1281, 9147, 14032, 60, 95859, 17087, 10989, 5874, 340, 39250, 2227, 1183, 19641, 37067, 1341, 284, 2038, 4370, 17087, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLog_pipelinerun_only_one(t *testing.T) { version := "v1alpha1" var ( pipelineName = "pipeline1" prName = "pr1" ns = "namespaces" taskName = "task1" ) namespaces := []*corev1.Namespace{ { ObjectMeta: metav1.ObjectMeta{ Name: ns, }, }, } pipelines := []*v1alpha1.Pipeline{ tb.Pipeline(pipelineName, tb.PipelineNamespace(ns), tb.PipelineSpec( tb.PipelineTask(taskName, taskName), ), ), } pipelineruns := []*v1alpha1.PipelineRun{ tb.PipelineRun(prName, tb.PipelineRunNamespace(ns), tb.PipelineRunLabel("tekton.dev/pipeline", pipelineName), tb.PipelineRunSpec(pipelineName), tb.PipelineRunStatus( tb.PipelineRunStatusCondition(apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionUnknown, Message: "Running", }), ), ), } cs, _ := test.SeedTestData(t, pipelinetest.Data{PipelineRuns: pipelineruns, Pipelines: pipelines, Namespaces: namespaces}) cs.Pipeline.Resources = cb.APIResourceList(version, []string{"pipelinerun"}) tdc := testDynamic.Options{} dc, err := tdc.Client( cb.UnstructuredPR(pipelineruns[0], version), ) if err != nil { t.Errorf("unable to create dynamic client: %v", err) } p := test.Params{ Kube: cs.Kube, Tekton: cs.Pipeline, Dynamic: dc, } p.SetNamespace(ns) lopt := options.LogOptions{ Params: &p, // This code https://git.io/JvCMV seems buggy so have to set the upper // Limit.. but I guess that's another fight for another day. Limit: len(pipelineruns), } err = askRunName(&lopt) if err != nil { t.Errorf("Unexpected error: %v", err) } test.AssertOutput(t, prName, lopt.PipelineRunName) }
explode_data.jsonl/14867
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 776 }
[ 2830, 3393, 2201, 620, 81079, 10453, 359, 18410, 11667, 1155, 353, 8840, 836, 8, 341, 74954, 1669, 330, 85, 16, 7141, 16, 698, 2405, 2399, 197, 3223, 8790, 675, 284, 330, 51258, 16, 698, 197, 25653, 675, 981, 284, 330, 649, 16, 698,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestServer_Issue987(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) gen, err := testAppGenerator(t, "../fixtures/bugs/987/swagger.yml", "deeper consumes produces") if assert.NoError(t, err) { app, err := gen.makeCodegenApp() if assert.NoError(t, err) { buf := bytes.NewBuffer(nil) if assert.NoError(t, templates.MustGet("serverBuilder").Execute(buf, app)) { formatted, err := app.GenOpts.LanguageOpts.FormatContent("shipyard_api.go", buf.Bytes()) if assert.NoError(t, err) { res := string(formatted) assertRegexpInCode(t, `JSONConsumer:\s+runtime.JSONConsumer()`, res) assertRegexpInCode(t, `JSONProducer:\s+runtime.JSONProducer()`, res) assertInCode(t, `result["application/json"] = o.JSONConsumer`, res) assertInCode(t, `result["application/json"] = o.JSONProducer`, res) } else { fmt.Println(buf.String()) } } } } }
explode_data.jsonl/3785
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 381 }
[ 2830, 3393, 5475, 7959, 83890, 24, 23, 22, 1155, 353, 8840, 836, 8, 341, 6725, 4202, 5097, 1956, 30158, 909, 47560, 340, 16867, 1487, 4202, 5097, 9638, 83225, 340, 82281, 11, 1848, 1669, 1273, 2164, 12561, 1155, 11, 7005, 45247, 14, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListenLocal(t *testing.T) { sset, err := makeStatefulSet(&monitoringv1.Alertmanager{ Spec: monitoringv1.AlertmanagerSpec{ ListenLocal: true, }, }, defaultTestConfig, "") if err != nil { t.Fatalf("Unexpected error while making StatefulSet: %v", err) } found := false for _, flag := range sset.Spec.Template.Spec.Containers[0].Args { if flag == "--web.listen-address=127.0.0.1:9093" { found = true } } if !found { t.Fatal("Alertmanager not listening on loopback when it should.") } if sset.Spec.Template.Spec.Containers[0].ReadinessProbe != nil { t.Fatal("Alertmanager readiness probe expected to be empty") } if sset.Spec.Template.Spec.Containers[0].LivenessProbe != nil { t.Fatal("Alertmanager readiness probe expected to be empty") } if len(sset.Spec.Template.Spec.Containers[0].Ports) != 2 { t.Fatal("Alertmanager container should only have one port defined") } }
explode_data.jsonl/25243
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 333 }
[ 2830, 3393, 38714, 7319, 1155, 353, 8840, 836, 8, 341, 1903, 746, 11, 1848, 1669, 1281, 1397, 1262, 1649, 2099, 32225, 287, 85, 16, 40143, 13297, 515, 197, 7568, 992, 25, 16558, 85, 16, 40143, 13297, 8327, 515, 298, 10675, 268, 7319, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConcurrentInit(t *testing.T) { cnt := 0 resolveWait := make(chan bool) r := &Resolver{ cache: make(map[string]*cacheRecord), resolve: func(name string) ([]net.IP, error) { cnt++ // The first call should be blocked on resolveWait. if cnt == 1 { <-resolveWait return []net.IP{net.ParseIP("0.0.0.0")}, nil } // The 2nd call should never happen. return nil, fmt.Errorf("resolve should be called just once, cnt: %d", cnt) }, } // 5 because first resolve calls refresh twice. refreshed := make(chan bool, 5) var wg sync.WaitGroup for i := 0; i < 4; i++ { wg.Add(1) go func() { _, err := r.resolveWithMaxAge("testHost", 4, 60*time.Second, refreshed) if err != nil { t.Logf("Err: %v\n", err) t.Errorf("Expected no error, got error") } wg.Done() }() } // Give offline update goroutines a chance. // If we call resolve more than once, this will make those resolves fail. runtime.Gosched() time.Sleep(1 * time.Millisecond) // Makes one of the resolve goroutines unblock refresh. resolveWait <- true resolvedCount := 0 // 5 because first resolve calls refresh twice. for i := 0; i < 5; i++ { if waitForChannelOrFail(t, refreshed, time.Second) { resolvedCount++ } } if resolvedCount != 1 { t.Errorf("resolvedCount=%v, want 1", resolvedCount) } wg.Wait() }
explode_data.jsonl/27871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 539 }
[ 2830, 3393, 1109, 3231, 3803, 1155, 353, 8840, 836, 8, 341, 60553, 1669, 220, 15, 198, 87778, 14190, 1669, 1281, 35190, 1807, 340, 7000, 1669, 609, 18190, 515, 197, 52680, 25, 1281, 9147, 14032, 8465, 9360, 6471, 1326, 197, 87778, 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 TestContextQuery(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("GET", "http://example.com/?foo=bar&page=10&id=", nil) value, ok := c.GetQuery("foo") assert.True(t, ok) assert.Equal(t, "bar", value) assert.Equal(t, "bar", c.DefaultQuery("foo", "none")) assert.Equal(t, "bar", c.Query("foo")) value, ok = c.GetQuery("page") assert.True(t, ok) assert.Equal(t, "10", value) assert.Equal(t, "10", c.DefaultQuery("page", "0")) assert.Equal(t, "10", c.Query("page")) value, ok = c.GetQuery("id") assert.True(t, ok) assert.Empty(t, value) assert.Empty(t, c.DefaultQuery("id", "nada")) assert.Empty(t, c.Query("id")) value, ok = c.GetQuery("NoKey") assert.False(t, ok) assert.Empty(t, value) assert.Equal(t, "nada", c.DefaultQuery("NoKey", "nada")) assert.Empty(t, c.Query("NoKey")) // postform should not mess value, ok = c.GetPostForm("page") assert.False(t, ok) assert.Empty(t, value) assert.Empty(t, c.PostForm("foo")) }
explode_data.jsonl/26761
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 418 }
[ 2830, 3393, 1972, 2859, 1155, 353, 8840, 836, 8, 341, 1444, 11, 716, 1669, 4230, 2271, 1972, 73392, 83, 70334, 7121, 47023, 2398, 1444, 9659, 11, 716, 284, 1758, 75274, 445, 3806, 497, 330, 1254, 1110, 8687, 905, 17763, 7975, 28, 2257...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewCache(t *testing.T) { tests := []struct { name string want *Cache }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := NewCache(); !reflect.DeepEqual(got, tt.want) { t.Errorf("NewCache() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/59939
{ "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, 3564, 8233, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 50780, 353, 8233, 198, 197, 59403, 197, 322, 5343, 25, 2691, 1273, 5048, 624, 197, 532, 2023, 8358, 17853, 1669, 2088, 7032...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileWithoutPVC(t *testing.T) { // TestReconcileWithoutPVC runs "Reconcile" on a PipelineRun that has two unrelated tasks. // It verifies that reconcile is successful and that no PVC is created ps := []*v1beta1.Pipeline{parse.MustParsePipeline(t, ` metadata: name: test-pipeline namespace: foo spec: tasks: - name: hello-world-1 taskRef: name: hello-world - name: hello-world-2 taskRef: name: hello-world `)} prs := []*v1beta1.PipelineRun{parse.MustParsePipelineRun(t, ` metadata: name: test-pipeline-run namespace: foo spec: pipelineRef: name: test-pipeline `)} ts := []*v1beta1.Task{simpleHelloWorldTask} d := test.Data{ PipelineRuns: prs, Pipelines: ps, Tasks: ts, } prt := newPipelineRunTest(d, t) defer prt.Cancel() reconciledRun, clients := prt.reconcileRun("foo", "test-pipeline-run", []string{}, false) actions := clients.Pipeline.Actions() // Check that the expected TaskRun was created for _, a := range actions { if ca, ok := a.(ktesting.CreateAction); ok { obj := ca.GetObject() if pvc, ok := obj.(*corev1.PersistentVolumeClaim); ok { t.Errorf("Did not expect to see a PVC created when no resources are linked. %s was created", pvc) } } } if !reconciledRun.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() { t.Errorf("Expected PipelineRun to be running, but condition status is %s", reconciledRun.Status.GetCondition(apis.ConditionSucceeded)) } }
explode_data.jsonl/27296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 577 }
[ 2830, 3393, 693, 40446, 457, 26040, 47, 11287, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 693, 40446, 457, 26040, 47, 11287, 8473, 330, 693, 40446, 457, 1, 389, 264, 40907, 6727, 429, 702, 1378, 45205, 9079, 624, 197, 322, 1084, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateKeepaliveEvent(t *testing.T) { event := corev2.FixtureEvent("entity1", "keepalive") keepaliveEvent := createKeepaliveEvent(event) assert.Equal(t, "keepalive", keepaliveEvent.Check.Name) assert.Equal(t, uint32(60), keepaliveEvent.Check.Interval) assert.Equal(t, []string{"keepalive"}, keepaliveEvent.Check.Handlers) assert.Equal(t, uint32(0), keepaliveEvent.Check.Status) assert.NotEqual(t, int64(0), keepaliveEvent.Check.Issued) event.Check = nil keepaliveEvent = createKeepaliveEvent(event) assert.Equal(t, "keepalive", keepaliveEvent.Check.Name) assert.Equal(t, uint32(20), keepaliveEvent.Check.Interval) assert.Equal(t, uint32(120), keepaliveEvent.Check.Timeout) }
explode_data.jsonl/45980
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 4021, 19434, 50961, 1556, 1155, 353, 8840, 836, 8, 341, 28302, 1669, 6200, 85, 17, 991, 12735, 1556, 445, 2996, 16, 497, 330, 13096, 50961, 1138, 197, 13096, 50961, 1556, 1669, 1855, 19434, 50961, 1556, 6235, 340, 6948, 1280...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestObjectWithVars(t *testing.T) { assertParseOneTerm(t, "var keys", "{foo: \"bar\", bar: 64}", ObjectTerm(Item(VarTerm("foo"), StringTerm("bar")), Item(VarTerm("bar"), IntNumberTerm(64)))) assertParseOneTerm(t, "nested var keys", "{baz: {foo: \"bar\", bar: qux}}", ObjectTerm(Item(VarTerm("baz"), ObjectTerm(Item(VarTerm("foo"), StringTerm("bar")), Item(VarTerm("bar"), VarTerm("qux")))))) assertParseOneTerm(t, "ambiguous or", `{ a: b+c | d }`, ObjectTerm(Item(VarTerm("a"), CallTerm(RefTerm(VarTerm("or")), CallTerm(RefTerm(VarTerm("plus")), VarTerm("b"), VarTerm("c")), VarTerm("d"))))) }
explode_data.jsonl/50453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 1190, 2354, 28305, 1155, 353, 8840, 836, 8, 341, 6948, 14463, 3966, 17249, 1155, 11, 330, 947, 6894, 497, 13868, 7975, 25, 7245, 2257, 16215, 3619, 25, 220, 21, 19, 9545, 3002, 17249, 29771, 7, 3962, 17249, 445, 7975, 3975...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnknownType(t *testing.T) { acc, err := NewAccessDetails("foo://192.168.122.1") if err == nil || acc != nil { t.Fatalf("unexpected parse success") } }
explode_data.jsonl/11832
{ "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, 13790, 929, 1155, 353, 8840, 836, 8, 341, 197, 4475, 11, 1848, 1669, 1532, 6054, 7799, 445, 7975, 1110, 16, 24, 17, 13, 16, 21, 23, 13, 16, 17, 17, 13, 16, 1138, 743, 1848, 621, 2092, 1369, 1029, 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 ]
3
func TestGitLabProviderUsername(t *testing.T) { b := testGitLabBackend() defer b.Close() bURL, _ := url.Parse(b.URL) p := testGitLabProvider(bURL.Host) p.AllowUnverifiedEmail = true session := &sessions.SessionState{AccessToken: "gitlab_access_token"} username, err := p.GetUserName(session) assert.Equal(t, nil, err) assert.Equal(t, "FooBar", username) }
explode_data.jsonl/12895
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 46562, 29046, 5179, 11115, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 1273, 46562, 29046, 29699, 741, 16867, 293, 10421, 2822, 2233, 3144, 11, 716, 1669, 2515, 8937, 1883, 20893, 340, 3223, 1669, 1273, 46562, 29046, 5179, 1883,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreatePostAll(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() Client := th.Client post := &model.Post{ChannelId: th.BasicChannel.Id, Message: "#hashtag a" + model.NewId() + "a"} user := model.User{Email: th.GenerateTestEmail(), Nickname: "Joram Wilander", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_USER_ROLE_ID} directChannel, _ := th.App.GetOrCreateDirectChannel(th.BasicUser.Id, th.BasicUser2.Id) ruser, resp := Client.CreateUser(&user) CheckNoError(t, resp) Client.Login(user.Email, user.Password) _, resp = Client.CreatePost(post) CheckForbiddenStatus(t, resp) th.App.UpdateUserRoles(ruser.Id, model.SYSTEM_USER_ROLE_ID+" "+model.SYSTEM_POST_ALL_ROLE_ID, false) th.App.InvalidateAllCaches() Client.Login(user.Email, user.Password) _, resp = Client.CreatePost(post) CheckNoError(t, resp) post.ChannelId = th.BasicPrivateChannel.Id _, resp = Client.CreatePost(post) CheckNoError(t, resp) post.ChannelId = directChannel.Id _, resp = Client.CreatePost(post) CheckNoError(t, resp) th.App.UpdateUserRoles(ruser.Id, model.SYSTEM_USER_ROLE_ID, false) th.App.JoinUserToTeam(th.BasicTeam, ruser, "") th.App.UpdateTeamMemberRoles(th.BasicTeam.Id, ruser.Id, model.TEAM_USER_ROLE_ID+" "+model.TEAM_POST_ALL_ROLE_ID) th.App.InvalidateAllCaches() Client.Login(user.Email, user.Password) post.ChannelId = th.BasicPrivateChannel.Id _, resp = Client.CreatePost(post) CheckNoError(t, resp) post.ChannelId = th.BasicChannel.Id _, resp = Client.CreatePost(post) CheckNoError(t, resp) post.ChannelId = directChannel.Id _, resp = Client.CreatePost(post) CheckForbiddenStatus(t, resp) }
explode_data.jsonl/5241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 632 }
[ 2830, 3393, 4021, 4133, 2403, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 51172, 1669, 609, 2528, 23442, 90, 9629, 764, 25, 270, 48868, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOperators(t *testing.T) { qs := dORM.QueryTable("user") num, err := qs.Filter("user_name", "slene").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.Filter("user_name__exact", String("slene")).Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.Filter("user_name__exact", "slene").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.Filter("user_name__iexact", "Slene").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) if IsMysql { // Now only mysql support `strictexact` num, err = qs.Filter("user_name__strictexact", "Slene").Count() throwFail(t, err) throwFail(t, AssertIs(num, 0)) num, err = qs.Filter("user_name__strictexact", "slene").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) } num, err = qs.Filter("user_name__contains", "e").Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) var shouldNum int if IsSqlite || IsTidb { shouldNum = 2 } else { shouldNum = 0 } num, err = qs.Filter("user_name__contains", "E").Count() throwFail(t, err) throwFail(t, AssertIs(num, shouldNum)) num, err = qs.Filter("user_name__icontains", "E").Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("user_name__icontains", "E").Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("status__gt", 1).Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("status__gte", 1).Count() throwFail(t, err) throwFail(t, AssertIs(num, 3)) num, err = qs.Filter("status__lt", Uint(3)).Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("status__lte", Int(3)).Count() throwFail(t, err) throwFail(t, AssertIs(num, 3)) num, err = qs.Filter("user_name__startswith", "s").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) if IsSqlite || IsTidb { shouldNum = 1 } else { shouldNum = 0 } num, err = qs.Filter("user_name__startswith", "S").Count() throwFail(t, err) throwFail(t, AssertIs(num, shouldNum)) num, err = qs.Filter("user_name__istartswith", "S").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.Filter("user_name__endswith", "e").Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) if IsSqlite || IsTidb { shouldNum = 2 } else { shouldNum = 0 } num, err = qs.Filter("user_name__endswith", "E").Count() throwFail(t, err) throwFail(t, AssertIs(num, shouldNum)) num, err = qs.Filter("user_name__iendswith", "E").Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("profile__isnull", true).Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.Filter("status__in", 1, 2).Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("status__in", []int{1, 2}).Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) n1, n2 := 1, 2 num, err = qs.Filter("status__in", []*int{&n1}, &n2).Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("id__between", 2, 3).Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.Filter("id__between", []int{2, 3}).Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.FilterRaw("user_name", "= 'slene'").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) num, err = qs.FilterRaw("status", "IN (1, 2)").Count() throwFail(t, err) throwFail(t, AssertIs(num, 2)) num, err = qs.FilterRaw("profile_id", "IN (SELECT id FROM user_profile WHERE age=30)").Count() throwFail(t, err) throwFail(t, AssertIs(num, 1)) }
explode_data.jsonl/18129
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1573 }
[ 2830, 3393, 77760, 1155, 353, 8840, 836, 8, 341, 18534, 82, 1669, 294, 4365, 15685, 2556, 445, 872, 1138, 22431, 11, 1848, 1669, 32421, 31696, 445, 872, 1269, 497, 330, 3226, 1952, 1827, 2507, 741, 9581, 19524, 1155, 11, 1848, 340, 95...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntegration_MultiwordV1_Sim(t *testing.T) { t.Parallel() // Simulate a consumer contract calling to obtain ETH quotes in 3 different currencies // in a single callback. config, cleanup := cltest.NewConfig(t) defer cleanup() user, _, _, consumerContract, operatorContract, b := setupMultiWordContracts(t) app, cleanup := cltest.NewApplicationWithConfigAndKeyOnSimulatedBlockchain(t, config, b) defer cleanup() app.Config.Set("ETH_HEAD_TRACKER_MAX_BUFFER_SIZE", 100) app.Config.Set("MIN_OUTGOING_CONFIRMATIONS", 1) authorizedSenders := []common.Address{app.Store.KeyStore.Accounts()[0].Address} _, err := operatorContract.SetAuthorizedSenders(user, authorizedSenders) require.NoError(t, err) b.Commit() // Fund node account with ETH. n, err := b.NonceAt(context.Background(), user.From, nil) require.NoError(t, err) tx := types.NewTransaction(n, app.Store.KeyStore.Accounts()[0].Address, big.NewInt(1000000000000000000), 21000, big.NewInt(1), nil) signedTx, err := user.Signer(user.From, tx) require.NoError(t, err) err = b.SendTransaction(context.Background(), signedTx) require.NoError(t, err) b.Commit() err = app.StartAndConnect() require.NoError(t, err) var call int64 response := func() string { defer func() { atomic.AddInt64(&call, 1) }() switch call { case 0: return `{"USD": 614.64}` case 1: return `{"EUR": 507.07}` case 2: return `{"JPY":63818.86}` } require.Fail(t, "only 3 calls expected") return "" } mockServer := cltest.NewHTTPMockServerWithAlterableResponse(t, response) spec := string(cltest.MustReadFile(t, "testdata/multiword_v1_runlog.json")) spec = strings.Replace(spec, "{url}", mockServer.URL, 1) spec = strings.Replace(spec, "{url}", mockServer.URL, 1) spec = strings.Replace(spec, "{url}", mockServer.URL, 1) j := cltest.CreateSpecViaWeb(t, app, spec) var specID [32]byte by, err := hex.DecodeString(j.ID.String()) require.NoError(t, err) copy(specID[:], by[:]) _, err = consumerContract.SetSpecID(user, specID) require.NoError(t, err) user.GasPrice = big.NewInt(1) user.GasLimit = 1000000 _, err = consumerContract.RequestMultipleParameters(user, "", big.NewInt(1000)) require.NoError(t, err) b.Commit() var empty [32]byte assertPrices(t, empty[:], empty[:], empty[:], consumerContract) tick := time.NewTicker(100 * time.Millisecond) defer tick.Stop() go func() { for range tick.C { app.EthBroadcaster.Trigger() b.Commit() } }() cltest.WaitForRuns(t, j, app.Store, 1) jr, err := app.Store.JobRunsFor(j.ID) require.NoError(t, err) cltest.WaitForEthTxAttemptCount(t, app.Store, 1) // Job should complete successfully. _ = cltest.WaitForJobRunStatus(t, app.Store, jr[0], models.RunStatusCompleted) assertPrices(t, []byte("614.64"), []byte("507.07"), []byte("63818.86"), consumerContract) }
explode_data.jsonl/75908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1075 }
[ 2830, 3393, 52464, 1245, 7068, 1158, 53, 16, 1098, 318, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 4467, 6334, 264, 11502, 5116, 8098, 311, 6851, 37742, 17194, 304, 220, 18, 2155, 35602, 198, 197, 322, 304, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAPIs(t *testing.T) { RegisterFailHandler(Fail) RunSpecsWithDefaultAndCustomReporters(t, "v1 Webhook Suite", []Reporter{printer.NewlineReporter{}}) }
explode_data.jsonl/28957
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 7082, 82, 1155, 353, 8840, 836, 8, 341, 79096, 19524, 3050, 7832, 604, 692, 85952, 8327, 16056, 3675, 3036, 10268, 10361, 388, 1155, 345, 197, 197, 1, 85, 16, 4895, 20873, 20977, 756, 197, 197, 1294, 52766, 90, 62956, 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
func TestAbsCollection_Max(t *testing.T) { intColl := NewIntCollection([]int{1, 2, 2, 3}) max, err := intColl.Max().ToInt() if err != nil { t.Fatal(err) } if max != 3 { t.Fatal("max错误") } }
explode_data.jsonl/66453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 27778, 6482, 58843, 1155, 353, 8840, 836, 8, 341, 2084, 15265, 1669, 1532, 1072, 6482, 10556, 396, 90, 16, 11, 220, 17, 11, 220, 17, 11, 220, 18, 3518, 22543, 11, 1848, 1669, 526, 15265, 14535, 1005, 38544, 741, 743, 184...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUint16Serial(t *testing.T) { b := buf.New() defer b.Release() n, err := serial.WriteUint16(b, 10) common.Must(err) if n != 2 { t.Error("expect 2 bytes writtng, but actually ", n) } if diff := cmp.Diff(b.Bytes(), []byte{0, 10}); diff != "" { t.Error(diff) } }
explode_data.jsonl/10870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 21570, 16, 21, 5915, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 6607, 7121, 741, 16867, 293, 58693, 2822, 9038, 11, 1848, 1669, 6146, 4073, 21570, 16, 21, 1883, 11, 220, 16, 15, 340, 83825, 50463, 3964, 340, 743, 308, 961...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGateway_HTTPIngress(t *testing.T) { istioNamespace := tc.Kube.IstioSystemNamespace() ingressGatewayServiceName := tc.Kube.IstioIngressGatewayService() // Configure a route from us.bookinfo.com to "c-v2" only cfgs := &deployableConfig{ Namespace: tc.Kube.Namespace, YamlFiles: []string{ "testdata/networking/v1alpha3/ingressgateway.yaml", maybeAddTLSForDestinationRule(tc, "testdata/networking/v1alpha3/destination-rule-c.yaml"), "testdata/networking/v1alpha3/rule-ingressgateway.yaml"}, kubeconfig: tc.Kube.KubeConfig, } if err := cfgs.Setup(); err != nil { t.Fatal(err) } defer cfgs.Teardown() for cluster := range tc.Kube.Clusters { runRetriableTest(t, cluster, "HTTPIngressGateway", defaultRetryBudget, func() error { reqURL := fmt.Sprintf("http://%s.%s/c", ingressGatewayServiceName, istioNamespace) resp := ClientRequest(cluster, "t", reqURL, 100, "-key Host -val uk.bookinfo.com") count := make(map[string]int) for _, elt := range resp.Version { count[elt] = count[elt] + 1 } log.Infof("request counts %v", count) if count["v2"] >= 95 { return nil } return errAgain }) } }
explode_data.jsonl/15607
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 480 }
[ 2830, 3393, 40709, 34954, 641, 2483, 1155, 353, 8840, 836, 8, 341, 197, 380, 815, 22699, 1669, 17130, 11352, 3760, 2447, 267, 815, 2320, 22699, 741, 197, 287, 673, 40709, 1860, 675, 1669, 17130, 11352, 3760, 2447, 267, 815, 641, 2483, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_sortStringSliceByLength(t *testing.T) { type args struct { m []string } tests := []struct { name string args args want PathSlices }{ { name: "00", args: args{ []string{"/aa/bb/cc", "/aa", "/aa/bb"}, }, want: []PathSlice{{ Path: "/aa/bb/cc", }, { Path: "/aa/bb", }, { Path: "/aa", }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := sortStringSliceByLength(tt.args.m); !reflect.DeepEqual(got, tt.want) { t.Errorf("sortStringSliceByLength() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/48287
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 18435, 703, 33236, 1359, 4373, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 2109, 3056, 917, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 7933, 50, 374...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalCmdErrors(t *testing.T) { t.Parallel() tests := []struct { name string id interface{} cmd interface{} err dcrjson.Error }{ { name: "unregistered type", id: 1, cmd: (*int)(nil), err: dcrjson.Error{Code: dcrjson.ErrUnregisteredMethod}, }, { name: "nil instance of registered type", id: 1, cmd: (*dcrjson.GetBlockCmd)(nil), err: dcrjson.Error{Code: dcrjson.ErrInvalidType}, }, { name: "nil instance of registered type", id: []int{0, 1}, cmd: &dcrjson.GetBlockCountCmd{}, err: dcrjson.Error{Code: dcrjson.ErrInvalidType}, }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { _, err := dcrjson.MarshalCmd("1.0", test.id, test.cmd) if reflect.TypeOf(err) != reflect.TypeOf(test.err) { t.Errorf("Test #%d (%s) wrong error type - got `%T` (%v), want `%T`", i, test.name, err, err, test.err) continue } gotErrorCode := err.(dcrjson.Error).Code if gotErrorCode != test.err.Code { t.Errorf("Test #%d (%s) mismatched error code - got "+ "%v (%v), want %v", i, test.name, gotErrorCode, err, test.err.Code) continue } } }
explode_data.jsonl/73750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 526 }
[ 2830, 3393, 55438, 15613, 13877, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 15710, 256, 3749, 16094, 197, 25920, 220, 3749, 16094, 197, 9859, 220, 294, 5082, 2236, 614...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIstioRules(t *testing.T) { r, stop := startTestReconciler(t) defer stop() in, cleanup := createTestInstance(t, testFeatureFlags{istio: true}) defer cleanup() cfg, err := r.getConfig() require.NoError(t, err) list, err := istioRules(cfg, in) require.NoError(t, err) require.Len(t, list, len(in.Spec.Services)) gvr := istioRuleGVR() for i, rule := range list { unstructuredShouldExist(t, r.Dynamic, gvr, rule) removeServiceFromSpec(t, r.Client, in, i) unstructuredShouldNotExist(t, r.Dynamic, gvr, rule) } }
explode_data.jsonl/47208
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 40, 267, 815, 26008, 1155, 353, 8840, 836, 8, 341, 7000, 11, 2936, 1669, 1191, 2271, 693, 40446, 5769, 1155, 340, 16867, 2936, 741, 17430, 11, 21290, 1669, 1855, 2271, 2523, 1155, 11, 1273, 13859, 9195, 90, 380, 815, 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 TestAccReboot_basic(t *testing.T) { if isCluster { t.Skip("Cluster does not support reboot operation") } if isCpxRun { t.Skip("CPX does not support reboot operation") } resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckRebootDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccRebooter_basic, Check: resource.ComposeTestCheckFunc( testAccCheckRebooterExist("citrixadc_rebooter.tf_rebooter", nil), ), }, }, }) }
explode_data.jsonl/28826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 14603, 693, 4619, 34729, 1155, 353, 8840, 836, 8, 341, 743, 374, 28678, 341, 197, 3244, 57776, 445, 28678, 1558, 537, 1824, 34592, 5666, 1138, 197, 532, 743, 374, 34, 1767, 6727, 341, 197, 3244, 57776, 445, 7123, 55, 1558,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetppid(t *testing.T) { test.DropPrivilege(t) defer test.ResetPrivilege(t) pid := os.Getpid() ppid := os.Getppid() list := []struct { name string pid int ppid int expectSuccess bool }{ {"ProcessZero", 0, -1, false}, {"CurrentProcess", pid, ppid, true}, {"InitProcess", 1, -1, false}, } for _, tt := range list { p, err := Getppid(tt.pid) if err != nil && tt.expectSuccess { t.Fatalf("unexpected failure for %q: %s", tt.name, err) } else if err == nil && !tt.expectSuccess { t.Fatalf("unexpected success for %q: got parent process ID %d instead of %d", tt.name, p, tt.ppid) } else if p != tt.ppid { t.Fatalf("unexpected parent process ID returned: got %d instead of %d", p, tt.ppid) } } }
explode_data.jsonl/19792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 341 }
[ 2830, 3393, 1949, 602, 307, 1155, 353, 8840, 836, 8, 341, 18185, 21688, 32124, 42769, 1155, 340, 16867, 1273, 36660, 32124, 42769, 1155, 692, 78799, 1669, 2643, 2234, 10412, 741, 65729, 307, 1669, 2643, 2234, 602, 307, 2822, 14440, 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...
7
func TestEditFileToNewBranch(t *testing.T) { prepareTestEnv(t) session := loginUser(t, "user2") testEditFileToNewBranch(t, session, "user2", "repo1", "master", "feature/test", "README.md") }
explode_data.jsonl/62574
{ "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, 4036, 1703, 1249, 3564, 18197, 1155, 353, 8840, 836, 8, 341, 197, 13609, 2271, 14359, 1155, 340, 25054, 1669, 87169, 1155, 11, 330, 872, 17, 1138, 18185, 4036, 1703, 1249, 3564, 18197, 1155, 11, 3797, 11, 330, 872, 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
func Test_Hoverfly_GetVersion_GetsVersion(t *testing.T) { RegisterTestingT(t) unit := Hoverfly{ version: "test-version", } Expect(unit.GetVersion()).To(Equal("test-version")) }
explode_data.jsonl/45392
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 2039, 1975, 21642, 13614, 5637, 2646, 1415, 5637, 1155, 353, 8840, 836, 8, 341, 79096, 16451, 51, 1155, 692, 81189, 1669, 85569, 21642, 515, 197, 74954, 25, 330, 1944, 45367, 756, 197, 630, 35911, 24144, 2234, 5637, 6011, 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
func TestNewProtobufEvent(t *testing.T) { Convey("given a protobuf event with a nil property value", t, func() { protoEvent := &sfxmodel.Event{ EventType: "mwp.test2", Dimensions: []*sfxmodel.Dimension{}, Properties: []*sfxmodel.Property{ { Key: "version", Value: &sfxmodel.PropertyValue{}, }, }, } Convey("should error when converted", func() { _, err := NewProtobufEvent(protoEvent) So(err, ShouldEqual, errPropertyValueNotSet) }) }) }
explode_data.jsonl/81471
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 208 }
[ 2830, 3393, 3564, 12423, 18464, 1556, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 41968, 264, 69634, 1538, 448, 264, 2092, 3343, 897, 497, 259, 11, 2915, 368, 341, 197, 197, 15110, 1556, 1669, 609, 82, 8298, 2528, 6904, 515, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetKeySucceeds(t *testing.T) { s, ctx := newSessionWithMock() pubKey := &rsa.PublicKey{N: big.NewInt(1), E: 1} // test newSigner works when everything... works ctx.GetAttributeValueFunc = func(_ pkcs11.SessionHandle, _ pkcs11.ObjectHandle, attrs []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { var returns []*pkcs11.Attribute for _, attr := range attrs { switch attr.Type { case pkcs11.CKA_ID: returns = append(returns, pkcs11.NewAttribute(pkcs11.CKA_ID, []byte{99})) default: return nil, errors.New("GetAttributeValue got unexpected attribute type") } } return returns, nil } _, err := s.NewSigner("label", pubKey) test.AssertNotError(t, err, "newSigner failed when everything worked properly") }
explode_data.jsonl/1167
{ "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, 1949, 1592, 50, 29264, 82, 1155, 353, 8840, 836, 8, 341, 1903, 11, 5635, 1669, 501, 5283, 2354, 11571, 741, 62529, 1592, 1669, 609, 60869, 49139, 1592, 90, 45, 25, 2409, 7121, 1072, 7, 16, 701, 468, 25, 220, 16, 630, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBaselineMetrics(t *testing.T) { w := httptest.NewRecorder() req, _ := http.NewRequest("GET", "/", nil) promhttp.Handler().ServeHTTP(w, req) assertMetricsExist(t, w.Body.String(), baselineMetrics) }
explode_data.jsonl/75857
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 64611, 27328, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 24395, 11, 716, 1669, 1758, 75274, 445, 3806, 497, 64657, 2092, 340, 3223, 441, 1254, 31010, 1005, 60421, 9230, 3622, 11, 4232, 340, 694...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDB_Batch_Panic(t *testing.T) { db := MustOpenDB() defer db.MustClose() var sentinel int var bork = &sentinel var problem interface{} var err error // Execute a function inside a batch that panics. func() { defer func() { if p := recover(); p != nil { problem = p } }() err = db.Batch(func(tx *bolt.Tx) error { panic(bork) }) }() // Verify there is no error. if g, e := err, error(nil); g != e { t.Fatalf("wrong error: %v != %v", g, e) } // Verify the panic was captured. if g, e := problem, bork; g != e { t.Fatalf("wrong error: %v != %v", g, e) } }
explode_data.jsonl/27491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 3506, 1668, 754, 1088, 31270, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 15465, 5002, 3506, 741, 16867, 2927, 50463, 7925, 2822, 2405, 80778, 526, 198, 2405, 293, 669, 284, 609, 24512, 29708, 198, 2405, 3491, 3749, 16094, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPortForward(t *testing.T) { const ( podName = "podFoo" podNamespace = "nsFoo" podUID types.UID = "12345678" port int32 = 5000 ) testcases := []struct { description string podName string expectError bool }{{ description: "success case", podName: podName, }, { description: "no such pod", podName: "bar", expectError: true, }} for _, tc := range testcases { testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */) defer testKubelet.Cleanup() kubelet := testKubelet.kubelet testKubelet.fakeRuntime.PodList = []*containertest.FakePod{ {Pod: &kubecontainer.Pod{ ID: podUID, Name: podName, Namespace: podNamespace, Containers: []*kubecontainer.Container{ {Name: "foo", ID: kubecontainer.ContainerID{Type: "test", ID: "foo"}, }, }, }}, } description := "streaming - " + tc.description fakeRuntime := &containertest.FakeStreamingRuntime{FakeRuntime: testKubelet.fakeRuntime} kubelet.containerRuntime = fakeRuntime kubelet.streamingRuntime = fakeRuntime redirect, err := kubelet.GetPortForward(tc.podName, podNamespace, podUID, portforward.V4Options{}) if tc.expectError { assert.Error(t, err, description) } else { assert.NoError(t, err, description) assert.Equal(t, containertest.FakeHost, redirect.Host, description+": redirect") } } }
explode_data.jsonl/49889
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 616 }
[ 2830, 3393, 1949, 7084, 25925, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 3223, 347, 675, 394, 284, 330, 39073, 40923, 698, 197, 3223, 347, 22699, 1843, 284, 330, 4412, 40923, 698, 197, 3223, 347, 6463, 981, 4494, 5255, 915, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestReadArchives(t *testing.T) { archiveArgsA.summaryArg = true summaries, _ := inspectArchives([]string{"testData/rs3.zip", "testData/rs2.zip"}, &archiveArgsA) if len(summaries) != 2 { t.Fatalf("Expected %d results but got %d", 2, len(summaries)) } }
explode_data.jsonl/13174
{ "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, 4418, 18727, 1886, 1155, 353, 8840, 836, 8, 341, 197, 16019, 4117, 32, 35341, 2735, 284, 830, 198, 31479, 89333, 11, 716, 1669, 24085, 18727, 1886, 10556, 917, 4913, 1944, 1043, 91885, 18, 20991, 497, 330, 1944, 1043, 91885,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewEncoderNoName(t *testing.T) { _, err := newEncoder("", zapcore.EncoderConfig{}) assert.Equal(t, errNoEncoderNameSpecified, err, "expected an error when creating an encoder with no name") }
explode_data.jsonl/54648
{ "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, 3564, 19921, 2753, 675, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 501, 19921, 19814, 32978, 2153, 26598, 4316, 2648, 37790, 6948, 12808, 1155, 11, 1848, 2753, 19921, 675, 8327, 1870, 11, 1848, 11, 330, 7325, 458, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCentroidDistanceSwapLess(t *testing.T) { dp1 := newBasicNodeWithLen(nil) dp2 := newBasicNodeWithLen([]int{1, 2, 3}) centroid := newBasicNodeWithLen(nil) data := []Node{dp1, dp2} cd := newCentroidDistance(centroid, data) if !cd.Less(0, 1) { t.Errorf("Expected dp1 < dp2.\n") } }
explode_data.jsonl/9173
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 22233, 1577, 14778, 46179, 27451, 1155, 353, 8840, 836, 8, 341, 55256, 16, 1669, 501, 15944, 1955, 2354, 11271, 27907, 340, 55256, 17, 1669, 501, 15944, 1955, 2354, 11271, 10556, 396, 90, 16, 11, 220, 17, 11, 220, 18, 8824...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandlerGetBuilders(t *testing.T) { dh := &Handler{} builders := map[string]*dashboard.BuildConfig{ "linux-amd64-testfile": { Name: "linux-amd64-testfile", HostType: "this-is-a-test-file", Notes: "", MinimumGoVersion: types.MajorMinor{}, }, "linux-386-testfile": { Name: "linux-386-testfile", HostType: "this-is-a-test-file", Notes: "", MinimumGoVersion: types.MajorMinor{}, }, "darwin-amd64-testfile": { Name: "darwin-amd64-testfile", HostType: "this-is-a-test-file", Notes: "", MinimumGoVersion: types.MajorMinor{}, }, "android-386-testfile": { Name: "android-386-testfile", HostType: "this-is-a-test-file", Notes: "", MinimumGoVersion: types.MajorMinor{}, }, } want := []*builder{ { OS: "darwin", Archs: []*arch{ { Arch: "amd64", Name: "darwin-amd64-testfile", Tag: "testfile", }, }, }, { OS: "linux", Archs: []*arch{ { Arch: "386", Name: "linux-386-testfile", Tag: "testfile", }, { Arch: "amd64", Name: "linux-amd64-testfile", Tag: "testfile", }, }, }, { OS: "android", Archs: []*arch{ { Arch: "386", Name: "android-386-testfile", Tag: "testfile", }, }, }, } got := dh.getBuilders(builders) if diff := cmp.Diff(want, got); diff != "" { t.Errorf("dh.getBuilders() mismatch (-want +got):\n%s", diff) } }
explode_data.jsonl/45361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 836 }
[ 2830, 3393, 3050, 1949, 62306, 1155, 353, 8840, 836, 8, 341, 2698, 71, 1669, 609, 3050, 16094, 69371, 388, 1669, 2415, 14032, 8465, 18641, 25212, 2648, 515, 197, 197, 1, 14210, 32217, 67, 21, 19, 16839, 1192, 788, 341, 298, 21297, 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