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 TestReExportDefaultNoBundleCommonJS(t *testing.T) { default_suite.expectBundled(t, bundled{ files: map[string]string{ "/entry.js": ` export {default as foo} from './foo' export {default as bar} from './bar' `, }, entryPaths: []string{"/entry.js"}, options: config.Options{ Mode: config.ModeConvertFormat, OutputFormat: config.FormatCommonJS, AbsOutputFile: "/out.js", }, }) }
explode_data.jsonl/38554
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 693, 16894, 3675, 2753, 8409, 10839, 12545, 1155, 353, 8840, 836, 8, 341, 11940, 57239, 25952, 33, 1241, 832, 1155, 11, 51450, 515, 197, 74075, 25, 2415, 14032, 30953, 515, 298, 197, 3115, 4085, 2857, 788, 22074, 571, 59440,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProb051(t *testing.T) { if err := projecteuler.FuncForTesting("cGFzc3BocmFzZXdoBpSPc95ZPTzVF1KUZtTRXqys/6jVTg==", calc, 1000000); err != nil { t.Errorf(err.Error()) } }
explode_data.jsonl/46894
{ "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, 36980, 15, 20, 16, 1155, 353, 8840, 836, 8, 341, 743, 1848, 1669, 2390, 68, 8479, 69845, 2461, 16451, 445, 66, 36332, 34968, 18, 33, 509, 76, 37, 89, 80723, 2982, 33, 79, 4592, 66, 24, 20, 57, 2828, 89, 49063, 16, 42...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecryptWithIncorrectSize(t *testing.T) { priv, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { t.Error(err) return } dec := new(rsaDecrypterSigner) dec.privateKey = priv aes := newAESGCM(16) keygen := randomKeyGenerator{ size: aes.keySize(), } payload := make([]byte, 254) _, err = dec.decrypt(payload, RSA1_5, keygen) if err == nil { t.Error("Invalid payload size should return error") } payload = make([]byte, 257) _, err = dec.decrypt(payload, RSA1_5, keygen) if err == nil { t.Error("Invalid payload size should return error") } }
explode_data.jsonl/63204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 235 }
[ 2830, 3393, 89660, 2354, 40468, 1695, 1155, 353, 8840, 836, 8, 341, 71170, 11, 1848, 1669, 68570, 57582, 1592, 37595, 47431, 11, 220, 17, 15, 19, 23, 340, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 853, 198, 197, 63...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDetectImagesContainerStopped(t *testing.T) { manager, fakeRuntime, _ := newRealImageGCManager(ImageGCPolicy{}) fakeRuntime.ImageList = []container.Image{ makeImage(0, 1024), makeImage(1, 2048), } fakeRuntime.AllPodList = []*containertest.FakePod{ {Pod: &container.Pod{ Containers: []*container.Container{ makeContainer(1), }, }}, } err := manager.detectImages(zero) assert := assert.New(t) require.NoError(t, err) assert.Equal(manager.imageRecordsLen(), 2) withContainer, ok := manager.getImageRecord(imageID(1)) require.True(t, ok) // Simulate container being stopped. fakeRuntime.AllPodList = []*containertest.FakePod{} err = manager.detectImages(time.Now()) require.NoError(t, err) assert.Equal(manager.imageRecordsLen(), 2) container1, ok := manager.getImageRecord(imageID(0)) require.True(t, ok) assert.Equal(zero, container1.firstDetected) assert.Equal(zero, container1.lastUsed) container2, ok := manager.getImageRecord(imageID(1)) require.True(t, ok) assert.Equal(zero, container2.firstDetected) assert.True(container2.lastUsed.Equal(withContainer.lastUsed)) }
explode_data.jsonl/48106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 411 }
[ 2830, 3393, 57193, 14228, 4502, 59803, 1155, 353, 8840, 836, 8, 341, 92272, 11, 12418, 15123, 11, 716, 1669, 501, 12768, 1906, 22863, 2043, 30122, 38, 7123, 8018, 37790, 1166, 726, 15123, 7528, 852, 284, 3056, 3586, 7528, 515, 197, 7743...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetHTTPClient(t *testing.T) { client := getHTTPClient() baseurl, err := getBasePath() th.AssertNoErr(t, err) resp, err := client.Get(baseurl) th.AssertNoErr(t, err) th.AssertEquals(t, resp.StatusCode, 200) }
explode_data.jsonl/23277
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 1949, 9230, 2959, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 633, 9230, 2959, 741, 24195, 1085, 11, 1848, 1669, 633, 3978, 1820, 741, 70479, 11711, 2753, 7747, 1155, 11, 1848, 340, 34653, 11, 1848, 1669, 2943, 2234, 12663, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMetricDescriptor_CopyTo(t *testing.T) { ms := NewMetricDescriptor() NewMetricDescriptor().CopyTo(ms) assert.True(t, ms.IsNil()) generateTestMetricDescriptor().CopyTo(ms) assert.EqualValues(t, generateTestMetricDescriptor(), ms) }
explode_data.jsonl/19517
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 54310, 11709, 77637, 1249, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 54310, 11709, 741, 197, 3564, 54310, 11709, 1005, 12106, 1249, 35680, 340, 6948, 32443, 1155, 11, 9829, 4506, 19064, 2398, 3174, 13220, 2271, 54310, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrivateKey_Sign(t *testing.T) { tests := []struct { name string wantedLength int }{ {"Test Private Key Signature Length of 65 bytes", 65}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { privKey, _, err := crypto.NewKeypair() if err != nil { t.Errorf("NewKeypair() error = %v", err) return } signature, errSign := privKey.Sign(crypto.SHA3FromString("foo")) if errSign != nil { t.Errorf("Sign() error = %v", errSign) return } if len(signature) != tt.wantedLength { t.Errorf("Sign() produced invalid length signature, got = %v, expected = %v", len(signature), tt.wantedLength) return } }) } }
explode_data.jsonl/6962
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 75981, 1098, 622, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 6692, 7566, 4373, 526, 198, 197, 59403, 197, 197, 4913, 2271, 9679, 5309, 32232, 17287, 315, 220, 21, 20, 5820, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPathGetNlri(t *testing.T) { nlri := bgp.NewIPAddrPrefix(24, "13.2.3.2") pd := &Path{ info: &originInfo{ nlri: nlri, }, } r_nlri := pd.GetNlri() assert.Equal(t, r_nlri, nlri) }
explode_data.jsonl/57482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 1820, 1949, 45, 75, 461, 1155, 353, 8840, 836, 8, 341, 9038, 75, 461, 1669, 8951, 79, 7121, 3298, 13986, 14335, 7, 17, 19, 11, 330, 16, 18, 13, 17, 13, 18, 13, 17, 1138, 3223, 67, 1669, 609, 1820, 515, 197, 27043, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntegrationTLSConnectCancellation(t *testing.T) { ctx, cancel := context.WithTimeout( context.Background(), time.Microsecond, ) defer cancel() results := TLSConnect(ctx, TLSConnectConfig{ Address: "ooni.io:443", }) if results.Error == nil { t.Fatal("expected an error here") } if results.Error.Error() != "generic_timeout_error" { t.Fatal("not the error we expected") } }
explode_data.jsonl/53540
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 52464, 45439, 14611, 82298, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 7636, 1006, 197, 28413, 19047, 1507, 882, 1321, 2754, 5569, 345, 197, 340, 16867, 9121, 741, 55497, 1669, 41654, 14611, 7502, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestZSetScan(t *testing.T) { c := getTestConn() defer c.Close() key := "scan_zset" c.Do("ZADD", key, 1, "a", 2, "b") if ay, err := goredis.Values(c.Do("XZSCAN", key, "0")); err != nil { t.Fatal(err) } else if len(ay) != 2 { t.Fatal(len(ay)) } else { checkScanValues(t, ay[1], "a", 1, "b", 2) } }
explode_data.jsonl/77091
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 57, 1649, 26570, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 633, 2271, 9701, 741, 16867, 272, 10421, 2822, 23634, 1669, 330, 16405, 6415, 746, 698, 1444, 33596, 445, 57, 15665, 497, 1376, 11, 220, 16, 11, 330, 64, 497, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBaseTable_Fields(t *testing.T) { b := NewBaseTable("", "", "") type args struct { f Field } tests := []struct { name string b *BaseTable args args want []Field }{ { name: "1", args: args{ f: newMockField(NewBaseField(1, "1", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), }, want: []Field{ newMockField(NewBaseField(1, "1", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), }, }, { name: "2", args: args{ f: newMockField(NewBaseField(1, "2", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), }, want: []Field{ newMockField(NewBaseField(1, "1", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), newMockField(NewBaseField(1, "2", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), }, }, { name: "3", args: args{ f: newMockField(NewBaseField(1, "3", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), }, want: []Field{ newMockField(NewBaseField(1, "1", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), newMockField(NewBaseField(1, "2", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), newMockField(NewBaseField(1, "3", NewBaseFieldType(&sql.ColumnType{})), NewBaseFieldType(&sql.ColumnType{})), }, }, } for _, tt := range tests { b.AppendField(tt.args.f) if got := b.Fields(); !reflect.DeepEqual(got, tt.want) { t.Errorf("run %v BaseTable.Fields() = %v, want %v", tt.name, got, tt.want) } } }
explode_data.jsonl/20042
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 705 }
[ 2830, 3393, 3978, 2556, 1400, 6907, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 1532, 3978, 2556, 19814, 7342, 14676, 13158, 2827, 2036, 341, 197, 1166, 8601, 198, 197, 630, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 2233, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandshakeClientEd25519(t *testing.T) { test := &clientTest{ name: "Ed25519", cert: testEd25519Certificate, key: testEd25519PrivateKey, } runClientTestTLS12(t, test) runClientTestTLS13(t, test) config := testConfig.Clone() cert, _ := X509KeyPair([]byte(clientEd25519CertificatePEM), []byte(clientEd25519KeyPEM)) config.Certificates = []Certificate{cert} test = &clientTest{ name: "ClientCert-Ed25519", args: []string{"-Verify", "1"}, config: config, } runClientTestTLS12(t, test) runClientTestTLS13(t, test) }
explode_data.jsonl/27709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 2314, 29661, 2959, 2715, 17, 20, 20, 16, 24, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 609, 2972, 2271, 515, 197, 11609, 25, 330, 2715, 17, 20, 20, 16, 24, 756, 197, 1444, 529, 25, 1273, 2715, 17, 20, 20, 16, 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...
1
func TestAssetID(t *testing.T) { c := codec.NewDefault() id := Asset{ ID: ids.NewID([32]byte{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, }), } if err := id.Verify(); err != nil { t.Fatal(err) } bytes, err := c.Marshal(&id) if err != nil { t.Fatal(err) } newID := Asset{} if err := c.Unmarshal(bytes, &newID); err != nil { t.Fatal(err) } if err := newID.Verify(); err != nil { t.Fatal(err) } if !id.AssetID().Equals(newID.AssetID()) { t.Fatalf("Parsing returned the wrong Asset ID") } }
explode_data.jsonl/61333
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 378 }
[ 2830, 3393, 16604, 915, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 34647, 7121, 3675, 2822, 15710, 1669, 22605, 515, 197, 29580, 25, 14151, 7121, 915, 2561, 18, 17, 90184, 515, 298, 197, 15, 87, 15, 15, 11, 220, 15, 87, 15, 16, 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...
6
func TestIsValidPeer(t *testing.T) { ring := ringDescriber{} host := &HostInfo{ rpcAddress: net.ParseIP("0.0.0.0"), rack: "myRack", hostId: "0", dataCenter: "datacenter", tokens: []string{"0", "1"}, } if !ring.IsValidPeer(host) { t.Errorf("expected %+v to be a valid peer", host) } host.rack = "" if ring.IsValidPeer(host) { t.Errorf("expected %+v to NOT be a valid peer", host) } }
explode_data.jsonl/37533
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 55470, 30888, 1155, 353, 8840, 836, 8, 341, 7000, 287, 1669, 10058, 62664, 652, 16094, 63104, 1669, 609, 9296, 1731, 515, 197, 7000, 3992, 4286, 25, 4179, 8937, 3298, 445, 15, 13, 15, 13, 15, 13, 15, 4461, 197, 7000, 473...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInsufficientPermission_Is(t *testing.T) { inp := &callbacks.InsufficientPermissions{} if errors.Is(nil, &callbacks.InsufficientPermissions{}) { t.Error(invalidErrorAssertion) } if errors.Is(fmt.Errorf(wrapMsg), &callbacks.InsufficientPermissions{}) { t.Error(invalidErrorAssertion) } if !errors.Is(inp, &callbacks.InsufficientPermissions{}) { t.Errorf(invalidErrorAssertion) } }
explode_data.jsonl/56089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 15474, 26683, 14966, 31879, 1155, 353, 8840, 836, 8, 341, 17430, 79, 1669, 609, 68311, 5337, 82, 26683, 23851, 31483, 743, 5975, 4506, 27907, 11, 609, 68311, 5337, 82, 26683, 23851, 28875, 341, 197, 3244, 6141, 5900, 1891, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetWriteOptions(t *testing.T) { t.Parallel() c, s := makeClient(t, nil, nil) defer s.Stop() r, _ := c.newRequest("GET", "/v1/jobs") q := &WriteOptions{ Region: "foo", Namespace: "bar", AuthToken: "foobar", } r.setWriteOptions(q) if r.params.Get("region") != "foo" { t.Fatalf("bad: %v", r.params) } if r.params.Get("namespace") != "bar" { t.Fatalf("bad: %v", r.params) } if r.token != "foobar" { t.Fatalf("bad: %v", r.token) } }
explode_data.jsonl/65019
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 1649, 7985, 3798, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1444, 11, 274, 1669, 1281, 2959, 1155, 11, 2092, 11, 2092, 340, 16867, 274, 30213, 2822, 7000, 11, 716, 1669, 272, 4618, 1900, 445, 3806, 497, 3521, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddIfNotPresentSharded(t *testing.T) { t.Parallel() flight := newShardedSyncU64set() if !flight.AddIfNotPresent(10) { t.Error("could not add the first value") } if flight.AddIfNotPresent(10) { t.Error("value added twice") } }
explode_data.jsonl/7436
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 2212, 2679, 2623, 21195, 2016, 20958, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1166, 4145, 1669, 501, 2016, 20958, 12154, 52, 21, 19, 746, 741, 743, 753, 38390, 1904, 2679, 2623, 21195, 7, 16, 15, 8, 341, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRepositoryLicense_String(t *testing.T) { v := RepositoryLicense{ Name: String(""), Path: String(""), SHA: String(""), Size: Int(0), URL: String(""), HTMLURL: String(""), GitURL: String(""), DownloadURL: String(""), Type: String(""), Content: String(""), Encoding: String(""), License: &License{}, } want := `github.RepositoryLicense{Name:"", Path:"", SHA:"", Size:0, URL:"", HTMLURL:"", GitURL:"", DownloadURL:"", Type:"", Content:"", Encoding:"", License:github.License{}}` if got := v.String(); got != want { t.Errorf("RepositoryLicense.String = %v, want %v", got, want) } }
explode_data.jsonl/33288
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 4624, 9827, 31777, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 26377, 9827, 515, 197, 21297, 25, 286, 923, 445, 4461, 197, 69640, 25, 286, 923, 445, 4461, 197, 7568, 17020, 25, 260, 923, 445, 4461, 197, 91224, 25, 286, 133...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEquals(t *testing.T) { tests := []struct { in1 string //十六进制编码值 in2 string //十六进制编码值 expected bool //预期相等 }{ {"0", "0", true}, {"0", "1", false}, {"1", "0", false}, //2^32-1==2^32-1? {"ffffffff", "ffffffff", true}, //2^64-1==2^64-2? {"ffffffffffffffff", "fffffffffffffffe", false}, //0==prime(mod prime)? {"0", "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", true}, // {"1", "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc30", true}, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { f := new(fieldVal).SetHex(test.in1).Normalize() f2 := new(fieldVal).SetHex(test.in2).Normalize() result := f.Equals(f2) if result != test.expected { t.Errorf("fieldVal.Equals #%d wrong result\n"+ "got: %v\nwant: %v", i, result, test.expected) continue } } }
explode_data.jsonl/361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 4315, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 258, 16, 414, 914, 442, 102853, 41299, 43316, 112950, 25511, 198, 258, 17, 414, 914, 442, 102853, 41299, 43316, 112950, 25511, 198, 7325, 1807, 256, 442, 1043...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWalletGetMultipleAddresses(t *testing.T) { chainID := ids.ID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} w, err := NewWallet(logging.NoLog{}, 12345, chainID, 0) if err != nil { t.Fatal(err) } addr0, err := w.GetAddress() if err != nil { t.Fatal(err) } addr1, err := w.GetAddress() if err != nil { t.Fatal(err) } if !addr0.Equals(addr1) { t.Fatalf("Should have returned the same address from multiple Get Address calls") } }
explode_data.jsonl/41619
{ "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, 38259, 1949, 32089, 52290, 1155, 353, 8840, 836, 8, 341, 197, 8819, 915, 1669, 14151, 9910, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, 23, 11, 220, 24, 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...
5
func TestTimeStampMicrosLogicalTypeUnionEncode(t *testing.T) { schema := `{"type": ["null", {"type": "long", "logicalType": "timestamp-micros"}]}` testBinaryEncodeFail(t, schema, "test", "cannot transform binary timestamp-micros, expected time.Time, received string") testBinaryCodecPass(t, schema, time.Date(2006, 1, 2, 15, 04, 05, 565283000, time.UTC), []byte("\x02\xc6\x8d\xf7\xe7\xaf\xd8\x84\x04")) }
explode_data.jsonl/12006
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 66146, 34609, 82, 64312, 929, 32658, 32535, 1155, 353, 8840, 836, 8, 341, 1903, 3416, 1669, 1565, 4913, 1313, 788, 4383, 2921, 497, 5212, 1313, 788, 330, 4825, 497, 330, 30256, 929, 788, 330, 13035, 1448, 2754, 82, 9207, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClassifier(t *testing.T) { file, err := os.CreateTemp("", "model.sav.") if err != nil { t.Errorf("create temp file failed") } defer file.Close() defer os.Remove(file.Name()) _, err = InitClassfier("") if err != nil { t.Errorf("expected no error but error occurred") } c1, err := InitClassfier(file.Name()) if err != nil { t.Errorf("init classification failed") } c1.Learn("Hello World This is the Test", Hot) c1.Learn("Hate this isn't test", Cold) test, likely := c1.Classify("Hat this test") log.Println(test, likely) err = c1.Backup() if err != nil { t.Errorf("backup failed") } c2, err := InitClassfier(file.Name()) if err != nil { t.Errorf("load exist model failed") } test, likely = c2.Classify("Hello this test") log.Println(test, likely) }
explode_data.jsonl/11991
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 306 }
[ 2830, 3393, 33895, 1155, 353, 8840, 836, 8, 341, 17661, 11, 1848, 1669, 2643, 7251, 12151, 19814, 330, 2528, 73984, 13053, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 3182, 2730, 1034, 4641, 1138, 197, 532, 16867, 1034, 10421, 741...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSearchResultWithProfiling(t *testing.T) { client := setupTestClientAndCreateIndexAndAddDocs(t) all := NewMatchAllQuery() searchResult, err := client.Search().Index(testIndexName).Query(all).Profile(true).Do(context.TODO()) if err != nil { t.Fatal(err) } if searchResult.Profile == nil { t.Fatal("Profiled MatchAll query did not return profiling data with results") } }
explode_data.jsonl/37510
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 5890, 2077, 2354, 18592, 7979, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 6505, 2271, 2959, 3036, 4021, 1552, 3036, 2212, 63107, 1155, 692, 50960, 1669, 1532, 8331, 2403, 2859, 741, 45573, 2077, 11, 1848, 1669, 2943, 31903, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) { t.Parallel() assertFunc := func(t *testing.T, ext string, pages page.Pages) { p := pages[0] if p.WordCount() != 8 { t.Fatalf("[%s] incorrect word count. expected %v, got %v", ext, 8, p.WordCount()) } } testAllMarkdownEnginesForPages(t, assertFunc, nil, simplePageWithAllCJKRunes) }
explode_data.jsonl/60622
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 10879, 2507, 2354, 2403, 89349, 6727, 288, 26040, 10281, 89349, 13806, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 6948, 9626, 1669, 2915, 1155, 353, 8840, 836, 11, 1303, 914, 11, 6816, 2150, 68829, 8, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTokenService(t *testing.T) { t.Run("should return the token", func(t *testing.T) { // GIVEN gcliMock := &gcliMocks.GraphQLClient{} defer gcliMock.AssertExpectations(t) expected := NewTokenResponse(token) ctx := context.WithValue(context.Background(), authentication.TenantKey, "tenant") gcliMock.On("Run", ctx, mock.Anything, mock.Anything).Run(GenerateTestToken(t, expected)).Return(nil).Once() tokenService := NewTokenService(gcliMock) // WHEN actualToken, appError := tokenService.GetToken(ctx, clientId, "Application") // THEN require.NoError(t, appError) assert.Equal(t, token, actualToken) }) t.Run("should return error when token not found", func(t *testing.T) { // GIVEN gcliMock := &gcliMocks.GraphQLClient{} defer gcliMock.AssertExpectations(t) err := errors.New("could not get the token") ctx := context.WithValue(context.Background(), authentication.TenantKey, "tenant") gcliMock.On("Run", ctx, mock.Anything, mock.Anything).Return(err) tokenService := NewTokenService(gcliMock) // WHEN actualToken, appError := tokenService.GetToken(ctx, clientId, "Application") // THEN require.Error(t, appError) assert.Equal(t, "", actualToken) }) }
explode_data.jsonl/71387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 443 }
[ 2830, 3393, 3323, 1860, 1155, 353, 8840, 836, 8, 1476, 3244, 16708, 445, 5445, 470, 279, 3950, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 322, 89836, 198, 197, 3174, 19521, 11571, 1669, 609, 70, 19521, 72577, 40237, 3588, 2959...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_FullLoggerNameGenerator_panics_primitive(t *testing.T) { assert.Execution(t, func() { FullLoggerNameGenerator(123) }).WillPanicWith("^invalid value to receive a package from: 123$") }
explode_data.jsonl/57921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 1400, 617, 7395, 675, 12561, 71099, 1211, 84087, 1155, 353, 8840, 836, 8, 341, 6948, 68352, 1155, 11, 2915, 368, 341, 197, 197, 9432, 7395, 675, 12561, 7, 16, 17, 18, 340, 197, 16630, 9945, 47, 31270, 2354, 48654, 11808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSortedSetScore(t *testing.T) { testRaw(t, func(c *client) { c.Do("ZADD", "z", "1", "aap", "2", "noot", "3", "mies", "2", "nootagain", "3", "miesagain", "+Inf", "the stars", ) c.Do("ZSCORE", "z", "mies") c.Do("ZSCORE", "z", "the stars") c.Do("ZSCORE", "z", "nosuch") c.Do("ZSCORE", "nosuch", "nosuch") // failure cases c.Error("wrong number", "ZSCORE") c.Error("wrong number", "ZSCORE", "foo") c.Error("wrong number", "ZSCORE", "foo", "too", "many") c.Do("SET", "str", "I am a string") c.Error("wrong kind", "ZSCORE", "str", "member") }) }
explode_data.jsonl/23347
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 51051, 1649, 10570, 1155, 353, 8840, 836, 8, 341, 18185, 20015, 1155, 11, 2915, 1337, 353, 2972, 8, 341, 197, 1444, 33596, 445, 57, 15665, 497, 330, 89, 756, 298, 197, 1, 16, 497, 330, 64, 391, 756, 298, 197, 1, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMetricDescriptor_Description(t *testing.T) { ms := NewMetricDescriptor() ms.InitEmpty() assert.EqualValues(t, "", ms.Description()) testValDescription := "test_description" ms.SetDescription(testValDescription) assert.EqualValues(t, testValDescription, ms.Description()) }
explode_data.jsonl/19519
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 54310, 11709, 79687, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 54310, 11709, 741, 47691, 26849, 3522, 741, 6948, 12808, 6227, 1155, 11, 7342, 9829, 28773, 2398, 18185, 2208, 5009, 1669, 330, 1944, 11448, 698, 47691, 420...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptyTimestamp(t *testing.T) { session := createSession(t) defer session.Close() if err := createTable(session, "CREATE TABLE gocql_test.test_empty_timestamp (id int, time timestamp, num int, PRIMARY KEY (id))"); err != nil { t.Fatalf("failed to create table with error '%v'", err) } if err := session.Query("INSERT INTO test_empty_timestamp (id, num) VALUES (?,?)", 1, 561).Exec(); err != nil { t.Fatalf("failed to insert with err: %v", err) } var timeVal time.Time if err := session.Query("SELECT time FROM test_empty_timestamp where id = ?", 1).Scan(&timeVal); err != nil { t.Fatalf("failed to select with err: %v", err) } if !timeVal.IsZero() { t.Errorf("time.Time bind variable should still be empty (was %s)", timeVal) } }
explode_data.jsonl/11171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 3522, 20812, 1155, 353, 8840, 836, 8, 341, 25054, 1669, 1855, 5283, 1155, 340, 16867, 3797, 10421, 2822, 743, 1848, 1669, 1855, 2556, 16264, 11, 330, 22599, 14363, 342, 509, 1470, 4452, 5958, 15124, 23073, 320, 307, 526, 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...
5
func TestServerOfName(t *testing.T) { addrs := []struct { input string want string }{ { input: "foo.com:80", want: "foo.com", }, { input: "192.168.0.9:80", want: "", }, { input: "foo.com", want: "", }, } c, err := New(OptionNoExternalConfig()) if err != nil { t.Fatal(err) } for _, v := range addrs { if got := c.serverNameOfAddr(v.input); got != v.want { t.Errorf("wanted %v, got %q", v.want, got) } } }
explode_data.jsonl/75539
{ "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, 5475, 2124, 675, 1155, 353, 8840, 836, 8, 341, 12718, 5428, 1669, 3056, 1235, 341, 197, 22427, 914, 198, 197, 50780, 220, 914, 198, 197, 59403, 197, 197, 515, 298, 22427, 25, 330, 7975, 905, 25, 23, 15, 756, 298, 50780, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVirtualService_InvalidEvent(t *testing.T) { g := NewGomegaWithT(t) o := processing.ProcessorOptions{ DomainSuffix: "cluster.local", MeshConfig: meshConfig(), } xform, src, acc := setupVS(g, o) xform.Start() defer xform.Stop() src.Handlers.Handle(event.FullSyncFor(collections.IstioNetworkingV1Alpha3Virtualservices)) g.Consistently(acc.Events).Should(BeEmpty()) }
explode_data.jsonl/71130
{ "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, 33026, 1860, 62, 7928, 1556, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 692, 22229, 1669, 8692, 29012, 269, 3798, 515, 197, 10957, 3121, 40177, 25, 330, 18855, 11033, 756, 197, 9209, 4288, 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...
1
func TestValidateShouldSucceedWithValidConfigs(t *testing.T) { validConfigs := []*LogsConfig{ {Type: FileType, Path: "/var/log/foo.log"}, {Type: TCPType, Port: 1234}, {Type: UDPType, Port: 5678}, {Type: DockerType}, {Type: JournaldType, ProcessingRules: []ProcessingRule{{Name: "foo", Type: ExcludeAtMatch, Pattern: ".*"}}}, } for _, config := range validConfigs { err := config.Validate() assert.Nil(t, err) } }
explode_data.jsonl/41171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 17926, 14996, 50, 29264, 2354, 4088, 84905, 1155, 353, 8840, 836, 8, 341, 56322, 84905, 1669, 29838, 51053, 2648, 515, 197, 197, 90, 929, 25, 93238, 11, 7933, 25, 3521, 947, 19413, 60555, 1665, 7115, 197, 197, 90, 929, 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 TestDynamicTemplate(t *testing.T) { tests := []struct { field Field method func(f Field) common.MapStr output common.MapStr }{ { field: Field{ Type: "object", ObjectType: "keyword", Name: "context", }, method: func(f Field) common.MapStr { return f.object() }, output: common.MapStr{ "context": common.MapStr{ "mapping": common.MapStr{"type": "keyword"}, "match_mapping_type": "string", "path_match": "context.*", }, }, }, { field: Field{ Type: "object", ObjectType: "long", path: "language", Name: "english", }, method: func(f Field) common.MapStr { return f.object() }, output: common.MapStr{ "language.english": common.MapStr{ "mapping": common.MapStr{"type": "long"}, "match_mapping_type": "long", "path_match": "language.english.*", }, }, }, { field: Field{ Type: "object", ObjectType: "text", path: "language", Name: "english", }, method: func(f Field) common.MapStr { return f.object() }, output: common.MapStr{ "language.english": common.MapStr{ "mapping": common.MapStr{"type": "text"}, "match_mapping_type": "string", "path_match": "language.english.*", }, }, }, } for _, test := range tests { dynamicTemplates = nil test.method(test.field) assert.Equal(t, test.output, dynamicTemplates[0]) } }
explode_data.jsonl/7476
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 652 }
[ 2830, 3393, 21752, 7275, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 39250, 220, 8601, 198, 197, 42257, 2915, 955, 8601, 8, 4185, 10104, 2580, 198, 197, 21170, 4185, 10104, 2580, 198, 197, 59403, 197, 197, 515, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPrepareForGroupByItems(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t") tk.MustExec("create table t(id int, v int)") tk.MustExec("insert into t(id, v) values(1, 2),(1, 2),(2, 3);") tk.MustExec("prepare s1 from 'select max(v) from t group by floor(id/?)';") tk.MustExec("set @a=2;") tk.MustQuery("execute s1 using @a;").Sort().Check(testkit.Rows("2", "3")) tk.MustExec("prepare s1 from 'select max(v) from t group by ?';") tk.MustExec("set @a=2;") err := tk.ExecToErr("execute s1 using @a;") require.EqualError(t, err, "Unknown column '2' in 'group statement'") tk.MustExec("set @a=2.0;") tk.MustQuery("execute s1 using @a;").Check(testkit.Rows("3")) }
explode_data.jsonl/5508
{ "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, 50590, 2461, 2808, 1359, 4353, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 741, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 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 TestSQLValueValidation(t *testing.T) { validate := New() validate.RegisterCustomTypeFunc(ValidateValuerType, (*driver.Valuer)(nil), valuer{}) validate.RegisterCustomTypeFunc(ValidateCustomType, MadeUpCustomType{}) validate.RegisterCustomTypeFunc(OverrideIntTypeForSomeReason, 1) val := valuer{ Name: "", } errs := validate.Var(val, "required") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "required") val.Name = "Valid Name" errs = validate.Var(val, "required") Equal(t, errs, nil) val.Name = "errorme" PanicMatches(t, func() { errs = validate.Var(val, "required") }, "SQL Driver Valuer error: some kind of error") myVal := valuer{ Name: "", } errs = validate.Var(myVal, "required") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "required") cust := MadeUpCustomType{ FirstName: "Joey", LastName: "Bloggs", } c := CustomMadeUpStruct{MadeUp: cust, OverriddenInt: 2} errs = validate.Struct(c) Equal(t, errs, nil) c.MadeUp.FirstName = "" c.OverriddenInt = 1 errs = validate.Struct(c) NotEqual(t, errs, nil) Equal(t, len(errs.(ValidationErrors)), 2) AssertError(t, errs, "CustomMadeUpStruct.MadeUp", "CustomMadeUpStruct.MadeUp", "MadeUp", "MadeUp", "required") AssertError(t, errs, "CustomMadeUpStruct.OverriddenInt", "CustomMadeUpStruct.OverriddenInt", "OverriddenInt", "OverriddenInt", "gt") }
explode_data.jsonl/77234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 537 }
[ 2830, 3393, 6688, 1130, 13799, 1155, 353, 8840, 836, 8, 1476, 197, 7067, 1669, 1532, 741, 197, 7067, 19983, 10268, 929, 9626, 7, 17926, 2208, 8801, 929, 11, 4609, 12521, 77819, 8801, 2376, 8385, 701, 1044, 8801, 37790, 197, 7067, 19983,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindIssueByID(t *testing.T) { i := domain.Issue{ ID: 1, Title: "test-title", Description: "test-description", Status: 1, ProjectID: 1, } cucm, iucm, lucm, pucm, m := prepareMocksAndRUC() iucm.On("FindByID", i.ID).Return(i, nil) c, rec := prepareHTTP(echo.GET, "/api/issues/:id", nil) c.SetParamNames("id") c.SetParamValues("1") err := m.FindIssueByID(c) assert.Nil(t, err) assert.Equal(t, 200, rec.Code) checkAssertions(t, cucm, iucm, lucm, pucm) }
explode_data.jsonl/60166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 9885, 42006, 60572, 1155, 353, 8840, 836, 8, 341, 8230, 1669, 7947, 2447, 83890, 515, 197, 29580, 25, 688, 220, 16, 345, 197, 92233, 25, 981, 330, 1944, 8816, 756, 197, 47414, 25, 330, 1944, 42830, 756, 197, 58321, 25, 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...
1
func TestXFFGateway(t *testing.T) { framework. NewTest(t). Features("traffic.ingress.topology"). Run(func(t framework.TestContext) { gatewayNs := namespace.NewOrFail(t, t, namespace.Config{Prefix: "custom-gateway"}) injectLabel := `sidecar.istio.io/inject: "true"` if len(t.Settings().Revisions.Default()) > 0 { injectLabel = fmt.Sprintf(`istio.io/rev: "%v"`, t.Settings().Revisions.Default()) } templateParams := map[string]string{ "imagePullSecret": image.PullSecretNameOrFail(t), "injectLabel": injectLabel, } t.Config().ApplyYAMLOrFail(t, gatewayNs.Name(), tmpl.MustEvaluate(`apiVersion: v1 kind: Service metadata: name: custom-gateway labels: istio: ingressgateway spec: ports: - port: 80 name: http selector: istio: ingressgateway --- apiVersion: apps/v1 kind: Deployment metadata: name: custom-gateway spec: selector: matchLabels: istio: ingressgateway template: metadata: annotations: inject.istio.io/templates: gateway proxy.istio.io/config: | gatewayTopology: numTrustedProxies: 2 labels: istio: ingressgateway {{ .injectLabel }} spec: {{- if ne .imagePullSecret "" }} imagePullSecrets: - name: {{ .imagePullSecret }} {{- end }} containers: - name: istio-proxy image: auto --- `, templateParams)) cs := t.Clusters().Default().(*kubecluster.Cluster) retry.UntilSuccessOrFail(t, func() error { _, err := kubetest.CheckPodsAreReady(kubetest.NewPodFetch(cs, gatewayNs.Name(), "istio=ingressgateway")) return err }, retry.Timeout(time.Minute*2), retry.Delay(time.Second)) for _, tt := range common.XFFGatewayCase(apps, fmt.Sprintf("custom-gateway.%s.svc.cluster.local", gatewayNs.Name())) { tt.Run(t, apps.Namespace.Name()) } }) }
explode_data.jsonl/62830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 808 }
[ 2830, 3393, 55, 1748, 40709, 1155, 353, 8840, 836, 8, 341, 1166, 5794, 624, 197, 197, 3564, 2271, 1155, 4292, 197, 197, 21336, 445, 53987, 13, 287, 673, 8772, 2449, 38609, 197, 85952, 18552, 1155, 12626, 8787, 1972, 8, 341, 298, 3174,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteFiles(t *testing.T) { testDir, cleanup := setupTempDirWithEtc(t) defer cleanup() d := newMockDaemon() contents := []byte("hello world\n") encodedContents := dataurl.EncodeBytes(contents) // gzip contents var buffer bytes.Buffer writer := gzip.NewWriter(&buffer) _, err := writer.Write(contents) assert.Nil(t, err) err = writer.Close() assert.Nil(t, err) gzippedContents := dataurl.EncodeBytes(buffer.Bytes()) // use current user so test doesn't try to chown to root currentUser, err := user.Current() assert.Nil(t, err) currentUid, err := strconv.Atoi(currentUser.Uid) assert.Nil(t, err) currentGid, err := strconv.Atoi(currentUser.Gid) assert.Nil(t, err) filePath := filepath.Join(testDir, "test") node := ign3types.Node{ Path: filePath, User: ign3types.NodeUser{ID: &currentUid}, Group: ign3types.NodeGroup{ID: &currentGid}, } mode := 420 tests := []struct { name string files []ign3types.File expectedErr error expectedContents []byte }{ { name: "basic file write", files: []ign3types.File{{ Node: node, FileEmbedded1: ign3types.FileEmbedded1{Contents: ign3types.Resource{Source: &encodedContents}, Mode: &mode}, }}, expectedContents: contents, }, { name: "write file with compressed contents", files: []ign3types.File{{ Node: node, FileEmbedded1: ign3types.FileEmbedded1{Contents: ign3types.Resource{Source: &gzippedContents, Compression: helpers.StrToPtr("gzip")}, Mode: &mode}, }}, expectedContents: contents, }, { name: "try to write file with unsupported compression type", files: []ign3types.File{{ Node: node, FileEmbedded1: ign3types.FileEmbedded1{Contents: ign3types.Resource{Source: &encodedContents, Compression: helpers.StrToPtr("xz")}, Mode: &mode}, }}, expectedErr: fmt.Errorf("could not decode file %q: %w", filePath, fmt.Errorf("unsupported compression type %q", "xz")), }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { err := d.writeFiles(test.files) assert.Equal(t, test.expectedErr, err) if test.expectedContents != nil { fileContents, err := os.ReadFile(filePath) assert.Nil(t, err) assert.Equal(t, string(test.expectedContents), string(fileContents)) } os.RemoveAll(filePath) }) } }
explode_data.jsonl/28211
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 949 }
[ 2830, 3393, 7985, 10809, 1155, 353, 8840, 836, 8, 341, 18185, 6184, 11, 21290, 1669, 6505, 12151, 6184, 2354, 36, 10413, 1155, 340, 16867, 21290, 2822, 2698, 1669, 501, 11571, 89177, 2822, 197, 17610, 1669, 3056, 3782, 445, 14990, 1879, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCancel(t *testing.T) { distroStruct := test_distro.New() arch, err := distroStruct.GetArch(test_distro.TestArchName) if err != nil { t.Fatalf("error getting arch from distro: %v", err) } imageType, err := arch.GetImageType(test_distro.TestImageTypeName) if err != nil { t.Fatalf("error getting image type from arch: %v", err) } manifest, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil, 0) if err != nil { t.Fatalf("error creating osbuild manifest: %v", err) } server := newTestServer(t, t.TempDir(), time.Duration(0), "/api/worker/v1") handler := server.Handler() jobId, err := server.EnqueueOSBuild(arch.Name(), &worker.OSBuildJob{Manifest: manifest}, "") require.NoError(t, err) j, token, typ, args, dynamicArgs, err := server.RequestJob(context.Background(), arch.Name(), []string{"osbuild"}, []string{""}) require.NoError(t, err) require.Equal(t, jobId, j) require.Equal(t, "osbuild", typ) require.NotNil(t, args) require.Nil(t, dynamicArgs) test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/worker/v1/jobs/%s", token), `{}`, http.StatusOK, fmt.Sprintf(`{"canceled":false,"href":"/api/worker/v1/jobs/%s","id":"%s","kind":"JobStatus"}`, token, token)) err = server.Cancel(jobId) require.NoError(t, err) test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/worker/v1/jobs/%s", token), `{}`, http.StatusOK, fmt.Sprintf(`{"canceled":true,"href":"/api/worker/v1/jobs/%s","id":"%s","kind":"JobStatus"}`, token, token)) }
explode_data.jsonl/1102
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 586 }
[ 2830, 3393, 9269, 1155, 353, 8840, 836, 8, 341, 2698, 15561, 9422, 1669, 1273, 814, 15561, 7121, 741, 197, 1113, 11, 1848, 1669, 1582, 299, 9422, 2234, 18727, 8623, 814, 15561, 8787, 18727, 675, 340, 743, 1848, 961, 2092, 341, 197, 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...
4
func TestRefsAllowed(t *testing.T) { t.Parallel() testCases := []struct { ref string match bool }{ {ref: "1450cd639e0bc6721eb02800169e464f212cde06 foo/bar", match: false}, {ref: "259a6fba859cc91c54cd86a2cbd4c2f720e3a19d foo/bar:baz", match: false}, {ref: "d0a293c0ac821fadfdc086fe528f79423004229d refs/foo/bar:baz", match: false}, {ref: "21751bf5cb2b556543a11018c1f13b35e44a99d7 tags/v0.0.1", match: false}, {ref: "498214de67004b1da3d820901307bed2a68a8ef6 keep-around/498214de67004b1da3d820901307bed2a68a8ef6", match: false}, {ref: "38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e merge-requests/11/head", match: false}, {ref: "c347ca2e140aa667b968e51ed0ffe055501fe4f4 environments/3/head", match: false}, {ref: "4ed78158b5b018c43005cec917129861541e25bc notes/commits", match: false}, {ref: "9298d46305ee0d3f4ce288370beaa02637584ff2 HEAD", match: true}, {ref: "0ed8c6c6752e8c6ea63e7b92a517bf5ac1209c80 refs/heads/markdown", match: true}, {ref: "f4e6814c3e4e7a0de82a9e7cd20c626cc963a2f8 refs/tags/v1.0.0", match: true}, {ref: "78a30867c755d774340108cdad5f11254818fb0c refs/keep-around/78a30867c755d774340108cdad5f11254818fb0c", match: true}, {ref: "c347ca2e140aa667b968e51ed0ffe055501fe4f4 refs/merge-requests/10/head", match: true}, {ref: "c347ca2e140aa667b968e51ed0ffe055501fe4f4 refs/environments/2/head", match: true}, {ref: "4ed78158b5b018c43005cec917129861541e25bc refs/notes/commits", match: true}, } for _, tc := range testCases { t.Run(tc.ref, func(t *testing.T) { match := refsAllowed.Match([]byte(tc.ref)) require.Equal(t, match, tc.match) }) } }
explode_data.jsonl/10971
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 807 }
[ 2830, 3393, 82807, 35382, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 18185, 37302, 1669, 3056, 1235, 341, 197, 59504, 256, 914, 198, 197, 47706, 1807, 198, 197, 59403, 197, 197, 90, 1097, 25, 330, 16, 19, 20, 15, 4385, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetNewUsersInTeam(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() teamId := th.BasicTeam.Id rusers, _, err := th.Client.GetNewUsersInTeam(teamId, 0, 60, "") require.NoError(t, err) lastCreateAt := model.GetMillis() for _, u := range rusers { require.LessOrEqual(t, u.CreateAt, lastCreateAt, "right sorting") lastCreateAt = u.CreateAt CheckUserSanitization(t, u) } rusers, _, err = th.Client.GetNewUsersInTeam(teamId, 1, 1, "") require.NoError(t, err) require.Len(t, rusers, 1, "should be 1 per page") th.Client.Logout() _, resp, err := th.Client.GetNewUsersInTeam(teamId, 1, 1, "") require.Error(t, err) CheckUnauthorizedStatus(t, resp) }
explode_data.jsonl/47515
{ "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, 1949, 3564, 7137, 641, 14597, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 197, 9196, 764, 1669, 270, 48868, 14597, 6444, 271, 7000, 4218, 11, 8358, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestBorderBoxWriterDrawsBox(t *testing.T) { bbw := createBorderedBoxWriter(NewRect(1, 1, 10, 10)) // the first column and row should be empty x := 0 for y := 0; y < 10; y++ { char := bbw(' ', point{x, y}) assert.Equal(t, ' ', char, "Cell at: (%d,%d) should be empty, contains %s", x, y, string(char)) } assert.Equal(t, boxTopLeft, bbw(' ', point{1, 1}), "expected top left box at (1,1), got: %s", string(bbw(' ', point{1, 1}))) assert.Equal(t, boxBottomLeft, bbw(' ', point{1, 10}), "expected bottom left box at (1,10), got: %s", string(bbw(' ', point{1, 10}))) assert.Equal(t, boxTopRight, bbw(' ', point{10, 1}), "expected top right box at (10,1), got: %s", string(bbw(' ', point{10, 1}))) assert.Equal(t, boxBottomRight, bbw(' ', point{10, 10}), "expected bottom right box at (10,10), got: %s", string(bbw(' ', point{10, 10}))) // check vertical lines for y := 2; y <= 9; y++ { assert.Equal(t, boxVertical, bbw(' ', point{1, y}), "expected %s at (1,%d), got: %s", string(boxVertical), y, string(bbw(' ', point{1, y}))) assert.Equal(t, boxVertical, bbw(' ', point{10, y}), string(boxVertical), y, string(bbw(' ', point{10, y}))) } // chek horizontal lines for x := 2; x <= 9; x++ { assert.Equal(t, boxHorizontal, bbw(' ', point{x, 1}), "expected %s at (%d,1), got: %s", string(boxHorizontal), x, string(bbw(' ', point{x, 1}))) assert.Equal(t, boxHorizontal, bbw(' ', point{x, 10}), "expected %s at (%d,10), got: %s", string(boxHorizontal), x, string(bbw(' ', point{x, 10}))) } }
explode_data.jsonl/30726
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 682 }
[ 2830, 3393, 10691, 1611, 6492, 8137, 82, 1611, 1155, 353, 8840, 836, 8, 341, 2233, 39824, 1669, 1855, 33, 10544, 1611, 6492, 35063, 4415, 7, 16, 11, 220, 16, 11, 220, 16, 15, 11, 220, 16, 15, 4390, 197, 322, 279, 1156, 3250, 323, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLogs(t *testing.T) { f := newPLMFixture(t) defer f.TearDown() f.kClient.SetLogsForPodContainer(podID, cName, "hello world!") start := time.Now() state := f.store.LockMutableStateForTesting() state.TiltStartTime = start p := store.Pod{ PodID: podID, Containers: []store.Container{NewRunningContainer(cName, cID)}, } state.UpsertManifestTarget(manifestutils.NewManifestTargetWithPod( model.Manifest{Name: "server"}, p)) f.store.UnlockMutableState() f.plm.OnChange(f.ctx, f.store) f.AssertOutputContains("hello world!") assert.Equal(t, start, f.kClient.LastPodLogStartTime) }
explode_data.jsonl/65264
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 51053, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 2916, 44, 18930, 1155, 340, 16867, 282, 836, 682, 4454, 2822, 1166, 5202, 2959, 4202, 51053, 2461, 23527, 4502, 1295, 347, 915, 11, 272, 675, 11, 330, 14990, 1879, 6650...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRootCommandSoftwareContext(t *testing.T) { testUtil.InitTestConfig(testUtil.SoftwarePlatform) output, err := executeCommand("help") assert.NoError(t, err) assert.Contains(t, output, "astro [command]") assert.Contains(t, output, "completion") assert.Contains(t, output, "dev") assert.Contains(t, output, "help") assert.Contains(t, output, "version") assert.Contains(t, output, "workspace") assert.Contains(t, output, "user") assert.Contains(t, output, "deploy") assert.Contains(t, output, "deployment") }
explode_data.jsonl/40241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 190 }
[ 2830, 3393, 8439, 4062, 19250, 1972, 1155, 353, 8840, 836, 8, 341, 18185, 2742, 26849, 2271, 2648, 8623, 2742, 46387, 2110, 17296, 340, 21170, 11, 1848, 1669, 9026, 4062, 445, 8653, 1138, 6948, 35699, 1155, 11, 1848, 340, 6948, 11545, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_underscore_arrays_12(t *testing.T) { tt(t, func() { test, _ := test_() test(` test('object', function() { var result = _.object(['moe', 'larry', 'curly'], [30, 40, 50]); var shouldBe = {moe: 30, larry: 40, curly: 50}; ok(_.isEqual(result, shouldBe), 'two arrays zipped together into an object'); result = _.object([['one', 1], ['two', 2], ['three', 3]]); shouldBe = {one: 1, two: 2, three: 3}; ok(_.isEqual(result, shouldBe), 'an array of pairs zipped together into an object'); var stooges = {moe: 30, larry: 40, curly: 50}; ok(_.isEqual(_.object(_.pairs(stooges)), stooges), 'an object converted to pairs and back to an object'); ok(_.isEqual(_.object(null), {}), 'handles nulls'); }); `) }) }
explode_data.jsonl/68906
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 336 }
[ 2830, 3393, 62, 53933, 68983, 62, 16, 17, 1155, 353, 8840, 836, 8, 972, 3244, 83, 1155, 11, 2915, 368, 972, 197, 18185, 11, 716, 1669, 1273, 62, 18005, 197, 18185, 5809, 319, 220, 1273, 492, 1700, 516, 729, 368, 972, 262, 762, 110...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldParseEventCorrectly(t *testing.T) { tests := map[string]struct { req *http.Request expected *analytics.EventRequest }{ "one": { req: httptest.NewRequest("GET", "/event?t=win&b=bidId&f=b&ts=1000&x=1&a=accountId&bidder=bidder&int=intType", strings.NewReader("")), expected: &analytics.EventRequest{ Type: analytics.Win, BidID: "bidId", Timestamp: 1000, Bidder: "bidder", AccountID: "", Format: analytics.Blank, Analytics: analytics.Enabled, Integration: "intType", }, }, "two": { req: httptest.NewRequest("GET", "/event?t=win&b=bidId&ts=0&a=accountId", strings.NewReader("")), expected: &analytics.EventRequest{ Type: analytics.Win, BidID: "bidId", Timestamp: 0, Analytics: analytics.Enabled, }, }, "three - vtype = start": { req: httptest.NewRequest("GET", "/event?t=vast&vtype=start&b=bidId&ts=0&a=accountId", strings.NewReader("")), expected: &analytics.EventRequest{ Type: analytics.Vast, VType: analytics.Start, BidID: "bidId", Timestamp: 0, Analytics: analytics.Enabled, }, }, } for name, test := range tests { t.Run(name, func(t *testing.T) { // execute er, errs := ParseEventRequest(test.req) // validate assert.Equal(t, 0, len(errs)) assert.EqualValues(t, test.expected, er) }) } }
explode_data.jsonl/146
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 653 }
[ 2830, 3393, 14996, 14463, 1556, 33092, 398, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 24395, 414, 353, 1254, 9659, 198, 197, 42400, 353, 77652, 6904, 1900, 198, 197, 59403, 197, 197, 1, 603, 788, 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...
1
func TestCustomer_SendStatementEmail(t *testing.T) { key := "test api key" server, err := invdmockserver.New(200, nil, "json", true) if err != nil { t.Fatal(err) } defer server.Close() conn := mockConnection(key, server) subjectEntity := conn.NewCustomer() err = subjectEntity.SendStatementEmail(nil) if err != nil { t.Fatal("Error with send", err) } }
explode_data.jsonl/15011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 12792, 46267, 8636, 4781, 1155, 353, 8840, 836, 8, 341, 23634, 1669, 330, 1944, 6330, 1376, 15620, 41057, 11, 1848, 1669, 1529, 13849, 1176, 4030, 7121, 7, 17, 15, 15, 11, 2092, 11, 330, 2236, 497, 830, 340, 743, 1848, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDomainUpdate(t *testing.T) { args := testutil.Args scenarios := []testutil.TestScenario{ { Args: args("domain update --service-id 123 --version 1 --new-name www.test.com --comment "), WantError: "error parsing arguments: required flag --name not provided", }, { Args: args("domain update --service-id 123 --version 1 --name www.test.com --autoclone"), API: mock.API{ ListVersionsFn: testutil.ListVersions, CloneVersionFn: testutil.CloneVersionResult(4), UpdateDomainFn: updateDomainOK, }, WantError: "error parsing arguments: must provide either --new-name or --comment to update domain", }, { Args: args("domain update --service-id 123 --version 1 --name www.test.com --new-name www.example.com --autoclone"), API: mock.API{ ListVersionsFn: testutil.ListVersions, CloneVersionFn: testutil.CloneVersionResult(4), UpdateDomainFn: updateDomainError, }, WantError: errTest.Error(), }, { Args: args("domain update --service-id 123 --version 1 --name www.test.com --new-name www.example.com --autoclone"), API: mock.API{ ListVersionsFn: testutil.ListVersions, CloneVersionFn: testutil.CloneVersionResult(4), UpdateDomainFn: updateDomainOK, }, WantOutput: "Updated domain www.example.com (service 123 version 4)", }, } for _, testcase := range scenarios { t.Run(testcase.Name, func(t *testing.T) { var stdout bytes.Buffer opts := testutil.NewRunOpts(testcase.Args, &stdout) opts.APIClient = mock.APIClient(testcase.API) err := app.Run(opts) testutil.AssertErrorContains(t, err, testcase.WantError) testutil.AssertStringContains(t, stdout.String(), testcase.WantOutput) }) } }
explode_data.jsonl/17442
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 650 }
[ 2830, 3393, 13636, 4289, 1155, 353, 8840, 836, 8, 341, 31215, 1669, 1273, 1314, 51015, 198, 29928, 60494, 1669, 3056, 1944, 1314, 8787, 54031, 515, 197, 197, 515, 298, 197, 4117, 25, 414, 2827, 445, 12204, 2647, 1177, 7936, 12897, 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 TestRenameInvalidUsername(t *testing.T) { defer prepareTestEnv(t)() invalidUsernames := []string{ "%2f*", "%2f.", "%2f..", "%00", "thisHas ASpace", "p<A>tho>lo<gical", } session := loginUser(t, "user2") for _, invalidUsername := range invalidUsernames { t.Logf("Testing username %s", invalidUsername) req := NewRequestWithValues(t, "POST", "/user/settings", map[string]string{ "_csrf": GetCSRF(t, session, "/user/settings"), "name": invalidUsername, "email": "user2@example.com", }) resp := session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) assert.Contains(t, htmlDoc.doc.Find(".ui.negative.message").Text(), i18n.Tr("en", "form.alpha_dash_dot_error"), ) unittest.AssertNotExistsBean(t, &user_model.User{Name: invalidUsername}) } }
explode_data.jsonl/28857
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 88757, 7928, 11115, 1155, 353, 8840, 836, 8, 341, 16867, 10549, 2271, 14359, 1155, 8, 2822, 197, 11808, 1474, 11400, 1669, 3056, 917, 515, 197, 197, 31391, 17, 69, 9, 756, 197, 197, 31391, 17, 69, 10346, 197, 197, 31391, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLocale(t *testing.T) { trans := New() expected := "es_DO" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } }
explode_data.jsonl/55243
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 3393, 19231, 1155, 353, 8840, 836, 8, 1476, 72453, 1669, 1532, 741, 42400, 1669, 330, 288, 21820, 1837, 743, 1356, 59094, 368, 961, 3601, 341, 197, 3244, 13080, 445, 18896, 7677, 82, 6, 24528, 7677, 82, 22772, 3601, 11, 1356, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestParsesEnvInnerNil(t *testing.T) { os.Setenv("innervar", "someinnervalue") defer os.Clearenv() cfg := ParentStruct{} assert.NoError(t, env.Parse(&cfg)) }
explode_data.jsonl/7479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 47, 1561, 288, 14359, 31597, 19064, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 445, 6130, 648, 277, 497, 330, 14689, 6130, 648, 540, 1138, 16867, 2643, 727, 273, 9151, 85, 741, 50286, 1669, 17022, 9422, 16094, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFavoritesControlUserHistory(t *testing.T) { mockCtrl, config, ctx := favTestInit(t, false) f := NewFavorites(config) f.Initialize(ctx) defer favTestShutdown(t, mockCtrl, config, f) config.mockKbpki.EXPECT().FavoriteList(gomock.Any()).Return(keybase1.FavoritesResult{}, nil) config.mockKbpki.EXPECT().FavoriteAdd(gomock.Any(), gomock.Any()). Return(nil) config.mockKbs.EXPECT().EncryptFavorites(gomock.Any(), gomock.Any()).Return(nil, nil) config.mockCodec.EXPECT().Encode(gomock.Any()).Return(nil, nil).Times(2) config.mockClock.EXPECT().Now().Return(time.Unix(0, 0)).Times(2) config.mockKbpki.EXPECT().FavoriteDelete(gomock.Any(), gomock.Any()). Return(nil) username := "bob" tlfName := "alice,bob" tlfType := tlf.Private // Add a favorite. err := f.Add(ctx, favorites.ToAdd{ Folder: favorites.Folder{ Name: tlfName, Type: tlfType, }, Created: true}) require.NoError(t, err) // Put a thing in user history. history := kbfsedits.NewTlfHistory() _, err = history.AddNotifications(username, []string{"hello"}) require.NoError(t, err) config.UserHistory().UpdateHistory(tlf.CanonicalName(tlfName), tlfType, history, username) // Delete the favorite. err = f.Delete(ctx, favorites.Folder{Name: tlfName, Type: tlfType}) require.NoError(t, err) // Verify that the user history is now empty. userHistory := config.UserHistory().Get(username) require.Empty(t, userHistory) }
explode_data.jsonl/14685
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 85221, 3273, 1474, 13424, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 11, 2193, 11, 5635, 1669, 9244, 2271, 3803, 1155, 11, 895, 340, 1166, 1669, 1532, 85221, 8754, 340, 1166, 45829, 7502, 340, 16867, 9244, 2271, 62004, 1155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRerror(t *testing.T) { rerr := new(Rerror) t.Logf("%v", rerr) rerr.Code = 400 rerr.Message = "msg" t.Logf("%v", rerr) rerr.Detail = `"bala...bala..."` t.Logf("%v", rerr) meta := new(utils.Args) rerr.SetToMeta(meta) t.Logf("%v", meta.String()) b := meta.Peek(MetaRerrorKey) t.Logf("%s", b) newRerr := NewRerrorFromMeta(meta) t.Logf("%v", newRerr) t.Logf("test ToError: %s", newRerr.ToError().Error()) }
explode_data.jsonl/68025
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 49, 841, 1155, 353, 8840, 836, 8, 341, 7000, 615, 1669, 501, 2785, 841, 340, 3244, 98954, 4430, 85, 497, 435, 615, 340, 7000, 615, 20274, 284, 220, 19, 15, 15, 198, 7000, 615, 8472, 284, 330, 3236, 698, 3244, 98954, 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...
1
func TestTabletServerReadTransaction(t *testing.T) { _, tsv, db := newTestTxExecutor(t) defer tsv.StopService() defer db.Close() target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY} db.AddQuery("select dtid, state, time_created from _vt.dt_state where dtid = 'aa'", &sqltypes.Result{}) got, err := tsv.ReadTransaction(ctx, &target, "aa") require.NoError(t, err) want := &querypb.TransactionMetadata{} utils.MustMatch(t, want, got, "ReadTransaction") txResult := &sqltypes.Result{ Fields: []*querypb.Field{ {Type: sqltypes.VarBinary}, {Type: sqltypes.Uint64}, {Type: sqltypes.Uint64}, }, Rows: [][]sqltypes.Value{{ sqltypes.NewVarBinary("aa"), sqltypes.NewInt64(int64(querypb.TransactionState_PREPARE)), sqltypes.NewVarBinary("1"), }}, } db.AddQuery("select dtid, state, time_created from _vt.dt_state where dtid = 'aa'", txResult) db.AddQuery("select keyspace, shard from _vt.dt_participant where dtid = 'aa'", &sqltypes.Result{ Fields: []*querypb.Field{ {Type: sqltypes.VarBinary}, {Type: sqltypes.VarBinary}, }, Rows: [][]sqltypes.Value{{ sqltypes.NewVarBinary("test1"), sqltypes.NewVarBinary("0"), }, { sqltypes.NewVarBinary("test2"), sqltypes.NewVarBinary("1"), }}, }) got, err = tsv.ReadTransaction(ctx, &target, "aa") require.NoError(t, err) want = &querypb.TransactionMetadata{ Dtid: "aa", State: querypb.TransactionState_PREPARE, TimeCreated: 1, Participants: []*querypb.Target{{ Keyspace: "test1", Shard: "0", TabletType: topodatapb.TabletType_PRIMARY, }, { Keyspace: "test2", Shard: "1", TabletType: topodatapb.TabletType_PRIMARY, }}, } utils.MustMatch(t, want, got, "ReadTransaction") txResult = &sqltypes.Result{ Fields: []*querypb.Field{ {Type: sqltypes.VarBinary}, {Type: sqltypes.Uint64}, {Type: sqltypes.Uint64}, }, Rows: [][]sqltypes.Value{{ sqltypes.NewVarBinary("aa"), sqltypes.NewInt64(int64(querypb.TransactionState_COMMIT)), sqltypes.NewVarBinary("1"), }}, } db.AddQuery("select dtid, state, time_created from _vt.dt_state where dtid = 'aa'", txResult) want.State = querypb.TransactionState_COMMIT got, err = tsv.ReadTransaction(ctx, &target, "aa") require.NoError(t, err) utils.MustMatch(t, want, got, "ReadTransaction") txResult = &sqltypes.Result{ Fields: []*querypb.Field{ {Type: sqltypes.VarBinary}, {Type: sqltypes.Uint64}, {Type: sqltypes.Uint64}, }, Rows: [][]sqltypes.Value{{ sqltypes.NewVarBinary("aa"), sqltypes.NewInt64(int64(querypb.TransactionState_ROLLBACK)), sqltypes.NewVarBinary("1"), }}, } db.AddQuery("select dtid, state, time_created from _vt.dt_state where dtid = 'aa'", txResult) want.State = querypb.TransactionState_ROLLBACK got, err = tsv.ReadTransaction(ctx, &target, "aa") require.NoError(t, err) utils.MustMatch(t, want, got, "ReadTransaction") }
explode_data.jsonl/79986
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1242 }
[ 2830, 3393, 2556, 83, 5475, 4418, 8070, 1155, 353, 8840, 836, 8, 341, 197, 6878, 259, 3492, 11, 2927, 1669, 501, 2271, 31584, 25255, 1155, 340, 16867, 259, 3492, 30213, 1860, 741, 16867, 2927, 10421, 741, 28861, 1669, 3239, 16650, 35016...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImageFormats(t *testing.T) { assertFindsRightColor(t, "white1x1.png", "ffffff") assertFindsRightColor(t, "white1x1.gif", "ffffff") }
explode_data.jsonl/14294
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 59 }
[ 2830, 3393, 1906, 44599, 1155, 353, 8840, 836, 8, 341, 6948, 37, 8673, 5979, 1636, 1155, 11, 330, 5782, 16, 87, 16, 3508, 497, 330, 26886, 1138, 6948, 37, 8673, 5979, 1636, 1155, 11, 330, 5782, 16, 87, 16, 16008, 497, 330, 26886, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSuspendWithDeadline(t *testing.T) { controller := newController() wfcset := controller.wfclientset.ArgoprojV1alpha1().Workflows("") // operate the workflow. it should become in a suspended state after wf := unmarshalWF(suspendTemplateWithDeadline) wf, err := wfcset.Create(wf) assert.Nil(t, err) woc := newWorkflowOperationCtx(wf, controller) woc.operate() wf, err = wfcset.Get(wf.ObjectMeta.Name, metav1.GetOptions{}) assert.Nil(t, err) assert.True(t, util.IsWorkflowSuspended(wf)) // operate again and verify no pods were scheduled woc = newWorkflowOperationCtx(wf, controller) woc.operate() updatedWf, err := wfcset.Get(wf.Name, metav1.GetOptions{}) assert.Nil(t, err) found := false for _, node := range updatedWf.Status.Nodes { if node.Type == wfv1.NodeTypeSuspend { assert.Equal(t, node.Phase, wfv1.NodeFailed) assert.Equal(t, node.Message, "terminated") found = true } } assert.True(t, found) }
explode_data.jsonl/54365
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 50, 12758, 2354, 83593, 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, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChargeUpdate(t *testing.T) { chargeParams := &stripe.ChargeParams{ Amount: 1002, Currency: currency.USD, Card: &stripe.CardParams{ Number: "378282246310005", Month: "06", Year: "20", }, Desc: "original description", } res, _ := New(chargeParams) if res.Desc != chargeParams.Desc { t.Errorf("Original description %q does not match expected description %q\n", res.Desc, chargeParams.Desc) } updated := &stripe.ChargeParams{ Desc: "updated description", } target, err := Update(res.ID, updated) if err != nil { t.Error(err) } if target.Desc != updated.Desc { t.Errorf("Updated description %q does not match expected description %q\n", target.Desc, updated.Desc) } }
explode_data.jsonl/73935
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 55363, 4289, 1155, 353, 8840, 836, 8, 341, 7450, 709, 4870, 1669, 609, 61233, 6353, 2744, 4870, 515, 197, 197, 10093, 25, 256, 220, 16, 15, 15, 17, 345, 197, 6258, 5088, 25, 11413, 13, 26749, 345, 197, 197, 5770, 25, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCase1(t *testing.T) { n := 100 expected := "202" actual := convertToBase7(n) if actual != expected { t.Errorf("Expected: %s, Actual: %s", expected, actual) } }
explode_data.jsonl/45632
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 30573, 16, 1155, 353, 8840, 836, 8, 341, 9038, 1669, 220, 16, 15, 15, 198, 42400, 1669, 330, 17, 15, 17, 698, 88814, 1669, 5508, 1249, 3978, 22, 1445, 340, 743, 5042, 961, 3601, 341, 197, 3244, 13080, 445, 18896, 25, 1018, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestProvider_Scan(t *testing.T) { ctrlr1 := storage.MockNvmeController(1) ctrlr2 := storage.MockNvmeController(2) ctrlr3 := storage.MockNvmeController(3) for name, tc := range map[string]struct { req storage.BdevScanRequest forwarded bool mbc *MockBackendConfig expRes *storage.BdevScanResponse expErr error expVMDDisabled bool }{ "no devices": { req: storage.BdevScanRequest{}, expRes: &storage.BdevScanResponse{}, expVMDDisabled: true, // disabled in mock by default }, "single device": { req: storage.BdevScanRequest{}, mbc: &MockBackendConfig{ ScanRes: &storage.BdevScanResponse{ Controllers: storage.NvmeControllers{ctrlr1}, }, VmdEnabled: true, }, expRes: &storage.BdevScanResponse{ Controllers: storage.NvmeControllers{ctrlr1}, }, }, "multiple devices": { req: storage.BdevScanRequest{}, mbc: &MockBackendConfig{ ScanRes: &storage.BdevScanResponse{ Controllers: storage.NvmeControllers{ ctrlr1, ctrlr2, ctrlr3, }, }, }, expRes: &storage.BdevScanResponse{ Controllers: storage.NvmeControllers{ ctrlr1, ctrlr2, ctrlr3, }, }, expVMDDisabled: true, }, "multiple devices with vmd disabled": { req: storage.BdevScanRequest{DisableVMD: true}, forwarded: true, mbc: &MockBackendConfig{ ScanRes: &storage.BdevScanResponse{ Controllers: storage.NvmeControllers{ ctrlr1, ctrlr2, ctrlr3, }, }, }, expRes: &storage.BdevScanResponse{ Controllers: storage.NvmeControllers{ ctrlr1, ctrlr2, ctrlr3, }, }, expVMDDisabled: true, }, "failure": { req: storage.BdevScanRequest{}, mbc: &MockBackendConfig{ ScanErr: errors.New("scan failed"), }, expErr: errors.New("scan failed"), }, } { t.Run(name, func(t *testing.T) { log, buf := logging.NewTestLogger(name) defer common.ShowBufferOnFailure(t, buf) p := NewMockProvider(log, tc.mbc) tc.req.Forwarded = tc.forwarded gotRes, gotErr := p.Scan(tc.req) common.CmpErr(t, tc.expErr, gotErr) if gotErr != nil { return } if diff := cmp.Diff(tc.expRes, gotRes, defCmpOpts()...); diff != "" { t.Fatalf("\nunexpected response (-want, +got):\n%s\n", diff) } common.AssertEqual(t, tc.expVMDDisabled, p.IsVMDDisabled(), "vmd disabled") }) } }
explode_data.jsonl/67553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1132 }
[ 2830, 3393, 5179, 1098, 4814, 1155, 353, 8840, 836, 8, 341, 84381, 81, 16, 1669, 5819, 24664, 45, 85, 2660, 2051, 7, 16, 340, 84381, 81, 17, 1669, 5819, 24664, 45, 85, 2660, 2051, 7, 17, 340, 84381, 81, 18, 1669, 5819, 24664, 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...
3
func TestHybiShortMaskedTextFrame(t *testing.T) { frameHeader := &hybiFrameHeader{Fin: true, OpCode: TextFrame, MaskingKey: []byte{0xcc, 0x55, 0x80, 0x20}} payload := []byte("hello") maskedPayload := []byte{0xa4, 0x30, 0xec, 0x4c, 0xa3} header := []byte{0x81, 0x85} header = append(header, frameHeader.MaskingKey...) testHybiFrame(t, header, payload, maskedPayload, frameHeader) }
explode_data.jsonl/53441
{ "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, 30816, 8221, 12472, 12686, 291, 1178, 4369, 1155, 353, 8840, 836, 8, 341, 34465, 4047, 1669, 609, 8503, 8221, 4369, 4047, 90, 9134, 25, 830, 11, 97779, 25, 2918, 4369, 345, 197, 9209, 70705, 1592, 25, 3056, 3782, 90, 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 TestSimpleString(t *testing.T) { var ( ctx = context.Background() conn, err = clickhouse.Open(&clickhouse.Options{ Addr: []string{"127.0.0.1:9000"}, Auth: clickhouse.Auth{ Database: "default", Username: "default", Password: "", }, Compression: &clickhouse.Compression{ Method: clickhouse.CompressionLZ4, }, }) ) if assert.NoError(t, err) { if err := checkMinServerVersion(conn, 21, 9, 0); err != nil { t.Skip(err.Error()) return } const ddl = ` CREATE TABLE test_string ( Col1 String ) Engine Memory ` defer func() { conn.Exec(ctx, "DROP TABLE test_string") }() if err := conn.Exec(ctx, ddl); assert.NoError(t, err) { if batch, err := conn.PrepareBatch(ctx, "INSERT INTO test_string"); assert.NoError(t, err) { if err := batch.Append("A"); assert.NoError(t, err) { if assert.NoError(t, batch.Send()) { } } } } } }
explode_data.jsonl/495
{ "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, 16374, 703, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 20985, 981, 284, 2266, 19047, 741, 197, 32917, 11, 1848, 284, 4205, 7675, 12953, 2099, 3678, 7675, 22179, 515, 298, 197, 13986, 25, 3056, 917, 4913, 16, 17, 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 TestSeriesNRows(t *testing.T) { // Create new series init := []Series{ NewSeriesFloat64("test", &SeriesInit{1, 0}, 1.0, nil, 2.0, 3.0), NewSeriesInt64("test", &SeriesInit{1, 0}, 1, nil, 2, 3), NewSeriesString("test", &SeriesInit{1, 0}, "1", nil, "2", "3"), NewSeriesTime("test", &SeriesInit{1, 0}, time.Now(), nil, time.Now(), time.Now()), NewSeriesMixed("test", &SeriesInit{1, 0}, 1, nil, 2, 3), NewSeriesGeneric("test", civil.Date{}, &SeriesInit{0, 1}, civil.Date{2018, time.May, 01}, nil, civil.Date{2018, time.May, 02}, civil.Date{2018, time.May, 03}), } expected := []int{ 4, 4, 4, 4, 4, 4, } for i := range init { s := init[i] if s.NRows() != expected[i] { t.Errorf("wrong val: expected: %v actual: %v", expected[i], s.NRows()) } } }
explode_data.jsonl/9999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 25544, 45, 9024, 1155, 353, 8840, 836, 8, 1476, 197, 322, 4230, 501, 4013, 198, 28248, 1669, 3056, 25544, 515, 197, 197, 3564, 25544, 5442, 21, 19, 445, 1944, 497, 609, 25544, 3803, 90, 16, 11, 220, 15, 2137, 220, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_MergeInstances(t *testing.T) { i1 := Instances{"i": healthy} i2 := Instances{"i": healthy} assert.Equal(t, healthy, i1.MergeInstances(i2)["i"]) i2 = Instances{"i": unhealthy} assert.Equal(t, unhealthy, i1.MergeInstances(i2)["i"]) i2 = Instances{"i": terminating} assert.Equal(t, terminating, i1.MergeInstances(i2)["i"]) // inverse i2 = Instances{"i": healthy} assert.Equal(t, healthy, i2.MergeInstances(i1)["i"]) i2 = Instances{"i": unhealthy} assert.Equal(t, unhealthy, i2.MergeInstances(i1)["i"]) i2 = Instances{"i": terminating} assert.Equal(t, terminating, i2.MergeInstances(i1)["i"]) }
explode_data.jsonl/40111
{ "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, 1245, 10080, 42725, 1155, 353, 8840, 836, 8, 341, 8230, 16, 1669, 89241, 4913, 72, 788, 9314, 532, 8230, 17, 1669, 89241, 4913, 72, 788, 9314, 532, 6948, 12808, 1155, 11, 9314, 11, 600, 16, 93855, 42725, 1956, 17, 65440, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFieldSetStringValue(t *testing.T) { recordBuf := make([]byte, 20) f := newField("NAME", "C", 5, 0) f.Offset = 5 f.setStringValue(recordBuf, " Abc", nil) require.Equal(t, []byte(" Abc "), recordBuf[5:10]) }
explode_data.jsonl/79455
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 1877, 1649, 82696, 1155, 353, 8840, 836, 8, 341, 71952, 15064, 1669, 1281, 10556, 3782, 11, 220, 17, 15, 340, 1166, 1669, 501, 1877, 445, 7535, 497, 330, 34, 497, 220, 20, 11, 220, 15, 340, 1166, 61958, 284, 220, 20, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTrieDB_GetClientSubscriptions(t *testing.T) { a := assert.New(t) db := NewStore() tt := []struct { clientID string topic packets.Topic }{ {clientID: "id0", topic: packets.Topic{Name: "name0", Qos: packets.QOS_0}}, {clientID: "id0", topic: packets.Topic{Name: "name1", Qos: packets.QOS_1}}, {clientID: "id1", topic: packets.Topic{Name: "name2", Qos: packets.QOS_2}}, {clientID: "id1", topic: packets.Topic{Name: "name3", Qos: packets.QOS_2}}, {clientID: "id2", topic: packets.Topic{Name: "name4", Qos: packets.QOS_2}}, {clientID: "id2", topic: packets.Topic{Name: "name5", Qos: packets.QOS_2}}, } for _, v := range tt { db.Subscribe(v.clientID, v.topic) } expected := []packets.Topic{ {Name: "name0", Qos: packets.QOS_0}, {Name: "name1", Qos: packets.QOS_1}, } rs := db.GetClientSubscriptions("id0") a.ElementsMatch(expected, rs) // not exists rs = db.GetClientSubscriptions("id5") a.Nil(rs) }
explode_data.jsonl/80982
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 51, 7231, 3506, 13614, 2959, 3136, 29966, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 340, 20939, 1669, 1532, 6093, 741, 3244, 83, 1669, 3056, 1235, 341, 197, 25291, 915, 914, 198, 197, 3244, 24810, 262, 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 TestRandom(t *testing.T) { timesRepeat := 100 tt := []struct { Min int Max int }{ {1, 10}, {1, 2}, {0, 1}, {1, 1}, {0, 0}, {1000, 2000}, } for _, tc := range tt { for i := 0; i < timesRepeat; i++ { res := Random(tc.Min, tc.Max) assert.True(t, res <= tc.Max) assert.True(t, res >= tc.Min) } } }
explode_data.jsonl/50931
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 13999, 1155, 353, 8840, 836, 8, 341, 3244, 1733, 38718, 1669, 220, 16, 15, 15, 198, 3244, 83, 1669, 3056, 1235, 341, 197, 197, 6217, 526, 198, 197, 197, 5974, 526, 198, 197, 59403, 197, 197, 90, 16, 11, 220, 16, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestName(t *testing.T) { n1 := "Test1" n2 := "Test2" tc1 := &testChip{name: n1} tc2 := &testChip{name: n2} pm.RegisterChip(tc1) pm.RegisterChip(tc2) if pm.FindChip(n1) != tc1 { t.Errorf("Did not match tc1") } if pm.FindChip(n2) != tc2 { t.Errorf("Did not match tc2") } chips := pm.Chips() sort.Strings(chips) exp := []string{n1, n2} if !reflect.DeepEqual(exp, chips) { t.Errorf("Expected %v, got %v", exp, chips) } }
explode_data.jsonl/75914
{ "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, 675, 1155, 353, 8840, 836, 8, 341, 9038, 16, 1669, 330, 2271, 16, 698, 9038, 17, 1669, 330, 2271, 17, 698, 78255, 16, 1669, 609, 1944, 56417, 47006, 25, 308, 16, 532, 78255, 17, 1669, 609, 1944, 56417, 47006, 25, 308, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEtcdStoragePath(t *testing.T) { master := StartRealMasterOrDie(t) defer master.Cleanup() defer dumpEtcdKVOnFailure(t, master.KV) client := &allClient{dynamicClient: master.Dynamic} if _, err := master.Client.CoreV1().Namespaces().Create(&v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: testNamespace}}); err != nil { t.Fatal(err) } etcdStorageData := GetEtcdStorageData() kindSeen := sets.NewString() pathSeen := map[string][]schema.GroupVersionResource{} etcdSeen := map[schema.GroupVersionResource]empty{} cohabitatingResources := map[string]map[schema.GroupVersionKind]empty{} for _, resourceToPersist := range master.Resources { t.Run(resourceToPersist.Mapping.Resource.String(), func(t *testing.T) { mapping := resourceToPersist.Mapping gvk := resourceToPersist.Mapping.GroupVersionKind gvResource := resourceToPersist.Mapping.Resource kind := gvk.Kind if kindWhiteList.Has(kind) { kindSeen.Insert(kind) t.Skip("whitelisted") } etcdSeen[gvResource] = empty{} testData, hasTest := etcdStorageData[gvResource] if !hasTest { t.Fatalf("no test data for %s. Please add a test for your new type to GetEtcdStorageData().", gvResource) } if len(testData.ExpectedEtcdPath) == 0 { t.Fatalf("empty test data for %s", gvResource) } shouldCreate := len(testData.Stub) != 0 // try to create only if we have a stub var ( input *metaObject err error ) if shouldCreate { if input, err = jsonToMetaObject([]byte(testData.Stub)); err != nil || input.isEmpty() { t.Fatalf("invalid test data for %s: %v", gvResource, err) } // unset type meta fields - we only set these in the CRD test data and it makes // any CRD test with an expectedGVK override fail the DeepDerivative test input.Kind = "" input.APIVersion = "" } all := &[]cleanupData{} defer func() { if !t.Failed() { // do not cleanup if test has already failed since we may need things in the etcd dump if err := client.cleanup(all); err != nil { t.Fatalf("failed to clean up etcd: %#v", err) } } }() if err := client.createPrerequisites(master.Mapper, testNamespace, testData.Prerequisites, all); err != nil { t.Fatalf("failed to create prerequisites for %s: %#v", gvResource, err) } if shouldCreate { // do not try to create items with no stub if err := client.create(testData.Stub, testNamespace, mapping, all); err != nil { t.Fatalf("failed to create stub for %s: %#v", gvResource, err) } } output, err := getFromEtcd(master.KV, testData.ExpectedEtcdPath) if err != nil { t.Fatalf("failed to get from etcd for %s: %#v", gvResource, err) } expectedGVK := gvk if testData.ExpectedGVK != nil { if gvk == *testData.ExpectedGVK { t.Errorf("GVK override %s for %s is unnecessary or something was changed incorrectly", testData.ExpectedGVK, gvk) } expectedGVK = *testData.ExpectedGVK } actualGVK := output.getGVK() if actualGVK != expectedGVK { t.Errorf("GVK for %s does not match, expected %s got %s", kind, expectedGVK, actualGVK) } if !apiequality.Semantic.DeepDerivative(input, output) { t.Errorf("Test stub for %s does not match: %s", kind, diff.ObjectGoPrintDiff(input, output)) } addGVKToEtcdBucket(cohabitatingResources, actualGVK, getEtcdBucket(testData.ExpectedEtcdPath)) pathSeen[testData.ExpectedEtcdPath] = append(pathSeen[testData.ExpectedEtcdPath], mapping.Resource) }) } if inEtcdData, inEtcdSeen := diffMaps(etcdStorageData, etcdSeen); len(inEtcdData) != 0 || len(inEtcdSeen) != 0 { t.Errorf("etcd data does not match the types we saw:\nin etcd data but not seen:\n%s\nseen but not in etcd data:\n%s", inEtcdData, inEtcdSeen) } if inKindData, inKindSeen := diffMaps(kindWhiteList, kindSeen); len(inKindData) != 0 || len(inKindSeen) != 0 { t.Errorf("kind whitelist data does not match the types we saw:\nin kind whitelist but not seen:\n%s\nseen but not in kind whitelist:\n%s", inKindData, inKindSeen) } for bucket, gvks := range cohabitatingResources { if len(gvks) != 1 { gvkStrings := []string{} for key := range gvks { gvkStrings = append(gvkStrings, keyStringer(key)) } t.Errorf("cohabitating resources in etcd bucket %s have inconsistent GVKs\nyou may need to use DefaultStorageFactory.AddCohabitatingResources to sync the GVK of these resources:\n%s", bucket, gvkStrings) } } for path, gvrs := range pathSeen { if len(gvrs) != 1 { gvrStrings := []string{} for _, key := range gvrs { gvrStrings = append(gvrStrings, keyStringer(key)) } t.Errorf("invalid test data, please ensure all expectedEtcdPath are unique, path %s has duplicate GVRs:\n%s", path, gvrStrings) } } }
explode_data.jsonl/79842
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1886 }
[ 2830, 3393, 31860, 4385, 5793, 1820, 1155, 353, 8840, 836, 8, 341, 2109, 2300, 1669, 5145, 12768, 18041, 2195, 18175, 1155, 340, 16867, 7341, 727, 60639, 741, 16867, 10276, 31860, 4385, 82707, 1925, 17507, 1155, 11, 7341, 11352, 53, 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...
3
func TestNSLookupTXT(t *testing.T) { testenv.MustHaveExternalNetwork(t) for _, server := range nslookupTestServers { txt, err := LookupTXT(server) if err != nil { t.Errorf("failed %s: %s", server, err) continue } if len(txt) == 0 { t.Errorf("no results") continue } expected, err := nslookupTXT(server) if err != nil { t.Logf("skipping failed nslookup %s test: %s", server, err) continue } sort.Strings(expected) sort.Strings(txt) if !reflect.DeepEqual(expected, txt) { t.Errorf("different results %s:\texp:%v\tgot:%v", server, toJson(expected), toJson(txt)) } } }
explode_data.jsonl/5818
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 2448, 34247, 62865, 1155, 353, 8840, 836, 8, 341, 18185, 3160, 50463, 12116, 25913, 12320, 1155, 692, 2023, 8358, 3538, 1669, 2088, 12268, 21020, 2271, 78139, 341, 197, 68272, 11, 1848, 1669, 50311, 62865, 21421, 340, 197, 743...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestNodeGroupWithFailedMachine(t *testing.T) { test := func(t *testing.T, testConfig *testConfig) { controller, stop := mustCreateTestController(t, testConfig) defer stop() // Simulate a failed machine machine := testConfig.machines[3].DeepCopy() unstructured.RemoveNestedField(machine.Object, "spec", "providerID") unstructured.SetNestedField(machine.Object, "FailureMessage", "status", "failureMessage") if err := updateResource(controller.managementClient, controller.machineInformer, controller.machineResource, machine); err != nil { t.Fatalf("unexpected error updating machine, got %v", err) } nodegroups, err := controller.nodeGroups() if err != nil { t.Fatalf("unexpected error: %v", err) } if l := len(nodegroups); l != 1 { t.Fatalf("expected 1 nodegroup, got %d", l) } ng := nodegroups[0] nodeNames, err := ng.Nodes() if err != nil { t.Fatalf("unexpected error: %v", err) } if len(nodeNames) != len(testConfig.nodes) { t.Fatalf("expected len=%v, got len=%v", len(testConfig.nodes), len(nodeNames)) } sort.SliceStable(nodeNames, func(i, j int) bool { return nodeNames[i].Id < nodeNames[j].Id }) // The failed machine key is sorted to the first index failedMachineID := fmt.Sprintf("%s%s_%s", failedMachinePrefix, machine.GetNamespace(), machine.GetName()) if nodeNames[0].Id != failedMachineID { t.Fatalf("expected %q, got %q", failedMachineID, nodeNames[0].Id) } for i := 1; i < len(nodeNames); i++ { // Fix the indexing due the failed machine being removed from the list var nodeIndex int if i < 4 { // for nodes 0, 1, 2 nodeIndex = i - 1 } else { // for nodes 4 onwards nodeIndex = i } if nodeNames[i].Id != testConfig.nodes[nodeIndex].Spec.ProviderID { t.Fatalf("expected %q, got %q", testConfig.nodes[nodeIndex].Spec.ProviderID, nodeNames[i].Id) } } } // Note: 10 is an upper bound for the number of nodes/replicas // Going beyond 10 will break the sorting that happens in the // test() function because sort.Strings() will not do natural // sorting and the expected semantics in test() will fail. t.Run("MachineSet", func(t *testing.T) { test(t, createMachineSetTestConfig(RandomString(6), RandomString(6), RandomString(6), 10, map[string]string{ nodeGroupMinSizeAnnotationKey: "1", nodeGroupMaxSizeAnnotationKey: "10", })) }) t.Run("MachineDeployment", func(t *testing.T) { test(t, createMachineDeploymentTestConfig(RandomString(6), RandomString(6), RandomString(6), 10, map[string]string{ nodeGroupMinSizeAnnotationKey: "1", nodeGroupMaxSizeAnnotationKey: "10", })) }) }
explode_data.jsonl/19674
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 962 }
[ 2830, 3393, 1955, 2808, 2354, 9408, 21605, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 2915, 1155, 353, 8840, 836, 11, 1273, 2648, 353, 1944, 2648, 8, 341, 197, 61615, 11, 2936, 1669, 1969, 4021, 2271, 2051, 1155, 11, 1273, 2648, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExportScheduleRequest_Validate(t *testing.T) { exportScheduleRequest := &ExportScheduleRequest{} err := exportScheduleRequest.Validate() assert.Equal(t, err.Error(), errors.New("Schedule identifier cannot be empty.").Error()) exportScheduleRequest.IdentifierType = Name exportScheduleRequest.IdentifierValue = "test" err = exportScheduleRequest.Validate() assert.Nil(t, err) }
explode_data.jsonl/64418
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 16894, 32210, 1900, 62, 17926, 1155, 353, 8840, 836, 8, 341, 59440, 32210, 1900, 1669, 609, 16894, 32210, 1900, 16094, 9859, 1669, 7485, 32210, 1900, 47667, 2822, 6948, 12808, 1155, 11, 1848, 6141, 1507, 5975, 7121, 445, 32210...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRestoreTeam(t *testing.T) { th := Setup(t) defer th.TearDown() Client := th.Client createTeam := func(t *testing.T, deleted bool, teamType string) *model.Team { t.Helper() team := &model.Team{ DisplayName: "Some Team", Description: "Some description", CompanyName: "Some company name", AllowOpenInvite: (teamType == model.TEAM_OPEN), InviteId: model.NewId(), Name: "aa-" + model.NewRandomTeamName() + "zz", Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: teamType, } team, _ = Client.CreateTeam(team) require.NotNil(t, team) if deleted { _, resp := th.SystemAdminClient.SoftDeleteTeam(team.Id) CheckOKStatus(t, resp) } return team } teamPublic := createTeam(t, true, model.TEAM_OPEN) t.Run("invalid team", func(t *testing.T) { _, resp := Client.RestoreTeam(model.NewId()) CheckForbiddenStatus(t, resp) }) th.TestForAllClients(t, func(t *testing.T, client *model.Client4) { team := createTeam(t, true, model.TEAM_OPEN) team, resp := client.RestoreTeam(team.Id) CheckOKStatus(t, resp) require.Zero(t, team.DeleteAt) require.Equal(t, model.TEAM_OPEN, team.Type) }, "restore archived public team") th.TestForAllClients(t, func(t *testing.T, client *model.Client4) { team := createTeam(t, true, model.TEAM_INVITE) team, resp := client.RestoreTeam(team.Id) CheckOKStatus(t, resp) require.Zero(t, team.DeleteAt) require.Equal(t, model.TEAM_INVITE, team.Type) }, "restore archived private team") th.TestForAllClients(t, func(t *testing.T, client *model.Client4) { team := createTeam(t, false, model.TEAM_OPEN) team, resp := client.RestoreTeam(team.Id) CheckOKStatus(t, resp) require.Zero(t, team.DeleteAt) require.Equal(t, model.TEAM_OPEN, team.Type) }, "restore active public team") t.Run("not logged in", func(t *testing.T) { Client.Logout() _, resp := Client.RestoreTeam(teamPublic.Id) CheckUnauthorizedStatus(t, resp) }) t.Run("no permission to manage team", func(t *testing.T) { th.LoginBasic2() _, resp := Client.RestoreTeam(teamPublic.Id) CheckForbiddenStatus(t, resp) }) th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { _, resp := client.RestoreTeam(teamPublic.Id) CheckOKStatus(t, resp) }) }
explode_data.jsonl/70706
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 966 }
[ 2830, 3393, 56284, 14597, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 340, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 39263, 14597, 1669, 2915, 1155, 353, 8840, 836, 11, 11062, 1807, 11, 2083, 929, 914, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInvalidProposerJoinAndLeave(t *testing.T) { val1, _ := validator.GenerateTestValidator(0) val2, _ := validator.GenerateTestValidator(1) val3, _ := validator.GenerateTestValidator(2) val4, _ := validator.GenerateTestValidator(3) val5, _ := validator.GenerateTestValidator(4) committee, err := NewCommittee([]*validator.Validator{val1, val2, val3, val4}, 4, val5.Address()) assert.Error(t, err) assert.Nil(t, committee) }
explode_data.jsonl/35318
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 7928, 2008, 23438, 12292, 3036, 21833, 1155, 353, 8840, 836, 8, 341, 19302, 16, 11, 716, 1669, 22935, 57582, 2271, 14256, 7, 15, 340, 19302, 17, 11, 716, 1669, 22935, 57582, 2271, 14256, 7, 16, 340, 19302, 18, 11, 716, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOr(t *testing.T) { assert := require.New(t) assert.Nil(Or()) assert.Nil(Or(nil)) assert.Equal(1, Or(0, 1, 0, 2, 0, 3, 4, 5, 6)) assert.Equal(true, Or(false, false, true)) assert.Equal(`one`, Or(`one`)) assert.Equal(4.0, Or(nil, ``, false, 0, 4.0)) assert.Nil(Or(false, false, false)) assert.Nil(Or(0, 0, 0)) assert.Equal(`three`, Or(``, ``, `three`)) type testStruct struct { name string } assert.Equal(testStruct{`three`}, Or(testStruct{}, testStruct{}, testStruct{`three`})) }
explode_data.jsonl/45566
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 2195, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 1373, 7121, 1155, 692, 6948, 59678, 7, 2195, 2398, 6948, 59678, 7, 2195, 27907, 1171, 6948, 12808, 7, 16, 11, 2521, 7, 15, 11, 220, 16, 11, 220, 15, 11, 220, 17, 11, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidateVolumeMounts(t *testing.T) { volumes := util.NewStringSet("abc", "123", "abc-123") successCase := []api.VolumeMount{ {Name: "abc", MountPath: "/foo"}, {Name: "123", MountPath: "/foo"}, {Name: "abc-123", MountPath: "/bar"}, } if errs := validateVolumeMounts(successCase, volumes); len(errs) != 0 { t.Errorf("expected success: %v", errs) } errorCases := map[string][]api.VolumeMount{ "empty name": {{Name: "", MountPath: "/foo"}}, "name not found": {{Name: "", MountPath: "/foo"}}, "empty mountpath": {{Name: "abc", MountPath: ""}}, } for k, v := range errorCases { if errs := validateVolumeMounts(v, volumes); len(errs) == 0 { t.Errorf("expected failure for %s", k) } } }
explode_data.jsonl/62789
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 287 }
[ 2830, 3393, 17926, 18902, 16284, 82, 1155, 353, 8840, 836, 8, 341, 5195, 19705, 1669, 4094, 7121, 703, 1649, 445, 13683, 497, 330, 16, 17, 18, 497, 330, 13683, 12, 16, 17, 18, 5130, 30553, 4207, 1669, 3056, 2068, 79106, 16284, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestImplementsRestHandlerFinder(t *testing.T) { r := New("/test") var i *RestHandlerFinder err := AssertThat(r, Implements(i)) if err != nil { t.Fatal(err) } }
explode_data.jsonl/10010
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 1427, 4674, 12416, 3050, 42300, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 4283, 1944, 1138, 2405, 600, 353, 12416, 3050, 42300, 198, 9859, 1669, 5319, 4792, 2601, 11, 49960, 1956, 1171, 743, 1848, 961, 2092, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestParseCachePolicy(t *testing.T) { tcs := []struct { in *CachePolicy out *service.CachePolicy err error }{ {in: &CachePolicy{EnabledFlag: "yes", TTL: "never"}, out: &service.CachePolicy{Enabled: true}}, {in: &CachePolicy{EnabledFlag: "true", TTL: "10h"}, out: &service.CachePolicy{Enabled: true}}, {in: &CachePolicy{Type: "whatever", EnabledFlag: "false", TTL: "10h"}, out: &service.CachePolicy{Enabled: false}}, {in: &CachePolicy{Type: "name", EnabledFlag: "yes", TTL: "never"}, out: &service.CachePolicy{Enabled: true}}, {in: &CachePolicy{EnabledFlag: "no"}, out: &service.CachePolicy{Enabled: false}}, } for i, tc := range tcs { comment := fmt.Sprintf("test case #%v", i) out, err := tc.in.Parse() if tc.err != nil { require.IsType(t, tc.err, err, comment) } else { require.NoError(t, err, comment) require.Equal(t, out, tc.out, comment) } } }
explode_data.jsonl/47169
{ "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, 14463, 8233, 13825, 1155, 353, 8840, 836, 8, 341, 3244, 4837, 1669, 3056, 1235, 341, 197, 17430, 220, 353, 8233, 13825, 198, 197, 13967, 353, 7936, 46130, 13825, 198, 197, 9859, 1465, 198, 197, 59403, 197, 197, 90, 258, 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...
3
func TestJoinJoinsInputLinesIntoSpaceSeparatedString(t *testing.T) { t.Parallel() input := "hello\nfrom\nthe\njoin\ntest" want := "hello from the join test\n" got, err := script.Echo(input).Join().String() if err != nil { t.Error(err) } if got != want { t.Errorf("want %q, got %q", want, got) } }
explode_data.jsonl/51482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 12292, 22493, 1330, 2505, 16794, 26591, 9914, 91925, 703, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 22427, 1669, 330, 14990, 1699, 1499, 1699, 1782, 1699, 5987, 59, 406, 477, 698, 50780, 1669, 330, 14990, 504, 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...
3
func TestGraphInstallWithReleaseNamePrefix(t *testing.T) { prefix := "metahelm-test-prefix-" fkc := fakeKubernetesClientset(t, DefaultK8sNamespace, testCharts) cfg := fakeHelmConfiguration(t) m := Manager{ LogF: t.Logf, K8c: fkc, HCfg: cfg, } ChartWaitPollInterval = 1 * time.Second rm, err := m.Install(context.Background(), testCharts, WithReleaseNamePrefix(prefix)) if err != nil { t.Fatalf("error installing: %v", err) } t.Logf("rm: %v\n", rm) }
explode_data.jsonl/69439
{ "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, 11212, 24690, 2354, 16077, 675, 14335, 1155, 353, 8840, 836, 8, 341, 3223, 5060, 1669, 330, 4059, 1466, 23162, 16839, 67181, 12, 698, 1166, 31378, 1669, 12418, 42, 29827, 2959, 746, 1155, 11, 7899, 42, 23, 82, 22699, 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...
2
func TestContanierSpecFromV1(t *testing.T) { v1Spec := v1.ContainerSpec{ CreationTime: timestamp, Labels: labels, HasCpu: true, Cpu: v1.CpuSpec{ Limit: 2048, MaxLimit: 4096, Mask: "cpu_mask", }, HasMemory: true, Memory: v1.MemorySpec{ Limit: 2048, Reservation: 1024, SwapLimit: 8192, }, HasNetwork: true, HasFilesystem: true, HasDiskIo: true, HasCustomMetrics: true, CustomMetrics: []v1.MetricSpec{{ Name: "foo", Type: v1.MetricGauge, Format: v1.IntType, Units: "bars", }}, Image: "gcr.io/kubernetes/kubernetes:v1", } aliases := []string{"baz", "oof"} namespace := "foo_bar_baz" expectedV2Spec := ContainerSpec{ CreationTime: timestamp, Labels: labels, HasCpu: true, Cpu: CpuSpec{ Limit: 2048, MaxLimit: 4096, Mask: "cpu_mask", }, HasMemory: true, Memory: MemorySpec{ Limit: 2048, Reservation: 1024, SwapLimit: 8192, }, HasNetwork: true, HasFilesystem: true, HasDiskIo: true, HasCustomMetrics: true, CustomMetrics: []v1.MetricSpec{{ Name: "foo", Type: v1.MetricGauge, Format: v1.IntType, Units: "bars", }}, Image: "gcr.io/kubernetes/kubernetes:v1", Aliases: aliases, Namespace: namespace, } v2Spec := ContainerSpecFromV1(&v1Spec, aliases, namespace) if !reflect.DeepEqual(v2Spec, expectedV2Spec) { t.Errorf("Converted spec differs from expectation!\nExpected: %+v\n Got: %+v\n", expectedV2Spec, v2Spec) } }
explode_data.jsonl/10989
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 769 }
[ 2830, 3393, 818, 276, 1268, 8327, 3830, 53, 16, 1155, 353, 8840, 836, 8, 341, 5195, 16, 8327, 1669, 348, 16, 33672, 8327, 515, 197, 6258, 26453, 1462, 25, 11441, 345, 197, 197, 23674, 25, 981, 9201, 345, 197, 197, 10281, 34, 5584, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExitAfterContinue(t *testing.T) { protest.AllowRecording(t) withTestProcess("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.sayhi") assertNoError(p.Continue(), t, "First Continue()") err := p.Continue() pe, ok := err.(proc.ErrProcessExited) if !ok { t.Fatalf("Continue() returned unexpected error type %s", pe) } if pe.Status != 0 { t.Errorf("Unexpected error status: %d", pe.Status) } if pe.Pid != p.Pid() { t.Errorf("Unexpected process id: %d", pe.Pid) } }) }
explode_data.jsonl/56198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 15339, 6025, 23526, 1155, 353, 8840, 836, 8, 341, 197, 776, 1944, 29081, 52856, 1155, 340, 46948, 2271, 7423, 445, 21319, 13807, 477, 32992, 497, 259, 11, 2915, 1295, 353, 15782, 35016, 11, 12507, 8665, 991, 12735, 8, 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...
4
func TestScheduleAfterRemoval(t *testing.T) { var wg1 sync.WaitGroup var wg2 sync.WaitGroup wg1.Add(1) wg2.Add(1) // The first time this job is run, set a timer and remove the other job // 750ms later. Correct behavior would be to still run the job again in // 250ms, but the bug would cause it to run instead 1s later. var calls int var mu sync.Mutex cron := newWithSeconds() hourJob := cron.Schedule(Every(time.Hour), FuncJob(func() {})) cron.Schedule(Every(time.Second), FuncJob(func() { mu.Lock() defer mu.Unlock() switch calls { case 0: wg1.Done() calls++ case 1: time.Sleep(750 * time.Millisecond) cron.Remove(hourJob) calls++ case 2: calls++ wg2.Done() case 3: panic("unexpected 3rd call") } })) cron.Start() defer cron.Stop() // the first run might be any length of time 0 - 1s, since the schedule // rounds to the second. wait for the first run to true up. wg1.Wait() select { case <-time.After(2 * OneSecond): t.Error("expected job fires 2 times") case <-wait(&wg2): } }
explode_data.jsonl/8312
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 32210, 6025, 6590, 13516, 1155, 353, 8840, 836, 8, 341, 2405, 63581, 16, 12811, 28384, 2808, 198, 2405, 63581, 17, 12811, 28384, 2808, 198, 72079, 16, 1904, 7, 16, 340, 72079, 17, 1904, 7, 16, 692, 197, 322, 576, 1156, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReconcileServiceInstanceUpdateMissingObservedGeneration(t *testing.T) { _, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{ UpdateInstanceReaction: &fakeosb.UpdateInstanceReaction{ Response: &osb.UpdateInstanceResponse{}, }, }) sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker()) sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass()) sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan()) instance := getTestServiceInstanceWithClusterRefs() instance.Generation = 2 instance.Status.ReconciledGeneration = 1 // Missing ObservedGeneration and Provisioned after updating Service Catalog instance.Status.ObservedGeneration = 0 instance.Status.ProvisionStatus = v1beta1.ServiceInstanceProvisionStatusNotProvisioned instance.Status.DeprovisionStatus = v1beta1.ServiceInstanceDeprovisionStatusRequired instance.Status.ExternalProperties = &v1beta1.ServiceInstancePropertiesState{ ClusterServicePlanExternalName: testClusterServicePlanName, ClusterServicePlanExternalID: testClusterServicePlanGUID, } if err := reconcileServiceInstance(t, testController, instance); err != nil { t.Fatalf("This should not fail : %v", err) } brokerActions := fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 0) actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) updatedServiceInstance := assertUpdateStatus(t, actions[0], instance).(*v1beta1.ServiceInstance) if updatedServiceInstance.Status.ObservedGeneration == 0 || updatedServiceInstance.Status.ObservedGeneration != instance.Status.ReconciledGeneration { t.Fatalf("Unexpected ObservedGeneration value: %d", updatedServiceInstance.Status.ObservedGeneration) } if updatedServiceInstance.Status.ProvisionStatus != v1beta1.ServiceInstanceProvisionStatusProvisioned { t.Fatalf("The instance was expected to be marked as Provisioned") } }
explode_data.jsonl/58204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 608 }
[ 2830, 3393, 693, 40446, 457, 1860, 2523, 4289, 25080, 66111, 2771, 37138, 1155, 353, 8840, 836, 8, 341, 197, 6878, 12418, 41606, 2959, 11, 12418, 28678, 1860, 65545, 2959, 11, 1273, 2051, 11, 6094, 37891, 388, 1669, 501, 2271, 2051, 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...
5
func TestWriteClusterConfigWithOIDCAndGitOps(t *testing.T) { clusterSpec := test.NewClusterSpec(func(s *cluster.Spec) { s.Cluster.APIVersion = v1alpha1.GroupVersion.String() s.Cluster.TypeMeta.Kind = v1alpha1.ClusterKind s.Cluster.CreationTimestamp = v1.Time{Time: time.Now()} s.Cluster.Name = "mycluster" s.Cluster.Spec.ExternalEtcdConfiguration = &v1alpha1.ExternalEtcdConfiguration{ Count: 3, } s.Cluster.Spec.GitOpsRef = &v1alpha1.Ref{ Kind: v1alpha1.GitOpsConfigKind, Name: "config", } s.Cluster.Spec.IdentityProviderRefs = []v1alpha1.Ref{ { Kind: v1alpha1.OIDCConfigKind, Name: "config", }, } s.OIDCConfig = &v1alpha1.OIDCConfig{ TypeMeta: v1.TypeMeta{ Kind: v1alpha1.OIDCConfigKind, APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: v1.ObjectMeta{ Name: "config", CreationTimestamp: v1.Time{Time: time.Now()}, }, Spec: v1alpha1.OIDCConfigSpec{ IssuerUrl: "https://url", }, } s.GitOpsConfig = &v1alpha1.GitOpsConfig{ TypeMeta: v1.TypeMeta{ Kind: v1alpha1.GitOpsConfigKind, APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: v1.ObjectMeta{ Name: "config", CreationTimestamp: v1.Time{Time: time.Now()}, }, Spec: v1alpha1.GitOpsConfigSpec{ Flux: v1alpha1.Flux{ Github: v1alpha1.Github{ Owner: "me", }, }, }, } s.SetSelfManaged() }) datacenterConfig := &v1alpha1.VSphereDatacenterConfig{ TypeMeta: v1.TypeMeta{ Kind: v1alpha1.VSphereDatacenterKind, APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: v1.ObjectMeta{ Name: "config", CreationTimestamp: v1.Time{Time: time.Now()}, }, Spec: v1alpha1.VSphereDatacenterConfigSpec{ Server: "https://url", }, } machineConfigs := []providers.MachineConfig{ &v1alpha1.VSphereMachineConfig{ TypeMeta: v1.TypeMeta{ Kind: v1alpha1.VSphereMachineConfigKind, APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: v1.ObjectMeta{ Name: "machineconf-1", CreationTimestamp: v1.Time{Time: time.Now()}, }, Spec: v1alpha1.VSphereMachineConfigSpec{ Folder: "my-folder", }, }, &v1alpha1.VSphereMachineConfig{ TypeMeta: v1.TypeMeta{ Kind: v1alpha1.VSphereMachineConfigKind, APIVersion: v1alpha1.GroupVersion.String(), }, ObjectMeta: v1.ObjectMeta{ Name: "machineconf-2", CreationTimestamp: v1.Time{Time: time.Now()}, }, Spec: v1alpha1.VSphereMachineConfigSpec{ Folder: "my-folder", }, }, } g := NewWithT(t) folder, writer := test.NewWriter(t) gotFile := filepath.Join(folder, "mycluster-eks-a-cluster.yaml") g.Expect(clustermarshaller.WriteClusterConfig(clusterSpec, datacenterConfig, machineConfigs, writer)).To(Succeed()) test.AssertFilesEquals(t, gotFile, "testdata/expected_marshalled_cluster.yaml") }
explode_data.jsonl/34555
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1384 }
[ 2830, 3393, 7985, 28678, 2648, 2354, 29805, 34, 3036, 46562, 38904, 1155, 353, 8840, 836, 8, 341, 197, 18855, 8327, 1669, 1273, 7121, 28678, 8327, 18552, 1141, 353, 18855, 36473, 8, 341, 197, 1903, 72883, 24922, 5637, 284, 348, 16, 7141...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStyled_DoesNotModifyArgument(t *testing.T) { Test(t, That("x = (styled text); _ = (styled $x red); put $x[0][fg-color]"). Puts("default"), That("x = (styled-segment text); _ = (styled $x red); put $x[fg-color]"). Puts("default"), ) }
explode_data.jsonl/6984
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 34180, 1557, 7072, 2623, 44427, 9171, 1155, 353, 8840, 836, 8, 341, 73866, 1155, 345, 197, 197, 4792, 445, 87, 284, 320, 22849, 1467, 1215, 716, 284, 320, 22849, 400, 87, 2518, 1215, 2182, 400, 87, 58, 15, 1457, 4817, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSessionHealthCheck(t *testing.T) { t.Parallel() if testing.Short() { t.SkipNow() } sp, sc, cleanup := setup(t, SessionPoolConfig{}) defer cleanup() // Test pinging sessions. sh, err := sp.take(context.Background()) if err != nil { t.Errorf("cannot get session from session pool: %v", err) } // Wait for healthchecker to send pings to session. waitFor(t, func() error { pings := sc.DumpPings() if len(pings) == 0 || pings[0] != sh.getID() { return fmt.Errorf("healthchecker didn't send any ping to session %v", sh.getID()) } return nil }) // Test broken session detection. sh, err = sp.take(context.Background()) if err != nil { t.Errorf("cannot get session from session pool: %v", err) } sc.InjectError("GetSession", status.Errorf(codes.NotFound, "Session not found:")) // Wait for healthcheck workers to find the broken session and tear it down. <-time.After(1 * time.Second) s := sh.session if sh.session.isValid() { t.Errorf("session(%v) is still alive, want it to be dropped by healthcheck workers", s) } sc.InjectError("GetSession", nil) // Test garbage collection. sh, err = sp.take(context.Background()) if err != nil { t.Errorf("cannot get session from session pool: %v", err) } sp.close() if sh.session.isValid() { t.Errorf("session(%v) is still alive, want it to be garbage collected", s) } }
explode_data.jsonl/78706
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 493 }
[ 2830, 3393, 5283, 14542, 3973, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 7039, 741, 197, 630, 41378, 11, 1136, 11, 21290, 1669, 6505, 1155, 11, 9164, 10551, 2648, 37790, 16867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadNews(t *testing.T) { db := New(config.DatabaseConfig{ Name: "fusion", Host: "127.0.0.1", Port: 3306, User: "root", Password: "password", }) news, err := db.News(0, 1) if err != nil { t.Error(err) } assert.Equal(t, 1, len(news)) }
explode_data.jsonl/17812
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 4418, 14373, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 1532, 8754, 25008, 2648, 515, 197, 21297, 25, 257, 330, 54565, 756, 197, 197, 9296, 25, 257, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 756, 197, 98459, 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 TestGetUIDsWithNoSyncs(t *testing.T) { req := makeRequest("/getuids", map[string]string{}) endpoint := NewGetUIDsEndpoint(config.HostCookie{}) res := httptest.NewRecorder() endpoint(res, req, nil) assert.Equal(t, http.StatusOK, res.Code) assert.JSONEq(t, `{}`, res.Body.String(), "GetUIDs endpoint shouldn't return anything if there don't exist any user syncs") }
explode_data.jsonl/55872
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 1949, 6463, 16056, 2753, 12154, 82, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 1281, 1900, 4283, 455, 91216, 497, 2415, 14032, 30953, 37790, 6246, 2768, 1669, 1532, 1949, 6463, 82, 27380, 8754, 29840, 20616, 37790, 10202, 1669...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetPidMode(t *testing.T) { // test false pod := &api.Pod{} pidMode := getPidMode(pod) if pidMode != "" { t.Errorf("expected empty pid mode for pod but got %v", pidMode) } // test true pod.Spec.SecurityContext = &api.PodSecurityContext{} pod.Spec.SecurityContext.HostPID = true pidMode = getPidMode(pod) if pidMode != "host" { t.Errorf("expected host pid mode for pod but got %v", pidMode) } }
explode_data.jsonl/31180
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 1949, 32339, 3636, 1155, 353, 8840, 836, 8, 341, 197, 322, 1273, 895, 198, 3223, 347, 1669, 609, 2068, 88823, 16094, 78799, 3636, 1669, 633, 32339, 3636, 1295, 347, 692, 743, 14814, 3636, 961, 1591, 341, 197, 3244, 13080, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatchMethod(t *testing.T) { hreq := &definition.Request{} hreq.Method = "GET" mreq := &definition.Request{} mreq.Method = "GET" m := MockMatch{} if m, err := m.Match(hreq, mreq); !m { t.Error(err) } mreq.Method = "POST" if m, _ := m.Match(hreq, mreq); m { t.Error("Not expected match") } }
explode_data.jsonl/1087
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 8331, 3523, 1155, 353, 8840, 836, 8, 341, 9598, 2958, 1669, 609, 18375, 9659, 16094, 9598, 2958, 20798, 284, 330, 3806, 698, 2109, 2958, 1669, 609, 18375, 9659, 16094, 2109, 2958, 20798, 284, 330, 3806, 698, 2109, 1669, 1456...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptyMatcher(t *testing.T) { testInputs(t, ` `, []TestInput{ {URL: "", Matched: false}, {URL: "foo", Matched: false}, }) }
explode_data.jsonl/81611
{ "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, 3522, 37554, 1155, 353, 8840, 836, 8, 341, 18185, 31946, 1155, 11, 1565, 271, 12892, 197, 197, 1294, 2271, 2505, 515, 298, 197, 90, 3144, 25, 7342, 14152, 291, 25, 895, 1583, 298, 197, 90, 3144, 25, 330, 7975, 497, 14152...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApiTest_MatchesResponseHttpCookies_OnlySuppliedFields(t *testing.T) { parsedDateTime, err := time.Parse(time.RFC3339, "2019-01-26T23:19:02Z") if err != nil { t.Fatalf("%s", err) } handler := http.NewServeMux() handler.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { http.SetCookie(w, &http.Cookie{ Name: "session_id", Value: "pdsanjdna_8e8922", Path: "/", Expires: parsedDateTime, Secure: true, HttpOnly: true, }) w.WriteHeader(http.StatusOK) }) apitest.New(). Handler(handler). Get("/hello"). Expect(t). Cookies( apitest.NewCookie("session_id"). Value("pdsanjdna_8e8922"). Path("/"). Expires(parsedDateTime). Secure(true). HttpOnly(true)). End() }
explode_data.jsonl/54805
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 6563, 2271, 1245, 9118, 2582, 2905, 50672, 62, 7308, 10048, 3440, 8941, 1155, 353, 8840, 836, 8, 341, 3223, 18112, 7689, 11, 1848, 1669, 882, 8937, 9730, 2013, 6754, 18, 18, 18, 24, 11, 330, 17, 15, 16, 24, 12, 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 TestRowTableShow(t *testing.T) { map_dao := &TableRowShowImpl{&DaoImpl{}} service := service.MakeTableRowService(map_dao) result := service.Show("523", "92") if !result.IsSuccess() { t.Errorf("Could not get details") } _, ok := result.GetDataByKey("data") if !ok { t.Errorf("data is not present in result") } }
explode_data.jsonl/15452
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 3102, 2556, 7812, 1155, 353, 8840, 836, 8, 341, 19567, 814, 3441, 1669, 609, 38558, 7812, 9673, 90, 5, 12197, 9673, 6257, 532, 52934, 1669, 2473, 50133, 38558, 1860, 9147, 814, 3441, 340, 9559, 1669, 2473, 9060, 445, 20, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSimulateMsgCreatePool(t *testing.T) { app, ctx := createTestApp(false) // setup a single account s := rand.NewSource(1) r := rand.New(s) accounts := getTestingAccounts(t, r, app, ctx, 1) // setup randomly generated liquidity pool creation fees feeCoins := simulation.GenPoolCreationFee(r) params := app.LiquidityKeeper.GetParams(ctx) params.PoolCreationFee = feeCoins app.LiquidityKeeper.SetParams(ctx, params) // begin a new block app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: app.LastBlockHeight() + 1, AppHash: app.LastCommitID().Hash}}) // execute operation op := simulation.SimulateMsgCreatePool(app.AccountKeeper, app.BankKeeper, app.LiquidityKeeper) operationMsg, futureOperations, err := op(r, app.BaseApp, ctx, accounts, "") require.NoError(t, err) var msg types.MsgCreatePool require.NoError(t, types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg)) require.True(t, operationMsg.OK) require.Equal(t, "cosmos1tnh2q55v8wyygtt9srz5safamzdengsnqeycj3", msg.GetPoolCreator().String()) require.Equal(t, types.DefaultPoolTypeId, msg.PoolTypeId) require.Equal(t, "171625357wLfFy,279341739zDmT", msg.DepositCoins.String()) require.Equal(t, types.TypeMsgCreatePool, msg.Type()) require.Len(t, futureOperations, 0) }
explode_data.jsonl/32401
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 474 }
[ 2830, 3393, 14027, 6334, 6611, 4021, 10551, 1155, 353, 8840, 836, 8, 341, 28236, 11, 5635, 1669, 1855, 2271, 2164, 3576, 692, 197, 322, 6505, 264, 3175, 2692, 198, 1903, 1669, 10382, 7121, 3608, 7, 16, 340, 7000, 1669, 10382, 7121, 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 TestMonitor(t *testing.T) { if _, isPresent := os.LookupEnv("FEATURE_TEST_ONLY_ENV_RUNNING"); !isPresent { t.Skip() } defer goleak.VerifyNone(t) // Configuration for the process via env vars. os.Setenv("KAFKA_BROKERS", "localhost:29092") os.Setenv("KAFKA_CLIENT_ID", "client") os.Setenv("KAFKA_SECURITY_PROTOCOL", "PLAINTEXT") os.Setenv("KAFKA_SASL_MECHANISM", "PLAIN") os.Setenv("KAFKA_SASL_USERNAME", "") os.Setenv("KAFKA_SASL_PASSWORD", "") os.Setenv("KAFKA_TRANSMISSION_TOPIC", "transmission") os.Setenv("KAFKA_CONFIG_SET_SIMPLIFIED_TOPIC", "config_set_simplified") os.Setenv("SCHEMA_REGISTRY_URL", "http://localhost:8989") os.Setenv("SCHEMA_REGISTRY_USERNAME", "") os.Setenv("SCHEMA_REGISTRY_PASSWORD", "") os.Setenv("FEEDS_URL", "http://some-feeds.com") os.Setenv("HTTP_ADDRESS", "http://localhost:3000") defer os.Unsetenv("KAFKA_BROKERS") defer os.Unsetenv("KAFKA_CLIENT_ID") defer os.Unsetenv("KAFKA_SECURITY_PROTOCOL") defer os.Unsetenv("KAFKA_SASL_MECHANISM") defer os.Unsetenv("KAFKA_SASL_USERNAME") defer os.Unsetenv("KAFKA_SASL_PASSWORD") defer os.Unsetenv("KAFKA_TRANSMISSION_TOPIC") defer os.Unsetenv("KAFKA_CONFIG_SET_SIMPLIFIED_TOPIC") defer os.Unsetenv("SCHEMA_REGISTRY_URL") defer os.Unsetenv("SCHEMA_REGISTRY_USERNAME") defer os.Unsetenv("SCHEMA_REGISTRY_PASSWORD") defer os.Unsetenv("FEEDS_URL") defer os.Unsetenv("HTTP_ADDRESS") ctx, cancel := context.WithTimeout(context.Background(), testMonitorDurationSec*time.Second) defer cancel() chainConfig := fakeChainConfig{ ReadTimeout: 100 * time.Millisecond, PollInterval: 100 * time.Millisecond, } monitor, err := NewMonitor( ctx, newNullLogger(), chainConfig, &fakeRandomDataSourceFactory{make(chan interface{})}, &fakeRandomDataSourceFactory{make(chan interface{})}, func(buf io.ReadCloser) ([]FeedConfig, error) { return []FeedConfig{}, nil }, func(buf io.ReadCloser) ([]NodeConfig, error) { return []NodeConfig{}, nil }, ) require.NoError(t, err) monitorWg := &sync.WaitGroup{} monitorWg.Add(1) go func() { defer monitorWg.Done() monitor.Run() }() // Wait for the monitor to start. <-time.After(5 * time.Second) kafkaConfig := &kafka.ConfigMap{ "bootstrap.servers": "localhost:29092", "client.id": "test-monitor", "group.id": "test-monitor", "security.protocol": "PLAINTEXT", "sasl.mechanisms": "PLAIN", "auto.offset.reset": "earliest", } consumerConfig, err := kafka.NewConsumer(kafkaConfig) require.NoError(t, err) err = consumerConfig.Subscribe("config_set_simplified", nil) require.NoError(t, err) consumerTransmission, err := kafka.NewConsumer(kafkaConfig) require.NoError(t, err) err = consumerTransmission.Subscribe("transmission", nil) require.NoError(t, err) // Wait for the subscriptions to start. <-time.After(2 * time.Second) var transmissionsCounter uint64 = 0 var configsCounter uint64 = 0 countersWg := &sync.WaitGroup{} countersWg.Add(2) go func() { defer countersWg.Done() for i := 0; i < 10; { select { case <-ctx.Done(): return default: event := consumerTransmission.Poll(500) if event != nil { atomic.AddUint64(&transmissionsCounter, 1) i++ } } } }() go func() { defer countersWg.Done() for i := 0; i < 10; { select { case <-ctx.Done(): return default: event := consumerConfig.Poll(500) if event != nil { atomic.AddUint64(&configsCounter, 1) i++ } } } }() countersWg.Wait() cancel() monitorWg.Wait() err = consumerConfig.Unsubscribe() require.NoError(t, err) err = consumerTransmission.Unsubscribe() require.NoError(t, err) require.Equal(t, uint64(10), configsCounter) require.Equal(t, uint64(10), transmissionsCounter) }
explode_data.jsonl/30266
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1595 }
[ 2830, 3393, 30098, 1155, 353, 8840, 836, 8, 341, 743, 8358, 374, 21195, 1669, 2643, 79261, 14359, 445, 71913, 11641, 31263, 22027, 70246, 5038, 753, 285, 21195, 341, 197, 3244, 57776, 741, 197, 532, 16867, 728, 273, 585, 54853, 4064, 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 TestUpdateDefaultLabels(t *testing.T) { testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */) testKubelet.kubelet.kubeClient = nil // ensure only the heartbeat client is used cases := []struct { name string initialNode *v1.Node existingNode *v1.Node needsUpdate bool finalLabels map[string]string }{ { name: "make sure default labels exist", initialNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, }, existingNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, }, needsUpdate: true, finalLabels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, { name: "make sure default labels are up to date", initialNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, }, existingNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "old-hostname", kubeletapis.LabelZoneFailureDomain: "old-zone-failure-domain", kubeletapis.LabelZoneRegion: "old-zone-region", kubeletapis.LabelInstanceType: "old-instance-type", kubeletapis.LabelOS: "old-os", kubeletapis.LabelArch: "old-arch", }, }, }, needsUpdate: true, finalLabels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, { name: "make sure existing labels do not get deleted", initialNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, }, existingNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", "please-persist": "foo", }, }, }, needsUpdate: false, finalLabels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", "please-persist": "foo", }, }, { name: "make sure existing labels do not get deleted when initial node has no opinion", initialNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{}, }, }, existingNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", "please-persist": "foo", }, }, }, needsUpdate: false, finalLabels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", "please-persist": "foo", }, }, { name: "no update needed", initialNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, }, existingNode: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, }, needsUpdate: false, finalLabels: map[string]string{ kubeletapis.LabelHostname: "new-hostname", kubeletapis.LabelZoneFailureDomain: "new-zone-failure-domain", kubeletapis.LabelZoneRegion: "new-zone-region", kubeletapis.LabelInstanceType: "new-instance-type", kubeletapis.LabelOS: "new-os", kubeletapis.LabelArch: "new-arch", }, }, } for _, tc := range cases { defer testKubelet.Cleanup() kubelet := testKubelet.kubelet needsUpdate := kubelet.updateDefaultLabels(tc.initialNode, tc.existingNode) assert.Equal(t, tc.needsUpdate, needsUpdate, tc.name) assert.Equal(t, tc.finalLabels, tc.existingNode.Labels, tc.name) } }
explode_data.jsonl/69723
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3644 }
[ 2830, 3393, 4289, 3675, 23674, 1155, 353, 8840, 836, 8, 341, 18185, 42, 3760, 1149, 1669, 501, 2271, 42, 3760, 1149, 1155, 11, 895, 1391, 6461, 30485, 89306, 5462, 639, 340, 18185, 42, 3760, 1149, 5202, 3760, 1149, 5202, 3760, 2959, 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 TestNewEntity(t *testing.T) { e := testMakeEntity() expected := "cc sava" if b, err := ioutil.ReadAll(e.Body); err != nil { t.Error("Expected no error while reading entity body, got", err) } else if s := string(b); s != expected { t.Errorf("Expected %q as entity body but got %q", expected, s) } }
explode_data.jsonl/30547
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 3564, 3030, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 1273, 8078, 3030, 2822, 42400, 1669, 330, 638, 274, 2907, 698, 743, 293, 11, 1848, 1669, 43144, 41851, 2026, 20934, 1215, 1848, 961, 2092, 341, 197, 3244, 6141, 445, 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...
3
func TestClient_mtlsNetRPCClient(t *testing.T) { process := helperProcess("test-interface-mtls") c := NewClient(&ClientConfig{ AutoMTLS: true, Cmd: process, HandshakeConfig: testVersionedHandshake, Plugins: testPluginMap, AllowedProtocols: []Protocol{ProtocolNetRPC}, }) defer c.Kill() if _, err := c.Start(); err != nil { t.Fatalf("err: %s", err) } // Grab the RPC client client, err := c.Client() if err != nil { t.Fatalf("err should be nil, got %s", err) } // Grab the impl raw, err := client.Dispense("test") if err != nil { t.Fatalf("err should be nil, got %s", err) } tester, ok := raw.(testInterface) if !ok { t.Fatalf("bad: %#v", raw) } n := tester.Double(3) if n != 6 { t.Fatal("invalid response", n) } c.process.Kill() select { case <-c.doneCtx.Done(): case <-time.After(time.Second * 2): t.Fatal("Context was not closed") } }
explode_data.jsonl/57861
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 398 }
[ 2830, 3393, 2959, 717, 34488, 6954, 29528, 2959, 1155, 353, 8840, 836, 8, 341, 53314, 1669, 13137, 7423, 445, 1944, 82954, 1448, 34488, 1138, 1444, 1669, 1532, 2959, 2099, 2959, 2648, 515, 197, 197, 13253, 8505, 7268, 25, 260, 830, 345,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHTTPPost(t *testing.T) { context.CorrelationID = "123" handler := func(w http.ResponseWriter, r *http.Request) { if r.URL.EscapedPath() == badPath { w.WriteHeader(http.StatusNotFound) return } w.WriteHeader(http.StatusOK) readMsg, _ := ioutil.ReadAll(r.Body) r.Body.Close() if strings.Compare((string)(readMsg), msgStr) != 0 { t.Errorf("Invalid msg received %v, expected %v", readMsg, msgStr) } if r.Header.Get("Content-type") != "application/json" { t.Errorf("Unexpected content-type received %s, expected %s", r.Header.Get("Content-type"), "application/json") } if r.URL.EscapedPath() != path { t.Errorf("Invalid path received %s, expected %s", r.URL.EscapedPath(), path) } } // create test server with handler ts := httptest.NewServer(http.HandlerFunc(handler)) defer ts.Close() url, err := url.Parse(ts.URL) require.NoError(t, err) tests := []struct { Name string Path string PersistOnFail bool RetryDataSet bool }{ {"Successful post", path, true, false}, {"Failed Post no persist", badPath, false, false}, {"Failed Post with persist", badPath, true, true}, } for _, test := range tests { t.Run(test.Name, func(t *testing.T) { sender := NewHTTPSender(`http://`+url.Host+test.Path, "", test.PersistOnFail) sender.HTTPPost(context, msgStr) assert.Equal(t, test.RetryDataSet, context.RetryData != nil) }) } }
explode_data.jsonl/75578
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 570 }
[ 2830, 3393, 9230, 4133, 1155, 353, 8840, 836, 8, 1476, 28413, 63560, 22221, 915, 284, 330, 16, 17, 18, 1837, 53326, 1669, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 1476, 197, 743, 435, 20893, 5142, 2388, 10185, 1820, 368, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatch_Inter(t *testing.T) { var testData = []struct { rawYql string data map[string]interface{} out bool }{ { rawYql: `letter ∩ ('a','b','c','d','e')`, data: map[string]interface{}{ "letter": []string{"a", "e"}, }, out: true, }, { rawYql: `letter !∩ (1,2,3)`, data: map[string]interface{}{ "letter": []float64{0.5, 3.01}, }, out: true, }, { rawYql: `letter ∩ ('a', 'b','c','d', 'e')`, data: map[string]interface{}{ "letter": []string{"a", "e", "f"}, }, out: true, }, { rawYql: `letter ∩ ('a','b','c', 'd', 'e')`, data: map[string]interface{}{ "letter": []string{"f"}, }, out: false, }, { rawYql: `letter ∩ ('a','b','c','d')`, data: map[string]interface{}{ "letter": "c", }, out: true, }, { rawYql: `letter ∩ (1,2,3)`, data: map[string]interface{}{ "letter": []float64{2.0, 3.0}, }, out: true, }, { rawYql: `letter ∩ (1,2,3)`, data: map[string]interface{}{ "letter": []int64{2, 5}, }, out: true, }, { rawYql: `letter !∩ (1,2,3)`, data: map[string]interface{}{ "letter": []int64{4, 5}, }, out: true, }, } ass := assert.New(t) for _, tc := range testData { ok, err := Match(tc.rawYql, tc.data) ass.NoError(err) ass.Equal(tc.out, ok, "rawYql=%s||data=%+v", tc.rawYql, tc.data) } }
explode_data.jsonl/65944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 734 }
[ 2830, 3393, 8331, 79717, 1155, 353, 8840, 836, 8, 341, 2405, 67348, 284, 3056, 1235, 341, 197, 76559, 56, 1470, 914, 198, 197, 8924, 256, 2415, 14032, 31344, 16094, 197, 13967, 262, 1807, 198, 197, 59403, 197, 197, 515, 298, 76559, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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