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 TestGetBoolOption(t *testing.T) {
for _, tc := range []struct {
name string
envName string
exportEnv map[string]string
option string
options map[string]interface{}
defaultValue bool
expected bool
expectedError bool
}{
{
name: "default to false",
defaultValue: false,
option: "opt",
expected: false,
},
{
name: "default to true",
defaultValue: true,
option: "opt",
envName: "VBOOL",
expected: true,
},
{
name: "given option",
defaultValue: false,
option: "opt",
options: map[string]interface{}{"opt": "true"},
expected: true,
},
{
name: "env value with missing option",
defaultValue: true,
option: "opt",
envName: "VBOOL",
exportEnv: map[string]string{"VBOOL": "false"},
expected: false,
},
{
name: "given option and env var",
defaultValue: false,
option: "opt",
options: map[string]interface{}{"opt": "false"},
envName: "VAR",
exportEnv: map[string]string{"VAR": "true"},
expected: true,
},
{
name: "disable with env var",
defaultValue: true,
option: "opt",
options: map[string]interface{}{"opt": "true"},
envName: "VAR",
exportEnv: map[string]string{"VAR": "false"},
expected: false,
},
{
name: "given option with bad env value",
defaultValue: false,
option: "opt",
options: map[string]interface{}{"opt": "true"},
envName: "VAR",
exportEnv: map[string]string{"VAR": "falsed"},
expected: true,
expectedError: true,
},
{
name: "env value with wrong option type",
defaultValue: true,
option: "opt",
options: map[string]interface{}{"opt": 1},
envName: "VAR",
exportEnv: map[string]string{"VAR": "true"},
expected: true,
expectedError: true,
},
{
name: "env value with bad option value",
defaultValue: true,
option: "opt",
options: map[string]interface{}{"opt": "falsed"},
envName: "VAR",
exportEnv: map[string]string{"VAR": "false"},
expected: false,
expectedError: true,
},
{
name: "bad env value with bad option value",
defaultValue: false,
option: "opt",
options: map[string]interface{}{"opt": "turk"},
envName: "VAR",
exportEnv: map[string]string{"VAR": "truth"},
expected: false,
expectedError: true,
},
} {
for key, value := range tc.exportEnv {
os.Setenv(key, value)
}
d, err := getBoolOption(tc.envName, tc.option, tc.defaultValue, tc.options)
if err == nil && tc.expectedError {
t.Errorf("[%s] unexpected non-error", tc.name)
} else if err != nil && !tc.expectedError {
t.Errorf("[%s] unexpected error: %v", tc.name, err)
}
if d != tc.expected {
t.Errorf("[%s] got unexpected duration: %t != %t", tc.name, d, tc.expected)
}
}
} | explode_data.jsonl/63536 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1494
} | [
2830,
3393,
1949,
11233,
5341,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
3056,
1235,
341,
197,
11609,
688,
914,
198,
197,
57538,
675,
981,
914,
198,
197,
59440,
14359,
257,
2415,
14032,
30953,
198,
197,
80845,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExactlyWrapper(t *testing.T) {
assert := New(new(testing.T))
a := float32(1)
b := float64(1)
c := float32(1)
d := float32(2)
if assert.Exactly(a, b) {
t.Error("Exactly should return false")
}
if assert.Exactly(a, d) {
t.Error("Exactly should return false")
}
if !assert.Exactly(a, c) {
t.Error("Exactly should return true")
}
if assert.Exactly(nil, a) {
t.Error("Exactly should return false")
}
if assert.Exactly(a, nil) {
t.Error("Exactly should return false")
}
} | explode_data.jsonl/54970 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 200
} | [
2830,
3393,
65357,
11542,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
1532,
1755,
8623,
287,
836,
4390,
11323,
1669,
2224,
18,
17,
7,
16,
340,
2233,
1669,
2224,
21,
19,
7,
16,
340,
1444,
1669,
2224,
18,
17,
7,
16,
340,
2698,
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... | 6 |
func TestUntarPathWithDestinationSrcFileAsFolder(t *testing.T) {
tmpFolder, err := os.MkdirTemp("", "docker-archive-test")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpFolder)
srcFile := filepath.Join(tmpFolder, "src")
tarFile := filepath.Join(tmpFolder, "src.tar")
os.Create(srcFile)
// Translate back to Unix semantics as next exec.Command is run under sh
srcFileU := srcFile
tarFileU := tarFile
if runtime.GOOS == "windows" {
tarFileU = "/tmp/" + filepath.Base(filepath.Dir(tarFile)) + "/src.tar"
srcFileU = "/tmp/" + filepath.Base(filepath.Dir(srcFile)) + "/src"
}
cmd := exec.Command("sh", "-c", "tar cf "+tarFileU+" "+srcFileU)
_, err = cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
destFolder := filepath.Join(tmpFolder, "dest")
err = os.MkdirAll(destFolder, 0740)
if err != nil {
t.Fatalf("Fail to create the destination folder")
}
// Let's create a folder that will has the same path as the extracted file (from tar)
destSrcFileAsFolder := filepath.Join(destFolder, srcFileU)
err = os.MkdirAll(destSrcFileAsFolder, 0740)
if err != nil {
t.Fatal(err)
}
err = defaultUntarPath(tarFile, destFolder)
if err != nil {
t.Fatalf("UntarPath should throw not throw an error if the extracted file already exists and is a folder")
}
} | explode_data.jsonl/79240 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 481
} | [
2830,
3393,
20250,
277,
1820,
2354,
33605,
20360,
1703,
2121,
13682,
1155,
353,
8840,
836,
8,
341,
20082,
13682,
11,
1848,
1669,
2643,
1321,
12438,
12151,
19814,
330,
28648,
95100,
16839,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUpdateUserMfa(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer th.TearDown()
Client := th.Client
th.App.SetLicense(model.NewTestLicense("mfa"))
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
session, _ := th.App.GetSession(Client.AuthToken)
session.IsOAuth = true
th.App.AddSessionToCache(session)
_, resp := Client.UpdateUserMfa(th.BasicUser.Id, "12345", false)
CheckForbiddenStatus(t, resp)
} | explode_data.jsonl/21543 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 174
} | [
2830,
3393,
4289,
1474,
44,
3632,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1005,
3803,
15944,
1005,
3803,
2320,
7210,
741,
16867,
270,
836,
682,
4454,
741,
71724,
1669,
270,
11716,
271,
70479,
5105,
4202,
9827,
7635,
7121,
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 Test_getFirstColumn(t *testing.T) {
testCases := []struct {
name string
fileContent string
want []string
wantErr bool
}{
{
name: "valid content",
fileContent: `libiscsi_tcp 28672 1 iscsi_tcp, Live 0xffffffffc07ae000
libiscsi 57344 3 ib_iser,iscsi_tcp,libiscsi_tcp, Live 0xffffffffc079a000
raid10 57344 0 - Live 0xffffffffc0597000`,
want: []string{"libiscsi_tcp", "libiscsi", "raid10"},
wantErr: false,
},
}
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
got, err := getFirstColumn(strings.NewReader(test.fileContent))
if (err != nil) != test.wantErr {
t.Errorf("getFirstColumn() error = %v, wantErr %v", err, test.wantErr)
return
}
if !reflect.DeepEqual(got, test.want) {
t.Errorf("getFirstColumn() = %v, want %v", got, test.want)
}
})
}
} | explode_data.jsonl/44375 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 389
} | [
2830,
3393,
3062,
5338,
2933,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
286,
914,
198,
197,
17661,
2762,
914,
198,
197,
50780,
286,
3056,
917,
198,
197,
50780,
7747,
257,
1807,
198,
197,
59403,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestDdot(t *testing.T) {
ctx, handle, buffers := setupTest(t, []float64{1, 2, 3, 4, -2, -3, 5},
[]float64{3, -1, 2, 3, -2, 0, 4, 2.5, 3.5}, []float64{0})
<-ctx.Run(func() error {
var res float64
err := handle.Ddot(3, buffers[0], 1, buffers[1], 1, &res)
if err != nil {
t.Error(err)
return nil
}
if math.Abs(res-7) > 1e-4 {
t.Errorf("bad value: %f", res)
}
err = handle.Ddot(5, buffers[0], 1, buffers[1], 2, &res)
if err != nil {
t.Error(err)
return nil
}
if math.Abs(res-10) > 1e-4 {
t.Errorf("bad value: %f", res)
}
err = handle.SetPointerMode(Device)
if err != nil {
t.Error(err)
return nil
}
defer handle.SetPointerMode(Host)
err = handle.Ddot(3, buffers[0], 3, buffers[1], 4, buffers[2])
if err != nil {
t.Error(err)
return nil
}
resSlice := make([]float64, 1)
err = cuda.ReadBuffer(resSlice, buffers[2])
if err != nil {
t.Error(err)
return nil
}
if math.Abs(resSlice[0]-12.5) > 1e-4 {
t.Errorf("bad value: %f", resSlice[0])
}
return nil
})
} | explode_data.jsonl/70348 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 522
} | [
2830,
3393,
35,
16119,
1155,
353,
8840,
836,
8,
341,
20985,
11,
3705,
11,
27389,
1669,
6505,
2271,
1155,
11,
3056,
3649,
21,
19,
90,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
481,
17,
11,
481,
18,
11,
220,
20,
1583,
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... | 9 |
func TestGrpc_CreateRawTxGroup(t *testing.T) {
_, err := g.CreateRawTxGroup(getOkCtx(), &pb.CreateTransactionGroup{})
assert.Equal(t, types.ErrTxGroupCountLessThanTwo, err)
} | explode_data.jsonl/326 | {
"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,
6464,
3992,
34325,
20015,
31584,
2808,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
342,
7251,
20015,
31584,
2808,
5433,
11578,
23684,
1507,
609,
16650,
7251,
8070,
2808,
37790,
6948,
12808,
1155,
11,
4494,
27862,
3158... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestXORtest4(t *testing.T) {
t.Run("XORtest 4", func(t *testing.T) {
rb := NewBitmap()
rb2 := NewBitmap()
counter := 0
for i := 0; i < 200000; i += 4 {
rb2.AddInt(i)
counter++
}
assert.EqualValues(t, counter, rb2.GetCardinality())
for i := 200000; i < 400000; i += 14 {
rb2.AddInt(i)
counter++
}
assert.EqualValues(t, counter, rb2.GetCardinality())
rb2card := rb2.GetCardinality()
assert.EqualValues(t, counter, rb2card)
// check or against an empty bitmap
xorresult := Xor(rb, rb2)
assert.EqualValues(t, counter, xorresult.GetCardinality())
off := Or(rb2, rb)
assert.EqualValues(t, counter, off.GetCardinality())
assert.True(t, xorresult.Equals(off))
assert.Equal(t, xorresult.GetCardinality(), rb2card)
for i := 500000; i < 600000; i += 14 {
rb.AddInt(i)
}
for i := 200000; i < 400000; i += 3 {
rb2.AddInt(i)
}
// check or against an empty bitmap
xorresult2 := Xor(rb, rb2)
assert.EqualValues(t, xorresult.GetCardinality(), rb2card)
assert.Equal(t, xorresult2.GetCardinality(), rb2.GetCardinality()+rb.GetCardinality())
rb.Xor(rb2)
assert.True(t, xorresult2.Equals(rb))
})
// need to add the massives
} | explode_data.jsonl/20340 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 541
} | [
2830,
3393,
55,
868,
1944,
19,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
55,
868,
1944,
220,
19,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
85589,
1669,
1532,
16773,
741,
197,
85589,
17,
1669,
1532,
16773,
741,
197,
58261,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetFuncName(t *testing.T) {
res1 := KDbug.GetFuncName(nil, false)
res2 := KDbug.GetFuncName(nil, true)
res3 := KDbug.GetFuncName(KArr.ArrayDiff, false) // ...ArrayDiff-fm
res4 := KDbug.GetFuncName(KArr.ArrayDiff, true) // ArrayDiff-fm
if !strings.Contains(res1, "TestGetFuncName") || res2 != "TestGetFuncName" || !strings.Contains(res3, "ArrayDiff") || !strings.HasPrefix(res4, "ArrayDiff") {
t.Error("GetFuncName fail")
return
}
} | explode_data.jsonl/74239 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 186
} | [
2830,
3393,
1949,
9626,
675,
1155,
353,
8840,
836,
8,
341,
10202,
16,
1669,
62990,
2313,
2234,
9626,
675,
27907,
11,
895,
340,
10202,
17,
1669,
62990,
2313,
2234,
9626,
675,
27907,
11,
830,
340,
10202,
18,
1669,
62990,
2313,
2234,
962... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFileUtilFunctionsErrors(t *testing.T) {
t.Run("syncDir-openfile", func(t *testing.T) {
err := syncDir("non-existent-dir")
require.Error(t, err)
require.Contains(t, err.Error(), "error while opening dir:non-existent-dir")
})
t.Run("createAndSyncFile-openfile", func(t *testing.T) {
path, err := ioutil.TempDir("", "kvledger")
err = createAndSyncFile(path, []byte("dummy content"))
require.Error(t, err)
require.Contains(t, err.Error(), "error while creating file:"+path)
})
} | explode_data.jsonl/74144 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 194
} | [
2830,
3393,
1703,
2742,
25207,
13877,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
12996,
6184,
25686,
1192,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
9859,
1669,
12811,
6184,
445,
6280,
59828,
45283,
1138,
197,
17957,
6141,
1155... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestInit(t *testing.T) {
u := gptest.NewUnitTester(t)
defer u.Remove()
ctx := context.Background()
ctx = ctxutil.WithAlwaysYes(ctx, true)
ctx = out.WithHidden(ctx, true)
ctx = backend.WithCryptoBackend(ctx, backend.Plain)
cfg := config.New()
cfg.Root.Path = backend.FromPath(u.StoreDir("rs"))
rs, err := New(ctx, cfg)
assert.NoError(t, err)
assert.Equal(t, false, rs.Initialized(ctx))
assert.NoError(t, rs.Init(ctx, "", u.StoreDir("rs"), "0xDEADBEEF"))
assert.Equal(t, true, rs.Initialized(ctx))
assert.NoError(t, rs.Init(ctx, "rs2", u.StoreDir("rs2"), "0xDEADBEEF"))
} | explode_data.jsonl/23936 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 247
} | [
2830,
3393,
3803,
1155,
353,
8840,
836,
8,
341,
10676,
1669,
342,
70334,
7121,
4562,
58699,
1155,
340,
16867,
575,
13270,
2822,
20985,
1669,
2266,
19047,
741,
20985,
284,
5635,
1314,
26124,
37095,
9454,
7502,
11,
830,
340,
20985,
284,
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 TestWriteMapDesc(t *testing.T) {
buf := &bytes.Buffer{}
dw := printers.NewBarePrefixWriter(buf)
WriteMapDesc(dw, testMap, "eggs", false)
assert.Equal(t, buf.String(), "eggs:\ta=b, c=d, foo=bar\n")
} | explode_data.jsonl/36443 | {
"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,
7985,
2227,
11065,
1155,
353,
8840,
836,
8,
341,
26398,
1669,
609,
9651,
22622,
16094,
2698,
86,
1669,
55953,
7121,
33,
546,
14335,
6492,
10731,
340,
60373,
2227,
11065,
97342,
11,
1273,
2227,
11,
330,
791,
5857,
497,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContext_IsXHR(t *testing.T) {
a := assert.New(t, false)
srv := newServer(a, nil)
router := srv.NewRouter("router", "https://example.com", group.MatcherFunc(group.Any))
a.NotNil(router)
router.Get("/not-xhr", func(ctx *Context) Responser {
a.False(ctx.IsXHR())
return nil
})
router.Get("/xhr", func(ctx *Context) Responser {
a.True(ctx.IsXHR())
return nil
})
r, err := http.NewRequest(http.MethodGet, "/not-xhr", nil)
a.NotError(err).NotNil(r)
w := httptest.NewRecorder()
router.MuxRouter().ServeHTTP(w, r)
r, err = http.NewRequest(http.MethodGet, "/xhr", nil)
a.NotError(err).NotNil(r)
r.Header.Set("X-Requested-With", "XMLHttpRequest")
w = httptest.NewRecorder()
router.MuxRouter().ServeHTTP(w, r)
} | explode_data.jsonl/34201 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 326
} | [
2830,
3393,
1972,
31879,
52036,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
2060,
7121,
1155,
11,
895,
692,
1903,
10553,
1669,
501,
5475,
2877,
11,
2092,
340,
67009,
1669,
43578,
7121,
9523,
445,
9937,
497,
330,
2428,
1110,
8687,
905,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGenericStatementArrayType(t *testing.T) {
a, errs := ParseString(`
x = []List<string> {
new List<string>([]string{"hi"}),
}
`)
bvmUtils.AssertNow(t, len(errs) == 0, errs.Format())
bvmUtils.AssertNow(t, a != nil, "nil scope")
bvmUtils.AssertLength(t, len(a.Sequence), 1)
} | explode_data.jsonl/49770 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 131
} | [
2830,
3393,
19964,
8636,
98481,
1155,
353,
8840,
836,
8,
341,
11323,
11,
70817,
1669,
14775,
703,
61528,
197,
10225,
284,
3056,
852,
4947,
29,
341,
298,
8638,
1759,
4947,
2235,
1294,
917,
4913,
6023,
67432,
197,
197,
532,
197,
24183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFind(t *testing.T) {
for _, tt := range limitTests {
t.Run(tt.name, func(t *testing.T) {
for _, httpMethod := range FindHTTPMethods {
testFind(t, httpMethod, tt.ex, tt.ex2, tt.header)
}
})
}
} | explode_data.jsonl/14049 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 106
} | [
2830,
3393,
9885,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17853,
1669,
2088,
3930,
18200,
341,
197,
3244,
16708,
47152,
2644,
11,
2915,
1155,
353,
8840,
836,
8,
341,
298,
2023,
8358,
1758,
3523,
1669,
2088,
7379,
9230,
17856,
341,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestLoggingOutletEnumList_SetDefaults(t *testing.T) {
e := &LoggingOutletEnumList{}
var i yaml.Defaulter = e
require.NotPanics(t, func() {
i.SetDefault()
assert.Equal(t, "warn", (*e)[0].Ret.(*StdoutLoggingOutlet).Level)
})
} | explode_data.jsonl/18557 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 104
} | [
2830,
3393,
34575,
10643,
10766,
852,
14812,
16273,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
609,
34575,
10643,
10766,
852,
16094,
2405,
600,
32246,
49947,
4943,
465,
284,
384,
198,
17957,
15000,
35693,
1211,
1155,
11,
2915,
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 TestPart1(t *testing.T) {
input := readInputs("input.txt")
foodSlice := parseInputs(input)
want := 2573
allergens := getAllergens(foodSlice)
got := countNonAllergens(allergens, foodSlice)
if got != want {
t.Errorf("got %d; want %d", got, want)
}
} | explode_data.jsonl/26577 | {
"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,
5800,
16,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
1349,
31946,
445,
1355,
3909,
1138,
197,
13915,
33236,
1669,
4715,
31946,
5384,
692,
50780,
1669,
220,
17,
20,
22,
18,
198,
50960,
2375,
724,
1669,
23955,
2375,
724,
810... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJSONIndented(t *testing.T) {
render := New(Options{
IndentJSON: true,
})
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
render.JSON(w, http.StatusOK, Greeting{"hello", "world"})
})
res := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/foo", nil)
h.ServeHTTP(res, req)
expect(t, res.Code, http.StatusOK)
expect(t, res.Header().Get(ContentType), ContentJSON+"; charset=UTF-8")
expect(t, res.Body.String(), "{\n \"one\": \"hello\",\n \"two\": \"world\"\n}\n")
} | explode_data.jsonl/3671 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 209
} | [
2830,
3393,
5370,
89509,
1155,
353,
8840,
836,
8,
341,
33921,
1669,
1532,
7,
3798,
515,
197,
197,
42729,
5370,
25,
830,
345,
197,
8824,
9598,
1669,
1758,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
33921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseGCLifecycle(t *testing.T) {
tt := []struct {
lifecycle string
states map[TableGCState]bool
expectErr bool
}{
{
lifecycle: "",
states: map[TableGCState]bool{
DropTableGCState: true,
},
},
{
lifecycle: "drop",
states: map[TableGCState]bool{
DropTableGCState: true,
},
},
{
lifecycle: " drop, ",
states: map[TableGCState]bool{
DropTableGCState: true,
},
},
{
lifecycle: "hold, drop",
states: map[TableGCState]bool{
HoldTableGCState: true,
DropTableGCState: true,
},
},
{
lifecycle: "hold,purge, evac;drop",
states: map[TableGCState]bool{
HoldTableGCState: true,
PurgeTableGCState: true,
EvacTableGCState: true,
DropTableGCState: true,
},
},
{
lifecycle: "hold,purge,evac,drop",
states: map[TableGCState]bool{
HoldTableGCState: true,
PurgeTableGCState: true,
EvacTableGCState: true,
DropTableGCState: true,
},
},
{
lifecycle: "hold, other, drop",
expectErr: true,
},
}
for _, ts := range tt {
states, err := ParseGCLifecycle(ts.lifecycle)
if ts.expectErr {
assert.Error(t, err)
} else {
assert.NoError(t, err)
assert.Equal(t, ts.states, states)
}
}
} | explode_data.jsonl/33453 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 595
} | [
2830,
3393,
14463,
38,
3140,
19517,
1155,
353,
8840,
836,
8,
341,
3244,
83,
1669,
3056,
1235,
341,
197,
8810,
19517,
914,
198,
197,
18388,
973,
262,
2415,
58,
2556,
22863,
1397,
96436,
198,
197,
24952,
7747,
1807,
198,
197,
59403,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestPresenceAPI(t *testing.T) {
node := nodeWithMemoryEngine()
ruleConfig := rule.DefaultConfig
ruleContainer := rule.NewContainer(ruleConfig)
api := NewExecutor(node, ruleContainer, "test")
resp := api.Presence(context.Background(), &PresenceRequest{})
require.Equal(t, ErrorBadRequest, resp.Error)
resp = api.Presence(context.Background(), &PresenceRequest{Channel: "test"})
require.Equal(t, ErrorNotAvailable, resp.Error)
config := ruleContainer.Config()
config.Presence = true
_ = ruleContainer.Reload(config)
resp = api.Presence(context.Background(), &PresenceRequest{Channel: "test"})
require.Nil(t, resp.Error)
} | explode_data.jsonl/48463 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 205
} | [
2830,
3393,
89169,
7082,
1155,
353,
8840,
836,
8,
341,
20831,
1669,
2436,
2354,
10642,
4571,
741,
7000,
1111,
2648,
1669,
5912,
13275,
2648,
198,
7000,
1111,
4502,
1669,
5912,
7121,
4502,
34944,
2648,
692,
54299,
1669,
1532,
25255,
6958,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParametersForBinding(t *testing.T) {
testcases := []struct {
name string
cmd string
params map[string]interface{}
}{
{
name: "bind with --param",
cmd: "bind NAME --param foo=bar --param baz=boo",
params: map[string]interface{}{
"foo": "bar",
"baz": "boo",
},
},
{
name: "bind with --params-json",
cmd: "bind NAME --params-json {\"foo\":\"bar\",\"baz\":\"boo\"}",
params: map[string]interface{}{
"foo": "bar",
"baz": "boo",
},
},
{
name: "bind with --params-json with a sub object",
cmd: "bind NAME --params-json {\"foo\":{\"faa\":\"bar\",\"baz\":\"boo\"}}",
params: map[string]interface{}{
"foo": map[string]interface{}{
"faa": "bar",
"baz": "boo",
},
},
},
}
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
fakeClient := fake.NewSimpleClientset()
cxt := newContext()
cxt.App = &svcat.App{
SvcatClient: &servicecatalog.SDK{ServiceCatalogClient: fakeClient},
}
cxt.Output = ioutil.Discard
executeFakeCommand(t, tc.cmd, cxt, true)
if c := fakeClient.Actions(); len(c) != 1 {
t.Fatal("Expected only 1 action, got ", c)
}
action := fakeClient.Actions()[0]
if action.GetVerb() != "create" {
t.Fatal("Expected a create action, but got ", action.GetVerb())
}
createAction, ok := action.(clientgotesting.CreateAction)
if !ok {
t.Fatal(t, "Unexpected type; failed to convert action %+v to CreateAction", action)
}
fakeObject := createAction.GetObject()
binding, ok := fakeObject.(*v1beta1.ServiceBinding)
if !ok {
t.Fatal(t, "Failed to cast object to binding: ", fakeObject)
}
var params map[string]interface{}
if err := json.Unmarshal(binding.Spec.Parameters.Raw, ¶ms); err != nil {
t.Error("failed to unmarshal binding.Spec.Parameters")
}
if eq := reflect.DeepEqual(params, tc.params); !eq {
t.Errorf("parameters mismatch, \nwant: %+v, \ngot: %+v", tc.params, params)
}
})
}
} | explode_data.jsonl/71178 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 875
} | [
2830,
3393,
9706,
2461,
15059,
1155,
353,
8840,
836,
8,
341,
18185,
23910,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
25920,
262,
914,
198,
197,
25856,
2415,
14032,
31344,
16094,
197,
59403,
197,
197,
515,
298,
11609,
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... | 7 |
func TestAcceptRetryTemporary(t *testing.T) {
listener := &testutils.MockListener{
AcceptFunc: func(i int) (net.Conn, error) {
if i < 10 {
return nil, testutils.ErrTemporaryTrue
}
return nil, io.EOF
},
}
server := &RetryServer{
Listener: listener,
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
start := time.Now()
if err := server.Serve(ctx); errors.Cause(err) != io.EOF {
t.Errorf("want io.EOF, got %v", err)
}
// retried 10 times for temporary errors, so the delays should be:
want := (5 + 10 + 20 + 40 + 80 + 160 + 320 + 640 + 1000 + 1000) * time.Millisecond
got := time.Since(start)
if got < want || got > (want+(100*time.Millisecond)) {
t.Errorf("want duration of %v, got %v", want, got)
}
} | explode_data.jsonl/71922 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 303
} | [
2830,
3393,
16646,
51560,
59362,
1155,
353,
8840,
836,
8,
341,
14440,
798,
1669,
609,
1944,
6031,
24664,
2743,
515,
197,
197,
16646,
9626,
25,
2915,
1956,
526,
8,
320,
4711,
50422,
11,
1465,
8,
341,
298,
743,
600,
366,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestWalkDir(t *testing.T) {
// happy path
err := walker.WalkDir("testdata/fs", func(filePath string, info os.FileInfo, opener analyzer.Opener) error {
if info.IsDir() {
return nil
}
if filePath == "testdata/fs/bar" {
b, err := opener()
require.NoError(t, err)
assert.Equal(t, "bar", string(b))
} else {
assert.Fail(t, "invalid file", filePath)
}
return nil
})
require.NoError(t, err, "happy path")
// sad path
err = walker.WalkDir("testdata/fs", func(filePath string, info os.FileInfo, opener analyzer.Opener) error {
return errors.New("error")
})
require.NotNil(t, err)
require.Contains(t, err.Error(), "failed to analyze file: error", "sad path")
} | explode_data.jsonl/82633 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 275
} | [
2830,
3393,
48849,
6184,
1155,
353,
8840,
836,
8,
341,
197,
322,
6247,
1815,
198,
9859,
1669,
62524,
1175,
1692,
6184,
445,
92425,
73036,
497,
2915,
29605,
914,
11,
3546,
2643,
8576,
1731,
11,
35153,
54660,
67799,
798,
8,
1465,
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... | 3 |
func TestDetectEncoding(t *testing.T) {
ff, _ := filepath.Glob("testdata/*.txt")
detector := NewDetector(WithLanguage("ja", ""))
for _, f := range ff {
filename := filepath.Base(f)
t.Run(filename, func(t *testing.T) {
b, _ := os.ReadFile(f)
enc, name := detector.DetectEncoding(b)
if assert.NotEqual(t, "", name) {
return
}
assert.Equal(
t,
strings.ToLower(strings.TrimSuffix(filename, ".txt")),
strings.Replace(strings.ToLower(fmt.Sprint(enc)), " ", "_", -1),
)
})
}
} | explode_data.jsonl/66097 | {
"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,
57193,
14690,
1155,
353,
8840,
836,
8,
341,
67399,
11,
716,
1669,
26054,
1224,
1684,
445,
92425,
23540,
8586,
1138,
2698,
295,
1256,
1669,
1532,
31606,
7,
2354,
13806,
445,
5580,
497,
77561,
2023,
8358,
282,
1669,
2088,
2553... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFetchTimebounds(t *testing.T) {
hmock := httptest.NewClient()
client := &Client{
HorizonURL: "https://localhost/",
HTTP: hmock,
}
// mock currentUniversalTime
client.SetCurrentUniversalTime(func() int64 {
return int64(1560947096)
})
// When no saved server time, return local time
st, err := client.FetchTimebounds(100)
if assert.NoError(t, err) {
assert.IsType(t, ServerTimeMap["localhost"], ServerTimeRecord{})
assert.Equal(t, st.MinTime, int64(0))
}
// server time is saved on requests to horizon
header := http.Header{}
header.Add("Date", "Wed, 19 Jun 2019 12:24:56 GMT") //unix time: 1560947096
hmock.On(
"GET",
"https://localhost/metrics",
).ReturnStringWithHeader(200, metricsResponse, header)
_, err = client.Metrics()
assert.NoError(t, err)
// get saved server time
st, err = client.FetchTimebounds(100)
if assert.NoError(t, err) {
assert.IsType(t, ServerTimeMap["localhost"], ServerTimeRecord{})
assert.Equal(t, st.MinTime, int64(0))
// serverTime + 100seconds
assert.Equal(t, st.MaxTime, int64(1560947196))
}
// mock server time
newRecord := ServerTimeRecord{ServerTime: 100, LocalTimeRecorded: client.currentUniversalTime()}
ServerTimeMap["localhost"] = newRecord
st, err = client.FetchTimebounds(100)
assert.NoError(t, err)
assert.IsType(t, st, txnbuild.Timebounds{})
assert.Equal(t, st.MinTime, int64(0))
// time should be 200, serverTime + 100seconds
assert.Equal(t, st.MaxTime, int64(200))
} | explode_data.jsonl/82478 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 554
} | [
2830,
3393,
20714,
1462,
34019,
1155,
353,
8840,
836,
8,
341,
9598,
16712,
1669,
54320,
70334,
7121,
2959,
741,
25291,
1669,
609,
2959,
515,
197,
13292,
269,
16973,
3144,
25,
330,
2428,
1110,
8301,
35075,
197,
197,
9230,
25,
981,
305,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEventString(t *testing.T) {
var table = []struct {
definition string
expectations map[string]string
}{
{
definition: `[
{ "type" : "event", "name" : "Balance", "inputs": [{ "name" : "in", "type": "uint256" }] },
{ "type" : "event", "name" : "Check", "inputs": [{ "name" : "t", "type": "address" }, { "name": "b", "type": "uint256" }] },
{ "type" : "event", "name" : "Transfer", "inputs": [{ "name": "from", "type": "address", "indexed": true }, { "name": "to", "type": "address", "indexed": true }, { "name": "value", "type": "uint256" }] }
]`,
expectations: map[string]string{
"Balance": "event Balance(uint256 in)",
"Check": "event Check(address t, uint256 b)",
"Transfer": "event Transfer(address indexed from, address indexed to, uint256 value)",
},
},
}
for _, test := range table {
abi, err := JSON(strings.NewReader(test.definition))
if err != nil {
t.Fatal(err)
}
for name, event := range abi.Events {
if event.String() != test.expectations[name] {
t.Errorf("expected string to be %s, got %s", test.expectations[name], event.String())
}
}
}
} | explode_data.jsonl/43924 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 456
} | [
2830,
3393,
1556,
703,
1155,
353,
8840,
836,
8,
341,
2405,
1965,
284,
3056,
1235,
341,
197,
7452,
4054,
256,
914,
198,
197,
24952,
804,
2415,
14032,
30953,
198,
197,
59403,
197,
197,
515,
298,
7452,
4054,
25,
1565,
9640,
298,
197,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestServerBoundHandshake_IsLoginRequest(t *testing.T) {
tt := []struct {
handshake mc.ServerBoundHandshake
result bool
}{
{
handshake: mc.ServerBoundHandshake{
NextState: mc.StatusState,
},
result: false,
},
{
handshake: mc.ServerBoundHandshake{
NextState: mc.LoginState,
},
result: true,
},
}
for _, tc := range tt {
if tc.handshake.IsLoginRequest() != tc.result {
t.Fail()
}
}
} | explode_data.jsonl/45002 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 192
} | [
2830,
3393,
5475,
19568,
2314,
29661,
31879,
6231,
1900,
1155,
353,
8840,
836,
8,
341,
3244,
83,
1669,
3056,
1235,
341,
197,
9598,
437,
29661,
19223,
22997,
19568,
2314,
29661,
198,
197,
9559,
262,
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 TestConcurrentWrites(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
_, mnt := setupIpnsTest(t, nil)
defer mnt.Close()
nactors := 4
filesPerActor := 400
fileSize := 2000
data := make([][][]byte, nactors)
if racedet.WithRace() {
nactors = 2
filesPerActor = 50
}
wg := sync.WaitGroup{}
for i := 0; i < nactors; i++ {
data[i] = make([][]byte, filesPerActor)
wg.Add(1)
go func(n int) {
defer wg.Done()
for j := 0; j < filesPerActor; j++ {
out, err := writeFile(fileSize, mnt.Dir+fmt.Sprintf("/local/%dFILE%d", n, j))
if err != nil {
t.Error(err)
continue
}
data[n][j] = out
}
}(i)
}
wg.Wait()
for i := 0; i < nactors; i++ {
for j := 0; j < filesPerActor; j++ {
if data[i][j] == nil {
// Error already reported.
continue
}
verifyFile(t, mnt.Dir+fmt.Sprintf("/local/%dFILE%d", i, j), data[i][j])
}
}
} | explode_data.jsonl/77471 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 443
} | [
2830,
3393,
1109,
3231,
93638,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
7039,
741,
197,
532,
197,
6878,
296,
406,
1669,
6505,
23378,
4412,
2271,
1155,
11,
2092,
340,
16867,
296,
406,
10421,
2822,
903... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDeleteInstanceIDError(t *testing.T) {
status := http.StatusOK
var tr *http.Request
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
tr = r
w.WriteHeader(status)
w.Header().Set("Content-Type", "application/json")
w.Write([]byte("{}"))
}))
defer ts.Close()
ctx := context.Background()
client, err := NewClient(ctx, testIIDConfig)
if err != nil {
t.Fatal(err)
}
client.endpoint = ts.URL
client.client.RetryConfig = nil
errorHandlers := map[int]func(error) bool{
http.StatusBadRequest: errorutils.IsInvalidArgument,
http.StatusUnauthorized: errorutils.IsUnauthenticated,
http.StatusForbidden: errorutils.IsPermissionDenied,
http.StatusNotFound: errorutils.IsNotFound,
http.StatusConflict: errorutils.IsConflict,
http.StatusTooManyRequests: errorutils.IsResourceExhausted,
http.StatusInternalServerError: errorutils.IsInternal,
http.StatusServiceUnavailable: errorutils.IsUnavailable,
}
deprecatedErrorHandlers := map[int]func(error) bool{
http.StatusBadRequest: IsInvalidArgument,
http.StatusUnauthorized: IsInsufficientPermission,
http.StatusForbidden: IsInsufficientPermission,
http.StatusNotFound: IsNotFound,
http.StatusConflict: IsAlreadyDeleted,
http.StatusTooManyRequests: IsTooManyRequests,
http.StatusInternalServerError: IsInternal,
http.StatusServiceUnavailable: IsServerUnavailable,
}
for code, check := range errorHandlers {
status = code
want := fmt.Sprintf("instance id %q: %s", "test-iid", errorMessages[code])
err := client.DeleteInstanceID(ctx, "test-iid")
if err == nil || !check(err) || err.Error() != want {
t.Errorf("DeleteInstanceID() = %v; want = %v", err, want)
}
resp := errorutils.HTTPResponse(err)
if resp.StatusCode != code {
t.Errorf("HTTPResponse().StatusCode = %d; want = %d", resp.StatusCode, code)
}
deprecatedCheck := deprecatedErrorHandlers[code]
if !deprecatedCheck(err) {
t.Errorf("DeleteInstanceID() = %v; want = %v", err, want)
}
if tr == nil {
t.Fatalf("Request = nil; want non-nil")
}
if tr.Method != http.MethodDelete {
t.Errorf("Method = %q; want = %q", tr.Method, http.MethodDelete)
}
if tr.URL.Path != "/project/test-project/instanceId/test-iid" {
t.Errorf("Path = %q; want = %q", tr.URL.Path, "/project/test-project/instanceId/test-iid")
}
if h := tr.Header.Get("Authorization"); h != "Bearer test-token" {
t.Errorf("Authorization = %q; want = %q", h, "Bearer test-token")
}
tr = nil
}
} | explode_data.jsonl/54624 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1041
} | [
2830,
3393,
6435,
2523,
915,
1454,
1155,
353,
8840,
836,
8,
341,
23847,
1669,
1758,
52989,
198,
2405,
489,
353,
1254,
9659,
198,
57441,
1669,
54320,
70334,
7121,
5475,
19886,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
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 TestBitMatrixParser_Mirror(t *testing.T) {
mirrored, _ := gozxing.ParseStringToBitMatrix(""+
"############## ## ##############\n"+
"## ## #### ## ##\n"+
"## ###### ## #### ## ###### ##\n"+
"## ###### ## ######## ## ###### ##\n"+
"## ###### ## ## ## ## ###### ##\n"+
"## ## ###### ## ##\n"+
"############## ## ## ## ##############\n"+
" ###### ## \n"+
" #### ######## ###### #### ## ####\n"+
"######## ###### ########## #### \n"+
" ###### ## ######## ########\n"+
"#### ## ## ## ## ## ###### ##\n"+
"## ## ######## ## ## ## ## ##\n"+
" ## #### ## \n"+
"############## #### ## ## ## \n"+
"## ## ## ########## ##\n"+
"## ###### ## ## #### #### ## \n"+
"## ###### ## #### ## ## ##\n"+
"## ###### ## ## ## #### #### \n"+
"## ## #### ## ## ## ##\n"+
"############## ###### ## ###### ", "##", " ")
unmirrored, _ := gozxing.ParseStringToBitMatrix(qrstr, "##", " ")
img, _ := gozxing.ParseStringToBitMatrix(qrstr, "##", " ")
p, _ := NewBitMatrixParser(img)
p.Mirror()
compareBitMatrix(t, img, mirrored)
p.Mirror()
compareBitMatrix(t, img, unmirrored)
} | explode_data.jsonl/32243 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 813
} | [
2830,
3393,
8344,
6689,
6570,
1245,
28812,
1155,
353,
8840,
836,
8,
341,
2109,
404,
47643,
11,
716,
1669,
728,
66700,
287,
8937,
703,
1249,
8344,
6689,
445,
27424,
197,
197,
1,
17455,
565,
220,
7704,
688,
76527,
565,
59,
77,
27424,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExtend(t *testing.T) {
for _, destStartIdx := range pos {
for _, srcStartIdx := range pos {
for _, srcEndIdx := range pos {
if destStartIdx <= srcStartIdx && srcStartIdx <= srcEndIdx {
toAppend := srcEndIdx - srcStartIdx
name := fmt.Sprintf("destStartIdx=%d,srcStartIdx=%d,toAppend=%d", destStartIdx,
srcStartIdx, toAppend)
t.Run(name, func(t *testing.T) {
n := nulls3.Copy()
n.Extend(&nulls5, destStartIdx, uint16(srcStartIdx), uint16(toAppend))
for i := uint64(0); i < destStartIdx; i++ {
require.Equal(t, nulls3.NullAt64(i), n.NullAt64(i))
}
for i := uint64(0); i < toAppend; i++ {
// TODO(solon): Arguably the null value should also be false if the source
// value was false, but that's not how the current implementation works.
// Fix this when we replace it with a faster bitwise implementation.
if nulls5.NullAt64(srcStartIdx + i) {
destIdx := destStartIdx + i
require.True(t, n.NullAt64(destIdx),
"n.NullAt64(%d) should be true", destIdx)
}
}
})
}
}
}
}
} | explode_data.jsonl/37158 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 532
} | [
2830,
3393,
72136,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
3201,
3479,
11420,
1669,
2088,
1133,
341,
197,
2023,
8358,
2286,
3479,
11420,
1669,
2088,
1133,
341,
298,
2023,
8358,
2286,
3727,
11420,
1669,
2088,
1133,
341,
571,
743,
3201,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestImageInspectError(t *testing.T) {
client := &Client{
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
}
_, _, err := client.ImageInspectWithRaw(context.Background(), "nothing")
if err == nil || err.Error() != "Error response from daemon: Server error" {
t.Fatalf("expected a Server Error, got %v", err)
}
if !errdefs.IsSystem(err) {
t.Fatalf("expected a Server Error, got %T", err)
}
} | explode_data.jsonl/6822 | {
"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,
1906,
58533,
1454,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
609,
2959,
515,
197,
25291,
25,
501,
11571,
2959,
6390,
11571,
19886,
66760,
11,
330,
5475,
1465,
30154,
197,
630,
197,
6878,
8358,
1848,
1669,
2943,
7528,
58533,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRouter_MatchingOptions_MatchesByQueryParameters(t *testing.T) {
mainRouter := Router{}
_ = mainRouter.Get("/users", testHandlerFunc, NewMatchingOptions())
_ = mainRouter.Get("/users/{id}", testHandlerFunc, MatchingOptions{"", "", []string{}, map[string]string{}, map[string]string{"key1": "value1"}, nil})
_ = mainRouter.Get("/users/{id}/create", testHandlerFunc, MatchingOptions{"", "", []string{}, map[string]string{}, map[string]string{"key2": "value2"}, nil})
req, _ := http.NewRequest("GET", "/users/1/create?key2=value2", nil)
res := httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 200, res.Code)
req, _ = http.NewRequest("GET", "/users/1/create?key2=invalid", nil)
res = httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 404, res.Code)
req, _ = http.NewRequest("GET", "/users/1", nil)
res = httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 404, res.Code)
req, _ = http.NewRequest("GET", "/users/1?key1=value1", nil)
req.Header.Set("key1", "value1")
res = httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 200, res.Code)
} | explode_data.jsonl/31735 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 445
} | [
2830,
3393,
9523,
1245,
31924,
3798,
1245,
9118,
1359,
2859,
9706,
1155,
353,
8840,
836,
8,
341,
36641,
9523,
1669,
10554,
31483,
197,
62,
284,
1887,
9523,
2234,
4283,
4218,
497,
1273,
3050,
9626,
11,
1532,
64430,
3798,
2398,
197,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBaseIdentity_HitPointGetterSetters(t *testing.T) {
i := getTestBaseIdentity()
mhp := i.GetMaxHitPoints()
chp := i.GetCurrentHitPoints()
if chp != mhp {
t.Errorf("Current Hit Points should equal max hit points: expected: %d, got: %d", mhp, chp)
}
i.ApplyDamage(TestDamage)
chp = i.GetCurrentHitPoints()
if chp != mhp-TestDamage {
t.Errorf("ApplyDamage should have reduced current hip points by %d, expected: %d, got %d", TestDamage, mhp-TestDamage, chp)
}
i.ApplyDamage(TestOverkillDamage)
chp = i.GetCurrentHitPoints()
if chp != 0 {
t.Errorf("Applying more damage than a hero's current hit points should set hit points to 0. Expected: 0, got %d", chp)
}
i.ApplyHealing(TestHealing)
ehp := chp + TestHealing
chp = i.GetCurrentHitPoints()
if chp != ehp {
t.Errorf("ApplyHealing should have raised currentHitPoints by %d. Expected %d, got: %d", TestHealing, ehp, chp)
}
i.ApplyHealing(TestOverkillHealing)
chp = i.GetCurrentHitPoints()
if chp != mhp {
t.Errorf("Applying more healing than the hero's max hit points should set current hit points to max. Expected: %d, got %d", mhp, chp)
}
} | explode_data.jsonl/55785 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 424
} | [
2830,
3393,
3978,
18558,
2039,
275,
2609,
31485,
1649,
5045,
1155,
353,
8840,
836,
8,
341,
8230,
1669,
633,
2271,
3978,
18558,
741,
2109,
21197,
1669,
600,
2234,
5974,
19498,
11411,
741,
23049,
79,
1669,
600,
44242,
19498,
11411,
2822,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCaptivePrepareRange_ToIsAheadOfRootHAS(t *testing.T) {
mockRunner := &stellarCoreRunnerMock{}
mockArchive := &historyarchive.MockArchive{}
mockArchive.
On("GetRootHAS").
Return(historyarchive.HistoryArchiveState{
CurrentLedger: uint32(192),
}, nil)
captiveBackend := CaptiveStellarCore{
archive: mockArchive,
stellarCoreRunnerFactory: func(_ stellarCoreRunnerMode) (stellarCoreRunnerInterface, error) {
return mockRunner, nil
},
checkpointManager: historyarchive.NewCheckpointManager(64),
}
err := captiveBackend.PrepareRange(context.Background(), BoundedRange(100, 200))
assert.EqualError(t, err, "error starting prepare range: opening subprocess: to sequence: 200 is greater than max available in history archives: 192")
mockArchive.AssertExpectations(t)
mockRunner.AssertExpectations(t)
} | explode_data.jsonl/7318 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 276
} | [
2830,
3393,
34,
27781,
50590,
6046,
38346,
3872,
87962,
2124,
8439,
78230,
1155,
353,
8840,
836,
8,
341,
77333,
19486,
1669,
609,
77293,
5386,
19486,
11571,
16094,
77333,
42502,
1669,
609,
18844,
16019,
24664,
42502,
16094,
77333,
42502,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMultiStageDockerBuildPreservesSyntaxDirective(t *testing.T) {
f := newIBDFixture(t, k8s.EnvGKE)
defer f.TearDown()
baseImage := model.MustNewImageTarget(SanchoBaseRef).WithBuildDetails(model.DockerBuild{
Dockerfile: `FROM golang:1.10`,
BuildPath: f.JoinPath("sancho-base"),
})
srcImage := model.MustNewImageTarget(SanchoRef).WithBuildDetails(model.DockerBuild{
Dockerfile: `# syntax = docker/dockerfile:experimental
FROM sancho-base
ADD . .
RUN go install github.com/tilt-dev/sancho
ENTRYPOINT /go/bin/sancho
`,
BuildPath: f.JoinPath("sancho"),
}).WithDependencyIDs([]model.TargetID{baseImage.ID()})
m := manifestbuilder.New(f, "sancho").
WithK8sYAML(SanchoYAML).
WithImageTargets(baseImage, srcImage).
Build()
_, err := f.ibd.BuildAndDeploy(f.ctx, f.st, buildTargets(m), store.BuildStateSet{})
if err != nil {
t.Fatal(err)
}
assert.Equal(t, 2, f.docker.BuildCount)
assert.Equal(t, 1, f.docker.PushCount)
assert.Equal(t, 0, f.kl.loadCount)
expected := expectedFile{
Path: "Dockerfile",
Contents: `# syntax = docker/dockerfile:experimental
FROM sancho-base:tilt-11cd0b38bc3ceb95
ADD . .
RUN go install github.com/tilt-dev/sancho
ENTRYPOINT /go/bin/sancho
`,
}
testutils.AssertFileInTar(t, tar.NewReader(f.docker.BuildContext), expected)
} | explode_data.jsonl/38260 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 533
} | [
2830,
3393,
20358,
19398,
35,
13659,
11066,
14367,
13280,
33890,
62076,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
501,
3256,
5262,
12735,
1155,
11,
595,
23,
82,
81214,
38,
3390,
340,
16867,
282,
836,
682,
4454,
2822,
24195,
1906,
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 TestContentTypeFieldValidationRangeUniquePredefinedValues(t *testing.T) {
var err error
assert := assert.New(t)
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Equal(r.Method, "POST")
assert.Equal(r.RequestURI, "/spaces/"+spaceID+"/content_types")
checkHeaders(r, assert)
var payload map[string]interface{}
err := json.NewDecoder(r.Body).Decode(&payload)
assert.Nil(err)
fields := payload["fields"].([]interface{})
assert.Equal(1, len(fields))
field1 := fields[0].(map[string]interface{})
assert.Equal("Integer", field1["type"].(string))
validations := field1["validations"].([]interface{})
// unique validation
validationUnique := validations[0].(map[string]interface{})
assert.Equal(false, validationUnique["unique"].(bool))
// range validation
validationRange := validations[1].(map[string]interface{})
rangeValues := validationRange["range"].(map[string]interface{})
errorMessage := validationRange["message"].(string)
assert.Equal("error message", errorMessage)
assert.Equal(float64(20), rangeValues["min"].(float64))
assert.Equal(float64(30), rangeValues["max"].(float64))
// predefined validation
validationPredefinedValues := validations[2].(map[string]interface{})
predefinedValues := validationPredefinedValues["in"].([]interface{})
assert.Equal(3, len(predefinedValues))
assert.Equal("error message 2", validationPredefinedValues["message"].(string))
assert.Equal(float64(20), predefinedValues[0].(float64))
assert.Equal(float64(21), predefinedValues[1].(float64))
assert.Equal(float64(22), predefinedValues[2].(float64))
w.WriteHeader(201)
fmt.Fprintln(w, string(readTestData("content_type.json")))
})
// test server
server := httptest.NewServer(handler)
defer server.Close()
// cma client
cma = NewCMA(CMAToken)
cma.BaseURL = server.URL
field1 := &Field{
ID: "field1",
Name: "field1-name",
Type: FieldTypeInteger,
Validations: []FieldValidation{
&FieldValidationUnique{
Unique: false,
},
&FieldValidationRange{
Range: &MinMax{
Min: 20,
Max: 30,
},
ErrorMessage: "error message",
},
&FieldValidationPredefinedValues{
In: []interface{}{20, 21, 22},
ErrorMessage: "error message 2",
},
},
}
ct := &ContentType{
Name: "ct-name",
Description: "ct-description",
Fields: []*Field{field1},
DisplayField: field1.ID,
}
err = cma.ContentTypes.Upsert("id1", ct)
assert.Nil(err)
} | explode_data.jsonl/66086 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 959
} | [
2830,
3393,
29504,
1877,
13799,
6046,
22811,
4703,
9711,
6227,
1155,
353,
8840,
836,
8,
341,
2405,
1848,
1465,
198,
6948,
1669,
2060,
7121,
1155,
692,
53326,
1669,
1758,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDirect_InvalidEvent(t *testing.T) {
g := NewGomegaWithT(t)
xform, src, acc := setup(g)
xform.Start()
defer xform.Stop()
src.Handlers.Handle(event.FullSyncFor(basicmeta.Collection2)) // Collection2
src.Handlers.Handle(event.AddFor(basicmeta.Collection2, data.EntryN1I1V1))
g.Consistently(acc.Events).Should(BeEmpty())
} | explode_data.jsonl/37563 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 129
} | [
2830,
3393,
16027,
62,
7928,
1556,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
1532,
38,
32696,
2354,
51,
1155,
692,
10225,
627,
11,
2286,
11,
1029,
1669,
6505,
3268,
692,
10225,
627,
12101,
741,
16867,
856,
627,
30213,
2822,
41144,
353... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNodeGetVolumeStats(t *testing.T) {
nonexistedPath := "/not/a/real/directory"
fakePath := "/tmp/fake-volume-path"
tests := []struct {
desc string
req csi.NodeGetVolumeStatsRequest
expectedErr error
}{
{
desc: "[Error] Volume ID missing",
req: csi.NodeGetVolumeStatsRequest{VolumePath: targetTest},
expectedErr: status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume ID was empty"),
},
{
desc: "[Error] VolumePath missing",
req: csi.NodeGetVolumeStatsRequest{VolumeId: "vol_1"},
expectedErr: status.Error(codes.InvalidArgument, "NodeGetVolumeStats volume path was empty"),
},
{
desc: "[Error] Incorrect volume path",
req: csi.NodeGetVolumeStatsRequest{VolumePath: nonexistedPath, VolumeId: "vol_1"},
expectedErr: status.Errorf(codes.NotFound, "path /not/a/real/directory does not exist"),
},
{
desc: "[Success] Standard success",
req: csi.NodeGetVolumeStatsRequest{VolumePath: fakePath, VolumeId: "vol_1"},
expectedErr: nil,
},
}
// Setup
_ = makeDir(fakePath)
d := NewFakeDriver()
for _, test := range tests {
_, err := d.NodeGetVolumeStats(context.Background(), &test.req)
//t.Errorf("[debug] error: %v\n metrics: %v", err, metrics)
if !reflect.DeepEqual(err, test.expectedErr) {
t.Errorf("desc: %v, expected error: %v, actual error: %v", test.desc, test.expectedErr, err)
}
}
// Clean up
err := os.RemoveAll(fakePath)
assert.NoError(t, err)
} | explode_data.jsonl/36855 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 618
} | [
2830,
3393,
1955,
1949,
18902,
16635,
1155,
353,
8840,
836,
8,
341,
197,
6280,
327,
13236,
1820,
1669,
3521,
1921,
14186,
14,
7951,
3446,
4758,
698,
1166,
726,
1820,
1669,
3521,
5173,
6663,
726,
66768,
33095,
1837,
78216,
1669,
3056,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestTakeApartVehicle(t *testing.T) {
a := assert.New(t)
vehicle := &Vehicle{
id: DefaultID,
name: DefaultName,
communicationID: DefaultCommunicationID,
isCarbonCopy: CarbonCopy,
version: DefaultVersion,
newVersion: DefaultVersion,
}
comp := &vehicleComponentMock{}
TakeApart(
vehicle,
func(id, name, communicationID, version string, isCarbonCopy bool) {
comp.id = id
comp.name = name
comp.communicationID = communicationID
comp.isCarbonCopy = isCarbonCopy
comp.version = version
},
)
expectComp := &vehicleComponentMock{
id: string(DefaultID),
name: DefaultName,
communicationID: string(DefaultCommunicationID),
isCarbonCopy: CarbonCopy,
version: string(DefaultVersion),
}
a.Equal(comp, expectComp)
} | explode_data.jsonl/36304 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 353
} | [
2830,
3393,
17814,
69504,
34602,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
2060,
7121,
1155,
692,
197,
19764,
1669,
609,
34602,
515,
197,
15710,
25,
1060,
7899,
915,
345,
197,
11609,
25,
310,
7899,
675,
345,
197,
197,
50171,
915,
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 TestGdbPythonCgo(t *testing.T) {
if runtime.GOARCH == "mips" || runtime.GOARCH == "mipsle" || runtime.GOARCH == "mips64" {
testenv.SkipFlaky(t, 18784)
}
testGdbPython(t, true)
} | explode_data.jsonl/62283 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 81
} | [
2830,
3393,
38,
1999,
30280,
34,
3346,
1155,
353,
8840,
836,
8,
341,
743,
15592,
97574,
10790,
621,
330,
76,
3077,
1,
1369,
15592,
97574,
10790,
621,
330,
76,
3077,
273,
1,
1369,
15592,
97574,
10790,
621,
330,
76,
3077,
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... | 4 |
func TestCreateBatchChangesCredential(t *testing.T) {
if testing.Short() {
t.Skip()
}
ctx := context.Background()
db := dbtesting.GetDB(t)
pruneUserCredentials(t, db)
userID := ct.CreateTestUser(t, db, false).ID
cstore := store.New(db)
r := &Resolver{store: cstore}
s, err := graphqlbackend.NewSchema(db, r, nil, nil, nil, nil, nil)
if err != nil {
t.Fatal(err)
}
input := map[string]interface{}{
"user": graphqlbackend.MarshalUserID(userID),
"externalServiceKind": string(extsvc.KindGitHub),
"externalServiceURL": "https://github.com/",
"credential": "SOSECRET",
}
var response struct {
CreateBatchChangesCredential apitest.BatchChangesCredential
}
actorCtx := actor.WithActor(ctx, actor.FromUser(userID))
// First time it should work, because no credential exists
apitest.MustExec(actorCtx, t, s, input, &response, mutationCreateCredential)
if response.CreateBatchChangesCredential.ID == "" {
t.Fatalf("expected credential to be created, but was not")
}
// Second time it should fail
errors := apitest.Exec(actorCtx, t, s, input, &response, mutationCreateCredential)
if len(errors) != 1 {
t.Fatalf("expected single errors, but got none")
}
if have, want := errors[0].Extensions["code"], "ErrDuplicateCredential"; have != want {
t.Fatalf("wrong error code. want=%q, have=%q", want, have)
}
} | explode_data.jsonl/13592 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 523
} | [
2830,
3393,
4021,
21074,
11317,
48265,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
741,
197,
630,
20985,
1669,
2266,
19047,
741,
20939,
1669,
2927,
8840,
2234,
3506,
1155,
692,
25653,
2886,
1474,
27025,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSort(test *testing.T) {
var g = graph{
0: {},
1: {0},
2: {0, 1},
3: {2},
4: {0, 1, 2, 3},
}
var nodes = []int{2, 1, 3, 4, 0}
var sorted, hasCycle = tsort.Sort(nodes, g.From)
if hasCycle {
test.Fatal("graph has cycle")
}
assertOrdered(test, sorted, g.From)
} | explode_data.jsonl/20777 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 145
} | [
2830,
3393,
10231,
8623,
353,
8840,
836,
8,
341,
2405,
342,
284,
4771,
515,
197,
197,
15,
25,
14573,
197,
197,
16,
25,
314,
15,
1583,
197,
197,
17,
25,
314,
15,
11,
220,
16,
1583,
197,
197,
18,
25,
314,
17,
1583,
197,
197,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestIsManagedDisk(t *testing.T) {
tests := []struct {
options string
expected bool
}{
{
options: "testurl/subscriptions/12/resourceGroups/23/providers/Microsoft.Compute/disks/name",
expected: true,
},
{
options: "test.com",
expected: true,
},
{
options: "HTTP://test.com",
expected: false,
},
{
options: "http://test.com/vhds/name",
expected: false,
},
}
for _, test := range tests {
result := isManagedDisk(test.options)
if !reflect.DeepEqual(result, test.expected) {
t.Errorf("input: %q, isManagedDisk result: %t, expected: %t", test.options, result, test.expected)
}
}
} | explode_data.jsonl/62102 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 273
} | [
2830,
3393,
3872,
27192,
47583,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
35500,
220,
914,
198,
197,
42400,
1807,
198,
197,
59403,
197,
197,
515,
298,
35500,
25,
220,
330,
1944,
1085,
37885,
29966,
14,
16,
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 TestEncoderFromPath(t *testing.T) {
test := func(path string, expected cidenc.Encoder) {
actual, err := CidEncoderFromPath(path)
if err != nil {
t.Error(err)
}
if actual != expected {
t.Errorf("CidEncoderFromPath(%s) failed: expected %#v but got %#v", path, expected, actual)
}
}
p := "QmRqVG8VGdKZ7KARqR96MV7VNHgWvEQifk94br5HpURpfu"
enc := cidenc.Default()
test(p, enc)
test(p+"/a", enc)
test(p+"/a/b", enc)
test(p+"/a/b/", enc)
test(p+"/a/b/c", enc)
test("/btfs/"+p, enc)
test("/btfs/"+p+"/b", enc)
p = "zb2rhfkM4FjkMLaUnygwhuqkETzbYXnUDf1P9MSmdNjW1w1Lk"
enc = cidenc.Encoder{
Base: mbase.MustNewEncoder(mbase.Base58BTC),
Upgrade: true,
}
test(p, enc)
test(p+"/a", enc)
test(p+"/a/b", enc)
test(p+"/a/b/", enc)
test(p+"/a/b/c", enc)
test("/btfs/"+p, enc)
test("/btfs/"+p+"/b", enc)
test("/btld/"+p, enc)
test("/btns/"+p, enc) // even IPNS should work.
p = "bafyreifrcnyjokuw4i4ggkzg534tjlc25lqgt3ttznflmyv5fftdgu52hm"
enc = cidenc.Encoder{
Base: mbase.MustNewEncoder(mbase.Base32),
Upgrade: true,
}
test(p, enc)
test("/btfs/"+p, enc)
test("/btld/"+p, enc)
for _, badPath := range []string{
"/btld/",
"/btld",
"/btld//",
"btld//",
"btld",
"",
"btns",
"/btfs/asdf",
"/btfs/...",
"...",
"abcdefg",
"boo",
} {
_, err := CidEncoderFromPath(badPath)
if err == nil {
t.Errorf("expected error extracting encoder from bad path: %s", badPath)
}
}
} | explode_data.jsonl/60863 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 774
} | [
2830,
3393,
19921,
3830,
1820,
1155,
353,
8840,
836,
8,
341,
18185,
1669,
2915,
5581,
914,
11,
3601,
32141,
954,
26598,
4316,
8,
341,
197,
88814,
11,
1848,
1669,
356,
307,
19921,
3830,
1820,
5581,
340,
197,
743,
1848,
961,
2092,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestParseBeegfsUrl(t *testing.T) {
tests := map[string]struct {
rawUrl string
wantHost, wantPath string
wantErr bool
}{
"basic ip example": {
rawUrl: "beegfs://127.0.0.1/path/to/volume",
wantHost: "127.0.0.1",
wantPath: "/path/to/volume",
wantErr: false,
},
"basic FQDN example": {
rawUrl: "beegfs://some.domain.com/path/to/volume",
wantHost: "some.domain.com",
wantPath: "/path/to/volume",
wantErr: false,
},
"invalid URL example": {
rawUrl: "beegfs:// some.domain.com/ path/to/volume",
wantHost: "",
wantPath: "",
wantErr: true,
},
"invalid https example": {
rawUrl: "https://some.domain.com/path/to/volume",
wantHost: "",
wantPath: "",
wantErr: true,
},
"invalid empty string example": {
rawUrl: "",
wantHost: "",
wantPath: "",
wantErr: true,
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
gotHost, gotPath, err := parseBeegfsUrl(tc.rawUrl)
if tc.wantHost != gotHost {
t.Fatalf("expected host: %s, got host: %s", tc.wantHost, gotHost)
}
if tc.wantPath != gotPath {
t.Fatalf("expected path: %s, got path: %s", tc.wantPath, gotPath)
}
if tc.wantErr == true && err == nil {
t.Fatalf("expected an error to occur for invalid URL: %s", tc.rawUrl)
}
if tc.wantErr == false && err != nil {
t.Fatalf("expected no error to occur: %v", err)
}
})
}
} | explode_data.jsonl/77106 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 678
} | [
2830,
3393,
14463,
3430,
791,
3848,
2864,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
2415,
14032,
60,
1235,
341,
197,
76559,
2864,
1797,
914,
198,
197,
50780,
9296,
11,
1366,
1820,
914,
198,
197,
50780,
7747,
310,
1807,
198,
197,
5940... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRouterMethodGet(t *testing.T) {
request := &http.Request{
URL: &url.URL{
Path: "/sha246:41af286dc0b172ed2f1ca934fd2278de4a1192302ffa07087cea2682e7d372e3",
},
Method: "GET",
Body: nil,
}
ctrl := gomock.NewController(t)
defer ctrl.Finish()
cmp := setupRouterTestComponents(t, ctrl)
cmp.downloadHandler.EXPECT().ServeHTTP(cmp.types.responseWriter, cmp.types.request)
cmp.router.ServeHTTP(cmp.responseWriter, request)
} | explode_data.jsonl/3912 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 191
} | [
2830,
3393,
9523,
3523,
1949,
1155,
353,
8840,
836,
8,
341,
23555,
1669,
609,
1254,
9659,
515,
197,
79055,
25,
609,
1085,
20893,
515,
298,
69640,
25,
3521,
15247,
17,
19,
21,
25,
19,
16,
2577,
17,
23,
21,
7628,
15,
65,
16,
22,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestResolveTerraformModulesTwoModulesWithDependencies(t *testing.T) {
t.Parallel()
moduleA := &TerraformModule{
Path: canonical(t, "../test/fixture-modules/module-a"),
Dependencies: []*TerraformModule{},
Config: config.TerragruntConfig{
Terraform: &config.TerraformConfig{Source: ptr("test")},
IsPartial: true,
},
TerragruntOptions: mockOptions.Clone(canonical(t, "../test/fixture-modules/module-a/"+config.DefaultTerragruntConfigPath)),
}
moduleC := &TerraformModule{
Path: canonical(t, "../test/fixture-modules/module-c"),
Dependencies: []*TerraformModule{moduleA},
Config: config.TerragruntConfig{
Dependencies: &config.ModuleDependencies{Paths: []string{"../module-a"}},
Terraform: &config.TerraformConfig{Source: ptr("temp")},
IsPartial: true,
},
TerragruntOptions: mockOptions.Clone(canonical(t, "../test/fixture-modules/module-c/"+config.DefaultTerragruntConfigPath)),
}
configPaths := []string{"../test/fixture-modules/module-a/" + config.DefaultTerragruntConfigPath, "../test/fixture-modules/module-c/" + config.DefaultTerragruntConfigPath}
expected := []*TerraformModule{moduleA, moduleC}
actualModules, actualErr := ResolveTerraformModules(configPaths, mockOptions, mockHowThesePathsWereFound)
assert.Nil(t, actualErr, "Unexpected error: %v", actualErr)
assertModuleListsEqual(t, expected, actualModules)
} | explode_data.jsonl/26636 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 531
} | [
2830,
3393,
56808,
51,
13886,
627,
28201,
11613,
28201,
2354,
48303,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
54020,
32,
1669,
609,
51,
13886,
627,
3332,
515,
197,
69640,
25,
260,
42453,
1155,
11,
7005,
1944,
14,
59612,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPoolBorrowCreate(t *testing.T) {
assert := assert.New(t)
testCases := []struct {
contentType string
}{
{"application/json"},
{"application/msgpack"},
{""},
}
for _, tc := range testCases {
// borrow a decoder from the pool
pool := NewDecoderPool(1)
decoder := pool.Borrow(tc.contentType)
assert.NotNil(decoder)
}
} | explode_data.jsonl/35762 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 135
} | [
2830,
3393,
10551,
33,
7768,
4021,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
18185,
37302,
1669,
3056,
1235,
341,
197,
27751,
929,
914,
198,
197,
59403,
197,
197,
4913,
5132,
8931,
7115,
197,
197,
4913,
5132,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMemberNotFound_InChannel(t *testing.T) {
var expected *discordgo.Channel
mnf := &callbacks.MemberNotFound{}
actual := mnf.InChannel()
err := deepEqual(actual, expected)
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/56082 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 84
} | [
2830,
3393,
9366,
10372,
25972,
9629,
1155,
353,
8840,
836,
8,
341,
2405,
3601,
353,
42579,
3346,
38716,
271,
2109,
31737,
1669,
609,
68311,
46404,
10372,
16094,
88814,
1669,
27938,
69,
5337,
9629,
2822,
9859,
1669,
5538,
2993,
29721,
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
] | 2 |
func TestEscaping1(t *testing.T) {
lines := []string{
"weat\\,he\\ r,loc\\\"ation\\,\\ =us\\ mid\\\"west temperature=82,temperature_string=\"hot, really \\\"hot\\\"!\" 1465839830100400200", // all kinds of crazy characters
"\"weather\",\"location\"=\"us-midwest\" \"temperature\"=82 1465839830100400200", // needlessly quoting of measurement, tag-keys, tag-values and field keys
}
currentTime := time.Now()
actual, _ := Parse(strings.Join(lines, "\n"), currentTime)
expected := []general.Point{
{Measurement: "weat,he r", Fields: map[string]interface{}{"temperature": 82.0, "temperature_string": `hot, really "hot"!`}, Tags: map[string]string{`loc"ation, `: `us mid"west`}, Timestamp: time.Unix(0, int64(1465839830100400200))},
{Measurement: `"weather"`, Fields: map[string]interface{}{`"temperature"`: 82.0}, Tags: map[string]string{`"location"`: `"us-midwest"`}, Timestamp: time.Unix(0, int64(1465839830100400200))},
}
assert.Equal(t, expected, actual, "The two objects should be the same.")
} | explode_data.jsonl/15581 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 415
} | [
2830,
3393,
36121,
14216,
16,
1155,
353,
8840,
836,
8,
341,
78390,
1669,
3056,
917,
515,
197,
197,
1,
896,
266,
3422,
11,
383,
3422,
435,
11,
1074,
3422,
2105,
367,
3422,
11,
3422,
284,
355,
3422,
5099,
3422,
2105,
11039,
9315,
28,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestStoreSendWithClockOffset(t *testing.T) {
defer leaktest.AfterTest(t)
store, mc, stopper := createTestStore(t)
defer stopper.Stop()
args := getArgs([]byte("a"))
// Set clock to time 1.
mc.Set(1)
// Set clock max offset to 250ms.
maxOffset := 250 * time.Millisecond
store.ctx.Clock.SetMaxOffset(maxOffset)
// Set args timestamp to exceed max offset.
ts := store.ctx.Clock.Now().Add(maxOffset.Nanoseconds()+1, 0)
if _, err := client.SendWrappedWith(store.testSender(), nil, roachpb.Header{Timestamp: ts}, &args); err == nil {
t.Error("expected max offset clock error")
}
} | explode_data.jsonl/44471 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 215
} | [
2830,
3393,
6093,
11505,
2354,
26104,
6446,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
340,
57279,
11,
19223,
11,
2936,
712,
1669,
1855,
2271,
6093,
1155,
340,
16867,
2936,
712,
30213,
741,
31215,
1669,
633,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestObjectTypeToString(t *testing.T) {
for typ, str := range map[ObjectType]string{
BlobObjectType: "blob",
TreeObjectType: "tree",
CommitObjectType: "commit",
TagObjectType: "tag",
UnknownObjectType: "unknown",
ObjectType(math.MaxUint8): "<unknown>",
} {
t.Run(str, func(t *testing.T) {
assert.Equal(t, str, typ.String())
})
}
} | explode_data.jsonl/72187 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 198
} | [
2830,
3393,
49530,
5870,
1155,
353,
8840,
836,
8,
341,
2023,
3582,
11,
607,
1669,
2088,
2415,
58,
49530,
30953,
515,
197,
12791,
1684,
49530,
25,
310,
330,
35112,
756,
197,
197,
6533,
49530,
25,
310,
330,
9344,
756,
197,
197,
33441,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAdd(t *testing.T) {
lru := New(int64(0), nil)
lru.Add("key", String("1"))
lru.Add("key", String("111"))
if lru.nbytes != int64(len("key") + len("111")) {
t.Fatalf("expected 6 but got", lru.nbytes)
}
} | explode_data.jsonl/22957 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 97
} | [
2830,
3393,
2212,
1155,
353,
8840,
836,
8,
341,
8810,
2672,
1669,
1532,
1548,
21,
19,
7,
15,
701,
2092,
340,
8810,
2672,
1904,
445,
792,
497,
923,
445,
16,
5455,
8810,
2672,
1904,
445,
792,
497,
923,
445,
16,
16,
16,
28075,
743,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestPVCVolumeMode(t *testing.T) {
// Enable feature BlockVolume for PVC
defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, true)()
block := core.PersistentVolumeBlock
file := core.PersistentVolumeFilesystem
fake := core.PersistentVolumeMode("fake")
empty := core.PersistentVolumeMode("")
// Success Cases
successCasesPVC := map[string]*core.PersistentVolumeClaim{
"valid block value": createTestVolModePVC(&block),
"valid filesystem value": createTestVolModePVC(&file),
"valid nil value": createTestVolModePVC(nil),
}
for k, v := range successCasesPVC {
if errs := ValidatePersistentVolumeClaim(v); len(errs) != 0 {
t.Errorf("expected success for %s", k)
}
}
// Error Cases
errorCasesPVC := map[string]*core.PersistentVolumeClaim{
"invalid value": createTestVolModePVC(&fake),
"empty value": createTestVolModePVC(&empty),
}
for k, v := range errorCasesPVC {
if errs := ValidatePersistentVolumeClaim(v); len(errs) == 0 {
t.Errorf("expected failure for %s", k)
}
}
} | explode_data.jsonl/1007 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 380
} | [
2830,
3393,
47,
11287,
18902,
3636,
1155,
353,
8840,
836,
8,
341,
197,
322,
18567,
4565,
8362,
18902,
369,
49866,
198,
16867,
4094,
12753,
8840,
4202,
13859,
42318,
16014,
2271,
1155,
11,
4094,
12753,
13275,
13859,
42318,
11,
4419,
28477,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPublishStateNew(t *testing.T) {
defer func(saved time.Duration) { *publishRetryInterval = saved }(*publishRetryInterval)
*publishRetryInterval = 1 * time.Millisecond
// This flow doesn't test the failure scenario, which
// we can't do using memorytopo, but we do test the retry
// code path.
ctx := context.Background()
ts := memorytopo.NewServer("cell1")
tm := newTestTM(t, ts, 42, "ks", "0")
ttablet, err := tm.TopoServer.GetTablet(ctx, tm.tabletAlias)
require.NoError(t, err)
assert.Equal(t, tm.Tablet(), ttablet.Tablet)
tab1 := tm.Tablet()
tab1.Keyspace = "tab1"
tm.tmState.mu.Lock()
tm.tmState.tablet = tab1
tm.tmState.publishStateLocked(ctx)
tm.tmState.mu.Unlock()
ttablet, err = tm.TopoServer.GetTablet(ctx, tm.tabletAlias)
require.NoError(t, err)
assert.Equal(t, tab1, ttablet.Tablet)
tab2 := tm.Tablet()
tab2.Keyspace = "tab2"
tm.tmState.mu.Lock()
tm.tmState.tablet = tab2
tm.tmState.mu.Unlock()
tm.tmState.retryPublish()
ttablet, err = tm.TopoServer.GetTablet(ctx, tm.tabletAlias)
require.NoError(t, err)
assert.Equal(t, tab2, ttablet.Tablet)
// If hostname doesn't match, it should not update.
tab3 := tm.Tablet()
tab3.Hostname = "tab3"
tm.tmState.mu.Lock()
tm.tmState.tablet = tab3
tm.tmState.publishStateLocked(ctx)
tm.tmState.mu.Unlock()
ttablet, err = tm.TopoServer.GetTablet(ctx, tm.tabletAlias)
require.NoError(t, err)
assert.Equal(t, tab2, ttablet.Tablet)
// Same for retryPublish.
tm.tmState.retryPublish()
ttablet, err = tm.TopoServer.GetTablet(ctx, tm.tabletAlias)
require.NoError(t, err)
assert.Equal(t, tab2, ttablet.Tablet)
} | explode_data.jsonl/75592 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 690
} | [
2830,
3393,
50145,
1397,
3564,
1155,
353,
8840,
836,
8,
341,
16867,
2915,
14217,
882,
33795,
8,
314,
353,
27502,
51560,
10256,
284,
6781,
335,
4071,
27502,
51560,
10256,
340,
197,
9,
27502,
51560,
10256,
284,
220,
16,
353,
882,
71482,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mergeReportID(t *testing.T) {
type args struct {
r1 string
r2 string
}
tests := []struct {
name string
args args
want string
}{
{"1|2", args{"1", "2"}, base64.StdEncoding.EncodeToString([]byte("1|2"))},
{"1|2|3", args{base64.StdEncoding.EncodeToString([]byte("1|2")), "3"}, base64.StdEncoding.EncodeToString([]byte("1|2|3"))},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := mergeReportID(tt.args.r1, tt.args.r2); got != tt.want {
t.Errorf("mergeReportID() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/52085 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 267
} | [
2830,
3393,
20888,
10361,
915,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
7000,
16,
914,
198,
197,
7000,
17,
914,
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 Test_OCRContractTracker_IsLaterThan(t *testing.T) {
t.Parallel()
tests := []struct {
name string
incoming types.Log
existing types.Log
expected bool
}{
{
"incoming higher index than existing",
types.Log{BlockNumber: 1, TxIndex: 1, Index: 2},
types.Log{BlockNumber: 1, TxIndex: 1, Index: 1},
true,
},
{
"incoming lower index than existing",
types.Log{BlockNumber: 1, TxIndex: 1, Index: 1},
types.Log{BlockNumber: 1, TxIndex: 1, Index: 2},
false,
},
{
"incoming identical to existing",
types.Log{BlockNumber: 1, TxIndex: 2, Index: 2},
types.Log{BlockNumber: 1, TxIndex: 2, Index: 2},
false,
},
{
"incoming higher tx index than existing",
types.Log{BlockNumber: 1, TxIndex: 2, Index: 2},
types.Log{BlockNumber: 1, TxIndex: 1, Index: 2},
true,
},
{
"incoming lower tx index than existing",
types.Log{BlockNumber: 1, TxIndex: 1, Index: 2},
types.Log{BlockNumber: 1, TxIndex: 2, Index: 2},
false,
},
{
"incoming higher block number than existing",
types.Log{BlockNumber: 3, TxIndex: 2, Index: 2},
types.Log{BlockNumber: 2, TxIndex: 2, Index: 2},
true,
},
{
"incoming lower block number than existing",
types.Log{BlockNumber: 2, TxIndex: 2, Index: 2},
types.Log{BlockNumber: 3, TxIndex: 2, Index: 2},
false,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
res := offchainreporting.IsLaterThan(test.incoming, test.existing)
assert.Equal(t, test.expected, res)
})
}
} | explode_data.jsonl/31063 | {
"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,
2232,
8973,
14067,
31133,
31879,
29982,
26067,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
78216,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
17430,
4959,
4494,
5247,
198,
197,
8122,
11083,
4494,
5247,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRESTCmd(t *testing.T) {
mockUpdaterFromFlags := rotor.NewMockUpdaterFromFlags(nil)
cmd := RESTCmd(mockUpdaterFromFlags)
cmd.Flags.Parse([]string{})
runner := cmd.Runner.(*restRunner)
assert.Equal(t, runner.updaterFlags, mockUpdaterFromFlags)
assert.NonNil(t, runner.clustersNodes)
} | explode_data.jsonl/10927 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 119
} | [
2830,
3393,
38307,
15613,
1155,
353,
8840,
836,
8,
341,
77333,
79854,
3830,
9195,
1669,
62025,
7121,
11571,
79854,
3830,
9195,
27907,
692,
25920,
1669,
25414,
15613,
30389,
79854,
3830,
9195,
340,
25920,
51887,
8937,
10556,
917,
37790,
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 TestAssociationByTypeAndName(t *testing.T) {
association1 := Association{
Type: "elastic-inference",
Name: "dev1",
}
association2 := Association{
Type: "other-type",
Name: "dev2",
}
task := &Task{
Associations: []Association{association1, association2},
}
// positive cases
association, ok := task.AssociationByTypeAndName("elastic-inference", "dev1")
assert.Equal(t, *association, association1)
association, ok = task.AssociationByTypeAndName("other-type", "dev2")
assert.Equal(t, *association, association2)
// negative cases
association, ok = task.AssociationByTypeAndName("elastic-inference", "dev2")
assert.False(t, ok)
association, ok = task.AssociationByTypeAndName("other-type", "dev1")
assert.False(t, ok)
} | explode_data.jsonl/37259 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 270
} | [
2830,
3393,
63461,
1359,
929,
3036,
675,
1155,
353,
8840,
836,
8,
341,
197,
54465,
16,
1669,
10024,
515,
197,
27725,
25,
330,
61964,
3419,
2202,
756,
197,
21297,
25,
330,
3583,
16,
756,
197,
532,
197,
54465,
17,
1669,
10024,
515,
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 TestKafkaClient_decodeGroupMetadata(t *testing.T) {
module := fixtureModule()
module.Configure("test", "consumer.test")
keyBuf := bytes.NewBuffer([]byte("\x00\x09testgroup"))
valueBytes := []byte("\x00\x01\x00\x08testtype\x00\x00\x00\x01\x00\x0ctestprotocol\x00\x0atestleader\x00\x00\x00\x01\x00\x0ctestmemberid\x00\x0ctestclientid\x00\x0etestclienthost\x00\x00\x00\x04\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x06topic1\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00")
go module.decodeGroupMetadata(keyBuf, valueBytes, zap.NewNop())
request := <-module.App.StorageChannel
assert.Equalf(t, protocol.StorageSetConsumerOwner, request.RequestType, "Expected request sent with type StorageSetConsumerOwner, not %v", request.RequestType)
assert.Equalf(t, "test", request.Cluster, "Expected request sent with cluster test, not %v", request.Cluster)
assert.Equalf(t, "topic1", request.Topic, "Expected request sent with topic testtopic, not %v", request.Topic)
assert.Equalf(t, int32(11), request.Partition, "Expected request sent with partition 0, not %v", request.Partition)
assert.Equalf(t, "testgroup", request.Group, "Expected request sent with Group testgroup, not %v", request.Group)
assert.Equalf(t, "testclienthost", request.Owner, "Expected request sent with Owner testclienthost, not %v", request.Owner)
assert.Equalf(t, "testclientid", request.ClientID, "Expected request set with ClientID testclientid, not %v", request.ClientID)
} | explode_data.jsonl/34275 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 571
} | [
2830,
3393,
42,
21883,
2959,
15227,
2808,
14610,
1155,
353,
8840,
836,
8,
341,
54020,
1669,
12507,
3332,
741,
54020,
78281,
445,
1944,
497,
330,
46764,
5958,
5130,
23634,
15064,
1669,
5820,
7121,
4095,
10556,
3782,
4921,
87,
15,
15,
346... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAppendWithoutDuplicates(t *testing.T) {
falseVar := false
tests := []struct {
name string
configs []*ModuleConfig
modules []string
expected []*ModuleConfig
}{
{
name: "just modules",
configs: []*ModuleConfig{},
modules: []string{"moduleA", "moduleB", "moduleC"},
expected: []*ModuleConfig{
{Module: "moduleA"},
{Module: "moduleB"},
{Module: "moduleC"},
},
},
{
name: "eliminate a duplicate, no override",
configs: []*ModuleConfig{
{
Module: "moduleB",
Filesets: map[string]*FilesetConfig{
"fileset": {
Var: map[string]interface{}{
"paths": "test",
},
},
},
},
},
modules: []string{"moduleA", "moduleB", "moduleC"},
expected: []*ModuleConfig{
{
Module: "moduleB",
Filesets: map[string]*FilesetConfig{
"fileset": {
Var: map[string]interface{}{
"paths": "test",
},
},
},
},
{Module: "moduleA"},
{Module: "moduleC"},
},
},
{
name: "disabled config",
configs: []*ModuleConfig{
{
Module: "moduleB",
Enabled: &falseVar,
Filesets: map[string]*FilesetConfig{
"fileset": {
Var: map[string]interface{}{
"paths": "test",
},
},
},
},
},
modules: []string{"moduleA", "moduleB", "moduleC"},
expected: []*ModuleConfig{
{
Module: "moduleB",
Enabled: &falseVar,
Filesets: map[string]*FilesetConfig{
"fileset": {
Var: map[string]interface{}{
"paths": "test",
},
},
},
},
{Module: "moduleA"},
{Module: "moduleB"},
{Module: "moduleC"},
},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
result, err := appendWithoutDuplicates(test.configs, test.modules)
require.NoError(t, err)
assert.Equal(t, test.expected, result)
})
}
} | explode_data.jsonl/64757 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 945
} | [
2830,
3393,
23877,
26040,
76851,
1155,
353,
8840,
836,
8,
341,
36012,
3962,
1669,
895,
198,
78216,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
25873,
82,
220,
29838,
3332,
2648,
198,
197,
42228,
2425,
220,
3056,
917,
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... | 1 |
func TestSessionCtxCancelClosesGetBlocksChannel(t *testing.T) {
fpm := newFakePeerManager()
fspm := newFakeSessionPeerManager()
fpf := newFakeProviderFinder()
sim := bssim.New()
bpm := bsbpm.New()
notif := notifications.New()
defer notif.Shutdown()
id := testutil.GenerateSessionID()
// Create a new session with its own context
sessctx, sesscancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
session := New(context.Background(), sessctx, id, fspm, fpf, sim, fpm, bpm, notif, time.Second, delay.Fixed(time.Minute), "")
timerCtx, timerCancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
defer timerCancel()
// Request a block with a new context
blockGenerator := blocksutil.NewBlockGenerator()
blks := blockGenerator.Blocks(1)
getctx, getcancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer getcancel()
getBlocksCh, err := session.GetBlocks(getctx, []cid.Cid{blks[0].Cid()})
if err != nil {
t.Fatal("error getting blocks")
}
// Cancel the session context
sesscancel()
// Expect the GetBlocks() channel to be closed
select {
case _, ok := <-getBlocksCh:
if ok {
t.Fatal("expected channel to be closed but was not closed")
}
case <-timerCtx.Done():
t.Fatal("expected channel to be closed before timeout")
}
} | explode_data.jsonl/37013 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 458
} | [
2830,
3393,
5283,
23684,
9269,
34,
49341,
1949,
29804,
9629,
1155,
353,
8840,
836,
8,
341,
1166,
5187,
1669,
501,
52317,
30888,
2043,
741,
1166,
68622,
1669,
501,
52317,
5283,
30888,
2043,
741,
1166,
15897,
1669,
501,
52317,
5179,
42300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadHeaders(t *testing.T) {
input := strings.NewReader("A,B,C\n1,2,3")
r := NewReader(input)
headers, err := r.Headers()
exp := []string{"A", "B", "C"}
if !reflect.DeepEqual(headers, exp) {
t.Errorf("out=%q, want=%q", headers, exp)
}
if err != nil {
t.Errorf("unexpected error: %q", err)
}
} | explode_data.jsonl/21911 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 139
} | [
2830,
3393,
4418,
10574,
1155,
353,
8840,
836,
8,
1476,
22427,
1669,
9069,
68587,
445,
32,
8161,
11289,
1699,
16,
11,
17,
11,
18,
1138,
7000,
1669,
1532,
5062,
5384,
692,
67378,
11,
1848,
1669,
435,
43968,
741,
48558,
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... | 3 |
func TestExpectedMethodCall(t *testing.T) {
reporter, ctrl := createFixtures(t)
subject := new(Subject)
ctrl.RecordCall(subject, "FooMethod", "argument")
ctrl.Call(subject, "FooMethod", "argument")
ctrl.Finish()
reporter.assertPass("Expected method call made.")
} | explode_data.jsonl/17269 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 91
} | [
2830,
3393,
18896,
3523,
7220,
1155,
353,
8840,
836,
8,
341,
69931,
261,
11,
23743,
1669,
1855,
25958,
18513,
1155,
340,
28624,
583,
1669,
501,
7,
13019,
692,
84381,
49959,
7220,
29128,
11,
330,
40923,
3523,
497,
330,
14479,
1138,
84381... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIsCacheExcludeDirective(t *testing.T) {
testCases := []struct {
cacheControlOpt string
expectedResult bool
}{
{"no-cache", true},
{"no-store", true},
{"must-revalidate", true},
{"no-transform", false},
{"max-age", false},
}
for i, testCase := range testCases {
if isCacheExcludeDirective(testCase.cacheControlOpt) != testCase.expectedResult {
t.Errorf("Cache exclude directive test failed for case %d", i)
}
}
} | explode_data.jsonl/74497 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
3872,
8233,
95239,
62076,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
52680,
3273,
21367,
914,
198,
197,
42400,
2077,
220,
1807,
198,
197,
59403,
197,
197,
4913,
2152,
36680,
497,
830,
1583,
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 TestKeysToSlice(t *testing.T) {
m := map[string]bool{
"1": true,
"2": true,
"3": true,
}
expected := []string{"1", "2", "3"}
result := KeysToSlice(m)
if !reflect.DeepEqual(expected, result) {
t.Errorf("places.keysToSlice(%v) = %v; expected %v", m, result, expected)
}
} | explode_data.jsonl/80322 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 129
} | [
2830,
3393,
8850,
1249,
33236,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
2415,
14032,
96436,
515,
197,
197,
1,
16,
788,
830,
345,
197,
197,
1,
17,
788,
830,
345,
197,
197,
1,
18,
788,
830,
345,
197,
532,
42400,
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... | 2 |
func TestPrincipal_ValidateForTCP(t *testing.T) {
testCases := []struct {
name string
principal *Principal
want bool
}{
{
name: "empty principal",
want: true,
},
{
name: "principal with group",
principal: &Principal{
Group: "group",
},
},
{
name: "principal with requestPrincipal",
principal: &Principal{
RequestPrincipals: []string{"request-principal"},
},
},
{
name: "principal with notRequestPrincipal",
principal: &Principal{
NotRequestPrincipals: []string{"not-request-principal"},
},
},
{
name: "principal with unsupported property",
principal: &Principal{
Properties: []KeyValues{
{
attrRequestPresenter: Values{
Values: []string{"ns"},
},
},
},
},
},
{
name: "good principal",
principal: &Principal{
Users: []string{"user"},
Properties: []KeyValues{
{
attrSrcNamespace: Values{
Values: []string{"ns"},
},
},
{
attrSrcPrincipal: Values{
Values: []string{"p"},
},
},
},
},
want: true,
},
}
for _, tc := range testCases {
err := tc.principal.ValidateForTCP(true)
got := err == nil
if tc.want != got {
t.Errorf("%s: want %v bot got: %s", tc.name, tc.want, err)
}
}
} | explode_data.jsonl/19938 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 632
} | [
2830,
3393,
31771,
62,
17926,
2461,
49896,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
414,
914,
198,
197,
25653,
15702,
353,
31771,
198,
197,
50780,
414,
1807,
198,
197,
59403,
197,
197,
515,
298,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestProposalProcessorSendProposal(t *testing.T) {
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
proc := mockfab.NewMockProposalProcessor(mockCtrl)
tp := mockProcessProposalRequest()
tpr := fab.TransactionProposalResponse{Endorser: "example.com", Status: 99, ProposalResponse: nil}
proc.EXPECT().ProcessTransactionProposal(gomock.Any(), tp).Return(&tpr, nil)
p := Peer{processor: proc}
ctx, cancel := reqContext.WithTimeout(reqContext.Background(), normalTimeout)
defer cancel()
tpr1, err := p.ProcessTransactionProposal(ctx, tp)
if err != nil || !reflect.DeepEqual(&tpr, tpr1) {
t.Fatal("Peer didn't proxy proposal processing")
}
} | explode_data.jsonl/4795 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 227
} | [
2830,
3393,
98637,
22946,
11505,
98637,
1155,
353,
8840,
836,
8,
341,
77333,
15001,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
7860,
15001,
991,
18176,
741,
197,
15782,
1669,
7860,
36855,
7121,
11571,
98637,
22946,
30389,
15001,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVirtualGeneratedColumnAndLimit(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t;")
tk.MustExec("create table t (a int, b int as (a + 1));")
tk.MustExec("insert into t(a) values (1);")
tk.MustQuery("select /*+ LIMIT_TO_COP() */ b from t limit 1;").Check(testkit.Rows("2"))
tk.MustQuery("select /*+ LIMIT_TO_COP() */ b from t order by b limit 1;").Check(testkit.Rows("2"))
} | explode_data.jsonl/65516 | {
"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,
33026,
15741,
2933,
3036,
16527,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
340,
3244,
74,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestHandlePodCreationError(t *testing.T) {
taskRun := tb.TaskRun("test-taskrun-pod-creation-failed", tb.TaskRunSpec(
tb.TaskRunTaskRef(simpleTask.Name),
), tb.TaskRunStatus(
tb.TaskRunStartTime(time.Now()),
tb.StatusCondition(apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
}),
))
d := test.Data{
TaskRuns: []*v1alpha1.TaskRun{taskRun},
Tasks: []*v1alpha1.Task{simpleTask},
}
testAssets, cancel := getTaskRunController(t, d)
defer cancel()
c, ok := testAssets.Controller.Reconciler.(*Reconciler)
if !ok {
t.Errorf("failed to construct instance of taskrun reconciler")
return
}
// Prevent backoff timer from starting
c.timeoutHandler.SetTaskRunCallbackFunc(nil)
testcases := []struct {
description string
err error
expectedType apis.ConditionType
expectedStatus corev1.ConditionStatus
expectedReason string
}{{
description: "exceeded quota errors are surfaced in taskrun condition but do not fail taskrun",
err: k8sapierrors.NewForbidden(k8sruntimeschema.GroupResource{Group: "foo", Resource: "bar"}, "baz", errors.New("exceeded quota")),
expectedType: apis.ConditionSucceeded,
expectedStatus: corev1.ConditionUnknown,
expectedReason: podconvert.ReasonExceededResourceQuota,
}, {
description: "errors other than exceeded quota fail the taskrun",
err: errors.New("this is a fatal error"),
expectedType: apis.ConditionSucceeded,
expectedStatus: corev1.ConditionFalse,
expectedReason: podconvert.ReasonCouldntGetTask,
}}
for _, tc := range testcases {
t.Run(tc.description, func(t *testing.T) {
c.handlePodCreationError(taskRun, tc.err)
foundCondition := false
for _, cond := range taskRun.Status.Conditions {
if cond.Type == tc.expectedType && cond.Status == tc.expectedStatus && cond.Reason == tc.expectedReason {
foundCondition = true
break
}
}
if !foundCondition {
t.Errorf("expected to find condition type %q, status %q and reason %q", tc.expectedType, tc.expectedStatus, tc.expectedReason)
}
})
}
} | explode_data.jsonl/885 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 793
} | [
2830,
3393,
6999,
23527,
32701,
1454,
1155,
353,
8840,
836,
8,
341,
49115,
6727,
1669,
16363,
28258,
6727,
445,
1944,
52579,
6108,
2268,
347,
12,
37375,
2220,
5687,
497,
16363,
28258,
6727,
8327,
1006,
197,
62842,
28258,
6727,
6262,
3945,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestXOR_disconnected(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short Unit Test mode.")
}
// the numbers will be different every time we run.
rand.Seed(time.Now().Unix())
outDirPath, contextPath, genomePath := "../../out/XOR_disconnected_test", "../../data/xor.neat", "../../data/xordisconnectedstartgenes"
fmt.Println("Loading start genome for XOR disconnected experiment")
opts, startGenome, err := utils.LoadOptionsAndGenome(contextPath, genomePath)
neat.LogLevel = neat.LogLevelInfo
require.NoError(t, err)
// Check if output dir exists
err = utils.CreateOutputDir(outDirPath)
require.NoError(t, err, "Failed to create output directory")
// The 100 runs XOR experiment
opts.NumRuns = 40 //100 reduce to shorten test time
experiment := experiment2.Experiment{
Id: 0,
Trials: make(experiment2.Trials, opts.NumRuns),
}
err = experiment.Execute(opts.NeatContext(), startGenome, NewXORGenerationEvaluator(outDirPath), nil)
require.NoError(t, err, "Failed to perform XOR disconnected experiment")
// Find winner statistics
avgNodes, avgGenes, avgEvals, _ := experiment.AvgWinner()
// check results
if avgNodes < 5 {
t.Error("avg_nodes < 5", avgNodes)
} else if avgNodes > 15 {
t.Error("avg_nodes > 15", avgNodes)
}
if avgGenes < 7 {
t.Error("avg_genes < 7", avgGenes)
} else if avgGenes > 20 {
t.Error("avg_genes > 20", avgGenes)
}
maxEvals := float64(opts.PopSize * opts.NumGenerations)
assert.True(t, avgEvals < maxEvals)
t.Logf("avg_nodes: %.1f, avg_genes: %.1f, avg_evals: %.1f\n", avgNodes, avgGenes, avgEvals)
meanComplexity, meanDiversity, meanAge := 0.0, 0.0, 0.0
for _, t := range experiment.Trials {
meanComplexity += t.BestComplexity().Mean()
meanDiversity += t.Diversity().Mean()
meanAge += t.BestAge().Mean()
}
count := float64(len(experiment.Trials))
meanComplexity /= count
meanDiversity /= count
meanAge /= count
t.Logf("Mean best organisms: complexity=%.1f, diversity=%.1f, age=%.1f", meanComplexity, meanDiversity, meanAge)
} | explode_data.jsonl/81243 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 772
} | [
2830,
3393,
55,
868,
9932,
15288,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
445,
4886,
5654,
1273,
304,
2805,
7954,
3393,
3856,
13053,
197,
630,
197,
322,
279,
5109,
686,
387,
2155,
1449,
882,
582,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTypeOf(t *testing.T) {
// Special case for nil
if typ := TypeOf(nil); typ != nil {
t.Errorf("expected nil type for nil value; got %v", typ)
}
for _, test := range deepEqualTests {
v := ValueOf(test.a)
if !v.IsValid() {
continue
}
typ := TypeOf(test.a)
if typ != v.Type() {
t.Errorf("TypeOf(%v) = %v, but ValueOf(%v).Type() = %v", test.a, typ, test.a, v.Type())
}
}
} | explode_data.jsonl/29538 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 181
} | [
2830,
3393,
929,
2124,
1155,
353,
8840,
836,
8,
341,
197,
322,
9785,
1142,
369,
2092,
198,
743,
3582,
1669,
3990,
2124,
27907,
1215,
3582,
961,
2092,
341,
197,
3244,
13080,
445,
7325,
2092,
943,
369,
2092,
897,
26,
2684,
1018,
85,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestEchoReplacesInputWithSuppliedStringWhenUsedAsFilter(t *testing.T) {
t.Parallel()
want := "Hello, world."
p := script.Echo("bogus").Echo(want)
got, err := p.String()
if err != nil {
t.Error(err)
}
if got != want {
t.Errorf("want %q, got %q", want, got)
}
} | explode_data.jsonl/51466 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 118
} | [
2830,
3393,
74994,
693,
26078,
2505,
2354,
10048,
3440,
703,
4498,
22743,
2121,
5632,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
50780,
1669,
330,
9707,
11,
1879,
10040,
3223,
1669,
5316,
5142,
958,
445,
65,
538,
355,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTimeout(t *testing.T) {
distroStruct := test_distro.New()
arch, err := distroStruct.GetArch(test_distro.TestArchName)
if err != nil {
t.Fatalf("error getting arch from distro: %v", err)
}
server := newTestServer(t, t.TempDir(), time.Millisecond*10, "/api/image-builder-worker/v1")
_, _, _, _, _, err = server.RequestJob(context.Background(), arch.Name(), []string{"osbuild"}, []string{""})
require.Equal(t, jobqueue.ErrDequeueTimeout, err)
test.TestRoute(t, server.Handler(), false, "POST", "/api/image-builder-worker/v1/jobs", `{"arch":"arch","types":["types"]}`, http.StatusNoContent,
`{"href":"/api/image-builder-worker/v1/jobs","id":"00000000-0000-0000-0000-000000000000","kind":"RequestJob"}`)
} | explode_data.jsonl/1107 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 261
} | [
2830,
3393,
7636,
1155,
353,
8840,
836,
8,
341,
2698,
15561,
9422,
1669,
1273,
814,
15561,
7121,
741,
197,
1113,
11,
1848,
1669,
1582,
299,
9422,
2234,
18727,
8623,
814,
15561,
8787,
18727,
675,
340,
743,
1848,
961,
2092,
341,
197,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestQueryCodec(t *testing.T) {
var rsp interface{}
var ok bool
var err error
conn := goetty.NewConnector(&goetty.Conf{
Addr: *addr,
TimeoutConnectToServer: time.Second * time.Duration(*connectTimeout),
}, gredis.NewRedisReplyDecoder(), goetty.NewEmptyEncoder())
if _, err = conn.Connect(); err != nil {
return
}
gredis.InitRedisConn(conn)
buf := conn.OutBuf()
docs := []*querypb.Document{
&querypb.Document{
Order: []uint64{1, 2},
Key: []byte("order_1"),
},
&querypb.Document{
Order: []uint64{2, 5},
Key: []byte("order_3"),
},
}
redis.WriteDocArray(docs, buf)
rrd := gredis.NewRedisReplyDecoder()
ok, rsp, err = rrd.Decode(buf)
fmt.Printf("ok %+v, rsp %+v, err %+v\n", ok, rsp, err)
if err != nil {
t.Fatalf("error %+v", err)
}
s := rsp.([]interface{})
for _, item := range s {
fmt.Printf("%+v\n", item)
}
return
} | explode_data.jsonl/10857 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 392
} | [
2830,
3393,
2859,
36913,
1155,
353,
8840,
836,
8,
341,
2405,
42160,
3749,
16094,
2405,
5394,
1807,
198,
2405,
1848,
1465,
198,
32917,
1669,
728,
88798,
7121,
35954,
2099,
3346,
88798,
4801,
69,
515,
197,
197,
13986,
25,
353,
6214,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestFuturesMarginChangeHistory(t *testing.T) {
t.Parallel()
if !areTestAPIKeysSet() {
t.Skip("skipping test: api keys not set")
}
_, err := b.FuturesMarginChangeHistory(context.Background(), currency.NewPairWithDelimiter("BTCUSD", "PERP", "_"), "add", time.Time{}, time.Time{}, 10)
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/76632 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 129
} | [
2830,
3393,
37,
74606,
21681,
4072,
13424,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
743,
753,
546,
2271,
7082,
8850,
1649,
368,
341,
197,
3244,
57776,
445,
4886,
5654,
1273,
25,
6330,
6894,
537,
738,
1138,
197,
532,
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 TestMessageValid(t *testing.T) {
t.Parallel()
until := time.Now()
validmsgs := []Message{
{Code: Run},
{Code: Sleep, Until: &until},
{Code: Pause},
{Code: Kill},
{Code: Error, Err: errors.New("test")},
{Code: Complete},
{Code: Checkpoint},
{Code: Release},
}
for _, m := range validmsgs {
if !m.Valid() {
t.Errorf("Expected %s to be valid.", m)
}
}
invalidmsgs := []Message{
{},
{Code: Sleep},
{Code: Error},
}
for _, m := range invalidmsgs {
if m.Valid() {
t.Errorf("Expected %s to be invalid.", m)
}
}
} | explode_data.jsonl/23107 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 250
} | [
2830,
3393,
2052,
4088,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
20479,
1646,
1669,
882,
13244,
741,
56322,
77845,
1669,
3056,
2052,
515,
197,
197,
90,
2078,
25,
6452,
1583,
197,
197,
90,
2078,
25,
23774,
11,
28970,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestSetClusterColor_MissingCluster(t *testing.T) {
manager := GetManagerInstance()
manager.SetDBConnection(&database.MockDBConnection{
GetClusterReturnErr: true,
})
clearManager()
_, err := manager.SetClusterColor("test", uint32(1))
if err == nil {
t.Error("Expected error")
}
} | explode_data.jsonl/24683 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 110
} | [
2830,
3393,
1649,
28678,
1636,
1245,
13577,
28678,
1155,
353,
8840,
836,
8,
341,
92272,
1669,
2126,
2043,
2523,
741,
92272,
4202,
3506,
4526,
2099,
12216,
24664,
3506,
4526,
515,
197,
37654,
28678,
5598,
7747,
25,
830,
345,
197,
3518,
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 TestAccessorFuncName(t *testing.T) {
const SCRIPT = `
const namedSym = Symbol('test262');
const emptyStrSym = Symbol("");
const anonSym = Symbol();
const o = {
get id() {},
get [anonSym]() {},
get [namedSym]() {},
get [emptyStrSym]() {},
set id(v) {},
set [anonSym](v) {},
set [namedSym](v) {},
set [emptyStrSym](v) {}
};
let prop;
prop = Object.getOwnPropertyDescriptor(o, 'id');
assert.sameValue(prop.get.name, 'get id');
assert.sameValue(prop.set.name, 'set id');
prop = Object.getOwnPropertyDescriptor(o, anonSym);
assert.sameValue(prop.get.name, 'get ');
assert.sameValue(prop.set.name, 'set ');
prop = Object.getOwnPropertyDescriptor(o, emptyStrSym);
assert.sameValue(prop.get.name, 'get []');
assert.sameValue(prop.set.name, 'set []');
prop = Object.getOwnPropertyDescriptor(o, namedSym);
assert.sameValue(prop.get.name, 'get [test262]');
assert.sameValue(prop.set.name, 'set [test262]');
`
testScript1(TESTLIB+SCRIPT, _undefined, t)
} | explode_data.jsonl/10533 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 400
} | [
2830,
3393,
29889,
9626,
675,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
4777,
6941,
27912,
284,
19612,
492,
1944,
17,
21,
17,
1157,
4777,
4287,
2580,
27912,
284,
19612,
13056,
4777,
74812,
27912,
284,
19612,
1428,
4777,
297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMaterializerExplicitColumns(t *testing.T) {
ms := &vtctldatapb.MaterializeSettings{
Workflow: "workflow",
SourceKeyspace: "sourceks",
TargetKeyspace: "targetks",
TableSettings: []*vtctldatapb.TableMaterializeSettings{{
TargetTable: "t1",
SourceExpression: "select c1, c1+c2, c2 from t1",
CreateDdl: "t1ddl",
}},
}
env := newTestMaterializerEnv(t, ms, []string{"0"}, []string{"-80", "80-"})
defer env.close()
vs := &vschemapb.Keyspace{
Sharded: true,
Vindexes: map[string]*vschemapb.Vindex{
"region": {
Type: "region_experimental",
Params: map[string]string{
"region_bytes": "1",
},
},
},
Tables: map[string]*vschemapb.Table{
"t1": {
ColumnVindexes: []*vschemapb.ColumnVindex{{
Columns: []string{"c1", "c2"},
Name: "region",
}},
},
},
}
if err := env.topoServ.SaveVSchema(context.Background(), "targetks", vs); err != nil {
t.Fatal(err)
}
env.tmc.expectVRQuery(200, mzSelectFrozenQuery, &sqltypes.Result{})
env.tmc.expectVRQuery(210, mzSelectFrozenQuery, &sqltypes.Result{})
env.tmc.expectVRQuery(
200,
insertPrefix+
`.*shard:\\"0\\" filter:{rules:{match:\\"t1\\" filter:\\"select.*t1 where in_keyrange\(c1, c2.*targetks\.region.*-80.*`,
&sqltypes.Result{},
)
env.tmc.expectVRQuery(
210,
insertPrefix+
`.*shard:\\"0\\" filter:{rules:{match:\\"t1\\" filter:\\"select.*t1 where in_keyrange\(c1, c2.*targetks\.region.*80-.*`,
&sqltypes.Result{},
)
env.tmc.expectVRQuery(200, mzUpdateQuery, &sqltypes.Result{})
env.tmc.expectVRQuery(210, mzUpdateQuery, &sqltypes.Result{})
err := env.wr.Materialize(context.Background(), ms)
require.NoError(t, err)
env.tmc.verifyQueries(t)
} | explode_data.jsonl/61870 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 791
} | [
2830,
3393,
13415,
3135,
98923,
13965,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
609,
9708,
302,
507,
266,
391,
65,
44253,
551,
6086,
515,
197,
197,
62768,
25,
981,
330,
56249,
756,
197,
197,
3608,
8850,
1306,
25,
330,
2427,
2787,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIssue_loadTotalTimes(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
ms, err := GetIssueByID(2)
assert.NoError(t, err)
assert.NoError(t, ms.loadTotalTimes(db.GetEngine(db.DefaultContext)))
assert.Equal(t, int64(3682), ms.TotalTrackedTime)
} | explode_data.jsonl/46844 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 106
} | [
2830,
3393,
42006,
12411,
7595,
18889,
1155,
353,
8840,
836,
8,
341,
6948,
35699,
1155,
11,
19905,
28770,
3380,
2271,
5988,
2398,
47691,
11,
1848,
1669,
2126,
42006,
60572,
7,
17,
340,
6948,
35699,
1155,
11,
1848,
340,
6948,
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 |
func TestFilesystemGenerate(t *testing.T) {
g := &FilesystemGenerator{}
result, err := g.Generate()
if err != nil {
t.Skipf("Generate() failed: %s", err)
}
_, resultTypeOk := result.(map[string]map[string]interface{})
if !resultTypeOk {
t.Errorf("Return type of Generate() shuold be map[string]map[string]interface{}")
}
} | explode_data.jsonl/5903 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 128
} | [
2830,
3393,
1703,
8948,
31115,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
609,
1703,
8948,
12561,
31483,
9559,
11,
1848,
1669,
342,
57582,
741,
743,
1848,
961,
2092,
341,
197,
3244,
57776,
69,
445,
31115,
368,
4641,
25,
1018,
82,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAccProjectIamCustomRole_createAfterDestroy(t *testing.T) {
t.Parallel()
roleId := "tfIamCustomRole" + randString(t, 10)
vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckGoogleProjectIamCustomRoleDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccCheckGoogleProjectIamCustomRole_basic(roleId),
},
{
ResourceName: "google_project_iam_custom_role.foo",
ImportState: true,
ImportStateVerify: true,
},
// Destroy resources
{
Config: " ",
Destroy: true,
},
// Re-create with no existing state
{
Config: testAccCheckGoogleProjectIamCustomRole_basic(roleId),
},
{
ResourceName: "google_project_iam_custom_role.foo",
ImportState: true,
ImportStateVerify: true,
},
},
})
} | explode_data.jsonl/51556 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 377
} | [
2830,
3393,
14603,
7849,
40,
309,
10268,
9030,
8657,
6025,
14245,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
97491,
1669,
330,
8935,
40,
309,
10268,
9030,
1,
488,
10382,
703,
1155,
11,
220,
16,
15,
340,
5195,
5082,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidatorMultiCreates(t *testing.T) {
_, _, mk := CreateTestInput(t, false, SufficientInitPower)
params := DefaultParams()
params.MaxValidators = 1
params.Epoch = 1
startUpValidator := NewValidator(addrVals[0], PKs[0], Description{}, types.DefaultMinSelfDelegation)
startUpStatus := baseValidatorStatus{startUpValidator}
invalidVal := NewValidator(addrVals[1], PKs[1], Description{}, types.DefaultMinSelfDelegation)
invalidVaStatus := baseValidatorStatus{invalidVal}
bAction := baseAction{mk}
inputActions := []IAction{
createValidatorAction{bAction, startUpStatus},
createValidatorAction{bAction, invalidVaStatus},
delegatorsAddSharesAction{bAction, false, true, 0, []sdk.AccAddress{ValidDelegator1}},
endBlockAction{bAction},
}
actionsAndChecker := []actResChecker{
validatorStatusChecker(sdk.Unbonded.String()),
noErrorInHandlerResult(false),
validatorDelegatorShareIncreased(true),
validatorStatusChecker(sdk.Bonded.String()),
}
smTestCase := newValidatorSMTestCase(mk, params, startUpStatus, inputActions, actionsAndChecker, t)
smTestCase.SetupValidatorSetAndDelegatorSet(int(params.MaxValidators))
smTestCase.Run(t)
} | explode_data.jsonl/53778 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 403
} | [
2830,
3393,
14256,
20358,
54868,
1155,
353,
8840,
836,
8,
1476,
197,
6878,
8358,
23789,
1669,
4230,
2271,
2505,
1155,
11,
895,
11,
328,
26683,
3803,
14986,
692,
25856,
1669,
7899,
4870,
741,
25856,
14535,
31748,
284,
220,
16,
198,
25856... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPairs(t *testing.T) {
pairs := Pairs{
{Priority: 4},
{Priority: 3},
{Priority: 100},
{Priority: 0, ComponentID: 2},
{Priority: 0, ComponentID: 1},
{Priority: 4},
{Priority: 5},
{Priority: 9},
{Priority: 8},
}
sort.Sort(pairs)
expectedOrder := []struct {
priority int64
component int
}{
{100, 0},
{9, 0},
{8, 0},
{5, 0},
{4, 0},
{4, 0},
{3, 0},
{0, 1},
{0, 2},
}
for i, p := range pairs {
if p.Priority != expectedOrder[i].priority {
t.Errorf("p[%d]: %d (got) != %d (expected)", i, p.Priority, expectedOrder[i])
}
if p.ComponentID != expectedOrder[i].component {
t.Errorf("p[%d] component: %d (got) != %d (expected)", i, p.Priority, expectedOrder[i])
}
}
} | explode_data.jsonl/9181 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 352
} | [
2830,
3393,
54228,
1155,
353,
8840,
836,
8,
341,
3223,
4720,
1669,
393,
4720,
515,
197,
197,
90,
20555,
25,
220,
19,
1583,
197,
197,
90,
20555,
25,
220,
18,
1583,
197,
197,
90,
20555,
25,
220,
16,
15,
15,
1583,
197,
197,
90,
205... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestELEMENTFromMont(t *testing.T) {
parameters := gopter.DefaultTestParameters()
parameters.MinSuccessfulTests = 10000
properties := gopter.NewProperties(parameters)
genA := gen()
properties.Property("Assembly implementation must be consistent with generic one", prop.ForAll(
func(a testPairElement) bool {
c := a.element
d := a.element
c.FromMont()
_fromMontGeneric(&d)
return c.Equal(&d)
},
genA,
))
properties.TestingRun(t, gopter.ConsoleReporter(false))
} | explode_data.jsonl/70340 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 176
} | [
2830,
3393,
91754,
3830,
34415,
1155,
353,
8840,
836,
8,
1476,
67543,
1669,
728,
73137,
13275,
2271,
9706,
741,
67543,
17070,
36374,
18200,
284,
220,
16,
15,
15,
15,
15,
271,
86928,
1669,
728,
73137,
7121,
7903,
37959,
692,
82281,
32,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestServerTcpNoPort(t *testing.T) {
// possibly flaky but worth it
// try to connect to localhost:DefaultPort
// if connection succeeds, port is in use and skip test
// if it fails, make sure it is because connection refused
if conn, err := net.DialTimeout("tcp", net.JoinHostPort("localhost", DefaultPort), 2*time.Second); err == nil {
conn.Close()
t.Skipf("default port is in use")
} else {
if e, ok := err.(*net.OpError); !ok || e.Op != "dial" {
// failed for some other reason, not connection refused
t.Error(err)
}
}
ucfg, err := common.NewConfigFrom(map[string]interface{}{
"host": "localhost",
})
assert.NoError(t, err)
btr, teardown, err := setupServer(t, ucfg, nil)
require.NoError(t, err)
defer teardown()
baseUrl, client := btr.client(false)
rsp, err := client.Get(baseUrl + HealthCheckURL)
assert.NoError(t, err)
assert.Equal(t, http.StatusOK, rsp.StatusCode)
} | explode_data.jsonl/4939 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 332
} | [
2830,
3393,
5475,
77536,
2753,
7084,
1155,
353,
8840,
836,
8,
341,
197,
322,
10767,
1320,
28100,
714,
5802,
432,
198,
197,
322,
1430,
311,
4564,
311,
47422,
25,
3675,
7084,
198,
197,
322,
421,
3633,
50081,
11,
2635,
374,
304,
990,
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... | 4 |
func TestTimeStampMillisLogicalTypeUnionEncode(t *testing.T) {
schema := `{"type": ["null", {"type": "long", "logicalType": "timestamp-millis"}]}`
testBinaryEncodeFail(t, schema, "test", "cannot transform binary timestamp-millis, expected time.Time, received string")
testBinaryCodecPass(t, schema, nil, []byte("\x00"))
testBinaryCodecPass(t, schema, time.Date(2006, 1, 2, 15, 04, 05, 565000000, time.UTC), []byte("\x02\xfa\x82\xac\xba\x91\x42"))
} | explode_data.jsonl/12004 | {
"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,
66146,
17897,
64312,
929,
32658,
32535,
1155,
353,
8840,
836,
8,
341,
1903,
3416,
1669,
1565,
4913,
1313,
788,
4383,
2921,
497,
5212,
1313,
788,
330,
4825,
497,
330,
30256,
929,
788,
330,
13035,
1448,
56212,
9207,
13989,
398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCBCEncryptAndDecrypt(t *testing.T) {
var key = "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9"
var iv = "d58ce954203b7c9a9a9d467f59839249"
keyByteAry, _ := hex.DecodeString(key)
ivByteAry, _ := hex.DecodeString(iv)
plainText := "6368616e676520746869732070617373"
crypted, err := AESCBCEncrypt(keyByteAry, ivByteAry, []byte(plainText))
assert.NoError(t, err)
decryptedPlainText, err := AESCBCDecrypt(keyByteAry, ivByteAry, crypted)
assert.NoError(t, err)
assert.Equal(t, []byte(plainText), decryptedPlainText)
} | explode_data.jsonl/59365 | {
"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,
12979,
2104,
1016,
3571,
3036,
89660,
1155,
353,
8840,
836,
8,
341,
2405,
1376,
284,
330,
16,
5918,
23,
95840,
15,
68,
22,
24,
23,
20,
638,
15,
65,
21,
17,
15,
18,
64,
20,
20,
23,
20,
20,
64,
16,
15,
18,
19,
9429... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTemplateBOM(t *testing.T) {
b := newTestSitesBuilder(t).WithSimpleConfigFile()
bom := "\ufeff"
b.WithTemplatesAdded(
"_default/baseof.html", bom+`
Base: {{ block "main" . }}base main{{ end }}`,
"_default/single.html", bom+`{{ define "main" }}Hi!?{{ end }}`)
b.WithContent("page.md", `---
title: "Page"
---
Page Content
`)
b.CreateSites().Build(BuildCfg{})
b.AssertFileContent("public/page/index.html", "Base: Hi!?")
} | explode_data.jsonl/60651 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 176
} | [
2830,
3393,
7275,
33,
1898,
1155,
353,
8840,
836,
8,
341,
2233,
1669,
501,
2271,
93690,
3297,
1155,
568,
2354,
16374,
2648,
1703,
741,
2233,
316,
1669,
2917,
1704,
6445,
1837,
2233,
26124,
51195,
19337,
1006,
197,
197,
35089,
2258,
2609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExportImport(t *testing.T) {
// make the storage with reasonable defaults
cstore := NewInMemory()
info, _, err := cstore.CreateMnemonic("john", English, "secretcpw", Secp256k1)
require.NoError(t, err)
require.Equal(t, info.GetName(), "john")
john, err := cstore.Get("john")
require.NoError(t, err)
require.Equal(t, info.GetName(), "john")
johnAddr := info.GetPubKey().Address()
armor, err := cstore.Export("john")
require.NoError(t, err)
err = cstore.Import("john2", armor)
require.NoError(t, err)
john2, err := cstore.Get("john2")
require.NoError(t, err)
require.Equal(t, john.GetPubKey().Address(), johnAddr)
require.Equal(t, john.GetName(), "john")
require.Equal(t, john, john2)
} | explode_data.jsonl/10671 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 273
} | [
2830,
3393,
16894,
11511,
1155,
353,
8840,
836,
8,
341,
197,
322,
1281,
279,
5819,
448,
13276,
16674,
198,
1444,
4314,
1669,
1532,
641,
10642,
2822,
27043,
11,
8358,
1848,
1669,
272,
4314,
7251,
44,
70775,
445,
47817,
497,
6364,
11,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSeries_EndsWith(t *testing.T) {
// assert that function returns a correct bool Series
s := NewSeries("test", "we are", "leaving now", nil, "right now", "bar")
assert.Equal(t, NewSeries("HasSuffix(test)", false, true, false, true, false),
s.EndsWith("now"))
} | explode_data.jsonl/54088 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 95
} | [
2830,
3393,
25544,
49953,
16056,
1155,
353,
8840,
836,
8,
341,
197,
322,
2060,
429,
729,
4675,
264,
4396,
1807,
11131,
198,
1903,
1669,
1532,
25544,
445,
1944,
497,
330,
896,
525,
497,
330,
273,
2317,
1431,
497,
2092,
11,
330,
1291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJobSpecsController_Create_NonExistentTaskJob(t *testing.T) {
t.Parallel()
rpcClient, gethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t)
defer assertMocksCalled()
app, cleanup := cltest.NewApplication(t,
eth.NewClientWith(rpcClient, gethClient),
)
defer cleanup()
require.NoError(t, app.Start())
client := app.NewHTTPClient()
jsonStr := cltest.MustReadFile(t, "testdata/nonexistent_task_job.json")
resp, cleanup := client.Post("/v2/specs", bytes.NewBuffer(jsonStr))
defer cleanup()
assert.Equal(t, http.StatusBadRequest, resp.StatusCode, "Response should be caller error")
expected := `{"errors":[{"detail":"idonotexist is not a supported adapter type"}]}`
body := string(cltest.ParseResponseBody(t, resp))
assert.Equal(t, expected, strings.TrimSpace(body))
} | explode_data.jsonl/31809 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 283
} | [
2830,
3393,
12245,
8327,
82,
2051,
34325,
1604,
263,
840,
18128,
6262,
12245,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
7000,
3992,
2959,
11,
633,
71,
2959,
11,
8358,
2060,
72577,
20960,
1669,
1185,
1944,
7121,
65390,
11571,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCCServerEmpty(t *testing.T) {
RegisterTestingT(t)
myModel := model.NewModel()
crossConnectAddress := "127.0.0.1:0"
grpcServer, monitor, sock, err := startAPIServer(myModel, crossConnectAddress)
defer grpcServer.Stop()
crossConnectAddress = sock.Addr().String()
Expect(err).To(BeNil())
monitor.Update(&crossconnect.CrossConnect{
Id: "cc1",
Payload: "json_data",
})
events := readNMSDCrossConnectEvents(crossConnectAddress, 1)
Expect(len(events)).To(Equal(1))
Expect(events[0].CrossConnects["cc1"].Payload).To(Equal("json_data"))
} | explode_data.jsonl/49127 | {
"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,
3706,
5475,
3522,
1155,
353,
8840,
836,
8,
341,
79096,
16451,
51,
1155,
692,
13624,
1712,
1669,
1614,
7121,
1712,
2822,
1444,
2128,
14611,
4286,
1669,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
15,
1837,
197,
56585,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_getbaseURL(t *testing.T) {
type args struct {
dda *datadoghqv1alpha1.DatadogAgent
}
tests := []struct {
name string
args args
want string
}{
{
name: "Get default baseURL",
args: args{
dda: test.NewDefaultedDatadogAgent("foo", "bar", &test.NewDatadogAgentOptions{}),
},
want: "https://api.datadoghq.com",
},
{
name: "Compute baseURL from site when passing Site",
args: args{
dda: test.NewDefaultedDatadogAgent("foo", "bar", &test.NewDatadogAgentOptions{
Site: "datadoghq.eu",
}),
},
want: "https://api.datadoghq.eu",
},
{
name: "Compute baseURL from ddUrl when Site is not defined",
args: args{
dda: test.NewDefaultedDatadogAgent("foo", "bar", &test.NewDatadogAgentOptions{
NodeAgentConfig: &datadoghqv1alpha1.NodeAgentConfig{
DDUrl: datadoghqv1alpha1.NewStringPointer("https://test.url.com"),
}}),
},
want: "https://test.url.com",
},
{
name: "Test that DDUrl takes precedence over Site",
args: args{
dda: test.NewDefaultedDatadogAgent("foo", "bar", &test.NewDatadogAgentOptions{
Site: "datadoghq.eu",
NodeAgentConfig: &datadoghqv1alpha1.NodeAgentConfig{
DDUrl: datadoghqv1alpha1.NewStringPointer("https://test.url.com"),
}}),
},
want: "https://test.url.com",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := getbaseURL(tt.args.dda); got != tt.want {
t.Errorf("getbaseURL() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/8878 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 680
} | [
2830,
3393,
3062,
3152,
3144,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
197,
71487,
353,
5911,
329,
63936,
69578,
16,
7141,
16,
909,
266,
329,
538,
16810,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
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 TestTLSCert(t *testing.T) {
tmpDir := t.TempDir()
tmpCA := path.Join(tmpDir, "ca.pem")
err := os.WriteFile(tmpCA, fixtures.LocalhostCert, 0o644)
require.NoError(t, err)
tests := []struct {
name string
conf *FileConfig
}{
{
"read deprecated DB cert field",
&FileConfig{
Databases: Databases{
Service: Service{
EnabledFlag: "true",
},
Databases: []*Database{
{
Name: "test-db-1",
Protocol: "mysql",
URI: "localhost:1234",
CACertFile: tmpCA,
},
},
},
},
},
{
"read DB cert field",
&FileConfig{
Databases: Databases{
Service: Service{
EnabledFlag: "true",
},
Databases: []*Database{
{
Name: "test-db-1",
Protocol: "mysql",
URI: "localhost:1234",
TLS: DatabaseTLS{
CACertFile: tmpCA,
},
},
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cfg := service.MakeDefaultConfig()
err = ApplyFileConfig(tt.conf, cfg)
require.NoError(t, err)
require.Len(t, cfg.Databases.Databases, 1)
require.Equal(t, fixtures.LocalhostCert, cfg.Databases.Databases[0].TLS.CACert)
})
}
} | explode_data.jsonl/47183 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 643
} | [
2830,
3393,
13470,
3540,
529,
1155,
353,
8840,
836,
8,
341,
20082,
6184,
1669,
259,
65009,
6184,
741,
20082,
5049,
1669,
1815,
22363,
10368,
6184,
11,
330,
924,
49373,
5130,
9859,
1669,
2643,
4073,
1703,
10368,
5049,
11,
37664,
20856,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestEventDecoding(t *testing.T) {
cc := []struct {
name string
input string
event Event
err error
}{
{
name: "empty_event",
input: "",
err: io.EOF,
},
{
name: "incomplete_event",
input: "data:ok\n",
err: io.EOF,
},
{
name: "only a comment",
input: ":start\n\n",
err: io.EOF,
},
{
name: "one data line",
input: "data:ok\n\n",
event: Event{Name: "message", Data: "ok"},
},
{
name: "one data line with leading space",
input: "data: ok\n\n",
event: Event{Name: "message", Data: "ok"},
},
{
name: "one data line with two leading spaces",
input: "data: ok\n\n",
event: Event{Name: "message", Data: " ok"},
},
{
name: "comment at the beginning",
input: ":some comment\ndata:ok\n\n",
event: Event{Name: "message", Data: "ok"},
},
{
name: "comment at the end",
input: "data:ok\n:some comment\n\n",
event: Event{Name: "message", Data: "ok"},
},
{
name: "empty data",
input: "data:\n\n",
event: Event{Name: "message", Data: ""},
},
{
name: "empty data (without ':')",
input: "data\n\n",
event: Event{Name: "message", Data: ""},
},
{
name: "multiple data lines",
input: "data:1\ndata: 2\ndata:3\n\n",
event: Event{Name: "message", Data: "1\n2\n3"},
},
{
name: "typed event",
input: "event:test\ndata:ok\n\n",
event: Event{Name: "test", Data: "ok"},
},
{
name: "set id without data",
input: "id:1\n\ndata:ok\n\n",
event: Event{Name: "message", Data: "ok"},
},
}
for _, c := range cc {
t.Run(c.name, func(t *testing.T) {
client := NewClient(bytes.NewBufferString(c.input))
e, err := client.Event()
if err != c.err {
t.Errorf("got error '%v', expected '%v'", err, c.err)
}
if e != c.event {
t.Errorf("got %#v, expected %#v", e, c.event)
}
err = client.Close()
if err != nil {
t.Errorf("could not close the client: %v", err)
}
})
}
} | explode_data.jsonl/75594 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 961
} | [
2830,
3393,
1556,
4900,
3700,
1155,
353,
8840,
836,
8,
341,
63517,
1669,
3056,
1235,
341,
197,
11609,
220,
914,
198,
197,
22427,
914,
198,
197,
28302,
3665,
198,
197,
9859,
256,
1465,
198,
197,
59403,
197,
197,
515,
298,
11609,
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... | 4 |
func TestExportUint(t *testing.T) {
type UnsignedIntStruct struct {
UnsignedInt uint `json:"uint"`
}
schemaRef, _, err := NewSchemaRefForValue(&UnsignedIntStruct{}, UseAllExportedFields())
require.NoError(t, err)
require.Equal(t, &openapi3.SchemaRef{Value: &openapi3.Schema{
Type: "object",
Properties: map[string]*openapi3.SchemaRef{
"uint": {Value: &openapi3.Schema{Type: "integer", Min: &zeroInt}},
}}}, schemaRef)
} | explode_data.jsonl/55876 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 174
} | [
2830,
3393,
16894,
21570,
1155,
353,
8840,
836,
8,
341,
13158,
97747,
1072,
9422,
2036,
341,
197,
197,
56421,
1072,
2622,
1565,
2236,
2974,
2496,
8805,
197,
630,
1903,
3416,
3945,
11,
8358,
1848,
1669,
1532,
8632,
3945,
2461,
1130,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAccKeycloakOpenidClient_createAfterManualDestroy(t *testing.T) {
var client = &keycloak.OpenidClient{}
realmName := "terraform-" + acctest.RandString(10)
clientId := "terraform-" + acctest.RandString(10)
resource.Test(t, resource.TestCase{
ProviderFactories: testAccProviderFactories,
PreCheck: func() { testAccPreCheck(t) },
CheckDestroy: testAccCheckKeycloakOpenidClientDestroy(),
Steps: []resource.TestStep{
{
Config: testKeycloakOpenidClient_basic(realmName, clientId),
Check: resource.ComposeTestCheckFunc(
testAccCheckKeycloakOpenidClientExistsWithCorrectProtocol("keycloak_openid_client.client"),
testAccCheckKeycloakOpenidClientFetch("keycloak_openid_client.client", client),
),
},
{
PreConfig: func() {
keycloakClient := testAccProvider.Meta().(*keycloak.KeycloakClient)
err := keycloakClient.DeleteOpenidClient(client.RealmId, client.Id)
if err != nil {
t.Fatal(err)
}
},
Config: testKeycloakOpenidClient_basic(realmName, clientId),
Check: testAccCheckKeycloakOpenidClientExistsWithCorrectProtocol("keycloak_openid_client.client"),
},
},
})
} | explode_data.jsonl/52125 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 467
} | [
2830,
3393,
14603,
1592,
88751,
5002,
307,
2959,
8657,
6025,
52092,
14245,
1155,
353,
8840,
836,
8,
341,
2405,
2943,
284,
609,
792,
88751,
12953,
307,
2959,
31483,
17200,
7673,
675,
1669,
330,
61385,
27651,
488,
1613,
67880,
2013,
437,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.