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 TestParseGitVersion(t *testing.T) { tests := []struct { gitVersion string out *serverVersion err bool }{ { gitVersion: "v1.8.0", out: &serverVersion{Major: 1, Minor: 8}, }, { gitVersion: "v1.12.0", out: &serverVersion{Major: 1, Minor: 12}, }, { gitVersion: "v1.12.20", out: &serverVersion{Major: 1, Minor: 12}, }, { gitVersion: "v1.12.8-test.10", out: &serverVersion{Major: 1, Minor: 12}, }, { gitVersion: "v1.a", err: true, }, } for _, tt := range tests { t.Run("", func(t *testing.T) { sv, err := parseGitVersion(tt.gitVersion) if tt.err { if err == nil { t.Errorf("expected error, got nil error") } return } if err != nil { t.Errorf("unexpected err: %v", err) return } if !reflect.DeepEqual(sv, tt.out) { t.Errorf("expected %v, got %v", tt.out, sv) } }) } }
explode_data.jsonl/10663
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 491 }
[ 2830, 3393, 14463, 46562, 5637, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 90731, 5637, 914, 198, 197, 13967, 286, 353, 4030, 5637, 198, 197, 9859, 286, 1807, 198, 197, 59403, 197, 197, 515, 298, 90731, 5637, 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...
5
func TestAcceptCharset(t *testing.T) { a := assert.New(t, false) name, enc := acceptCharset(DefaultCharset) a.Equal(name, DefaultCharset). True(charsetIsNop(enc)) name, enc = acceptCharset("") a.Equal(name, DefaultCharset). True(charsetIsNop(enc)) // * 表示采用默认的编码 name, enc = acceptCharset("*") a.Equal(name, DefaultCharset). True(charsetIsNop(enc)) name, enc = acceptCharset("gbk") a.Equal(name, "gbk"). Equal(enc, simplifiedchinese.GBK) // 传递一个非正规名称 name, enc = acceptCharset("chinese") a.Equal(name, "gbk"). Equal(enc, simplifiedchinese.GBK) // q 错解析错误 name, enc = acceptCharset("utf-8;q=x.9,gbk;q=0.8") a.Equal(name, "gbk"). Equal(enc, simplifiedchinese.GBK) // 不支持的编码 name, enc = acceptCharset("not-supported") a.Empty(name). Nil(enc) }
explode_data.jsonl/34209
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 413 }
[ 2830, 3393, 16646, 78172, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 11, 895, 692, 11609, 11, 3209, 1669, 4193, 78172, 87874, 78172, 340, 11323, 12808, 3153, 11, 7899, 78172, 4292, 197, 197, 2514, 6933, 746, 3872, 45, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadProcMountsFrom(t *testing.T) { successCase := `/dev/0 /path/to/0 type0 flags 0 0 /dev/1 /path/to/1 type1 flags 1 1 /dev/2 /path/to/2 type2 flags,1,2=3 2 2 ` // NOTE: readProcMountsFrom has been updated to using fnv.New32a() mounts, err := parseProcMounts([]byte(successCase)) if err != nil { t.Errorf("expected success, got %v", err) } if len(mounts) != 3 { t.Fatalf("expected 3 mounts, got %d", len(mounts)) } mp := MountPoint{"/dev/0", "/path/to/0", "type0", []string{"flags"}, 0, 0} if !mountPointsEqual(&mounts[0], &mp) { t.Errorf("got unexpected MountPoint[0]: %#v", mounts[0]) } mp = MountPoint{"/dev/1", "/path/to/1", "type1", []string{"flags"}, 1, 1} if !mountPointsEqual(&mounts[1], &mp) { t.Errorf("got unexpected MountPoint[1]: %#v", mounts[1]) } mp = MountPoint{"/dev/2", "/path/to/2", "type2", []string{"flags", "1", "2=3"}, 2, 2} if !mountPointsEqual(&mounts[2], &mp) { t.Errorf("got unexpected MountPoint[2]: %#v", mounts[2]) } errorCases := []string{ "/dev/0 /path/to/mount\n", "/dev/1 /path/to/mount type flags a 0\n", "/dev/2 /path/to/mount type flags 0 b\n", } for _, ec := range errorCases { _, err := parseProcMounts([]byte(ec)) if err == nil { t.Errorf("expected error") } } }
explode_data.jsonl/76944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 556 }
[ 2830, 3393, 4418, 24508, 16284, 82, 3830, 1155, 353, 8840, 836, 8, 341, 30553, 4207, 19687, 197, 197, 63, 14, 3583, 14, 15, 608, 2343, 32429, 14, 15, 943, 15, 8042, 220, 15, 220, 15, 198, 35061, 14, 16, 262, 608, 2343, 32429, 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...
8
func TestListFiles_ErrorsOnNonexistentPath(t *testing.T) { t.Parallel() p := script.ListFiles("nonexistentpath") if p.Error() == nil { t.Error("want error status on listing non-existent path, but got nil") } }
explode_data.jsonl/51512
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 852, 10809, 93623, 1087, 1925, 8121, 64085, 1820, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3223, 1669, 5316, 5814, 10809, 445, 6280, 64085, 2343, 1138, 743, 281, 6141, 368, 621, 2092, 341, 197, 3244, 6141, 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 ]
2
func TestChouonpuO(t *testing.T) { input := []inp{ {input: "オー", want: "oo"}, {input: "コーカ", want: "kooka"}, {input: "キョーカ", want: "kyooka"}, {input: "ゴーカ", want: "gooka"}, {input: "ギョーカ", want: "gyooka"}, {input: "ソーカ", want: "sooka"}, {input: "ショーカ", want: "shooka"}, {input: "ゾーカ", want: "zooka"}, {input: "ジョーカ", want: "jooka"}, {input: "トーカ", want: "tooka"}, {input: "チョーカ", want: "chooka"}, {input: "ドーカ", want: "dooka"}, {input: "ヂョーカ", want: "jooka"}, {input: "ノーカ", want: "nooka"}, {input: "ニョーカ", want: "nyooka"}, {input: "ホーカ", want: "hooka"}, {input: "ヒョーカ", want: "hyooka"}, {input: "ボーカ", want: "booka"}, {input: "ビョーカ", want: "byooka"}, {input: "ポーカ", want: "pooka"}, {input: "ピョーカ", want: "pyooka"}, {input: "モーカ", want: "mooka"}, {input: "ミョーカ", want: "myooka"}, {input: "ローカ", want: "rooka"}, {input: "リョーカ", want: "ryooka"}, {input: "ヲーカ", want: "wooka"}, } for _, v := range input { got, err := KanaToRomaji(v.input) assert.Equal(t, v.want, got) assert.Nil(t, err) } }
explode_data.jsonl/11361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 580 }
[ 2830, 3393, 1143, 283, 263, 5584, 46, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 42092, 515, 197, 197, 90, 1355, 25, 330, 129809, 497, 1366, 25, 330, 2624, 7115, 197, 197, 90, 1355, 25, 330, 46160, 37148, 104, 497, 1366, 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 TestTenancyUserList(t *testing.T) { auth, _ := base.TenancyWithLoginTester(t) defer base.BaseLogOut(auth) obj := auth.POST("v1/merchant/user/getAdminList"). WithJSON(map[string]interface{}{"page": 1, "pageSize": 10}). Expect().Status(http.StatusOK).JSON().Object() obj.Keys().ContainsOnly("status", "data", "message") obj.Value("status").Number().Equal(200) obj.Value("message").String().Equal("获取成功") data := obj.Value("data").Object() data.Keys().ContainsOnly("list", "total", "page", "pageSize") data.Value("pageSize").Number().Equal(10) data.Value("page").Number().Equal(1) data.Value("total").Number().Ge(1) }
explode_data.jsonl/29881
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 242 }
[ 2830, 3393, 32687, 6572, 1474, 852, 1155, 353, 8840, 836, 8, 341, 78011, 11, 716, 1669, 2331, 836, 268, 6572, 2354, 6231, 58699, 1155, 340, 16867, 2331, 13018, 2201, 2662, 27435, 340, 22671, 1669, 4166, 14721, 445, 85, 16, 14, 39011, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDiffBasicNoSpecificAnnotation(t *testing.T) { s := newScaffold(t) defer s.reset() d := &dg{cmValue: "baz", secretValue: "baz"} s.client.getFunc = d.get err := s.executeCommand("diff", "dev", "--ignore-annotation", "ann/foo", "--show-deletes=false") require.NotNil(t, err) a := assert.New(t) a.NotContains(s.stdout(), "ann/foo") a.Contains(s.stdout(), "ann/bar") }
explode_data.jsonl/72090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 21751, 15944, 2753, 47514, 19711, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 501, 50, 27864, 1155, 340, 16867, 274, 13857, 741, 2698, 1669, 609, 35138, 90, 6226, 1130, 25, 330, 42573, 497, 6234, 1130, 25, 330, 42573, 16707, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHashPasswordWithPbkdf2WithSalt(t *testing.T) { type args struct { password string salt []byte } tests := []struct { name string args args wantHash []byte }{ { name: "Hash", args: args{ password: "password", salt: []byte("salt"), }, wantHash: []byte{245, 209, 112, 34, 201, 106, 244, 108, 10, 29, 196, 154, 88, 187, 230, 84, 162, 142, 152, 16, 72, 131, 228, 175, 77, 233, 116, 205, 162, 199, 65, 34}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if gotHash := HashPasswordWithPbkdf2WithSalt(tt.args.password, tt.args.salt); !reflect.DeepEqual(gotHash, tt.wantHash) { t.Errorf("HashPasswordWithPbkdf2WithSalt() = %v, want %v", gotHash, tt.wantHash) } }) } }
explode_data.jsonl/17828
{ "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, 6370, 4876, 2354, 47, 40029, 2940, 17, 2354, 47318, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 58199, 914, 198, 197, 1903, 3145, 257, 3056, 3782, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 257...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlags(t *testing.T) { testEqual(t, "Base64ForceAVX2 = %q, want %q", Base64ForceAVX2, 1<<0) testEqual(t, "Base64ForceNeon32 = %q, want %q", Base64ForceNeon32, 1<<1) testEqual(t, "Base64ForceNeon64 = %q, want %q", Base64ForceNeon64, 1<<2) testEqual(t, "Base64ForcePlain = %q, want %q", Base64ForcePlain, 1<<3) testEqual(t, "Base64ForceSSSE3 = %q, want %q", Base64ForceSSSE3, 1<<4) testEqual(t, "Base64ForceSSE41 = %q, want %q", Base64ForceSSE41, 1<<5) testEqual(t, "Base64ForceSSE42 = %q, want %q", Base64ForceSSE42, 1<<6) testEqual(t, "Base64ForceAVX = %q, want %q", Base64ForceAVX, 1<<7) }
explode_data.jsonl/17239
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 9195, 1155, 353, 8840, 836, 8, 341, 18185, 2993, 1155, 11, 330, 3978, 21, 19, 18573, 8093, 55, 17, 284, 1018, 80, 11, 1366, 1018, 80, 497, 5351, 21, 19, 18573, 8093, 55, 17, 11, 220, 16, 2442, 15, 340, 18185, 2993, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddLogMutilErr(t *testing.T) { mockdb := &mockMongo{ data: nil, err: errors.New("mock insert all"), errTrigger: 1, errTriggerStep: 0, } DB = mockdb contents := []auditoplog.AuditLogContext{ auditoplog.AuditLogContext{ID: 1, Content: "sss"}, } err := AddLogMulti(1, auditoplog.AuditOpTypeAdd, common.BKInnerObjIDHost, contents, "mock desc", common.BKDefaultOwnerID, "user") if err != mockdb.err { t.Error(err) } }
explode_data.jsonl/56517
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 2212, 2201, 44, 1314, 7747, 1155, 353, 8840, 836, 8, 1476, 77333, 1999, 1669, 609, 16712, 54998, 515, 197, 8924, 25, 1843, 2092, 345, 197, 9859, 25, 310, 5975, 7121, 445, 16712, 5656, 678, 4461, 197, 9859, 17939, 25, 257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewEvent(t *testing.T) { _, err := NewEvent([]byte(`{"kind": "test"`)) if err == nil { t.Fatal("expected json parse error") } _, err = NewEvent([]byte(`{"kind": "test"}`)) if err != nil { t.Fatal(err) } }
explode_data.jsonl/27812
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 3564, 1556, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 1532, 1556, 10556, 3782, 5809, 4913, 15314, 788, 330, 1944, 39917, 1171, 743, 1848, 621, 2092, 341, 197, 3244, 26133, 445, 7325, 2951, 4715, 1465, 1138, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestResourceTemplate(t *testing.T) { controller := newController() wfcset := controller.wfclientset.ArgoprojV1alpha1().Workflows("") // operate the workflow. it should create a pod. wf := unmarshalWF(resourceTemplate) wf, err := wfcset.Create(wf) assert.NoError(t, err) woc := newWorkflowOperationCtx(wf, controller) woc.operate() wf, err = wfcset.Get(wf.ObjectMeta.Name, metav1.GetOptions{}) assert.NoError(t, err) assert.Equal(t, wfv1.NodeRunning, wf.Status.Phase) pod, err := controller.kubeclientset.CoreV1().Pods("").Get("resource-template", metav1.GetOptions{}) if !assert.NoError(t, err) { t.Fatal(err) } tmplStr := pod.Annotations[common.AnnotationKeyTemplate] tmpl := wfv1.Template{} err = yaml.Unmarshal([]byte(tmplStr), &tmpl) if !assert.NoError(t, err) { t.Fatal(err) } cm := apiv1.ConfigMap{} err = yaml.Unmarshal([]byte(tmpl.Resource.Manifest), &cm) if !assert.NoError(t, err) { t.Fatal(err) } assert.Equal(t, "resource-cm", cm.Name) assert.Empty(t, cm.ObjectMeta.OwnerReferences) }
explode_data.jsonl/54384
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 433 }
[ 2830, 3393, 4783, 7275, 1155, 353, 8840, 836, 8, 341, 61615, 1669, 501, 2051, 741, 6692, 8316, 746, 1669, 6461, 1418, 69, 2972, 746, 18979, 45926, 73, 53, 16, 7141, 16, 1005, 6776, 38140, 445, 5130, 197, 322, 14476, 279, 28288, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPopulateInventory(t *testing.T) { var rawInventory = map[string]interface{}{ "key_1": 1, "key_2": 2, "key_3": "foo", } i := inventory.New() populateInventory(i, rawInventory) for key, value := range rawInventory { v, exists := i.Item(key) assert.True(t, exists) assert.Equal(t, value, v["value"]) } }
explode_data.jsonl/13417
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 11598, 6334, 22319, 1155, 353, 8840, 836, 8, 341, 2405, 7112, 22319, 284, 2415, 14032, 31344, 67066, 197, 197, 1, 792, 62, 16, 788, 220, 16, 345, 197, 197, 1, 792, 62, 17, 788, 220, 17, 345, 197, 197, 1, 792, 62, 18,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAuthenticateRace(t *testing.T) { ctx := context.Background() c, rollback := makeConnection(t) defer rollback() var wg sync.WaitGroup for i := 0; i < 10; i++ { wg.Add(1) go func() { defer wg.Done() err := c.Authenticate(ctx) if err != nil { t.Error("Auth failed", err) } if !c.Authenticated() { t.Error("Not authenticated") } }() } wg.Wait() }
explode_data.jsonl/12657
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 99087, 55991, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 1155, 340, 16867, 60414, 741, 2405, 63581, 12811, 28384, 2808, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 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...
3
func TestTranslateIngressV1beta1BackendWithInvalidService(t *testing.T) { prefix := networkingv1beta1.PathTypePrefix // no backend. ing := &networkingv1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", }, Spec: networkingv1beta1.IngressSpec{ Rules: []networkingv1beta1.IngressRule{ { Host: "apisix.apache.org", IngressRuleValue: networkingv1beta1.IngressRuleValue{ HTTP: &networkingv1beta1.HTTPIngressRuleValue{ Paths: []networkingv1beta1.HTTPIngressPath{ { Path: "/foo", PathType: &prefix, Backend: networkingv1beta1.IngressBackend{ ServiceName: "test-service", ServicePort: intstr.IntOrString{ Type: intstr.String, StrVal: "undefined-port", }, }, }, }, }, }, }, }, }, } client := fake.NewSimpleClientset() informersFactory := informers.NewSharedInformerFactory(client, 0) svcInformer := informersFactory.Core().V1().Services().Informer() svcLister := informersFactory.Core().V1().Services().Lister() tr := &translator{ TranslatorOptions: &TranslatorOptions{ ServiceLister: svcLister, }, } ctx, err := tr.translateIngressV1beta1(ing) assert.NotNil(t, err) assert.Nil(t, ctx) assert.Equal(t, "service \"test-service\" not found", err.Error()) processCh := make(chan struct{}) svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { processCh <- struct{}{} }, }) stopCh := make(chan struct{}) defer close(stopCh) go svcInformer.Run(stopCh) cache.WaitForCacheSync(stopCh, svcInformer.HasSynced) _, err = client.CoreV1().Services("default").Create(context.Background(), _testSvc, metav1.CreateOptions{}) assert.Nil(t, err) _, err = client.CoreV1().Endpoints("default").Create(context.Background(), _testEp, metav1.CreateOptions{}) assert.Nil(t, err) <-processCh ctx, err = tr.translateIngressV1beta1(ing) assert.Nil(t, ctx) assert.Equal(t, &translateError{ field: "service", reason: "port not found", }, err) }
explode_data.jsonl/6702
{ "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, 27473, 641, 2483, 53, 16, 19127, 16, 29699, 2354, 7928, 1860, 1155, 353, 8840, 836, 8, 341, 3223, 5060, 1669, 28030, 85, 16, 19127, 16, 17474, 929, 14335, 198, 197, 322, 902, 19163, 624, 197, 287, 1669, 609, 17511, 287, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigFlagBackwardsCompatability(t *testing.T) { assert := assert.New(t) c, err := NewConfig([]string{ "--client-id=clientid", "--client-secret=verysecret", "--prompt=prompt", "--cookie-secret=veryverysecret", "--lifetime=200", "--cookie-secure=false", "--cookie-domains=test1.com,example.org", "--cookie-domain=another1.net", "--domain=test2.com,example.org", "--domain=another2.net", "--whitelist=test3.com,example.org", "--whitelist=another3.net", }) require.Nil(t, err) // The following used to be passed as comma separated list expected1 := []CookieDomain{ *NewCookieDomain("another1.net"), *NewCookieDomain("test1.com"), *NewCookieDomain("example.org"), } assert.Equal(expected1, c.CookieDomains, "should read legacy comma separated list cookie-domains") expected2 := CommaSeparatedList{"test2.com", "example.org", "another2.net"} assert.Equal(expected2, c.Domains, "should read legacy comma separated list domains") expected3 := CommaSeparatedList{"test3.com", "example.org", "another3.net"} assert.Equal(expected3, c.Whitelist, "should read legacy comma separated list whitelist") // Name changed assert.Equal([]byte("veryverysecret"), c.Secret) // Google provider params used to be top level assert.Equal("clientid", c.ClientIdLegacy) assert.Equal("clientid", c.Providers.Google.ClientID, "--client-id should set providers.google.client-id") assert.Equal("verysecret", c.ClientSecretLegacy) assert.Equal("verysecret", c.Providers.Google.ClientSecret, "--client-secret should set providers.google.client-secret") assert.Equal("prompt", c.PromptLegacy) assert.Equal("prompt", c.Providers.Google.Prompt, "--prompt should set providers.google.promot") // "cookie-secure" used to be a standard go bool flag that could take // true, TRUE, 1, false, FALSE, 0 etc. values. // Here we're checking that format is still suppoted assert.Equal("false", c.CookieSecureLegacy) assert.True(c.InsecureCookie, "--cookie-secure=false should set insecure-cookie true") c, err = NewConfig([]string{"--cookie-secure=TRUE"}) assert.Nil(err) assert.Equal("TRUE", c.CookieSecureLegacy) assert.False(c.InsecureCookie, "--cookie-secure=TRUE should set insecure-cookie false") }
explode_data.jsonl/33755
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 775 }
[ 2830, 3393, 2648, 12135, 3707, 4014, 13552, 2096, 1403, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 1444, 11, 1848, 1669, 1532, 2648, 10556, 917, 515, 197, 197, 74757, 2972, 12897, 28, 2972, 307, 756, 197, 197, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIdentifierForPull(t *testing.T) { var testCases = []struct { name string org, repo string num int expected string }{ { name: "normal works as expected", org: "organization", repo: "repository", num: 1234, expected: "organization/repository/pull/1234", }, } for _, testCase := range testCases { if actual, expected := IdentifierForPull(testCase.org, testCase.repo, testCase.num), testCase.expected; actual != expected { t.Errorf("%s: got incorrect identifier, expected %s but got %s", testCase.name, expected, actual) } } }
explode_data.jsonl/24635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 8714, 2461, 36068, 1155, 353, 8840, 836, 8, 341, 2405, 1273, 37302, 284, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 87625, 11, 15867, 914, 198, 197, 22431, 981, 526, 198, 197, 42400, 220, 914, 198, 197, 59403, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestContextFormFile(t *testing.T) { buf := new(bytes.Buffer) mw := multipart.NewWriter(buf) w, err := mw.CreateFormFile("file", "test") if assert.NoError(t, err) { _, err = w.Write([]byte("test")) assert.NoError(t, err) } mw.Close() c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", buf) c.Request.Header.Set("Content-Type", mw.FormDataContentType()) f, err := c.FormFile("file") if assert.NoError(t, err) { assert.Equal(t, "test", f.Filename) } assert.NoError(t, c.SaveUploadedFile(f, "test")) }
explode_data.jsonl/26737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 1972, 1838, 1703, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 501, 23158, 22622, 340, 2109, 86, 1669, 68058, 7121, 6492, 10731, 340, 6692, 11, 1848, 1669, 52810, 7251, 1838, 1703, 445, 1192, 497, 330, 1944, 1138, 743, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPeriodicGC(t *testing.T) { Convey("Periodic gc enabled for default store", t, func() { port := test.GetFreePort() baseURL := test.GetBaseURL(port) conf := config.New() conf.HTTP.Port = port logFile, err := ioutil.TempFile("", "zot-log*.txt") So(err, ShouldBeNil) conf.Log.Level = "debug" conf.Log.Output = logFile.Name() defer os.Remove(logFile.Name()) // clean up ctlr := api.NewController(conf) dir := t.TempDir() ctlr.Config.Storage.RootDirectory = dir ctlr.Config.Storage.GC = true ctlr.Config.Storage.GCInterval = 1 * time.Hour ctlr.Config.Storage.GCDelay = 1 * time.Second go startServer(ctlr) defer stopServer(ctlr) test.WaitTillServerReady(baseURL) data, err := os.ReadFile(logFile.Name()) So(err, ShouldBeNil) So(string(data), ShouldContainSubstring, "\"GC\":true,\"Commit\":false,\"GCDelay\":1000000000,\"GCInterval\":3600000000000") So(string(data), ShouldContainSubstring, fmt.Sprintf("executing GC of orphaned blobs for %s", ctlr.StoreController.DefaultStore.RootDir())) So(string(data), ShouldNotContainSubstring, fmt.Sprintf("error while running GC for %s", ctlr.StoreController.DefaultStore.RootDir())) So(string(data), ShouldContainSubstring, fmt.Sprintf("GC completed for %s, next GC scheduled after", ctlr.StoreController.DefaultStore.RootDir())) }) Convey("Periodic GC enabled for substore", t, func() { port := test.GetFreePort() baseURL := test.GetBaseURL(port) conf := config.New() conf.HTTP.Port = port logFile, err := ioutil.TempFile("", "zot-log*.txt") So(err, ShouldBeNil) conf.Log.Level = "debug" conf.Log.Output = logFile.Name() defer os.Remove(logFile.Name()) // clean up ctlr := api.NewController(conf) dir := t.TempDir() subDir := t.TempDir() subPaths := make(map[string]config.StorageConfig) subPaths["/a"] = config.StorageConfig{RootDirectory: subDir, GC: true, GCDelay: 1 * time.Second, GCInterval: 24 * time.Hour} //nolint:lll // gofumpt conflicts with lll ctlr.Config.Storage.SubPaths = subPaths ctlr.Config.Storage.RootDirectory = dir go startServer(ctlr) defer stopServer(ctlr) test.WaitTillServerReady(baseURL) data, err := os.ReadFile(logFile.Name()) So(err, ShouldBeNil) // periodic GC is not enabled for default store So(string(data), ShouldContainSubstring, "\"GCDelay\":3600000000000,\"GCInterval\":0,\"RootDirectory\":\""+dir+"\"") // periodic GC is enabled for sub store So(string(data), ShouldContainSubstring, fmt.Sprintf("\"SubPaths\":{\"/a\":{\"RootDirectory\":\"%s\",\"GC\":true,\"Dedupe\":false,\"Commit\":false,\"GCDelay\":1000000000,\"GCInterval\":86400000000000", subDir)) //nolint:lll // gofumpt conflicts with lll So(string(data), ShouldContainSubstring, fmt.Sprintf("executing GC of orphaned blobs for %s", ctlr.StoreController.SubStore["/a"].RootDir())) }) }
explode_data.jsonl/77709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1096 }
[ 2830, 3393, 23750, 292, 22863, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 23750, 292, 22122, 8970, 369, 1638, 3553, 497, 259, 11, 2915, 368, 341, 197, 52257, 1669, 1273, 2234, 10940, 7084, 741, 197, 24195, 3144, 1669, 1273, 2234, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecimalType(t *testing.T) { testCases := []testCase{ {sql: "create table decimal_table (d1 decimal(10, 5));"}, {sql: "create table decimal_table1 (d1 decimal(20, 5));"}, {sql: "insert into decimal_table values (333.333);"}, {sql: "insert into decimal_table1 values (333.333);"}, {sql: "select * from decimal_table;", res: executeResult{ attr: []string{"d1"}, data: [][]string{{"33333300"}}, }}, {sql: "select * from decimal_table1;", res: executeResult{ attr: []string{"d1"}, data: [][]string{{"{33333300 0}"}}, }}, } test(t, testCases) }
explode_data.jsonl/69830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 11269, 929, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 66194, 515, 197, 197, 90, 3544, 25, 330, 3182, 1965, 12122, 5237, 320, 67, 16, 12122, 7, 16, 15, 11, 220, 20, 5905, 7115, 197, 197, 90, 3544, 25, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMapProxy_TryLockWithNonSerializableKey(t *testing.T) { _, err := mp.TryLock(student{}) AssertErrorNotNil(t, err, "tryLock did not return an error for nonserializable key") mp.Clear() }
explode_data.jsonl/57057
{ "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, 2227, 16219, 1139, 884, 11989, 2354, 8121, 29268, 1592, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10490, 19824, 11989, 39004, 37790, 18017, 1454, 96144, 1155, 11, 1848, 11, 330, 1539, 11989, 1521, 537, 470, 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 ]
1
func TestStrOpsTextJustify_XValueInt_01(t *testing.T) { txtJustify := TextJustify(0).Center() currValue := txtJustify.XValueInt() if currValue != 3 { t.Errorf("Error: Expected return of object integer = '3'.\n"+ "Instead, object integer value = '%v'\n", txtJustify.XValueInt()) } }
explode_data.jsonl/29335
{ "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, 2580, 38904, 1178, 9952, 1437, 6859, 1130, 1072, 62, 15, 16, 1155, 353, 8840, 836, 8, 1476, 68272, 9952, 1437, 1669, 2918, 9952, 1437, 7, 15, 568, 9392, 2822, 54966, 1130, 1669, 7932, 9952, 1437, 4338, 1130, 1072, 2822, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidateAwsAccountId(t *testing.T) { validNames := []string{ "123456789012", "999999999999", } for _, v := range validNames { _, errors := validateAwsAccountId(v, "account_id") if len(errors) != 0 { t.Fatalf("%q should be a valid AWS Account ID: %q", v, errors) } } invalidNames := []string{ "12345678901", // too short "1234567890123", // too long "invalid", "x123456789012", } for _, v := range invalidNames { _, errors := validateAwsAccountId(v, "account_id") if len(errors) == 0 { t.Fatalf("%q should be an invalid AWS Account ID", v) } } }
explode_data.jsonl/78563
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 17926, 47359, 62545, 1155, 353, 8840, 836, 8, 341, 56322, 7980, 1669, 3056, 917, 515, 197, 197, 1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 756, 197, 197, 1, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 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 Test_AVIO_001(t *testing.T) { AVFormatInit() defer AVFormatDeinit() // Set log callback AVLogSetCallback(AV_LOG_DEBUG, func(level AVLogLevel, message string, _ uintptr) { t.Log("level=", level, "message=", strings.TrimSpace(message)) }) // Open file for reading r, err := os.Open(SAMPLE_MP4) if err != nil { t.Fatal(err) } defer r.Close() // Create IO context io := NewAVIOContext(bufferSize, false, r.Read, nil, nil) if io == nil { t.Fatal("Failed to create AVIOContext") } defer io.Free() // Open input file ctx := NewAVFormatContext() if err := ctx.OpenInputIO(io.AVIOContext, nil); err != nil { t.Fatal(err) } else { defer ctx.CloseInput() } // Find stream information if err := ctx.FindStreamInfo(); err != nil { t.Error(err) } else { ctx.Dump(0) } }
explode_data.jsonl/33978
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 323 }
[ 2830, 3393, 29386, 3810, 62, 15, 15, 16, 1155, 353, 8840, 836, 8, 341, 197, 8093, 4061, 3803, 741, 16867, 12155, 4061, 1912, 2327, 2822, 197, 322, 2573, 1487, 4822, 198, 197, 8093, 2201, 1649, 7494, 4346, 53, 8419, 11139, 11, 2915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSoftDeleteClauseFromClaim(t *testing.T) { db, _ := gorm.Open(nil, nil) userID := uint64(1) jwtClaims := jwtutil.JWTClaims{ UserID: userID, } ctx := context.WithValue(context.Background(), jwtutil.JWTClaimsKey, jwtClaims) // nolint db = db.WithContext(ctx) now := time.Now() type args struct { d *gorm.DB now time.Time } tests := []struct { name string args args want map[string]interface{} want1 bool }{ { name: "Test case1: success", args: args{ d: db, now: now, }, want: map[string]interface{}{ "deleted_by": userID, "deleted_at": now, }, want1: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, got1 := SoftDeleteClauseFromClaim(tt.args.d, tt.args.now) if !reflect.DeepEqual(got, tt.want) { t.Errorf("SoftDeleteClauseFromClaim() got = %v, want %v", got, tt.want) } if got1 != tt.want1 { t.Errorf("SoftDeleteClauseFromClaim() got1 = %v, want %v", got1, tt.want1) } }) } }
explode_data.jsonl/61792
{ "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, 30531, 6435, 28482, 3830, 45544, 1155, 353, 8840, 836, 8, 341, 20939, 11, 716, 1669, 342, 493, 12953, 27907, 11, 2092, 340, 19060, 915, 1669, 2622, 21, 19, 7, 16, 340, 12428, 9306, 51133, 1669, 24589, 1314, 99073, 51133, 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...
3
func TestResources_SyncDroplet(t *testing.T) { tests := []struct { name string dropletsSvc godo.DropletsService initialResources *resources expectedResources *resources err error }{ { name: "happy path", dropletsSvc: &fakeDropletService{ getFunc: func(ctx context.Context, id int) (*godo.Droplet, *godo.Response, error) { return &godo.Droplet{ID: 1, Name: "updated-one"}, newFakeOKResponse(), nil }, }, initialResources: &resources{ dropletIDMap: map[int]*godo.Droplet{1: {ID: 1, Name: "one"}}, dropletNameMap: map[string]*godo.Droplet{"one": {ID: 1, Name: "one"}}, }, expectedResources: &resources{ dropletIDMap: map[int]*godo.Droplet{1: {ID: 1, Name: "updated-one"}}, dropletNameMap: map[string]*godo.Droplet{"updated-one": {ID: 1, Name: "updated-one"}}, }, err: nil, }, { name: "error", dropletsSvc: &fakeDropletService{ getFunc: func(ctx context.Context, id int) (*godo.Droplet, *godo.Response, error) { return nil, newFakeNotOKResponse(), errors.New("fail") }, }, initialResources: &resources{ dropletIDMap: map[int]*godo.Droplet{1: {ID: 1, Name: "one"}}, dropletNameMap: map[string]*godo.Droplet{"updated-one": {ID: 1, Name: "one"}}, }, expectedResources: &resources{ dropletIDMap: map[int]*godo.Droplet{1: {ID: 1, Name: "one"}}, dropletNameMap: map[string]*godo.Droplet{"one": {ID: 1, Name: "one"}}, }, err: errors.New("fail"), }, { name: "droplet not found", dropletsSvc: &fakeDropletService{ getFunc: func(ctx context.Context, id int) (*godo.Droplet, *godo.Response, error) { return nil, newFakeResponse(http.StatusNotFound), errors.New("not found") }, }, initialResources: &resources{ dropletIDMap: map[int]*godo.Droplet{1: {ID: 1, Name: "one"}}, dropletNameMap: map[string]*godo.Droplet{"one": {ID: 1, Name: "one"}}, }, expectedResources: &resources{ dropletIDMap: map[int]*godo.Droplet{}, dropletNameMap: map[string]*godo.Droplet{}, }, err: nil, }, { name: "new droplet", dropletsSvc: &fakeDropletService{ getFunc: func(ctx context.Context, id int) (*godo.Droplet, *godo.Response, error) { return &godo.Droplet{ID: 1, Name: "one"}, newFakeOKResponse(), nil }, }, initialResources: &resources{ dropletIDMap: map[int]*godo.Droplet{}, dropletNameMap: map[string]*godo.Droplet{}, }, expectedResources: &resources{ dropletIDMap: map[int]*godo.Droplet{1: {ID: 1, Name: "one"}}, dropletNameMap: map[string]*godo.Droplet{"one": {ID: 1, Name: "one"}}, }, err: nil, }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { t.Parallel() client := &godo.Client{ Droplets: test.dropletsSvc, } fakeResources := newResources("", "", client) fakeResources.dropletIDMap = test.initialResources.dropletIDMap fakeResources.dropletNameMap = test.initialResources.dropletNameMap err := fakeResources.SyncDroplet(context.Background(), 1) if test.err != nil { if !reflect.DeepEqual(err, test.err) { t.Errorf("incorrect err\nwant: %#v\n got: %#v", test.err, err) } return } if err != nil { t.Errorf("did not expect err but got: %s", err) return } if want, got := test.expectedResources.dropletIDMap, fakeResources.dropletIDMap; !reflect.DeepEqual(want, got) { t.Errorf("incorrect droplet id map\nwant: %#v\n got: %#v", want, got) } if want, got := test.expectedResources.dropletNameMap, fakeResources.dropletNameMap; !reflect.DeepEqual(want, got) { t.Errorf("incorrect droplet name map\nwant: %#v\n got: %#v", want, got) } }) } }
explode_data.jsonl/28025
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1645 }
[ 2830, 3393, 11277, 1098, 1721, 35, 299, 10819, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 2698, 299, 89492, 92766, 981, 342, 6004, 909, 299, 89492, 1860, 198, 197, 85270, 11277, 220, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLastInsertID(t *testing.T) { store, clean := realtikvtest.CreateMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") // insert tk.MustExec("create table t (c1 int not null auto_increment, c2 int, PRIMARY KEY (c1))") tk.MustExec("insert into t set c2 = 11") tk.MustQuery("select last_insert_id()").Check(testkit.Rows("1")) tk.MustExec("insert into t (c2) values (22), (33), (44)") tk.MustQuery("select last_insert_id()").Check(testkit.Rows("2")) tk.MustExec("insert into t (c1, c2) values (10, 55)") tk.MustQuery("select last_insert_id()").Check(testkit.Rows("2")) // replace tk.MustExec("replace t (c2) values(66)") tk.MustQuery("select * from t").Check(testkit.Rows("1 11", "2 22", "3 33", "4 44", "10 55", "11 66")) tk.MustQuery("select last_insert_id()").Check(testkit.Rows("11")) // update tk.MustExec("update t set c1=last_insert_id(c1 + 100)") tk.MustQuery("select * from t").Check(testkit.Rows("101 11", "102 22", "103 33", "104 44", "110 55", "111 66")) tk.MustQuery("select last_insert_id()").Check(testkit.Rows("111")) tk.MustExec("insert into t (c2) values (77)") tk.MustQuery("select last_insert_id()").Check(testkit.Rows("112")) // drop tk.MustExec("drop table t") tk.MustQuery("select last_insert_id()").Check(testkit.Rows("112")) tk.MustExec("create table t (c2 int, c3 int, c1 int not null auto_increment, PRIMARY KEY (c1))") tk.MustExec("insert into t set c2 = 30") // insert values lastInsertID := tk.Session().LastInsertID() tk.MustExec("prepare stmt1 from 'insert into t (c2) values (?)'") tk.MustExec("set @v1=10") tk.MustExec("set @v2=20") tk.MustExec("execute stmt1 using @v1") tk.MustExec("execute stmt1 using @v2") tk.MustExec("deallocate prepare stmt1") currLastInsertID := tk.Session().GetSessionVars().StmtCtx.PrevLastInsertID tk.MustQuery("select c1 from t where c2 = 20").Check(testkit.Rows(fmt.Sprint(currLastInsertID))) require.Equal(t, currLastInsertID, lastInsertID+2) }
explode_data.jsonl/5812
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 777 }
[ 2830, 3393, 5842, 13780, 915, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1931, 83, 1579, 85, 1944, 7251, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestListIteratorLast(t *testing.T) { list := New() it := list.Iterator() if actualValue, expectedValue := it.Last(), false; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } list.Add("a", "b", "c") if actualValue, expectedValue := it.Last(), true; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } if index, value := it.Index(), it.Value(); index != 2 || value != "c" { t.Errorf("Got %v,%v expected %v,%v", index, value, 2, "c") } }
explode_data.jsonl/18307
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 191 }
[ 2830, 3393, 852, 11951, 5842, 1155, 353, 8840, 836, 8, 341, 14440, 1669, 1532, 741, 23374, 1669, 1140, 40846, 741, 743, 5042, 1130, 11, 3601, 1130, 1669, 432, 24682, 1507, 895, 26, 5042, 1130, 961, 3601, 1130, 341, 197, 3244, 13080, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestHeartbeatTimeout(t *testing.T) { t.Parallel() cfg := DefaultConfig() cfg.HeartbeatPeriod = 100 * time.Millisecond cfg.HeartbeatEpsilon = 0 gd, err := startDispatcher(cfg) assert.NoError(t, err) defer gd.Close() var expectedSessionID string { stream, err := gd.Clients[0].Session(context.Background(), &api.SessionRequest{}) assert.NoError(t, err) resp, err := stream.Recv() assert.NoError(t, err) assert.NotEmpty(t, resp.SessionID) expectedSessionID = resp.SessionID } time.Sleep(500 * time.Millisecond) gd.Store.View(func(readTx store.ReadTx) { storeNodes, err := store.FindNodes(readTx, store.ByIDPrefix(gd.SecurityConfigs[0].ClientTLSCreds.NodeID())) assert.NoError(t, err) assert.NotEmpty(t, storeNodes) assert.Equal(t, api.NodeStatus_DOWN, storeNodes[0].Status.State) }) // check that node is deregistered resp, err := gd.Clients[0].Heartbeat(context.Background(), &api.HeartbeatRequest{SessionID: expectedSessionID}) assert.Nil(t, resp) assert.Error(t, err) assert.Equal(t, grpc.ErrorDesc(err), ErrNodeNotRegistered.Error()) }
explode_data.jsonl/13846
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 412 }
[ 2830, 3393, 45384, 22227, 7636, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 50286, 1669, 7899, 2648, 741, 50286, 13, 45384, 22227, 23750, 284, 220, 16, 15, 15, 353, 882, 71482, 198, 50286, 13, 45384, 22227, 36, 59892, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestApplierRun(t *testing.T) { bundle := testutil.NewTestBundle(t, "testdata/source_bundle") replicationController, err := bundle.SelectOne(document.NewSelector().ByKind("ReplicationController")) require.NoError(t, err) b, err := replicationController.AsYAML() require.NoError(t, err) f := k8stest.FakeFactory(t, []k8stest.ClientHandler{ &k8stest.InventoryObjectHandler{}, &k8stest.NamespaceHandler{}, &k8stest.GenericHandler{ Obj: &corev1.ReplicationController{}, Bytes: b, URLPath: "/namespaces/%s/replicationcontrollers", Namespace: replicationController.GetNamespace(), }, }) defer f.Cleanup() tests := []struct { name string driver applier.Driver expectErr bool expectedString string bundle document.Bundle poller poller.Poller }{ { name: "init-err", driver: applier.NewFakeAdaptor().WithInitError(fmt.Errorf("init-err")), expectedString: "init-err", bundle: bundle, expectErr: true, }, { name: "can't reach cluster", expectedString: "connection refused", expectErr: true, bundle: bundle, poller: &applier.FakePoller{}, }, { name: "bundle failure", expectedString: "nil bundle provided", expectErr: true, }, { name: "success", expectErr: false, bundle: bundle, driver: applier.NewFakeAdaptor().WithEvents(k8stest.SuccessEvents()), }, { name: "set poller", expectErr: false, bundle: bundle, driver: applier.NewFakeAdaptor().WithEvents(k8stest.SuccessEvents()), poller: &applier.FakePoller{}, }, { name: "two configmaps present", expectErr: true, bundle: newBundle("testdata/two_cm_bundle", t), driver: applier.NewFakeAdaptor().WithEvents(k8stest.SuccessEvents()), expectedString: "found more than one document", }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { // create default applier eventChan := make(chan events.Event) a := applier.NewApplier(eventChan, f, nil) opts := applier.ApplyOptions{ WaitTimeout: time.Second * 5, BundleName: "test-bundle", DryRunStrategy: common.DryRunClient, } if tt.driver != nil { a.Driver = tt.driver } if tt.poller != nil { a.Poller = tt.poller } // start writing to channel go func(bundle document.Bundle, applyOpts applier.ApplyOptions) { // since applier doesn't close channel anymore, we need to close it // after it applier is finished defer close(eventChan) a.ApplyBundle(bundle, applyOpts) }(tt.bundle, opts) var airEvents []events.Event for e := range eventChan { airEvents = append(airEvents, e) } var errs []error for _, e := range airEvents { if e.Type == events.ErrorType { errs = append(errs, e.ErrorEvent.Error) } else if e.Type == events.ApplierType && e.ApplierEvent.Type == event.ErrorType { errs = append(errs, e.ApplierEvent.ErrorEvent.Err) } } if tt.expectErr { t.Logf("errors are %v \n", errs) require.Len(t, errs, 1) require.NotNil(t, errs[0]) // check if error contains string assert.Contains(t, errs[0].Error(), tt.expectedString) } else { assert.Len(t, errs, 0) } }) } }
explode_data.jsonl/22135
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1552 }
[ 2830, 3393, 10611, 7875, 6727, 1155, 353, 8840, 836, 8, 341, 2233, 4206, 1669, 1273, 1314, 7121, 2271, 8409, 1155, 11, 330, 92425, 54373, 60986, 1138, 73731, 1693, 2051, 11, 1848, 1669, 12894, 14752, 3966, 15290, 7121, 5877, 1005, 1359, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetUserTermsOfService(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() _, _, err := th.Client.GetUserTermsOfService(th.BasicUser.Id, "") CheckErrorID(t, err, "app.user_terms_of_service.get_by_user.no_rows.app_error") termsOfService, appErr := th.App.CreateTermsOfService("terms of service", th.BasicUser.Id) require.Nil(t, appErr) _, err = th.Client.RegisterTermsOfServiceAction(th.BasicUser.Id, termsOfService.Id, true) require.NoError(t, err) userTermsOfService, _, err := th.Client.GetUserTermsOfService(th.BasicUser.Id, "") require.NoError(t, err) assert.Equal(t, th.BasicUser.Id, userTermsOfService.UserId) assert.Equal(t, termsOfService.Id, userTermsOfService.TermsOfServiceId) assert.NotEmpty(t, userTermsOfService.CreateAt) }
explode_data.jsonl/47558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 1949, 1474, 43128, 2124, 1860, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 197, 6878, 8358, 1848, 1669, 270, 11716, 78179, 43128, 2124, 1860, 24365, 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 TestServeFileContentType(t *testing.T) { defer afterTest(t) const ctype = "icecream/chocolate" ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { switch r.FormValue("override") { case "1": w.Header().Set("Content-Type", ctype) case "2": // Explicitly inhibit sniffing. w.Header()["Content-Type"] = []string{} } ServeFile(w, r, "testdata/file") })) defer ts.Close() get := func(override string, want []string) { resp, err := Get(ts.URL + "?override=" + override) if err != nil { t.Fatal(err) } if h := resp.Header["Content-Type"]; !reflect.DeepEqual(h, want) { t.Errorf("Content-Type mismatch: got %v, want %v", h, want) } resp.Body.Close() } get("0", []string{"text/plain; charset=utf-8"}) get("1", []string{ctype}) get("2", nil) }
explode_data.jsonl/48231
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 60421, 1703, 29504, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 340, 4777, 85507, 284, 330, 558, 46000, 21284, 13816, 698, 57441, 1669, 54320, 70334, 7121, 5475, 7, 3050, 9626, 18552, 3622, 5949, 6492, 11, 435, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestIssue2319(t *testing.T) { // Check to make sure we don't crash on startup when the target is // a binary with a mix of DWARF-5 C++ compilation units and // DWARF-4 Go compilation units. // Require CGO, since we need to use the external linker for this test. protest.MustHaveCgo(t) // The test fixture uses linux/amd64 assembly and a *.syso file // that is linux/amd64, so skip for other architectures. if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { t.Skipf("skipping since not linux/amd64") } // Skip unless on 1.14 or later. The test fixture uses a *.syso // file, which in 1.13 is not loaded unless we're in internal // linking mode (we need external linking here). if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { t.Skip("test contains fixture that is specific to go 1.14+") } fixture := protest.BuildFixture("issue2319/", protest.BuildModeExternalLinker) // Load up the binary and make sure there are no crashes. bi := proc.NewBinaryInfo("linux", "amd64") assertNoError(bi.LoadBinaryInfo(fixture.Path, 0, nil), t, "LoadBinaryInfo") }
explode_data.jsonl/56352
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 42006, 17, 18, 16, 24, 1155, 353, 8840, 836, 8, 341, 197, 322, 4248, 311, 1281, 2704, 582, 1513, 944, 9920, 389, 20567, 979, 279, 2169, 374, 198, 197, 322, 264, 7868, 448, 264, 6514, 315, 37752, 934, 37, 12, 20, 356, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGroup(t *testing.T) { m, err := types.NewFromInterface(map[string]interface{}{"id": 0, "bk_supplier_account": "bk_supplier_account"}) attr := &Group{} attr, err = attr.Parse(m) if str, _ := attr.ToMapStr().String("bk_supplier_account"); str != "bk_supplier_account" || err != nil { t.Fail() } }
explode_data.jsonl/15661
{ "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, 2808, 1155, 353, 8840, 836, 8, 341, 2109, 11, 1848, 1669, 4494, 7121, 3830, 5051, 9147, 14032, 31344, 6257, 4913, 307, 788, 220, 15, 11, 330, 40029, 75438, 13500, 788, 330, 40029, 75438, 13500, 23625, 60943, 1669, 609, 2808,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateListenerPort(t *testing.T) { forbiddenListenerPorts := map[int]bool{ 1234: true, } gcv := &GlobalConfigurationValidator{ forbiddenListenerPorts: forbiddenListenerPorts, } allErrs := gcv.validateListenerPort(5555, field.NewPath("port")) if len(allErrs) > 0 { t.Errorf("validateListenerPort() returned errors %v for valid input", allErrs) } allErrs = gcv.validateListenerPort(1234, field.NewPath("port")) if len(allErrs) == 0 { t.Errorf("validateListenerPort() returned no errors for invalid input") } }
explode_data.jsonl/11994
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 17926, 2743, 7084, 1155, 353, 8840, 836, 8, 341, 2023, 22108, 2743, 68273, 1669, 2415, 18640, 96436, 515, 197, 197, 16, 17, 18, 19, 25, 830, 345, 197, 630, 3174, 13122, 1669, 609, 11646, 7688, 14256, 515, 197, 2023, 22108,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequireSuitableIsSetCorrectly(t *testing.T) { thelmaBuilder := builder.NewBuilder().WithTestDefaults(t) app, err := thelmaBuilder.Build() require.NoError(t, err) state, err := app.State() require.NoError(t, err) devCluster, err := state.Clusters().Get("terra-dev") require.NoError(t, err) devEnv, err := state.Environments().Get("dev") require.NoError(t, err) prodCluster, err := state.Clusters().Get("terra-prod") require.NoError(t, err) prodEnv, err := state.Environments().Get("prod") require.NoError(t, err) assert.False(t, devCluster.RequireSuitable()) assert.False(t, devEnv.RequireSuitable()) assert.True(t, prodCluster.RequireSuitable()) assert.True(t, prodEnv.RequireSuitable()) }
explode_data.jsonl/79305
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 273 }
[ 2830, 3393, 17959, 62898, 480, 3872, 1649, 33092, 398, 1155, 353, 8840, 836, 8, 341, 70479, 301, 1728, 3297, 1669, 7363, 7121, 3297, 1005, 2354, 2271, 16273, 1155, 340, 28236, 11, 1848, 1669, 279, 75, 1728, 3297, 25212, 741, 17957, 3569...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestData(t *testing.T) { f := mbtest.NewReportingMetricSetV2Error(t, getConfig()) err := mbtest.WriteEventsReporterV2Error(f, t, ".") if err != nil { t.Fatal("write", err) } }
explode_data.jsonl/5597
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 93200, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 10016, 1944, 7121, 70131, 54310, 1649, 53, 17, 1454, 1155, 11, 66763, 2398, 9859, 1669, 10016, 1944, 4073, 7900, 52766, 53, 17, 1454, 955, 11, 259, 11, 5933, 1138, 743, 1848, 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 ]
2
func TestBebopValidatePitchWhenEqualOffset(t *testing.T) { gobottest.Assert(t, ValidatePitch(32767.0, 32767.0), 100) }
explode_data.jsonl/68980
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 50 }
[ 2830, 3393, 33, 3065, 453, 17926, 47071, 4498, 2993, 6446, 1155, 353, 8840, 836, 8, 341, 3174, 674, 1716, 477, 11711, 1155, 11, 23282, 47071, 7, 18, 17, 22, 21, 22, 13, 15, 11, 220, 18, 17, 22, 21, 22, 13, 15, 701, 220, 16, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestSubStr(t *testing.T) { type args struct { s string length int } tests := []struct { name string args args want string }{ { name: "123456789", args: args{ s: "123456789", length: 5, }, want: "12345", }, { name: "中文字符截断测试", args: args{ s: "中文字符截断测试", length: 5, }, want: "中文字符截", }, { name: "123中文测试", args: args{ s: "123中文测试", length: 5, }, want: "123中文", }, { name: "123中", args: args{ s: "123中", length: 5, }, want: "123中", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := SubStr(tt.args.s, tt.args.length); got != tt.want { t.Errorf("SubStr() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/74443
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 485 }
[ 2830, 3393, 3136, 2580, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 414, 914, 198, 197, 49046, 526, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 914, 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...
2
func TestInputService14ProtocolTestStringPayloadCase1(t *testing.T) { sess := session.New() svc := NewInputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService14TestShapeInputService14TestCaseOperation1Input{ Foo: aws.String("bar"), } req, _ := svc.InputService14TestCaseOperation1Request(input) r := req.HTTPRequest // build request restxml.Build(req) assert.NoError(t, req.Error) // assert body assert.NotNil(t, r.Body) body := util.SortXML(r.Body) assert.Equal(t, `bar`, util.Trim(string(body))) // assert URL awstesting.AssertURL(t, "https://test/", r.URL.String()) // assert headers }
explode_data.jsonl/46484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 2505, 1860, 16, 19, 20689, 2271, 703, 29683, 4207, 16, 1155, 353, 8840, 836, 8, 341, 1903, 433, 1669, 3797, 7121, 741, 1903, 7362, 1669, 1532, 2505, 1860, 16, 19, 20689, 2271, 57223, 11, 609, 8635, 10753, 90, 27380, 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 TestLoadOrgIDsFromCSVNonInt(t *testing.T) { nonIntIDCSV := `OrgID str 3 ` r := strings.NewReader(nonIntIDCSV) _, err := conf.LoadOrgIDsFromCSV(r) assert.EqualError(t, err, "organization ID on line 2 in CSV is not numerical. Found value: str") }
explode_data.jsonl/61903
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 5879, 42437, 30466, 3830, 44209, 8121, 1072, 1155, 353, 8840, 836, 8, 341, 197, 6280, 1072, 915, 44209, 1669, 1565, 42437, 915, 198, 495, 198, 18, 198, 3989, 7000, 1669, 9069, 68587, 29191, 1072, 915, 44209, 340, 197, 6878, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadProducesCompletePipeContents(t *testing.T) { t.Parallel() want := []byte("hello") p := script.Echo("hello") got, err := io.ReadAll(p) if err != nil { t.Fatal(err) } if !cmp.Equal(want, got) { t.Error(cmp.Diff(want, got)) } }
explode_data.jsonl/51535
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 4418, 49112, 12548, 34077, 14803, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50780, 1669, 3056, 3782, 445, 14990, 1138, 3223, 1669, 5316, 5142, 958, 445, 14990, 1138, 3174, 354, 11, 1848, 1669, 6399, 41851, 1295, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStepsOnExit(t *testing.T) { wf := unmarshalWF(stepsOnExit) cancel, controller := newController(wf) defer cancel() ctx := context.Background() woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) makePodsPhase(ctx, woc, apiv1.PodFailed) woc = newWorkflowOperationCtx(woc.wf, controller) woc.operate(ctx) onExitNodeIsPresent := false for _, node := range woc.wf.Status.Nodes { if strings.Contains(node.Name, "onExit") { onExitNodeIsPresent = true break } } assert.True(t, onExitNodeIsPresent) }
explode_data.jsonl/70993
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 33951, 1925, 15339, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 650, 27121, 32131, 84271, 1925, 15339, 340, 84441, 11, 6461, 1669, 501, 2051, 3622, 69, 340, 16867, 9121, 2822, 20985, 1669, 2266, 19047, 741, 6692, 509, 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...
3
func TestUnknownExitSignal(t *testing.T) { conn := dial(exitSignalUnknownHandler, t) defer conn.Close() session, err := conn.NewSession() if err != nil { t.Fatalf("Unable to request new session: %v", err) } defer session.Close() if err := session.Shell(); err != nil { t.Fatalf("Unable to execute command: %v", err) } err = session.Wait() if err == nil { t.Fatalf("expected command to fail but it didn't") } e, ok := err.(*ExitError) if !ok { t.Fatalf("expected *ExitError but got %T", err) } if e.Signal() != "SYS" || e.ExitStatus() != 128 { t.Fatalf("expected command to exit with signal SYS and status 128 but got signal %s and status %v", e.Signal(), e.ExitStatus()) } }
explode_data.jsonl/34800
{ "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, 13790, 15339, 26810, 1155, 353, 8840, 836, 8, 341, 32917, 1669, 27860, 88622, 26810, 13790, 3050, 11, 259, 340, 16867, 4534, 10421, 741, 25054, 11, 1848, 1669, 4534, 7121, 5283, 741, 743, 1848, 961, 2092, 341, 197, 3244, 307...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParse(t *testing.T) { var nginx NginxPlugin stub := `Active connections: 123 server accepts handled requests 1693613501 1693613501 7996986318 Reading: 66 Writing: 16 Waiting: 41 ` nginxStats := bytes.NewBufferString(stub) stat, err := nginx.parseStats(nginxStats) fmt.Println(stat) assert.Nil(t, err) assert.EqualValues(t, reflect.TypeOf(stat["writing"]).String(), "float64") assert.EqualValues(t, stat["writing"], 16) assert.EqualValues(t, reflect.TypeOf(stat["accepts"]).String(), "float64") assert.EqualValues(t, stat["accepts"], 1693613501) }
explode_data.jsonl/71308
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 14463, 1155, 353, 8840, 836, 8, 341, 2405, 70482, 451, 8163, 87, 11546, 198, 18388, 392, 1669, 1565, 5728, 13234, 25, 220, 16, 17, 18, 198, 4030, 26344, 17608, 7388, 198, 220, 16, 21, 24, 18, 21, 16, 18, 20, 15, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCorruptData(t *testing.T) { ctx := context.Background() t.Run("corrupt spans", func(t *testing.T) { tc := testcluster.StartTestCluster(t, 1, base.TestClusterArgs{}) defer tc.Stopper().Stop(ctx) s := tc.Server(0) pts := ptstorage.New(s.ClusterSettings(), s.InternalExecutor().(*sql.InternalExecutor)) rec := newRecord(s.Clock().Now(), "foo", []byte("bar"), tableSpan(42)) require.NoError(t, s.DB().Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { return pts.Protect(ctx, txn, &rec) })) ie := tc.Server(0).InternalExecutor().(sqlutil.InternalExecutor) affected, err := ie.ExecEx( ctx, "corrupt-data", nil, /* txn */ sqlbase.InternalExecutorSessionDataOverride{User: security.NodeUser}, "UPDATE system.protected_ts_records SET spans = $1 WHERE id = $2", []byte("junk"), rec.ID.String()) require.NoError(t, err) require.Equal(t, 1, affected) // Set the log scope so we can introspect the logged errors. scope := log.Scope(t) defer scope.Close(t) var got *ptpb.Record msg := regexp.MustCompile("failed to unmarshal spans for " + rec.ID.String() + ": ") require.Regexp(t, msg, s.DB().Txn(ctx, func(ctx context.Context, txn *kv.Txn) (err error) { got, err = pts.GetRecord(ctx, txn, rec.ID) return err }).Error()) require.Nil(t, got) require.NoError(t, s.DB().Txn(ctx, func(ctx context.Context, txn *kv.Txn) (err error) { _, err = pts.GetState(ctx, txn) return err })) log.Flush() entries, err := log.FetchEntriesFromFiles(0, math.MaxInt64, 100, msg) require.NoError(t, err) require.Len(t, entries, 1) for _, e := range entries { require.Equal(t, log.Severity_ERROR, e.Severity) } }) t.Run("corrupt hlc timestamp", func(t *testing.T) { tc := testcluster.StartTestCluster(t, 1, base.TestClusterArgs{}) defer tc.Stopper().Stop(ctx) s := tc.Server(0) pts := ptstorage.New(s.ClusterSettings(), s.InternalExecutor().(*sql.InternalExecutor)) rec := newRecord(s.Clock().Now(), "foo", []byte("bar"), tableSpan(42)) require.NoError(t, s.DB().Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { return pts.Protect(ctx, txn, &rec) })) // This timestamp has too many logical digits and thus will fail parsing. var d tree.DDecimal d.SetFinite(math.MaxInt32, -12) ie := tc.Server(0).InternalExecutor().(sqlutil.InternalExecutor) affected, err := ie.ExecEx( ctx, "corrupt-data", nil, /* txn */ sqlbase.InternalExecutorSessionDataOverride{User: security.NodeUser}, "UPDATE system.protected_ts_records SET ts = $1 WHERE id = $2", d.String(), rec.ID.String()) require.NoError(t, err) require.Equal(t, 1, affected) // Set the log scope so we can introspect the logged errors. scope := log.Scope(t) defer scope.Close(t) var got *ptpb.Record msg := regexp.MustCompile("failed to parse timestamp for " + rec.ID.String() + ": logical part has too many digits") require.Regexp(t, msg, s.DB().Txn(ctx, func(ctx context.Context, txn *kv.Txn) (err error) { got, err = pts.GetRecord(ctx, txn, rec.ID) return err })) require.Nil(t, got) require.NoError(t, s.DB().Txn(ctx, func(ctx context.Context, txn *kv.Txn) (err error) { _, err = pts.GetState(ctx, txn) return err })) log.Flush() entries, err := log.FetchEntriesFromFiles(0, math.MaxInt64, 100, msg) require.NoError(t, err) require.Len(t, entries, 1) for _, e := range entries { require.Equal(t, log.Severity_ERROR, e.Severity) } }) }
explode_data.jsonl/49445
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1442 }
[ 2830, 3393, 10580, 6585, 1043, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 3244, 16708, 445, 6005, 6585, 44295, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 78255, 1669, 1273, 18855, 12101, 2271, 28678, 1155, 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 TestValidateFrom_Success(t *testing.T) { tests := []struct { name string tasks []PipelineTask }{{ name: "valid pipeline task - from resource referring to valid output resource of the pipeline task", tasks: []PipelineTask{{ Name: "bar", TaskRef: &TaskRef{Name: "bar-task"}, Resources: &PipelineTaskResources{ Inputs: []PipelineTaskInputResource{{ Name: "some-resource", Resource: "some-resource", }}, Outputs: []PipelineTaskOutputResource{{ Name: "output-resource", Resource: "output-resource", }}, }, }, { Name: "foo", TaskRef: &TaskRef{Name: "foo-task"}, Resources: &PipelineTaskResources{ Inputs: []PipelineTaskInputResource{{ Name: "wow-image", Resource: "output-resource", From: []string{"bar"}, }}, }, }}, }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := validateFrom(tt.tasks) if err != nil { t.Errorf("Pipeline.validateFrom() returned error: %v", err) } }) } }
explode_data.jsonl/26527
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 17926, 3830, 87161, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 3244, 4604, 3056, 34656, 6262, 198, 197, 15170, 515, 197, 11609, 25, 330, 1891, 15301, 3383, 481, 504, 5101, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStepback(t *testing.T) { assert := assert.New(t) require.NoError(t, db.ClearCollections(task.Collection, task.OldCollection, build.Collection, VersionCollection), "Error clearing task and build collections") b1 := &build.Build{ Id: "build1", Status: evergreen.BuildStarted, Version: "v1", Requester: evergreen.RepotrackerVersionRequester, } b2 := &build.Build{ Id: "build2", Status: evergreen.BuildStarted, Version: "v2", Requester: evergreen.RepotrackerVersionRequester, } b3 := &build.Build{ Id: "build3", Status: evergreen.BuildStarted, Version: "v3", Requester: evergreen.RepotrackerVersionRequester, } t1 := &task.Task{ Id: "t1", DistroId: "test", DisplayName: "task", Activated: true, BuildId: b1.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskSucceeded, RevisionOrderNumber: 1, Requester: evergreen.RepotrackerVersionRequester, } t2 := &task.Task{ Id: "t2", DistroId: "test", DisplayName: "task", Activated: false, BuildId: b2.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskInactive, RevisionOrderNumber: 2, Requester: evergreen.RepotrackerVersionRequester, } t3 := &task.Task{ Id: "t3", DistroId: "test", DisplayName: "task", Activated: true, BuildId: b2.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskFailed, RevisionOrderNumber: 3, Requester: evergreen.RepotrackerVersionRequester, } dt1 := &task.Task{ Id: "dt1", DistroId: "test", DisplayName: "displayTask", Activated: true, BuildId: b1.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskSucceeded, RevisionOrderNumber: 1, DisplayOnly: true, ExecutionTasks: []string{"et1"}, Requester: evergreen.RepotrackerVersionRequester, } dt2 := &task.Task{ Id: "dt2", DistroId: "test", DisplayName: "displayTask", Activated: false, BuildId: b2.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskInactive, RevisionOrderNumber: 2, DisplayOnly: true, ExecutionTasks: []string{"et2"}, Requester: evergreen.RepotrackerVersionRequester, } dt3 := &task.Task{ Id: "dt3", DistroId: "test", DisplayName: "displayTask", Activated: true, BuildId: b2.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskFailed, RevisionOrderNumber: 3, DisplayOnly: true, ExecutionTasks: []string{"et3"}, Requester: evergreen.RepotrackerVersionRequester, } et1 := &task.Task{ Id: "et1", DistroId: "test", DisplayName: "execTask", Activated: true, BuildId: b1.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskSucceeded, RevisionOrderNumber: 1, Requester: evergreen.RepotrackerVersionRequester, } et2 := &task.Task{ Id: "et2", DistroId: "test", DisplayName: "execTask", Activated: false, BuildId: b2.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskInactive, RevisionOrderNumber: 2, Requester: evergreen.RepotrackerVersionRequester, } et3 := &task.Task{ Id: "et3", DistroId: "test", DisplayName: "execTask", Activated: true, BuildId: b3.Id, Execution: 1, Project: "sample", StartTime: time.Date(2017, time.June, 12, 12, 0, 0, 0, time.Local), Status: evergreen.TaskFailed, RevisionOrderNumber: 1, Requester: evergreen.RepotrackerVersionRequester, } b1.Tasks = []build.TaskCache{ { Id: t1.Id, }, { Id: dt1.Id, }, } b2.Tasks = []build.TaskCache{ { Id: t2.Id, }, { Id: dt2.Id, }, } b3.Tasks = []build.TaskCache{ { Id: t3.Id, }, { Id: dt3.Id, }, } assert.NoError(b1.Insert()) assert.NoError(b2.Insert()) assert.NoError(b3.Insert()) assert.NoError(t1.Insert()) assert.NoError(t2.Insert()) assert.NoError(t3.Insert()) assert.NoError(et1.Insert()) assert.NoError(et2.Insert()) assert.NoError(et3.Insert()) assert.NoError(dt1.Insert()) assert.NoError(dt2.Insert()) assert.NoError(dt3.Insert()) // test stepping back a regular task assert.NoError(doStepback(t3)) dbTask, err := task.FindOne(task.ById(t2.Id)) assert.NoError(err) assert.True(dbTask.Activated) // test stepping back a display task assert.NoError(doStepback(dt3)) dbTask, err = task.FindOne(task.ById(dt2.Id)) assert.NoError(err) assert.True(dbTask.Activated) dbTask, err = task.FindOne(task.ById(dt2.Id)) assert.NoError(err) assert.True(dbTask.Activated) }
explode_data.jsonl/60440
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3205 }
[ 2830, 3393, 8304, 1419, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 17957, 35699, 1155, 11, 2927, 13524, 52730, 17483, 28629, 11, 3383, 8382, 507, 6482, 11, 1936, 28629, 11, 6079, 6482, 1326, 197, 197, 1, 1454, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSendPasswordReset(t *testing.T) { th := Setup().InitBasic() Client := th.BasicClient team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN} team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team) user := &model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", Password: "passwd1"} user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User) LinkUserToTeam(user, team) store.Must(app.Srv.Store.User().VerifyEmail(user.Id)) Client.Logout() if result, err := Client.SendPasswordReset(user.Email); err != nil { t.Fatal(err) } else { resp := result.Data.(map[string]string) if resp["email"] != user.Email { t.Fatal("wrong email") } } if _, err := Client.SendPasswordReset("junk@junk.com"); err != nil { t.Fatal("Should have errored - bad email") } if _, err := Client.SendPasswordReset(""); err == nil { t.Fatal("Should have errored - no email") } authData := model.NewId() user2 := &model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", AuthData: &authData, AuthService: "random"} user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User) LinkUserToTeam(user2, team) store.Must(app.Srv.Store.User().VerifyEmail(user2.Id)) if _, err := Client.SendPasswordReset(user2.Email); err == nil { t.Fatal("should have errored - SSO user can't send reset password link") } }
explode_data.jsonl/13817
{ "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, 11505, 4876, 14828, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 71724, 1669, 270, 48868, 2959, 271, 197, 9196, 1669, 609, 2528, 65842, 90, 26456, 25, 330, 675, 497, 3988, 25, 330, 89, 9141, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddIndexer(t *testing.T) { AddIndexer(mock.TVIndexer{}) if len(indexersCollection) != 1 { t.Error("Indexer not added to list of indexers") } }
explode_data.jsonl/81815
{ "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, 2212, 1552, 261, 1155, 353, 8840, 836, 8, 341, 37972, 1552, 261, 30389, 836, 53, 1552, 261, 37790, 743, 2422, 7195, 388, 6482, 8, 961, 220, 16, 341, 197, 3244, 6141, 445, 1552, 261, 537, 3694, 311, 1140, 315, 1922, 388, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLd_All(t *testing.T) { type fields struct { request request } tests := []struct { name string fields fields want []*lead wantErr bool }{ {"error", fields{request{}}, nil, true}, } for _, tt := range tests { if tt.name == "error" { OpenConnection("error", "error", "error") } t.Run(tt.name, func(t *testing.T) { l := Ld{ request: tt.fields.request, } got, err := l.All() if (err != nil) != tt.wantErr { t.Errorf("Ld.All() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("Ld.All() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/15590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 319 }
[ 2830, 3393, 43, 67, 53629, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 23555, 1681, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 55276, 220, 5043, 198, 197, 50780, 262, 29838, 26060, 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...
3
func TestKeyringKeybaseExportImportPrivKey(t *testing.T) { kb, err := New("keybasename", "test", t.TempDir(), nil) require.NoError(t, err) _, _, err = kb.NewMnemonic("john", English, sdk.FullFundraiserPath, hd.Secp256k1) require.NoError(t, err) keystr, err := kb.ExportPrivKeyArmor("john", "somepassword") require.NoError(t, err) require.NotEmpty(t, keystr) err = kb.Delete("john") require.NoError(t, err) // try import the key - wrong password err = kb.ImportPrivKey("john2", keystr, "bad pass") require.Equal(t, "failed to decrypt private key: ciphertext decryption failed", err.Error()) // try import the key with the correct password require.NoError(t, kb.ImportPrivKey("john2", keystr, "somepassword")) // overwrite is not allowed err = kb.ImportPrivKey("john2", keystr, "password") require.Equal(t, "cannot overwrite key: john2", err.Error()) // try export non existing key _, err = kb.ExportPrivKeyArmor("john3", "wrongpassword") require.Equal(t, "The specified item could not be found in the keyring", err.Error()) }
explode_data.jsonl/73440
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 1592, 12640, 1592, 3152, 16894, 11511, 32124, 1592, 1155, 353, 8840, 836, 8, 341, 16463, 65, 11, 1848, 1669, 1532, 445, 792, 42953, 497, 330, 1944, 497, 259, 65009, 6184, 1507, 2092, 340, 17957, 35699, 1155, 11, 1848, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnAuthenticate(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionAuth(t) defer rollback() c.UnAuthenticate() if c.Authenticated() { t.Fatal("Shouldn't be authenticated") } // Test re-authenticate err := c.Authenticate(ctx) if err != nil { t.Fatal("ReAuth failed", err) } if !c.Authenticated() { t.Fatal("Not authenticated") } }
explode_data.jsonl/12740
{ "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, 1806, 99087, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 5087, 1155, 340, 16867, 60414, 741, 1444, 10616, 99087, 741, 743, 272, 25233, 17942, 368, 341, 197, 3244, 26133, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDWZCompression(t *testing.T) { // If dwz is not available in the system, skip this test if _, err := exec.LookPath("dwz"); err != nil { t.Skip("dwz not installed") } withTestProcessArgs("dwzcompression", t, ".", []string{}, protest.EnableDWZCompression, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "C.fortytwo") assertNoError(p.Continue(), t, "first Continue()") val := evalVariable(p, t, "stdin") if val.RealType == nil { t.Errorf("Can't find type for \"stdin\" global variable") } }) }
explode_data.jsonl/56316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 54219, 57, 81411, 1155, 353, 8840, 836, 8, 341, 197, 322, 1416, 13835, 89, 374, 537, 2500, 304, 279, 1849, 11, 10706, 419, 1273, 198, 743, 8358, 1848, 1669, 3883, 36851, 1820, 445, 29406, 89, 5038, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimpleReceive(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.CreateConnected(context.TestInitialSequenceNumber, 30000, -1 /* epRcvBuf */) we, ch := waiter.NewChannelEntry(nil) c.WQ.EventRegister(&we, waiter.ReadableEvents) defer c.WQ.EventUnregister(&we) ept := endpointTester{c.EP} data := []byte{1, 2, 3} iss := seqnum.Value(context.TestInitialSequenceNumber).Add(1) c.SendPacket(data, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: iss, AckNum: c.IRS.Add(1), RcvWnd: 30000, }) // Wait for receive to be notified. select { case <-ch: case <-time.After(1 * time.Second): t.Fatalf("Timed out waiting for data to arrive") } // Receive data. v := ept.CheckRead(t) if !bytes.Equal(data, v) { t.Fatalf("got data = %v, want = %v", v, data) } // Check that ACK is received. checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.TCPSeqNum(uint32(c.IRS)+1), checker.TCPAckNum(uint32(iss)+uint32(len(data))), checker.TCPFlags(header.TCPFlagAck), ), ) }
explode_data.jsonl/75932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 494 }
[ 2830, 3393, 16374, 14742, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 1444, 7251, 21146, 5378, 8787, 6341, 14076, 2833, 11, 220, 18, 15, 15, 15, 15, 11, 481, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestV1SetKeyCASOnValueFail(t *testing.T) { tests.RunServer(func(s *server.Server) { v := url.Values{} v.Set("value", "XXX") fullURL := fmt.Sprintf("%s%s", s.URL(), "/v1/keys/foo/bar") resp, _ := tests.PutForm(fullURL, v) assert.Equal(t, resp.StatusCode, http.StatusOK) tests.ReadBody(resp) v.Set("value", "YYY") v.Set("prevValue", "AAA") resp, _ = tests.PutForm(fullURL, v) assert.Equal(t, resp.StatusCode, http.StatusPreconditionFailed) body := tests.ReadBodyJSON(resp) assert.Equal(t, body["errorCode"], 101, "") assert.Equal(t, body["message"], "Compare failed", "") assert.Equal(t, body["cause"], "[AAA != XXX]", "") assert.Equal(t, body["index"], 3, "") }) }
explode_data.jsonl/24840
{ "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, 53, 16, 1649, 1592, 87516, 1925, 1130, 19524, 1155, 353, 8840, 836, 8, 341, 78216, 16708, 5475, 18552, 1141, 353, 4030, 22997, 8, 341, 197, 5195, 1669, 2515, 35145, 16094, 197, 5195, 4202, 445, 957, 497, 330, 30100, 1138, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDataPath(t *testing.T) { os.Unsetenv(xdg.DataHomeEnvVar) os.Setenv("APPDATA", filepath.Join(homedir.HomeDir(), "foo")) expected := filepath.Join(homedir.HomeDir(), "foo", appName, testFile) if lazy.dataPath(testFile) != expected { t.Errorf("expected '%s', got '%s'", expected, lazy.dataPath(testFile)) } os.Setenv(xdg.DataHomeEnvVar, filepath.Join(homedir.HomeDir(), "xdg")) expected = filepath.Join(homedir.HomeDir(), "xdg", appName, testFile) if lazy.dataPath(testFile) != expected { t.Errorf("expected '%s', got '%s'", expected, lazy.dataPath(testFile)) } }
explode_data.jsonl/5284
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 93200, 1820, 1155, 353, 8840, 836, 8, 341, 25078, 10616, 746, 3160, 2075, 35138, 3336, 7623, 14359, 3962, 340, 25078, 4202, 3160, 445, 14707, 17777, 497, 26054, 22363, 3203, 24139, 404, 59965, 6184, 1507, 330, 7975, 28075, 42400, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestConfigMapNotControlledByUs(t *testing.T) { f := newFixture(t) startTime := metav1.Now() completionTime := metav1.Now() mpiJob := newMPIJob("test", int32Ptr(64), &startTime, &completionTime) f.setUpMPIJob(mpiJob) configMap := newConfigMap(mpiJob, 8, 8) configMap.OwnerReferences = nil f.setUpConfigMap(configMap) f.runExpectError(getKey(mpiJob, t), gpuResourceName) }
explode_data.jsonl/75010
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 2648, 2227, 2623, 3273, 832, 1359, 3558, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 21375, 1462, 1669, 77520, 16, 13244, 741, 32810, 14386, 1462, 1669, 77520, 16, 13244, 2822, 197, 39479, 12245, 1669, 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...
1
func TestRouterConfigureStream(t *testing.T) { expect := ttesting.NewExpect(t) TypeRegistry.Register(mockFormatter{}) mockConf := NewPluginConfig("", "core.mockPlugin") mockConf.Override("Router", "testBoundStream") mockConf.Override("Modulators", []interface{}{ "core.mockFormatter", }) mockConf.Override("TimeoutMs", 100) mockRouter := getMockRouter() reader := NewPluginConfigReader(&mockConf) err := reader.Configure(&mockRouter) expect.Equal(nil, err) }
explode_data.jsonl/25576
{ "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, 9523, 28560, 3027, 1155, 353, 8840, 836, 8, 341, 24952, 1669, 259, 8840, 7121, 17536, 1155, 340, 27725, 15603, 19983, 30389, 14183, 6257, 692, 77333, 15578, 1669, 1532, 11546, 2648, 19814, 330, 2153, 15068, 11546, 1138, 77333, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestToBoolE(t *testing.T) { type args struct { s string } tests := []struct { name string args args want bool wantErr bool }{ { name: "", args: args{ s: "true", }, want: true, wantErr: false, }, { name: "", args: args{ s: "21a", }, want: false, wantErr: true, }, { name: "", args: args{ s: "", }, want: false, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := ToBoolE(tt.args.s) if (err != nil) != tt.wantErr { t.Errorf("ToBoolE() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("ToBoolE() got = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/5484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 423 }
[ 2830, 3393, 1249, 11233, 36, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 50780, 262, 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...
3
func TestEmptyBody(t *testing.T) { // Verify that a zero-length body is nil after logging. // That will ensure that net/http sends a "Content-Length: 0" header. req := &http.Request{ Method: "POST", URL: &url.URL{ Scheme: "https", Host: "example.com", Path: "a/b/c", }, Body: ioutil.NopCloser(strings.NewReader("")), } l := newLogger() _, remove, err := martian.TestContext(req, nil, nil) if err != nil { t.Fatal(err) } defer remove() if err := l.ModifyRequest(req); err != nil { t.Fatal(err) } if req.Body != nil { t.Error("got non-nil req.Body, want nil") } }
explode_data.jsonl/27766
{ "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, 3522, 5444, 1155, 353, 8840, 836, 8, 341, 197, 322, 25429, 429, 264, 7168, 29325, 2487, 374, 2092, 1283, 8392, 624, 197, 322, 2938, 686, 5978, 429, 4179, 15627, 21308, 264, 330, 2762, 52493, 25, 220, 15, 1, 4247, 624, 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...
4
func TestSaveUnknown(t *testing.T) { repo := postgres.NewConfigRepository(db, testLog) cases := []struct { desc string externalID string externalKey string err error }{ { desc: "save unknown", externalID: uuid.NewV4().String(), externalKey: uuid.NewV4().String(), err: nil, }, { desc: "save invalid unknown", externalID: uuid.NewV4().String(), externalKey: "", err: nil, }, } for _, tc := range cases { err := repo.SaveUnknown(tc.externalKey, tc.externalID) assert.Equal(t, tc.err, err, fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) } }
explode_data.jsonl/465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 301 }
[ 2830, 3393, 8784, 13790, 1155, 353, 8840, 836, 8, 341, 17200, 5368, 1669, 59826, 7121, 2648, 4624, 9791, 11, 1273, 2201, 692, 1444, 2264, 1669, 3056, 1235, 341, 197, 41653, 286, 914, 198, 197, 197, 20921, 915, 220, 914, 198, 197, 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 TestReadWriteAccessBytUserAndKey(t *testing.T) { clientCertTemDir := testutils.GenerateTestCrypto(t, []string{"admin", "alice", "bob", "eve", "server"}) testServer, _, _, err := SetupTestServerWithParams(t, clientCertTemDir, time.Second, 1, false, false) defer testServer.Stop() require.NoError(t, err) bcdb, adminSession, aliceSession := startServerConnectOpenAdminCreateUserAndUserSession(t, testServer, clientCertTemDir, "alice") pemUserCert, err := ioutil.ReadFile(path.Join(clientCertTemDir, "bob.pem")) dbPerm := map[string]types.Privilege_Access{ "bdb": 1, } require.NoError(t, err) addUser(t, "bob", adminSession, pemUserCert, dbPerm) pemUserCert, err = ioutil.ReadFile(path.Join(clientCertTemDir, "eve.pem")) require.NoError(t, err) addUser(t, "eve", adminSession, pemUserCert, dbPerm) bobSession := openUserSession(t, bcdb, "bob", clientCertTemDir) eveSession := openUserSession(t, bcdb, "eve", clientCertTemDir) // 20 blocks, 1 tx each, 10 keys for i := 0; i < 2; i++ { keys := make([]string, 0) values := make([]string, 0) for j := 0; j < 10; j++ { keys = append(keys, fmt.Sprintf("key%d", j)) values = append(values, fmt.Sprintf("value%d_%d", i, j)) } putMultipleKeysAndValidateMultipleUsers(t, keys, values, []string{"alice", "bob", "eve"}, aliceSession) } users := []string{"bob", "eve"} usersSession := []DBSession{bobSession, eveSession} usersReadKey := make([][]string, len(users)) usersWrittenKey := make([][]string, len(users)) usersTxReceipt := make([][]*types.TxReceipt, len(users)) for i := 0; i < 5; i++ { userIdx := i % (len(users)) readKey := fmt.Sprintf("key%d", i*2) writeKey := fmt.Sprintf("key%d", i*2+1) usersReadKey[userIdx] = append(usersReadKey[userIdx], readKey) usersWrittenKey[userIdx] = append(usersWrittenKey[userIdx], writeKey) usersTxReceipt[userIdx] = append(usersTxReceipt[userIdx], runUpdateTx(t, users[userIdx], usersSession[userIdx], readKey, writeKey)) } userTests := []struct { name string user string readKeys []string writtenKeys []string txReceipt []*types.TxReceipt wantErr bool }{ { name: "bob test, 3 reads, 3 writes", user: "bob", readKeys: usersReadKey[0], writtenKeys: usersWrittenKey[0], txReceipt: usersTxReceipt[0], wantErr: false, }, { name: "eve test, 2 reads, 2 writes", user: "eve", readKeys: usersReadKey[1], writtenKeys: usersWrittenKey[1], txReceipt: usersTxReceipt[1], wantErr: false, }, } for _, tt := range userTests { t.Run(tt.name, func(t *testing.T) { p, err := aliceSession.Provenance() require.NoError(t, err) keys := make([]string, 0) reads, err := p.GetDataReadByUser(tt.user) require.NoError(t, err) for _, k := range reads { keys = append(keys, k.GetKey()) } require.ElementsMatch(t, tt.readKeys, keys) keys = make([]string, 0) writes, err := p.GetDataWrittenByUser(tt.user) require.NoError(t, err) for _, k := range writes { keys = append(keys, k.GetKey()) } require.ElementsMatch(t, tt.writtenKeys, keys) }) } keyTests := []struct { name string key string readers []string writers []string wantErr bool }{ { name: "key0", key: "key0", readers: []string{"bob"}, writers: []string{"alice"}, }, { name: "key5", key: "key5", readers: nil, writers: []string{"alice", "bob"}, }, { name: "key6", key: "key6", readers: []string{"eve"}, writers: []string{"alice"}, }, { name: "key3", key: "key3", readers: nil, writers: []string{"alice", "eve"}, }, { name: "key11", key: "key11", readers: nil, writers: nil, }, } for _, tt := range keyTests { t.Run(tt.name, func(t *testing.T) { p, err := aliceSession.Provenance() require.NoError(t, err) readers, err := p.GetReaders("bdb", tt.key) require.NoError(t, err) require.ElementsMatch(t, tt.readers, readers) writers, err := p.GetWriters("bdb", tt.key) require.NoError(t, err) require.ElementsMatch(t, tt.writers, writers) }) } }
explode_data.jsonl/47197
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1860 }
[ 2830, 3393, 58610, 6054, 1359, 83, 1474, 3036, 1592, 1155, 353, 8840, 836, 8, 341, 25291, 36934, 21988, 6184, 1669, 1273, 6031, 57582, 2271, 58288, 1155, 11, 3056, 917, 4913, 2882, 497, 330, 63195, 497, 330, 47086, 497, 330, 82048, 497,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDeleteProduct(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, Path: "../../migrations", }) pool := migration.Setup(context.Background(), "") db := &DB{ Postgres: pool, } createProducts(t, db, []inventory.CreateProductParams{ { ID: "product", Name: "Product name", Description: "Product description", Price: 123, }, { ID: "do_not_erase", Name: "Do not erase", Price: 123, }, }) type args struct { ctx context.Context id string } tests := []struct { name string args args wantErr string }{ { name: "product", args: args{ ctx: context.Background(), id: "product", }, wantErr: "", }, // calling delete multiple times should not fail { name: "product_already_deleted", args: args{ ctx: context.Background(), id: "product", }, wantErr: "", }, // delete should be idempotent { name: "not_found", args: args{ ctx: context.Background(), id: "xyz", }, }, { name: "canceled_ctx", args: args{ ctx: canceledContext(), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ ctx: deadlineExceededContext(), }, wantErr: "context deadline exceeded", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := db.DeleteProduct(tt.args.ctx, tt.args.id) if err == nil && tt.wantErr != "" || err != nil && tt.wantErr != err.Error() { t.Errorf("DB.DeleteProduct() error = %v, wantErr %v", err, tt.wantErr) } if err != nil { return } got, err := db.GetProduct(context.Background(), tt.args.id) if err != nil { t.Errorf("DB.GetProduct() error = %v, wantErr %v", err, tt.wantErr) } if got != nil { t.Errorf("DB.GetProduct() returned %v, but should return nil", got) } }) } // Check if a limited number of rows were deleted by verifying one product ("do_not_erase") exists on the database. var total int if err := db.Postgres.QueryRow(context.Background(), `SELECT COUNT(*) as total FROM "product"`).Scan(&total); err != nil { t.Fatalf(`failed to query "product" table: %v`, err) } if total != 1 { t.Errorf("product table should have 1 row, but got %d", total) } }
explode_data.jsonl/25453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1011 }
[ 2830, 3393, 6435, 4816, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2109, 5033, 1669, 5704, 1944, 7121, 1155, 11, 5704, 1944, 22179, 515, 197, 197, 18573, 25, 353, 8833, 345, 197, 69640, 25, 220, 10208, 76, 17824, 756, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestGocloak_DecodeAccessTokenCustomClaims(t *testing.T) { t.Parallel() cfg := GetConfig(t) client := NewClientWithDebug(t) token := GetClientToken(t, client) claims := jwt.MapClaims{} resultToken, err := client.DecodeAccessTokenCustomClaims( token.AccessToken, cfg.GoCloak.Realm, claims) t.Log(resultToken) t.Log(claims) FailIfErr(t, err, "DecodeAccessTokenCustomClaims") }
explode_data.jsonl/79513
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 38, 509, 385, 585, 78668, 534, 37649, 10268, 51133, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50286, 1669, 2126, 2648, 1155, 340, 25291, 1669, 1532, 2959, 2354, 7939, 1155, 340, 43947, 1669, 2126, 2959, 3323, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLocalsInInclude(t *testing.T) { t.Parallel() cleanupTerraformFolder(t, TEST_FIXTURE_LOCALS_IN_INCLUDE) tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_LOCALS_IN_INCLUDE) childPath := filepath.Join(tmpEnvPath, TEST_FIXTURE_LOCALS_IN_INCLUDE, TEST_FIXTURE_LOCALS_IN_INCLUDE_CHILD_REL_PATH) runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve -no-color --terragrunt-non-interactive --terragrunt-working-dir %s", childPath)) // Check the outputs of the dir functions referenced in locals to make sure they return what is expected stdout := bytes.Buffer{} stderr := bytes.Buffer{} require.NoError( t, runTerragruntCommand(t, fmt.Sprintf("terragrunt output -no-color -json --terragrunt-non-interactive --terragrunt-working-dir %s", childPath), &stdout, &stderr), ) outputs := map[string]TerraformOutput{} require.NoError(t, json.Unmarshal([]byte(stdout.String()), &outputs)) assert.Equal( t, filepath.Join(tmpEnvPath, TEST_FIXTURE_LOCALS_IN_INCLUDE), outputs["parent_terragrunt_dir"].Value, ) assert.Equal( t, childPath, outputs["terragrunt_dir"].Value, ) assert.Equal( t, "apply", outputs["terraform_command"].Value, ) assert.Equal( t, "[\"apply\",\"-auto-approve\",\"-no-color\"]", outputs["terraform_cli_args"].Value, ) }
explode_data.jsonl/10113
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 541 }
[ 2830, 3393, 9152, 1127, 641, 22283, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1444, 60639, 51, 13886, 627, 13682, 1155, 11, 13602, 42635, 41486, 28399, 50, 2158, 48081, 340, 20082, 14359, 1820, 1669, 2975, 12723, 1155, 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 TestPersistenceLayer_Insert(t *testing.T) { tests := []struct { name string callArgs []string db *mockInsertEventDatabase expectError bool argsAssertions []assertion }{ { "account lookup error", []string{"user-id", "account-id", "payload"}, &mockInsertEventDatabase{ findAccountErr: errors.New("did not work"), }, true, []assertion{ func(accountID interface{}) error { if cast, ok := accountID.(FindAccountQueryActiveByID); ok { if cast != "account-id" { return fmt.Errorf("unexpected account identifier %v", cast) } } return nil }, }, }, { "user lookup error", []string{"user-id", "account-id", "payload"}, &mockInsertEventDatabase{ findAccountResult: Account{ Name: "test", UserSalt: "{1,} CaHVhk78uhoPmf5wanA0vg==", }, findSecretErr: errors.New("did not work"), }, true, []assertion{ func(accountID interface{}) error { if cast, ok := accountID.(FindAccountQueryActiveByID); ok { if cast != "account-id" { return fmt.Errorf("unexpected account identifier %v", cast) } } return nil }, func(userID interface{}) error { if cast, ok := userID.(FindSecretQueryBySecretID); ok { if cast == "user-id" || cast == "" { return fmt.Errorf("unexpected user identifier %v", cast) } } return nil }, }, }, { "insert error", []string{"user-id", "account-id", "payload"}, &mockInsertEventDatabase{ findAccountResult: Account{ Name: "test", UserSalt: "{1,} CaHVhk78uhoPmf5wanA0vg==", }, createEventErr: errors.New("did not work"), }, true, []assertion{ func(accountID interface{}) error { if cast, ok := accountID.(FindAccountQueryActiveByID); ok { if cast != "account-id" { return fmt.Errorf("unexpected account identifier %v", cast) } } return nil }, func(userID interface{}) error { if cast, ok := userID.(FindSecretQueryBySecretID); ok { if cast == "user-id" || cast == "" { return fmt.Errorf("unexpected user identifier %v", cast) } } return nil }, func(evt interface{}) error { if cast, ok := evt.(*Event); ok { wellformed := cast.Payload == "payload" && cast.AccountID == "account-id" && cast.EventID != "" && *cast.SecretID != "user-id" if !wellformed { return fmt.Errorf("unexpected event shape %v", cast) } } return nil }, }, }, { "ok", []string{"user-id", "account-id", "payload"}, &mockInsertEventDatabase{ findAccountResult: Account{ Name: "test", UserSalt: "{1,} CaHVhk78uhoPmf5wanA0vg==", }, }, false, []assertion{ func(accountID interface{}) error { if cast, ok := accountID.(FindAccountQueryActiveByID); ok { if cast != "account-id" { return fmt.Errorf("unexpected account identifier %v", cast) } } return nil }, func(userID interface{}) error { if cast, ok := userID.(FindSecretQueryBySecretID); ok { if cast == "user-id" || cast == "" { return fmt.Errorf("unexpected user identifier %v", cast) } } return nil }, func(evt interface{}) error { if cast, ok := evt.(*Event); ok { wellformed := cast.Payload == "payload" && cast.AccountID == "account-id" && cast.EventID != "" && *cast.SecretID != "user-id" if !wellformed { return fmt.Errorf("unexpected event shape %v", cast) } } return nil }, }, }, { "anonymous event ok", []string{"", "account-id", "payload"}, &mockInsertEventDatabase{ findAccountResult: Account{ Name: "test", UserSalt: "{1,} CaHVhk78uhoPmf5wanA0vg==", }, findSecretErr: errors.New("did not work"), }, false, []assertion{ func(accountID interface{}) error { if cast, ok := accountID.(FindAccountQueryActiveByID); ok { if cast != "account-id" { return fmt.Errorf("unexpected account identifier %v", cast) } } return nil }, func(evt interface{}) error { if cast, ok := evt.(*Event); ok { wellformed := cast.Payload == "payload" && cast.AccountID == "account-id" && cast.EventID != "" && cast.SecretID == nil if !wellformed { return fmt.Errorf("unexpected event shape %v", cast) } } return nil }, }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { r := &persistenceLayer{ dal: test.db, } err := r.Insert(test.callArgs[0], test.callArgs[1], test.callArgs[2], nil) if (err != nil) != test.expectError { t.Errorf("Unexpected error value %v", err) } if expected, found := len(test.argsAssertions), len(test.db.methodArgs); expected != found { t.Fatalf("Number of assertions did not match number of calls, got %d and expected %d", found, expected) } for i, a := range test.argsAssertions { if err := a(test.db.methodArgs[i]); err != nil { t.Errorf("Unexpected assertion error checking arguments: %v", err) } } }) } }
explode_data.jsonl/45973
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2416 }
[ 2830, 3393, 71562, 9188, 76417, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 67288, 4117, 981, 3056, 917, 198, 197, 20939, 1797, 353, 16712, 13780, 1556, 5988, 198, 197, 24952, 1454, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestS3MetaToOSSOptions(t *testing.T) { var err error var headers map[string]string headers = map[string]string{ "x-amz-meta-invalid_meta": "value", } _, err = appendS3MetaToOSSOptions(nil, headers) if err = errors.Cause(err); err != nil { if _, ok := err.(minio.UnsupportedMetadata); !ok { t.Fatalf("Test failed with unexpected error %s, expected UnsupportedMetadata", err) } } headers = map[string]string{ "accept-encoding": "gzip", // not this "content-encoding": "gzip", "X-Amz-Meta-Hdr": "value", "X-Amz-Meta-X-test-key": "value", "X-Amz-Meta-X--test--key": "value", "X-Amz-Meta-X-Amz-Key": "hu3ZSqtqwn+aL4V2VhAeov4i+bG3KyCtRMSXQFRHXOk=", "X-Amz-Meta-X-Amz-Matdesc": "{}", "X-Amz-Meta-X-Amz-Iv": "eWmyryl8kq+EVnnsE7jpOg==", } opts, err := appendS3MetaToOSSOptions(nil, headers) if err != nil { t.Fatalf("Test failed, with %s", err) } if len(opts) != len(headers) { t.Fatalf("Test failed, S3 metdata is not fully transformed. expeted: %d, actual: %d", len(headers)-1, len(opts)) } }
explode_data.jsonl/79132
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 513 }
[ 2830, 3393, 50, 18, 12175, 1249, 46, 1220, 3798, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 2405, 7102, 2415, 14032, 30953, 271, 67378, 284, 2415, 14032, 30953, 515, 197, 197, 65438, 32217, 89, 54017, 39740, 13381, 788, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestControl_httpReq_canRetry(t *testing.T) { validReq := &httpReq{ url: &url.URL{ Scheme: "http", Host: "testhost:1234", }, } for name, tc := range map[string]struct { req *httpReq inErr error cur uint expResult bool }{ "nil": {}, // do not crash "nil URL": { req: &httpReq{}, }, "generic error": { req: validReq, inErr: errors.New("something bad happened"), }, "retryable error": { req: validReq, inErr: HTTPReqTimedOut(validReq.url.String()), expResult: true, }, "max iterations": { req: validReq, cur: httpMaxRetries, inErr: HTTPReqTimedOut(validReq.url.String()), }, "greater than max iterations": { req: validReq, cur: httpMaxRetries + 1, inErr: HTTPReqTimedOut(validReq.url.String()), }, "just below max iterations": { req: validReq, cur: httpMaxRetries - 1, inErr: HTTPReqTimedOut(validReq.url.String()), expResult: true, }, } { t.Run(name, func(t *testing.T) { result := tc.req.canRetry(tc.inErr, tc.cur) common.AssertEqual(t, tc.expResult, result, "") }) } }
explode_data.jsonl/59296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 564 }
[ 2830, 3393, 3273, 25888, 27234, 27421, 51560, 1155, 353, 8840, 836, 8, 341, 56322, 27234, 1669, 609, 1254, 27234, 515, 197, 19320, 25, 609, 1085, 20893, 515, 298, 7568, 8058, 25, 330, 1254, 756, 298, 197, 9296, 25, 256, 330, 1944, 379...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTableNoHeaders(t *testing.T) { table := NewTableOutput() err := table.AddRow([]string{"value1", "value2", "value3"}) assert.Equal(t, ErrorOutputAddRowNoHeaders, err) }
explode_data.jsonl/59414
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 2556, 2753, 10574, 1155, 353, 8840, 836, 8, 341, 26481, 1669, 1532, 2556, 5097, 741, 9859, 1669, 1965, 1904, 3102, 10556, 917, 4913, 957, 16, 497, 330, 957, 17, 497, 330, 957, 18, 23625, 6948, 12808, 1155, 11, 4600, 5097, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIDAndClass(t *testing.T) { tmpl, err := ParseFile("testdir/test_id_and_class.slim") if err != nil { t.Fatal(err) } var buf bytes.Buffer err = tmpl.Execute(&buf, Values{ "title": "HELLO, RENDER", "text": "Hello, Render", }) if err != nil { t.Fatal(err) } expect := readFile(t, "testdir/test_id_and_class.html") got := buf.String() if expect != got { t.Fatalf("expected %v but %v", expect, got) } }
explode_data.jsonl/80445
{ "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, 915, 3036, 1957, 1155, 353, 8840, 836, 8, 341, 3244, 54010, 11, 1848, 1669, 14775, 1703, 445, 1944, 3741, 12697, 842, 8378, 4790, 74257, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 2405, 6607, 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...
4
func TestNewAddChannelToChannelGroupBuilder(t *testing.T) { assert := assert.New(t) o := newAddChannelToChannelGroupBuilder(pubnub) o.ChannelGroup("cg") o.Channels([]string{"ch1", "ch2", "ch3"}) path, err := o.opts.buildPath() assert.Nil(err) u := &url.URL{ Path: path, } h.AssertPathsEqual(t, fmt.Sprintf("/v1/channel-registration/sub-key/sub_key/channel-group/cg"), u.EscapedPath(), []int{}) query, err := o.opts.buildQuery() assert.Nil(err) expected := &url.Values{} expected.Set("add", "ch1,ch2,ch3") h.AssertQueriesEqual(t, expected, query, []string{"pnsdk", "uuid"}, []string{}) body, err := o.opts.buildBody() assert.Nil(err) assert.Equal([]byte{}, body) }
explode_data.jsonl/8263
{ "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, 3564, 2212, 9629, 1249, 9629, 2808, 3297, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 22229, 1669, 501, 2212, 9629, 1249, 9629, 2808, 3297, 74186, 77, 392, 340, 22229, 38716, 2808, 445, 27446, 1138, 2222...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAdd(t *testing.T) { r1 := NewResourceBuilder(). AddResource(constants.Memory, 1). AddResource(constants.CPU, 1). Build() r2 := NewResourceBuilder(). AddResource(constants.Memory, 2). AddResource(constants.CPU, 2). Build() r := Add(r1, r2) assert.Equal(t, len(r.Resources), 2) assert.Equal(t, r.Resources[constants.Memory].Value, int64(3)) assert.Equal(t, r.Resources[constants.CPU].Value, int64(3)) r1 = NewResourceBuilder(). AddResource(constants.Memory, 1). Build() r2 = NewResourceBuilder(). AddResource(constants.Memory, 2). AddResource(constants.CPU, 2). Build() r = Add(r1, r2) assert.Equal(t, len(r.Resources), 2) assert.Equal(t, r.Resources[constants.Memory].Value, int64(3)) assert.Equal(t, r.Resources[constants.CPU].Value, int64(2)) r1 = nil r2 = nil r = Add(r1, r2) assert.Equal(t, len(r.Resources), 0) r1 = NewResourceBuilder(). AddResource(constants.Memory, 1). Build() r2 = nil r = Add(r1, r2) assert.Equal(t, len(r.Resources), 1) assert.Equal(t, r.Resources[constants.Memory].Value, int64(1)) r1 = nil r2 = NewResourceBuilder(). AddResource(constants.Memory, 1). Build() r = Add(r1, r2) assert.Equal(t, len(r.Resources), 1) assert.Equal(t, r.Resources[constants.Memory].Value, int64(1)) r1 = NewResourceBuilder(). AddResource(constants.Memory, 1024). AddResource(constants.CPU, 20). AddResource("nvidia.com/gpu", 2). Build() r2 = NewResourceBuilder(). AddResource(constants.Memory, 2048). AddResource(constants.CPU, 30). AddResource("nvidia.com/gpu", 3). Build() r = Add(r1, r2) assert.Equal(t, len(r.Resources), 3) assert.Equal(t, r.Resources[constants.Memory].Value, int64(3072)) assert.Equal(t, r.Resources[constants.CPU].Value, int64(50)) assert.Equal(t, r.Resources["nvidia.com/gpu"].Value, int64(5)) }
explode_data.jsonl/63792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 751 }
[ 2830, 3393, 2212, 1155, 353, 8840, 836, 8, 341, 7000, 16, 1669, 1532, 4783, 3297, 25829, 197, 37972, 4783, 80368, 71162, 11, 220, 16, 4292, 197, 37972, 4783, 80368, 727, 6325, 11, 220, 16, 4292, 197, 197, 11066, 741, 7000, 17, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRpc_CreateToken(t *testing.T) { err := client.Connect() if err != nil { t.Fatalf("error %s", err.Error()) } ti := uint64(time.Now().Unix()) resp, err := client.Gc.GenerateTokenAddress(context.Background(), &GenerateTokenReq{ Network: "mainnet", Address: "FMejc9bjiTeQzKQG9fSDPGdsRzzEdEQe6se", Abbr: "ANBJ", }) fmt.Println(string(resp.Result)) token := string(resp.Result) resp, err = client.Gc.CreateToken(context.Background(), &TokenReq{ From: "FMejc9bjiTeQzKQG9fSDPGdsRzzEdEQe6se", Receiver: "FMegukTco2m1S9Y4ebXM9kVpQ6jqGGZBwWv", Token: token, Amount: 1000000000000, Fees: 1000000, Nonce: 4, Name: "12121", Abbr: "ANBJ", Increase: true, Timestamp: ti, }) fmt.Println(string(resp.Result)) var h *respHash err = json.Unmarshal(resp.Result, &h) if err != nil { t.Fatalf("error %s", err.Error()) } priv, err := secp256k1.ParseStringToPrivate("68d01d8fe1d512f9038040f0e1d3b26a599513a2e6595322aae07060afae698c") hash, err := arry.StringToHash(h.Header.Hash) if err != nil { t.Fatalf("error %s", err.Error()) } fmt.Println(hash.String()) si, err := types.Sign(priv, hash) if err != nil { t.Fatalf("error %s", err.Error()) } resp, err = client.Gc.SendToken(context.Background(), &TokenReq{ From: "FMejc9bjiTeQzKQG9fSDPGdsRzzEdEQe6se", Receiver: "FMegukTco2m1S9Y4ebXM9kVpQ6jqGGZBwWv", Token: token, Amount: 1000000000000, Fees: 1000000, Nonce: 4, Name: "12121", Abbr: "ANBJ", Increase: true, Timestamp: ti, Signature: si.SignatureString(), Publickey: si.PubKeyString(), }) fmt.Println(resp, err) }
explode_data.jsonl/35238
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 823 }
[ 2830, 3393, 60248, 34325, 3323, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 2943, 43851, 741, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 841, 1018, 82, 497, 1848, 6141, 2398, 197, 532, 72859, 1669, 2622, 21, 19, 9730, 13244, 1005...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMaterializerComplexVindexExpression(t *testing.T) { ms := &vtctldatapb.MaterializeSettings{ Workflow: "workflow", SourceKeyspace: "sourceks", TargetKeyspace: "targetks", TableSettings: []*vtctldatapb.TableMaterializeSettings{{ TargetTable: "t1", SourceExpression: "select a+b as c1 from t1", CreateDdl: "t1ddl", }}, } env := newTestMaterializerEnv(t, ms, []string{"0"}, []string{"-80", "80-"}) defer env.close() vs := &vschemapb.Keyspace{ Sharded: true, Vindexes: map[string]*vschemapb.Vindex{ "hash": { Type: "hash", }, }, Tables: map[string]*vschemapb.Table{ "t1": { ColumnVindexes: []*vschemapb.ColumnVindex{{ Column: "c1", Name: "hash", }}, }, }, } if err := env.topoServ.SaveVSchema(context.Background(), "targetks", vs); err != nil { t.Fatal(err) } env.tmc.expectVRQuery(200, mzSelectFrozenQuery, &sqltypes.Result{}) env.tmc.expectVRQuery(210, mzSelectFrozenQuery, &sqltypes.Result{}) err := env.wr.Materialize(context.Background(), ms) require.EqualError(t, err, "vindex column cannot be a complex expression: a + b as c1") }
explode_data.jsonl/61882
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 507 }
[ 2830, 3393, 13415, 3135, 31137, 53, 1252, 9595, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 609, 9708, 302, 507, 266, 391, 65, 44253, 551, 6086, 515, 197, 197, 62768, 25, 981, 330, 56249, 756, 197, 197, 3608, 8850, 1306, 25, 330, 242...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseOneDoc(t *testing.T) { fulltext := `--- time: '2016-02-17 06:34:59' last_modified: '2017-06-09 20:00:38' document: doco1 entry: entro1 --- This is some text ` docs, err := ParseScroll(fulltext) assert.Equal(t, nil, err) assert.Equal(t, "This is some text", docs[0].Text) assert.Equal(t, "doco1", docs[0].Front.Document) assert.Equal(t, "entro1", docs[0].Front.Entry) assert.Equal(t, "2016-02-17 06:34:59 +0000 UTC", docs[0].Front.Time.String()) assert.Equal(t, 1, docs.Len()) }
explode_data.jsonl/30235
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 14463, 3966, 9550, 1155, 353, 8840, 836, 8, 972, 94042, 1318, 1669, 1565, 4421, 4474, 1678, 25, 364, 17, 15, 16, 21, 12, 15, 17, 12, 16, 22, 220, 15, 21, 25, 18, 19, 25, 20, 24, 9739, 4259, 37749, 25, 364, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestVerifySimpleOneToManyInsert_FailMissingCity(t *testing.T) { log.Println("M$$$$$$$$$$$$$$$$$$$$$$$$$$") pers, addressTable, city, _, err := simpleOneToMany() if err != nil { t.Fatal(err) } err = pers.CreateTables(city, addressTable) if err != nil { t.Fatal(err) } cityRec2, err := makeCityRecord2(city) if err != nil { t.Fatal(err) } err = pers.save(cityRec2) if err != nil { t.Fatal(err) } addressRec1, err := makeAddressRecord1(addressTable, Address1PK) if err != nil { t.Fatal(err) } err = pers.save(addressRec1) if err == nil { t.Fatal(err) } else { // Should cause Forign Key constraint failure t.Log(err) } }
explode_data.jsonl/61919
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 32627, 16374, 57482, 13780, 1400, 604, 25080, 12730, 1155, 353, 8840, 836, 8, 341, 6725, 12419, 445, 44, 69502, 69502, 69502, 69502, 69502, 69502, 14085, 1138, 3223, 388, 11, 2621, 2556, 11, 3283, 11, 8358, 1848, 1669, 4285, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimpleFieldParamsOK(t *testing.T) { t.Parallel() resolver := newMockResolver() expectedParams := &LocalGetClassParams{ Kind: kind.ACTION_KIND, ClassName: "SomeAction", Properties: []SelectProperty{{Name: "intField", IsPrimitive: true}}, } resolver.On("LocalGetClass", expectedParams). Return(test_helper.EmptyListThunk(), nil).Once() resolver.AssertResolve(t, "{ Get { Actions { SomeAction { intField } } } }") }
explode_data.jsonl/10587
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 16374, 1877, 4870, 3925, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 10202, 7921, 1669, 501, 11571, 18190, 2822, 42400, 4870, 1669, 609, 7319, 1949, 1957, 4870, 515, 197, 197, 10629, 25, 981, 3093, 28934, 72959, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBreakpointConfusionOnResume(t *testing.T) { // Checks that SetCurrentBreakpoint, (*Thread).StepInstruction and // native.(*Thread).singleStep all agree on which breakpoint the thread is // stopped at. // This test checks for a regression introduced when fixing Issue #1656 skipUnlessOn(t, "amd64 only", "amd64") withTestProcess("nopbreakpoint/", t, func(p *proc.Target, fixture protest.Fixture) { maindots := filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.s")) maindotgo := filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.go")) setFileBreakpoint(p, t, maindots, 5) // line immediately after the NOP assertNoError(p.Continue(), t, "First Continue") assertLineNumber(p, t, 5, "not on main.s:5") setFileBreakpoint(p, t, maindots, 4) // sets a breakpoint on the NOP line, which will be one byte before the breakpoint we currently are stopped at. setFileBreakpoint(p, t, maindotgo, 18) // set one extra breakpoint so that we can recover execution and check the global variable g assertNoError(p.Continue(), t, "Second Continue") gvar := evalVariable(p, t, "g") if n, _ := constant.Int64Val(gvar.Value); n != 1 { t.Fatalf("wrong value of global variable 'g': %v (expected 1)", gvar.Value) } }) }
explode_data.jsonl/56337
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 22524, 2768, 15578, 7560, 1925, 28563, 1155, 353, 8840, 836, 8, 341, 197, 322, 24843, 429, 2573, 5405, 22524, 2768, 11, 4609, 6855, 568, 8304, 16664, 323, 198, 197, 322, 9867, 41399, 6855, 568, 15338, 8304, 678, 7503, 389, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHello(t *testing.T) { testenv.MustHaveGoBuild(t) dir := tmpDir(t) defer os.RemoveAll(dir) hello := filepath.Join(dir, "hello.go") prog := ` package main func main() { println("hello world") } ` err := ioutil.WriteFile(hello, []byte(prog), 0666) if err != nil { t.Fatal(err) } run := func(args ...string) string { return doRun(t, dir, args...) } goBin := testenv.GoToolPath(t) run(goBin, "build", "cmd/pack") // writes pack binary to dir run(goBin, "tool", "compile", "hello.go") run("./pack", "grc", "hello.a", "hello.o") run(goBin, "tool", "link", "-o", "a.out", "hello.a") out := run("./a.out") if out != "hello world\n" { t.Fatalf("incorrect output: %q, want %q", out, "hello world\n") } }
explode_data.jsonl/67506
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 325 }
[ 2830, 3393, 9707, 1155, 353, 8840, 836, 8, 341, 18185, 3160, 50463, 12116, 10850, 11066, 1155, 692, 48532, 1669, 4174, 6184, 1155, 340, 16867, 2643, 84427, 14161, 340, 9598, 4791, 1669, 26054, 22363, 14161, 11, 330, 14990, 18002, 1138, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestModes(t *testing.T) { testConvert(t, ` file_to_generate: "foo.proto" proto_file < name: "foo.proto" package: "example_package.nested" message_type < name: "FooProto" field < name: "i1" number: 1 type: TYPE_INT32 label: LABEL_OPTIONAL > field < name: "i2" number: 2 type: TYPE_INT32 label: LABEL_REQUIRED > field < name: "i3" number: 3 type: TYPE_INT32 label: LABEL_REPEATED > options < [gen_bq_schema.bigquery_opts] <table_name: "foo_table"> > > > `, map[string]string{ "example_package/nested/foo_table.schema": `[ { "name": "i1", "type": "INTEGER", "mode": "NULLABLE" }, { "name": "i2", "type": "INTEGER", "mode": "REQUIRED" }, { "name": "i3", "type": "INTEGER", "mode": "REPEATED" } ]`, }) }
explode_data.jsonl/41117
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 377 }
[ 2830, 3393, 70035, 1155, 353, 8840, 836, 8, 341, 18185, 12012, 1155, 11, 22074, 298, 17661, 2346, 48851, 25, 330, 7975, 57322, 698, 298, 197, 15110, 2458, 77565, 571, 11609, 25, 330, 7975, 57322, 698, 571, 197, 1722, 25, 330, 8687, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckCFCheckptSanity(t *testing.T) { t.Parallel() for _, testCase := range cfCheckptTestCases { t.Run(testCase.name, func(t *testing.T) { runCheckCFCheckptSanityTestCase(t, testCase) }) } }
explode_data.jsonl/43132
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 3973, 9650, 3973, 417, 23729, 487, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2023, 8358, 54452, 1669, 2088, 24111, 3973, 417, 2271, 37302, 341, 197, 3244, 16708, 8623, 4207, 2644, 11, 2915, 1155, 353, 8840, 836,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMode(t *testing.T) { for i, test := range []struct { x []float64 weights []float64 ans float64 count float64 }{ {}, { x: []float64{1, 6, 1, 9, -2}, ans: 1, count: 2, }, { x: []float64{1, 6, 1, 9, -2}, weights: []float64{1, 7, 3, 5, 0}, ans: 6, count: 7, }, } { m, count := Mode(test.x, test.weights) if test.ans != m { t.Errorf("Mode mismatch case %d. Expected %v, found %v", i, test.ans, m) } if test.count != count { t.Errorf("Mode count mismatch case %d. Expected %v, found %v", i, test.count, count) } } if !panics(func() { Mode(make([]float64, 3), make([]float64, 2)) }) { t.Errorf("Mode did not panic with x, weights length mismatch") } }
explode_data.jsonl/1776
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 367 }
[ 2830, 3393, 3636, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 1273, 1669, 2088, 3056, 1235, 341, 197, 10225, 981, 3056, 3649, 21, 19, 198, 197, 197, 13327, 3056, 3649, 21, 19, 198, 197, 43579, 257, 2224, 21, 19, 198, 197, 18032, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddIssueErr(t *testing.T) { p := domain.Project{ ID: 1, } i := &domain.Issue{ Title: "test-title", Description: "test-description", Status: 1, ProjectID: 1, } labels := map[string]domain.Label{ "test1": domain.Label{}, "test2": domain.Label{}, "test3": domain.Label{}, } cucm, iucm, lucm, pucm, m := prepareMocksAndRUC() pucm.On("FindByID", mock.AnythingOfType("uint")).Return(p, nil) lucm.On("FindByName", mock.AnythingOfType("string")).Return(domain.Label{}, nil) iucm.On("Add", i.Title, i.Description, i.Status, p, labels).Return(i, errors.New("test error")) body := strings.NewReader("projectId=1&title=test-title&description=test-description&status=1&labels=test1,test2,test3") c, _ := prepareHTTP(echo.POST, "/api/issues/new", body) err := m.AddIssue(c) assert.NotNil(t, err) assert.Equal(t, "test error", err.Error()) checkAssertions(t, cucm, iucm, lucm, pucm) }
explode_data.jsonl/60160
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 393 }
[ 2830, 3393, 2212, 42006, 7747, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 7947, 30944, 515, 197, 29580, 25, 220, 16, 345, 197, 532, 8230, 1669, 609, 12204, 2447, 83890, 515, 197, 92233, 25, 981, 330, 1944, 8816, 756, 197, 47414, 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 TestHandshakeClientX25519(t *testing.T) { config := testConfig.Clone() config.CurvePreferences = []CurveID{X25519} test := &clientTest{ name: "X25519-ECDHE-RSA-AES-GCM", command: []string{"openssl", "s_server", "-cipher", "ECDHE-RSA-AES128-GCM-SHA256"}, config: config, } runClientTestTLS12(t, test) }
explode_data.jsonl/71357
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 2314, 29661, 2959, 55, 17, 20, 20, 16, 24, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1273, 2648, 64463, 741, 25873, 727, 73047, 14306, 284, 3056, 31325, 915, 90, 55, 17, 20, 20, 16, 24, 630, 18185, 1669, 609, 2972, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNextState(t *testing.T) { t.Run("empty thread ID", func(t *testing.T) { svc, err := New(&protocol.MockProvider{ ServiceMap: map[string]interface{}{ mediator.Coordination: &mockroute.MockMediatorSvc{}, }, }) require.NoError(t, err) _, err = svc.nextState(RequestMsgType, "") require.EqualError(t, err, "unable to compute hash, empty bytes") }) t.Run("valid inputs", func(t *testing.T) { svc, err := New(&protocol.MockProvider{ ServiceMap: map[string]interface{}{ mediator.Coordination: &mockroute.MockMediatorSvc{}, }, }) require.NoError(t, err) s, errState := svc.nextState(RequestMsgType, generateRandomID()) require.NoError(t, errState) require.Equal(t, StateIDRequested, s.Name()) }) }
explode_data.jsonl/30539
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 307 }
[ 2830, 3393, 5847, 1397, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 3194, 4516, 3034, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1903, 7362, 11, 1848, 1669, 1532, 2099, 17014, 24664, 5179, 515, 298, 91619, 2227, 25, 2415, 14032...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFromCLIContext(t *testing.T) { runAppTest(t, []string{}, func(c *cli.Context) error { cfg := FromCLIContext(c) assert.NotNil(t, cfg) return nil }) }
explode_data.jsonl/6892
{ "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, 3830, 63959, 1972, 1155, 353, 8840, 836, 8, 341, 56742, 2164, 2271, 1155, 11, 3056, 917, 22655, 2915, 1337, 353, 19521, 9328, 8, 1465, 341, 197, 50286, 1669, 5542, 63959, 1972, 1337, 692, 197, 6948, 93882, 1155, 11, 13286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecodeYAMLStream(t *testing.T) { f := newFixture(t) defer f.TearDown() d := yamlStream d = fmt.Sprintf("observed = decode_yaml_stream('''%s''')\n", d) d += fmt.Sprintf("expected = %s\n", yamlStreamAsStarlark) tf := d + ` load('assert.tilt', 'assert') assert.equals(expected, observed) ` f.File("Tiltfile", tf) _, err := f.ExecFile("Tiltfile") if err != nil { fmt.Println(f.PrintOutput()) } require.NoError(t, err) }
explode_data.jsonl/10615
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 32564, 56, 31102, 3027, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 16867, 282, 836, 682, 4454, 2822, 2698, 1669, 32246, 3027, 198, 2698, 284, 8879, 17305, 445, 5481, 2771, 284, 16895, 64380, 12673, 8343...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetPhantom(t *testing.T) { for _, tc := range []struct { desc string ok bool rfErr error // MockReadFile error. wfErr error // MockWriteFile error. spiValue int // Current SPI value. num int enable bool value int // New SPI value. }{ // Supported states. "none" or "all" indicate that none or all four phantoms // are enabled on the given `agc` device. {"none 1 on", true, nil, nil, 0b00000000, 1, true, 0b00001000}, {"none 1 off", true, nil, nil, 0b00000000, 1, false, 0b00000000}, {"all 1 on", true, nil, nil, 0b00001111, 1, true, 0b00001111}, {"all 1 off", true, nil, nil, 0b00001111, 1, false, 0b00000111}, {"none 2 on", true, nil, nil, 0b00000000, 2, true, 0b00000100}, {"none 2 off", true, nil, nil, 0b00000000, 2, false, 0b00000000}, {"all 2 on", true, nil, nil, 0b00001111, 2, true, 0b00001111}, {"all 2 off", true, nil, nil, 0b00001111, 2, false, 0b00001011}, {"none 15 on", true, nil, nil, 0b00000000, 15, true, 0b00000010}, {"none 15 off", true, nil, nil, 0b00000000, 15, false, 0b00000000}, {"all 15 on", true, nil, nil, 0b00001111, 15, true, 0b00001111}, {"all 15 off", true, nil, nil, 0b00001111, 15, false, 0b00001101}, {"none 16 on", true, nil, nil, 0b00000000, 16, true, 0b00000001}, {"none 16 off", true, nil, nil, 0b00000000, 16, false, 0b00000000}, {"all 16 on", true, nil, nil, 0b00001111, 16, true, 0b00001111}, {"all 16 off", true, nil, nil, 0b00001111, 16, false, 0b00001110}, // Error states. A ReadFile error is included because the phantom value // must be read before it can be written. {desc: "readfile error", rfErr: fmt.Errorf("mock ReadFile error"), num: 1}, {desc: "writefile error", wfErr: fmt.Errorf("mock WriteFile error"), num: 1}, } { signal, err := newInput("TestSetPhantom", tc.num, 16) if err != nil { t.Fatalf("error setting up test; %s", err) } t.Run(fmt.Sprintf("SetPhantom() %s", tc.desc), func(t *testing.T) { helpers.ResetMockReadWrite() helpers.PrepareMockReadFile([]byte{}, tc.rfErr) helpers.PrepareMockWriteFile(tc.wfErr) signal.Phantom().spi.Write(tc.spiValue) // Calling setState() directly as [En|Dis]able are simple enough. err := signal.Phantom().setState(tc.enable) if err != nil && tc.ok { t.Fatalf("unexpected error %q", err) } if err == nil && !tc.ok { t.Fatalf("expected an error") } if !tc.ok { return } if got, want := signal.Phantom().spi.Value(), tc.value; got != want { t.Errorf("SPI Value() = %d, want %d", want, got) } }) } }
explode_data.jsonl/34847
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1054 }
[ 2830, 3393, 1649, 3357, 30002, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 41653, 257, 914, 198, 197, 59268, 981, 1807, 198, 197, 7000, 69, 7747, 262, 1465, 442, 14563, 4418, 1703, 1465, 624, 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...
7
func TestMempoolFilters(t *testing.T) { app := kvstore.NewApplication() cc := proxy.NewLocalClientCreator(app) mempool, cleanup := newMempoolWithApp(cc) defer cleanup() emptyTxArr := []types.Tx{[]byte{}} nopPreFilter := func(tx types.Tx) error { return nil } nopPostFilter := func(tx types.Tx, res *abci.ResponseCheckTx) error { return nil } // each table driven test creates numTxsToCreate txs with checkTx, and at the end clears all remaining txs. // each tx has 20 bytes tests := []struct { numTxsToCreate int preFilter PreCheckFunc postFilter PostCheckFunc expectedNumTxs int }{ {10, nopPreFilter, nopPostFilter, 10}, {10, PreCheckMaxBytes(10), nopPostFilter, 0}, {10, PreCheckMaxBytes(22), nopPostFilter, 10}, {10, nopPreFilter, PostCheckMaxGas(-1), 10}, {10, nopPreFilter, PostCheckMaxGas(0), 0}, {10, nopPreFilter, PostCheckMaxGas(1), 10}, {10, nopPreFilter, PostCheckMaxGas(3000), 10}, {10, PreCheckMaxBytes(10), PostCheckMaxGas(20), 0}, {10, PreCheckMaxBytes(30), PostCheckMaxGas(20), 10}, {10, PreCheckMaxBytes(22), PostCheckMaxGas(1), 10}, {10, PreCheckMaxBytes(22), PostCheckMaxGas(0), 0}, } for tcIndex, tt := range tests { err := mempool.Update(1, emptyTxArr, abciResponses(len(emptyTxArr), abci.CodeTypeOK), tt.preFilter, tt.postFilter) require.NoError(t, err) checkTxs(t, mempool, tt.numTxsToCreate, UnknownPeerID) require.Equal(t, tt.expectedNumTxs, mempool.Size(), "mempool had the incorrect size, on test case %d", tcIndex) mempool.Flush() } }
explode_data.jsonl/14609
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 596 }
[ 2830, 3393, 44, 3262, 1749, 28351, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 16178, 4314, 7121, 4988, 741, 63517, 1669, 13291, 7121, 7319, 2959, 31865, 11462, 340, 2109, 3262, 1749, 11, 21290, 1669, 501, 44, 3262, 1749, 2354, 2164, 314...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoundTrip(t *testing.T) { roundtrip.RoundTripTestForAPIGroup(t, Install, testapigroupfuzzer.Funcs) roundtrip.RoundTripProtobufTestForAPIGroup(t, Install, testapigroupfuzzer.Funcs) }
explode_data.jsonl/13362
{ "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, 27497, 56352, 1155, 353, 8840, 836, 8, 341, 197, 1049, 32981, 37646, 56352, 2271, 2461, 7082, 2808, 1155, 11, 19242, 11, 1273, 391, 74658, 69, 91447, 69845, 82, 340, 197, 1049, 32981, 37646, 56352, 12423, 18464, 2271, 2461, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLaunchMultipleContainersWithRemoteSnapshotter_Isolated(t *testing.T) { integtest.Prepare(t, integtest.WithDefaultNetwork()) testTimeout := 600 * time.Second ctx, cancel := context.WithTimeout(context.Background(), testTimeout) defer cancel() var wg sync.WaitGroup numberOfVms := integtest.NumberOfVms for vmID := 0; vmID < numberOfVms; vmID++ { wg.Add(1) go func(id int) { defer wg.Done() launchContainerWithRemoteSnapshotterInVM(ctx, t, strconv.Itoa(id)) }(vmID) } wg.Wait() }
explode_data.jsonl/42542
{ "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, 32067, 32089, 74632, 2354, 24703, 15009, 465, 31879, 80519, 1155, 353, 8840, 836, 8, 341, 2084, 791, 1944, 28770, 3380, 1155, 11, 5388, 1944, 26124, 3675, 12320, 12367, 18185, 7636, 1669, 220, 21, 15, 15, 353, 882, 32435, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFormatWithdrawPermissions(t *testing.T) { p.SetDefaults() expectedResult := exchange.AutoWithdrawCryptoWithAPIPermissionText + " & " + exchange.NoFiatWithdrawalsText withdrawPermissions := p.FormatWithdrawPermissions() if withdrawPermissions != expectedResult { t.Errorf("Expected: %s, Received: %s", expectedResult, withdrawPermissions) } }
explode_data.jsonl/23568
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 4061, 92261, 23851, 1155, 353, 8840, 836, 8, 341, 3223, 4202, 16273, 741, 42400, 2077, 1669, 9289, 6477, 92261, 58288, 2354, 7082, 14966, 1178, 488, 330, 609, 330, 488, 9289, 16766, 37, 10358, 92261, 1127, 1178, 271, 46948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrintServiceList(t *testing.T) { serviceList := api.ServiceList{ Items: []api.Service{ { ObjectMeta: metav1.ObjectMeta{Name: "service1"}, Spec: api.ServiceSpec{ Type: api.ServiceTypeClusterIP, Ports: []api.ServicePort{ { Protocol: "tcp", Port: 2233, }, }, ClusterIP: "10.9.8.7", }, }, { ObjectMeta: metav1.ObjectMeta{Name: "service2"}, Spec: api.ServiceSpec{ Type: api.ServiceTypeNodePort, Ports: []api.ServicePort{ { Protocol: "udp", Port: 5566, }, }, ClusterIP: "1.2.3.4", }, }, }, } // Columns: Name, Type, Cluster-IP, External-IP, Port(s), Age expectedRows := []metav1.TableRow{ {Cells: []interface{}{"service1", "ClusterIP", "10.9.8.7", "<none>", "2233/tcp", "<unknown>"}}, {Cells: []interface{}{"service2", "NodePort", "1.2.3.4", "<none>", "5566/udp", "<unknown>"}}, } rows, err := printServiceList(&serviceList, printers.GenerateOptions{}) if err != nil { t.Fatalf("Error printing service list: %#v", err) } for i := range rows { rows[i].Object.Object = nil } if !reflect.DeepEqual(expectedRows, rows) { t.Errorf("mismatch: %s", diff.ObjectReflectDiff(expectedRows, rows)) } }
explode_data.jsonl/21613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 598 }
[ 2830, 3393, 8994, 1860, 852, 1155, 353, 8840, 836, 8, 341, 52934, 852, 1669, 6330, 13860, 852, 515, 197, 197, 4353, 25, 3056, 2068, 13860, 515, 298, 197, 515, 571, 23816, 12175, 25, 77520, 16, 80222, 63121, 25, 330, 7936, 16, 7115, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue38267(t *testing.T) { const testPackage = ` -- go.mod -- module mod.com go 1.12 -- lib.go -- package lib func Hello(x string) { _ = x } -- lib_test.go -- package lib import "testing" type testStruct struct{ name string } func TestHello(t *testing.T) { testStructs := []*testStruct{ &testStruct{"hello"}, &testStruct{"goodbye"}, } for y := range testStructs { _ = y } } ` runner.Run(t, testPackage, func(t *testing.T, env *Env) { env.OpenFile("lib_test.go") env.Await( DiagnosticAt("lib_test.go", 10, 2), DiagnosticAt("lib_test.go", 11, 2), ) env.OpenFile("lib.go") env.RegexpReplace("lib.go", "_ = x", "var y int") env.Await( env.DiagnosticAtRegexp("lib.go", "y int"), EmptyDiagnostics("lib_test.go"), ) }) }
explode_data.jsonl/38909
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 42006, 18, 23, 17, 21, 22, 1155, 353, 8840, 836, 8, 341, 4777, 1273, 13100, 284, 22074, 313, 728, 10929, 39514, 4352, 1463, 905, 271, 3346, 220, 16, 13, 16, 17, 198, 313, 3051, 18002, 39514, 1722, 3051, 271, 2830, 21927,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOla(t *testing.T) { verificaMensagemCorreta := func(t testing.TB, resultado, esperado string) { t.Helper() if resultado != esperado { t.Errorf("resultado %q, esperado %q", resultado, esperado) } } t.Run("diz olá para as pessoas", func(t *testing.T) { resultado := Ola("Chris") esperado := "Olá, Chris" verificaMensagemCorreta(t, resultado, esperado) }) t.Run("'Mundo' como padrão para string vazia", func(t *testing.T) { resultado := Ola("") esperado := "Olá, Mundo" verificaMensagemCorreta(t, resultado, esperado) }) }
explode_data.jsonl/33809
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 46, 4260, 1155, 353, 8840, 836, 8, 341, 197, 423, 29488, 44, 67859, 10580, 65698, 1669, 2915, 1155, 7497, 836, 33, 11, 26192, 11, 30057, 2123, 914, 8, 341, 197, 3244, 69282, 741, 197, 743, 26192, 961, 30057, 2123, 341, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIPFSWithLazyPulling(t *testing.T) { requiresIPFS(t) testutil.DockerIncompatible(t) base := testutil.NewBase(t) requiresStargz(base) ipfsCID := pushImageToIPFS(t, base, testutil.AlpineImage, "--estargz") base.Env = append(os.Environ(), "CONTAINERD_SNAPSHOTTER=stargz") base.Cmd("pull", ipfsCID).AssertOK() base.Cmd("run", "--rm", ipfsCID, "ls", "/.stargz-snapshotter").AssertOK() }
explode_data.jsonl/28112
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 3298, 8485, 2354, 39766, 36068, 287, 1155, 353, 8840, 836, 8, 341, 197, 41375, 3298, 8485, 1155, 340, 18185, 1314, 909, 13659, 641, 34842, 1155, 340, 24195, 1669, 1273, 1314, 7121, 3978, 1155, 340, 197, 41375, 623, 858, 89, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStrArray_PopLefts(t *testing.T) { gtest.C(t, func(t *gtest.T) { array := garray.NewStrArrayFrom(g.SliceStr{"1", "2", "3"}) t.Assert(array.PopLefts(2), g.Slice{"1", "2"}) t.Assert(array.Len(), 1) t.Assert(array.PopLefts(2), g.Slice{"3"}) t.Assert(array.Len(), 0) }) }
explode_data.jsonl/53087
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 2580, 1857, 1088, 453, 5415, 82, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11923, 1669, 342, 1653, 7121, 2580, 1857, 3830, 3268, 95495, 2580, 4913, 16, 497, 330, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDLOAppend(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionWithDLO(t) defer rollback() opts := swift.LargeObjectOpts{ Container: CONTAINER, ObjectName: OBJECT, Flags: os.O_APPEND, CheckHash: true, ContentType: "image/jpeg", } out, err := c.DynamicLargeObjectCreateFile(ctx, &opts) if err != nil { t.Fatal(err) } contents, err := c.ObjectGetString(ctx, CONTAINER, OBJECT) if err != nil { t.Fatal(err) } buf := bytes.NewBuffer([]byte(contents)) multi := io.MultiWriter(buf, out) for i := 0; i < 2; i++ { _, err = fmt.Fprintf(multi, "%d %s\n", i+10, CONTENTS) if err != nil { t.Fatal(err) } } err = out.CloseWithContext(ctx) if err != nil { t.Error(err) } expected := buf.String() contents, err = c.ObjectGetString(ctx, CONTAINER, OBJECT) if err != nil { t.Error(err) } if contents != expected { t.Errorf("Contents wrong, expected %q, got: %q", expected, contents) } }
explode_data.jsonl/12722
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 414 }
[ 2830, 3393, 35, 1593, 23877, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 2354, 35, 1593, 1155, 340, 16867, 60414, 741, 64734, 1669, 29362, 92762, 1190, 43451, 515, 197, 197, 4502, 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...
8
func TestJobRunsController_Update_WithError(t *testing.T) { t.Parallel() ethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t) defer assertMocksCalled() app, cleanup := cltest.NewApplication(t, ethClient, ) defer cleanup() app.Start() client := app.NewHTTPClient() bta, bt := cltest.NewBridgeType(t) assert.Nil(t, app.Store.CreateBridgeType(bt)) j := cltest.NewJobWithWebInitiator() j.Tasks = []models.TaskSpec{{Type: bt.Name}} assert.Nil(t, app.Store.CreateJob(&j)) jr := cltest.NewJobRunPendingBridge(j) assert.Nil(t, app.Store.CreateJobRun(&jr)) body := fmt.Sprintf(`{"id":"%v","error":"stack overflow","data":{"result": "0"}}`, jr.ID.String()) headers := map[string]string{"Authorization": "Bearer " + bta.IncomingToken} resp, cleanup := client.Patch("/v2/runs/"+jr.ID.String(), bytes.NewBufferString(body), headers) defer cleanup() assert.Equal(t, http.StatusOK, resp.StatusCode, "Response should be successful") var respJobRun presenters.JobRun assert.NoError(t, cltest.ParseJSONAPIResponse(t, resp, &respJobRun)) assert.Equal(t, jr.ID, respJobRun.ID) jr = cltest.WaitForJobRunStatus(t, app.Store, jr, models.RunStatusErrored) value := cltest.MustResultString(t, jr.Result) assert.Equal(t, "0", value) }
explode_data.jsonl/49854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 487 }
[ 2830, 3393, 12245, 73920, 2051, 47393, 62, 66102, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 769, 2959, 11, 8358, 2060, 72577, 20960, 1669, 1185, 1944, 7121, 65390, 11571, 16056, 39076, 90206, 1155, 340, 16867, 2060, 72577...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1