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 TestQuerytronShallow(t *testing.T) {
is := func(got, expect, message string) {
if got != expect {
t.Errorf("%s failed - got '%s', expected '%s'\n", message, got, expect)
}
}
q := set(Q{
"name": "overridden name",
"secret": "overridden secret",
"ignored": "overridden ignored (BAD!)",
})
shallow := Shallow{
Name: "initial name",
hidden: "initial hidden",
Ignored: "initial ignored",
}
is(shallow.Name, "initial name", "initial name is set before testing")
is(shallow.Ignored, "initial ignored", "initial ignored is set before testing")
is(shallow.hidden, "initial hidden", "initial hidden is set before testing")
qs.Override(&shallow, q)
is(shallow.Name, "overridden name", "Name is overridden from NAME env var")
is(shallow.Ignored, "initial ignored", "initial ignored is still set")
is(shallow.hidden, "initial hidden", "hidden fields cannot be overridden")
} | explode_data.jsonl/13873 | {
"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,
2859,
34685,
2016,
7183,
1155,
353,
8840,
836,
8,
341,
19907,
1669,
2915,
3268,
354,
11,
1720,
11,
1943,
914,
8,
341,
197,
743,
2684,
961,
1720,
341,
298,
3244,
13080,
4430,
82,
4641,
481,
2684,
7677,
82,
516,
3601,
7677... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAESSIV_EmptyAdditionalData(t *testing.T) {
keyStr :=
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" +
"00112233445566778899aabbccddeefff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
key, _ := hex.DecodeString(keyStr)
a, err := subtle.NewAESSIV(key)
if err != nil {
t.Errorf("NewAESSIV(key) = _, %v, want _, nil", err)
}
ct, err := a.EncryptDeterministically(nil, nil)
if err != nil {
t.Errorf("Unexpected encryption error: %v", err)
}
if pt, err := a.DecryptDeterministically(ct, nil); err != nil {
t.Errorf("Unexpected decryption error: %v", err)
} else if !bytes.Equal(pt, []byte{}) {
t.Errorf("Mismatched plaintexts: got %v, want []", pt)
}
if pt, err := a.DecryptDeterministically(ct, []byte{}); err != nil {
t.Errorf("Unexpected decryption error: %v", err)
} else if !bytes.Equal(pt, []byte{}) {
t.Errorf("Mismatched plaintexts: got %v, want []", pt)
}
} | explode_data.jsonl/7233 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 410
} | [
2830,
3393,
32,
9996,
3090,
76060,
1595,
29019,
1043,
1155,
353,
8840,
836,
8,
341,
23634,
2580,
19687,
197,
197,
1,
15,
15,
15,
16,
15,
17,
15,
18,
15,
19,
15,
20,
15,
21,
15,
22,
15,
23,
15,
24,
15,
64,
15,
65,
15,
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,
1... | 7 |
func TestInt32_Add(t *testing.T) {
testcases := []struct {
name string
input []int32
expect []int32
}{
{
name: "test Int32 Add, inputs nothing",
input: []int32{},
expect: []int32{},
},
{
name: "test Int32 Add, inputs multiple elements",
input: []int32{1, 2, 3},
expect: []int32{1, 2, 3},
},
}
for _, tc := range testcases {
t.Logf("running scenario: %s", tc.name)
actual := Int32{}
actual.Add(tc.input...)
validateInt32(t, actual, tc.expect)
}
} | explode_data.jsonl/62318 | {
"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,
1072,
18,
17,
21346,
1155,
353,
8840,
836,
8,
341,
18185,
23910,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
22427,
220,
3056,
396,
18,
17,
198,
197,
24952,
3056,
396,
18,
17,
198,
197,
59403,
197,
197,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestEncryptDecrypt(t *testing.T) {
var tests = []struct {
input string
passphrase passphrase
}{
{"log", passphrase("popcorn")},
{"log", passphrase("pa$$word")},
{"log", passphrase("pdsasdas")},
{"log", passphrase("[asdsdasdmasn]")},
{"log", passphrase("popwas")},
{"log", passphrase("oi0isas")},
{"log", passphrase("0=2oasdaj")},
{"test", passphrase("testPass")},
{"test", passphrase("asdasdasd")},
{"test", passphrase("testP[ss")},
{"test", passphrase("195s2f5")},
{"test", passphrase("%%%%%%%s")},
{"test", passphrase("#491k2@")},
{"test", passphrase("[]'fd;fo;hkaf")},
}
for _, test := range tests {
var wg sync.WaitGroup
var encryptedDataChan = make(chan encryptedData)
wg.Add(1)
go encrypt([]byte(test.input), test.passphrase, encryptedDataChan, &wg)
encryptedResults := <-encryptedDataChan
wg.Wait()
if decryptedDataRes := string(decrypt(encryptedResults, test.passphrase)); decryptedDataRes != test.input {
t.Error("Test failed: input:{} expectedOutput:{} output:{}", test.input, test.input, string(decryptedDataRes))
}
}
} | explode_data.jsonl/46190 | {
"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,
61520,
89660,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
1235,
341,
197,
22427,
414,
914,
198,
197,
41431,
27710,
75493,
198,
197,
59403,
197,
197,
4913,
839,
497,
75493,
445,
8374,
38630,
79583,
197,
197,
4913,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDomainRecordEditRequest_String(t *testing.T) {
record := &DomainRecordEditRequest{
Type: "CNAME",
Name: "example",
Data: "@",
Priority: 10,
Port: 10,
TTL: 1800,
Weight: 10,
Flags: 1,
Tag: "test",
}
stringified := record.String()
expected := `godo.DomainRecordEditRequest{Type:"CNAME", Name:"example", Data:"@", Priority:10, Port:10, TTL:1800, Weight:10, Flags:1, Tag:"test"}`
if expected != stringified {
t.Errorf("DomainRecordEditRequest.String returned %+v, expected %+v", stringified, expected)
}
} | explode_data.jsonl/22681 | {
"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,
13636,
6471,
4036,
1900,
31777,
1155,
353,
8840,
836,
8,
341,
71952,
1669,
609,
13636,
6471,
4036,
1900,
515,
197,
27725,
25,
257,
330,
34,
7535,
756,
197,
21297,
25,
257,
330,
8687,
756,
197,
40927,
25,
257,
8428,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIfString(t *testing.T) {
assert.True(t, IfString(true, "1", "0") == "1")
assert.True(t, IfString(false, "1", "0") == "0")
} | explode_data.jsonl/43219 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 60
} | [
2830,
3393,
2679,
703,
1155,
353,
8840,
836,
8,
341,
6948,
32443,
1155,
11,
1416,
703,
3715,
11,
330,
16,
497,
330,
15,
899,
621,
330,
16,
1138,
6948,
32443,
1155,
11,
1416,
703,
3576,
11,
330,
16,
497,
330,
15,
899,
621,
330,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestReaderSetOffsetWhenConsumerGroupsEnabled(t *testing.T) {
r := &Reader{config: ReaderConfig{GroupID: "not-zero"}}
if err := r.SetOffset(LastOffset); err != errNotAvailableWithGroup {
t.Fatalf("expected %v; got %v", errNotAvailableWithGroup, err)
}
} | explode_data.jsonl/80369 | {
"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,
5062,
1649,
6446,
4498,
29968,
22173,
5462,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
609,
5062,
90,
1676,
25,
25166,
2648,
90,
2808,
915,
25,
330,
1921,
36929,
95642,
743,
1848,
1669,
435,
4202,
6446,
4957,
559,
6446,
121... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAppleKeySet_Get(t *testing.T) {
testKeySet := appleKeySet{}
_, err := testKeySet.get("some-kid")
assert.Error(t, err, "failed to get key in appleKeySet, key set is nil or empty")
testKeySet, err = parseAppleJWK([]byte(`{"keys":[{
"kty": "RSA",
"kid": "86D88Kf",
"use": "sig",
"alg": "RS256",
"n": "iGaLqP6y-SJCCBq5Hv6pGDbG_SQ11MNjH7rWHcCFYz4hGwHC4lcSurTlV8u3avoVNM8jXevG1Iu1SY11qInqUvjJur--hghr1b56OPJu6H1iKulSxGjEIyDP6c5BdE1uwprYyr4IO9th8fOwCPygjLFrh44XEGbDIFeImwvBAGOhmMB2AD1n1KviyNsH0bEB7phQtiLk-ILjv1bORSRl8AK677-1T8isGfHKXGZ_ZGtStDe7Lu0Ihp8zoUt59kx2o9uWpROkzF56ypresiIl4WprClRCjz8x6cPZXU2qNWhu71TQvUFwvIvbkE1oYaJMb0jcOTmBRZA2QuYw-zHLwQ",
"e": "AQAB"
}]}`))
require.Nil(t, err)
apk, err := testKeySet.get("86D88Kf")
assert.Nil(t, err)
assert.Equal(t, apk.ID, "86D88Kf")
_, err = testKeySet.get("not-found-kid")
assert.Error(t, err, "key with ID some-kid not found")
} | explode_data.jsonl/74295 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 552
} | [
2830,
3393,
26567,
1592,
1649,
13614,
1155,
353,
8840,
836,
8,
341,
18185,
1592,
1649,
1669,
23268,
1592,
1649,
16094,
197,
6878,
1848,
1669,
1273,
1592,
1649,
670,
445,
14689,
12646,
307,
1138,
6948,
6141,
1155,
11,
1848,
11,
330,
1609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_one_element(t *testing.T) {
should := require.New(t)
iter := jsoner.ParseString(jsoner.DefaultAPI(), `[1]`)
should.True(iter.ReadArray())
should.Equal(1, iter.ReadInt())
should.False(iter.ReadArray())
iter = jsoner.ParseString(jsoner.DefaultAPI(), `[1]`)
iter.ReadArrayCB(func(iter *jsoner.Iterator) bool {
should.Equal(1, iter.ReadInt())
return true
})
} | explode_data.jsonl/57872 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 150
} | [
2830,
3393,
11667,
7894,
1155,
353,
8840,
836,
8,
341,
197,
5445,
1669,
1373,
7121,
1155,
340,
79924,
1669,
2951,
261,
8937,
703,
9304,
261,
13275,
7082,
1507,
77644,
16,
60,
24183,
197,
5445,
32443,
27070,
6503,
1857,
2398,
197,
5445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSquashCorrectness(t *testing.T) {
engine, pool, cleanup := setup(t)
defer cleanup()
squashEngine := newSquashEngine(pool)
queries := []string{
`SELECT * FROM repositories`,
`SELECT * FROM refs`,
`SELECT * FROM remotes`,
`SELECT * FROM commits`,
`SELECT * FROM tree_entries`,
`SELECT * FROM blobs`,
`SELECT * FROM files`,
`SELECT * FROM repositories r INNER JOIN refs ON r.repository_id = refs.repository_id`,
`SELECT * FROM repositories r INNER JOIN remotes ON r.repository_id = remotes.repository_id`,
`SELECT * FROM refs r INNER JOIN remotes re ON r.repository_id = re.repository_id`,
`SELECT * FROM refs r INNER JOIN commits c ON r.commit_hash = c.commit_hash`,
`SELECT * FROM ref_commits r INNER JOIN commits c ON r.commit_hash = c.commit_hash`,
`SELECT * FROM refs r INNER JOIN commit_trees t ON r.commit_hash = t.commit_hash`,
`SELECT * FROM refs r INNER JOIN commit_blobs b ON r.commit_hash = b.commit_hash`,
`SELECT * FROM refs r
INNER JOIN commit_blobs cb
ON r.commit_hash = cb.commit_hash
INNER JOIN blobs b
ON cb.blob_hash = b.blob_hash`,
`SELECT * FROM commits c INNER JOIN commit_trees t ON c.commit_hash = t.tree_hash`,
`SELECT * FROM commits c INNER JOIN tree_entries te ON c.tree_hash = te.tree_hash`,
`SELECT * FROM commits c
INNER JOIN commit_blobs cb
ON c.commit_hash = cb.commit_hash
INNER JOIN blobs b
ON cb.blob_hash = b.blob_hash`,
`SELECT * FROM tree_entries te INNER JOIN blobs b ON te.blob_hash = b.blob_hash`,
`SELECT * FROM commit_files NATURAL JOIN files`,
`SELECT * FROM commit_files c INNER JOIN files f ON c.tree_hash = f.tree_hash`,
`SELECT * FROM repositories r
INNER JOIN refs re
ON r.repository_id = re.repository_id
INNER JOIN commits c
ON re.commit_hash = c.commit_hash
WHERE re.ref_name = 'HEAD'`,
`SELECT * FROM commits c
INNER JOIN commit_trees t
ON c.commit_hash = t.commit_hash
INNER JOIN tree_entries te
ON t.tree_hash = te.tree_hash
INNER JOIN blobs b
ON te.blob_hash = b.blob_hash
WHERE te.tree_entry_name = 'LICENSE'`,
`SELECT * FROM repositories,
commits c INNER JOIN tree_entries te
ON c.tree_hash = te.tree_hash`,
`SELECT * FROM refs r
INNER JOIN ref_commits c
ON r.ref_name = c.ref_name
AND c.repository_id = r.repository_id`,
`SELECT * FROM refs r
INNER JOIN ref_commits c
ON r.commit_hash = c.commit_hash
AND r.ref_name = c.ref_name
AND c.repository_id = r.repository_id`,
`SELECT COUNT(r.*) as repos FROM repositories r`,
`SELECT repository_id, num_files FROM (
SELECT COUNT(f.*) num_files, f.repository_id
FROM ref_commits r
INNER JOIN commit_files cf
ON r.commit_hash = cf.commit_hash
AND r.repository_id = cf.repository_id
INNER JOIN files f
ON cf.repository_id = f.repository_id
AND cf.blob_hash = f.blob_hash
AND cf.tree_hash = f.tree_hash
AND cf.file_path = f.file_path
WHERE r.ref_name = 'HEAD'
GROUP BY f.repository_id
) t
ORDER BY num_files DESC
LIMIT 10`,
`SELECT
SUBSTRING(repository_id_part, 1, ARRAY_LENGTH(SPLIT(repository_id_part, ''))-4) AS repository_id,
commit_author_when,
commit_type
FROM (
SELECT
SUBSTRING(remote_fetch_url, 18) AS repository_id_part,
commit_author_when,
CASE ARRAY_LENGTH(commit_parents) WHEN 0 THEN 'Commit' WHEN 1 THEN 'Commit' ELSE 'Merge' END AS commit_type
FROM remotes
NATURAL JOIN refs
NATURAL JOIN commits
) AS q
LIMIT 1000`,
// Squash with non-squashable joins
`SELECT * FROM refs NATURAL JOIN blobs`,
`SELECT * FROM remotes NATURAL JOIN commits`,
`SELECT *
FROM repositories
NATURAL JOIN refs
NATURAL JOIN blobs
NATURAL JOIN files`,
}
for _, q := range queries {
t.Run(q, func(t *testing.T) {
expected := queryResults(t, engine, pool, q)
result := queryResults(t, squashEngine, pool, q)
require.Len(t, result, len(expected))
require.ElementsMatch(
t,
expected,
result,
)
})
}
} | explode_data.jsonl/13694 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1652
} | [
2830,
3393,
50,
446,
988,
33092,
2090,
1155,
353,
8840,
836,
8,
341,
80118,
11,
7314,
11,
21290,
1669,
6505,
1155,
340,
16867,
21290,
2822,
1903,
446,
988,
4571,
1669,
501,
50,
446,
988,
4571,
41838,
692,
197,
42835,
1669,
3056,
917,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestResolveChartOpts(t *testing.T) {
tests := []struct {
name, ref, version string
expect []getter.Option
}{
{
name: "repo with CA-file",
ref: "testing-ca-file/foo",
expect: []getter.Option{
getter.WithURL("https://example.com/foo-1.2.3.tgz"),
getter.WithTLSClientConfig("cert", "key", "ca"),
},
},
}
c := ChartDownloader{
Out: os.Stderr,
RepositoryConfig: repoConfig,
RepositoryCache: repoCache,
Getters: getter.All(&cli.EnvSettings{
RepositoryConfig: repoConfig,
RepositoryCache: repoCache,
}),
}
// snapshot options
snapshotOpts := c.Options
for _, tt := range tests {
// reset chart downloader options for each test case
c.Options = snapshotOpts
expect, err := getter.NewHTTPGetter(tt.expect...)
if err != nil {
t.Errorf("%s: failed to setup http client: %s", tt.name, err)
continue
}
u, err := c.ResolveChartVersion(tt.ref, tt.version)
if err != nil {
t.Errorf("%s: failed with error %s", tt.name, err)
continue
}
got, err := getter.NewHTTPGetter(
append(
c.Options,
getter.WithURL(u.String()),
)...,
)
if err != nil {
t.Errorf("%s: failed to create http client: %s", tt.name, err)
continue
}
if *(got.(*getter.HTTPGetter)) != *(expect.(*getter.HTTPGetter)) {
t.Errorf("%s: expected %s, got %s", tt.name, expect, got)
}
}
} | explode_data.jsonl/1368 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 616
} | [
2830,
3393,
56808,
14488,
43451,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
11,
2053,
11,
2319,
914,
198,
197,
24952,
1797,
3056,
52891,
52216,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,
330,
23476,
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... | 6 |
func TestNewContractAddress(t *testing.T) {
key, _ := HexToECDSA(testPrivHex)
addr := common.HexToAddress(testAddrHex)
genAddr := PubkeyToAddress(key.PublicKey)
// sanity check before using addr to create contract address
checkAddr(t, genAddr, addr)
caddr0 := CreateAddress(addr, 0)
caddr1 := CreateAddress(addr, 1)
caddr2 := CreateAddress(addr, 2)
checkAddr(t, common.HexToAddress("333c3310824b7c685133f2bedb2ca4b8b4df633d"), caddr0)
checkAddr(t, common.HexToAddress("8bda78331c916a08481428e4b07c96d3e916d165"), caddr1)
checkAddr(t, common.HexToAddress("c9ddedf451bc62ce88bf9292afb13df35b670699"), caddr2)
} | explode_data.jsonl/3760 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 259
} | [
2830,
3393,
3564,
14067,
4286,
1155,
353,
8840,
836,
8,
341,
23634,
11,
716,
1669,
27228,
1249,
7498,
72638,
8623,
32124,
20335,
340,
53183,
1669,
4185,
91538,
1249,
4286,
8623,
13986,
20335,
340,
82281,
13986,
1669,
22611,
792,
1249,
428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTransportExternal(t *testing.T) {
if !*extNet {
t.Skip("skipping external network test")
}
req, _ := http.NewRequest("GET", "https://"+*transportHost+"/", nil)
rt := &Transport{TLSClientConfig: tlsConfigInsecure}
res, err := rt.RoundTrip(req)
if err != nil {
t.Fatalf("%v", err)
}
res.Write(os.Stdout)
} | explode_data.jsonl/16045 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 136
} | [
2830,
3393,
27560,
25913,
1155,
353,
8840,
836,
8,
341,
743,
753,
9,
427,
6954,
341,
197,
3244,
57776,
445,
4886,
5654,
9250,
3922,
1273,
1138,
197,
532,
24395,
11,
716,
1669,
1758,
75274,
445,
3806,
497,
330,
2428,
1110,
5572,
9,
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 TestConfigKeys(t *testing.T) {
c, err := NewContainer(ContainerName)
if err != nil {
t.Errorf(err.Error())
}
keys := strings.Join(c.ConfigKeys("mercury.network.0"), " ")
if !strings.Contains(keys, "mtu") {
t.Errorf("Keys failed...")
}
} | explode_data.jsonl/2776 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 103
} | [
2830,
3393,
2648,
8850,
1155,
353,
8840,
836,
8,
341,
1444,
11,
1848,
1669,
1532,
4502,
75145,
675,
340,
743,
1848,
961,
2092,
341,
197,
3244,
13080,
3964,
6141,
2398,
197,
630,
80112,
1669,
9069,
22363,
1337,
10753,
8850,
445,
1174,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRendersCaptureOfSimpleText(t *testing.T) {
d := map[string]interface{}{
"ghola": PersonS{"Duncan", 67},
}
template, _ := ParseString("welcome {% capture intro %}Mr.X{% endcapture%}. {{ intro }}", nil)
assertRender(t, template, d, `welcome . Mr.X`)
} | explode_data.jsonl/42411 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 102
} | [
2830,
3393,
49,
14506,
27429,
2124,
16374,
1178,
1155,
353,
8840,
836,
8,
341,
2698,
1669,
2415,
14032,
31344,
67066,
197,
197,
1,
866,
7924,
788,
7357,
50,
4913,
35,
37466,
497,
220,
21,
22,
1583,
197,
532,
22832,
11,
716,
1669,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAssets(t *testing.T) {
p := NewPersist()
ctx := context.Background()
tm := time.Now().UTC().Truncate(1 * time.Second)
v := &Assets{}
v.ID = "id1"
v.ChainID = "cid1"
v.Name = "name1"
v.Symbol = "symbol1"
v.Denomination = 0x1
v.Alias = "alias1"
v.CurrentSupply = 1
v.CreatedAt = tm
stream := health.NewStream()
rawDBConn, err := dbr.Open(TestDB, TestDSN, stream)
if err != nil {
t.Fatal("db fail", err)
}
_, _ = rawDBConn.NewSession(stream).DeleteFrom(TableAssets).Exec()
err = p.InsertAssets(ctx, rawDBConn.NewSession(stream), v, true)
if err != nil {
t.Fatal("insert fail", err)
}
fv, err := p.QueryAssets(ctx, rawDBConn.NewSession(stream), v)
if err != nil {
t.Fatal("query fail", err)
}
if !reflect.DeepEqual(*v, *fv) {
t.Fatal("compare fail")
}
v.ChainID = "cid2"
v.Name = "name2"
v.Symbol = "symbol2"
v.Denomination = 0x2
v.Alias = "alias2"
v.CurrentSupply = 2
v.CreatedAt = tm
err = p.InsertAssets(ctx, rawDBConn.NewSession(stream), v, true)
if err != nil {
t.Fatal("insert fail", err)
}
fv, err = p.QueryAssets(ctx, rawDBConn.NewSession(stream), v)
if err != nil {
t.Fatal("query fail", err)
}
if fv.Name != "name2" {
t.Fatal("compare fail")
}
if !reflect.DeepEqual(*v, *fv) {
t.Fatal("compare fail")
}
} | explode_data.jsonl/12927 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 589
} | [
2830,
3393,
26879,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
1532,
61267,
741,
20985,
1669,
2266,
19047,
741,
3244,
76,
1669,
882,
13244,
1005,
21183,
1005,
1282,
26900,
7,
16,
353,
882,
32435,
692,
5195,
1669,
609,
26879,
16094,
5195,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTotalFileNumsInternal(t *testing.T) {
type fields struct {
runtime *datav1alpha1.GooseFSRuntime
name string
namespace string
Log logr.Logger
}
tests := []struct {
name string
fields fields
wantFileCount int64
wantErr bool
}{
{
name: "test",
fields: fields{
runtime: &datav1alpha1.GooseFSRuntime{
ObjectMeta: v1.ObjectMeta{
Name: "spark",
Namespace: "default",
},
},
name: "spark",
namespace: "defaut",
Log: fake.NullLogger(),
},
wantFileCount: 6,
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
e := &GooseFSEngine{
runtime: tt.fields.runtime,
name: tt.fields.name,
namespace: tt.fields.namespace,
Log: tt.fields.Log,
}
patch1 := ApplyFunc(kubeclient.ExecCommandInContainer, func(podName string, containerName string, namespace string, cmd []string) (string, string, error) {
summary, err := mockGooseFSFileUtilsCount()
return summary, "", err
})
defer patch1.Reset()
gotFileCount, err := e.totalFileNumsInternal()
if (err != nil) != tt.wantErr {
t.Errorf("GooseFSEngine.totalFileNumsInternal() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotFileCount != tt.wantFileCount {
t.Errorf("GooseFSEngine.totalFileNumsInternal() = %v, want %v", gotFileCount, tt.wantFileCount)
}
})
}
} | explode_data.jsonl/70297 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 687
} | [
2830,
3393,
7595,
1703,
4651,
82,
11569,
1155,
353,
8840,
836,
8,
341,
13158,
5043,
2036,
341,
197,
7000,
4466,
256,
353,
5911,
402,
16,
7141,
16,
1224,
13752,
8485,
15123,
198,
197,
11609,
414,
914,
198,
197,
56623,
914,
198,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_nopeLimiter_allow(t *testing.T) {
t.Parallel()
var nope nopeLimiter
var wg sync.WaitGroup
wg.Add(100)
for i := 0; i < 100; i++ {
go func() {
defer wg.Done()
assert.True(t, nope.allow())
}()
}
wg.Wait()
} | explode_data.jsonl/12309 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 115
} | [
2830,
3393,
1089,
2792,
43,
17700,
55731,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
2405,
902,
375,
902,
375,
43,
17700,
198,
2405,
63581,
12811,
28384,
2808,
198,
72079,
1904,
7,
16,
15,
15,
340,
2023,
600,
1669,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestParseFederationReplicaSetReference(t *testing.T) {
successPrefs := []string{
`{"rebalance": true,
"clusters": {
"k8s-1": {"minReplicas": 10, "maxReplicas": 20, "weight": 2},
"*": {"weight": 1}
}}`,
}
failedPrefes := []string{
`{`, // bad json
}
rs := newReplicaSetWithReplicas("rs-1", 100)
accessor, _ := meta.Accessor(rs)
anno := accessor.GetAnnotations()
if anno == nil {
anno = make(map[string]string)
accessor.SetAnnotations(anno)
}
for _, prefString := range successPrefs {
anno[FedReplicaSetPreferencesAnnotation] = prefString
pref, err := parseFederationReplicaSetReference(rs)
assert.NotNil(t, pref)
assert.Nil(t, err)
}
for _, prefString := range failedPrefes {
anno[FedReplicaSetPreferencesAnnotation] = prefString
pref, err := parseFederationReplicaSetReference(rs)
assert.Nil(t, pref)
assert.NotNil(t, err)
}
} | explode_data.jsonl/61665 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 359
} | [
2830,
3393,
14463,
37,
96013,
18327,
15317,
1649,
8856,
1155,
353,
8840,
836,
8,
341,
30553,
31434,
1669,
3056,
917,
515,
197,
197,
63,
4913,
265,
21571,
788,
830,
345,
7847,
330,
78521,
788,
341,
6449,
330,
74,
23,
82,
12,
16,
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... | 4 |
func TestDescribeOpts_Run(t *testing.T) {
ctrl := gomock.NewController(t)
mockStore := mocks.NewMockSyncsDescriber(ctrl)
defer ctrl.Finish()
expected := &opsmngr.BackupStore{}
opts := &DescribeOpts{
store: mockStore,
}
mockStore.
EXPECT().GetSync(opts.syncID).
Return(expected, nil).
Times(1)
if err := opts.Run(); err != nil {
t.Fatalf("Run() unexpected error: %v", err)
}
} | explode_data.jsonl/54766 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 168
} | [
2830,
3393,
74785,
43451,
84158,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
77333,
6093,
1669,
68909,
7121,
11571,
12154,
82,
62664,
652,
62100,
340,
16867,
23743,
991,
18176,
2822,
42400,
1669,
609,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPostMedia_ParseURI(t *testing.T) {
tests := []struct {
uri string
expErr error
}{
{
uri: "http://error.com",
expErr: nil,
},
{
uri: "http://",
expErr: fmt.Errorf("invalid uri provided"),
},
{
uri: "error.com",
expErr: fmt.Errorf("invalid uri provided"),
},
{
uri: ".com",
expErr: fmt.Errorf("invalid uri provided"),
},
{
uri: "ttps://",
expErr: fmt.Errorf("invalid uri provided"),
},
{
uri: "ps://site.com",
expErr: fmt.Errorf("invalid uri provided"),
},
{
uri: "https://",
expErr: fmt.Errorf("invalid uri provided"),
},
{
uri: "https://example.com",
expErr: nil,
},
}
for _, test := range tests {
test := test
t.Run(test.uri, func(t *testing.T) {
require.Equal(t, test.expErr, types.ValidateURI(test.uri))
})
}
} | explode_data.jsonl/47674 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 428
} | [
2830,
3393,
4133,
12661,
77337,
10301,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
197,
6070,
262,
914,
198,
197,
48558,
7747,
1465,
198,
197,
59403,
197,
197,
515,
298,
197,
6070,
25,
262,
330,
1254,
1110,
841,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIsEOF(t *testing.T) {
p := NewHtmlParser("")
if !isEOF(p) {
t.Errorf("expect %t, actual %t", true, isEOF(p))
}
p = NewHtmlParser(" ")
if isEOF(p) {
t.Errorf("expect %t, actual %t", false, isEOF(p))
}
read(p)
if !isEOF(p) {
t.Errorf("expect %t, actual %t", true, isEOF(p))
}
} | explode_data.jsonl/34981 | {
"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,
3872,
23483,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
1532,
13591,
6570,
31764,
743,
753,
285,
23483,
1295,
8,
341,
197,
3244,
13080,
445,
17119,
1018,
83,
11,
5042,
1018,
83,
497,
830,
11,
374,
23483,
1295,
1171,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestSummaryDataPointSlice_CopyTo(t *testing.T) {
dest := NewSummaryDataPointSlice()
// Test CopyTo to empty
NewSummaryDataPointSlice().CopyTo(dest)
assert.EqualValues(t, NewSummaryDataPointSlice(), dest)
// Test CopyTo larger slice
generateTestSummaryDataPointSlice().CopyTo(dest)
assert.EqualValues(t, generateTestSummaryDataPointSlice(), dest)
// Test CopyTo same size slice
generateTestSummaryDataPointSlice().CopyTo(dest)
assert.EqualValues(t, generateTestSummaryDataPointSlice(), dest)
} | explode_data.jsonl/19571 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 161
} | [
2830,
3393,
19237,
1043,
2609,
33236,
77637,
1249,
1155,
353,
8840,
836,
8,
341,
49616,
1669,
1532,
19237,
1043,
2609,
33236,
741,
197,
322,
3393,
14540,
1249,
311,
4287,
198,
197,
3564,
19237,
1043,
2609,
33236,
1005,
12106,
1249,
27010,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGAEvolveModelRuntimeError(t *testing.T) {
var ga, err = NewDefaultGAConfig().NewGA()
if err != nil {
t.Errorf("Expected nil, got %v", err)
}
ga.Model = ModRuntimeError{}
if err = ga.init(NewVector); err != nil {
t.Errorf("Expected nil, got %v", err)
}
if ga.evolve() == nil {
t.Error("An error should have been raised")
}
} | explode_data.jsonl/82085 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 139
} | [
2830,
3393,
38,
13669,
85,
3948,
1712,
15123,
1454,
1155,
353,
8840,
836,
8,
341,
2405,
13510,
11,
1848,
284,
1532,
3675,
16128,
2648,
1005,
3564,
16128,
741,
743,
1848,
961,
2092,
341,
197,
3244,
13080,
445,
18896,
2092,
11,
2684,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestStaticSymlinkObject(t *testing.T) {
ctx := context.Background()
info, err := getSwinftInfo(t)
if err != nil {
t.Fatal(err)
}
if sym, ok := info["symlink"].(map[string]interface{}); ok {
if _, ok := sym["static_links"]; !ok {
t.Skip("skip, static symlink not supported")
return
}
} else {
t.Skip("skip, symlink not supported")
return
}
c, rollback := makeConnectionWithContainer(t)
defer rollback()
// write target objects
err = c.ObjectPutBytes(ctx, CONTAINER, OBJECT2, []byte(CONTENTS2), "text/tomato")
if err != nil {
t.Fatal(err)
}
defer func() {
err = c.ObjectDelete(ctx, CONTAINER, OBJECT2)
if err != nil {
t.Error(err)
}
}()
// test static link
// first with the wrong target etag
_, err = c.ObjectSymlinkCreate(ctx, CONTAINER, SYMLINK_OBJECT2, "", CONTAINER, OBJECT2, CONTENT_MD5)
if err == nil {
t.Error("Symlink with wrong target etag should have failed")
}
_, err = c.ObjectSymlinkCreate(ctx, CONTAINER, SYMLINK_OBJECT2, "", CONTAINER, OBJECT2, CONTENT2_MD5)
if err != nil {
t.Fatal(err)
}
defer func() {
err = c.ObjectDelete(ctx, CONTAINER, SYMLINK_OBJECT2)
if err != nil {
t.Error(err)
}
}()
md, _, err := c.Object(ctx, CONTAINER, SYMLINK_OBJECT2)
if err != nil {
t.Error(err)
}
if md.ContentType != "text/tomato" {
t.Error("Bad content type", md.ContentType)
}
if md.Bytes != CONTENT_SIZE {
t.Errorf("Bad length want 5 got %v", md.Bytes)
}
if md.Hash != CONTENT2_MD5 {
t.Errorf("Bad MD5 want %v got %v", CONTENT2_MD5, md.Hash)
}
} | explode_data.jsonl/12677 | {
"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,
11690,
34667,
44243,
1190,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
27043,
11,
1848,
1669,
73683,
7526,
723,
1731,
1155,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
743,
7886,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReturnExpr(t *testing.T) {
gopClTest(t, `
func foo(format string, args ...interface{}) (int, error) {
return 0, nil
}
func main() {
}
`, `package main
func foo(format string, args ...interface {
}) (int, error) {
return 0, nil
}
func main() {
}
`)
} | explode_data.jsonl/73680 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 102
} | [
2830,
3393,
5598,
16041,
1155,
353,
8840,
836,
8,
341,
3174,
453,
5066,
2271,
1155,
11,
22074,
2830,
15229,
20698,
914,
11,
2827,
2503,
4970,
28875,
320,
396,
11,
1465,
8,
341,
853,
220,
15,
11,
2092,
198,
630,
2830,
1887,
368,
341,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMemberNotFound_InGuild(t *testing.T) {
expected := &discordgo.Guild{Name: mockconstants.TestGuild}
mnf := &callbacks.MemberNotFound{Guild: expected}
actual := mnf.InGuild()
err := deepEqual(actual, expected)
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/56080 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 102
} | [
2830,
3393,
9366,
10372,
25972,
72574,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
609,
42579,
3346,
1224,
1498,
63121,
25,
7860,
15763,
8787,
72574,
532,
2109,
31737,
1669,
609,
68311,
46404,
10372,
90,
72574,
25,
3601,
532,
88814,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestConcurrent(t *testing.T) {
m := NewSimpleLongConcurrentHashMap()
ch := make(chan string)
const loop = 2000
var s [loop]string
go func() {
for i := 0; i < loop/2; i++ {
m.Put(int64(i), strconv.Itoa(i))
value, _ := m.Get(int64(i))
ch <- value.(string)
}
}()
go func() {
for i := loop/2; i < loop; i++ {
m.Put(int64(i), strconv.Itoa(i))
value, _ := m.Get(int64(i))
ch <- value.(string)
}
}()
// wait
counter := 0
for ele := range ch {
s[counter] = ele;
counter ++;
if counter == loop {
break;
}
}
if m.Size() != loop {
t.Error("map should contain 2000 elements")
}
} | explode_data.jsonl/19663 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 287
} | [
2830,
3393,
1109,
3231,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
1532,
16374,
6583,
1109,
3231,
18497,
741,
23049,
1669,
1281,
35190,
914,
340,
4777,
6337,
284,
220,
17,
15,
15,
15,
198,
2405,
274,
508,
10498,
30953,
271,
30680,
2915... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestServiceFlagStringer(t *testing.T) {
tests := []struct {
in rddwire.ServiceFlag
want string
}{
{0, "0x0"},
{rddwire.SFNodeNetwork, "SFNodeNetwork"},
{0xffffffff, "SFNodeNetwork|0xfffffffe"},
}
t.Logf("Running %d tests", len(tests))
for i, test := range tests {
result := test.in.String()
if result != test.want {
t.Errorf("String #%d\n got: %s want: %s", i, result,
test.want)
continue
}
}
} | explode_data.jsonl/39136 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 190
} | [
2830,
3393,
1860,
12135,
703,
261,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
17430,
256,
435,
631,
35531,
13860,
12135,
198,
197,
50780,
914,
198,
197,
59403,
197,
197,
90,
15,
11,
330,
15,
87,
15,
7115,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestTimeTieBreaker(t *testing.T) {
origin := bgp.NewPathAttributeOrigin(0)
aspathParam := []bgp.AsPathParamInterface{bgp.NewAs4PathParam(2, []uint32{65001})}
aspath := bgp.NewPathAttributeAsPath(aspathParam)
nexthop := bgp.NewPathAttributeNextHop("10.0.0.1")
med := bgp.NewPathAttributeMultiExitDisc(0)
pathAttributes := []bgp.PathAttributeInterface{origin, aspath, nexthop, med}
nlri := bgp.NewIPAddrPrefix(24, "10.10.0.0")
updateMsg := bgp.NewBGPUpdateMessage(nil, pathAttributes, []*bgp.IPAddrPrefix{nlri})
peer1 := &PeerInfo{AS: 2, LocalAS: 1, Address: net.IP{1, 1, 1, 1}, ID: net.IP{1, 1, 1, 1}}
path1 := ProcessMessage(updateMsg, peer1, time.Now())[0]
peer2 := &PeerInfo{AS: 2, LocalAS: 1, Address: net.IP{2, 2, 2, 2}, ID: net.IP{2, 2, 2, 2}} // weaker router-id
path2 := ProcessMessage(updateMsg, peer2, time.Now().Add(-1*time.Hour))[0] // older than path1
d := NewDestination(nlri, 0)
d.Calculate(path1)
d.Calculate(path2)
assert.Equal(t, len(d.knownPathList), 2)
assert.Equal(t, true, d.GetBestPath("", 0).GetSource().ID.Equal(net.IP{2, 2, 2, 2})) // path from peer2 win
// this option disables tie breaking by age
SelectionOptions.ExternalCompareRouterId = true
d = NewDestination(nlri, 0)
d.Calculate(path1)
d.Calculate(path2)
assert.Equal(t, len(d.knownPathList), 2)
assert.Equal(t, true, d.GetBestPath("", 0).GetSource().ID.Equal(net.IP{1, 1, 1, 1})) // path from peer1 win
} | explode_data.jsonl/14522 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 602
} | [
2830,
3393,
1462,
51,
645,
22524,
261,
1155,
353,
8840,
836,
8,
341,
197,
8611,
1669,
8951,
79,
7121,
1820,
3907,
13298,
7,
15,
340,
60451,
2343,
2001,
1669,
3056,
12220,
79,
20242,
93492,
5051,
90,
12220,
79,
7121,
2121,
19,
93492,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInitRotZapFromJson(t *testing.T) {
zapLog, err := InitRotZapFromJSON(jsonStr)
if err != nil {
t.Fatal(err)
}
defer zapLog.Sync()
zapLog.Info("RotZap provide an easy way to initialize zap with file-rotatelogs", zap.String("test", "TestInitRotZapFromJson"))
zapLog.Error("RotZap provide an easy way to initialize zap with file-rotatelogs", zap.String("test", "TestInitRotZapFromJson"))
} | explode_data.jsonl/53066 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 155
} | [
2830,
3393,
3803,
36936,
57,
391,
3830,
5014,
1155,
353,
8840,
836,
8,
341,
20832,
391,
2201,
11,
1848,
1669,
15690,
36936,
57,
391,
3830,
5370,
9304,
2580,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
16867,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestAgent_PassCheck(t *testing.T) {
t.Parallel()
a := NewTestAgent(t.Name(), "")
defer a.Shutdown()
chk := &structs.HealthCheck{Name: "test", CheckID: "test"}
chkType := &structs.CheckType{TTL: 15 * time.Second}
if err := a.AddCheck(chk, chkType, false, ""); err != nil {
t.Fatalf("err: %v", err)
}
req, _ := http.NewRequest("PUT", "/v1/agent/check/pass/test", nil)
obj, err := a.srv.AgentCheckPass(nil, req)
if err != nil {
t.Fatalf("err: %v", err)
}
if obj != nil {
t.Fatalf("bad: %v", obj)
}
// Ensure we have a check mapping
state := a.State.Checks()["test"]
if state.Status != api.HealthPassing {
t.Fatalf("bad: %v", state)
}
} | explode_data.jsonl/33617 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 284
} | [
2830,
3393,
16810,
1088,
395,
3973,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
11323,
1669,
1532,
2271,
16810,
1155,
2967,
1507,
14676,
16867,
264,
10849,
18452,
2822,
23049,
74,
1669,
609,
1235,
82,
74980,
3973,
63121,
25,
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... | 5 |
func TestMCP23017DriverSetName(t *testing.T) {
d := initTestMCP23017Driver(0)
d.SetName("TESTME")
gobottest.Assert(t, d.Name(), "TESTME")
} | explode_data.jsonl/42327 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 63
} | [
2830,
3393,
44,
7123,
17,
18,
15,
16,
22,
11349,
69778,
1155,
353,
8840,
836,
8,
341,
2698,
1669,
2930,
2271,
44,
7123,
17,
18,
15,
16,
22,
11349,
7,
15,
340,
2698,
4202,
675,
445,
10033,
7462,
1138,
3174,
674,
1716,
477,
11711,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLoadConfig(t *testing.T) {
factories, err := componenttest.NopFactories()
assert.NoError(t, err)
factory := NewFactory()
receiverType := "prometheus_exec"
factories.Receivers[configmodels.Type(receiverType)] = factory
config, err := configtest.LoadConfigFile(t, path.Join(".", "testdata", "config.yaml"), factories)
assert.NoError(t, err)
assert.NotNil(t, config)
assert.Equal(t, len(config.Receivers), 5)
receiver1 := config.Receivers[receiverType]
assert.Equal(t, factory.CreateDefaultConfig(), receiver1)
receiver2 := config.Receivers["prometheus_exec/test"]
assert.Equal(t, wantReceiver2, receiver2)
receiver3 := config.Receivers["prometheus_exec/test2"]
assert.Equal(t, wantReceiver3, receiver3)
receiver4 := config.Receivers["prometheus_exec/end_to_end_test/1"]
assert.Equal(t, wantReceiver4, receiver4)
receiver5 := config.Receivers["prometheus_exec/end_to_end_test/2"]
assert.Equal(t, wantReceiver5, receiver5)
} | explode_data.jsonl/3544 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 349
} | [
2830,
3393,
5879,
2648,
1155,
353,
8840,
836,
8,
341,
1166,
52893,
11,
1848,
1669,
3692,
1944,
2067,
453,
17417,
2433,
741,
6948,
35699,
1155,
11,
1848,
692,
1166,
2919,
1669,
1532,
4153,
741,
17200,
12862,
929,
1669,
330,
24468,
39705,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNextEOFHandling(t *testing.T) {
var r countReader
// corner case: empty source
s := new(Scanner).Init(&r)
tok := s.Next()
if tok != EOF {
t.Error("1) EOF not reported")
}
tok = s.Peek()
if tok != EOF {
t.Error("2) EOF not reported")
}
if r != 1 {
t.Errorf("scanner called Read %d times, not once", r)
}
} | explode_data.jsonl/56538 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 146
} | [
2830,
3393,
5847,
23483,
38606,
1155,
353,
8840,
836,
8,
341,
2405,
435,
1760,
5062,
271,
197,
322,
9131,
1142,
25,
4287,
2530,
198,
1903,
1669,
501,
7,
31002,
568,
3803,
2099,
81,
692,
3244,
562,
1669,
274,
18501,
741,
743,
9628,
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... | 4 |
func TestMySQL(t *testing.T) {
t.Parallel()
for version, port := range map[string]int{"56": 3306, "57": 3307, "8": 3308} {
addr := net.JoinHostPort("localhost", strconv.Itoa(port))
t.Run(version, func(t *testing.T) {
client := enttest.Open(t, dialect.MySQL, fmt.Sprintf("root:pass@tcp(%s)/test?parseTime=True", addr), opts)
defer client.Close()
for _, tt := range tests {
name := runtime.FuncForPC(reflect.ValueOf(tt).Pointer()).Name()
t.Run(name[strings.LastIndex(name, ".")+1:], func(t *testing.T) {
drop(t, client)
tt(t, client)
})
}
})
}
} | explode_data.jsonl/45699 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 262
} | [
2830,
3393,
59224,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2023,
2319,
11,
2635,
1669,
2088,
2415,
14032,
63025,
4913,
20,
21,
788,
220,
18,
18,
15,
21,
11,
330,
20,
22,
788,
220,
18,
18,
15,
22,
11,
330,
23,
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... | 1 |
func TestScopeLookupParent(t *testing.T) {
fset := token.NewFileSet()
imports := make(testImporter)
conf := Config{Importer: imports}
mustParse := func(src string) *ast.File {
f, err := parser.ParseFile(fset, "dummy.go", src, parser.ParseComments)
if err != nil {
t.Fatal(err)
}
return f
}
var info Info
makePkg := func(path string, files ...*ast.File) {
var err error
imports[path], err = conf.Check(path, fset, files, &info)
if err != nil {
t.Fatal(err)
}
}
makePkg("lib", mustParse("package lib; var X int"))
// Each /*name=kind:line*/ comment makes the test look up the
// name at that point and checks that it resolves to a decl of
// the specified kind and line number. "undef" means undefined.
mainSrc := `
/*lib=pkgname:5*/ /*X=var:1*/ /*Pi=const:8*/ /*T=typename:9*/ /*Y=var:10*/ /*F=func:12*/
package main
import "lib"
import . "lib"
const Pi = 3.1415
type T struct{}
var Y, _ = lib.X, X
func F(){
const pi, e = 3.1415, /*pi=undef*/ 2.71828 /*pi=const:13*/ /*e=const:13*/
type /*t=undef*/ t /*t=typename:14*/ *t
print(Y) /*Y=var:10*/
x, Y := Y, /*x=undef*/ /*Y=var:10*/ Pi /*x=var:16*/ /*Y=var:16*/ ; _ = x; _ = Y
var F = /*F=func:12*/ F /*F=var:17*/ ; _ = F
var a []int
for i, x := range /*i=undef*/ /*x=var:16*/ a /*i=var:20*/ /*x=var:20*/ { _ = i; _ = x }
var i interface{}
switch y := i.(type) { /*y=undef*/
case /*y=undef*/ int /*y=var:23*/ :
case float32, /*y=undef*/ float64 /*y=var:23*/ :
default /*y=var:23*/:
println(y)
}
/*y=undef*/
switch int := i.(type) {
case /*int=typename:0*/ int /*int=var:31*/ :
println(int)
default /*int=var:31*/ :
}
}
/*main=undef*/
`
info.Uses = make(map[*ast.Ident]Object)
f := mustParse(mainSrc)
makePkg("main", f)
mainScope := imports["main"].Scope()
rx := regexp.MustCompile(`^/\*(\w*)=([\w:]*)\*/$`)
for _, group := range f.Comments {
for _, comment := range group.List {
// Parse the assertion in the comment.
m := rx.FindStringSubmatch(comment.Text)
if m == nil {
t.Errorf("%s: bad comment: %s",
fset.Position(comment.Pos()), comment.Text)
continue
}
name, want := m[1], m[2]
// Look up the name in the innermost enclosing scope.
inner := mainScope.Innermost(comment.Pos())
if inner == nil {
t.Errorf("%s: at %s: can't find innermost scope",
fset.Position(comment.Pos()), comment.Text)
continue
}
got := "undef"
if _, obj := inner.LookupParent(name, comment.Pos()); obj != nil {
kind := strings.ToLower(strings.TrimPrefix(reflect.TypeOf(obj).String(), "*types."))
got = fmt.Sprintf("%s:%d", kind, fset.Position(obj.Pos()).Line)
}
if got != want {
t.Errorf("%s: at %s: %s resolved to %s, want %s",
fset.Position(comment.Pos()), comment.Text, name, got, want)
}
}
}
// Check that for each referring identifier,
// a lookup of its name on the innermost
// enclosing scope returns the correct object.
for id, wantObj := range info.Uses {
inner := mainScope.Innermost(id.Pos())
if inner == nil {
t.Errorf("%s: can't find innermost scope enclosing %q",
fset.Position(id.Pos()), id.Name)
continue
}
// Exclude selectors and qualified identifiers---lexical
// refs only. (Ideally, we'd see if the AST parent is a
// SelectorExpr, but that requires PathEnclosingInterval
// from golang.org/x/tools/go/ast/astutil.)
if id.Name == "X" {
continue
}
_, gotObj := inner.LookupParent(id.Name, id.Pos())
if gotObj != wantObj {
t.Errorf("%s: got %v, want %v",
fset.Position(id.Pos()), gotObj, wantObj)
continue
}
}
} | explode_data.jsonl/55550 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1545
} | [
2830,
3393,
10803,
34247,
8387,
1155,
353,
8840,
836,
8,
341,
1166,
746,
1669,
3950,
7121,
1703,
1649,
741,
21918,
82,
1669,
1281,
8623,
77289,
340,
67850,
1669,
5532,
90,
77289,
25,
15202,
532,
2109,
590,
14463,
1669,
2915,
14705,
914,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestClientGossip(t *testing.T) {
defer leaktest.AfterTest(t)()
stopper := stop.NewStopper()
local := startGossip(1, stopper, t, metric.NewRegistry())
remote := startGossip(2, stopper, t, metric.NewRegistry())
disconnected := make(chan *client, 1)
c := newClient(log.AmbientContext{Tracer: tracing.NewTracer()}, remote.GetNodeAddr(), makeMetrics())
defer func() {
stopper.Stop(context.TODO())
if c != <-disconnected {
t.Errorf("expected client disconnect after remote close")
}
}()
if err := local.AddInfo("local-key", nil, time.Hour); err != nil {
t.Fatal(err)
}
if err := remote.AddInfo("remote-key", nil, time.Hour); err != nil {
t.Fatal(err)
}
gossipSucceedsSoon(t, stopper, disconnected, map[*client]*Gossip{
c: local,
}, func() error {
if _, err := remote.GetInfo("local-key"); err != nil {
return err
}
if _, err := local.GetInfo("remote-key"); err != nil {
return err
}
return nil
})
} | explode_data.jsonl/18544 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 370
} | [
2830,
3393,
2959,
38,
41473,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
741,
62644,
712,
1669,
2936,
7121,
10674,
712,
741,
8854,
1669,
1191,
38,
41473,
7,
16,
11,
2936,
712,
11,
259,
11,
18266,
7121,
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... | 2 |
func TestDecimal_EqualTo(t *testing.T) {
for i, tc := range []struct {
a, b Decimal
sf int
want bool
}{
{New(0), New(0), 1, true},
{New(1), New(0), 1, false},
{NewCents(100), New(1), 3, true},
{NewScalar(123, 2), NewScalar(123, 3), 3, false},
{NewScalar(1230, 1), NewScalar(123, 0), 3, true},
{NewScalar(123, -1), NewScalar(1230, 0), 3, true},
} {
tc := tc
t.Run(fmt.Sprintf("#%d %v equals %v [%d sf]", i, tc.a, tc.b, tc.sf), func(t *testing.T) {
t.Parallel()
got := tc.a.EqualTo(tc.b, tc.sf)
if got != tc.want {
t.Errorf("wanted %t, got %t", tc.want, got)
}
})
}
} | explode_data.jsonl/71800 | {
"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,
11269,
2089,
1751,
1249,
1155,
353,
8840,
836,
8,
341,
2023,
600,
11,
17130,
1669,
2088,
3056,
1235,
341,
197,
11323,
11,
293,
26728,
198,
197,
53024,
256,
526,
198,
197,
50780,
1807,
198,
197,
59403,
197,
197,
90,
3564,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTestCompleteHandler(t *testing.T) {
cases := map[string]struct {
path string
header http.Header
isWebsocketCall bool
customWriter http.ResponseWriter
customOrigin string
exp string
wantErr string
}{
"negotiate": {
path: "/negotiate",
exp: `{"ConnectionToken":"hello world","ConnectionId":"1234-ABC","URL":"/signalr","ProtocolVersion":"1337"}`,
},
"negotiate failure": {
path: "/negotiate",
customWriter: writeFailer{err: "sample negotiate error"},
wantErr: "sample negotiate error",
},
"connect": {
path: "/connect",
header: http.Header{
"Upgrade": []string{"websocket"},
"Connection": []string{"upgrade"},
"Sec-Websocket-Version": []string{"13"},
"Sec-Websocket-Key": []string{"blablabla"},
},
isWebsocketCall: true,
exp: `{"S":1}`,
},
"connect failure": {
path: "/connect",
header: http.Header{
"Upgrade": []string{"websocket"},
"Connection": []string{"upgrade"},
"Sec-Websocket-Version": []string{"13"},
"Sec-Websocket-Key": []string{"blablabla"},
},
customOrigin: "blabla",
isWebsocketCall: true,
wantErr: "websocket: request origin not allowed by Upgrader.CheckOrigin",
},
"reconnect": {
path: "/reconnect",
header: http.Header{
"Upgrade": []string{"websocket"},
"Connection": []string{"upgrade"},
"Sec-Websocket-Version": []string{"13"},
"Sec-Websocket-Key": []string{"blablabla"},
},
isWebsocketCall: true,
exp: `{"S":1}`,
},
"start": {
path: "/start",
exp: `{"Response":"started"}`,
},
"start failure": {
path: "/start",
customWriter: writeFailer{err: "sample start error"},
wantErr: "sample start error",
},
}
for id, tc := range cases {
tc := tc
recorder := httptest.NewRecorder()
var customErr error
ts := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch {
case tc.customOrigin != "":
r.Header.Set("Origin", tc.customOrigin)
customErr = catchErr(signalr.TestCompleteHandler, w, r)
case tc.customWriter != nil:
customErr = catchErr(signalr.TestCompleteHandler, tc.customWriter, r)
case !tc.isWebsocketCall:
signalr.TestCompleteHandler(recorder, r)
default:
signalr.TestCompleteHandler(w, r)
}
}))
ts.Start()
c := ts.Client()
u := ts.URL + tc.path
var err error
var act string
if tc.isWebsocketCall {
var conn *websocket.Conn
var p []byte
u = strings.Replace(u, "http://", "ws://", -1)
conn, _, err = websocket.DefaultDialer.Dial(u, nil)
if customErr == nil {
if err != nil {
panic(err)
}
_, p, err = conn.ReadMessage()
act = string(p)
}
} else {
var req *http.Request
req, err = http.NewRequest("GET", u, nil)
if err != nil {
panic(err)
}
req.Header = tc.header
_, err = c.Do(req)
if err != nil {
panic(err)
}
act = recorder.Body.String()
}
if tc.wantErr != "" {
if customErr != nil {
errMatches(t, id, customErr, tc.wantErr)
} else {
errMatches(t, id, err, tc.wantErr)
}
} else {
equals(t, id, tc.exp, act)
ok(t, id, err)
}
}
} | explode_data.jsonl/14513 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1563
} | [
2830,
3393,
2271,
12548,
3050,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
2415,
14032,
60,
1235,
341,
197,
26781,
310,
914,
198,
197,
20883,
688,
1758,
15753,
198,
197,
19907,
5981,
9556,
7220,
1807,
198,
197,
1444,
1450,
6492,
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... | 4 |
func TestIssues(t *testing.T) {
t.Skip("it has been broken. Please fix it as soon as possible.")
// for issue #4954
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
tk.MustExec("CREATE TABLE t (a CHAR(5) CHARACTER SET latin1);")
tk.MustExec("INSERT INTO t VALUES ('oe');")
tk.MustExec("INSERT INTO t VALUES (0xf6);")
r := tk.MustQuery(`SELECT * FROM t WHERE a= 'oe';`)
r.Check(testkit.Rows("oe"))
r = tk.MustQuery(`SELECT HEX(a) FROM t WHERE a= 0xf6;`)
r.Check(testkit.Rows("F6"))
// for issue #4006
tk.MustExec(`drop table if exists tb`)
tk.MustExec("create table tb(id int auto_increment primary key, v varchar(32));")
tk.MustExec("insert into tb(v) (select v from tb);")
r = tk.MustQuery(`SELECT * FROM tb;`)
r.Check(testkit.Rows())
tk.MustExec(`insert into tb(v) values('hello');`)
tk.MustExec("insert into tb(v) (select v from tb);")
r = tk.MustQuery(`SELECT * FROM tb;`)
r.Check(testkit.Rows("1 hello", "2 hello"))
// for issue #5111
tk.MustExec(`drop table if exists t`)
tk.MustExec("create table t(c varchar(32));")
tk.MustExec("insert into t values('1e649'),('-1e649');")
r = tk.MustQuery(`SELECT * FROM t where c < 1;`)
r.Check(testkit.Rows("-1e649"))
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|",
"Warning|1292|Truncated incorrect DOUBLE value: '1e649'",
"Warning|1292|Truncated incorrect DOUBLE value: '-1e649'"))
r = tk.MustQuery(`SELECT * FROM t where c > 1;`)
r.Check(testkit.Rows("1e649"))
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|",
"Warning|1292|Truncated incorrect DOUBLE value: '1e649'",
"Warning|1292|Truncated incorrect DOUBLE value: '-1e649'"))
// for issue #5293
tk.MustExec("drop table if exists t")
tk.MustExec("create table t(a int)")
tk.MustExec("insert t values (1)")
tk.MustQuery("select * from t where cast(a as binary)").Check(testkit.Rows("1"))
// for issue #16351
tk.MustExec("drop table if exists t2")
tk.MustExec("create table t2(a int, b varchar(20))")
tk.MustExec(`insert into t2 values(1,"1111"),(2,"2222"),(3,"3333"),(4,"4444"),(5,"5555"),(6,"6666"),(7,"7777"),(8,"8888"),(9,"9999"),(10,"0000")`)
tk.MustQuery(`select (@j := case when substr(t2.b,1,3)=@i then 1 else @j+1 end) from t2, (select @j := 0, @i := "0") tt limit 10`).Check(testkit.Rows(
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"))
// for issue #23479
tk.MustQuery("select b'10000000' DIV 10").Check(testkit.Rows("12"))
tk.MustQuery("select cast(b'10000000' as unsigned) / 10").Check(testkit.Rows("12.8000"))
tk.MustQuery("select b'10000000' / 10").Check(testkit.Rows("12.8000"))
} | explode_data.jsonl/65460 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1104
} | [
2830,
3393,
85828,
1155,
353,
8840,
836,
8,
341,
3244,
57776,
445,
275,
702,
1012,
10865,
13,
5209,
5046,
432,
438,
5135,
438,
3204,
13053,
197,
322,
369,
4265,
671,
19,
24,
20,
19,
198,
57279,
11,
4240,
1669,
1273,
8226,
7251,
1157... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMuxer_StreamCloseDuringRead(t *testing.T) {
r1, w1 := io.Pipe()
r2, w2 := io.Pipe()
alice := NewMuxer(NewReadWriteCloser(r1, w2), false)
defer func() { assert.NoError(t, alice.Close()) }()
bob := NewMuxer(NewReadWriteCloser(r2, w1), true)
defer func() { assert.NoError(t, bob.Close()) }()
_, s := alice.Serve()
go s.Close()
buf := make([]byte, 20)
n, err := s.Read(buf)
assert.Equal(t, 0, n)
assert.Equal(t, io.EOF, err)
} | explode_data.jsonl/49633 | {
"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,
44,
2200,
261,
80631,
7925,
16014,
4418,
1155,
353,
8840,
836,
8,
341,
7000,
16,
11,
289,
16,
1669,
6399,
1069,
3444,
741,
7000,
17,
11,
289,
17,
1669,
6399,
1069,
3444,
2822,
197,
63195,
1669,
1532,
44,
2200,
261,
35063... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBundleSlug(t *testing.T) {
t.Parallel()
assert := require.New(t)
const pageTemplate = `---
title: Title
slug: %s
---
`
b := newTestSitesBuilder(t)
b.WithTemplatesAdded("index.html", `{{ range .Site.RegularPages }}|{{ .RelPermalink }}{{ end }}|`)
b.WithSimpleConfigFile().
WithContent("about/services1/misc.md", fmt.Sprintf(pageTemplate, "this-is-the-slug")).
WithContent("about/services2/misc/index.md", fmt.Sprintf(pageTemplate, "this-is-another-slug"))
b.CreateSites().Build(BuildCfg{})
b.AssertHome(
"|/about/services1/this-is-the-slug/|/",
"|/about/services2/this-is-another-slug/|")
assert.True(b.CheckExists("public/about/services1/this-is-the-slug/index.html"))
assert.True(b.CheckExists("public/about/services2/this-is-another-slug/index.html"))
} | explode_data.jsonl/68133 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 314
} | [
2830,
3393,
8409,
54968,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
6948,
1669,
1373,
7121,
1155,
692,
4777,
2150,
7275,
284,
1565,
10952,
2102,
25,
10869,
198,
15125,
25,
1018,
82,
198,
10952,
19324,
2233,
1669,
501,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMatPow(t *testing.T) {
src := NewMatWithSize(101, 102, MatTypeCV8U)
dst := NewMat()
power := 2.0
Pow(src, power, &dst)
if dst.Empty() {
t.Error("TestMatPow dest should not be empty.")
}
} | explode_data.jsonl/81722 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 90
} | [
2830,
3393,
11575,
66584,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
1532,
11575,
2354,
1695,
7,
16,
15,
16,
11,
220,
16,
15,
17,
11,
6867,
929,
19589,
23,
52,
340,
52051,
1669,
1532,
11575,
741,
3223,
1202,
1669,
220,
17,
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... | 2 |
func TestChangefeedEnvelope(t *testing.T) {
defer leaktest.AfterTest(t)()
testFn := func(t *testing.T, db *gosql.DB, f testfeedFactory) {
sqlDB := sqlutils.MakeSQLRunner(db)
sqlDB.Exec(t, `CREATE TABLE foo (a INT PRIMARY KEY, b STRING)`)
sqlDB.Exec(t, `INSERT INTO foo VALUES (1, 'a')`)
t.Run(`envelope=row`, func(t *testing.T) {
foo := f.Feed(t, `CREATE CHANGEFEED FOR foo WITH envelope='row'`)
defer foo.Close(t)
assertPayloads(t, foo, []string{`foo: [1]->{"a": 1, "b": "a"}`})
})
t.Run(`envelope=key_only`, func(t *testing.T) {
foo := f.Feed(t, `CREATE CHANGEFEED FOR foo WITH envelope='key_only'`)
defer foo.Close(t)
assertPayloads(t, foo, []string{`foo: [1]->`})
})
t.Run(`envelope=value_only`, func(t *testing.T) {
foo := f.Feed(t, `CREATE CHANGEFEED FOR foo WITH envelope='value_only'`)
defer foo.Close(t)
assertPayloads(t, foo, []string{`foo: ->{"a": 1, "b": "a"}`})
})
}
t.Run(`sinkless`, sinklessTest(testFn))
t.Run(`enterprise`, enterpriseTest(testFn))
t.Run(`rangefeed`, rangefeedTest(sinklessTest, testFn))
} | explode_data.jsonl/21273 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 489
} | [
2830,
3393,
1143,
524,
823,
12051,
62712,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
18185,
24911,
1669,
2915,
1155,
353,
8840,
836,
11,
2927,
353,
34073,
1470,
22537,
11,
282,
1273,
11184,
4153,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestLastStatsForClosedConnection(t *testing.T) {
clientID := "1"
state := NewDefaultNetworkState()
dSent := uint64(42)
dRecv := uint64(133)
dRetransmits := uint32(0)
conn := ConnectionStats{
Pid: 123,
Type: TCP,
Family: AFINET,
Source: util.AddressFromString("127.0.0.1"),
Dest: util.AddressFromString("127.0.0.1"),
SPort: 31890,
DPort: 80,
MonotonicSentBytes: 36,
MonotonicRecvBytes: 24,
MonotonicRetransmits: 1,
}
conn2 := conn
conn2.MonotonicSentBytes += dSent
conn2.MonotonicRecvBytes += dRecv
conn2.MonotonicRetransmits += dRetransmits
// First get, we should not have any connections stored
conns := state.Connections(clientID, latestEpochTime(), nil)
assert.Equal(t, 0, len(conns))
// We should have one connection with last stats equal to monotonic stats
conns = state.Connections(clientID, latestEpochTime(), []ConnectionStats{conn})
assert.Equal(t, 1, len(conns))
assert.Equal(t, conn.MonotonicSentBytes, conns[0].LastSentBytes)
assert.Equal(t, conn.MonotonicRecvBytes, conns[0].LastRecvBytes)
assert.Equal(t, conn.MonotonicRetransmits, conns[0].LastRetransmits)
assert.Equal(t, conn.MonotonicSentBytes, conns[0].MonotonicSentBytes)
assert.Equal(t, conn.MonotonicRecvBytes, conns[0].MonotonicRecvBytes)
assert.Equal(t, conn.MonotonicRetransmits, conns[0].MonotonicRetransmits)
state.StoreClosedConnection(conn2)
// We should have one connection with last stats
conns = state.Connections(clientID, latestEpochTime(), nil)
assert.Equal(t, 1, len(conns))
assert.Equal(t, dSent, conns[0].LastSentBytes)
assert.Equal(t, dRecv, conns[0].LastRecvBytes)
assert.Equal(t, dRetransmits, conns[0].LastRetransmits)
assert.Equal(t, conn2.MonotonicSentBytes, conns[0].MonotonicSentBytes)
assert.Equal(t, conn2.MonotonicRecvBytes, conns[0].MonotonicRecvBytes)
assert.Equal(t, conn2.MonotonicRetransmits, conns[0].MonotonicRetransmits)
} | explode_data.jsonl/22147 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 847
} | [
2830,
3393,
5842,
16635,
2461,
26884,
4526,
1155,
353,
8840,
836,
8,
341,
25291,
915,
1669,
330,
16,
698,
24291,
1669,
1532,
3675,
12320,
1397,
2822,
2698,
31358,
1669,
2622,
21,
19,
7,
19,
17,
340,
2698,
63483,
1669,
2622,
21,
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 TestAccounts_SetBalance_fromDB(t *testing.T) {
mutableTree, _ := tree.NewMutableTree(0, db.NewMemDB(), 1024)
b := bus.NewBus()
b.SetChecker(checker.NewChecker(b))
accounts, err := NewAccounts(b, mutableTree)
if err != nil {
t.Fatal(err)
}
accounts.SetBalance([20]byte{4}, 0, big.NewInt(1000))
err = accounts.Commit()
if err != nil {
t.Fatal(err)
}
accounts, err = NewAccounts(b, mutableTree)
if err != nil {
t.Fatal(err)
}
if accounts.GetBalance([20]byte{4}, 0).String() != "1000" {
t.Fatal("balance of coin ID '0' not equal 1000")
}
} | explode_data.jsonl/23597 | {
"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,
41369,
14812,
21190,
5673,
3506,
1155,
353,
8840,
836,
8,
341,
2109,
5922,
6533,
11,
716,
1669,
4916,
7121,
11217,
6533,
7,
15,
11,
2927,
7121,
18816,
3506,
1507,
220,
16,
15,
17,
19,
340,
2233,
1669,
5828,
7121,
15073,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIsValidMatchValue(t *testing.T) {
validValues := []string{
"abc",
"123",
`\"
abc\"`,
`\"`,
}
for _, value := range validValues {
errs := isValidMatchValue(value)
if len(errs) > 0 {
t.Errorf("isValidMatchValue(%q) returned errors %v for valid input", value, errs)
}
}
invalidValues := []string{
`"`,
`\`,
`abc"`,
`abc\\\`,
`a"b`,
}
for _, value := range invalidValues {
errs := isValidMatchValue(value)
if len(errs) == 0 {
t.Errorf("isValidMatchValue(%q) returned no errors for invalid input", value)
}
}
} | explode_data.jsonl/65853 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 245
} | [
2830,
3393,
55470,
8331,
1130,
1155,
353,
8840,
836,
8,
341,
56322,
6227,
1669,
3056,
917,
515,
197,
197,
1,
13683,
756,
197,
197,
1,
16,
17,
18,
756,
197,
197,
61069,
698,
197,
197,
13683,
2105,
12892,
197,
197,
63,
2105,
12892,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDeleteUnusedImagesRemoveAllUnusedImages(t *testing.T) {
manager, fakeRuntime, _ := newRealImageGCManager(ImageGCPolicy{})
fakeRuntime.ImageList = []container.Image{
makeImage(0, 1024),
makeImage(1, 2048),
makeImage(2, 2048),
}
fakeRuntime.AllPodList = []*containertest.FakePod{
{Pod: &container.Pod{
Containers: []*container.Container{
makeContainer(2),
},
}},
}
spaceFreed, err := manager.DeleteUnusedImages()
assert := assert.New(t)
require.NoError(t, err)
assert.EqualValues(3072, spaceFreed)
assert.Len(fakeRuntime.ImageList, 1)
} | explode_data.jsonl/48109 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 219
} | [
2830,
3393,
6435,
94033,
14228,
13021,
2403,
94033,
14228,
1155,
353,
8840,
836,
8,
341,
92272,
11,
12418,
15123,
11,
716,
1669,
501,
12768,
1906,
22863,
2043,
30122,
38,
7123,
8018,
37790,
1166,
726,
15123,
7528,
852,
284,
3056,
3586,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPreprocessCloudMetrics(t *testing.T) {
testFamily := tests.MakeTestMetricFamily(prometheusProto.MetricType_GAUGE, 1, testLabels)
metricAndContext := preprocessCloudMetrics(testFamily, "hostA")
assert.NotNil(t, metricAndContext.Context.AdditionalContext)
assert.Equal(t, "hostA", metricAndContext.Context.AdditionalContext.(*exporters.CloudMetricContext).CloudHost)
labels := metricAndContext.Family.GetMetric()[0].Label
assert.Equal(t, 2, len(labels))
assert.True(t, tests.HasLabel(labels, "cloudHost", "hostA"))
assert.True(t, tests.HasLabel(labels, testLabels[0].GetName(), testLabels[0].GetValue()))
} | explode_data.jsonl/82511 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 216
} | [
2830,
3393,
4703,
4630,
16055,
27328,
1155,
353,
8840,
836,
8,
341,
18185,
15192,
1669,
7032,
50133,
2271,
54310,
15192,
83332,
39705,
31549,
1321,
16340,
929,
2646,
32,
47644,
11,
220,
16,
11,
1273,
23674,
340,
2109,
16340,
3036,
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 TestDeflateInflate(t *testing.T) {
t.Parallel()
for i, h := range deflateInflateTests {
testToFromWithLimit(t, h.in, fmt.Sprintf("#%d", i), [11]int{})
}
} | explode_data.jsonl/81406 | {
"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,
2620,
5075,
641,
16716,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2023,
600,
11,
305,
1669,
2088,
92689,
641,
16716,
18200,
341,
197,
18185,
1249,
3830,
2354,
16527,
1155,
11,
305,
1858,
11,
8879,
17305,
3584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBadArrayObject(t *testing.T) {
assert := assert.New(t)
// Create a request to pass to our handler. We don't have any query parameters for now, so we'll
// pass 'nil' as the third parameter.
userJson := `{"username": "dennis", "balance": 200},{"username": "bob", "balance": 5000}]`
reader := strings.NewReader(userJson)
req, err := http.NewRequest("GET", "/health-check", reader)
if err != nil {
t.Fatal(err)
}
var object []User
err = ParseJsonRequest(req, &object)
assert.Error(err)
} | explode_data.jsonl/32028 | {
"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,
17082,
1857,
1190,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
197,
322,
4230,
264,
1681,
311,
1494,
311,
1039,
7013,
13,
1205,
1513,
944,
614,
894,
3239,
5029,
369,
1431,
11,
773,
582,
3278,
198,
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... | 2 |
func TestStoreRangeIDAllocation(t *testing.T) {
defer leaktest.AfterTest(t)()
ctx := context.Background()
stopper := stop.NewStopper()
defer stopper.Stop(ctx)
store, _ := createTestStore(t,
testStoreOpts{
// This test was written before test stores could start with more than one
// range and was not adapted.
createSystemRanges: false,
},
stopper)
// Range IDs should be allocated from ID 2 (first allocated range)
// to rangeIDAllocCount * 3 + 1.
for i := 0; i < rangeIDAllocCount*3; i++ {
rangeID, err := store.AllocateRangeID(ctx)
require.NoError(t, err)
require.EqualValues(t, 2+i, rangeID)
}
} | explode_data.jsonl/97 | {
"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,
6093,
6046,
915,
78316,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
20985,
1669,
2266,
19047,
741,
62644,
712,
1669,
2936,
7121,
10674,
712,
741,
16867,
2936,
712,
30213,
7502,
340,
57279,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContainsWrites(t *testing.T) {
col := &rwsetutil.CollHashedRwSet{
CollectionName: "col1",
}
assert.False(t, containsWrites("tx", "ns", col))
col.HashedRwSet = &kvrwset.HashedRWSet{}
assert.False(t, containsWrites("tx", "ns", col))
col.HashedRwSet.HashedWrites = append(col.HashedRwSet.HashedWrites, &kvrwset.KVWriteHash{})
assert.True(t, containsWrites("tx", "ns", col))
} | explode_data.jsonl/68558 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 172
} | [
2830,
3393,
23805,
93638,
1155,
353,
8840,
836,
8,
341,
1572,
46640,
1669,
609,
31768,
746,
1314,
727,
965,
6370,
291,
49,
86,
1649,
515,
197,
94120,
675,
25,
330,
2074,
16,
756,
197,
532,
6948,
50757,
1155,
11,
5610,
93638,
445,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMedian(t *testing.T) {
listt := []*KDNode{
&KDNode{X: 2, Y: 3},
&KDNode{X: 9, Y: 6},
&KDNode{X: 8, Y: 1},
&KDNode{X: 4, Y: 7},
&KDNode{X: 5, Y: 4},
&KDNode{X: 7, Y: 2},
}
root := BuildKDTree(listt, 1)
fmt.Println(root.Left)
a := 0.0012
b := 0.0013
fmt.Println(a > b)
} | explode_data.jsonl/3463 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 178
} | [
2830,
3393,
79514,
1155,
353,
8840,
836,
8,
341,
14440,
83,
1669,
29838,
89609,
1955,
515,
197,
197,
5,
89609,
1955,
90,
55,
25,
220,
17,
11,
809,
25,
220,
18,
1583,
197,
197,
5,
89609,
1955,
90,
55,
25,
220,
24,
11,
809,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCaseInsensitive(t *testing.T) {
for _, config := range []struct {
typ string
content string
}{
{"yaml", `
aBcD: 1
eF:
gH: 2
iJk: 3
Lm:
nO: 4
P:
Q: 5
R: 6
`},
{"json", `{
"aBcD": 1,
"eF": {
"iJk": 3,
"Lm": {
"P": {
"Q": 5,
"R": 6
},
"nO": 4
},
"gH": 2
}
}`},
{"toml", `aBcD = 1
[eF]
gH = 2
iJk = 3
[eF.Lm]
nO = 4
[eF.Lm.P]
Q = 5
R = 6
`},
} {
doTestCaseInsensitive(t, config.typ, config.content)
}
} | explode_data.jsonl/5593 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 324
} | [
2830,
30573,
75293,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
2193,
1669,
2088,
3056,
1235,
341,
197,
25314,
257,
914,
198,
197,
27751,
914,
198,
197,
59403,
197,
197,
4913,
41466,
497,
22074,
64,
33,
66,
35,
25,
220,
16,
198,
68,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestHTTPHTMLPages(t *testing.T) {
if os.Getenv("TEST_PWD_REDIS_URI") == "" {
t.Skipf("TEST_PWD_REDIS_URI not set - skipping")
}
e, _ := NewRedisExporter(os.Getenv("TEST_PWD_REDIS_URI"), Options{Namespace: "test", Registry: prometheus.NewRegistry()})
ts := httptest.NewServer(e)
defer ts.Close()
for _, tst := range []struct {
path string
want string
}{
{
path: "/",
want: `<head><title>Redis Exporter `,
},
{
path: "/health",
want: `ok`,
},
} {
t.Run(fmt.Sprintf("path: %s", tst.path), func(t *testing.T) {
body := downloadURL(t, ts.URL+tst.path)
if !strings.Contains(body, tst.want) {
t.Fatalf(`error, expected string "%s" in body, got body: \n\n%s`, tst.want, body)
}
})
}
} | explode_data.jsonl/47007 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 340
} | [
2830,
3393,
9230,
5835,
17713,
1155,
353,
8840,
836,
8,
341,
743,
2643,
64883,
445,
10033,
1088,
17563,
2192,
21202,
23116,
899,
621,
1591,
341,
197,
3244,
57776,
69,
445,
10033,
1088,
17563,
2192,
21202,
23116,
537,
738,
481,
42659,
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... | 2 |
func TestPermanentDeleteUser(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
enableAPIUserDeletion := *th.App.Config().ServiceSettings.EnableAPIUserDeletion
defer func() {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableAPIUserDeletion = &enableAPIUserDeletion })
}()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPIUserDeletion = false })
userToDelete := th.CreateUser()
t.Run("Permanent deletion not available through API if EnableAPIUserDeletion is not set", func(t *testing.T) {
resp, err := th.SystemAdminClient.PermanentDeleteUser(userToDelete.Id)
require.Error(t, err)
CheckUnauthorizedStatus(t, resp)
})
t.Run("Permanent deletion available through local mode even if EnableAPIUserDeletion is not set", func(t *testing.T) {
_, err := th.LocalClient.PermanentDeleteUser(userToDelete.Id)
require.NoError(t, err)
})
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPIUserDeletion = true })
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
userToDelete = th.CreateUser()
_, err := c.PermanentDeleteUser(userToDelete.Id)
require.NoError(t, err)
_, appErr := th.App.GetTeam(userToDelete.Id)
assert.NotNil(t, appErr)
resp, err := c.PermanentDeleteUser("junk")
require.Error(t, err)
CheckBadRequestStatus(t, resp)
}, "Permanent deletion with EnableAPIUserDeletion set")
} | explode_data.jsonl/47510 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 513
} | [
2830,
3393,
78793,
6435,
1474,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
568,
3803,
15944,
741,
16867,
270,
836,
682,
4454,
2822,
197,
12552,
7082,
1474,
1912,
52625,
1669,
353,
339,
5105,
10753,
1005,
1860,
6086,
32287,
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 TestIntegration(t *testing.T) {
fstests.Run(t, &fstests.Opt{
RemoteName: "TestAzureBlob:",
NilObject: (*Object)(nil),
TiersToTest: []string{"Hot", "Cool"},
ChunkedUpload: fstests.ChunkedUploadConfig{
MaxChunkSize: maxChunkSize,
},
})
} | explode_data.jsonl/8879 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 115
} | [
2830,
3393,
52464,
1155,
353,
8840,
836,
8,
341,
1166,
267,
17966,
16708,
1155,
11,
609,
49494,
17966,
8382,
417,
515,
197,
197,
24703,
675,
25,
220,
330,
2271,
78107,
37985,
55120,
197,
18317,
321,
1190,
25,
256,
4609,
1190,
2376,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDatabase_Client_GetBuildStepCount(t *testing.T) {
// setup types
b := testBuild()
b.SetID(2)
b.SetRepoID(1)
b.SetNumber(1)
sOne := testStep()
sOne.SetID(1)
sOne.SetRepoID(1)
sOne.SetBuildID(1)
sOne.SetNumber(1)
sOne.SetName("foo")
sOne.SetImage("baz")
sTwo := testStep()
sTwo.SetID(2)
sTwo.SetRepoID(2)
sTwo.SetBuildID(2)
sTwo.SetNumber(1)
sTwo.SetName("foo")
sTwo.SetImage("baz")
sThree := testStep()
sThree.SetID(3)
sThree.SetRepoID(2)
sThree.SetBuildID(2)
sThree.SetNumber(2)
sThree.SetName("bar")
sThree.SetImage("baz")
want := 2
// setup database
db, _ := NewTest()
defer func() {
db.Database.Exec("delete from steps;")
db.Database.Close()
}()
_ = db.CreateStep(sOne)
_ = db.CreateStep(sTwo)
_ = db.CreateStep(sThree)
// run test
got, err := db.GetBuildStepCount(b)
if err != nil {
t.Errorf("GetBuildStepCount returned err: %v", err)
}
if got != int64(want) {
t.Errorf("GetBuildStepCount is %v, want %v", got, want)
}
} | explode_data.jsonl/69135 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 454
} | [
2830,
3393,
5988,
46102,
13614,
11066,
8304,
2507,
1155,
353,
8840,
836,
8,
341,
197,
322,
6505,
4494,
198,
2233,
1669,
1273,
11066,
741,
2233,
4202,
915,
7,
17,
340,
2233,
4202,
25243,
915,
7,
16,
340,
2233,
4202,
2833,
7,
16,
692,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGonicMapperID(t *testing.T) {
assert.NoError(t, PrepareEngine())
oldMapper := testEngine.GetColumnMapper()
testEngine.UnMapType(utils.ReflectValue(new(IDGonicMapper)).Type())
testEngine.SetMapper(names.LintGonicMapper)
defer func() {
testEngine.UnMapType(utils.ReflectValue(new(IDGonicMapper)).Type())
testEngine.SetMapper(oldMapper)
}()
err := testEngine.CreateTables(new(IDGonicMapper))
if err != nil {
t.Fatal(err)
}
tables, err := testEngine.DBMetas()
if err != nil {
t.Fatal(err)
}
for _, tb := range tables {
if tb.Name == "id_gonic_mapper" {
if len(tb.PKColumns()) != 1 || tb.PKColumns()[0].Name != "id" {
t.Fatal(tb)
}
return
}
}
t.Fatal("not table id_gonic_mapper")
} | explode_data.jsonl/19201 | {
"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,
38,
14011,
10989,
915,
1155,
353,
8840,
836,
8,
341,
6948,
35699,
1155,
11,
31166,
4571,
12367,
61828,
10989,
1669,
1273,
4571,
2234,
2933,
10989,
741,
18185,
4571,
10616,
2227,
929,
64166,
18369,
767,
1130,
1755,
18742,
38,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSortAndValidateSecretsConfigration(t *testing.T) {
testCases := []struct {
name string
config Configuration
errorExpected bool
}{
{
name: "empty configuration",
errorExpected: false,
},
{
name: "incorrect default access",
config: Configuration{
Spec: ConfigurationSpec{
Secrets: SecretsSpec{
Scopes: []SecretsScope{
{
StoreName: "testStore",
DefaultAccess: "incorrect",
},
},
},
},
},
errorExpected: true,
},
{
name: "empty default access",
config: Configuration{
Spec: ConfigurationSpec{
Secrets: SecretsSpec{
Scopes: []SecretsScope{
{
StoreName: "testStore",
},
},
},
},
},
errorExpected: false,
},
{
name: "repeated store Name",
config: Configuration{
Spec: ConfigurationSpec{
Secrets: SecretsSpec{
Scopes: []SecretsScope{
{
StoreName: "testStore",
DefaultAccess: AllowAccess,
},
{
StoreName: "testStore",
DefaultAccess: DenyAccess,
},
},
},
},
},
errorExpected: true,
},
{
name: "simple secrets config",
config: Configuration{
Spec: ConfigurationSpec{
Secrets: SecretsSpec{
Scopes: []SecretsScope{
{
StoreName: "testStore",
DefaultAccess: DenyAccess,
AllowedSecrets: []string{"Z", "b", "a", "c"},
},
},
},
},
},
errorExpected: false,
},
{
name: "case-insensitive default access",
config: Configuration{
Spec: ConfigurationSpec{
Secrets: SecretsSpec{
Scopes: []SecretsScope{
{
StoreName: "testStore",
DefaultAccess: "DeNY",
AllowedSecrets: []string{"Z", "b", "a", "c"},
},
},
},
},
},
errorExpected: false,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
err := sortAndValidateSecretsConfiguration(&tc.config)
if tc.errorExpected {
assert.Error(t, err, "expected validation to fail")
} else {
for _, scope := range tc.config.Spec.Secrets.Scopes {
assert.True(t, sort.StringsAreSorted(scope.AllowedSecrets), "expected sorted slice")
assert.True(t, sort.StringsAreSorted(scope.DeniedSecrets), "expected sorted slice")
}
}
})
}
} | explode_data.jsonl/9029 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1165
} | [
2830,
3393,
10231,
3036,
17926,
19773,
82,
2648,
2165,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
688,
914,
198,
197,
25873,
286,
12221,
198,
197,
18290,
18896,
1807,
198,
197,
59403,
197,
197,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestReplaceInput(t *testing.T) {
f := setup(t)
f.SetCodeBuffer(tk.CodeBuffer{Content: "ab", Dot: 1})
evals(f.Evaler, `edit:replace-input XYZ`)
testCodeBuffer(t, f.Editor, tk.CodeBuffer{Content: "XYZ", Dot: 3})
} | explode_data.jsonl/3301 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 94
} | [
2830,
3393,
23107,
2505,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
6505,
1155,
692,
1166,
4202,
2078,
4095,
84960,
20274,
4095,
90,
2762,
25,
330,
370,
497,
31262,
25,
220,
16,
3518,
7727,
25596,
955,
5142,
831,
261,
11,
1565,
3587,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInternalizeExternalizeNull(t *testing.T) {
type S struct {
*js.Object
}
r := js.Global.Call("eval", "(function(f) { return f(null); })").Invoke(func(s S) S {
if s.Object != nil {
t.Fail()
}
return s
})
if r != nil {
t.Fail()
}
} | explode_data.jsonl/56803 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 115
} | [
2830,
3393,
11569,
551,
25913,
551,
3280,
1155,
353,
8840,
836,
8,
341,
13158,
328,
2036,
341,
197,
197,
9,
2519,
8348,
198,
197,
532,
7000,
1669,
6994,
27381,
27017,
445,
14170,
497,
11993,
1688,
955,
8,
314,
470,
282,
4967,
1215,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestClientCancelEarly(t *testing.T) {
t.Parallel()
c := Config{
HMACKey: []byte("0x24FEEDFACEDEADBEEFCAFE"),
MaxSize: 5120 * 1024,
RequestTimeout: time.Duration(500) * time.Millisecond,
MaxRedirects: 3,
ServerName: "go-camo",
noIPFiltering: true,
}
ts := httptest.NewServer(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "image/png")
w.Header().Set("Connection", "close")
flusher, ok := w.(http.Flusher)
assert.True(t, ok)
for i := 1; i <= 500; i++ {
_, err := fmt.Fprintf(w, "Chunk #%d\n", i)
// conn closed/broken pipe
if err != nil {
mlog.Debugm("write error", mlog.Map{"err": err, "i": i})
break
}
flusher.Flush() // Trigger "chunked" encoding and send a chunk...
}
},
))
defer ts.Close()
camoServer, err := New(c)
assert.Nil(t, err)
router := &router.DumbRouter{
ServerName: c.ServerName,
CamoHandler: camoServer,
}
tsCamo := httptest.NewServer(router)
defer tsCamo.Close()
conn, err := net.Dial("tcp", tsCamo.Listener.Addr().String())
assert.Nil(t, err)
defer conn.Close()
req := []byte(fmt.Sprintf(
"GET %s HTTP/1.1\r\nHost: foo.com\r\nConnection: close\r\n\r\n",
encoding.B64EncodeURL(c.HMACKey, ts.URL+"/image.png"),
))
_, err = conn.Write(req)
assert.Nil(t, err)
conn.Close()
time.Sleep(100 * time.Millisecond)
fmt.Printf("done\n")
} | explode_data.jsonl/24300 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 656
} | [
2830,
3393,
2959,
9269,
41198,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
1444,
1669,
5532,
515,
197,
13292,
25788,
1592,
25,
286,
3056,
3782,
445,
15,
87,
17,
19,
11419,
1479,
19759,
1150,
94373,
7099,
37,
5049,
11419,
446... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestModifiedLevels(t *testing.T) {
buf := bytes.Buffer{}
logger := levels.New(
log.NewJSONLogger(&buf),
levels.Key("l"),
levels.DebugValue("dbg"),
levels.InfoValue("nfo"),
levels.WarnValue("wrn"),
levels.ErrorValue("err"),
levels.CritValue("crt"),
)
logger.With("easter_island", "176°").Debug().Log("msg", "moai")
if want, have := `{"easter_island":"176°","l":"dbg","msg":"moai"}`+"\n", buf.String(); want != have {
t.Errorf("want %#v, have %#v", want, have)
}
} | explode_data.jsonl/78156 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 207
} | [
2830,
3393,
19148,
46991,
1155,
353,
8840,
836,
8,
341,
26398,
1669,
5820,
22622,
16094,
17060,
1669,
5866,
7121,
1006,
197,
6725,
7121,
5370,
7395,
2099,
5909,
1326,
197,
197,
42564,
9610,
445,
75,
4461,
197,
197,
42564,
20345,
1130,
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... | 2 |
func TestReadDeltaBinaryPackedINT(t *testing.T) {
testData := [][]interface{}{
[]interface{}{int64(1), int64(2), int64(3), int64(4)},
[]interface{}{int64(0), int64(0), int64(0), int64(0), int64(0)},
}
for _, data := range testData {
res, _ := ReadDeltaBinaryPackedINT(bytes.NewReader(WriteDeltaINT64(data)))
if fmt.Sprintf("%v", data) != fmt.Sprintf("%v", res) {
t.Errorf("ReadRLEBitpackedHybrid error, expect %v, get %v", data, res)
}
}
} | explode_data.jsonl/23901 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 195
} | [
2830,
3393,
4418,
20277,
21338,
47,
11191,
3221,
1155,
353,
8840,
836,
8,
341,
18185,
1043,
1669,
52931,
4970,
67066,
197,
197,
1294,
4970,
6257,
90,
396,
21,
19,
7,
16,
701,
526,
21,
19,
7,
17,
701,
526,
21,
19,
7,
18,
701,
526... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUndeclaredDiagnostics(t *testing.T) {
src := `
-- go.mod --
module mod.com
go 1.12
-- a/a.go --
package a
func _() int {
return x
}
-- b/b.go --
package b
func _() int {
var y int
y = y
return y
}
`
Run(t, src, func(t *testing.T, env *Env) {
isUnnecessary := func(diag protocol.Diagnostic) bool {
for _, tag := range diag.Tags {
if tag == protocol.Unnecessary {
return true
}
}
return false
}
// 'x' is undeclared, but still necessary.
env.OpenFile("a/a.go")
env.Await(env.DiagnosticAtRegexp("a/a.go", "x"))
diags := env.DiagnosticsFor("a/a.go")
if got := len(diags.Diagnostics); got != 1 {
t.Errorf("len(Diagnostics) = %d, want 1", got)
}
if diag := diags.Diagnostics[0]; isUnnecessary(diag) {
t.Errorf("%v tagged unnecessary, want necessary", diag)
}
// 'y = y' is pointless, and should be detected as unnecessary.
env.OpenFile("b/b.go")
env.Await(env.DiagnosticAtRegexp("b/b.go", "y = y"))
diags = env.DiagnosticsFor("b/b.go")
if got := len(diags.Diagnostics); got != 1 {
t.Errorf("len(Diagnostics) = %d, want 1", got)
}
if diag := diags.Diagnostics[0]; !isUnnecessary(diag) {
t.Errorf("%v tagged necessary, want unnecessary", diag)
}
})
} | explode_data.jsonl/70870 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 550
} | [
2830,
3393,
19957,
68,
86251,
35,
18938,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
22074,
313,
728,
10929,
39514,
4352,
1463,
905,
271,
3346,
220,
16,
13,
16,
17,
198,
313,
264,
14186,
18002,
39514,
1722,
264,
271,
2830,
716,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestDeleteTodo(t *testing.T) {
t.Log(`Should delete a single todo`)
mockDB, mock, err := sqlmock.New()
if err != nil {
t.Error(err)
t.Fail()
}
defer mockDB.Close()
todoID := uint(1)
userID := uint(1)
mock.ExpectExec(`DELETE FROM todos.+`).
WithArgs(todoID, userID).
WillReturnResult(sqlmock.NewResult(1, 1))
db := DB{mockDB}
if _, err := db.DeleteTodo(todoID, userID); err != nil {
t.Errorf("Failed to delete todo: %s", err.Error())
t.Fail()
}
if err := mock.ExpectationsWereMet(); err != nil {
t.Errorf("there were unfulfilled expectations: %s", err)
}
} | explode_data.jsonl/44581 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 257
} | [
2830,
3393,
6435,
24176,
1155,
353,
8840,
836,
8,
341,
3244,
5247,
5809,
14996,
3698,
264,
3175,
11804,
24183,
77333,
3506,
11,
7860,
11,
1848,
1669,
5704,
16712,
7121,
741,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
3964,
340,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_runChunk(t *testing.T) {
if !QuotasAvailable {
t.Skip("Skipping as build does not enforce quotas")
return
}
type args struct {
source string
rtCtx RuntimeContextDef
}
tests := []struct {
name string
args args
want Value
wantErr bool
skipIfNoQuotas bool
}{
{
name: "run out of cpu",
args: args{
source: `while true do end`,
rtCtx: RuntimeContextDef{HardLimits: RuntimeResources{Cpu: 10000}},
},
want: NilValue,
wantErr: true,
},
{
name: "return value",
args: args{
source: `return 42`,
rtCtx: RuntimeContextDef{HardLimits: RuntimeResources{Cpu: 10000}},
},
want: IntValue(42),
wantErr: false,
},
{
name: "error in execution",
args: args{
source: `return {} + 1`,
rtCtx: RuntimeContextDef{HardLimits: RuntimeResources{Cpu: 10000}},
},
want: NilValue,
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := RunChunk1([]byte(tt.args.source), tt.args.rtCtx, os.Stdout)
if (err != nil) != tt.wantErr {
t.Errorf("runChunk() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("runChunk() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/68610 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 629
} | [
2830,
3393,
14007,
28304,
1155,
353,
8840,
836,
8,
1476,
743,
753,
2183,
53524,
16485,
341,
197,
3244,
57776,
445,
85945,
438,
1936,
1558,
537,
28162,
84818,
1138,
197,
853,
198,
197,
630,
13158,
2827,
2036,
341,
197,
47418,
914,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestTxIndex(t *testing.T) {
for i := 0; i < 20; i++ {
txs := makeTxs(15, 60)
for j := 0; j < len(txs); j++ {
tx := txs[j]
idx := txs.Index(tx)
assert.Equal(t, j, idx)
}
assert.Equal(t, -1, txs.Index(nil))
assert.Equal(t, -1, txs.Index(Tx("foodnwkf")))
}
} | explode_data.jsonl/57148 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 154
} | [
2830,
3393,
31584,
1552,
1155,
353,
8840,
836,
8,
341,
2023,
600,
1669,
220,
15,
26,
600,
366,
220,
17,
15,
26,
600,
1027,
341,
197,
3244,
18561,
1669,
1281,
51,
18561,
7,
16,
20,
11,
220,
21,
15,
340,
197,
2023,
502,
1669,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestNewResMapFromSecretArgs(t *testing.T) {
secrets := []types.SecretArgs{
{
GeneratorArgs: types.GeneratorArgs{
Name: "apple",
KvPairSources: types.KvPairSources{
LiteralSources: []string{
"DB_USERNAME=admin",
"DB_PASSWORD=somepw",
},
},
},
Type: ifc.SecretTypeOpaque,
},
}
fSys := filesys.MakeFsInMemory()
fSys.Mkdir(".")
actual, err := rmF.NewResMapFromSecretArgs(
kv.NewLoader(
loader.NewFileLoaderAtRoot(fSys),
valtest_test.MakeFakeValidator()), nil, secrets)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
expected := resmaptest_test.NewRmBuilder(t, rf).Add(
map[string]interface{}{
"apiVersion": "v1",
"kind": "Secret",
"metadata": map[string]interface{}{
"name": "apple",
},
"type": ifc.SecretTypeOpaque,
"data": map[string]interface{}{
"DB_USERNAME": base64.StdEncoding.EncodeToString([]byte("admin")),
"DB_PASSWORD": base64.StdEncoding.EncodeToString([]byte("somepw")),
},
}).ResMap()
if err = expected.ErrorIfNotEqualLists(actual); err != nil {
t.Fatalf("error: %s", err)
}
} | explode_data.jsonl/49171 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 506
} | [
2830,
3393,
3564,
1061,
2227,
3830,
19773,
4117,
1155,
353,
8840,
836,
8,
341,
84686,
52710,
1669,
3056,
9242,
74779,
4117,
515,
197,
197,
515,
298,
197,
12561,
4117,
25,
4494,
1224,
15312,
4117,
515,
571,
21297,
25,
330,
22377,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestControllerUpdateEventWithGoodControllerNoAPIVersion(t *testing.T) {
c, tc := makeController("", "ReplicaSet")
c.Update(simpleOwnedPod("unit", "test"))
validateSent(t, tc, sourcesv1beta1.ApiServerSourceUpdateRefEventType)
} | explode_data.jsonl/39268 | {
"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,
2051,
4289,
1556,
2354,
15216,
2051,
2753,
7082,
5637,
1155,
353,
8840,
836,
8,
341,
1444,
11,
17130,
1669,
1281,
2051,
19814,
330,
18327,
15317,
1649,
1138,
1444,
16689,
1141,
6456,
57641,
23527,
445,
3843,
497,
330,
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 |
func TestService_setupExtensions(t *testing.T) {
errExtensionFactory := extensionhelper.NewFactory(
"err",
func() config.Extension {
cfg := config.NewExtensionSettings(config.NewComponentID("err"))
return &cfg
},
func(ctx context.Context, set component.ExtensionCreateSettings, extension config.Extension) (component.Extension, error) {
return nil, fmt.Errorf("cannot create \"err\" extension type")
},
)
errExtensionConfig := errExtensionFactory.CreateDefaultConfig()
badExtensionFactory := newBadExtensionFactory()
badExtensionCfg := badExtensionFactory.CreateDefaultConfig()
tests := []struct {
name string
factories component.Factories
config *config.Config
wantErrMsg string
}{
{
name: "extension_not_configured",
config: &config.Config{
Service: config.Service{
Extensions: []config.ComponentID{
config.NewComponentID("myextension"),
},
},
},
wantErrMsg: "extension \"myextension\" is not configured",
},
{
name: "missing_extension_factory",
config: &config.Config{
Extensions: map[config.ComponentID]config.Extension{
config.NewComponentID(errExtensionFactory.Type()): errExtensionConfig,
},
Service: config.Service{
Extensions: []config.ComponentID{
config.NewComponentID(errExtensionFactory.Type()),
},
},
},
wantErrMsg: "extension factory for type \"err\" is not configured",
},
{
name: "error_on_create_extension",
factories: component.Factories{
Extensions: map[config.Type]component.ExtensionFactory{
errExtensionFactory.Type(): errExtensionFactory,
},
},
config: &config.Config{
Extensions: map[config.ComponentID]config.Extension{
config.NewComponentID(errExtensionFactory.Type()): errExtensionConfig,
},
Service: config.Service{
Extensions: []config.ComponentID{
config.NewComponentID(errExtensionFactory.Type()),
},
},
},
wantErrMsg: "failed to create extension err: cannot create \"err\" extension type",
},
{
name: "bad_factory",
factories: component.Factories{
Extensions: map[config.Type]component.ExtensionFactory{
badExtensionFactory.Type(): badExtensionFactory,
},
},
config: &config.Config{
Extensions: map[config.ComponentID]config.Extension{
config.NewComponentID(badExtensionFactory.Type()): badExtensionCfg,
},
Service: config.Service{
Extensions: []config.ComponentID{
config.NewComponentID(badExtensionFactory.Type()),
},
},
},
wantErrMsg: "factory for bf produced a nil extension",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ext, err := BuildExtensions(componenttest.NewNopTelemetrySettings(), component.NewDefaultBuildInfo(), tt.config, tt.factories.Extensions)
assert.Error(t, err)
assert.EqualError(t, err, tt.wantErrMsg)
assert.Equal(t, 0, len(ext))
})
}
} | explode_data.jsonl/5404 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1125
} | [
2830,
3393,
1860,
21363,
31282,
1155,
353,
8840,
836,
8,
341,
9859,
12049,
4153,
1669,
8894,
18764,
7121,
4153,
1006,
197,
197,
1,
615,
756,
197,
29244,
368,
2193,
59715,
341,
298,
50286,
1669,
2193,
7121,
12049,
6086,
8754,
7121,
2189,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestYouonZSpecial(t *testing.T) {
const want = "zazizuzezozwazi"
for _, v := range [2]string{"ずぁずぃずぅずぇずぉずゎぜぃ", "ズァズィズゥズェズォズヮゼィ"} {
got, err := KanaToRomaji(v)
assert.Equal(t, want, got)
assert.Nil(t, err)
}
} | explode_data.jsonl/11322 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 136
} | [
2830,
3393,
2610,
263,
57,
20366,
1155,
353,
8840,
836,
8,
341,
4777,
1366,
284,
330,
89,
1370,
449,
90211,
89,
9510,
86,
17812,
1837,
2023,
8358,
348,
1669,
2088,
508,
17,
30953,
4913,
124145,
126025,
124145,
144205,
124145,
144260,
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... | 2 |
func TestGetPodPriority(t *testing.T) {
p := int32(20)
tests := []struct {
name string
pod *v1.Pod
expectedPriority int32
}{
{
name: "no priority pod resolves to static default priority",
pod: &v1.Pod{
Spec: v1.PodSpec{Containers: []v1.Container{
{Name: "container", Image: "image"}},
},
},
expectedPriority: scheduling.DefaultPriorityWhenNoDefaultClassExists,
},
{
name: "pod with priority resolves correctly",
pod: &v1.Pod{
Spec: v1.PodSpec{Containers: []v1.Container{
{Name: "container", Image: "image"}},
Priority: &p,
},
},
expectedPriority: p,
},
}
for _, test := range tests {
if GetPodPriority(test.pod) != test.expectedPriority {
t.Errorf("expected pod priority: %v, got %v", test.expectedPriority, GetPodPriority(test.pod))
}
}
} | explode_data.jsonl/59154 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 370
} | [
2830,
3393,
1949,
23527,
20555,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
526,
18,
17,
7,
17,
15,
340,
78216,
1669,
3056,
1235,
341,
197,
11609,
1797,
914,
198,
197,
3223,
347,
1060,
353,
85,
16,
88823,
198,
197,
42400,
20555,
526,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMaterializeTypes(t *testing.T) {
defer leaktest.AfterTest(t)()
// TODO(andyk): Make sure to add more types here. Consider iterating over
// types.OidToTypes list and also using randomly generated EncDatums.
types := []types.T{
*types.Bool,
*types.Int,
*types.Float,
*types.Decimal,
*types.Date,
*types.String,
*types.Bytes,
*types.Name,
*types.Oid,
}
inputRow := sqlbase.EncDatumRow{
sqlbase.EncDatum{Datum: tree.DBoolTrue},
sqlbase.EncDatum{Datum: tree.NewDInt(tree.DInt(31))},
sqlbase.EncDatum{Datum: tree.NewDFloat(37.41)},
sqlbase.EncDatum{Datum: &tree.DDecimal{Decimal: *apd.New(43, 47)}},
sqlbase.EncDatum{Datum: tree.NewDDate(pgdate.MakeCompatibleDateFromDisk(53))},
sqlbase.EncDatum{Datum: tree.NewDString("hello")},
sqlbase.EncDatum{Datum: tree.NewDBytes("ciao")},
sqlbase.EncDatum{Datum: tree.NewDName("aloha")},
sqlbase.EncDatum{Datum: tree.NewDOid(59)},
}
input := NewRepeatableRowSource(types, sqlbase.EncDatumRows{inputRow})
ctx := context.Background()
st := cluster.MakeTestingClusterSettings()
evalCtx := tree.MakeTestingEvalContext(st)
defer evalCtx.Stop(ctx)
flowCtx := &FlowCtx{
Settings: st,
EvalCtx: &evalCtx,
}
c, err := newColumnarizer(flowCtx, 0, input)
if err != nil {
t.Fatal(err)
}
outputToInputColIdx := make([]int, len(types))
for i := range outputToInputColIdx {
outputToInputColIdx[i] = i
}
m, err := newMaterializer(
flowCtx,
1, /* processorID */
c,
types,
outputToInputColIdx,
&distsqlpb.PostProcessSpec{},
nil, /* output */
nil, /* metadataSourcesQueue */
nil, /* outputStatsToTrace */
)
if err != nil {
t.Fatal(err)
}
row, meta := m.Next()
if meta != nil {
t.Fatalf("unexpected meta %+v", meta)
}
if row == nil {
t.Fatal("unexpected nil row")
}
for i := range inputRow {
inDatum := inputRow[i].Datum
outDatum := row[i].Datum
if inDatum.Compare(&evalCtx, outDatum) != 0 {
t.Fatal("unequal datums", inDatum, outDatum)
}
}
} | explode_data.jsonl/57429 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 851
} | [
2830,
3393,
13415,
551,
4173,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
197,
322,
5343,
7,
13331,
74,
1648,
7405,
2704,
311,
912,
803,
4494,
1588,
13,
21144,
87235,
916,
198,
197,
322,
4494,
8382,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTukeyBadAlpha(t *testing.T) {
_, err := window.NewTukey(-0.01)
assert.Error(t, err)
_, err = window.NewTukey(1.01)
assert.Error(t, err)
} | explode_data.jsonl/52507 | {
"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,
52971,
792,
17082,
19384,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
3241,
7121,
52971,
792,
4080,
15,
13,
15,
16,
340,
6948,
6141,
1155,
11,
1848,
692,
197,
6878,
1848,
284,
3241,
7121,
52971,
792,
7,
16,
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 |
func TestSummaryValueAtPercentile_Percentile(t *testing.T) {
ms := NewSummaryValueAtPercentile()
ms.InitEmpty()
assert.EqualValues(t, float64(0.0), ms.Percentile())
testValPercentile := float64(0.90)
ms.SetPercentile(testValPercentile)
assert.EqualValues(t, testValPercentile, ms.Percentile())
} | explode_data.jsonl/19587 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 107
} | [
2830,
3393,
19237,
1130,
1655,
32010,
457,
53918,
1168,
457,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
19237,
1130,
1655,
32010,
457,
741,
47691,
26849,
3522,
741,
6948,
12808,
6227,
1155,
11,
2224,
21,
19,
7,
15,
13,
15,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewReferenceFromBase58(t *testing.T) {
origin := gen.Reference()
decoded, err := insolar.NewReferenceFromBase58(origin.String())
require.NoError(t, err)
assert.Equal(t, origin, *decoded)
} | explode_data.jsonl/42747 | {
"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,
3564,
8856,
3830,
3978,
20,
23,
1155,
353,
8840,
836,
8,
341,
197,
8611,
1669,
4081,
58416,
741,
197,
62913,
11,
1848,
1669,
1640,
7417,
7121,
8856,
3830,
3978,
20,
23,
45375,
6431,
2398,
17957,
35699,
1155,
11,
1848,
340,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestCollectUnusedError(t *testing.T) {
t.Parallel()
const input = `
s0 {
f0 fidl_string
}
`
nopErrorHandler := func(pos ast.Pos, msg string) {}
desc := ast.Parse([]byte(input), "input", nopErrorHandler)
if desc == nil {
t.Fatal("failed to parse")
}
_, err := CollectUnused(desc, targets.List[targets.TestOS][targets.TestArch64], nopErrorHandler)
if err == nil {
t.Fatal("CollectUnused should have failed but didn't")
}
} | explode_data.jsonl/53124 | {
"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,
47504,
94033,
1454,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
4777,
1946,
284,
22074,
197,
1903,
15,
341,
298,
1166,
15,
32104,
75,
3904,
198,
197,
197,
532,
286,
22074,
9038,
453,
66673,
1669,
2915,
12259,
117... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetTestCodeBoundaries(t *testing.T) {
var pc uintptr
func() { pc, _, _, _ = runtime.Caller(1) }()
testName := t.Name()
pkg, fname, bound := GetPackageAndNameAndBoundaries(pc)
if pkg != "go.undefinedlabs.com/scopeagent/instrumentation" {
t.Fatalf("value '%s' not expected", pkg)
}
if fname != testName {
t.Fatalf("value '%s' not expected", fname)
}
boundaryExpected, _ := ast.GetFuncSourceForName(pc, testName)
calcExpected := fmt.Sprintf("%s:%d:%d", boundaryExpected.File, boundaryExpected.Start.Line, boundaryExpected.End.Line)
if bound != calcExpected {
t.Fatalf("value '%s' not expected", bound)
}
} | explode_data.jsonl/19240 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 246
} | [
2830,
3393,
1949,
2271,
2078,
19568,
5431,
1155,
353,
8840,
836,
8,
341,
2405,
13312,
38190,
198,
29244,
368,
314,
13312,
11,
8358,
8358,
716,
284,
15592,
727,
13956,
7,
16,
8,
50746,
18185,
675,
1669,
259,
2967,
2822,
3223,
7351,
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 TestUpdateNameServerAddress(t *testing.T) {
Convey("Test UpdateNameServerAddress method", t, func() {
srvs := []string{
"192.168.100.1",
"192.168.100.2",
"192.168.100.3",
"192.168.100.4",
"192.168.100.5",
}
http.HandleFunc("/nameserver/addrs", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, strings.Join(srvs, ";"))
})
server := &http.Server{Addr: ":0", Handler: nil}
listener, _ := net.Listen("tcp", ":0")
go server.Serve(listener)
port := listener.Addr().(*net.TCPAddr).Port
nameServerDommain := fmt.Sprintf("http://127.0.0.1:%d/nameserver/addrs", port)
fmt.Println("temporary name server domain: ", nameServerDommain)
resolver := primitive.NewHttpResolver("DEFAULT", nameServerDommain)
ns := &namesrvs{
srvs: []string{},
lock: new(sync.Mutex),
resolver: resolver,
}
ns.UpdateNameServerAddress()
index1 := ns.index
IP1 := ns.getNameServerAddress()
index2 := ns.index
IP2 := ns.getNameServerAddress()
So(index1+1, ShouldEqual, index2)
So(IP1, ShouldEqual, srvs[index1])
So(IP2, ShouldEqual, srvs[index2])
})
} | explode_data.jsonl/49162 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 484
} | [
2830,
3393,
4289,
675,
5475,
4286,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
2271,
5549,
675,
5475,
4286,
1714,
497,
259,
11,
2915,
368,
341,
197,
1903,
10553,
82,
1669,
3056,
917,
515,
298,
197,
1,
16,
24,
17,
13,
16,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCreateAppConfigWithJsonError(t *testing.T) {
jsonStr:=`package agollo
import (
"os"
"strconv"
"github.com/cihub/seelog"
"time"
"fmt"
"net/url"
)`
config,err:=createAppConfigWithJson(jsonStr)
t.Log(err)
test.NotNil(t,err)
test.Nil(t,config)
} | explode_data.jsonl/50973 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 127
} | [
2830,
3393,
4021,
2164,
2648,
2354,
5014,
1454,
1155,
353,
8840,
836,
8,
341,
30847,
2580,
14209,
63,
1722,
933,
27961,
271,
474,
2399,
197,
34482,
698,
197,
59658,
698,
197,
9749,
905,
2899,
6996,
392,
59587,
50571,
698,
197,
32139,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateActionProxyRewritePathForRegexpFails(t *testing.T) {
tests := []string{"$request_uri", `"test"`, `test\`}
for _, test := range tests {
allErrs := validateActionProxyRewritePathForRegexp(test, field.NewPath("rewritePath"))
if len(allErrs) == 0 {
t.Errorf("validateActionProxyRewritePathForRegexp(%v) returned no errors for invalid input", test)
}
}
} | explode_data.jsonl/65899 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 139
} | [
2830,
3393,
17926,
2512,
16219,
58465,
1247,
1820,
2461,
3477,
4580,
37,
6209,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
917,
4913,
3,
2035,
15572,
497,
53305,
1944,
1,
7808,
1565,
1944,
59,
53136,
2023,
8358,
1273,
1669,
2088,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAccept(t *testing.T) {
policyID := "policyID"
m, err := policies.NewManagerImpl("test", providerMap(), &cb.ConfigGroup{
Policies: map[string]*cb.ConfigPolicy{
policyID: {Policy: acceptAllPolicy},
},
})
assert.NoError(t, err)
assert.NotNil(t, m)
policy, ok := m.GetPolicy(policyID)
assert.True(t, ok, "Should have found policy which was just added, but did not")
err = policy.Evaluate([]*protoutil.SignedData{{Identity: []byte("identity"), Data: []byte("data"), Signature: []byte("sig")}})
assert.NoError(t, err, "Should not have errored evaluating an acceptAll policy")
} | explode_data.jsonl/51380 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 213
} | [
2830,
3393,
16646,
1155,
353,
8840,
836,
8,
341,
3223,
8018,
915,
1669,
330,
34790,
915,
698,
2109,
11,
1848,
1669,
10186,
7121,
2043,
9673,
445,
1944,
497,
9109,
2227,
1507,
609,
7221,
10753,
2808,
515,
197,
10025,
42038,
25,
2415,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseConfig(t *testing.T) {
b, err := ioutil.ReadFile("generators/testdata/ref.json")
if err != nil {
t.Error(err)
}
configTests := []struct {
name string
configBytes []byte
ignoreMissingDB bool
correct bool
errMsgRegex *regexp.Regexp
nbColl int
}{
{
name: "ref.json",
configBytes: b,
ignoreMissingDB: false,
correct: true,
errMsgRegex: nil,
nbColl: 2,
},
{
name: "invalid content",
configBytes: []byte(`[{
"database": "datagen_it_test",
"collection": "test",
"count": 1000,
"content": { "k": invalid }
}]`),
ignoreMissingDB: false,
correct: false,
errMsgRegex: regexp.MustCompile("^error in configuration file: object / array / Date badly formatted: \n\n\t\t.*"),
nbColl: 0,
},
{
name: "missing database field",
configBytes: []byte(`[{
"collection": "test",
"count": 1000,
"content": {}
}]`),
ignoreMissingDB: false,
correct: false,
errMsgRegex: regexp.MustCompile("^error in configuration file: \n\t'collection' and 'database' fields can't be empty.*"),
nbColl: 0,
},
{
name: "count > 0",
configBytes: []byte(`[{
"database": "datagen_it_test",
"collection": "test",
"count": 0,
"content": {}
}]`),
ignoreMissingDB: false,
correct: false,
errMsgRegex: regexp.MustCompile("^error in configuration file: \n\tfor collection.*"),
nbColl: 0,
},
}
for _, tt := range configTests {
t.Run(tt.name, func(t *testing.T) {
c, err := datagen.ParseConfig(tt.configBytes, tt.ignoreMissingDB)
if tt.correct {
if err != nil {
t.Errorf("expected no error for config %s: %v", tt.configBytes, err)
}
if tt.nbColl != len(c) {
t.Errorf("expected %d coll but got %d", tt.nbColl, len(c))
}
} else {
if err == nil {
t.Errorf("expected an error for config %s", tt.configBytes)
}
if !tt.errMsgRegex.MatchString(err.Error()) {
t.Errorf("error message should match %s, but was %v", tt.errMsgRegex.String(), err)
}
}
})
}
} | explode_data.jsonl/31827 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1053
} | [
2830,
3393,
14463,
2648,
1155,
353,
8840,
836,
8,
1476,
2233,
11,
1848,
1669,
43144,
78976,
445,
7490,
2973,
12697,
691,
55763,
4323,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
3964,
340,
197,
630,
25873,
18200,
1669,
3056,
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... | 6 |
func TestListBucketPagesFallback(t *testing.T) {
createData := func(ts *testServer, prefix string, n int64) []string {
keys := make([]string, n)
for i := int64(0); i < n; i++ {
key := fmt.Sprintf("%s%d", prefix, i)
ts.backendPutString(defaultBucket, key, nil, fmt.Sprintf("body-%d", i))
keys[i] = key
}
return keys
}
t.Run("fallback-disabled", func(t *testing.T) {
ts := newTestServer(t,
withBackend(&backendWithUnimplementedPaging{s3mem.New()}),
withFakerOptions(gofakes3.WithUnimplementedPageError()),
)
defer ts.Close()
createData(ts, "", 5)
_, err := ts.listBucketV1Pages(nil, 2, "")
if !hasErrorCode(err, gofakes3.ErrNotImplemented) {
t.Fatal(err)
}
})
t.Run("fallback-enabled", func(t *testing.T) {
ts := newTestServer(t, withBackend(&backendWithUnimplementedPaging{s3mem.New()}))
defer ts.Close()
createData(ts, "", 5)
r := ts.mustListBucketV1Pages(nil, 2, "")
// Without pagination, should just fall back to returning all keys:
if len(r.Contents) != 5 {
t.Fatal()
}
})
} | explode_data.jsonl/22269 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 453
} | [
2830,
3393,
852,
36018,
17713,
87206,
1155,
353,
8840,
836,
8,
341,
39263,
1043,
1669,
2915,
35864,
353,
1944,
5475,
11,
9252,
914,
11,
308,
526,
21,
19,
8,
3056,
917,
341,
197,
80112,
1669,
1281,
10556,
917,
11,
308,
340,
197,
2023... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDestroyAll(t *testing.T) {
testutil.LoadDatabase(t)
core, _ := component.NewCoreMock()
mux := router.New()
user.New(core).Routes(mux)
u := store.NewUser(core.DB, core.Q)
_, err := u.Create("John", "Smith", "jsmith@example.com", "password")
assert.Nil(t, err)
r := httptest.NewRequest("DELETE", "/v1/user", nil)
r.Header.Add("Content-Type", "application/x-www-form-urlencoded")
w := httptest.NewRecorder()
mux.ServeHTTP(w, r)
assert.Equal(t, http.StatusOK, w.Code)
assert.Contains(t, w.Body.String(), `{"status":"OK","message":"users deleted"}`)
} | explode_data.jsonl/36367 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 234
} | [
2830,
3393,
14245,
2403,
1155,
353,
8840,
836,
8,
341,
18185,
1314,
13969,
5988,
1155,
340,
71882,
11,
716,
1669,
3692,
7121,
5386,
11571,
2822,
2109,
2200,
1669,
9273,
7121,
741,
19060,
7121,
47867,
568,
26653,
1255,
2200,
692,
10676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfigWatcherExpiration(t *testing.T) {
// init conf
ConfigContext.Set("p-group", &SchedulerConfig{Checksum: []byte("abc")})
// simulate configuration never changes
SchedulerConfigLoader = func(policyGroup string) (config *SchedulerConfig, e error) {
return &SchedulerConfig{Checksum: []byte("abc")}, nil
}
cw := CreateConfigWatcher("rm-id", "p-group", 2*time.Second)
cw.Run()
// short run, after 2 seconds, it should be stopped
assert.Assert(t, waitForStopped(cw) == nil)
// start again
cw.Run()
assert.Assert(t, waitForStarted(cw) == nil)
} | explode_data.jsonl/26852 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 204
} | [
2830,
3393,
2648,
47248,
66301,
1155,
353,
8840,
836,
8,
341,
197,
322,
2930,
2335,
198,
66156,
1972,
4202,
445,
79,
4351,
497,
609,
38878,
2648,
90,
73190,
25,
3056,
3782,
445,
13683,
899,
3518,
197,
322,
37453,
6546,
2581,
4344,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMapLoadConfigWithReslice(t *testing.T) {
// Check that load configuration is respected for resliced maps.
withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) {
zolotovLoadCfg := proc.LoadConfig{FollowPointers: true, MaxStructFields: -1, MaxVariableRecurse: 3, MaxStringLen: 10, MaxArrayValues: 10}
assertNoError(p.Continue(), t, "First Continue()")
scope, err := proc.GoroutineScope(p, p.CurrentThread())
assertNoError(err, t, "GoroutineScope")
m1, err := scope.EvalExpression("m1", zolotovLoadCfg)
assertNoError(err, t, "EvalVariable")
t.Logf("m1 returned children %d (%d)", len(m1.Children)/2, m1.Len)
expr := fmt.Sprintf("(*(*%q)(%d))[10:]", m1.DwarfType.String(), m1.Addr)
t.Logf("expr %q\n", expr)
m1cont, err := scope.EvalExpression(expr, zolotovLoadCfg)
assertNoError(err, t, "EvalVariable")
t.Logf("m1cont returned children %d", len(m1cont.Children)/2)
if len(m1cont.Children) != 20 {
t.Fatalf("wrong number of children returned %d\n", len(m1cont.Children)/2)
}
})
} | explode_data.jsonl/56317 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 413
} | [
2830,
3393,
2227,
5879,
2648,
2354,
1061,
4754,
1155,
353,
8840,
836,
8,
341,
197,
322,
4248,
429,
2795,
6546,
374,
30287,
369,
592,
74630,
14043,
624,
46948,
2271,
7423,
445,
1944,
18616,
17,
497,
259,
11,
2915,
1295,
353,
15782,
350... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTaskResetExecute(t *testing.T) {
Convey("With a task returned by the Connector", t, func() {
sc := data.MockConnector{}
timeNow := time.Now()
testTask := task.Task{
Id: "testTaskId",
Activated: false,
Secret: "initialSecret",
DispatchTime: timeNow,
}
sc.MockTaskConnector.CachedTasks = append(sc.MockTaskConnector.CachedTasks, testTask)
ctx := context.Background()
Convey("and an error from the service function", func() {
sc.MockTaskConnector.StoredError = fmt.Errorf("could not reset task")
trh := &taskRestartHandler{
taskId: "testTaskId",
username: "testUser",
sc: &sc,
}
resp := trh.Run(ctx)
So(resp.Status(), ShouldNotEqual, http.StatusOK)
apiErr, ok := resp.Data().(gimlet.ErrorResponse)
So(ok, ShouldBeTrue)
So(apiErr.StatusCode, ShouldEqual, http.StatusBadRequest)
})
Convey("calling TryReset should reset the task", func() {
trh := &taskRestartHandler{
taskId: "testTaskId",
username: "testUser",
sc: &sc,
}
res := trh.Run(ctx)
So(res.Status(), ShouldEqual, http.StatusOK)
resTask, ok := res.Data().(*model.APITask)
So(ok, ShouldBeTrue)
So(resTask.Activated, ShouldBeTrue)
So(resTask.DispatchTime, ShouldEqual, nil)
dbTask, err := sc.FindTaskById("testTaskId")
So(err, ShouldBeNil)
So(dbTask.Secret, ShouldNotResemble, "initialSecret")
})
})
} | explode_data.jsonl/9572 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 605
} | [
2830,
3393,
6262,
14828,
17174,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
2354,
264,
3383,
5927,
553,
279,
54814,
497,
259,
11,
2915,
368,
341,
197,
29928,
1669,
821,
24664,
35954,
16094,
197,
21957,
7039,
1669,
882,
13244,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestList(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleListExtensionsSuccessfully(t)
count := 0
err := extensions.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := extensions.ExtractExtensions(page)
th.AssertNoErr(t, err)
th.CheckDeepEquals(t, common.ExpectedExtensions, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, 1, count)
} | explode_data.jsonl/66905 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 173
} | [
2830,
3393,
852,
1155,
353,
8840,
836,
8,
341,
70479,
39820,
9230,
741,
16867,
270,
94849,
37496,
9230,
741,
197,
6999,
852,
31282,
35959,
1155,
692,
18032,
1669,
220,
15,
198,
9859,
1669,
19721,
5814,
12805,
13860,
2959,
6011,
4854,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestEnableLegacyInstanceScope(t *testing.T) {
store, clean := realtikvtest.CreateMockStoreAndSetup(t)
defer clean()
tk := testkit.NewTestKit(t, store)
// enable 'switching' to SESSION variables
tk.MustExec("set tidb_enable_legacy_instance_scope = 1")
tk.MustExec("set tidb_general_log = 1")
tk.MustQuery(`show warnings`).Check(testkit.Rows(fmt.Sprintf("Warning %d modifying tidb_general_log will require SET GLOBAL in a future version of TiDB", errno.ErrInstanceScope)))
require.True(t, tk.Session().GetSessionVars().EnableLegacyInstanceScope)
// disable 'switching' to SESSION variables
tk.MustExec("set tidb_enable_legacy_instance_scope = 0")
tk.MustGetErrCode("set tidb_general_log = 1", errno.ErrGlobalVariable)
require.False(t, tk.Session().GetSessionVars().EnableLegacyInstanceScope)
} | explode_data.jsonl/5712 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 278
} | [
2830,
3393,
11084,
77415,
2523,
10803,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1931,
83,
1579,
85,
1944,
7251,
11571,
6093,
3036,
21821,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFileWatcher(t *testing.T) {
interval := time.Millisecond
filewatcher.InitialReadInterval = interval
writeDelay := interval * 10
timeout := writeDelay * 20
payload1 := []byte("Hello, world!")
payload2 := []byte("Bye, world!")
dir, err := ioutil.TempDir("", "filewatcher_test_")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
path := filepath.Join(dir, "foo")
// Delay writing the file
go func() {
time.Sleep(writeDelay)
f, err := os.Create(path)
if err != nil {
t.Error(err)
return
}
defer f.Close()
if _, err := f.Write(payload1); err != nil {
t.Error(err)
}
}()
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
data, err := filewatcher.New(
ctx,
filewatcher.Config{
Path: path,
Parser: parser,
Logger: log.TestWrapper(t),
},
)
if err != nil {
t.Fatal(err)
}
defer data.Stop()
compareBytesData(t, data.Get(), payload1)
func() {
f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, 0644)
if err != nil {
t.Fatal(err)
}
defer f.Close()
if _, err := f.Write(payload2); err != nil {
t.Fatal(err)
}
}()
// Give it some time to handle the file content change
time.Sleep(time.Millisecond * 500)
compareBytesData(t, data.Get(), payload2)
} | explode_data.jsonl/15404 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 547
} | [
2830,
3393,
1703,
47248,
1155,
353,
8840,
836,
8,
341,
2084,
6152,
1669,
882,
71482,
198,
17661,
14321,
261,
32932,
4418,
10256,
284,
9873,
198,
24945,
20039,
1669,
9873,
353,
220,
16,
15,
198,
78395,
1669,
3270,
20039,
353,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAssessRunStatusErrorMessageAnalysisPhaseFail(t *testing.T) {
status, message, dryRunSummary := StartAssessRunStatusErrorMessageAnalysisPhaseFail(t, false)
assert.Equal(t, v1alpha1.AnalysisPhaseFailed, status)
assert.Equal(t, "Metric \"failed-metric\" assessed Failed due to failed (1) > failureLimit (0)", message)
expectedDryRunSummary := v1alpha1.RunSummary{
Count: 0,
Successful: 0,
Failed: 0,
Inconclusive: 0,
Error: 0,
}
assert.Equal(t, &expectedDryRunSummary, dryRunSummary)
} | explode_data.jsonl/75842 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 201
} | [
2830,
3393,
5615,
433,
6727,
2522,
21349,
26573,
30733,
19524,
1155,
353,
8840,
836,
8,
341,
23847,
11,
1943,
11,
9058,
6727,
19237,
1669,
5145,
5615,
433,
6727,
2522,
21349,
26573,
30733,
19524,
1155,
11,
895,
340,
6948,
12808,
1155,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestToggleFlag(t *testing.T) {
type args struct {
ctx context.Context
flag Flag
}
tests := []struct {
name string
args args
want bool
}{
{"on", args{context.Background(), LIVE}, true},
{"off", args{WithFlag(context.Background(), LIVE), LIVE}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if ctx := ToggleFlag(tt.args.ctx, tt.args.flag); Has(ctx, tt.args.flag) != tt.want {
t.Errorf("ToggleFlag() = (%d) %v, got %v, want %v", FromContext(ctx), ctx, Has(ctx, tt.args.flag), tt.want)
}
})
}
} | explode_data.jsonl/46856 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 239
} | [
2830,
3393,
18897,
12135,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
20985,
220,
2266,
9328,
198,
197,
30589,
22666,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
31215,
2827,
198,
197,
50780,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestKondoCommander(t *testing.T) {
var testCases = map[string]struct {
input []string
command string
}{
"t1": {
input: []string{"hello", "there"},
command: "help",
},
"noInput": {
command: "whatever",
},
}
for n, tc := range testCases {
t.Run(n, func(t *testing.T) {
c := &KondoCommander{Command: tc.command}
assert.Equal(t, tc.command, c.String())
assert.True(t, c.Success())
for i := range tc.input {
assert.NoError(t, WriteString(c, tc.input[i]))
}
assert.True(t, c.Success())
c.Reset()
assert.True(t, c.Success())
})
}
} | explode_data.jsonl/47700 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 272
} | [
2830,
3393,
42,
34971,
4062,
261,
1155,
353,
8840,
836,
8,
341,
2405,
1273,
37302,
284,
2415,
14032,
60,
1235,
341,
197,
22427,
256,
3056,
917,
198,
197,
45566,
914,
198,
197,
59403,
197,
197,
1,
83,
16,
788,
341,
298,
22427,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSerializeFromQuery(t *testing.T) {
pr, err := readPingRequestFromQuery(url.Values{
"site": []string{"0101-0101"},
"deployType": []string{"server"},
"version": []string{"3.12.6"},
"auth": []string{"foo,bar"},
"extsvcs": []string{"GITHUB,GITLAB"},
"signup": []string{"true"},
"hasExtURL": []string{"false"},
"u": []string{"123"},
"act": []string{`{"foo": "bar"}`},
"initAdmin": []string{"test@sourcegraph.com"},
"totalUsers": []string{"234"},
"repos": []string{"true"},
"searched": []string{"false"},
"refs": []string{"true"},
})
if err != nil {
t.Fatalf("unexpected error %s", err)
}
now := time.Now()
payload, err := marshalPing(pr, true, "127.0.0.1", now)
if err != nil {
t.Fatalf("unexpected error %s", err)
}
compareJSON(t, payload, `{
"remote_ip": "127.0.0.1",
"remote_site_version": "3.12.6",
"remote_site_id": "0101-0101",
"license_key": "",
"has_update": "true",
"unique_users_today": "123",
"site_activity": {"foo":"bar"},
"batch_changes_usage": null,
"code_intel_usage": null,
"new_code_intel_usage": null,
"dependency_versions": null,
"extensions_usage": null,
"code_insights_usage": null,
"code_insights_critical_telemetry": null,
"code_monitoring_usage": null,
"code_host_integration_usage": null,
"ide_extensions_usage": null,
"cta_usage": null,
"search_usage": null,
"growth_statistics": null,
"saved_searches": null,
"homepage_panels": null,
"search_onboarding": null,
"repositories": null,
"retention_statistics": null,
"installer_email": "test@sourcegraph.com",
"auth_providers": "foo,bar",
"ext_services": "GITHUB,GITLAB",
"code_host_versions": null,
"builtin_signup_allowed": "true",
"deploy_type": "server",
"total_user_accounts": "234",
"has_external_url": "false",
"has_repos": "true",
"ever_searched": "false",
"ever_find_refs": "true",
"timestamp": "`+now.UTC().Format(time.RFC3339)+`"
}`)
} | explode_data.jsonl/3335 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 882
} | [
2830,
3393,
15680,
3830,
2859,
1155,
353,
8840,
836,
8,
341,
25653,
11,
1848,
1669,
1349,
69883,
1900,
3830,
2859,
6522,
35145,
515,
197,
197,
1,
9513,
788,
981,
3056,
917,
4913,
15,
16,
15,
16,
12,
15,
16,
15,
16,
7115,
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... | 3 |
func TestEnum(t *testing.T) {
r := workloads.ReservationWorkload{
Type: workloads.WorkloadTypeContainer,
}
bytes, err := json.Marshal(r)
require.NoError(t, err)
var o workloads.ReservationWorkload
require.NoError(t, json.Unmarshal(bytes, &o))
require.Equal(t, r.Type, o.Type)
} | explode_data.jsonl/67193 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 115
} | [
2830,
3393,
10766,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
975,
32685,
8377,
8768,
6776,
1078,
515,
197,
27725,
25,
975,
32685,
28748,
1078,
929,
4502,
345,
197,
630,
70326,
11,
1848,
1669,
2951,
37271,
2601,
340,
17957,
35699,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.