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 TestNodeProperty(t *testing.T) {
labels := make(map[string]string)
labels["label1"] = "value1"
labels["label2"] = "valuel2"
node := &api.Node{
TypeMeta: metav1.TypeMeta{
Kind: "Node",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: "my-node-1",
UID: "my-node-1-UID",
Labels: labels,
},
}
ps := BuildNodeProperties(node)
nodeName := GetNodeNameFromProperty(ps)
if nodeName != node.Name {
t.Errorf("Failed to get node name from perperties: %+v", ps)
}
} | explode_data.jsonl/75720 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 230
} | [
2830,
3393,
1955,
3052,
1155,
353,
8840,
836,
8,
341,
95143,
1669,
1281,
9147,
14032,
30953,
340,
95143,
1183,
1502,
16,
1341,
284,
330,
957,
16,
698,
95143,
1183,
1502,
17,
1341,
284,
330,
831,
4000,
17,
1837,
20831,
1669,
609,
2068,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewFileWatcher(t *testing.T) {
w := createTestWatcher(t)
assert.Equal(t, w.notify, "/tmp/notifytest")
assert.NotNil(t, w.fsWatcher)
assert.NotNil(t, w.Events)
} | explode_data.jsonl/81013 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 78
} | [
2830,
3393,
3564,
1703,
47248,
1155,
353,
8840,
836,
8,
341,
6692,
1669,
1855,
2271,
47248,
1155,
340,
6948,
12808,
1155,
11,
289,
24681,
11,
3521,
5173,
14,
21948,
1944,
1138,
6948,
93882,
1155,
11,
289,
41355,
47248,
340,
6948,
93882,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEndpointsAdapterGet(t *testing.T) {
endpoints1, _ := generateEndpointsAndSlice("foo", "testing", []int{80, 443}, []string{"10.1.2.3", "10.1.2.4"})
testCases := map[string]struct {
endpointSlicesEnabled bool
expectedError error
expectedEndpoints *corev1.Endpoints
endpoints []*corev1.Endpoints
namespaceParam string
nameParam string
}{
"single-existing-endpoints": {
endpointSlicesEnabled: false,
expectedError: nil,
expectedEndpoints: endpoints1,
endpoints: []*corev1.Endpoints{endpoints1},
namespaceParam: "testing",
nameParam: "foo",
},
"single-existing-endpoints-slices-enabled": {
endpointSlicesEnabled: true,
expectedError: nil,
expectedEndpoints: endpoints1,
endpoints: []*corev1.Endpoints{endpoints1},
namespaceParam: "testing",
nameParam: "foo",
},
"wrong-namespace": {
endpointSlicesEnabled: false,
expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "foo"),
expectedEndpoints: nil,
endpoints: []*corev1.Endpoints{endpoints1},
namespaceParam: "foo",
nameParam: "foo",
},
"wrong-name": {
endpointSlicesEnabled: false,
expectedError: errors.NewNotFound(schema.GroupResource{Group: "", Resource: "endpoints"}, "bar"),
expectedEndpoints: nil,
endpoints: []*corev1.Endpoints{endpoints1},
namespaceParam: "testing",
nameParam: "bar",
},
}
for name, testCase := range testCases {
t.Run(name, func(t *testing.T) {
client := fake.NewSimpleClientset()
epAdapter := EndpointsAdapter{endpointClient: client.CoreV1()}
if testCase.endpointSlicesEnabled {
epAdapter.endpointSliceClient = client.DiscoveryV1alpha1()
}
for _, endpoints := range testCase.endpoints {
_, err := client.CoreV1().Endpoints(endpoints.Namespace).Create(endpoints)
if err != nil {
t.Fatalf("Error creating Endpoints: %v", err)
}
}
endpoints, err := epAdapter.Get(testCase.namespaceParam, testCase.nameParam, metav1.GetOptions{})
if !apiequality.Semantic.DeepEqual(testCase.expectedError, err) {
t.Errorf("Expected error: %v, got: %v", testCase.expectedError, err)
}
if !apiequality.Semantic.DeepEqual(endpoints, testCase.expectedEndpoints) {
t.Errorf("Expected endpoints: %v, got: %v", testCase.expectedEndpoints, endpoints)
}
})
}
} | explode_data.jsonl/11036 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1126
} | [
2830,
3393,
80786,
5940,
1949,
1155,
353,
8840,
836,
8,
341,
6246,
7706,
16,
11,
716,
1669,
6923,
80786,
3036,
33236,
445,
7975,
497,
330,
8840,
497,
3056,
396,
90,
23,
15,
11,
220,
19,
19,
18,
2137,
3056,
917,
4913,
16,
15,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestNewGoogleAuthenticator_HappyPath_FirstKey(t *testing.T) {
asserter := assert.New(t)
reader := rand.Reader
bitSize := 2048
start := time.Now()
expires := time.Now().Add(time.Hour)
clientId := "testyMcTesterson"
subject := "12345"
email := "test@test.com"
name := "Bob McTester"
keyOne, err := rsa.GenerateKey(reader, bitSize)
if err != nil {
panic(err)
}
keyTwo, err := rsa.GenerateKey(reader, bitSize)
if err != nil {
panic(err)
}
certFetcher := func(ctx context.Context) (GooglePublicCerts, error) {
return GooglePublicCerts{
Certs: []*x509.Certificate{
createCert(keyOne, 123, start, expires),
createCert(keyTwo, 456, start, expires),
},
Expiration: expires,
}, nil
}
jwtPayload := fmt.Sprintf(`{
"iss": "foo.bar.com",
"azp": "whatever",
"aud": "%s",
"sub": "%s",
"email": "%s",
"email_verified": true,
"at_hash": "9SrKH5GRtXul1yRpWCyLow",
"name": "%s",
"picture": "https://some.google.link/blah",
"given_name": "Bob",
"family_name": "McTester",
"locale": "en",
"iat": %d,
"exp": %d,
"jti": "123abc56"
}`, clientId, subject, email, name, start.Unix(), expires.Unix())
jwtHeader := `{"alg":"RS256","kid":"a41a3570b8e3ae1b72caabcaa7b8d2db2065d7c1","typ":"JWT"}`
unsigned := fmt.Sprintf("%s.%s", base64.RawURLEncoding.EncodeToString([]byte(jwtHeader)), base64.RawURLEncoding.EncodeToString([]byte(jwtPayload)))
hasher := crypto.SHA256.New()
hasher.Write([]byte(unsigned))
sigBytes, err := rsa.SignPKCS1v15(rand.Reader, keyOne, crypto.SHA256, hasher.Sum(nil))
if err != nil {
panic(err)
}
jwt := fmt.Sprintf("%s.%s", unsigned, base64.RawURLEncoding.EncodeToString(sigBytes))
expectedRoles := []Role{
Role("whatever"),
}
getRoles := RoleOracle(func(ctx context.Context, emailAddress string) []Role {
asserter.Equal(email, emailAddress)
return expectedRoles
})
testInstance := NewGoogleAuthenticator(clientId, certFetcher, getRoles)
res, err := testInstance(context.Background(), jwt)
asserter.NoError(err)
asserter.Equal(Principal{
UserID: subject,
Email: email,
Name: name,
Roles: expectedRoles,
}, res)
} | explode_data.jsonl/7220 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 873
} | [
2830,
3393,
3564,
14444,
5087,
61393,
2039,
11144,
1820,
79790,
1592,
1155,
353,
8840,
836,
8,
341,
197,
33758,
465,
1669,
2060,
7121,
1155,
692,
61477,
1669,
10382,
47431,
198,
79980,
1695,
1669,
220,
17,
15,
19,
23,
271,
21375,
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 TestIndex_InvalidName(t *testing.T) {
path, err := ioutil.TempDir("", "pilosa-index-")
if err != nil {
panic(err)
}
index, err := pilosa.NewIndex(path, "ABC")
if index != nil {
t.Fatalf("unexpected index name %s", index)
}
} | explode_data.jsonl/55627 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 99
} | [
2830,
3393,
1552,
62,
7928,
675,
1155,
353,
8840,
836,
8,
341,
26781,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
79,
321,
11983,
21492,
12,
1138,
743,
1848,
961,
2092,
341,
197,
30764,
3964,
340,
197,
532,
26327,
11,
1848,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestMiddleware_HTTPBasicAuth(t *testing.T) {
env.SetEnv(env.Env{BasicAuthUsername: basicUsername, BasicAuthPassword: basicPass})
mw := &Middleware{}
tests := []struct {
name string
authorization string
wantResponseCode int
}{
{
name: "Testcase #1: Positive",
authorization: "Basic " + validBasicAuth,
wantResponseCode: 200,
},
{
name: "Testcase #2: Negative, empty authorization",
authorization: "",
wantResponseCode: 401,
},
{
name: "Testcase #3: Negative, invalid authorization",
authorization: "Basic xxxxx",
wantResponseCode: 401,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
nextHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
handlerToTest := mw.HTTPBasicAuth(nextHandler)
req := httptest.NewRequest("GET", "http://testing", nil)
req.Header.Add("Authorization", tt.authorization)
recorder := httptest.NewRecorder()
handlerToTest.ServeHTTP(recorder, req)
assert.Equal(t, tt.wantResponseCode, recorder.Code)
})
}
} | explode_data.jsonl/44826 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 466
} | [
2830,
3393,
24684,
34954,
15944,
5087,
1155,
353,
8840,
836,
8,
341,
57538,
4202,
14359,
16978,
81214,
90,
15944,
5087,
11115,
25,
6770,
11115,
11,
14625,
5087,
4876,
25,
6770,
12187,
3518,
2109,
86,
1669,
609,
24684,
31483,
78216,
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 TestRemoveUnminedTx(t *testing.T) {
store, db, teardown, err := testStore()
if err != nil {
t.Fatal(err)
}
defer teardown()
// In order to reproduce real-world scenarios, we'll use a new database
// transaction for each interaction with the wallet.
//
// We'll start off the test by creating a new coinbase output at height
// 100 and inserting it into the store.
b100 := &BlockMeta{
Block: Block{Height: 100},
Time: time.Now(),
}
initialBalance := int64(1e8)
cb := newCoinBase(initialBalance)
cbRec, err := NewTxRecordFromMsgTx(cb, b100.Time)
if err != nil {
t.Fatal(err)
}
commitDBTx(t, store, db, func(ns walletdb.ReadWriteBucket) {
if err := store.InsertTx(ns, cbRec, b100); err != nil {
t.Fatal(err)
}
err := store.AddCredit(ns, cbRec, b100, 0, false)
if err != nil {
t.Fatal(err)
}
})
// Determine the maturity height for the coinbase output created.
coinbaseMaturity := int32(chaincfg.TestNet3Params.CoinbaseMaturity)
maturityHeight := b100.Block.Height + coinbaseMaturity
// checkBalance is a helper function that compares the balance of the
// store with the expected value. The includeUnconfirmed boolean can be
// used to include the unconfirmed balance as a part of the total
// balance.
checkBalance := func(expectedBalance btcutil.Amount,
includeUnconfirmed bool) {
t.Helper()
minConfs := int32(1)
if includeUnconfirmed {
minConfs = 0
}
commitDBTx(t, store, db, func(ns walletdb.ReadWriteBucket) {
t.Helper()
b, err := store.Balance(ns, minConfs, maturityHeight)
if err != nil {
t.Fatalf("unable to retrieve balance: %v", err)
}
if b != expectedBalance {
t.Fatalf("expected balance of %d, got %d",
expectedBalance, b)
}
})
}
// Since we don't have any unconfirmed transactions within the store,
// the total balance reflecting confirmed and unconfirmed outputs should
// match the initial balance.
checkBalance(btcutil.Amount(initialBalance), false)
checkBalance(btcutil.Amount(initialBalance), true)
// Then, we'll create an unconfirmed spend for the coinbase output and
// insert it into the store.
b101 := &BlockMeta{
Block: Block{Height: 201},
Time: time.Now(),
}
changeAmount := int64(4e7)
spendTx := spendOutput(&cbRec.Hash, 0, 5e7, changeAmount)
spendTxRec, err := NewTxRecordFromMsgTx(spendTx, b101.Time)
if err != nil {
t.Fatal(err)
}
commitDBTx(t, store, db, func(ns walletdb.ReadWriteBucket) {
if err := store.InsertTx(ns, spendTxRec, nil); err != nil {
t.Fatal(err)
}
err := store.AddCredit(ns, spendTxRec, nil, 1, true)
if err != nil {
t.Fatal(err)
}
})
// With the unconfirmed spend inserted into the store, we'll query it
// for its unconfirmed tranasctions to ensure it was properly added.
commitDBTx(t, store, db, func(ns walletdb.ReadWriteBucket) {
unminedTxs, err := store.UnminedTxs(ns)
if err != nil {
t.Fatalf("unable to query for unmined txs: %v", err)
}
if len(unminedTxs) != 1 {
t.Fatalf("expected 1 mined tx, instead got %v",
len(unminedTxs))
}
unminedTxHash := unminedTxs[0].TxHash()
spendTxHash := spendTx.TxHash()
if !unminedTxHash.IsEqual(&spendTxHash) {
t.Fatalf("mismatch tx hashes: expected %v, got %v",
spendTxHash, unminedTxHash)
}
})
// Now that an unconfirmed spend exists, there should no longer be any
// confirmed balance. The total balance should now all be unconfirmed
// and it should match the change amount of the unconfirmed spend
// tranasction.
checkBalance(0, false)
checkBalance(btcutil.Amount(changeAmount), true)
// Now, we'll remove the unconfirmed spend tranaction from the store.
commitDBTx(t, store, db, func(ns walletdb.ReadWriteBucket) {
if err := store.RemoveUnminedTx(ns, spendTxRec); err != nil {
t.Fatal(err)
}
})
// We'll query the store one last time for its unconfirmed transactions
// to ensure the unconfirmed spend was properly removed above.
commitDBTx(t, store, db, func(ns walletdb.ReadWriteBucket) {
unminedTxs, err := store.UnminedTxs(ns)
if err != nil {
t.Fatalf("unable to query for unmined txs: %v", err)
}
if len(unminedTxs) != 0 {
t.Fatalf("expected 0 mined txs, instead got %v",
len(unminedTxs))
}
})
// Finally, the total balance (including confirmed and unconfirmed)
// should once again match the initial balance, as the uncofirmed spend
// has already been removed.
checkBalance(btcutil.Amount(initialBalance), false)
checkBalance(btcutil.Amount(initialBalance), true)
} | explode_data.jsonl/48542 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1636
} | [
2830,
3393,
13021,
1806,
1065,
291,
31584,
1155,
353,
8840,
836,
8,
341,
57279,
11,
2927,
11,
49304,
11,
1848,
1669,
1273,
6093,
741,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
16867,
49304,
2822,
197,
322,
758,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAddDilateDoubleInt64(t *testing.T) {
f := func(x *Int64) bool {
// t.Logf("x = %v", x)
l, r := new(Int64), new(Int64)
l.Add(x, x)
r.Dilate(x, 2)
return l.Equals(r)
}
if err := quick.Check(f, nil); err != nil {
t.Error(err)
}
} | explode_data.jsonl/29669 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 132
} | [
2830,
3393,
2212,
35,
75357,
7378,
1072,
21,
19,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
2915,
2075,
353,
1072,
21,
19,
8,
1807,
341,
197,
197,
322,
259,
98954,
445,
87,
284,
1018,
85,
497,
856,
340,
197,
8810,
11,
435,
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 TestNoOpLocalDetector(t *testing.T) {
localDetector := NewNoOpLocalDetector()
if localDetector.IsImplemented() {
t.Error("NoOpLocalDetector returns true for IsImplemented")
}
ifLocal := localDetector.IfLocal()
if len(ifLocal) != 0 {
t.Errorf("NoOpLocalDetector returns %v for IsLocal (expected nil)", ifLocal)
}
ifNotLocal := localDetector.IfNotLocal()
if len(ifNotLocal) != 0 {
t.Errorf("NoOpLocalDetector returns %v for IsNotLocal (expected nil)", ifNotLocal)
}
} | explode_data.jsonl/10301 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 175
} | [
2830,
3393,
2753,
7125,
7319,
31606,
1155,
353,
8840,
836,
8,
341,
8854,
31606,
1669,
1532,
2753,
7125,
7319,
31606,
741,
743,
2205,
31606,
4506,
18300,
368,
341,
197,
3244,
6141,
445,
2753,
7125,
7319,
31606,
4675,
830,
369,
2160,
1830... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_Token_TextEquals(t *testing.T) {
token := Token{
text: []Text{
[]byte("one"),
[]byte("two"),
},
}
assert.True(t, token.TextEquals("onetwo"))
} | explode_data.jsonl/78427 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 74
} | [
2830,
3393,
1139,
1679,
20550,
4315,
1155,
353,
8840,
836,
8,
341,
43947,
1669,
9660,
515,
197,
15425,
25,
3056,
1178,
515,
298,
197,
1294,
3782,
445,
603,
4461,
298,
197,
1294,
3782,
445,
19789,
4461,
197,
197,
1583,
197,
532,
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,
1,
1
] | 1 |
func TestLicense(t *testing.T) {
licenseStr := "0QFGbwit-"
text, err := decrypt(key, licenseStr)
if err != nil {
fmt.Println("decrypt err")
}
fmt.Printf("license text: %s", text)
} | explode_data.jsonl/31206 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 77
} | [
2830,
3393,
9827,
1155,
353,
8840,
836,
8,
341,
197,
13266,
2580,
1669,
330,
15,
48,
12001,
39824,
275,
12,
698,
15425,
11,
1848,
1669,
38126,
4857,
11,
5723,
2580,
340,
743,
1848,
961,
2092,
341,
197,
11009,
12419,
445,
73295,
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
] | 2 |
func TestRequestBody(t *testing.T) {
// test unknown type
r := (&Request{}).Body([]string{"test"})
if r.err == nil || r.body != nil {
t.Errorf("should have set err and left body nil: %#v", r)
}
// test error set when failing to read file
f, err := ioutil.TempFile("", "test")
if err != nil {
t.Fatalf("unable to create temp file")
}
defer f.Close()
os.Remove(f.Name())
r = (&Request{}).Body(f.Name())
if r.err == nil || r.body != nil {
t.Errorf("should have set err and left body nil: %#v", r)
}
// test unencodable api object
r = (&Request{content: defaultContentConfig()}).Body(&NotAnAPIObject{})
if r.err == nil || r.body != nil {
t.Errorf("should have set err and left body nil: %#v", r)
}
} | explode_data.jsonl/13260 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 279
} | [
2830,
3393,
33334,
1155,
353,
8840,
836,
8,
341,
197,
322,
1273,
9788,
943,
198,
7000,
1669,
15899,
1900,
6257,
568,
5444,
10556,
917,
4913,
1944,
23625,
743,
435,
18441,
621,
2092,
1369,
435,
5079,
961,
2092,
341,
197,
3244,
13080,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestDomainAlias_Normalize(t *testing.T) {
tests := []struct {
aliases map[string]string
email string
want string
}{
{
aliases: map[string]string{
"examplemail.com": "email.com",
},
email: "a@examplemail.com",
want: "a@email.com",
},
{
aliases: map[string]string{},
email: "a@examplemail.com",
want: "a@examplemail.com",
},
}
for i, tt := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
ea := NewEmailAddress(tt.email)
NewDomainAlias(tt.aliases).Normalize(ea)
if got := ea.String(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("DomainAlias.Normalize() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/57367 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 320
} | [
2830,
3393,
13636,
22720,
74900,
551,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
197,
33924,
2415,
14032,
30953,
198,
197,
57549,
256,
914,
198,
197,
50780,
262,
914,
198,
197,
59403,
197,
197,
515,
298,
197,
339... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func Test_underscore_arrays_9(t *testing.T) {
tt(t, func() {
test, _ := test_()
test(`
test("union", function() {
var result = _.union([1, 2, 3], [2, 30, 1], [1, 40]);
equal(result.join(' '), '1 2 3 30 40', 'takes the union of a list of arrays');
var result = _.union([1, 2, 3], [2, 30, 1], [1, 40, [1]]);
equal(result.join(' '), '1 2 3 30 40 1', 'takes the union of a list of nested arrays');
});
`)
})
} | explode_data.jsonl/68903 | {
"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,
62,
53933,
68983,
62,
24,
1155,
353,
8840,
836,
8,
972,
3244,
83,
1155,
11,
2915,
368,
972,
197,
18185,
11,
716,
1669,
1273,
62,
18005,
197,
18185,
5809,
319,
220,
1273,
445,
16192,
497,
729,
368,
972,
262,
762,
1102,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExtractInvalidPods(t *testing.T) {
var testCases = []struct {
desc string
pod *v1.Pod
}{
{
desc: "No version",
pod: &v1.Pod{TypeMeta: metav1.TypeMeta{APIVersion: ""}},
},
{
desc: "Invalid version",
pod: &v1.Pod{TypeMeta: metav1.TypeMeta{APIVersion: "v1betta2"}},
},
{
desc: "Invalid volume name",
pod: &v1.Pod{
TypeMeta: metav1.TypeMeta{APIVersion: api.Registry.GroupOrDie(v1.GroupName).GroupVersion.String()},
Spec: v1.PodSpec{
Volumes: []v1.Volume{{Name: "_INVALID_"}},
},
},
},
{
desc: "Duplicate volume names",
pod: &v1.Pod{
TypeMeta: metav1.TypeMeta{APIVersion: api.Registry.GroupOrDie(v1.GroupName).GroupVersion.String()},
Spec: v1.PodSpec{
Volumes: []v1.Volume{{Name: "repeated"}, {Name: "repeated"}},
},
},
},
{
desc: "Unspecified container name",
pod: &v1.Pod{
TypeMeta: metav1.TypeMeta{APIVersion: api.Registry.GroupOrDie(v1.GroupName).GroupVersion.String()},
Spec: v1.PodSpec{
Containers: []v1.Container{{Name: ""}},
},
},
},
{
desc: "Invalid container name",
pod: &v1.Pod{
TypeMeta: metav1.TypeMeta{APIVersion: api.Registry.GroupOrDie(v1.GroupName).GroupVersion.String()},
Spec: v1.PodSpec{
Containers: []v1.Container{{Name: "_INVALID_"}},
},
},
},
}
for _, testCase := range testCases {
data, err := json.Marshal(testCase.pod)
if err != nil {
t.Fatalf("%s: Some weird json problem: %v", testCase.desc, err)
}
fakeHandler := utiltesting.FakeHandler{
StatusCode: 200,
ResponseBody: string(data),
}
testServer := httptest.NewServer(&fakeHandler)
defer testServer.Close()
ch := make(chan interface{}, 1)
c := sourceURL{testServer.URL, http.Header{}, "localhost", ch, nil, 0, http.DefaultClient}
if err := c.extractFromURL(); err == nil {
t.Errorf("%s: Expected error", testCase.desc)
}
}
} | explode_data.jsonl/48249 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 853
} | [
2830,
3393,
28959,
7928,
23527,
82,
1155,
353,
8840,
836,
8,
341,
2405,
1273,
37302,
284,
3056,
1235,
341,
197,
41653,
914,
198,
197,
3223,
347,
220,
353,
85,
16,
88823,
198,
197,
59403,
197,
197,
515,
298,
41653,
25,
330,
2753,
231... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetStatusDetailsHandler(t *testing.T) {
context, executor := testContext()
req, err := http.NewRequest("GET", "http://10.0.0.100/status", nil)
if err != nil {
logger.Fatal(err)
}
executor.MockExecuteCommandWithOutputFile = func(debug bool, actionName string, command string, outFileArg string, args ...string) (string, error) {
switch {
case args[0] == "status":
return cephStatusResponseRaw, nil
case args[0] == "time-sync-status":
return cephTimeStatusReponseRaw, nil
}
return "", fmt.Errorf("unexpected command '%v'", args)
}
// make a request to GetStatusDetails and verify the results
w := httptest.NewRecorder()
h := newTestHandler(context)
h.GetStatusDetails(w, req)
assert.Equal(t, http.StatusOK, w.Code)
expectedRespObj := model.StatusDetails{
OverallStatus: model.HealthWarning,
SummaryMessages: []model.StatusSummary{
{Status: model.HealthWarning, Name: "TEST_MSG", Message: "too many PGs per OSD (2048 > max 300)"},
},
Monitors: []model.MonitorSummary{
{Name: "rook-ceph-mon0", Address: "127.0.0.1:6790/0", InQuorum: true, Status: model.HealthOK},
},
OSDs: model.OSDSummary{
Total: 10, NumberIn: 9, NumberUp: 9, Full: false, NearFull: true,
},
Mgrs: model.MgrSummary{
ActiveName: "rook-ceph-mgr0",
ActiveAddr: "172.17.0.8:6800/13",
Available: true,
},
PGs: model.PGSummary{
Total: 2148,
StateCounts: map[string]int{"active+clean": 2048, "created+peering": 100},
},
Usage: model.UsageSummary{
TotalBytes: 345,
DataBytes: 0,
UsedBytes: 123,
AvailableBytes: 234,
},
}
VerifyStatusResponse(t, expectedRespObj, w)
} | explode_data.jsonl/35436 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 659
} | [
2830,
3393,
1949,
2522,
7799,
3050,
1155,
353,
8840,
836,
8,
341,
28413,
11,
31558,
1669,
1273,
1972,
2822,
24395,
11,
1848,
1669,
1758,
75274,
445,
3806,
497,
330,
1254,
1110,
16,
15,
13,
15,
13,
15,
13,
16,
15,
15,
32518,
497,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestApplicationContext_CreateBean(t *testing.T) {
c, ch := container()
c.Object(&ObjFactory{})
err := c.Refresh()
assert.Nil(t, err)
p := <-ch
b, err := p.BeanRegistry().Wire((*ObjFactory).NewObj, arg.R1("${i:=5}"))
fmt.Println(b, err)
} | explode_data.jsonl/17431 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 108
} | [
2830,
3393,
19736,
34325,
10437,
1155,
353,
8840,
836,
8,
1476,
1444,
11,
521,
1669,
5476,
741,
1444,
8348,
2099,
5261,
4153,
37790,
9859,
1669,
272,
49841,
741,
6948,
59678,
1155,
11,
1848,
692,
3223,
1669,
9119,
331,
271,
2233,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetJobByType(t *testing.T) {
th := Setup(t)
defer th.TearDown()
jobType := model.NewId()
statuses := []*model.Job{
{
Id: model.NewId(),
Type: jobType,
CreateAt: 1000,
},
{
Id: model.NewId(),
Type: jobType,
CreateAt: 999,
},
{
Id: model.NewId(),
Type: jobType,
CreateAt: 1001,
},
}
for _, status := range statuses {
store.Must(th.App.Srv.Store.Job().Save(status))
defer th.App.Srv.Store.Job().Delete(status.Id)
}
if received, err := th.App.GetJobsByType(jobType, 0, 2); err != nil {
t.Fatal(err)
} else if len(received) != 2 {
t.Fatal("received wrong number of statuses")
} else if received[0].Id != statuses[2].Id {
t.Fatal("should've received newest job first")
} else if received[1].Id != statuses[0].Id {
t.Fatal("should've received second newest job second")
}
if received, err := th.App.GetJobsByType(jobType, 2, 2); err != nil {
t.Fatal(err)
} else if len(received) != 1 {
t.Fatal("received wrong number of statuses")
} else if received[0].Id != statuses[1].Id {
t.Fatal("should've received oldest job last")
}
} | explode_data.jsonl/49285 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 496
} | [
2830,
3393,
1949,
12245,
1359,
929,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
340,
16867,
270,
836,
682,
4454,
2822,
68577,
929,
1669,
1614,
7121,
764,
2822,
23847,
288,
1669,
29838,
2528,
45293,
515,
197,
197,
515,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
func TestRaceParamsContextCopy(t *testing.T) {
DefaultWriter = os.Stdout
router := Default()
nameGroup := router.Group("/:name")
var wg sync.WaitGroup
wg.Add(2)
{
nameGroup.GET("/api", func(c *Context) {
go func(c *Context, param string) {
defer wg.Done()
// First assert must be executed after the second request
time.Sleep(50 * time.Millisecond)
assert.Equal(t, c.Param("name"), param)
}(c.Copy(), c.Param("name"))
})
}
performRequest(router, "GET", "/name1/api")
performRequest(router, "GET", "/name2/api")
wg.Wait()
} | explode_data.jsonl/26841 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 231
} | [
2830,
3393,
55991,
4870,
1972,
12106,
1155,
353,
8840,
836,
8,
341,
91084,
6492,
284,
2643,
83225,
198,
67009,
1669,
7899,
741,
11609,
2808,
1669,
9273,
5407,
91944,
606,
1138,
2405,
63581,
12811,
28384,
2808,
198,
72079,
1904,
7,
17,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRoundtrip(t *testing.T) {
payload := []byte("Lorem ipsum")
sharedkey := []byte("Avracadabra")
hmacAlgorithms := []jwa.SignatureAlgorithm{jwa.HS256, jwa.HS384, jwa.HS512}
for _, alg := range hmacAlgorithms {
t.Run("HMAC "+alg.String(), func(t *testing.T) {
signed, err := jws.Sign(payload, alg, sharedkey)
if !assert.NoError(t, err, "Sign succeeds") {
return
}
if pdebug.Enabled {
pdebug.Printf("signed string: %s", signed)
}
verified, err := jws.Verify(signed, alg, sharedkey)
if !assert.NoError(t, err, "Verify succeeded") {
return
}
if !assert.Equal(t, payload, verified, "verified payload matches") {
return
}
})
}
t.Run("HMAC SignMulti", func(t *testing.T) {
var signed []byte
t.Run("Sign", func(t *testing.T) {
var options []jws.Option
for _, alg := range hmacAlgorithms {
signer, err := sign.New(alg)
if !assert.NoError(t, err, `sign.New should succeed`) {
return
}
options = append(options, jws.WithSigner(signer, sharedkey, nil, nil))
}
var err error
signed, err = jws.SignMulti(payload, options...)
if !assert.NoError(t, err, `jws.SignMulti should succeed`) {
return
}
})
for _, alg := range hmacAlgorithms {
t.Run("Verify "+alg.String(), func(t *testing.T) {
verified, err := jws.Verify(signed, alg, sharedkey)
if !assert.NoError(t, err, "Verify succeeded") {
return
}
if !assert.Equal(t, payload, verified, "verified payload matches") {
return
}
})
}
})
} | explode_data.jsonl/1560 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 671
} | [
2830,
3393,
27497,
32981,
1155,
353,
8840,
836,
8,
341,
76272,
1669,
3056,
3782,
445,
32783,
26342,
1138,
197,
6100,
792,
1669,
3056,
3782,
445,
9865,
19959,
329,
43932,
5130,
9598,
11948,
2101,
18980,
1669,
3056,
73,
9991,
41152,
1568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDisconnect(t *testing.T) {
// Scenario: spawn 2 ordering service instances
// and a client.
// Have the client try to Recv() from one of them,
// and disconnect the client until it tries connecting
// to the other instance.
defer ensureNoGoroutineLeak(t)()
os1 := mocks.NewOrderer(5613, t)
os1.SetNextExpectedSeek(5)
os2 := mocks.NewOrderer(5614, t)
os2.SetNextExpectedSeek(5)
defer os1.Shutdown()
defer os2.Shutdown()
waitForConnectionToSomeOSN := func() {
for {
if os1.ConnCount() > 0 || os2.ConnCount() > 0 {
return
}
time.Sleep(time.Millisecond * 100)
}
}
connFact := func(endpoint string) (*grpc.ClientConn, error) {
return grpc.Dial(endpoint, grpc.WithInsecure(), grpc.WithBlock())
}
prod := comm.NewConnectionProducer(connFact, []string{"localhost:5613", "localhost:5614"})
clFact := func(cc *grpc.ClientConn) orderer.AtomicBroadcastClient {
return orderer.NewAtomicBroadcastClient(cc)
}
onConnect := func(bd blocksprovider.BlocksDeliverer) error {
return nil
}
retryPol := func(attemptNum int, elapsedTime time.Duration) (time.Duration, bool) {
return time.Millisecond * 10, attemptNum < 100
}
cl := NewBroadcastClient(prod, clFact, onConnect, retryPol)
stopChan := make(chan struct{})
go func() {
cl.Recv()
stopChan <- struct{}{}
}()
waitForConnectionToSomeOSN()
cl.Disconnect(false)
i := 0
os1Connected := false
os2Connected := false
for (!os1Connected || !os2Connected) && i < 100 {
if os1.ConnCount() > 0 {
os1Connected = true
}
if os2.ConnCount() > 0 {
os2Connected = true
}
t.Log("Attempt", i, "os1ConnCount()=", os1.ConnCount(), "os2ConnCount()=", os2.ConnCount())
i++
if i == 100 {
assert.Fail(t, "Didn't switch to other instance after many attempts")
}
cl.Disconnect(false)
time.Sleep(time.Millisecond * 500)
}
cl.Close()
select {
case <-stopChan:
case <-time.After(time.Second * 20):
assert.Fail(t, "Didn't stop within a timely manner")
}
} | explode_data.jsonl/38324 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 768
} | [
2830,
3393,
60651,
1155,
353,
8840,
836,
8,
341,
197,
322,
58663,
25,
18042,
220,
17,
21391,
2473,
13121,
198,
197,
322,
323,
264,
2943,
624,
197,
322,
12243,
279,
2943,
1430,
311,
4067,
85,
368,
504,
825,
315,
1105,
345,
197,
322,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRemoveGitBuildFromName(t *testing.T) {
pluginName := "datasource-kairosdb"
// The root directory should get renamed to the plugin name
paths := map[string]string{
"datasource-plugin-kairosdb-cc4a3965ef5d3eb1ae0ee4f93e9e78ec7db69e64/": "datasource-kairosdb/",
"datasource-plugin-kairosdb-cc4a3965ef5d3eb1ae0ee4f93e9e78ec7db69e64/README.md": "datasource-kairosdb/README.md",
"datasource-plugin-kairosdb-cc4a3965ef5d3eb1ae0ee4f93e9e78ec7db69e64/partials/": "datasource-kairosdb/partials/",
"datasource-plugin-kairosdb-cc4a3965ef5d3eb1ae0ee4f93e9e78ec7db69e64/partials/config.html": "datasource-kairosdb/partials/config.html",
}
for pth, exp := range paths {
name := removeGitBuildFromName(pluginName, pth)
assert.Equal(t, exp, name)
}
} | explode_data.jsonl/74301 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 385
} | [
2830,
3393,
13021,
46562,
11066,
3830,
675,
1155,
353,
8840,
836,
8,
341,
197,
9138,
675,
1669,
330,
27240,
919,
12646,
2143,
3630,
1999,
1837,
197,
322,
576,
3704,
6220,
1265,
633,
27280,
311,
279,
9006,
829,
198,
197,
21623,
1669,
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 TestWaitVisible(t *testing.T) {
t.Parallel()
ctx, cancel := testAllocate(t, "js.html")
defer cancel()
var nodeIDs []cdp.NodeID
if err := Run(ctx, NodeIDs("#input2", &nodeIDs, ByID)); err != nil {
t.Fatalf("got error: %v", err)
}
if len(nodeIDs) != 1 {
t.Errorf("expected to have exactly 1 node id: got %d", len(nodeIDs))
}
var value string
if err := Run(ctx,
WaitVisible("#input2", ByID),
Value(nodeIDs, &value, ByNodeID),
); err != nil {
t.Fatalf("got error: %v", err)
}
} | explode_data.jsonl/59457 | {
"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,
14190,
5715,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
20985,
11,
9121,
1669,
1273,
75380,
1155,
11,
330,
2519,
2564,
1138,
16867,
9121,
2822,
2405,
2436,
30466,
3056,
4385,
79,
21714,
915,
198,
743,
1848,
1669,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestGetWorkflow(t *testing.T) {
type (
args struct {
db mock.DB
wfTemplate, wfHardware string
}
want struct {
expectedError bool
}
)
testCases := map[string]struct {
args args
want want
}{
"SuccessGettingWorkflow": {
args: args{
db: mock.DB{
GetWorkflowFunc: func(ctx context.Context, workflowID string) (db.Workflow, error) {
return db.Workflow{
ID: workflowID,
Template: templateID,
Hardware: hw}, nil
},
GetTemplateFunc: func(ctx context.Context, fields map[string]string, deleted bool) (string, string, string, error) {
return "", "", templateData, nil
},
},
wfTemplate: templateID,
wfHardware: hw,
},
want: want{
expectedError: false,
},
},
}
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
s := testServer(t, tc.args.db)
res, err := s.GetWorkflow(ctx, &workflow.GetRequest{
Id: workflowID,
})
if err != nil {
assert.Error(t, err)
assert.Empty(t, res)
assert.True(t, tc.want.expectedError)
return
}
assert.NoError(t, err)
assert.NotEmpty(t, res)
assert.False(t, tc.want.expectedError)
})
}
} | explode_data.jsonl/51754 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 591
} | [
2830,
3393,
1949,
62768,
1155,
353,
8840,
836,
8,
341,
13158,
2399,
197,
31215,
2036,
341,
298,
20939,
3824,
7860,
22537,
198,
298,
6692,
69,
7275,
11,
41248,
66862,
914,
198,
197,
197,
532,
197,
50780,
2036,
341,
298,
42400,
1454,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTerragruntWorksWithSingleJsonConfig(t *testing.T) {
t.Parallel()
cleanupTerraformFolder(t, TEST_FIXTURE_CONFIG_SINGLE_JSON_PATH)
tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_CONFIG_SINGLE_JSON_PATH)
rootTerragruntConfigPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_CONFIG_SINGLE_JSON_PATH)
runTerragrunt(t, fmt.Sprintf("terragrunt plan --terragrunt-non-interactive --terragrunt-working-dir %s", rootTerragruntConfigPath))
} | explode_data.jsonl/10079 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 177
} | [
2830,
3393,
51402,
68305,
3850,
6776,
16056,
10888,
5014,
2648,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1444,
60639,
51,
13886,
627,
13682,
1155,
11,
13602,
42635,
41486,
12568,
39028,
25356,
7944,
340,
20082,
14359,
1820,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReceiveMatchWithTimeframe(t *testing.T) {
p := New().(*processor)
ctx := testutils.NewProcessorContext()
p.Configure(
ctx,
map[string]interface{}{
"Compare_Field": "message",
"timeframe": 1,
},
)
p.Receive(testutils.NewPacketOld("test", nil))
assert.Equal(t, 0, ctx.SentPacketsCount(0), "changed ! 0")
p.Receive(testutils.NewPacketOld("test", nil))
assert.Equal(t, 0, ctx.SentPacketsCount(0), "changed ! 0")
p.Receive(testutils.NewPacketOld("test1", nil))
if assert.Equal(t, 1, ctx.SentPacketsCount(0), "changed ! 0") {
assert.Equal(t, "test1", ctx.SentPackets(0)[0].Message())
}
p.Receive(testutils.NewPacketOld("test1", nil))
if assert.Equal(t, 1, ctx.SentPacketsCount(0), "changed ! 0") {
assert.Equal(t, "test1", ctx.SentPackets(0)[0].Message())
}
p.Receive(testutils.NewPacketOld("test1", nil))
if assert.Equal(t, 1, ctx.SentPacketsCount(0), "changed ! 0") {
assert.Equal(t, "test1", ctx.SentPackets(0)[0].Message())
}
time.Sleep(time.Second * 2)
p.Receive(testutils.NewPacketOld("test1", nil))
if assert.Equal(t, 1, ctx.SentPacketsCount(0), "changed ! 0") {
assert.Equal(t, "test1", ctx.SentPackets(0)[0].Message())
}
time.Sleep(time.Second * 2)
p.Receive(testutils.NewPacketOld("test1", nil))
p.Receive(testutils.NewPacketOld("test1", nil))
assert.Equal(t, 1, ctx.SentPacketsCount(0), "changed ! 0")
p.Receive(testutils.NewPacketOld("A", nil))
assert.Equal(t, 2, ctx.SentPacketsCount(0), "changed ! 0")
p.Receive(testutils.NewPacketOld("B", nil))
assert.Equal(t, 3, ctx.SentPacketsCount(0), "changed ! 0")
time.Sleep(time.Second * 2)
p.Receive(testutils.NewPacketOld("B", nil))
assert.Equal(t, 3, ctx.SentPacketsCount(0), "changed ! 0")
p.Receive(testutils.NewPacketOld("B", nil))
p.Receive(testutils.NewPacketOld("test", nil))
time.Sleep(time.Second * 2)
p.Receive(testutils.NewPacketOld("test", nil))
assert.Equal(t, 4, ctx.SentPacketsCount(0), "changed ! 0")
} | explode_data.jsonl/74200 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 829
} | [
2830,
3393,
14742,
8331,
2354,
1462,
6763,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
1532,
1005,
4071,
29474,
340,
20985,
1669,
1273,
6031,
7121,
22946,
1972,
741,
3223,
78281,
1006,
197,
20985,
345,
197,
19567,
14032,
31344,
67066,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestTool_DownloadActionResult(t *testing.T) {
e, cleanup := fakes.NewTestEnv(t)
defer cleanup()
cmd := &command.Command{
Args: []string{"tool"},
ExecRoot: e.ExecRoot,
InputSpec: &command.InputSpec{},
OutputFiles: []string{"a/b/out"},
}
opt := command.DefaultExecutionOptions()
output := "output"
_, acDg := e.Set(cmd, opt, &command.Result{Status: command.CacheHitResultStatus}, &fakes.OutputFile{Path: "a/b/out", Contents: output},
fakes.StdOut("stdout"), fakes.StdErr("stderr"))
toolClient := &Client{GrpcClient: e.Client.GrpcClient}
tmpDir := t.TempDir()
if err := toolClient.DownloadActionResult(context.Background(), acDg.String(), tmpDir); err != nil {
t.Fatalf("DownloadActionResult(%v,%v) failed: %v", acDg.String(), tmpDir, err)
}
verifyData := map[string]string{
filepath.Join(tmpDir, "a/b/out"): "output",
filepath.Join(tmpDir, "stdout"): "stdout",
filepath.Join(tmpDir, "stderr"): "stderr",
}
for fp, want := range verifyData {
c, err := os.ReadFile(fp)
if err != nil {
t.Fatalf("Unable to read downloaded output file %v: %v", fp, err)
}
got := string(c)
if got != want {
t.Fatalf("Incorrect content in downloaded file %v, want %v, got %v", fp, want, got)
}
}
} | explode_data.jsonl/8276 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 504
} | [
2830,
3393,
7740,
1557,
37702,
17301,
1155,
353,
8840,
836,
8,
341,
7727,
11,
21290,
1669,
282,
2050,
7121,
2271,
14359,
1155,
340,
16867,
21290,
741,
25920,
1669,
609,
5631,
12714,
515,
197,
197,
4117,
25,
286,
3056,
917,
4913,
14172,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestKLog(t *testing.T) {
klog.InitFlags(nil)
flag.Set("logtostderr", "false")
flag.Set("alsologtostderr", "false")
flag.Set("stderrthreshold", "100")
// flag.Set("v", "100")
flag.Set("log_dir", "stu/klog/")
flag.Set("add_dir_header", "true")
flag.Set("one_output", "true")
flag.Parse()
if klog.V(1).Enabled() {
klog.Infoln("sdfsdf")
}
klog.Infoln("Infoln")
klog.Errorln("Errorln")
klog.Warningln("Warningln")
klog.Fatalln("Fatalln")
} | explode_data.jsonl/50089 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 214
} | [
2830,
3393,
42,
2201,
1155,
353,
8840,
836,
8,
341,
16463,
839,
26849,
9195,
27907,
340,
30589,
4202,
445,
839,
83,
535,
67,
615,
497,
330,
3849,
1138,
30589,
4202,
445,
1127,
1609,
83,
535,
67,
615,
497,
330,
3849,
1138,
30589,
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,
1,
1,
1,
1,
1... | 2 |
func TestSHA1(t *testing.T) {
for i, this := range []struct {
input string
expectedHash string
}{
{"Hello world, gophers!", "c8b5b0e33d408246e30f53e32b8f7627a7a649d4"},
{"Lorem ipsum dolor", "45f75b844be4d17b3394c6701768daf39419c99b"},
} {
result, err := sha1(this.input)
if err != nil {
t.Errorf("sha1 returned error: %s", err)
}
if result != this.expectedHash {
t.Errorf("[%d] sha1: expected '%s', got '%s'", i, this.expectedHash, result)
}
}
_, err := sha1(t)
if err == nil {
t.Error("Expected error from sha1")
}
} | explode_data.jsonl/9256 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 266
} | [
2830,
3393,
33145,
16,
1155,
353,
8840,
836,
8,
341,
2023,
600,
11,
419,
1669,
2088,
3056,
1235,
341,
197,
22427,
286,
914,
198,
197,
42400,
6370,
914,
198,
197,
59403,
197,
197,
4913,
9707,
1879,
11,
342,
5127,
388,
18789,
330,
66,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStreamServerInterceptorWithoutRequestId(t *testing.T) {
handler := func(srv interface{}, stream grpc.ServerStream) error {
reqID, exists := FromContext(stream.Context())
if exists && reqID == "" {
t.Errorf("requestId must be generated by interceptor")
}
return nil
}
ctx := DummyContextWithServerTransportStream()
ms := &mockServerStream{ctx}
err := StreamServerInterceptor()(testRequest{}, ms, nil, handler)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
} | explode_data.jsonl/74064 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 167
} | [
2830,
3393,
3027,
5475,
32786,
26040,
61774,
1155,
353,
8840,
836,
8,
341,
53326,
1669,
2915,
1141,
10553,
3749,
22655,
4269,
47900,
22997,
3027,
8,
1465,
341,
197,
24395,
915,
11,
6724,
1669,
5542,
1972,
20574,
9328,
2398,
197,
743,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewFromJSObject(t *testing.T) {
if obj, err := baseobject.Get(js.Global(), "event"); testingutils.AssertErr(t, err) {
if d, err := NewFromJSObject(obj); testingutils.AssertErr(t, err) {
testingutils.AssertExpect(t, "[object ClipboardEvent]", d.ToString_())
}
}
} | explode_data.jsonl/42127 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 111
} | [
2830,
3393,
3564,
3830,
12545,
1190,
1155,
353,
8840,
836,
8,
1476,
743,
2839,
11,
1848,
1669,
2331,
1700,
2234,
53418,
27381,
1507,
330,
3087,
5038,
7497,
6031,
11711,
7747,
1155,
11,
1848,
8,
341,
197,
743,
294,
11,
1848,
1669,
1532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOutputService10ProtocolTestTimestampMembersCase1(t *testing.T) {
svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
buf := bytes.NewReader([]byte("<OperationNameResponse><StructMember><foo>2014-04-29T18:30:38Z</foo><bar>1398796238</bar></StructMember><TimeArg>2014-04-29T18:30:38Z</TimeArg><TimeCustom>Tue, 29 Apr 2014 18:30:38 GMT</TimeCustom><TimeFormat>1398796238</TimeFormat><RequestId>requestid</RequestId></OperationNameResponse>"))
req, out := svc.OutputService10TestCaseOperation1Request(nil)
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
// set headers
// unmarshal response
req.Handlers.UnmarshalMeta.Run(req)
req.Handlers.Unmarshal.Run(req)
if req.Error != nil {
t.Errorf("expect not error, got %v", req.Error)
}
// assert response
if out == nil {
t.Errorf("expect not to be nil")
}
if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Bar.UTC().String(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.UTC().String(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeArg.UTC().String(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeCustom.UTC().String(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeFormat.UTC().String(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
} | explode_data.jsonl/46134 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 658
} | [
2830,
3393,
5097,
1860,
16,
15,
20689,
2271,
20812,
24371,
4207,
16,
1155,
353,
8840,
836,
8,
341,
1903,
7362,
1669,
1532,
5097,
1860,
16,
15,
20689,
2271,
24144,
20674,
11,
609,
8635,
10753,
90,
27380,
25,
31521,
6431,
445,
2428,
111... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLocale(t *testing.T) {
trans := New()
expected := "en_KN"
if trans.Locale() != expected {
t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
}
} | explode_data.jsonl/27339 | {
"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,
268,
10102,
45,
1837,
743,
1356,
59094,
368,
961,
3601,
341,
197,
3244,
13080,
445,
18896,
7677,
82,
6,
24528,
7677,
82,
22772,
3601,
11,
1356... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNormalizeAndValidate(t *testing.T) {
t.Parallel()
path, err := NormalizeAndValidate("")
assert.NoError(t, err)
assert.Equal(t, ".", path)
path, err = NormalizeAndValidate(".")
assert.NoError(t, err)
assert.Equal(t, ".", path)
path, err = NormalizeAndValidate("./.")
assert.NoError(t, err)
assert.Equal(t, ".", path)
path, err = NormalizeAndValidate("./foo")
assert.NoError(t, err)
assert.Equal(t, "foo", path)
_, err = NormalizeAndValidate("/foo")
assert.Error(t, err)
_, err = NormalizeAndValidate("../foo")
assert.Error(t, err)
} | explode_data.jsonl/11895 | {
"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,
87824,
3036,
17926,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
26781,
11,
1848,
1669,
68092,
3036,
17926,
31764,
6948,
35699,
1155,
11,
1848,
340,
6948,
12808,
1155,
11,
68514,
1815,
340,
26781,
11,
1848,
284,
680... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ResolveTypes_UnionItem_Fail(t *testing.T) {
data := `
models:
Custom:
oneOf:
nope: NonExisting
`
old, err := unmarshalSpec([]byte(data))
assert.Equal(t, err, nil)
errors := enrichSpec(old)
assert.Equal(t, len(errors), 1)
assert.Equal(t, strings.Contains(errors[0].Message, "NonExisting"), true)
} | explode_data.jsonl/79852 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 134
} | [
2830,
3393,
62,
56808,
4173,
62,
32658,
1234,
1400,
604,
1155,
353,
8840,
836,
8,
341,
8924,
1669,
22074,
6507,
510,
220,
8406,
510,
262,
825,
2124,
510,
414,
902,
375,
25,
11581,
53067,
198,
3989,
61828,
11,
1848,
1669,
650,
27121,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderAlgorix, config.Adapter{
Endpoint: "https://{{.Host}}.test.com?sid={{.SourceId}}&token={{.AccountID}}"})
if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
}
adapterstest.RunJSONBidderTest(t, "algorixtest", bidder)
} | explode_data.jsonl/66138 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 134
} | [
2830,
3393,
5014,
39571,
1155,
353,
8840,
836,
8,
341,
2233,
307,
1107,
11,
1936,
7747,
1669,
20626,
30981,
3342,
65,
9927,
1785,
307,
1107,
2101,
5628,
941,
11,
2193,
34190,
515,
197,
197,
27380,
25,
330,
2428,
1110,
2979,
13,
9296,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSwarmLeave(t *testing.T) {
buf := new(bytes.Buffer)
cmd := newLeaveCommand(
test.NewFakeCli(&fakeClient{}, buf))
assert.NoError(t, cmd.Execute())
assert.Equal(t, "Node left the swarm.", strings.TrimSpace(buf.String()))
} | explode_data.jsonl/74067 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 89
} | [
2830,
3393,
13218,
2178,
21833,
1155,
353,
8840,
836,
8,
341,
26398,
1669,
501,
23158,
22622,
340,
25920,
1669,
501,
21833,
4062,
1006,
197,
18185,
7121,
52317,
87014,
2099,
30570,
2959,
22655,
6607,
1171,
6948,
35699,
1155,
11,
5439,
138... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestParse(t *testing.T) {
infos, err := ParseURL(testURL)
if err != nil {
t.Fatal(err)
}
if infos.Title != testExpectedTitle {
t.Fatal("mercury.Parse(): incorrect Title")
}
if infos.DatePublished != testExpectedDatePublished {
t.Fatal("mercury.Parse(): incorrect DatePublished")
}
if infos.ImageURL != testExpectedImageURL {
t.Fatal("mercury.Parse(): incorrect ImageURL")
}
if infos.TotalPages != testExpectedTotalPages {
t.Fatal("mercury.Parse(): incorrect title")
}
if infos.Direction != testExpectedDirection {
t.Fatal("mercury.Parse(): incorrect title")
}
if infos.WordCount != testExpectedWordCount {
t.Fatal("mercury.Parse(): incorrect title")
}
} | explode_data.jsonl/14987 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 264
} | [
2830,
3393,
14463,
1155,
353,
8840,
836,
8,
341,
197,
55965,
11,
1848,
1669,
14775,
3144,
8623,
3144,
692,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
630,
743,
44144,
22967,
961,
1273,
18896,
3851,
341,
197,
3244,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestRendersElseAFailedUnless(t *testing.T) {
template, _ := ParseString("A-{% unless true %}in if{%else%}in else{%endunless%}-Z", nil)
assertRender(t, template, nil, `A-in else-Z`)
} | explode_data.jsonl/42419 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 76
} | [
2830,
3393,
49,
14506,
22971,
8276,
5687,
35587,
1155,
353,
8840,
836,
8,
341,
22832,
11,
716,
1669,
14775,
703,
445,
32,
63347,
4,
7241,
830,
1018,
92,
258,
421,
66365,
1503,
4,
92,
258,
770,
66365,
408,
38770,
4,
19732,
57,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestCall_GetTransactionReceipt_InvalidArgs(t *testing.T) {
mockJSONRPC := &mocks.JSONRPC{}
mockGraphQL := &mocks.GraphQL{}
c := &Client{
c: mockJSONRPC,
g: mockGraphQL,
traceSemaphore: semaphore.NewWeighted(100),
}
ctx := context.Background()
resp, err := c.Call(
ctx,
&RosettaTypes.CallRequest{
Method: "eth_getTransactionReceipt",
},
)
assert.Nil(t, resp)
assert.True(t, errors.Is(err, ErrCallParametersInvalid))
mockJSONRPC.AssertExpectations(t)
mockGraphQL.AssertExpectations(t)
} | explode_data.jsonl/55497 | {
"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,
7220,
13614,
8070,
67461,
62,
7928,
4117,
1155,
353,
8840,
836,
8,
341,
77333,
5370,
29528,
1669,
609,
16712,
82,
18009,
29528,
16094,
77333,
88637,
1669,
609,
16712,
82,
40237,
3588,
31483,
1444,
1669,
609,
2959,
515,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestHandleVersion(t *testing.T) {
p, cleanup := newTestPoliteiawww(t)
defer cleanup()
d := newTestPoliteiad(t, p)
defer d.Close()
expectedReply := www.VersionReply{
Version: www.PoliteiaWWWAPIVersion,
Route: www.PoliteiaWWWAPIRoute,
PubKey: hex.EncodeToString(p.cfg.Identity.Key[:]),
TestNet: p.cfg.TestNet,
}
var tests = []struct {
name string
wantReply www.VersionReply
wantStatus int
wantError error
}{
{
"success",
expectedReply,
http.StatusOK,
nil,
},
}
for _, v := range tests {
t.Run(v.name, func(t *testing.T) {
// Setup request
r := httptest.NewRequest(http.MethodGet, www.RouteVersion, nil)
w := httptest.NewRecorder()
// Run test case
p.handleVersion(w, r)
res := w.Result()
body, _ := ioutil.ReadAll(res.Body)
res.Body.Close()
// Unmarshal body response
var gotReply www.VersionReply
err := json.Unmarshal(body, &gotReply)
if err != nil {
t.Errorf("unmarshal error with body %v", body)
}
// Validate response status
if res.StatusCode != v.wantStatus {
t.Errorf("got status code %v, want %v",
res.StatusCode, v.wantStatus)
}
// Validate response body
diff := deep.Equal(gotReply, v.wantReply)
if diff != nil {
t.Errorf("VersionReply got/want diff:\n%v",
spew.Sdump(diff))
}
})
}
} | explode_data.jsonl/80244 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 590
} | [
2830,
3393,
6999,
5637,
1155,
353,
8840,
836,
8,
341,
3223,
11,
21290,
1669,
501,
2271,
14658,
632,
72,
672,
1250,
1155,
340,
16867,
21290,
2822,
2698,
1669,
501,
2271,
14658,
632,
62944,
1155,
11,
281,
340,
16867,
294,
10421,
2822,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestMessageDeliveryQueueDiscardMessages(t *testing.T) {
acks := newAckTracker()
blockingReceiver := newTestBlockingMessageReceiver(t)
messageQueue := newMessageDeliveryQueue(acks, blockingReceiver.onMessage, 10)
msg1 := seqMsgWithOffset(1)
ack1 := newAckConsumer(1, 0, nil)
msg2 := seqMsgWithOffset(2)
ack2 := newAckConsumer(2, 0, nil)
messageQueue.Start()
messageQueue.Add(&ReceivedMessage{Msg: msg1, Ack: ack1})
messageQueue.Add(&ReceivedMessage{Msg: msg2, Ack: ack2})
// The blocking receiver suspends after receiving msg1.
blockingReceiver.ValidateMsg(msg1)
// Stopping the message queue should discard undelivered msg2.
messageQueue.Stop()
// Unsuspend the blocking receiver and verify msg2 is not received.
blockingReceiver.Return()
messageQueue.Wait()
blockingReceiver.VerifyNoMsgs()
if got, want := acks.outstandingAcks.Len(), 1; got != want {
t.Errorf("ackTracker.outstandingAcks.Len() got %v, want %v", got, want)
}
} | explode_data.jsonl/31634 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 321
} | [
2830,
3393,
2052,
38121,
7554,
23477,
567,
15820,
1155,
353,
8840,
836,
8,
341,
197,
7821,
1669,
501,
55559,
31133,
741,
47996,
287,
25436,
1669,
501,
2271,
48266,
2052,
25436,
1155,
340,
24753,
7554,
1669,
501,
2052,
38121,
7554,
7,
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... | 2 |
func TestDeployTwinImages(t *testing.T) {
f := newIBDFixture(t, k8s.EnvGKE)
defer f.TearDown()
sancho := NewSanchoDockerBuildManifest(f)
newK8sTarget := k8s.MustTarget("sancho", yaml.ConcatYAML(SanchoYAML, SanchoTwinYAML)).
WithDependencyIDs(sancho.K8sTarget().DependencyIDs())
manifest := sancho.WithDeployTarget(newK8sTarget)
result, err := f.ibd.BuildAndDeploy(f.ctx, f.st, buildTargets(manifest), store.BuildStateSet{})
if err != nil {
t.Fatal(err)
}
id := manifest.ImageTargetAt(0).ID()
expectedImage := "gcr.io/some-project-162817/sancho:tilt-11cd0b38bc3ceb95"
image := store.ClusterImageRefFromBuildResult(result[id])
assert.Equal(t, expectedImage, image.String())
assert.Equalf(t, 2, strings.Count(f.k8s.Yaml, expectedImage),
"Expected image to update twice in YAML: %s", f.k8s.Yaml)
} | explode_data.jsonl/38250 | {
"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,
69464,
51,
7526,
14228,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
501,
3256,
5262,
12735,
1155,
11,
595,
23,
82,
81214,
38,
3390,
340,
16867,
282,
836,
682,
4454,
2822,
1903,
276,
958,
1669,
1532,
23729,
958,
35,
13659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestImagePullSecrets(t *testing.T) {
woc := newWoc()
woc.execWf.Spec.ImagePullSecrets = []apiv1.LocalObjectReference{
{
Name: "secret-name",
},
}
tmplCtx, err := woc.createTemplateContext(wfv1.ResourceScopeLocal, "")
assert.NoError(t, err)
ctx := context.Background()
_, err = woc.executeContainer(ctx, woc.execWf.Spec.Entrypoint, tmplCtx.GetTemplateScope(), &woc.execWf.Spec.Templates[0], &wfv1.WorkflowStep{}, &executeTemplateOpts{})
assert.NoError(t, err)
pods, err := woc.controller.kubeclientset.CoreV1().Pods("").List(ctx, metav1.ListOptions{})
assert.NoError(t, err)
assert.Len(t, pods.Items, 1)
pod := pods.Items[0]
assert.Equal(t, pod.Spec.ImagePullSecrets[0].Name, "secret-name")
} | explode_data.jsonl/75371 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 298
} | [
2830,
3393,
1906,
36068,
19773,
82,
1155,
353,
8840,
836,
8,
341,
6692,
509,
1669,
501,
54,
509,
741,
6692,
509,
15776,
54,
69,
36473,
7528,
36068,
19773,
82,
284,
3056,
391,
344,
16,
20856,
1190,
8856,
515,
197,
197,
515,
298,
2129... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMissingImportDiagsClearOnFirstFile(t *testing.T) {
t.Parallel()
runner.Run(t, onlyMod, func(t *testing.T, env *Env) {
env.CreateBuffer("main.go", `package main
func m() {
log.Println()
}
`)
env.Await(
env.DiagnosticAtRegexp("main.go", "log"),
)
env.SaveBuffer("main.go")
env.Await(
EmptyDiagnostics("main.go"),
)
})
} | explode_data.jsonl/38900 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 158
} | [
2830,
3393,
25080,
11511,
21685,
2032,
14008,
1925,
5338,
1703,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
197,
41736,
16708,
1155,
11,
1172,
4459,
11,
2915,
1155,
353,
8840,
836,
11,
6105,
353,
14359,
8,
341,
197,
57538,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMultiplicationProofJSON(t *testing.T) {
g, gok := buildGroup(big.NewInt(47))
require.True(t, gok, "Failed to setup group for Multiplication proof testing")
s := newMultiplicationProofStructure("m1", "m2", "mod", "result", 3)
proofBefore := s.fakeProof(g)
proofJSON, err := json.Marshal(proofBefore)
require.NoError(t, err, "error during json marshal")
var proofAfter MultiplicationProof
err = json.Unmarshal(proofJSON, &proofAfter)
require.NoError(t, err, "error during json unmarshal")
assert.True(t, s.verifyProofStructure(proofAfter), "json'ed proof structure rejected")
} | explode_data.jsonl/56447 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 203
} | [
2830,
3393,
57251,
1693,
31076,
5370,
1155,
353,
8840,
836,
8,
341,
3174,
11,
342,
562,
1669,
1936,
2808,
75616,
7121,
1072,
7,
19,
22,
1171,
17957,
32443,
1155,
11,
342,
562,
11,
330,
9408,
311,
6505,
1874,
369,
58712,
1693,
11064,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNilcheckSimple(t *testing.T) {
c := testConfig(t)
ptrType := c.config.Types.BytePtr
fun := c.Fun("entry",
Bloc("entry",
Valu("mem", OpInitMem, types.TypeMem, 0, nil),
Valu("sb", OpSB, c.config.Types.Uintptr, 0, nil),
Goto("checkPtr")),
Bloc("checkPtr",
Valu("ptr1", OpLoad, ptrType, 0, nil, "sb", "mem"),
Valu("bool1", OpIsNonNil, c.config.Types.Bool, 0, nil, "ptr1"),
If("bool1", "secondCheck", "exit")),
Bloc("secondCheck",
Valu("bool2", OpIsNonNil, c.config.Types.Bool, 0, nil, "ptr1"),
If("bool2", "extra", "exit")),
Bloc("extra",
Goto("exit")),
Bloc("exit",
Exit("mem")))
CheckFunc(fun.f)
nilcheckelim(fun.f)
// clean up the removed nil check
fusePlain(fun.f)
deadcode(fun.f)
CheckFunc(fun.f)
for _, b := range fun.f.Blocks {
if b == fun.blocks["secondCheck"] && isNilCheck(b) {
t.Errorf("secondCheck was not eliminated")
}
}
} | explode_data.jsonl/6045 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 412
} | [
2830,
3393,
19064,
2028,
16374,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
1273,
2648,
1155,
340,
43811,
929,
1669,
272,
5423,
29147,
32119,
5348,
198,
90126,
1669,
272,
991,
359,
445,
4085,
756,
197,
12791,
1074,
445,
4085,
756,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestParseLine1(t *testing.T) {
s := "【三扯】扯舸可坷惹喏舍者赭饿个和贺荷课锞社射麝赦猞蔗鹧柘"
var cr ChineseRhymes
cr.Init()
cr.parseLine(1, s)
for k, v := range cr.ZhChar2Rhyme {
fmt.Printf("[%s]: [%s]\n", k, v.Desc)
}
if len(cr.ZhChar2Rhyme) != 24 {
t.Errorf("TestParseLine1 failed: %v, want: 24", len(cr.ZhChar2Rhyme))
}
} | explode_data.jsonl/15079 | {
"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,
14463,
2460,
16,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
330,
10904,
44991,
105948,
10958,
105948,
120735,
30440,
103841,
105771,
120645,
100496,
28946,
121553,
103048,
18947,
33108,
102103,
100905,
99504,
121222,
60237,
99759,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAddReading(t *testing.T) {
reset()
myMock := &dbMock.DBClient{}
myMock.On("AddReading", mock.Anything).Return("", nil)
dbClient = myMock
_, err := addReading(models.Reading{Name: "valid"}, logger.NewMockClient())
if err != nil {
t.Errorf("Unexpected error adding reading")
}
} | explode_data.jsonl/48167 | {
"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,
2212,
31899,
1155,
353,
8840,
836,
8,
341,
70343,
741,
13624,
11571,
1669,
609,
1999,
11571,
22537,
2959,
31483,
13624,
11571,
8071,
445,
2212,
31899,
497,
7860,
13311,
1596,
568,
5598,
19814,
2092,
692,
20939,
2959,
284,
847,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLeaveConversation(t *testing.T) {
http.HandleFunc("/conversations.leave", leaveConversationHandler)
once.Do(startServer)
api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/"))
_, err := api.LeaveConversation("CXXXXXXXX")
if err != nil {
t.Errorf("Unexpected error: %s", err)
return
}
} | explode_data.jsonl/78549 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 119
} | [
2830,
3393,
21833,
60313,
1155,
353,
8840,
836,
8,
341,
28080,
63623,
4283,
443,
72995,
89303,
497,
5274,
60313,
3050,
340,
197,
13184,
33596,
10639,
5475,
340,
54299,
1669,
1532,
445,
8840,
34841,
497,
6959,
7082,
3144,
445,
1254,
1110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAggregateMsgByFlowKey(t *testing.T) {
messageChan := make(chan *entities.Message)
input := AggregationInput{
MessageChan: messageChan,
WorkerNum: 2,
CorrelateFields: fields,
ActiveExpiryTimeout: testActiveExpiry,
InactiveExpiryTimeout: testInactiveExpiry,
}
aggregationProcess, _ := InitAggregationProcess(input)
// Template records with IPv4 fields should be ignored
message := createMsgwithTemplateSet(false)
err := aggregationProcess.AggregateMsgByFlowKey(message)
assert.NoError(t, err)
assert.Empty(t, aggregationProcess.flowKeyRecordMap)
assert.Empty(t, aggregationProcess.expirePriorityQueue.Len())
// Data records should be processed and stored with corresponding flow key
message = createDataMsgForSrc(t, false, false, false, false, false)
err = aggregationProcess.AggregateMsgByFlowKey(message)
assert.NoError(t, err)
assert.NotZero(t, uint64(1), aggregationProcess.GetNumFlows())
assert.NotZero(t, aggregationProcess.expirePriorityQueue.Len())
flowKey := FlowKey{"10.0.0.1", "10.0.0.2", 6, 1234, 5678}
aggRecord := aggregationProcess.flowKeyRecordMap[flowKey]
assert.NotNil(t, aggregationProcess.flowKeyRecordMap[flowKey])
item := aggregationProcess.expirePriorityQueue.Peek()
assert.NotNil(t, item)
ieWithValue, _, exist := aggRecord.Record.GetInfoElementWithValue("sourceIPv4Address")
assert.Equal(t, true, exist)
assert.Equal(t, net.IP{0xa, 0x0, 0x0, 0x1}, ieWithValue.GetIPAddressValue())
assert.Equal(t, message.GetSet().GetRecords()[0], aggRecord.Record)
// Template records with IPv6 fields should be ignored
message = createMsgwithTemplateSet(true)
err = aggregationProcess.AggregateMsgByFlowKey(message)
assert.NoError(t, err)
// It should have only data record with IPv4 fields that is added before.
assert.Equal(t, int64(1), aggregationProcess.GetNumFlows())
assert.Equal(t, 1, aggregationProcess.expirePriorityQueue.Len())
// Data record with IPv6 addresses should be processed and stored correctly
message = createDataMsgForSrc(t, true, false, false, false, false)
err = aggregationProcess.AggregateMsgByFlowKey(message)
assert.NoError(t, err)
assert.Equal(t, int64(2), aggregationProcess.GetNumFlows())
assert.Equal(t, 2, aggregationProcess.expirePriorityQueue.Len())
flowKey = FlowKey{"2001:0:3238:dfe1:63::fefb", "2001:0:3238:dfe1:63::fefc", 6, 1234, 5678}
assert.NotNil(t, aggregationProcess.flowKeyRecordMap[flowKey])
aggRecord = aggregationProcess.flowKeyRecordMap[flowKey]
ieWithValue, _, exist = aggRecord.Record.GetInfoElementWithValue("sourceIPv6Address")
assert.Equal(t, true, exist)
assert.Equal(t, net.IP{0x20, 0x1, 0x0, 0x0, 0x32, 0x38, 0xdf, 0xe1, 0x0, 0x63, 0x0, 0x0, 0x0, 0x0, 0xfe, 0xfb}, ieWithValue.GetIPAddressValue())
assert.Equal(t, message.GetSet().GetRecords()[0], aggRecord.Record)
// Test data record with invalid "flowEndSeconds" field
element, _, exists := message.GetSet().GetRecords()[0].GetInfoElementWithValue("flowEndSeconds")
assert.True(t, exists)
element.ResetValue()
err = aggregationProcess.AggregateMsgByFlowKey(message)
assert.NoError(t, err)
} | explode_data.jsonl/8698 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1095
} | [
2830,
3393,
64580,
6611,
1359,
18878,
1592,
1155,
353,
8840,
836,
8,
341,
24753,
46019,
1669,
1281,
35190,
353,
10499,
8472,
340,
22427,
1669,
4598,
34442,
2505,
515,
197,
46733,
46019,
25,
1843,
1943,
46019,
345,
197,
197,
21936,
4651,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRepairWriteTearLast(t *testing.T) {
corruptf := func(p string, offset int64) error {
f, err := openLast(p)
if err != nil {
return err
}
defer f.Close()
// 512 bytes perfectly aligns the last record, so use 1024
if offset < 1024 {
return fmt.Errorf("got offset %d, expected >1024", offset)
}
if terr := f.Truncate(1024); terr != nil {
return terr
}
if terr := f.Truncate(offset); terr != nil {
return terr
}
return nil
}
testRepair(t, makeEnts(50), corruptf, 40)
} | explode_data.jsonl/6817 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 206
} | [
2830,
3393,
98386,
7985,
51,
682,
5842,
1155,
353,
8840,
836,
8,
341,
1444,
269,
6585,
69,
1669,
2915,
1295,
914,
11,
4347,
526,
21,
19,
8,
1465,
341,
197,
1166,
11,
1848,
1669,
1787,
5842,
1295,
340,
197,
743,
1848,
961,
2092,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestAgent_Checks_ACLFilter(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), TestACLConfig())
defer a.Shutdown()
chk1 := &structs.HealthCheck{
Node: a.Config.NodeName,
CheckID: "mysql",
Name: "mysql",
Status: api.HealthPassing,
}
a.State.AddCheck(chk1, "")
t.Run("no token", func(t *testing.T) {
req, _ := http.NewRequest("GET", "/v1/agent/checks", nil)
obj, err := a.srv.AgentChecks(nil, req)
if err != nil {
t.Fatalf("Err: %v", err)
}
val := obj.(map[types.CheckID]*structs.HealthCheck)
if len(val) != 0 {
t.Fatalf("bad checks: %v", obj)
}
})
t.Run("root token", func(t *testing.T) {
req, _ := http.NewRequest("GET", "/v1/agent/checks?token=root", nil)
obj, err := a.srv.AgentChecks(nil, req)
if err != nil {
t.Fatalf("Err: %v", err)
}
val := obj.(map[types.CheckID]*structs.HealthCheck)
if len(val) != 1 {
t.Fatalf("bad checks: %v", obj)
}
})
} | explode_data.jsonl/33593 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 431
} | [
2830,
3393,
16810,
28188,
82,
97627,
5632,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
11323,
1669,
1532,
2271,
16810,
1155,
2967,
1507,
3393,
55393,
2648,
2398,
16867,
264,
10849,
18452,
2822,
23049,
74,
16,
1669,
609,
1235,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInstrumentationLibrarySpans_CopyTo(t *testing.T) {
ms := NewInstrumentationLibrarySpans()
generateTestInstrumentationLibrarySpans().CopyTo(ms)
assert.EqualValues(t, generateTestInstrumentationLibrarySpans(), ms)
} | explode_data.jsonl/63252 | {
"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,
56324,
367,
16915,
6406,
596,
77637,
1249,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
56324,
367,
16915,
6406,
596,
741,
3174,
13220,
2271,
56324,
367,
16915,
6406,
596,
1005,
12106,
1249,
35680,
340,
6948,
12808,
6227,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAuthenticate(t *testing.T) {
type testData struct {
test string
user string
errorMsg string
anonymousEnabled bool
}
var tests = []testData{
{
test: "TestNoSessionAnonymousDisabled",
errorMsg: "no session information",
anonymousEnabled: false,
},
{
test: "TestSessionPresent",
user: "admin",
anonymousEnabled: false,
},
{
test: "TestSessionNotPresentAnonymousEnabled",
anonymousEnabled: true,
},
}
for _, testData := range tests {
t.Run(testData.test, func(t *testing.T) {
cm := test.NewFakeConfigMap()
if testData.anonymousEnabled {
cm.Data["users.anonymous.enabled"] = "true"
}
secret := test.NewFakeSecret()
kubeclientset := fake.NewSimpleClientset(cm, secret)
appClientSet := apps.NewSimpleClientset()
argoCDOpts := ArgoCDServerOpts{
Namespace: test.FakeArgoCDNamespace,
KubeClientset: kubeclientset,
AppClientset: appClientSet,
}
argocd := NewServer(context.Background(), argoCDOpts)
ctx := context.Background()
if testData.user != "" {
token, err := argocd.sessionMgr.Create("admin", 0, "")
assert.NoError(t, err)
ctx = metadata.NewIncomingContext(context.Background(), metadata.Pairs(apiclient.MetaDataTokenKey, token))
}
_, err := argocd.Authenticate(ctx)
if testData.errorMsg != "" {
assert.Errorf(t, err, testData.errorMsg)
} else {
assert.NoError(t, err)
}
})
}
} | explode_data.jsonl/38042 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 673
} | [
2830,
3393,
99087,
1155,
353,
8840,
836,
8,
341,
13158,
67348,
2036,
341,
197,
18185,
1797,
914,
198,
197,
19060,
1797,
914,
198,
197,
18290,
6611,
260,
914,
198,
197,
197,
25280,
5462,
1807,
198,
197,
532,
2405,
7032,
284,
3056,
1944... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPacketDot11DataQOSData(t *testing.T) {
p := gopacket.NewPacket(testPacketDot11DataQOSData, LinkTypeIEEE80211Radio, gopacket.Default)
if p.ErrorLayer() != nil {
t.Error("Failed to decode packet:", p.ErrorLayer().Error())
}
checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11DataQOSData, LayerTypeDot11Data, LayerTypeLLC, LayerTypeSNAP, LayerTypeARP}, t)
if got, ok := p.Layer(LayerTypeARP).(*ARP); ok {
want := &ARP{BaseLayer: BaseLayer{
Contents: []uint8{0x0, 0x1, 0x8, 0x0, 0x6, 0x4, 0x0, 0x1, 0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52, 0xa9, 0xfe, 0xf7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8c, 0xb4, 0x33, 0x44},
Payload: []uint8{},
},
AddrType: 0x1,
Protocol: 0x800,
HwAddressSize: 0x6,
ProtAddressSize: 0x4,
Operation: 0x1,
SourceHwAddress: []uint8{0x0, 0x19, 0xe3, 0xd3, 0x53, 0x52},
SourceProtAddress: []uint8{0xa9, 0xfe, 0xf7, 0x0},
DstHwAddress: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
DstProtAddress: []uint8{0x8c, 0xb4, 0x33, 0x44},
}
if !reflect.DeepEqual(got, want) {
t.Errorf("ARP packet processing failed:\ngot :\n%#v\n\nwant :\n%#v\n\n", got, want)
}
}
} | explode_data.jsonl/7562 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 630
} | [
2830,
3393,
16679,
34207,
16,
16,
1043,
48,
3126,
1043,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
342,
453,
5709,
7121,
16679,
8623,
16679,
34207,
16,
16,
1043,
48,
3126,
1043,
11,
5948,
929,
76705,
23,
15,
17,
16,
16,
28203,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestLibraryVariableSetGetThatDoesNotExist(t *testing.T) {
libraryVariableSetID := "there-is-no-way-this-libraryVariableSet-id-exists-i-hope"
expected := octopusdeploy.ErrItemNotFound
libraryVariableSet, err := client.LibraryVariableSet.Get(libraryVariableSetID)
assert.Error(t, err, "there should have been an error raised as this libraryVariableSet should not be found")
assert.Equal(t, expected, err, "a item not found error should have been raised")
assert.Nil(t, libraryVariableSet, "no libraryVariableSet should have been returned")
} | explode_data.jsonl/65966 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 163
} | [
2830,
3393,
16915,
7827,
1649,
1949,
4792,
21468,
45535,
1155,
353,
8840,
836,
8,
341,
197,
18065,
7827,
1649,
915,
1669,
330,
18532,
30430,
28366,
26798,
60191,
52421,
7827,
1649,
12897,
10187,
1671,
17600,
2832,
2792,
698,
42400,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestLabelNamespace(t *testing.T) {
g := NewGomegaWithT(t)
l := New()
l.Namespace("ns-1")
g.Expect(l[NamespaceLabelKey]).To(Equal("ns-1"))
} | explode_data.jsonl/22126 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 68
} | [
2830,
3393,
2476,
22699,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
1532,
38,
32696,
2354,
51,
1155,
692,
8810,
1669,
1532,
741,
8810,
46011,
445,
4412,
12,
16,
1138,
3174,
81893,
2333,
22223,
1680,
2476,
1592,
10697,
1249,
67372,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestPrepareTaskRequestEnvironment_IsolateAndCAS(t *testing.T) {
t.Parallel()
Convey(`Make sure we do not process both Isolate and CAS`, t, func() {
c := reproduceRun{}
c.init(&testAuthFlags{})
// Use TempDir, which creates a temp directory, to return a unique directory namme
// that prepareTaskRequestEnvironment() will remove and recreate (via prepareDir())
c.work = t.TempDir()
service := &testService{}
properties := &swarming.SwarmingRpcsTaskProperties{
Command: []string{"rbd", "stream", "-test-id-prefix", "chicken://chicken_chicken/"},
InputsRef: &swarming.SwarmingRpcsFilesRef{
Isolated: "isolated",
},
CasInputRoot: &swarming.SwarmingRpcsCASReference{
CasInstance: "CAS-instance",
},
}
_, err := c.prepareTaskRequestEnvironment(context.Background(), properties, service)
So(err, ShouldBeError, "fetched TaskRequest has files from Isolate and RBE-CAS")
})
} | explode_data.jsonl/74872 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 322
} | [
2830,
3393,
50590,
6262,
1900,
12723,
31879,
33066,
3036,
87516,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
93070,
5617,
5809,
8078,
2704,
582,
653,
537,
1882,
2176,
2160,
33066,
323,
41790,
7808,
259,
11,
2915,
368,
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... | 1 |
func TestCopyOne(t *testing.T) {
defer leaktest.AfterTest(t)()
t.Skip("#18352")
params, _ := tests.CreateTestServerParams()
s, db, _ := serverutils.StartServer(t, params)
defer s.Stopper().Stop(context.TODO())
if _, err := db.Exec(`
CREATE DATABASE d;
SET DATABASE = d;
CREATE TABLE t (
i INT PRIMARY KEY
);
`); err != nil {
t.Fatal(err)
}
txn, err := db.Begin()
if err != nil {
t.Fatal(err)
}
if _, err := txn.Prepare(pq.CopyIn("t", "i")); err != nil {
t.Fatal(err)
}
if _, err := txn.Prepare(pq.CopyIn("t", "i")); err == nil {
t.Fatal("expected error")
}
} | explode_data.jsonl/2949 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 280
} | [
2830,
3393,
12106,
3966,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
3244,
57776,
3584,
16,
23,
18,
20,
17,
5130,
25856,
11,
716,
1669,
7032,
7251,
2271,
5475,
4870,
741,
1903,
11,
2927,
11,
716,
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... | 5 |
func TestInvalidHost(t *testing.T) {
c := StartCapture()
exit = func(r int) {}
os.Args = []string{"dosa", "--host", "invalid-hostname.", "schema", "upsertable", "--scope", "bar", "--namePrefix", "foo", "../../testentity"}
main()
output := c.stop(true)
assert.Contains(t, output, "invalid-hostname")
assert.Contains(t, output, "no such host")
} | explode_data.jsonl/16644 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 133
} | [
2830,
3393,
7928,
9296,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
5145,
27429,
741,
14519,
284,
2915,
2601,
526,
8,
5613,
25078,
51015,
284,
3056,
917,
4913,
67,
11983,
497,
14482,
3790,
497,
330,
11808,
38589,
606,
10465,
330,
17349,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadPlainBOOLEAN(t *testing.T) {
testData := [][]interface{}{
[]interface{}{(true)},
[]interface{}{(false)},
[]interface{}{(false), (false)},
[]interface{}{(false), (true)},
}
for _, data := range testData {
res, _ := ReadPlainBOOLEAN(bytes.NewReader(WritePlainBOOLEAN(data)), uint64(len(data)))
if fmt.Sprintf("%v", data) != fmt.Sprintf("%v", res) {
t.Errorf("ReadPlainBOOLEAN err, expect %v, get %v", data, res)
}
}
} | explode_data.jsonl/23892 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 194
} | [
2830,
3393,
4418,
26982,
72110,
1155,
353,
8840,
836,
8,
341,
18185,
1043,
1669,
52931,
4970,
67066,
197,
197,
1294,
4970,
6257,
96065,
1866,
39781,
197,
197,
1294,
4970,
6257,
96065,
3849,
39781,
197,
197,
1294,
4970,
6257,
96065,
3849,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRegexValidate(t *testing.T) {
testData := []testRegex{
{exp: "[A-Z]+", isValid: true, err: nil, data: "HELLO"},
{exp: "[0-9]{4,6}", isValid: true, err: nil, data: "12345"},
{exp: "\\w+", isValid: true, err: nil, data: "whatever24"},
{exp: `\w+`, isValid: true, err: nil, data: "iamgood"},
{exp: "[^A-Z]+", isValid: true, err: nil, data: "123456asdf"},
}
for _, v := range testData {
validator := ®exValidator{regex: regexp.MustCompile(v.exp)}
isValid, err := validator.validate(v.data)
if v.isValid != isValid {
t.Errorf("%+v != %+v it should be valid with data %+v", v.isValid, isValid, v.data)
}
if err != v.err {
t.Errorf("there was an error %s", err)
}
}
} | explode_data.jsonl/11235 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 315
} | [
2830,
3393,
32464,
17926,
1155,
353,
8840,
836,
8,
341,
18185,
1043,
1669,
3056,
1944,
32464,
515,
197,
197,
90,
4580,
25,
10545,
32,
11171,
7574,
497,
26171,
25,
830,
11,
1848,
25,
2092,
11,
821,
25,
330,
50712,
1593,
7115,
197,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestClient_CoinsOHLC(t *testing.T) {
t.Run("Minutely", func(t *testing.T) {
ohlc, err := client.CoinsOHLC(CoinsOHLCParams{Id: "polkadot", VsCurrency: "usd", Days: "1"})
require.NoError(t, err)
require.LessOrEqual(t, 48, len(ohlc))
})
t.Run("Hourly", func(t *testing.T) {
ohlc, err := client.CoinsOHLC(CoinsOHLCParams{Id: "polkadot", VsCurrency: "usd", Days: "7"})
require.NoError(t, err)
require.LessOrEqual(t, 6*7, len(ohlc))
})
t.Run("Daily", func(t *testing.T) {
ohlc, err := client.CoinsOHLC(CoinsOHLCParams{Id: "polkadot", VsCurrency: "usd", Days: "90"})
require.NoError(t, err)
require.LessOrEqual(t, 90/4, len(ohlc))
})
} | explode_data.jsonl/37793 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 310
} | [
2830,
3393,
2959,
920,
68798,
46761,
8556,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
6217,
97366,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
197,
2267,
17257,
11,
1848,
1669,
2943,
52114,
1330,
46761,
8556,
3025,
68798,
46761,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIndexArrayPtrIssue784(t *testing.T) {
gopClTest(t, `
type intArr [2]int
func foo(a *intArr) {
a[1] = 10
}
`, `package main
type intArr [2]int
func foo(a *intArr) {
a[1] = 10
}
`)
} | explode_data.jsonl/73658 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 98
} | [
2830,
3393,
1552,
1857,
5348,
42006,
22,
23,
19,
1155,
353,
8840,
836,
8,
341,
3174,
453,
5066,
2271,
1155,
11,
22074,
1313,
526,
8838,
508,
17,
63025,
271,
2830,
15229,
2877,
353,
396,
8838,
8,
341,
11323,
58,
16,
60,
284,
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... | 1 |
func TestOpenFail(t *testing.T) {
_, err := Open("/dev/null", DefaultOptions().WithSynced(false))
require.Error(t, err)
os.Mkdir("ro_dir1", 0500)
defer os.RemoveAll("ro_dir1")
_, err = Open("ro_dir/bla", DefaultOptions().WithSynced(false))
require.Error(t, err)
_, err = Open("wrongdir\000", DefaultOptions().WithSynced(false))
require.Error(t, err)
defer os.RemoveAll("tt1")
_, err = Open("tt1", DefaultOptions().WithSynced(false).WithAppFactory(
func(rootPath, subPath string, opts *multiapp.Options) (a appendable.Appendable, e error) {
if subPath == "tree" {
e = errors.New("simulated error")
}
return
}))
_, err = Open("tt1", DefaultOptions().WithSynced(false).WithAppFactory(
func(rootPath, subPath string, opts *multiapp.Options) (a appendable.Appendable, e error) {
if subPath == "commit" {
e = errors.New("simulated error")
}
return
}))
require.Error(t, err)
} | explode_data.jsonl/49662 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 364
} | [
2830,
3393,
5002,
19524,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
5264,
4283,
3583,
19293,
497,
7899,
3798,
1005,
2354,
12154,
291,
3576,
1171,
17957,
6141,
1155,
11,
1848,
340,
25078,
1321,
12438,
445,
299,
4334,
16,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSservice_CopyExecInOsDefault(t *testing.T) {
op := Option{}
mpss := make([]immudb.ManpageService, 2)
mpss[0] = immudbcmdtest.ManpageServiceMock{}
mpss[1] = immudbcmdtest.ManpageServiceMock{}
ss := sservice{osMock, &servicetest.ConfigServiceMock{}, mpss, op}
_, err := ss.CopyExecInOsDefault("immudb")
assert.Nil(t, err)
} | explode_data.jsonl/57710 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 144
} | [
2830,
3393,
50,
7936,
77637,
10216,
641,
28867,
3675,
1155,
353,
8840,
836,
8,
341,
39703,
1669,
6959,
16094,
53230,
778,
1669,
1281,
10556,
12543,
661,
65,
29902,
2893,
1860,
11,
220,
17,
340,
53230,
778,
58,
15,
60,
284,
4893,
661,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEqual(t *testing.T) {
for _, tc := range EqualTests {
if res := Equal(tc.a, tc.b); res != tc.exp {
t.Errorf("%v: Equal(%v, %v) = %v, want %v", tc.desc, tc.a, tc.b, res, tc.exp)
}
}
} | explode_data.jsonl/23967 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 101
} | [
2830,
3393,
2993,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
38474,
18200,
341,
197,
743,
592,
1669,
38474,
44415,
5849,
11,
17130,
948,
1215,
592,
961,
17130,
13754,
341,
298,
3244,
13080,
4430,
85,
25,
38474,
15238,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSetError_SetsSuppliedErrorOnPipe(t *testing.T) {
t.Parallel()
p := script.NewPipe()
e := errors.New("fake error")
p.SetError(e)
if p.Error() != e {
t.Errorf("want %v when setting pipe error, got %v", e, p.Error())
}
} | explode_data.jsonl/51533 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 99
} | [
2830,
3393,
1649,
1454,
1098,
1415,
10048,
3440,
1454,
1925,
34077,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
3223,
1669,
5316,
7121,
34077,
741,
7727,
1669,
5975,
7121,
445,
30570,
1465,
1138,
3223,
4202,
1454,
2026,
340,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestStageRead(t *testing.T) {
r := require.New(t)
in := map[string]interface{}{
"name": "test_stage",
"database": "test_db",
"schema": "test_schema",
}
d := stage(t, "test_db|test_schema|test_stage", in)
WithMockDb(t, func(db *sql.DB, mock sqlmock.Sqlmock) {
// Test when resource is not found, checking if state will be empty
r.NotEmpty(d.State())
q := snowflake.Stage("test_stage", "test_db", "test_schema").Describe()
mock.ExpectQuery(q).WillReturnError(sql.ErrNoRows)
err := resources.ReadStage(d, db)
r.Empty(d.State())
r.Nil(err)
})
} | explode_data.jsonl/59822 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 250
} | [
2830,
3393,
19398,
4418,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
1373,
7121,
1155,
692,
17430,
1669,
2415,
14032,
31344,
67066,
197,
197,
31486,
788,
257,
330,
1944,
35238,
756,
197,
197,
1,
12216,
788,
330,
1944,
8685,
756,
197,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestReconcileAddonsConfiguration_AddAddonsProcess(t *testing.T) {
for tn, ac := range map[string]*v1alpha1.AddonsConfiguration{
"empty addons configuration": fixAddonsConfiguration(),
"pending addons configuration": fixPendingAddonsConfiguration(),
} {
t.Run(tn, func(t *testing.T) {
// GIVEN
fixAddonsCfg := ac
ts := getTestSuite(t, fixAddonsCfg)
indexDTO := fixIndexDTO()
tmpDir := os.TempDir()
ts.addonGetter.On("GetIndex").Return(indexDTO, nil)
ts.addonGetter.On("Cleanup").Return(nil)
for _, entry := range indexDTO.Entries {
for _, e := range entry {
completeAddon := fixAddonWithDocsURL(string(e.Name), string(e.Name), "example.com", "example.com")
ts.addonGetter.On("GetCompleteAddon", e).
Return(completeAddon, nil)
ts.docsProvider.On("EnsureAssetGroup", completeAddon.Addon).Return(nil)
}
}
ts.brokerFacade.On("Exist").Return(false, nil).Once()
ts.addonGetterFactory.On("NewGetter", fixAddonsCfg.Spec.Repositories[0].URL, path.Join(tmpDir, "addon-loader-dst")).Return(ts.addonGetter, nil).Once()
defer ts.assertExpectations()
// WHEN
reconciler := NewReconcileAddonsConfiguration(ts.mgr, ts.addonGetterFactory, ts.chartStorage, ts.addonStorage,
ts.brokerFacade, ts.docsProvider, ts.brokerSyncer, ts.templateService, tmpDir, time.Second, spy.NewLogDummy())
// THEN
result, err := reconciler.Reconcile(reconcile.Request{NamespacedName: types.NamespacedName{Namespace: fixAddonsCfg.Namespace, Name: fixAddonsCfg.Name}})
assert.NoError(t, err)
assert.False(t, result.Requeue)
res := v1alpha1.AddonsConfiguration{}
err = ts.mgr.GetClient().Get(context.Background(), types.NamespacedName{Namespace: fixAddonsCfg.Namespace, Name: fixAddonsCfg.Name}, &res)
assert.NoError(t, err)
assert.Contains(t, res.Finalizers, v1alpha1.FinalizerAddonsConfiguration)
assert.Equal(t, res.Status.Phase, v1alpha1.AddonsConfigurationReady)
})
}
} | explode_data.jsonl/40347 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 770
} | [
2830,
3393,
693,
40446,
457,
2212,
2382,
7688,
21346,
2212,
2382,
7423,
1155,
353,
8840,
836,
8,
341,
2023,
43308,
11,
1613,
1669,
2088,
2415,
14032,
8465,
85,
16,
7141,
16,
1904,
2382,
7688,
515,
197,
197,
1,
3194,
89145,
6546,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateStepFunctionStateMachineName(t *testing.T) {
validTypes := []string{
"foo",
"BAR",
"FooBar123",
"FooBar123Baz-_",
}
invalidTypes := []string{
"foo bar",
"foo<bar>",
"foo{bar}",
"foo[bar]",
"foo*bar",
"foo?bar",
"foo#bar",
"foo%bar",
"foo\bar",
"foo^bar",
"foo|bar",
"foo~bar",
"foo$bar",
"foo&bar",
"foo,bar",
"foo:bar",
"foo;bar",
"foo/bar",
strings.Repeat("W", 81), // length > 80
}
for _, v := range validTypes {
_, errors := validateSfnStateMachineName(v, "name")
if len(errors) != 0 {
t.Fatalf("%q should be a valid Step Function State Machine name: %v", v, errors)
}
}
for _, v := range invalidTypes {
_, errors := validateSfnStateMachineName(v, "name")
if len(errors) == 0 {
t.Fatalf("%q should not be a valid Step Function State Machine name", v)
}
}
} | explode_data.jsonl/78599 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 386
} | [
2830,
3393,
17926,
8304,
5152,
94666,
675,
1155,
353,
8840,
836,
8,
341,
56322,
4173,
1669,
3056,
917,
515,
197,
197,
1,
7975,
756,
197,
197,
1,
33065,
756,
197,
197,
1,
40923,
3428,
16,
17,
18,
756,
197,
197,
1,
40923,
3428,
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... | 5 |
func TestFleetWithZeroReplicas(t *testing.T) {
t.Parallel()
ctx := context.Background()
client := framework.AgonesClient.AgonesV1()
flt := defaultFleet(framework.Namespace)
flt.Spec.Replicas = 0
flt, err := client.Fleets(framework.Namespace).Create(ctx, flt, metav1.CreateOptions{})
assert.NoError(t, err)
// can't think of a better way to wait for a bit before checking.
time.Sleep(time.Second)
list, err := framework.ListGameServersFromFleet(flt)
assert.NoError(t, err)
assert.Empty(t, list)
} | explode_data.jsonl/15430 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 184
} | [
2830,
3393,
37,
18973,
2354,
17999,
18327,
52210,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
20985,
1669,
2266,
19047,
741,
25291,
1669,
12626,
49850,
3154,
2959,
49850,
3154,
53,
16,
2822,
1166,
4832,
1669,
1638,
37,
18973,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNormalizeURL(t *testing.T) {
tests := []struct {
name, base, path, expect string
}{
{name: "basic URL", base: "https://example.com", path: "http://helm.sh/foo", expect: "http://helm.sh/foo"},
{name: "relative path", base: "https://helm.sh/charts", path: "foo", expect: "https://helm.sh/charts/foo"},
}
for _, tt := range tests {
got, err := normalizeURL(tt.base, tt.path)
if err != nil {
t.Errorf("%s: error %s", tt.name, err)
continue
} else if got != tt.expect {
t.Errorf("%s: expected %q, got %q", tt.name, tt.expect, got)
}
}
} | explode_data.jsonl/45512 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 242
} | [
2830,
3393,
87824,
3144,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
11,
2331,
11,
1815,
11,
1720,
914,
198,
197,
59403,
197,
197,
47006,
25,
330,
22342,
5548,
497,
2331,
25,
330,
2428,
1110,
8687,
905,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestConfig_ToString(t *testing.T) {
type fields struct {
Block *Block
FilePath string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "block",
fields: fields{
Block: &Block{
Directives: []IDirective{
&Directive{
Name: "user",
Parameters: []string{"nginx", "nginx"},
},
&Directive{
Name: "worker_processes",
Parameters: []string{"5"},
},
&Include{
Directive: &Directive{
Name: "include",
Parameters: []string{"/etc/nginx/conf/*.conf"},
},
IncludePath: "/etc/nginx/conf/*.conf",
},
},
},
},
want: "user nginx nginx;\nworker_processes 5;\ninclude /etc/nginx/conf/*.conf;",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &Config{
Block: tt.fields.Block,
FilePath: tt.fields.FilePath,
}
//TODO(tufan): create another dumper for a config and include statement (file thingis)
if got := DumpConfig(c, NoIndentStyle); got != tt.want {
t.Errorf("ToString() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/50894 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 571
} | [
2830,
3393,
2648,
38346,
703,
1155,
353,
8840,
836,
8,
341,
13158,
5043,
2036,
341,
197,
94940,
262,
353,
4713,
198,
197,
197,
19090,
914,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
55276,
5043,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestParallel_1(t *testing.T) {
conf := testConf.Config()
t.Parallel()
for _, test := range tests {
if err := test.Check(conf); err != nil {
t.Error(err)
}
}
} | explode_data.jsonl/41689 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 75
} | [
2830,
3393,
16547,
62,
16,
1155,
353,
8840,
836,
8,
341,
67850,
1669,
1273,
15578,
10753,
741,
3244,
41288,
7957,
741,
2023,
8358,
1273,
1669,
2088,
7032,
341,
197,
743,
1848,
1669,
1273,
10600,
29879,
1215,
1848,
961,
2092,
341,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 3 |
func TestDialContext_CANRaw(t *testing.T) {
requireVCAN0(t)
ctx, done := context.WithTimeout(context.Background(), time.Second)
defer done()
conn, err := DialContext(ctx, "can", "vcan0")
assert.NilError(t, err)
assert.NilError(t, conn.Close())
} | explode_data.jsonl/35854 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 96
} | [
2830,
3393,
35,
530,
1972,
45600,
20015,
1155,
353,
8840,
836,
8,
341,
17957,
11287,
1093,
15,
1155,
340,
20985,
11,
2814,
1669,
2266,
26124,
7636,
5378,
19047,
1507,
882,
32435,
340,
16867,
2814,
741,
32917,
11,
1848,
1669,
66155,
1972... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewPubMessage(t *testing.T) {
m := NewPubMessage(uuid.NewString(), "test", []byte("test"))
if m.Id == "" {
t.Fatal("expected PubMessage to set id")
}
if m.Type != PubMessage {
t.Fatalf("expected PubMessage but got %s", m.Type)
}
} | explode_data.jsonl/63184 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 97
} | [
2830,
3393,
3564,
29162,
2052,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
1532,
29162,
2052,
41458,
7121,
703,
1507,
330,
1944,
497,
3056,
3782,
445,
1944,
28075,
743,
296,
6444,
621,
1591,
341,
197,
3244,
26133,
445,
7325,
22611,
2052,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTelemetryEnabledToVLabs(t *testing.T) {
cs := getDefaultContainerService()
cs.Properties.FeatureFlags.EnableTelemetry = true
vlabsCS := ConvertContainerServiceToVLabs(cs)
if vlabsCS == nil {
t.Errorf("expected the converted containerService struct to be non-nil")
}
if !vlabsCS.Properties.FeatureFlags.EnableTelemetry {
t.Errorf("expected the EnableTelemetry feature flag to be true")
}
} | explode_data.jsonl/33 | {
"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,
6639,
35958,
5462,
1249,
30698,
3435,
1155,
353,
8840,
836,
8,
341,
71899,
1669,
69106,
4502,
1860,
741,
71899,
15945,
58434,
9195,
32287,
6639,
35958,
284,
830,
198,
5195,
70271,
6412,
1669,
7169,
4502,
1860,
1249,
30698,
343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSecondaryDiagnostics(t *testing.T) {
const dir = `
-- go.mod --
module mod.com
-- main.go --
package main
func main() {
panic("not here")
}
-- other.go --
package main
func main() {}
`
runner.Run(t, dir, func(t *testing.T, env *Env) {
log.SetFlags(log.Lshortfile)
env.OpenFile("main.go")
env.OpenFile("other.go")
env.Await(InitialWorkspaceLoad)
x := env.DiagnosticsFor("main.go")
if x == nil {
t.Fatalf("expected 1 diagnostic, got none")
}
if len(x.Diagnostics) != 1 {
t.Fatalf("main.go, got %d diagnostics, expected 1", len(x.Diagnostics))
}
keep := x.Diagnostics[0]
y := env.DiagnosticsFor("other.go")
if len(y.Diagnostics) != 1 {
t.Fatalf("other.go: got %d diagnostics, expected 1", len(y.Diagnostics))
}
if len(y.Diagnostics[0].RelatedInformation) != 1 {
t.Fatalf("got %d RelatedInformations, expected 1", len(y.Diagnostics[0].RelatedInformation))
}
// check that the RelatedInformation matches the error from main.go
c := y.Diagnostics[0].RelatedInformation[0]
if c.Location.Range != keep.Range {
t.Errorf("locations don't match. Got %v expected %v", c.Location.Range, keep.Range)
}
})
} | explode_data.jsonl/38938 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 463
} | [
2830,
3393,
48963,
35,
18938,
1155,
353,
8840,
836,
8,
341,
4777,
5419,
284,
22074,
313,
728,
10929,
39514,
4352,
1463,
905,
198,
313,
1887,
18002,
39514,
1722,
1887,
198,
2830,
1887,
368,
341,
30764,
445,
1921,
1588,
1138,
532,
313,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLeaveCommands(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
Client := th.Client
team := th.BasicTeam
user2 := th.BasicUser2
channel1 := &model.Channel{DisplayName: "AA", Name: "aa" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
channel1 = Client.Must(Client.CreateChannel(channel1)).(*model.Channel)
Client.Must(Client.AddChannelMember(channel1.Id, th.BasicUser.Id))
channel2 := &model.Channel{DisplayName: "BB", Name: "bb" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
channel2 = Client.Must(Client.CreateChannel(channel2)).(*model.Channel)
Client.Must(Client.AddChannelMember(channel2.Id, th.BasicUser.Id))
Client.Must(Client.AddChannelMember(channel2.Id, user2.Id))
channel3 := Client.Must(Client.CreateDirectChannel(th.BasicUser.Id, user2.Id)).(*model.Channel)
rs1 := Client.Must(Client.ExecuteCommand(channel1.Id, "/leave")).(*model.CommandResponse)
require.True(t, strings.HasSuffix(rs1.GotoLocation, "/"+team.Name+"/channels/"+model.DEFAULT_CHANNEL), "failed to leave open channel 1")
rs2 := Client.Must(Client.ExecuteCommand(channel2.Id, "/leave")).(*model.CommandResponse)
require.True(t, strings.HasSuffix(rs2.GotoLocation, "/"+team.Name+"/channels/"+model.DEFAULT_CHANNEL), "failed to leave private channel 1")
_, err := Client.ExecuteCommand(channel3.Id, "/leave")
require.NotNil(t, err, "should fail leaving direct channel")
cdata := Client.Must(Client.GetChannelsForTeamForUser(th.BasicTeam.Id, th.BasicUser.Id, "")).([]*model.Channel)
found := false
for _, c := range cdata {
if c.Id == channel1.Id || c.Id == channel2.Id {
found = true
}
}
require.False(t, found, "did not leave right channels")
for _, c := range cdata {
if c.Name == model.DEFAULT_CHANNEL {
_, err := Client.RemoveUserFromChannel(c.Id, th.BasicUser.Id)
require.NotNil(t, err, "should have errored on leaving default channel")
break
}
}
} | explode_data.jsonl/26342 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 711
} | [
2830,
3393,
21833,
30479,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
568,
3803,
15944,
741,
16867,
270,
836,
682,
4454,
2822,
71724,
1669,
270,
11716,
198,
197,
9196,
1669,
270,
48868,
14597,
198,
19060,
17,
1669,
270,
4886... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCase7(t *testing.T) {
golden := `v=0
o=- 1109162014219182 0 IN IP4 0.0.0.0
s=HIK Media Server V3.4.106
i=HIK Media Server Session Description : standard
e=NONE
c=IN IP4 0.0.0.0
t=0 0
a=control:*
b=AS:4106
a=range:clock=20210520T063812Z-20210520T064816Z
m=video 0 RTP/AVP 96
i=Video Media
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=4D0014;packetization-mode=0
a=control:trackID=video
b=AS:4096
m=audio 0 RTP/AVP 98
i=Audio Media
a=rtpmap:98 G7221/16000
a=control:trackID=audio
b=AS:10
a=Media_header:MEDIAINFO=494D4B48020100000400000121720110803E0000803E000000000000000000000000000000000000;
a=appversion:1.0
`
golden = strings.ReplaceAll(golden, "\n", "\r\n")
ctx, err := ParseSdp2LogicContext([]byte(golden))
assert.Equal(t, nil, err)
_ = ctx
} | explode_data.jsonl/55603 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 349
} | [
2830,
30573,
22,
1155,
353,
8840,
836,
8,
341,
3174,
813,
268,
1669,
1565,
85,
28,
15,
198,
78,
10829,
220,
16,
16,
15,
24,
16,
21,
17,
15,
16,
19,
17,
16,
24,
16,
23,
17,
220,
15,
1964,
6790,
19,
220,
15,
13,
15,
13,
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 TestSummaryValueAtPercentile_InitEmpty(t *testing.T) {
ms := NewSummaryValueAtPercentile()
assert.True(t, ms.IsNil())
ms.InitEmpty()
assert.False(t, ms.IsNil())
} | explode_data.jsonl/19585 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 66
} | [
2830,
3393,
19237,
1130,
1655,
32010,
457,
15644,
3522,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
19237,
1130,
1655,
32010,
457,
741,
6948,
32443,
1155,
11,
9829,
4506,
19064,
2398,
47691,
26849,
3522,
741,
6948,
50757,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestAccIterationPermissions_SetPermissions(t *testing.T) {
projectName := testutils.GenerateResourceName()
config := hclIterationPermissions(projectName, map[string]map[string]string{
"root": {
"CREATE_CHILDREN": "Deny",
"GENERIC_READ": "NotSet",
"DELETE": "Deny",
},
"iteration": {
"CREATE_CHILDREN": "Allow",
"GENERIC_READ": "NotSet",
"DELETE": "Allow",
},
})
tfNodeRoot := "azuredevops_iteration_permissions.root-permissions"
tfNodeIteration := "azuredevops_iteration_permissions.iteration-permissions"
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testutils.PreCheck(t, nil) },
Providers: testutils.GetProviders(),
CheckDestroy: testutils.CheckProjectDestroyed,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testutils.CheckProjectExists(projectName),
resource.TestCheckResourceAttrSet(tfNodeRoot, "project_id"),
resource.TestCheckResourceAttrSet(tfNodeRoot, "principal"),
resource.TestCheckNoResourceAttr(tfNodeRoot, "path"),
resource.TestCheckResourceAttr(tfNodeRoot, "permissions.%", "3"),
resource.TestCheckResourceAttr(tfNodeRoot, "permissions.CREATE_CHILDREN", "deny"),
resource.TestCheckResourceAttr(tfNodeRoot, "permissions.GENERIC_READ", "notset"),
resource.TestCheckResourceAttr(tfNodeRoot, "permissions.DELETE", "deny"),
resource.TestCheckResourceAttrSet(tfNodeIteration, "project_id"),
resource.TestCheckResourceAttrSet(tfNodeIteration, "principal"),
resource.TestCheckResourceAttr(tfNodeIteration, "path", "Iteration 1"),
resource.TestCheckResourceAttr(tfNodeIteration, "permissions.%", "3"),
resource.TestCheckResourceAttr(tfNodeIteration, "permissions.CREATE_CHILDREN", "allow"),
resource.TestCheckResourceAttr(tfNodeIteration, "permissions.GENERIC_READ", "notset"),
resource.TestCheckResourceAttr(tfNodeIteration, "permissions.DELETE", "allow"),
),
},
},
})
} | explode_data.jsonl/10941 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 785
} | [
2830,
3393,
14603,
53101,
23851,
14812,
23851,
1155,
353,
8840,
836,
8,
341,
72470,
675,
1669,
1273,
6031,
57582,
4783,
675,
741,
25873,
1669,
305,
564,
53101,
23851,
21168,
675,
11,
2415,
14032,
60,
2186,
14032,
30953,
515,
197,
197,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPullMerge(t *testing.T) {
onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) {
hookTasks, err := models.HookTasks(1, 1) //Retrieve previous hook number
assert.NoError(t, err)
hookTasksLenBefore := len(hookTasks)
session := loginUser(t, "user1")
testRepoFork(t, session, "user2", "repo1", "user1", "repo1")
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n")
resp := testPullCreate(t, session, "user1", "repo1", "master", "This is a pull title")
elem := strings.Split(test.RedirectURL(resp), "/")
assert.EqualValues(t, "pulls", elem[3])
testPullMerge(t, session, elem[1], elem[2], elem[4], models.MergeStyleMerge)
hookTasks, err = models.HookTasks(1, 1)
assert.NoError(t, err)
assert.Len(t, hookTasks, hookTasksLenBefore+1)
})
} | explode_data.jsonl/70633 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 342
} | [
2830,
3393,
36068,
52096,
1155,
353,
8840,
836,
8,
341,
24630,
38,
632,
64,
6727,
1155,
11,
2915,
1155,
353,
8840,
836,
11,
342,
632,
64,
3144,
353,
1085,
20893,
8,
341,
197,
9598,
1941,
25449,
11,
1848,
1669,
4119,
3839,
1941,
2544... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMemTombstonesConcurrency(t *testing.T) {
tomb := NewMemTombstones()
totalRuns := 100
var wg sync.WaitGroup
wg.Add(2)
go func() {
for x := 0; x < totalRuns; x++ {
tomb.AddInterval(uint64(x), Interval{int64(x), int64(x)})
}
wg.Done()
}()
go func() {
for x := 0; x < totalRuns; x++ {
_, err := tomb.Get(uint64(x))
assert.NoError(t, err)
}
wg.Done()
}()
wg.Wait()
} | explode_data.jsonl/80241 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 199
} | [
2830,
3393,
18816,
51,
2855,
32510,
79611,
1155,
353,
8840,
836,
8,
341,
3244,
2855,
1669,
1532,
18816,
51,
2855,
32510,
741,
34493,
73920,
1669,
220,
16,
15,
15,
198,
2405,
63581,
12811,
28384,
2808,
198,
72079,
1904,
7,
17,
692,
306... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUserAccessTokenDisableConfigBotsExcluded(t *testing.T) {
th := Setup(t)
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.EnableBotAccountCreation = true
*cfg.ServiceSettings.EnableUserAccessTokens = false
})
bot, resp, err := th.SystemAdminClient.CreateBot(&model.Bot{
Username: GenerateTestUsername(),
DisplayName: "a bot",
Description: "bot",
})
require.NoError(t, err)
CheckCreatedStatus(t, resp)
rtoken, _, err := th.SystemAdminClient.CreateUserAccessToken(bot.UserId, "test token")
th.Client.AuthToken = rtoken.Token
require.NoError(t, err)
_, _, err = th.Client.GetMe("")
require.NoError(t, err)
} | explode_data.jsonl/47555 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 249
} | [
2830,
3393,
1474,
37649,
25479,
2648,
33,
2412,
840,
10181,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
340,
16867,
270,
836,
682,
4454,
2822,
70479,
5105,
16689,
2648,
18552,
28272,
353,
2528,
10753,
8,
341,
197,
197,
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... | 1 |
func TestMapProfileToBranch(t *testing.T) {
_, filename, _, _ := runtime.Caller(0)
execPath := filepath.Dir(filename)
testfile := filepath.Join(execPath, "../../test/data/testcodefile")
lines, _ := fileparser.ReadLines(testfile)
base := filepath.Join(execPath, "../../")
tests := []struct {
name string
profileLine string
expected []*branch
}{
{
name: "uncoveredLines",
profileLine: "github.com/Liu-Chunhui/line-coverage/test/data/testcodefile:16.16,18.3 1 0",
expected: []*branch{
{
Start: 17,
Finish: 17,
Covered: false,
},
},
},
{
name: "finishingLineIs, nil",
profileLine: "github.com/Liu-Chunhui/line-coverage/test/data/testcodefile:59.2,59.19 1 60",
expected: []*branch{
{
Start: 59,
Finish: 59,
Covered: true,
},
},
},
{
name: "WhenStatementIs0ButExecuteTimesAreNot0_ThenShouldMarkedAsCovered",
profileLine: "github.com/Liu-Chunhui/line-coverage/test/data/testcodefile:15.14,15.14 0 2",
expected: []*branch{
{
Start: 15,
Finish: 15,
Covered: true,
},
},
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
profile, err := mapLineToCoverageProfile(tt.profileLine, "github.com/Liu-Chunhui/line-coverage", base)
require.NoError(t, err)
target, branches := convertProfileToBranch(profile, lines)
require.NotNil(t, target)
assert.NotEmpty(t, target)
assert.Equal(t, tt.expected, branches)
})
}
} | explode_data.jsonl/20910 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 732
} | [
2830,
3393,
2227,
8526,
1249,
18197,
1155,
353,
8840,
836,
8,
341,
197,
6878,
3899,
11,
8358,
716,
1669,
15592,
727,
13956,
7,
15,
340,
67328,
1820,
1669,
26054,
83757,
10961,
340,
18185,
1192,
1669,
26054,
22363,
46896,
1820,
11,
10208... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_Resolve_Operations_Fail_UnknownType(t *testing.T) {
data := `
http:
test:
some_url:
endpoint: GET /some/url/{id:nonexisting1}
query:
the_query: nonexisting2
header:
The-Header: nonexisting3
response:
ok: empty
`
old, err := unmarshalSpec([]byte(data))
assert.Equal(t, err, nil)
errors := enrichSpec(old)
assert.Equal(t, len(errors), 3)
assert.Equal(t, strings.Contains(errors[0].Message, "nonexisting1"), true)
assert.Equal(t, strings.Contains(errors[1].Message, "nonexisting2"), true)
assert.Equal(t, strings.Contains(errors[2].Message, "nonexisting3"), true)
} | explode_data.jsonl/79847 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 323
} | [
2830,
3393,
62,
56808,
2232,
712,
804,
1400,
604,
62,
13790,
929,
1155,
353,
8840,
836,
8,
341,
8924,
1669,
22074,
1254,
510,
262,
1273,
510,
286,
1045,
2903,
510,
310,
14887,
25,
7890,
608,
14689,
57254,
9388,
307,
25,
6280,
36895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetCourseHTML(t *testing.T) {
handler := func(r *http.Request) (*http.Response, error) {
body := `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link
href="https://fonts.googleapis.com/css?family=Lato|Satisfy|Kristi&display=swap"
rel="stylesheet"
/>
<link href="/assets/styles.css" rel="stylesheet">
<title>Gophercises | courses.calhoun.io</title>
</head>
<body class="bg-grey-100">
<div class="w-full mb-4 pt-8">
<div>
<h3 class="text-grey-600 border-b border-grey-200 py-1 text-2xl flex items-baseline mx-6">
<div>Quiz Game</div>
</h3>
<div class="text-grey-600 px-6 py-2 markdown">
<p>Create a program to run timed quizes via the command line.</p>
</div>
<div class="flex flex-wrap px-2 pt-4 pb-12">
<a href="/lessons/les_goph_01">
<div class="w-64 mb-4 mx-4">
<div class="w-full h-144px">
<img alt="Thumbnail for Overview" src="/assets/img/thumbs/les_goph_01.png" class="rounded max-h-full" />
</div>
<div class="px-2 py-2">
<span class="text-grey-700 font-sans no-underline">
Overview
</span>
</div>
</div>
</a>
<a href="/lessons/les_goph_02">
<div class="w-64 mb-4 mx-4">
<div class="w-full h-144px">
<img alt="Thumbnail for Solution - Part 1" src="/assets/img/thumbs/les_goph_02.png" class="rounded max-h-full" />
</div>
<div class="px-2 py-2">
<span class="text-grey-700 font-sans no-underline">
Solution - Part 1
</span>
</div>
</div>
</a>
<a href="/lessons/les_goph_03">
<div class="w-64 mb-4 mx-4">
<div class="w-full h-144px">
<img alt="Thumbnail for Solution - Part 2" src="/assets/img/thumbs/les_goph_03.png" class="rounded max-h-full" />
</div>
<div class="px-2 py-2">
<span class="text-grey-700 font-sans no-underline">
Solution - Part 2
</span>
</div>
</div>
</a>
</div>
</div>
</div>`
return &http.Response{
Body: ioutil.NopCloser(strings.NewReader(body)),
}, nil
}
t.Run("getCourseHTML: fetches the course HTML main page, this page contains links to individual lessons that make up the course", func(t *testing.T) {
client, _ := NewClient(WithTransport(handler))
// set course name
*course = *course + "_test"
getCourseHTML(courses["gophercises"], client)
assert.True(t, fileExists(*course+".html"))
os.Remove(*course + ".html")
})
} | explode_data.jsonl/67950 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1244
} | [
2830,
3393,
1949,
23340,
5835,
1155,
353,
8840,
836,
8,
341,
53326,
1669,
2915,
2601,
353,
1254,
9659,
8,
4609,
1254,
12574,
11,
1465,
8,
341,
197,
35402,
1669,
1565,
13543,
15458,
5272,
397,
197,
197,
13745,
8688,
428,
268,
881,
7847... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidation(t *testing.T) {
// Scenarios: This test contains the following sub-tests:
// 1) alive message validation: a message is validated <==> it entered the message store
// 2) request/response message validation:
// 2.1) alive messages from membership requests/responses are validated.
// 2.2) once alive messages enter the message store, reception of them via membership responses
// doesn't trigger validation, but via membership requests - do.
wrapReceivedMessage := func(msg *protoext.SignedGossipMessage) protoext.ReceivedMessage {
return &dummyReceivedMessage{
msg: msg,
info: &protoext.ConnectionInfo{
ID: common.PKIidType("testID"),
},
}
}
requestMessagesReceived := make(chan *protoext.SignedGossipMessage, 100)
responseMessagesReceived := make(chan *protoext.SignedGossipMessage, 100)
aliveMessagesReceived := make(chan *protoext.SignedGossipMessage, 5000)
var membershipRequest atomic.Value
var membershipResponseWithAlivePeers atomic.Value
var membershipResponseWithDeadPeers atomic.Value
recordMembershipRequest := func(req *protoext.SignedGossipMessage) {
msg, _ := protoext.EnvelopeToGossipMessage(req.GetMemReq().SelfInformation)
membershipRequest.Store(req)
requestMessagesReceived <- msg
}
recordMembershipResponse := func(res *protoext.SignedGossipMessage) {
memRes := res.GetMemRes()
if len(memRes.GetAlive()) > 0 {
membershipResponseWithAlivePeers.Store(res)
}
if len(memRes.GetDead()) > 0 {
membershipResponseWithDeadPeers.Store(res)
}
responseMessagesReceived <- res
}
interceptor := func(msg *protoext.SignedGossipMessage) {
if memReq := msg.GetMemReq(); memReq != nil {
recordMembershipRequest(msg)
return
}
if memRes := msg.GetMemRes(); memRes != nil {
recordMembershipResponse(msg)
return
}
// Else, it's an alive message
aliveMessagesReceived <- msg
}
// p3 is the boot peer of p1, and p1 is the boot peer of p2.
// p1 sends a (membership) request to p3, and receives a (membership) response back.
// p2 sends a (membership) request to p1.
// Therefore, p1 receives both a membership request and a response.
p1 := createDiscoveryInstanceThatGossipsWithInterceptors(4675, "p1", []string{bootPeer(4677)}, true, noopPolicy, interceptor, defaultTestConfig)
p2 := createDiscoveryInstance(4676, "p2", []string{bootPeer(4675)})
p3 := createDiscoveryInstance(4677, "p3", nil)
instances := []*gossipInstance{p1, p2, p3}
assertMembership(t, instances, 2)
instances = []*gossipInstance{p1, p2}
// Stop p3 and wait until its death is detected
p3.Stop()
assertMembership(t, instances, 1)
// Force p1 to send a membership request so it can receive back a response
// with dead peers.
p1.InitiateSync(1)
// Wait until a response with a dead peer is received
waitUntilOrFail(t, func() bool {
return membershipResponseWithDeadPeers.Load() != nil
})
p1.Stop()
p2.Stop()
close(aliveMessagesReceived)
t.Log("Recorded", len(aliveMessagesReceived), "alive messages")
t.Log("Recorded", len(requestMessagesReceived), "request messages")
t.Log("Recorded", len(responseMessagesReceived), "response messages")
// Ensure we got alive messages from membership requests and from membership responses
assert.NotNil(t, membershipResponseWithAlivePeers.Load())
assert.NotNil(t, membershipRequest.Load())
t.Run("alive message", func(t *testing.T) {
// Spawn a new peer - p4
p4 := createDiscoveryInstance(4678, "p1", nil)
defer p4.Stop()
// Record messages validated
validatedMessages := make(chan *protoext.SignedGossipMessage, 5000)
p4.comm.recordValidation(validatedMessages)
tmpMsgs := make(chan *protoext.SignedGossipMessage, 5000)
// Replay the messages sent to p1 into p4, and also save them into a temporary channel
for msg := range aliveMessagesReceived {
p4.comm.incMsgs <- wrapReceivedMessage(msg)
tmpMsgs <- msg
}
// Simulate the messages received by p4 into the message store
policy := protoext.NewGossipMessageComparator(0)
msgStore := msgstore.NewMessageStore(policy, func(_ interface{}) {})
close(tmpMsgs)
for msg := range tmpMsgs {
if msgStore.Add(msg) {
// Ensure the message was verified if it can be added into the message store
expectedMessage := <-validatedMessages
assert.Equal(t, expectedMessage, msg)
}
}
// Ensure we didn't validate any other messages.
assert.Empty(t, validatedMessages)
})
req := membershipRequest.Load().(*protoext.SignedGossipMessage)
res := membershipResponseWithDeadPeers.Load().(*protoext.SignedGossipMessage)
// Ensure the membership response contains both alive and dead peers
assert.Len(t, res.GetMemRes().GetAlive(), 2)
assert.Len(t, res.GetMemRes().GetDead(), 1)
for _, testCase := range []struct {
name string
expectedAliveMessages int
port int
message *protoext.SignedGossipMessage
shouldBeReValidated bool
}{
{
name: "membership request",
expectedAliveMessages: 1,
message: req,
port: 4679,
shouldBeReValidated: true,
},
{
name: "membership response",
expectedAliveMessages: 3,
message: res,
port: 4680,
},
} {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
p := createDiscoveryInstance(testCase.port, "p", nil)
defer p.Stop()
// Record messages validated
validatedMessages := make(chan *protoext.SignedGossipMessage, testCase.expectedAliveMessages)
p.comm.recordValidation(validatedMessages)
p.comm.incMsgs <- wrapReceivedMessage(testCase.message)
// Ensure all messages were validated
for i := 0; i < testCase.expectedAliveMessages; i++ {
validatedMsg := <-validatedMessages
// send the message directly to be included in the message store
p.comm.incMsgs <- wrapReceivedMessage(validatedMsg)
}
// Wait for the messages to be validated
for i := 0; i < testCase.expectedAliveMessages; i++ {
<-validatedMessages
}
// Not more than testCase.expectedAliveMessages should have been validated
assert.Empty(t, validatedMessages)
if !testCase.shouldBeReValidated {
// Re-submit the message twice and ensure it wasn't validated.
// If it is validated, panic would occur because an enqueue to the validatesMessages channel
// would be attempted and the channel is closed.
close(validatedMessages)
}
p.comm.incMsgs <- wrapReceivedMessage(testCase.message)
p.comm.incMsgs <- wrapReceivedMessage(testCase.message)
// Wait until the size of the channel is zero. It means at least one message was processed.
waitUntilOrFail(t, func() bool {
return len(p.comm.incMsgs) == 0
})
})
}
} | explode_data.jsonl/62260 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2428
} | [
2830,
3393,
13799,
1155,
353,
8840,
836,
8,
341,
197,
322,
2463,
60494,
25,
1096,
1273,
5610,
279,
2701,
1186,
81094,
510,
197,
322,
220,
16,
8,
13675,
1943,
10519,
25,
264,
1943,
374,
32332,
366,
84653,
432,
10636,
279,
1943,
3553,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestApiRouter(t *testing.T) {
registry := &Registry{}
router := gin.New()
registry.ApiRegister(router)
pathMix := []string{
"/registry/v1/token",
"/registry/v1/notifications",
"/registry/v1/repositories/mine",
"/registry/v1/repositories/public",
"/registry/v1/tag/list/:namespace/:image",
"/registry/v1/manifests/:reference/:namespace/:image",
"/registry/v1/:namespace/:image/publicity",
}
for _, info := range router.Routes() {
assert.Contains(t, pathMix, info.Path)
}
} | explode_data.jsonl/53353 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 224
} | [
2830,
3393,
6563,
9523,
1155,
353,
8840,
836,
8,
341,
197,
29172,
1669,
609,
15603,
31483,
67009,
1669,
46183,
7121,
2822,
197,
29172,
21044,
8690,
61210,
692,
26781,
58083,
1669,
3056,
917,
515,
197,
197,
3115,
29172,
5457,
16,
54386,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestApp_Run_Categories(t *testing.T) {
buf := new(bytes.Buffer)
app := &App{
Name: "categories",
HideHelp: true,
Commands: []*Command{
{
Name: "command1",
Category: "1",
},
{
Name: "command2",
Category: "1",
},
{
Name: "command3",
Category: "2",
},
},
Writer: buf,
}
app.Run([]string{"categories"})
expect := commandCategories([]*commandCategory{
{
name: "1",
commands: []*Command{
app.Commands[0],
app.Commands[1],
},
},
{
name: "2",
commands: []*Command{
app.Commands[2],
},
},
})
if !reflect.DeepEqual(app.Categories, &expect) {
t.Fatalf("expected categories %#v, to equal %#v", app.Categories, &expect)
}
output := buf.String()
t.Logf("output: %q\n", buf.Bytes())
if !strings.Contains(output, "1:\n command1") {
t.Errorf("want buffer to include category %q, did not: \n%q", "1:\n command1", output)
}
} | explode_data.jsonl/52590 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 458
} | [
2830,
3393,
2164,
84158,
920,
5268,
1155,
353,
8840,
836,
8,
341,
26398,
1669,
501,
23158,
22622,
692,
28236,
1669,
609,
2164,
515,
197,
21297,
25,
257,
330,
15497,
756,
197,
13292,
577,
12689,
25,
830,
345,
197,
197,
30479,
25,
29838... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDB_BeginRW(t *testing.T) {
db := MustOpenDB()
defer db.MustClose()
tx, err := db.Begin(true)
if err != nil {
t.Fatal(err)
} else if tx == nil {
t.Fatal("expected tx")
}
if tx.DB() != db.DB {
t.Fatal("unexpected tx database")
} else if !tx.Writable() {
t.Fatal("expected writable tx")
}
if err := tx.Commit(); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/27473 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
3506,
93447,
56368,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
15465,
5002,
3506,
741,
16867,
2927,
50463,
7925,
2822,
46237,
11,
1848,
1669,
2927,
28467,
3715,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
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... | 6 |
func TestListAny(t *testing.T) {
list := New()
list.Add("a", "b", "c")
any := list.Any(func(index int, value interface{}) bool {
return value.(string) == "c"
})
if any != true {
t.Errorf("Got %v expected %v", any, true)
}
any = list.Any(func(index int, value interface{}) bool {
return value.(string) == "x"
})
if any != false {
t.Errorf("Got %v expected %v", any, false)
}
} | explode_data.jsonl/18296 | {
"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,
852,
8610,
1155,
353,
8840,
836,
8,
341,
14440,
1669,
1532,
741,
14440,
1904,
445,
64,
497,
330,
65,
497,
330,
66,
1138,
197,
3767,
1669,
1140,
13311,
18552,
7195,
526,
11,
897,
3749,
28875,
1807,
341,
197,
853,
897,
128... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSetLocker(t *testing.T) {
if locker != nil {
t.Fail()
t.Log("Expected locker to not be set by default")
}
SetLocker(&lockerMock{})
if locker == nil {
t.Fail()
t.Log("Expected locker to be set")
}
} | explode_data.jsonl/63507 | {
"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,
1649,
87253,
1155,
353,
8840,
836,
8,
341,
743,
34679,
961,
2092,
341,
197,
3244,
57243,
741,
197,
3244,
5247,
445,
18896,
34679,
311,
537,
387,
738,
553,
1638,
1138,
197,
630,
22212,
87253,
2099,
93414,
11571,
6257,
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
] | 3 |
func TestConvertWithBadImportTypedef(t *testing.T) {
lines, err := convertTypes(
"Foo", "Bar",
`
include "../../bar.thrift"
struct Foo {
1: optional bar.MyString one
2: required string two
}
struct Bar {
1: optional bar.MyString one
2: required string two
}`,
map[string][]byte{
"../../bar.thrift": []byte(`
typedef string MyString
`),
},
nil,
)
assert.Error(t, err)
assert.Equal(t, "", lines)
assert.Contains(t,
err.Error(),
"could not lookup fieldType when building converter for MyString",
)
} | explode_data.jsonl/62042 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 233
} | [
2830,
3393,
12012,
2354,
17082,
11511,
12834,
4219,
1155,
353,
8840,
836,
8,
341,
78390,
11,
1848,
1669,
5508,
4173,
1006,
197,
197,
1,
40923,
497,
330,
3428,
756,
197,
197,
3989,
197,
24699,
10208,
2257,
13677,
41380,
698,
2394,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAPISendMessage(t *testing.T) {
// perform login through api
req := crud.NewSignInEmailRequest("bejanhtc@gmail.com", "Saburi123")
resp, err := req.LoginByEmail()
if err != nil {
t.Fatal(err)
}
// send message
msg := crud.NewMessage(fmt.Sprintf("Test Message %s", uuid.New().String()), resp.Data.User)
respMsg, err := msg.SendMessage("23e7235e-2072-3330-91b7-3b747d5a87e7", resp.Data.AccessToken)
if err == crud.ErrMessageInternal {
t.Skip("server sends 500 Internal Server Error, but message is sent")
} else if err != nil {
t.Fatal(err)
}
_ = respMsg
} | explode_data.jsonl/15732 | {
"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,
2537,
1637,
408,
2052,
1155,
353,
8840,
836,
8,
341,
197,
322,
2736,
5858,
1526,
6330,
198,
24395,
1669,
75404,
7121,
35423,
4781,
1900,
445,
1371,
22838,
426,
66,
10375,
905,
497,
330,
76378,
6070,
16,
17,
18,
1138,
34653... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPeerMonitor(t *testing.T) {
peer := NewBpPeer(
p2p.ID(tmrand.Str(12)), 0, 10,
func(err error, _ p2p.ID) {},
nil)
peer.SetLogger(log.TestingLogger())
peer.startMonitor()
assert.NotNil(t, peer.recvMonitor)
peer.stopMonitor()
assert.Nil(t, peer.recvMonitor)
} | explode_data.jsonl/35421 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 126
} | [
2830,
3393,
30888,
30098,
1155,
353,
8840,
836,
8,
341,
197,
16537,
1669,
1532,
33,
79,
30888,
1006,
197,
3223,
17,
79,
9910,
64190,
11335,
27318,
7,
16,
17,
5731,
220,
15,
11,
220,
16,
15,
345,
197,
29244,
3964,
1465,
11,
716,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTemplateGoIssues(t *testing.T) {
b := newTestSitesBuilder(t)
b.WithTemplatesAdded(
"index.html", `
{{ $title := "a & b" }}
<script type="application/ld+json">{"@type":"WebPage","headline":"{{$title}}"}</script>
{{/* Action/commands newlines, from Go 1.16, see https://github.com/golang/go/issues/29770 */}}
{{ $norway := dict
"country" "Norway"
"population" "5 millions"
"language" "Norwegian"
"language_code" "nb"
"weather" "freezing cold"
"capitol" "Oslo"
"largest_city" "Oslo"
"currency" "Norwegian krone"
"dialing_code" "+47"
}}
Population in Norway is {{
$norway.population
| lower
| upper
}}
`,
)
b.Build(BuildCfg{})
b.AssertFileContent("public/index.html", `
<script type="application/ld+json">{"@type":"WebPage","headline":"a \u0026 b"}</script>
Population in Norway is 5 MILLIONS
`)
} | explode_data.jsonl/60661 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 323
} | [
2830,
3393,
7275,
10850,
85828,
1155,
353,
8840,
836,
8,
341,
2233,
1669,
501,
2271,
93690,
3297,
1155,
692,
2233,
26124,
51195,
19337,
1006,
197,
197,
1,
1252,
2564,
497,
22074,
2979,
400,
2102,
1669,
330,
64,
609,
293,
1,
8096,
7734... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.