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 TestLaunchRequestWithBuildFlags(t *testing.T) {
runTest(t, "buildflagtest", func(client *daptest.Client, fixture protest.Fixture) {
runDebugSession(t, client, "launch", func() {
// We reuse the harness that builds, but ignore the built binary,
// only relying on the source to be built in response to LaunchRequest.
client.LaunchRequestWithArgs(map[string]interface{}{
"mode": "debug", "program": fixture.Source, "output": "__mybin",
"buildFlags": "-ldflags '-X main.Hello=World'"})
}, fixture.Source)
})
} | explode_data.jsonl/17351 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 178
} | [
2830,
3393,
32067,
1900,
2354,
11066,
9195,
1155,
353,
8840,
836,
8,
341,
56742,
2271,
1155,
11,
330,
5834,
9903,
1944,
497,
2915,
12805,
353,
91294,
1944,
11716,
11,
12507,
8665,
991,
12735,
8,
341,
197,
56742,
7939,
5283,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetHint(t *testing.T) {
t.Parallel()
output := &bytes.Buffer{}
input := strings.NewReader("")
p := &blackjack.Player{
Hands: []*blackjack.Hand{
{
Id: 1,
Cards: []cards.Card{
{Rank: cards.Six, Suit: cards.Heart},
{Rank: cards.Nine, Suit: cards.Spade},
},
Bet: 1,
Action: blackjack.None,
},
},
}
dealerCard := cards.Card{Rank: cards.Ten, Suit: cards.Heart}
index := 0
counter := blackjack.CardCounter{}
stage := blackjack.StageDeciding
action := blackjack.GetHint(output, input, p, dealerCard, index, counter, stage)
want := blackjack.ActionHit.String()
got := action.String()
if want != got {
t.Fatalf("want: %q, got: %q", want, got)
}
} | explode_data.jsonl/5934 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 300
} | [
2830,
3393,
1949,
26987,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
21170,
1669,
609,
9651,
22622,
16094,
22427,
1669,
9069,
68587,
445,
5130,
3223,
1669,
609,
11453,
27134,
23756,
515,
197,
197,
95439,
25,
29838,
11453,
27134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestXZSetScan(t *testing.T) {
c := getTestConn()
defer c.Close()
key := "scan_zset"
c.Do("ZADD", key, 1, "a", 2, "b")
if ay, err := goredis.Values(c.Do("XZSCAN", key, "")); err != nil {
t.Fatal(err)
} else if len(ay) != 2 {
t.Fatal(len(ay))
} else {
checkScanValues(t, ay[1], "a", 1, "b", 2)
}
} | explode_data.jsonl/77090 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 159
} | [
2830,
3393,
55,
57,
1649,
26570,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
633,
2271,
9701,
741,
16867,
272,
10421,
2822,
23634,
1669,
330,
16405,
6415,
746,
698,
1444,
33596,
445,
57,
15665,
497,
1376,
11,
220,
16,
11,
330,
64,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateQuotaCommand(t *testing.T) {
t.Parallel()
for tn, tc := range map[string]struct {
namespace string
quotaName string
wantErr error
wantErrStrs []string
args []string
setup func(t *testing.T, fakeCreator *fake.FakeClient)
assert func(t *testing.T, buffer *bytes.Buffer)
}{
"invalid number of args": {
args: []string{},
wantErr: errors.New("accepts 1 arg(s), received 0"),
},
"minimal config": {
args: []string{"some-space"},
setup: func(t *testing.T, fakeCreator *fake.FakeClient) {
fakeCreator.
EXPECT().
Transform(gomock.Any(), gomock.Any()).
Return(nil)
},
assert: func(t *testing.T, buffer *bytes.Buffer) {
testutil.AssertContainsAll(t, buffer.String(), []string{"successfully created", "quota", "some-space"})
},
},
"some flags": {
args: []string{"some-space", "-m", "1024M", "-c", "30"},
setup: func(t *testing.T, fakeCreator *fake.FakeClient) {
fakeCreator.
EXPECT().
Transform(gomock.Any(), gomock.Any()).
Return(nil)
},
assert: func(t *testing.T, buffer *bytes.Buffer) {
testutil.AssertContainsAll(t, buffer.String(), []string{"successfully created", "quota", "some-space"})
},
},
} {
t.Run(tn, func(t *testing.T) {
ctrl := gomock.NewController(t)
fakeCreator := fake.NewFakeClient(ctrl)
if tc.setup != nil {
tc.setup(t, fakeCreator)
}
buffer := &bytes.Buffer{}
c := NewCreateQuotaCommand(&config.KfParams{
Namespace: tc.namespace,
}, fakeCreator)
c.SetOutput(buffer)
c.SetArgs(tc.args)
gotErr := c.Execute()
if tc.wantErr != nil {
testutil.AssertErrorsEqual(t, tc.wantErr, gotErr)
return
}
if tc.wantErrStrs != nil {
testutil.AssertErrorContainsAll(t, gotErr, tc.wantErrStrs)
return
}
if tc.assert != nil {
tc.assert(t, buffer)
}
testutil.AssertNil(t, "Command err", gotErr)
ctrl.Finish()
})
}
} | explode_data.jsonl/44781 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 880
} | [
2830,
3393,
4021,
2183,
6089,
4062,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2023,
43308,
11,
17130,
1669,
2088,
2415,
14032,
60,
1235,
341,
197,
56623,
256,
914,
198,
197,
197,
92604,
675,
256,
914,
198,
197,
50780,
7747... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuildCache(t *testing.T) {
resource1 := &fixture.Resource{ObjectMeta: corev2.ObjectMeta{Name: "resource1", Namespace: "default"}}
resource2 := &fixture.Resource{ObjectMeta: corev2.ObjectMeta{Name: "resource2", Namespace: "default"}}
resource3 := &fixture.Resource{ObjectMeta: corev2.ObjectMeta{Name: "resource3", Namespace: "acme"}}
cache := buildCache([]corev2.Resource{resource1, resource2, resource3}, false)
assert.Len(t, cache["acme"], 1)
assert.Len(t, cache["default"], 2)
assert.Len(t, cache, 2)
} | explode_data.jsonl/15114 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 183
} | [
2830,
3393,
11066,
8233,
1155,
353,
8840,
836,
8,
341,
50346,
16,
1669,
609,
59612,
20766,
90,
1190,
12175,
25,
6200,
85,
17,
80222,
63121,
25,
330,
9233,
16,
497,
41962,
25,
330,
2258,
95642,
50346,
17,
1669,
609,
59612,
20766,
90,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_RootViaSymlink(t *testing.T) {
resolver, err := newDirectoryResolver("./test-fixtures/symlinked-root/nested/link-root")
require.NoError(t, err)
locations, err := resolver.FilesByPath("./file1.txt")
require.NoError(t, err)
assert.Len(t, locations, 1)
locations, err = resolver.FilesByPath("./nested/file2.txt")
require.NoError(t, err)
assert.Len(t, locations, 1)
locations, err = resolver.FilesByPath("./nested/linked-file1.txt")
require.NoError(t, err)
assert.Len(t, locations, 1)
} | explode_data.jsonl/50127 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 202
} | [
2830,
3393,
2568,
1905,
54428,
34667,
44243,
1155,
353,
8840,
836,
8,
341,
10202,
7921,
11,
1848,
1669,
501,
9310,
18190,
13988,
1944,
70913,
18513,
2687,
88,
44243,
291,
39214,
9612,
9980,
55431,
39214,
1138,
17957,
35699,
1155,
11,
1848... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAsanaProjects(t *testing.T) {
defer resetAsanaLimit()
asanaPerPageLimit = 10
s := createAsanaService()
projects, err := s.Projects()
if err != nil {
t.Error("error calling projects(), err:", err)
}
if len(projects) <= 10 {
t.Error("should get more than 10 project, please create at least 11 project to test pagination")
}
} | explode_data.jsonl/78895 | {
"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,
2121,
3362,
29958,
1155,
353,
8840,
836,
8,
341,
16867,
7585,
2121,
3362,
16527,
741,
60451,
3362,
36831,
16527,
284,
220,
16,
15,
271,
1903,
1669,
1855,
2121,
3362,
1860,
2822,
197,
17161,
11,
1848,
1669,
274,
30944,
82,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTxOut_IsStandard_ScriptNullData_false(t *testing.T) {
scriptarr4 := script.NewScriptRaw([]byte{opcodes.OP_RETURN, 1, 1})
conf.Cfg.Script.AcceptDataCarrier = false
txout := NewTxOut(9, scriptarr4)
pubKeyType, isStandard := txout.IsStandard()
assert.Equal(t, script.ScriptNullData, pubKeyType)
assert.False(t, isStandard)
} | explode_data.jsonl/38878 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 125
} | [
2830,
3393,
31584,
2662,
31879,
19781,
1098,
1228,
3280,
1043,
36015,
1155,
353,
8840,
836,
8,
341,
86956,
1118,
19,
1669,
5316,
7121,
5910,
20015,
10556,
3782,
90,
453,
25814,
81563,
21909,
11,
220,
16,
11,
220,
16,
3518,
67850,
727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateCondition(t *testing.T) {
tests := []struct {
condition v1.Condition
msg string
}{
{
condition: v1.Condition{
Header: "x-version",
Value: "v1",
},
msg: "valid header",
},
{
condition: v1.Condition{
Cookie: "my_cookie",
Value: "",
},
msg: "valid cookie",
},
{
condition: v1.Condition{
Argument: "arg",
Value: "yes",
},
msg: "valid argument",
},
{
condition: v1.Condition{
Variable: "$request_method",
Value: "POST",
},
msg: "valid variable",
},
}
for _, test := range tests {
allErrs := validateCondition(test.condition, field.NewPath("condition"))
if len(allErrs) > 0 {
t.Errorf("validateCondition() returned errors %v for valid input for the case of %s", allErrs, test.msg)
}
}
} | explode_data.jsonl/65846 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 365
} | [
2830,
3393,
17926,
10547,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
197,
9056,
348,
16,
75134,
198,
197,
21169,
981,
914,
198,
197,
59403,
197,
197,
515,
298,
197,
9056,
25,
348,
16,
75134,
515,
571,
197,
4047... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCmdCreate_Exec(t *testing.T) {
// TODO remote this after merging
err := os.Setenv("FLOGO_BUILD_EXPERIMENTAL", "true")
if err != nil {
t.Fatal(err)
}
defer os.Unsetenv("FLOGO_BUILD_EXPERIMENTAL")
tempDir, err := ioutil.TempDir("", "test")
if err != nil {
t.Fatal(err)
}
tempDirInfo, err := filepath.EvalSymlinks(tempDir)
if err == nil {
// Sym link
tempDir = tempDirInfo
}
testEnv := &TestEnv{currentDir: tempDir}
defer testEnv.cleanup()
t.Logf("Current dir '%s'", testEnv.currentDir)
cmd := &cmdCreate{option: optCreate, currentDir: testEnv.getTestwd}
fs := flag.NewFlagSet("test", flag.ExitOnError)
appName := "testApp"
args := []string{appName}
err = cli.ExecCommand(fs, cmd, args)
if err != nil {
t.Fatal(err)
}
// Validate the structure
currentDir := testEnv.currentDir
_, err = os.Stat(currentDir)
assert.Nil(t, err, "There should be a folder for temp dir '%s'", currentDir)
// There should be a folder with app name
appFolderPath := path.Join(currentDir, appName)
fi, err := os.Stat(appFolderPath)
assert.Nil(t, err, "There should be a folder for app name '%s'", appFolderPath)
assert.True(t, fi.IsDir(), "There should be a folder for app name '%s'", appFolderPath)
// There should be a flogo.json file
flogojsonPath := path.Join(appFolderPath, config.FileDescriptor)
fi, err = os.Stat(flogojsonPath)
assert.Nil(t, err, "There should be a file for flogo json '%s'", flogojsonPath)
// Compare the flogo.json with GOLD file
jsonBytes, err := ioutil.ReadFile(flogojsonPath)
if err != nil {
t.Fatal(err)
}
assert.True(t, bytes.Equal(jsonBytes, []byte(GOLD_FLOGO_JSON)), "Unexpected flogo.json format")
// There should be a src folder
srcPath := path.Join(appFolderPath, "src")
fi, err = os.Stat(srcPath)
assert.Nil(t, err, "There should be a folder for src '%s'", srcPath)
// There should be an app folder
appSrcFolderPath := path.Join(srcPath, appName)
fi, err = os.Stat(appSrcFolderPath)
assert.Nil(t, err, "There should be a folder for app name '%s'", appSrcFolderPath)
assert.True(t, fi.IsDir(), "There should be a folder for app name '%s'", appSrcFolderPath)
// There should be a main file
mainPath := path.Join(appSrcFolderPath, fileMainGo)
fi, err = os.Stat(mainPath)
assert.Nil(t, err, "There should be a file for main.go '%s'", mainPath)
// There should be an imports file
importsPath := path.Join(appSrcFolderPath, config.FileImportsGo)
fi, err = os.Stat(importsPath)
assert.Nil(t, err, "There should be a file for imports.go '%s'", importsPath)
} | explode_data.jsonl/16618 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 970
} | [
2830,
3393,
15613,
4021,
62,
10216,
1155,
353,
8840,
836,
8,
341,
197,
322,
5343,
8699,
419,
1283,
53377,
198,
9859,
1669,
2643,
4202,
3160,
445,
37,
7243,
46,
37491,
4966,
9654,
65953,
969,
497,
330,
1866,
1138,
743,
1848,
961,
2092,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 Test_dummyEncrypter_CreateKey(t *testing.T) {
d := dummyEncrypter{
keyId: types.MustParseUUID(`22a342bf-3278-4126-9a02-f1ac0c9cf05f`),
}
if err := d.CreateKey(); err != nil {
t.Errorf("CreateKey() error = %v, wantErr %v", err, false)
}
} | explode_data.jsonl/47236 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 117
} | [
2830,
3393,
60321,
61520,
261,
34325,
1592,
1155,
353,
8840,
836,
8,
341,
2698,
1669,
17292,
61520,
261,
515,
197,
23634,
764,
25,
4494,
50463,
14463,
24754,
5809,
17,
17,
64,
18,
19,
17,
13233,
12,
18,
17,
22,
23,
12,
19,
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... | 2 |
func TestValidateTLS(t *testing.T) {
validTLSes := []*v1.TLS{
nil,
{
Secret: "",
},
{
Secret: "my-secret",
},
{
Secret: "my-secret",
Redirect: &v1.TLSRedirect{},
},
{
Secret: "my-secret",
Redirect: &v1.TLSRedirect{
Enable: true,
},
},
{
Secret: "my-secret",
Redirect: &v1.TLSRedirect{
Enable: true,
Code: createPointerFromInt(302),
BasedOn: "scheme",
},
},
{
Secret: "my-secret",
Redirect: &v1.TLSRedirect{
Enable: true,
Code: createPointerFromInt(307),
},
},
}
for _, tls := range validTLSes {
allErrs := validateTLS(tls, field.NewPath("tls"))
if len(allErrs) > 0 {
t.Errorf("validateTLS() returned errors %v for valid input %v", allErrs, tls)
}
}
invalidTLSes := []*v1.TLS{
{
Secret: "-",
},
{
Secret: "a/b",
},
{
Secret: "my-secret",
Redirect: &v1.TLSRedirect{
Enable: true,
Code: createPointerFromInt(305),
BasedOn: "scheme",
},
},
{
Secret: "my-secret",
Redirect: &v1.TLSRedirect{
Enable: true,
Code: createPointerFromInt(301),
BasedOn: "invalidScheme",
},
},
}
for _, tls := range invalidTLSes {
allErrs := validateTLS(tls, field.NewPath("tls"))
if len(allErrs) == 0 {
t.Errorf("validateTLS() returned no errors for invalid input %v", tls)
}
}
} | explode_data.jsonl/65822 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 692
} | [
2830,
3393,
17926,
45439,
1155,
353,
8840,
836,
8,
341,
56322,
45439,
288,
1669,
29838,
85,
16,
836,
7268,
515,
197,
84131,
345,
197,
197,
515,
298,
7568,
50856,
25,
8324,
197,
197,
1583,
197,
197,
515,
298,
7568,
50856,
25,
330,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestActionGoString(t *testing.T) {
tests := []struct {
a Action
s string
}{
{
a: Drop(),
s: `ovs.Drop()`,
},
{
a: Flood(),
s: `ovs.Flood()`,
},
{
a: Local(),
s: `ovs.Local()`,
},
{
a: Normal(),
s: `ovs.Normal()`,
},
{
a: StripVLAN(),
s: `ovs.StripVLAN()`,
},
{
a: ConnectionTracking("commit"),
s: `ovs.ConnectionTracking("commit")`,
},
{
a: ModDataLinkDestination(mustParseMAC("de:ad:be:ef:de:ad")),
s: `ovs.ModDataLinkDestination(net.HardwareAddr{0xde, 0xad, 0xbe, 0xef, 0xde, 0xad})`,
},
{
a: ModDataLinkSource(mustParseMAC("de:ad:be:ef:de:ad")),
s: `ovs.ModDataLinkSource(net.HardwareAddr{0xde, 0xad, 0xbe, 0xef, 0xde, 0xad})`,
},
{
a: ModNetworkDestination(net.IPv4(192, 168, 1, 1)),
s: `ovs.ModNetworkDestination(net.IPv4(192, 168, 1, 1))`,
},
{
a: ModNetworkSource(net.IPv4(192, 168, 1, 1)),
s: `ovs.ModNetworkSource(net.IPv4(192, 168, 1, 1))`,
},
{
a: ModVLANVID(10),
s: `ovs.ModVLANVID(10)`,
},
{
a: Output(1),
s: `ovs.Output(1)`,
},
{
a: Resubmit(0, 10),
s: `ovs.Resubmit(0, 10)`,
},
{
a: Load("0x2", "NXM_OF_ARP_OP[]"),
s: `ovs.Load("0x2", "NXM_OF_ARP_OP[]")`,
},
{
a: SetField("192.168.1.1", "arp_spa"),
s: `ovs.SetField("192.168.1.1", "arp_spa")`,
},
{
a: SetTunnel(10),
s: `ovs.SetTunnel(0xa)`,
},
{
a: Conjunction(123, 1, 2),
s: `ovs.Conjunction(123, 1, 2)`,
},
{
a: Move("nw_src", "nw_dst"),
s: `ovs.Move("nw_src", "nw_dst")`,
},
{
a: OutputField("in_port"),
s: `ovs.OutputField("in_port")`,
},
{
a: Learn(&LearnedFlow{
DeleteLearned: true,
FinHardTimeout: 10,
HardTimeout: 30,
Limit: 10,
Matches: []Match{DataLinkType(0x800)},
Actions: []Action{OutputField("in_port")},
}),
s: `ovs.Learn(&ovs.LearnedFlow{Priority:0, InPort:0, Matches:[]ovs.Match{ovs.DataLinkType(0x0800)}, Table:0, IdleTimeout:0, Cookie:0x0, Actions:[]ovs.Action{ovs.OutputField("in_port")}, DeleteLearned:true, FinHardTimeout:10, HardTimeout:30, Limit:10})`,
},
}
for _, tt := range tests {
t.Run(tt.s, func(t *testing.T) {
if want, got := tt.s, tt.a.GoString(); want != got {
t.Fatalf("unexpected Action Go syntax:\n- want: %v\n- got: %v", want, got)
}
})
}
} | explode_data.jsonl/49522 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1265
} | [
2830,
3393,
2512,
10850,
703,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11323,
5586,
198,
197,
1903,
914,
198,
197,
59403,
197,
197,
515,
298,
11323,
25,
15733,
3148,
298,
1903,
25,
1565,
859,
82,
21688,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestDupLockInconsistency(t *testing.T) {
store, clean := createMockStoreAndSetup(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, index b (b))")
tk.MustExec("insert t (a) values (1), (1)")
tk.MustExec("begin pessimistic")
tk.MustExec("update t, (select a from t) s set t.b = s.a")
tk.MustExec("commit")
tk.MustExec("admin check table t")
} | explode_data.jsonl/12487 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 178
} | [
2830,
3393,
85713,
11989,
641,
6254,
47094,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1855,
11571,
6093,
3036,
21821,
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 TestSyncDb(t *testing.T) {
RegisterModel(new(Data), new(DataNull), new(DataCustom))
RegisterModel(new(User))
RegisterModel(new(Profile))
RegisterModel(new(Post))
RegisterModel(new(NullValue))
RegisterModel(new(Tag))
RegisterModel(new(Comment))
RegisterModel(new(UserBig))
RegisterModel(new(PostTags))
RegisterModel(new(Group))
RegisterModel(new(Permission))
RegisterModel(new(GroupPermissions))
RegisterModel(new(InLine))
RegisterModel(new(InLineOneToOne))
RegisterModel(new(IntegerPk))
RegisterModel(new(UintPk))
RegisterModel(new(PtrPk))
RegisterModel(new(Index))
RegisterModel(new(StrPk))
RegisterModel(new(TM))
RegisterModel(new(DeptInfo))
err := RunSyncdb("default", true, Debug)
throwFail(t, err)
modelCache.clean()
} | explode_data.jsonl/18116 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 265
} | [
2830,
3393,
12154,
7994,
1155,
353,
8840,
836,
8,
341,
79096,
1712,
1755,
18959,
701,
501,
18959,
3280,
701,
501,
18959,
10268,
1171,
79096,
1712,
1755,
13087,
1171,
79096,
1712,
1755,
98379,
1171,
79096,
1712,
1755,
68048,
1171,
79096,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestQMatches(t *testing.T) {
qp := QMatches(model.LabelSet{
"job": "test",
"instance": "web-1",
"path": "/user/profile",
"method": "GET",
})
q := &query{}
qp(q)
f := q.filters[0]
cases := []struct {
sil *pb.Silence
drop bool
}{
{
sil: &pb.Silence{
Matchers: []*pb.Matcher{
{Name: "job", Pattern: "test", Type: pb.Matcher_EQUAL},
},
},
drop: true,
},
{
sil: &pb.Silence{
Matchers: []*pb.Matcher{
{Name: "job", Pattern: "test", Type: pb.Matcher_EQUAL},
{Name: "method", Pattern: "POST", Type: pb.Matcher_EQUAL},
},
},
drop: false,
},
{
sil: &pb.Silence{
Matchers: []*pb.Matcher{
{Name: "path", Pattern: "/user/.+", Type: pb.Matcher_REGEXP},
},
},
drop: true,
},
{
sil: &pb.Silence{
Matchers: []*pb.Matcher{
{Name: "path", Pattern: "/user/.+", Type: pb.Matcher_REGEXP},
{Name: "path", Pattern: "/nothing/.+", Type: pb.Matcher_REGEXP},
},
},
drop: false,
},
}
for _, c := range cases {
drop, err := f(c.sil, &Silences{mc: matcherCache{}}, time.Time{})
require.NoError(t, err)
require.Equal(t, c.drop, drop, "unexpected filter result")
}
} | explode_data.jsonl/2690 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 607
} | [
2830,
3393,
48,
42470,
1155,
353,
8840,
836,
8,
341,
18534,
79,
1669,
1207,
42470,
7635,
4679,
1649,
515,
197,
197,
1,
8799,
788,
414,
330,
1944,
756,
197,
197,
1,
4851,
788,
330,
2911,
12,
16,
756,
197,
197,
70688,
788,
257,
3521... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestGauge(t *testing.T) {
tick = fakeTick
defer func() { tick = time.Tick }()
buf := &bytes.Buffer{}
c := New(buf, time.Second)
c.Gauge("metric1", 1, "tag1")
c.Gauge("metric2", -2.0, "tag1", "tag2")
wait(buf)
assert.Equal(t, "metric1:1.000000|g|#tag1\nmetric2:-2.000000|g|#tag1,tag2\n", buf.String())
} | explode_data.jsonl/59254 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 156
} | [
2830,
3393,
38,
19392,
1155,
353,
8840,
836,
8,
341,
3244,
865,
284,
12418,
22213,
198,
16867,
2915,
368,
314,
9341,
284,
882,
66858,
335,
2822,
26398,
1669,
609,
9651,
22622,
16094,
1444,
1669,
1532,
10731,
11,
882,
32435,
692,
1444,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filterFindNodeServers(t *testing.T) {
//func filterFindNodeServers(nodes []node.Node, queried map[string]struct{}, alpha int) []node.Node {
nodes := node.GenerateRandomNodesData(20)
q := make(map[string]struct{})
q[nodes[0].String()] = struct{}{}
q[nodes[1].String()] = struct{}{}
q[nodes[2].String()] = struct{}{}
filtered := filterFindNodeServers(nodes, q, 5)
assert.Equal(t, 5, len(filtered))
for n := range filtered {
if _, ok := q[filtered[n].String()]; ok {
t.Error("It was in the filtered")
}
}
} | explode_data.jsonl/37079 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 216
} | [
2830,
3393,
8727,
9885,
1955,
78139,
1155,
353,
8840,
836,
8,
341,
197,
322,
2830,
4051,
9885,
1955,
78139,
38705,
3056,
3509,
21714,
11,
77902,
2415,
14032,
60,
1235,
22655,
8287,
526,
8,
3056,
3509,
21714,
1476,
79756,
1669,
2436,
575... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCollectorLabels(t *testing.T) {
jaeger := v1.NewJaeger(types.NamespacedName{Name: "my-instance"})
jaeger.Spec.Labels = map[string]string{
"name": "operator",
"hello": "jaeger",
}
jaeger.Spec.Collector.Labels = map[string]string{
"hello": "world", // Override top level annotation
"another": "false",
}
collector := NewCollector(jaeger)
dep := collector.Get()
assert.Equal(t, "operator", dep.Spec.Template.Labels["name"])
assert.Equal(t, "world", dep.Spec.Template.Labels["hello"])
assert.Equal(t, "false", dep.Spec.Template.Labels["another"])
} | explode_data.jsonl/59522 | {
"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,
53694,
23674,
1155,
353,
8840,
836,
8,
341,
197,
5580,
1878,
1669,
348,
16,
7121,
52445,
1878,
52613,
98932,
68552,
675,
63121,
25,
330,
2408,
73655,
23625,
197,
5580,
1878,
36473,
4679,
82,
284,
2415,
14032,
30953,
515,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRenderDashboard(t *testing.T) {
rendered, err := RenderDashboard([]byte(body), []Var{
{
Name: "SERVICE_NAME",
Values: []Val{
{
Value: "news",
Context: map[string]string{
"TEST_VAR": "local_news",
},
},
{
Value: "payment",
Context: map[string]string{
"TEST_VAR": "local_payment",
},
},
{
Value: "user",
Context: map[string]string{},
},
},
},
{
Name: "TEST_VAR",
Values: []Val{
{
Value: "global",
Context: map[string]string{},
},
},
},
})
assert.Nil(t, err)
assert.Equal(t, []byte(ExpectedRendered), rendered)
} | explode_data.jsonl/653 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 341
} | [
2830,
3393,
6750,
26947,
1155,
353,
8840,
836,
8,
341,
33921,
291,
11,
1848,
1669,
13848,
26947,
10556,
3782,
15225,
701,
3056,
3962,
515,
197,
197,
515,
298,
21297,
25,
330,
65075,
4708,
756,
298,
197,
6227,
25,
3056,
2208,
515,
571,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_WorkspaceFeatures_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) {
t.Parallel()
parameters := gopter.DefaultTestParameters()
parameters.MaxSize = 10
properties := gopter.NewProperties(parameters)
properties.Property(
"Round trip from WorkspaceFeatures to WorkspaceFeatures via AssignPropertiesToWorkspaceFeatures & AssignPropertiesFromWorkspaceFeatures returns original",
prop.ForAll(RunPropertyAssignmentTestForWorkspaceFeatures, WorkspaceFeaturesGenerator()))
properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout))
} | explode_data.jsonl/43370 | {
"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,
87471,
8746,
21336,
62,
4498,
7903,
61941,
2568,
795,
21884,
1690,
26040,
39838,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
67543,
1669,
728,
73137,
13275,
2271,
9706,
741,
67543,
14535,
1695,
284,
220,
16,
15,
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 TestReadOperands(t *testing.T) {
tests := []struct {
op Opcode
operands []int
bytesRead int
}{
{OpConstant, []int{65535}, 2},
}
for _, tt := range tests {
instruction := Make(tt.op, tt.operands...)
def, err := Lookup(byte(tt.op))
if err != nil {
t.Fatalf("definition not found: %q\n", err)
}
operandsRead, n := ReadOperands(def, instruction[1:])
if n != tt.bytesRead {
t.Fatalf("n wrong. want=%d, got=%d", tt.bytesRead, n)
}
for i, want := range tt.operands {
if operandsRead[i] != want {
t.Errorf("operand wrong. want=%d, got=%d", want, operandsRead[i])
}
}
}
} | explode_data.jsonl/9478 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 287
} | [
2830,
3393,
4418,
5494,
2844,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
39703,
286,
78899,
198,
197,
197,
92593,
220,
3056,
396,
198,
197,
70326,
4418,
526,
198,
197,
59403,
197,
197,
90,
7125,
15472,
11,
3056,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLoginIdentityOut(t *testing.T) {
os.RemoveAll(profile.FullProfilePath(""))
t.Cleanup(func() {
os.RemoveAll(profile.FullProfilePath(""))
})
connector := mockConnector(t)
alice, err := types.NewUser("alice@example.com")
require.NoError(t, err)
alice.SetRoles([]string{"access"})
authProcess, proxyProcess := makeTestServers(t, connector, alice)
authServer := authProcess.GetAuthServer()
require.NotNil(t, authServer)
proxyAddr, err := proxyProcess.ProxyWebAddr()
require.NoError(t, err)
identPath := filepath.Join(t.TempDir(), "ident")
err = Run([]string{
"login",
"--insecure",
"--debug",
"--auth", connector.GetName(),
"--proxy", proxyAddr.String(),
"--out", identPath,
}, cliOption(func(cf *CLIConf) error {
cf.mockSSOLogin = mockSSOLogin(t, authServer, alice)
return nil
}))
require.NoError(t, err)
_, err = client.KeyFromIdentityFile(identPath)
require.NoError(t, err)
} | explode_data.jsonl/21926 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 360
} | [
2830,
3393,
6231,
18558,
2662,
1155,
353,
8840,
836,
8,
341,
25078,
84427,
36606,
32038,
8526,
1820,
73303,
3244,
727,
60639,
18552,
368,
341,
197,
25078,
84427,
36606,
32038,
8526,
1820,
73303,
197,
8824,
32917,
1256,
1669,
7860,
35954,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateDuration(t *testing.T) {
for _, test := range durationTests {
err := validateDuration(test.proto)
gotValid := (err == nil)
if gotValid != test.isValid {
t.Errorf("validateDuration(%v) = %t, want %t", test.proto, gotValid, test.isValid)
}
}
} | explode_data.jsonl/19236 | {
"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,
17926,
12945,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
8090,
18200,
341,
197,
9859,
1669,
9593,
12945,
8623,
57322,
340,
197,
3174,
354,
4088,
1669,
320,
615,
621,
2092,
340,
197,
743,
2684,
4088,
961,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestTimestampLiteral(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
r := tk.MustQuery("select timestamp '2017-01-01 00:00:00';")
r.Check(testkit.Rows("2017-01-01 00:00:00"))
r = tk.MustQuery("select timestamp '2017@01@01 00:00:00';")
r.Check(testkit.Rows("2017-01-01 00:00:00"))
r = tk.MustQuery("select timestamp '2017@01@01 00~00~00';")
r.Check(testkit.Rows("2017-01-01 00:00:00"))
r = tk.MustQuery("select timestamp '2017@01@0001 00~00~00.333';")
r.Check(testkit.Rows("2017-01-01 00:00:00.333"))
_, err := tk.Exec("select timestamp '00:00:00';")
require.Error(t, err)
require.True(t, terror.ErrorEqual(err, types.ErrWrongValue.GenWithStackByArgs(types.DateTimeStr, "00:00:00")))
_, err = tk.Exec("select timestamp '1992-01-03';")
require.Error(t, err)
require.True(t, terror.ErrorEqual(err, types.ErrWrongValue.GenWithStackByArgs(types.DateTimeStr, "1992-01-03")))
_, err = tk.Exec("select timestamp '20171231235959.999999';")
require.Error(t, err)
require.True(t, terror.ErrorEqual(err, types.ErrWrongValue.GenWithStackByArgs(types.DateTimeStr, "20171231235959.999999")))
} | explode_data.jsonl/65456 | {
"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,
20812,
17350,
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,
692,
7000,
1669,
17162,
50463,
285... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMapProxy_PutTransientWithNilValue(t *testing.T) {
testKey := "testingKey"
err := mp.PutTransient(testKey, nil, 1, time.Millisecond)
AssertErrorNotNil(t, err, "putTransient did not return an error for nil value")
mp.Clear()
} | explode_data.jsonl/56975 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 86
} | [
2830,
3393,
2227,
16219,
1088,
332,
48183,
2354,
19064,
1130,
1155,
353,
8840,
836,
8,
341,
18185,
1592,
1669,
330,
8840,
1592,
698,
9859,
1669,
10490,
39825,
48183,
8623,
1592,
11,
2092,
11,
220,
16,
11,
882,
71482,
340,
18017,
1454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfigOauthScopes(t *testing.T) {
scopes := oauthScopesFromConfigOrDefault(&schema.Set{})
if len(scopes) != len(defaultOauthScopes) {
t.Fatalf("error: default oauth scopes not being set")
}
s := schema.NewSet(
schema.HashString,
[]interface{}{
"https://www.googleapis.com/auth/admin.directory.group"})
scopes = oauthScopesFromConfigOrDefault(s)
if len(scopes) != len(convertStringSet(s)) {
t.Fatalf("error: oauth scopes not being set")
}
} | explode_data.jsonl/68871 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 182
} | [
2830,
3393,
2648,
46,
3242,
3326,
18523,
1155,
353,
8840,
836,
8,
1476,
29928,
18523,
1669,
46415,
3326,
18523,
3830,
2648,
14188,
2099,
17349,
4202,
6257,
692,
743,
2422,
16860,
18523,
8,
961,
2422,
18978,
46,
3242,
3326,
18523,
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... | 3 |
func TestReadTerragruntConfigIamRole(t *testing.T) {
t.Parallel()
identityArn, err := aws_helper.GetAWSIdentityArn(nil, &options.TerragruntOptions{})
assert.NoError(t, err)
cleanupTerraformFolder(t, TEST_FIXTURE_READ_IAM_ROLE)
// Execution outputs to be verified
stdout := bytes.Buffer{}
stderr := bytes.Buffer{}
// Invoke terragrunt and verify used IAM role
err = runTerragruntCommand(t, fmt.Sprintf("terragrunt init --terragrunt-working-dir %s", TEST_FIXTURE_READ_IAM_ROLE), &stdout, &stderr)
// Since are used not existing AWS accounts, for validation are used success and error outputs
output := fmt.Sprintf("%v %v %v", string(stderr.Bytes()), string(stdout.Bytes()), err.Error())
// Check that output contains value defined in IAM role
assert.Equal(t, 1, strings.Count(output, "666666666666"))
// Ensure that state file wasn't created with default IAM value
assert.True(t, util.FileNotExists(util.JoinPath(TEST_FIXTURE_READ_IAM_ROLE, identityArn+".txt")))
} | explode_data.jsonl/10175 | {
"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,
4418,
51402,
68305,
3850,
2648,
40,
309,
9030,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
16912,
58331,
11,
1848,
1669,
31521,
10418,
2234,
36136,
18558,
58331,
27907,
11,
609,
2875,
836,
615,
68305,
3850,
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 TestPodSpecWithCustomStartPort(t *testing.T) {
fakeClient := fakek8sclient.NewSimpleClientset()
coreops.SetInstance(coreops.New(fakeClient))
fakeClient.Discovery().(*fakediscovery.FakeDiscovery).FakedServerVersion = &version.Info{
GitVersion: "v1.12.8",
}
startPort := uint32(10001)
nodeName := "testNode"
cluster := &corev1.StorageCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "px-cluster",
Namespace: "kube-system",
},
Spec: corev1.StorageClusterSpec{
Image: "portworx/oci-monitor:2.1.1",
StartPort: &startPort,
},
}
driver := portworx{}
expected := getExpectedPodSpecFromDaemonset(t, "testspec/portworxPodCustomPort.yaml")
actual, err := driver.GetStoragePodSpec(cluster, nodeName)
require.NoError(t, err, "Unexpected error on GetStoragePodSpec")
assertPodSpecEqual(t, expected, &actual)
// Don't set the start port if same as default start port
startPort = uint32(pxutil.DefaultStartPort)
cluster.Spec.StartPort = &startPort
expectedArgs := []string{
"-c", "px-cluster",
"-x", "kubernetes",
}
actual, _ = driver.GetStoragePodSpec(cluster, nodeName)
assert.ElementsMatch(t, expectedArgs, actual.Containers[0].Args)
// Don't set the start port if nil
cluster.Spec.StartPort = nil
actual, _ = driver.GetStoragePodSpec(cluster, nodeName)
assert.ElementsMatch(t, expectedArgs, actual.Containers[0].Args)
} | explode_data.jsonl/55446 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 514
} | [
2830,
3393,
23527,
8327,
2354,
10268,
3479,
7084,
1155,
353,
8840,
836,
8,
341,
1166,
726,
2959,
1669,
12418,
74,
23,
82,
2972,
7121,
16374,
2959,
746,
741,
71882,
3721,
4202,
2523,
47867,
3721,
7121,
74138,
2959,
1171,
1166,
726,
2959,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCmdLineArgs(t *testing.T) {
expectSuccess := func(p *proc.Target, fixture protest.Fixture) {
err := p.Continue()
bp := p.CurrentThread().Breakpoint()
if bp.Breakpoint != nil && bp.Name == proc.UnrecoveredPanic {
t.Fatalf("testing args failed on unrecovered-panic breakpoint: %v", bp)
}
exit, exited := err.(proc.ErrProcessExited)
if !exited {
t.Fatalf("Process did not exit: %v", err)
} else {
if exit.Status != 0 {
t.Fatalf("process exited with invalid status %d", exit.Status)
}
}
}
expectPanic := func(p *proc.Target, fixture protest.Fixture) {
p.Continue()
bp := p.CurrentThread().Breakpoint()
if bp.Breakpoint == nil || bp.Name != proc.UnrecoveredPanic {
t.Fatalf("not on unrecovered-panic breakpoint: %v", bp)
}
}
// make sure multiple arguments (including one with spaces) are passed to the binary correctly
withTestProcessArgs("testargs", t, ".", []string{"test"}, 0, expectSuccess)
withTestProcessArgs("testargs", t, ".", []string{"-test"}, 0, expectPanic)
withTestProcessArgs("testargs", t, ".", []string{"test", "pass flag"}, 0, expectSuccess)
// check that arguments with spaces are *only* passed correctly when correctly called
withTestProcessArgs("testargs", t, ".", []string{"test pass", "flag"}, 0, expectPanic)
withTestProcessArgs("testargs", t, ".", []string{"test", "pass", "flag"}, 0, expectPanic)
withTestProcessArgs("testargs", t, ".", []string{"test pass flag"}, 0, expectPanic)
// and that invalid cases (wrong arguments or no arguments) panic
withTestProcess("testargs", t, expectPanic)
withTestProcessArgs("testargs", t, ".", []string{"invalid"}, 0, expectPanic)
withTestProcessArgs("testargs", t, ".", []string{"test", "invalid"}, 0, expectPanic)
withTestProcessArgs("testargs", t, ".", []string{"invalid", "pass flag"}, 0, expectPanic)
} | explode_data.jsonl/56251 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 624
} | [
2830,
3393,
15613,
2460,
4117,
1155,
353,
8840,
836,
8,
341,
24952,
7188,
1669,
2915,
1295,
353,
15782,
35016,
11,
12507,
8665,
991,
12735,
8,
341,
197,
9859,
1669,
281,
2451,
6232,
741,
197,
2233,
79,
1669,
281,
11517,
6855,
1005,
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... | 5 |
func TestDescribeConfigsRequestv0(t *testing.T) {
t.Parallel()
var request *DescribeConfigsRequest
request = &DescribeConfigsRequest{
Version: 0,
Resources: []*ConfigResource{},
}
testRequest(t, "no requests", request, emptyDescribeConfigsRequest)
configs := []string{"segment.ms"}
request = &DescribeConfigsRequest{
Version: 0,
Resources: []*ConfigResource{
{
Type: TopicResource,
Name: "foo",
ConfigNames: configs,
},
},
}
testRequest(t, "one config", request, singleDescribeConfigsRequest)
request = &DescribeConfigsRequest{
Version: 0,
Resources: []*ConfigResource{
{
Type: TopicResource,
Name: "foo",
ConfigNames: []string{"segment.ms", "retention.ms"},
},
{
Type: TopicResource,
Name: "bar",
ConfigNames: []string{"segment.ms"},
},
},
}
testRequest(t, "two configs", request, doubleDescribeConfigsRequest)
request = &DescribeConfigsRequest{
Version: 0,
Resources: []*ConfigResource{
{
Type: TopicResource,
Name: "foo",
},
},
}
testRequest(t, "one topic, all configs", request, singleDescribeConfigsRequestAllConfigs)
} | explode_data.jsonl/40237 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 487
} | [
2830,
3393,
74785,
84905,
1900,
85,
15,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2405,
1681,
353,
74785,
84905,
1900,
271,
23555,
284,
609,
74785,
84905,
1900,
515,
197,
77847,
25,
256,
220,
15,
345,
197,
197,
11277,
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 TestMixedResourceNonResourceUncovered(t *testing.T) {
escalationTest{
ownerRules: []authorizationapi.PolicyRule{
{Verbs: sets.NewString("get"), Resources: sets.NewString("pods"), NonResourceURLs: sets.NewString("/api", "/api/*")},
},
servantRules: []authorizationapi.PolicyRule{
{Verbs: sets.NewString("get", "post"), Resources: sets.NewString("pods", "builds"), NonResourceURLs: sets.NewString("/api", "/apis")},
},
expectedCovered: false,
expectedUncoveredRules: []authorizationapi.PolicyRule{
{Verbs: sets.NewString("post"), Resources: sets.NewString("pods")},
{Verbs: sets.NewString("get"), Resources: sets.NewString("builds")},
{Verbs: sets.NewString("post"), Resources: sets.NewString("builds")},
{Verbs: sets.NewString("post"), NonResourceURLs: sets.NewString("/api")},
{Verbs: sets.NewString("get"), NonResourceURLs: sets.NewString("/apis")},
{Verbs: sets.NewString("post"), NonResourceURLs: sets.NewString("/apis")},
},
}.test(t)
} | explode_data.jsonl/9065 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 358
} | [
2830,
3393,
86433,
4783,
8121,
4783,
1806,
20804,
1155,
353,
8840,
836,
8,
341,
80629,
278,
367,
2271,
515,
197,
197,
8118,
26008,
25,
3056,
39554,
2068,
1069,
8018,
11337,
515,
298,
197,
90,
10141,
1279,
25,
7289,
7121,
703,
445,
455... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDescribeUnknownSchemaObject(t *testing.T) {
d := &testDescriber{Output: "test output"}
f, tf, codec := NewTestFactory()
tf.Describer = d
tf.Client = &client.FakeRESTClient{
Codec: codec,
Resp: &http.Response{StatusCode: 200, Body: objBody(codec, &internalType{Name: "foo"})},
}
tf.Namespace = "non-default"
buf := bytes.NewBuffer([]byte{})
cmd := f.NewCmdDescribe(buf)
cmd.Run(cmd, []string{"type", "foo"})
if d.Name != "foo" || d.Namespace != "non-default" {
t.Errorf("unexpected describer: %#v", d)
}
if buf.String() != fmt.Sprintf("%s\n", d.Output) {
t.Errorf("unexpected output: %s", buf.String())
}
} | explode_data.jsonl/7652 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 257
} | [
2830,
3393,
74785,
13790,
8632,
1190,
1155,
353,
8840,
836,
8,
341,
2698,
1669,
609,
1944,
62664,
652,
90,
5097,
25,
330,
1944,
2550,
16707,
1166,
11,
6409,
11,
34647,
1669,
1532,
2271,
4153,
741,
3244,
69,
23548,
740,
652,
284,
294,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewTeam_Marshal(t *testing.T) {
testJSONMarshal(t, &NewTeam{}, "{}")
u := &NewTeam{
Name: "n",
Description: String("d"),
Maintainers: []string{"m1", "m2"},
RepoNames: []string{"repo1", "repo2"},
ParentTeamID: Int64(1),
Permission: String("perm"),
Privacy: String("p"),
LDAPDN: String("l"),
}
want := `{
"name": "n",
"description": "d",
"maintainers": ["m1", "m2"],
"repo_names": ["repo1", "repo2"],
"parent_team_id": 1,
"permission": "perm",
"privacy": "p",
"ldap_dn": "l"
}`
testJSONMarshal(t, u, want)
} | explode_data.jsonl/4560 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 324
} | [
2830,
3393,
3564,
14597,
1245,
28423,
1155,
353,
8840,
836,
8,
341,
18185,
5370,
55438,
1155,
11,
609,
3564,
14597,
22655,
35503,
5130,
10676,
1669,
609,
3564,
14597,
515,
197,
21297,
25,
260,
330,
77,
756,
197,
47414,
25,
220,
923,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMPPDecimalConvert(t *testing.T) {
testDecimalConvert(t, 5, 9, 5, 8, false, false, 5, 9)
testDecimalConvert(t, 5, 8, 5, 9, false, false, 5, 9)
testDecimalConvert(t, 0, 8, 0, 11, true, false, 0, 11)
testDecimalConvert(t, 0, 16, 0, 11, false, false, 0, 16)
testDecimalConvert(t, 5, 9, 4, 9, true, true, 5, 10)
testDecimalConvert(t, 5, 8, 4, 9, true, true, 5, 10)
testDecimalConvert(t, 5, 9, 4, 8, false, true, 5, 9)
testDecimalConvert(t, 10, 16, 0, 11, true, true, 10, 21)
testDecimalConvert(t, 5, 19, 0, 20, false, true, 5, 25)
testDecimalConvert(t, 20, 20, 0, 60, true, true, 20, 65)
testDecimalConvert(t, 20, 40, 0, 60, false, true, 20, 65)
testDecimalConvert(t, 0, 40, 0, 60, false, false, 0, 60)
} | explode_data.jsonl/80647 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 330
} | [
2830,
3393,
44,
4406,
11269,
12012,
1155,
353,
8840,
836,
8,
341,
18185,
11269,
12012,
1155,
11,
220,
20,
11,
220,
24,
11,
220,
20,
11,
220,
23,
11,
895,
11,
895,
11,
220,
20,
11,
220,
24,
340,
18185,
11269,
12012,
1155,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestWalkRDirTree(t *testing.T) {
for _, test := range []struct {
entries fs.DirEntries
want string
err error
root string
level int
}{
{fs.DirEntries{}, "/\n", nil, "", -1},
{fs.DirEntries{mockobject.Object("a")}, `/
a
`, nil, "", -1},
{fs.DirEntries{mockobject.Object("a/b")}, `/
a/
a/
b
`, nil, "", -1},
{fs.DirEntries{mockobject.Object("a/b/c/d")}, `/
a/
a/
b/
a/b/
c/
a/b/c/
d
`, nil, "", -1},
{fs.DirEntries{mockobject.Object("a")}, "", errorBoom, "", -1},
{fs.DirEntries{
mockobject.Object("0/1/2/3"),
mockobject.Object("4/5/6/7"),
mockobject.Object("8/9/a/b"),
mockobject.Object("c/d/e/f"),
mockobject.Object("g/h/i/j"),
mockobject.Object("k/l/m/n"),
mockobject.Object("o/p/q/r"),
mockobject.Object("s/t/u/v"),
mockobject.Object("w/x/y/z"),
}, `/
0/
4/
8/
c/
g/
k/
o/
s/
w/
0/
1/
0/1/
2/
0/1/2/
3
4/
5/
4/5/
6/
4/5/6/
7
8/
9/
8/9/
a/
8/9/a/
b
c/
d/
c/d/
e/
c/d/e/
f
g/
h/
g/h/
i/
g/h/i/
j
k/
l/
k/l/
m/
k/l/m/
n
o/
p/
o/p/
q/
o/p/q/
r
s/
t/
s/t/
u/
s/t/u/
v
w/
x/
w/x/
y/
w/x/y/
z
`, nil, "", -1},
{fs.DirEntries{
mockobject.Object("a/b/c/d/e/f1"),
mockobject.Object("a/b/c/d/e/f2"),
mockobject.Object("a/b/c/d/e/f3"),
}, `a/b/c/
d/
a/b/c/d/
e/
a/b/c/d/e/
f1
f2
f3
`, nil, "a/b/c", -1},
{fs.DirEntries{
mockobject.Object("A"),
mockobject.Object("a/B"),
mockobject.Object("a/b/C"),
mockobject.Object("a/b/c/D"),
mockobject.Object("a/b/c/d/E"),
}, `/
A
a/
a/
B
b/
`, nil, "", 2},
{fs.DirEntries{
mockobject.Object("a/b/c"),
mockobject.Object("a/b/c/d/e"),
}, `/
a/
a/
b/
`, nil, "", 2},
} {
r, err := walkRDirTree(context.Background(), nil, test.root, true, test.level, makeListRCallback(test.entries, test.err))
assert.Equal(t, test.err, err, fmt.Sprintf("%+v", test))
assert.Equal(t, test.want, r.String(), fmt.Sprintf("%+v", test))
}
} | explode_data.jsonl/65765 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1164
} | [
2830,
3393,
48849,
49,
6184,
6533,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
197,
12940,
8619,
83757,
24533,
198,
197,
50780,
262,
914,
198,
197,
9859,
257,
1465,
198,
197,
33698,
262,
914,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestTeamsService_ListProjectsByID(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
wantAcceptHeaders := []string{mediaTypeProjectsPreview}
mux.HandleFunc("/organizations/1/team/1/projects", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
fmt.Fprint(w, `[{"id":1}]`)
})
ctx := context.Background()
projects, _, err := client.Teams.ListTeamProjectsByID(ctx, 1, 1)
if err != nil {
t.Errorf("Teams.ListTeamProjectsByID returned error: %v", err)
}
want := []*Project{{ID: Int64(1)}}
if !cmp.Equal(projects, want) {
t.Errorf("Teams.ListTeamProjectsByID returned %+v, want %+v", projects, want)
}
const methodName = "ListTeamProjectsByID"
testBadOptions(t, methodName, func() (err error) {
_, _, err = client.Teams.ListTeamProjectsByID(ctx, -1, -1)
return err
})
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Teams.ListTeamProjectsByID(ctx, 1, 1)
if got != nil {
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
}
return resp, err
})
} | explode_data.jsonl/4545 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 463
} | [
2830,
3393,
60669,
1860,
27104,
29958,
60572,
1155,
353,
8840,
836,
8,
341,
25291,
11,
59807,
11,
8358,
49304,
1669,
6505,
741,
16867,
49304,
2822,
50780,
16646,
10574,
1669,
3056,
917,
90,
7399,
929,
29958,
24625,
532,
2109,
2200,
63623,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDatabaseOpen(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
d, mapCh, _ := newTestDatabase(t, ctrl, BootstrapNotStarted)
defer func() {
close(mapCh)
leaktest.CheckTimeout(t, time.Second)()
}()
require.NoError(t, d.Open())
require.Equal(t, errDatabaseAlreadyOpen, d.Open())
require.NoError(t, d.Close())
} | explode_data.jsonl/46523 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 140
} | [
2830,
3393,
5988,
5002,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
2698,
11,
2415,
1143,
11,
716,
1669,
501,
2271,
5988,
1155,
11,
23743,
11,
26059,
2623,
32527,
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 TestCast(t *testing.T) {
store, clean := realtikvtest.CreateMockStoreAndSetup(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustQuery("select cast(0.5 as unsigned)")
tk.MustQuery("select cast(-0.5 as signed)")
tk.MustQuery("select hex(cast(0x10 as binary(2)))").Check(testkit.Rows("1000"))
} | explode_data.jsonl/5795 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
18714,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1931,
83,
1579,
85,
1944,
7251,
11571,
6093,
3036,
21821,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
340,
3244,
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 TestUniqueString(t *testing.T) {
const str = "uniqueString(resourceGroup().id)"
res := LookUp(nil, nil, str).(string)
_, err := uuid.Parse(res)
assert.NoError(t, err)
} | explode_data.jsonl/20144 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 69
} | [
2830,
3393,
22811,
703,
1155,
353,
8840,
836,
8,
341,
4777,
607,
284,
330,
9587,
703,
23599,
2808,
1005,
307,
12954,
10202,
1669,
9192,
2324,
27907,
11,
2092,
11,
607,
68615,
917,
692,
197,
6878,
1848,
1669,
16040,
8937,
4590,
340,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPreserveVerInfo(t *testing.T) {
inVer := "0.0.10"
var outKey, outVer string
svc := appService{
miscRepository: &mock.MiscRepositoryMock{
OnCreateOrUpdate: func(key, value string) error {
outKey = key
outVer = value
return nil
},
},
versionReader: &common.VersionReaderMock{
OnRead: func() (string, error) {
return inVer, nil
},
},
}
err := svc.PreserveVerInfo()
require.NoError(t, err)
require.Equal(t, AppVer, outKey)
require.Equal(t, inVer, outVer)
} | explode_data.jsonl/44306 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 219
} | [
2830,
3393,
14367,
5852,
10141,
1731,
1155,
353,
8840,
836,
8,
341,
17430,
10141,
1669,
330,
15,
13,
15,
13,
16,
15,
698,
2405,
700,
1592,
11,
700,
10141,
914,
271,
1903,
7362,
1669,
906,
1860,
515,
197,
2109,
3427,
4624,
25,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestOpenNonexistentFile(t *testing.T) {
vfsObj, root, ctx, err := newVerityRoot(t, SHA256)
if err != nil {
t.Fatalf("newVerityRoot: %v", err)
}
filename := "verity-test-file"
fd, _, err := newFileFD(ctx, t, vfsObj, root, filename, 0644)
if err != nil {
t.Fatalf("newFileFD: %v", err)
}
// Enable verity on the file and confirms a normal read succeeds.
enableVerity(ctx, t, fd)
// Enable verity on the parent directory.
parentFD, err := openVerityAt(ctx, vfsObj, root, "", linux.O_RDONLY, linux.ModeRegular)
if err != nil {
t.Fatalf("OpenAt: %v", err)
}
enableVerity(ctx, t, parentFD)
// Ensure open an unexpected file in the parent directory fails with
// ENOENT rather than verification failure.
if _, err = openVerityAt(ctx, vfsObj, root, filename+"abc", linux.O_RDONLY, linux.ModeRegular); err != syserror.ENOENT {
t.Errorf("OpenAt unexpected error: %v", err)
}
} | explode_data.jsonl/56760 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 342
} | [
2830,
3393,
5002,
8121,
64085,
1703,
1155,
353,
8840,
836,
8,
341,
5195,
3848,
5261,
11,
3704,
11,
5635,
11,
1848,
1669,
501,
10141,
487,
8439,
1155,
11,
21721,
17,
20,
21,
340,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHideReveal(t *testing.T) {
for _, name := range loadTestImages(t) {
// load test jpeg
f, err := os.Open("testdata/" + name)
if err != nil {
t.Fatal(err)
}
defer f.Close()
img, err := jpeg.Decode(f)
if err != nil {
t.Fatal(err)
}
// hide data in img
var buf bytes.Buffer
data := []byte("foo bar baz quux")
err = Hide(&buf, img, data, nil)
if err != nil {
t.Fatal(err)
}
// reveal data
revealed, err := Reveal(&buf)
if err != nil {
t.Fatal(err)
}
revealed = revealed[:len(data)]
if !bytes.Equal(data, revealed) {
t.Fatal("revealed bytes do not match original")
}
}
} | explode_data.jsonl/74658 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 289
} | [
2830,
3393,
21692,
693,
40611,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
829,
1669,
2088,
2795,
2271,
14228,
1155,
8,
341,
197,
197,
322,
2795,
1273,
54566,
198,
197,
1166,
11,
1848,
1669,
2643,
12953,
445,
92425,
11225,
488,
829,
340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func Test_SaveAndLoadConfValue(t *testing.T) {
fc := NewFileConfig(testFilename, new(fakeCoder))
err := fc.SaveToFile(fakeCoderText)
if err != nil {
t.Error("SavetoFile test failed", err)
}
defer os.Remove(testFilename)
newvalue := fc.Value()
if newvalue != fakeCoderText {
t.Errorf("ConfValue test failed, get %v != set %v", newvalue, fakeCoderText)
}
str := new(string)
err = fc.LoadFromFile(str)
if err != nil {
t.Errorf("LoadFromFile failed %v", err)
}
if *str != newvalue {
t.Errorf("LoadFromFile test failed, get %v != set %v", *str, newvalue)
}
} | explode_data.jsonl/69620 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 228
} | [
2830,
3393,
78746,
3036,
5879,
15578,
1130,
1155,
353,
8840,
836,
8,
341,
1166,
66,
1669,
1532,
1703,
2648,
8623,
20759,
11,
501,
74138,
35290,
1171,
9859,
1669,
25563,
13599,
41550,
74138,
35290,
1178,
340,
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,
1... | 5 |
func TestParseShortNameMode(t *testing.T) {
tests := []struct {
input string
result types.ShortNameMode
mustFail bool
}{
{"disabled", types.ShortNameModeDisabled, false},
{"enforcing", types.ShortNameModeEnforcing, false},
{"permissive", types.ShortNameModePermissive, false},
{"", -1, true},
{"xxx", -1, true},
}
for _, test := range tests {
shortName, err := parseShortNameMode(test.input)
if test.mustFail {
assert.Error(t, err)
continue
}
require.NoError(t, err)
assert.Equal(t, test.result, shortName)
}
} | explode_data.jsonl/62241 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 215
} | [
2830,
3393,
14463,
12472,
675,
3636,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
22427,
262,
914,
198,
197,
9559,
256,
4494,
55958,
675,
3636,
198,
197,
2109,
590,
19524,
1807,
198,
197,
59403,
197,
197,
4913,
119... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestErrorBuildError(t *testing.T) {
assert := assert.New(t)
input := `{"__type": "dynamodb#MissingAction", "message": "The FooBar happened."}`
req, _ := http.NewRequest("POST", "http://fake/fake", nil)
resp := &http.Response{}
err := buildError(req, nil, resp, []byte(input))
e := err.(*Error)
assert.Equal(ErrorInvalidParameter, e.Type)
assert.Equal([]byte(input), e.ResponseBody)
assert.Equal("MissingAction", e.Exception)
e = buildError(req, nil, resp, []byte("\n")).(*Error)
assert.Equal(ErrorUnknown, e.Type)
assert.Equal("unexpected end of JSON input", e.Message)
} | explode_data.jsonl/68122 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 214
} | [
2830,
3393,
1454,
11066,
1454,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
22427,
1669,
1565,
4913,
563,
1313,
788,
330,
67,
83348,
2,
25080,
2512,
497,
330,
1994,
788,
330,
785,
33428,
3428,
6932,
1189,
31257,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCompileWithSubModule(t *testing.T) {
m := createModuleScript(t)
f, err := ioutil.TempFile("", "")
assert.Nil(t, err)
f.WriteString(fmt.Sprintf(`(import "%v") (print (%v.hello "John"))`, m, path.Base(m)))
err = f.Close()
assert.Nil(t, err)
es, err := Compile(f.Name())
assert.Nil(t, err)
assert.Equal(t, 1, len(es))
} | explode_data.jsonl/24275 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 149
} | [
2830,
3393,
46126,
2354,
3136,
3332,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
1855,
3332,
5910,
1155,
692,
1166,
11,
1848,
1669,
43144,
65009,
1703,
19814,
14676,
6948,
59678,
1155,
11,
1848,
692,
1166,
44747,
28197,
17305,
5809,
7,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnmarshalSensitiveStringFromFile(t *testing.T) {
t.Parallel()
conf := struct {
Path *string `yaml:"path" mapstructure:"path"`
Password1 *string `yaml:"password" mapstructure:"password1"`
Password2 *SensitiveString `yaml:"password" mapstructure:"password2"`
}{}
fs := afero.NewMemMapFs()
err := afero.WriteFile(fs,
"sensitive_string_config.yaml",
[]byte("path: testdata\npassword1: pwd1\npassword2: pwd2"), 0644)
require.Nil(t, err)
b := NewConfigReaderBuilder()
reader := b.WithFs(fs).WithConfigFile("sensitive_string_config.yaml").Build()
err = reader.Unmarshal(&conf)
require.Nil(t, err)
assert.Equal(t, "testdata", *conf.Path)
assert.Equal(t, "pwd1", *conf.Password1)
assert.Equal(t, "****************", conf.Password2.String())
assert.Equal(t, "pwd2", conf.Password2.Value())
} | explode_data.jsonl/53793 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 341
} | [
2830,
3393,
1806,
27121,
63316,
703,
43633,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
67850,
1669,
2036,
341,
197,
69640,
414,
353,
917,
688,
1565,
41466,
2974,
2343,
1,
2415,
7837,
2974,
2343,
8805,
197,
197,
4876,
16,
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 TestLocalTemporaryTableDelete(t *testing.T) {
store, clean := realtikvtest.CreateMockStoreAndSetup(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("create temporary table tmp1 (id int primary key, u int unique, v int)")
insertRecords := func(idList []int) {
for _, id := range idList {
tk.MustExec("insert into tmp1 values (?, ?, ?)", id, id+100, id+1000)
}
}
checkAllExistRecords := func(idList []int) {
sort.Ints(idList)
expectedResult := make([]string, 0, len(idList))
expectedIndexResult := make([]string, 0, len(idList))
for _, id := range idList {
expectedResult = append(expectedResult, fmt.Sprintf("%d %d %d", id, id+100, id+1000))
expectedIndexResult = append(expectedIndexResult, fmt.Sprintf("%d", id+100))
}
tk.MustQuery("select * from tmp1 order by id").Check(testkit.Rows(expectedResult...))
// check index deleted
tk.MustQuery("select /*+ use_index(tmp1, u) */ u from tmp1 order by u").Check(testkit.Rows(expectedIndexResult...))
tk.MustQuery("show warnings").Check(testkit.Rows())
}
assertDelete := func(sql string, deleted []int) {
idList := []int{1, 2, 3, 4, 5, 6, 7, 8, 9}
deletedMap := make(map[int]bool)
for _, id := range deleted {
deletedMap[id] = true
}
keepList := make([]int, 0)
for _, id := range idList {
if _, exist := deletedMap[id]; !exist {
keepList = append(keepList, id)
}
}
// delete records in txn and records are inserted in txn
tk.MustExec("begin")
insertRecords(idList)
tk.MustExec(sql)
tk.MustQuery("show warnings").Check(testkit.Rows())
checkAllExistRecords(keepList)
tk.MustExec("rollback")
checkAllExistRecords([]int{})
// delete records out of txn
insertRecords(idList)
tk.MustExec(sql)
checkAllExistRecords(keepList)
// delete records in txn
insertRecords(deleted)
tk.MustExec("begin")
tk.MustExec(sql)
checkAllExistRecords(keepList)
// test rollback
tk.MustExec("rollback")
checkAllExistRecords(idList)
// test commit
tk.MustExec("begin")
tk.MustExec(sql)
tk.MustExec("commit")
checkAllExistRecords(keepList)
tk.MustExec("delete from tmp1")
checkAllExistRecords([]int{})
}
assertDelete("delete from tmp1 where id=1", []int{1})
assertDelete("delete from tmp1 where id in (1, 3, 5)", []int{1, 3, 5})
assertDelete("delete from tmp1 where u=102", []int{2})
assertDelete("delete from tmp1 where u in (103, 107, 108)", []int{3, 7, 8})
assertDelete("delete from tmp1 where id=10", []int{})
assertDelete("delete from tmp1 where id in (10, 12)", []int{})
assertDelete("delete from tmp1 where u=110", []int{})
assertDelete("delete from tmp1 where u in (111, 112)", []int{})
assertDelete("delete from tmp1 where id in (1, 11, 5)", []int{1, 5})
assertDelete("delete from tmp1 where u in (102, 121, 106)", []int{2, 6})
assertDelete("delete from tmp1 where id<3", []int{1, 2})
assertDelete("delete from tmp1 where u>107", []int{8, 9})
assertDelete("delete /*+ use_index(tmp1, u) */ from tmp1 where u>105 and u<107", []int{6})
assertDelete("delete from tmp1 where v>=1006 or v<=1002", []int{1, 2, 6, 7, 8, 9})
} | explode_data.jsonl/5726 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1194
} | [
2830,
3393,
7319,
59362,
2556,
6435,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1931,
83,
1579,
85,
1944,
7251,
11571,
6093,
3036,
21821,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestControllerRegister_InsertFilterChain_Order(t *testing.T) {
InsertFilterChain("/abc", func(next FilterFunc) FilterFunc {
return func(ctx *context.Context) {
ctx.Output.Header("first", fmt.Sprintf("%d", time.Now().UnixNano()))
time.Sleep(time.Millisecond * 10)
next(ctx)
}
})
InsertFilterChain("/abc", func(next FilterFunc) FilterFunc {
return func(ctx *context.Context) {
ctx.Output.Header("second", fmt.Sprintf("%d", time.Now().UnixNano()))
time.Sleep(time.Millisecond * 10)
next(ctx)
}
})
r, _ := http.NewRequest("GET", "/abc", nil)
w := httptest.NewRecorder()
BhojpurApp.Handlers.Init()
BhojpurApp.Handlers.ServeHTTP(w, r)
first := w.Header().Get("first")
second := w.Header().Get("second")
ft, _ := strconv.ParseInt(first, 10, 64)
st, _ := strconv.ParseInt(second, 10, 64)
assert.True(t, st > ft)
} | explode_data.jsonl/14967 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 342
} | [
2830,
3393,
2051,
8690,
76417,
5632,
18837,
53267,
1155,
353,
8840,
836,
8,
341,
197,
13780,
5632,
18837,
4283,
13683,
497,
2915,
16913,
12339,
9626,
8,
12339,
9626,
341,
197,
853,
2915,
7502,
353,
2147,
9328,
8,
341,
298,
20985,
34246,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_SeekUnreachable(t *testing.T) {
filename := "Test_SeekUnreachable"
ioutil.WriteFile(filename, []byte("xxx"), os.ModePerm)
defer os.Remove(filename)
f, err := os.Open(filename)
if err != nil {
t.Error(err)
}
x, err := f.Seek(123456, os.SEEK_SET)
if err != nil {
t.Error(err)
}
fmt.Println(x)
//ioutil.WriteFile(filename, []byte("yyyy"), os.ModeAppend)
bx := []byte{}
n, err := f.Read(bx)
if err != nil {
t.Error(err)
}
fmt.Println(n, err, string(bx), "xx")
x1, err := f.Seek(0, os.SEEK_END)
if err != nil {
t.Error(err)
}
fmt.Println("x1", x1)
st, err := f.Stat()
fmt.Println(st.Size())
} | explode_data.jsonl/19696 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 305
} | [
2830,
3393,
26920,
1225,
1806,
46550,
1155,
353,
8840,
836,
8,
341,
66434,
1669,
330,
2271,
26920,
1225,
1806,
46550,
698,
8230,
30158,
4073,
1703,
10961,
11,
3056,
3782,
445,
24048,
3975,
2643,
42852,
81245,
340,
16867,
2643,
13270,
1096... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDB_Snapshot(t *testing.T) {
db, delete := openTestDB(t, nil)
defer delete()
// append data
app := db.Appender()
mint := int64(1414141414000)
for i := 0; i < 1000; i++ {
_, err := app.Add(labels.FromStrings("foo", "bar"), mint+int64(i), 1.0)
testutil.Ok(t, err)
}
testutil.Ok(t, app.Commit())
testutil.Ok(t, app.Rollback())
// create snapshot
snap, err := ioutil.TempDir("", "snap")
testutil.Ok(t, err)
defer func() {
testutil.Ok(t, os.RemoveAll(snap))
}()
testutil.Ok(t, db.Snapshot(snap, true))
testutil.Ok(t, db.Close())
// reopen DB from snapshot
db, err = Open(snap, nil, nil, nil)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, db.Close()) }()
querier, err := db.Querier(mint, mint+1000)
testutil.Ok(t, err)
defer func() { testutil.Ok(t, querier.Close()) }()
// sum values
seriesSet, err := querier.Select(labels.NewEqualMatcher("foo", "bar"))
testutil.Ok(t, err)
sum := 0.0
for seriesSet.Next() {
series := seriesSet.At().Iterator()
for series.Next() {
_, v := series.At()
sum += v
}
testutil.Ok(t, series.Err())
}
testutil.Ok(t, seriesSet.Err())
testutil.Equals(t, 1000.0, sum)
} | explode_data.jsonl/64369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 503
} | [
2830,
3393,
3506,
1098,
9601,
1155,
353,
8840,
836,
8,
341,
20939,
11,
3698,
1669,
1787,
2271,
3506,
1155,
11,
2092,
340,
16867,
3698,
2822,
197,
322,
8737,
821,
198,
28236,
1669,
2927,
5105,
1659,
741,
2109,
396,
1669,
526,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestQueryAllBatchConfirms(t *testing.T) {
input := CreateTestEnv(t)
ctx := input.Context
var (
tokenContract = "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B"
validatorAddr, _ = sdk.AccAddressFromBech32("cosmos1mgamdcs9dah0vn0gqupl05up7pedg2mvupe6hh")
)
input.GravityKeeper.SetBatchConfirm(ctx, &types.MsgConfirmBatch{
Nonce: 1,
TokenContract: tokenContract,
EthSigner: "0xf35e2cc8e6523d683ed44870f5b7cc785051a77d",
Orchestrator: validatorAddr.String(),
Signature: "signature",
})
batchConfirms, err := queryAllBatchConfirms(ctx, "1", tokenContract, input.GravityKeeper)
require.NoError(t, err)
expectedJSON := []byte(`[{"eth_signer":"0xf35e2cc8e6523d683ed44870f5b7cc785051a77d", "nonce":"1", "signature":"signature", "token_contract":"0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B", "orchestrator":"cosmos1mgamdcs9dah0vn0gqupl05up7pedg2mvupe6hh"}]`)
assert.JSONEq(t, string(expectedJSON), string(batchConfirms), "json is equal")
} | explode_data.jsonl/8798 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 447
} | [
2830,
3393,
2859,
2403,
21074,
15578,
14404,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
4230,
2271,
14359,
1155,
340,
20985,
1669,
1946,
9328,
271,
2405,
2399,
197,
43947,
14067,
262,
284,
330,
15,
87,
5830,
20,
23,
15,
16,
64,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestReadSignedCertificate(t *testing.T) {
testCases := map[string]struct {
gracePeriodRatio float32
minGracePeriod time.Duration
k8sCaCertFile string
secretNames []string
dnsNames []string
serviceNamespaces []string
secretName string
secretNameSpace string
invalidCert bool
expectFaill bool
}{
"read signed cert should succeed": {
gracePeriodRatio: 0.6,
k8sCaCertFile: "./test-data/example-ca-cert.pem",
dnsNames: []string{"foo"},
secretNames: []string{"istio.webhook.foo"},
serviceNamespaces: []string{"foo.ns"},
secretName: "mock-secret",
secretNameSpace: "mock-secret-namespace",
invalidCert: false,
expectFaill: false,
},
"read invalid signed cert should fail": {
gracePeriodRatio: 0.6,
k8sCaCertFile: "./test-data/example-ca-cert.pem",
dnsNames: []string{"foo"},
secretNames: []string{"istio.webhook.foo"},
serviceNamespaces: []string{"foo.ns"},
secretName: "mock-secret",
secretNameSpace: "mock-secret-namespace",
invalidCert: true,
expectFaill: true,
},
}
for _, tc := range testCases {
client := fake.NewSimpleClientset()
var csr *cert.CertificateSigningRequest
if tc.invalidCert {
csr = &cert.CertificateSigningRequest{
ObjectMeta: metav1.ObjectMeta{
Name: "domain-cluster.local-ns--secret-mock-secret",
},
Status: cert.CertificateSigningRequestStatus{
Certificate: []byte("invalid-cert"),
},
}
} else {
csr = &cert.CertificateSigningRequest{
ObjectMeta: metav1.ObjectMeta{
Name: "domain-cluster.local-ns--secret-mock-secret",
},
Status: cert.CertificateSigningRequestStatus{
Certificate: []byte(exampleIssuedCert),
},
}
}
client.PrependReactor("get", "certificatesigningrequests", defaultReactionFunc(csr))
wc, err := NewWebhookController(tc.gracePeriodRatio, tc.minGracePeriod,
client.CoreV1(), client.AdmissionregistrationV1beta1(), client.CertificatesV1beta1(),
tc.k8sCaCertFile, tc.secretNames, tc.dnsNames, tc.serviceNamespaces)
if err != nil {
t.Errorf("failed at creating webhook controller: %v", err)
continue
}
// 4. Read the signed certificate
csrName := fmt.Sprintf("domain-%s-ns-%s-secret-%s", spiffe.GetTrustDomain(), tc.secretNameSpace, tc.secretName)
_, _, err = readSignedCertificate(wc.certClient.CertificateSigningRequests(), csrName, certReadInterval, maxNumCertRead, wc.k8sCaCertFile)
if tc.expectFaill {
if err == nil {
t.Errorf("should have failed at updateMutatingWebhookConfig")
}
} else if err != nil {
t.Errorf("failed at updateMutatingWebhookConfig: %v", err)
}
}
} | explode_data.jsonl/18248 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1157
} | [
2830,
3393,
4418,
49312,
33202,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
2415,
14032,
60,
1235,
341,
197,
90059,
578,
23750,
22777,
220,
2224,
18,
17,
198,
197,
25320,
86543,
23750,
262,
882,
33795,
198,
197,
16463,
23,
82,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestExportProtocolViolations_nodelessFirstMessage(t *testing.T) {
metricSink := newMetricAppender()
_, port, doneFn := ocReceiverOnGRPCServer(t, metricSink)
defer doneFn()
metricsClient, metricsClientDoneFn, err := makeMetricsServiceClient(port)
require.NoError(t, err, "Failed to create the gRPC MetricsService_ExportClient: %v", err)
defer metricsClientDoneFn()
// Send a Nodeless first message
err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: nil})
require.NoError(t, err, "Unexpectedly failed to send the first message: %v", err)
longDuration := 2 * time.Second
testDone := make(chan bool, 1)
var wg sync.WaitGroup
wg.Add(1)
go func() {
// Our insurance policy to ensure that this test doesn't hang
// forever and should quickly report if/when we regress.
select {
case <-testDone:
t.Log("Test ended early enough")
case <-time.After(longDuration):
metricsClientDoneFn()
t.Errorf("Test took too long (%s) and is likely still hanging so this is a regression", longDuration)
}
wg.Done()
}()
// Now the response should return an error and should have been torn down
// regardless of the number of times after invocation below, or any attempt
// to send the proper/corrective data should be rejected.
for i := 0; i < 10; i++ {
recv, err := metricsClient.Recv()
if recv != nil {
t.Errorf("Iteration #%d: Unexpectedly got back a response: %#v", i, recv)
}
if err == nil {
t.Errorf("Iteration #%d: Unexpectedly got back a nil error", i)
continue
}
wantSubStr := "protocol violation: Export's first message must have a Node"
if g := err.Error(); !strings.Contains(g, wantSubStr) {
t.Errorf("Iteration #%d: Got error:\n\t%s\nWant substring:\n\t%s\n", i, g, wantSubStr)
}
// The connection should be invalid at this point and
// no attempt to send corrections should succeed.
n1 := &commonpb.Node{
Identifier: &commonpb.ProcessIdentifier{Pid: 9489, HostName: "nodejs-host"},
LibraryInfo: &commonpb.LibraryInfo{Language: commonpb.LibraryInfo_NODE_JS},
}
if err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: n1}); err == nil {
t.Errorf("Iteration #%d: Unexpectedly succeeded in sending a message upstream. Connection must be in terminal state", i)
} else if g, w := err, io.EOF; g != w {
t.Errorf("Iteration #%d:\nGot error %q\nWant error %q", i, g, w)
}
}
close(testDone)
wg.Wait()
} | explode_data.jsonl/1888 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 860
} | [
2830,
3393,
16894,
20689,
49717,
804,
5084,
1717,
5338,
2052,
1155,
353,
8840,
836,
8,
341,
2109,
16340,
45094,
1669,
501,
54310,
2164,
1659,
2822,
197,
6878,
2635,
11,
2814,
24911,
1669,
17796,
25436,
1925,
8626,
4872,
5475,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test_createRun(t *testing.T) {
tempDir := t.TempDir()
fixtureFile := filepath.Join(tempDir, "fixture.txt")
assert.NoError(t, os.WriteFile(fixtureFile, []byte("{}"), 0644))
emptyFile := filepath.Join(tempDir, "empty.txt")
assert.NoError(t, os.WriteFile(emptyFile, []byte(" \t\n"), 0644))
tests := []struct {
name string
opts *CreateOptions
stdin string
wantOut string
wantStderr string
wantParams map[string]interface{}
wantErr bool
wantBrowse string
responseStatus int
}{
{
name: "public",
opts: &CreateOptions{
Public: true,
Filenames: []string{fixtureFile},
},
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
wantStderr: "- Creating gist fixture.txt\n✓ Created gist fixture.txt\n",
wantErr: false,
wantParams: map[string]interface{}{
"description": "",
"updated_at": "0001-01-01T00:00:00Z",
"public": true,
"files": map[string]interface{}{
"fixture.txt": map[string]interface{}{
"content": "{}",
},
},
},
responseStatus: http.StatusOK,
},
{
name: "with description",
opts: &CreateOptions{
Description: "an incredibly interesting gist",
Filenames: []string{fixtureFile},
},
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
wantStderr: "- Creating gist fixture.txt\n✓ Created gist fixture.txt\n",
wantErr: false,
wantParams: map[string]interface{}{
"description": "an incredibly interesting gist",
"updated_at": "0001-01-01T00:00:00Z",
"public": false,
"files": map[string]interface{}{
"fixture.txt": map[string]interface{}{
"content": "{}",
},
},
},
responseStatus: http.StatusOK,
},
{
name: "multiple files",
opts: &CreateOptions{
Filenames: []string{fixtureFile, "-"},
},
stdin: "cool stdin content",
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
wantStderr: "- Creating gist with multiple files\n✓ Created gist fixture.txt\n",
wantErr: false,
wantParams: map[string]interface{}{
"description": "",
"updated_at": "0001-01-01T00:00:00Z",
"public": false,
"files": map[string]interface{}{
"fixture.txt": map[string]interface{}{
"content": "{}",
},
"gistfile1.txt": map[string]interface{}{
"content": "cool stdin content",
},
},
},
responseStatus: http.StatusOK,
},
{
name: "file with empty content",
opts: &CreateOptions{
Filenames: []string{emptyFile},
},
wantOut: "",
wantStderr: heredoc.Doc(`
- Creating gist empty.txt
X Failed to create gist: a gist file cannot be blank
`),
wantErr: true,
wantParams: map[string]interface{}{
"description": "",
"updated_at": "0001-01-01T00:00:00Z",
"public": false,
"files": map[string]interface{}{
"empty.txt": map[string]interface{}{"content": " \t\n"},
},
},
responseStatus: http.StatusUnprocessableEntity,
},
{
name: "stdin arg",
opts: &CreateOptions{
Filenames: []string{"-"},
},
stdin: "cool stdin content",
wantOut: "https://gist.github.com/aa5a315d61ae9438b18d\n",
wantStderr: "- Creating gist...\n✓ Created gist\n",
wantErr: false,
wantParams: map[string]interface{}{
"description": "",
"updated_at": "0001-01-01T00:00:00Z",
"public": false,
"files": map[string]interface{}{
"gistfile0.txt": map[string]interface{}{
"content": "cool stdin content",
},
},
},
responseStatus: http.StatusOK,
},
{
name: "web arg",
opts: &CreateOptions{
WebMode: true,
Filenames: []string{fixtureFile},
},
wantOut: "Opening gist.github.com/aa5a315d61ae9438b18d in your browser.\n",
wantStderr: "- Creating gist fixture.txt\n✓ Created gist fixture.txt\n",
wantErr: false,
wantBrowse: "https://gist.github.com/aa5a315d61ae9438b18d",
wantParams: map[string]interface{}{
"description": "",
"updated_at": "0001-01-01T00:00:00Z",
"public": false,
"files": map[string]interface{}{
"fixture.txt": map[string]interface{}{
"content": "{}",
},
},
},
responseStatus: http.StatusOK,
},
}
for _, tt := range tests {
reg := &httpmock.Registry{}
if tt.responseStatus == http.StatusOK {
reg.Register(
httpmock.REST("POST", "gists"),
httpmock.StringResponse(`{
"html_url": "https://gist.github.com/aa5a315d61ae9438b18d"
}`))
} else {
reg.Register(
httpmock.REST("POST", "gists"),
httpmock.StatusStringResponse(tt.responseStatus, "{}"))
}
mockClient := func() (*http.Client, error) {
return &http.Client{Transport: reg}, nil
}
tt.opts.HttpClient = mockClient
tt.opts.Config = func() (config.Config, error) {
return config.NewBlankConfig(), nil
}
ios, stdin, stdout, stderr := iostreams.Test()
tt.opts.IO = ios
browser := &cmdutil.TestBrowser{}
tt.opts.Browser = browser
_, teardown := run.Stub()
defer teardown(t)
t.Run(tt.name, func(t *testing.T) {
stdin.WriteString(tt.stdin)
if err := createRun(tt.opts); (err != nil) != tt.wantErr {
t.Errorf("createRun() error = %v, wantErr %v", err, tt.wantErr)
}
bodyBytes, _ := io.ReadAll(reg.Requests[0].Body)
reqBody := make(map[string]interface{})
err := json.Unmarshal(bodyBytes, &reqBody)
if err != nil {
t.Fatalf("error decoding JSON: %v", err)
}
assert.Equal(t, tt.wantOut, stdout.String())
assert.Equal(t, tt.wantStderr, stderr.String())
assert.Equal(t, tt.wantParams, reqBody)
reg.Verify(t)
browser.Verify(t, tt.wantBrowse)
})
}
} | explode_data.jsonl/27560 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2643
} | [
2830,
3393,
8657,
6727,
1155,
353,
8840,
836,
8,
341,
16280,
6184,
1669,
259,
65009,
6184,
741,
1166,
12735,
1703,
1669,
26054,
22363,
9758,
6184,
11,
330,
59612,
3909,
1138,
6948,
35699,
1155,
11,
2643,
4073,
1703,
94886,
1703,
11,
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 TestEmphasis(t *testing.T) {
var tests = []string{
"nothing inline\n",
"<p>nothing inline</p>\n",
"simple *inline* test\n",
"<p>simple <em>inline</em> test</p>\n",
"*at the* beginning\n",
"<p><em>at the</em> beginning</p>\n",
"at the *end*\n",
"<p>at the <em>end</em></p>\n",
"*try two* in *one line*\n",
"<p><em>try two</em> in <em>one line</em></p>\n",
"over *two\nlines* test\n",
"<p>over <em>two\nlines</em> test</p>\n",
"odd *number of* markers* here\n",
"<p>odd <em>number of</em> markers* here</p>\n",
"odd *number\nof* markers* here\n",
"<p>odd <em>number\nof</em> markers* here</p>\n",
"simple _inline_ test\n",
"<p>simple <em>inline</em> test</p>\n",
"_at the_ beginning\n",
"<p><em>at the</em> beginning</p>\n",
"at the _end_\n",
"<p>at the <em>end</em></p>\n",
"_try two_ in _one line_\n",
"<p><em>try two</em> in <em>one line</em></p>\n",
"over _two\nlines_ test\n",
"<p>over <em>two\nlines</em> test</p>\n",
"odd _number of_ markers_ here\n",
"<p>odd <em>number of</em> markers_ here</p>\n",
"odd _number\nof_ markers_ here\n",
"<p>odd <em>number\nof</em> markers_ here</p>\n",
"mix of *markers_\n",
"<p>mix of *markers_</p>\n",
}
doTestsInline(t, tests)
} | explode_data.jsonl/57347 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 629
} | [
2830,
3393,
2269,
54149,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
917,
515,
197,
197,
1,
41212,
7381,
1699,
756,
197,
197,
22476,
79,
29,
41212,
7381,
522,
79,
8449,
77,
25897,
197,
197,
1,
22944,
353,
5057,
9,
1273,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSingleOpenConn(t *testing.T) {
db := newTestDB(t, "people")
defer closeDB(t, db)
db.SetMaxOpenConns(1)
rows, err := db.Query("SELECT|people|name|")
if err != nil {
t.Fatal(err)
}
if err = rows.Close(); err != nil {
t.Fatal(err)
}
// shouldn't deadlock
rows, err = db.Query("SELECT|people|name|")
if err != nil {
t.Fatal(err)
}
if err = rows.Close(); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/16006 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 184
} | [
2830,
3393,
10888,
5002,
9701,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
501,
2271,
3506,
1155,
11,
330,
16069,
1138,
16867,
3265,
3506,
1155,
11,
2927,
692,
20939,
4202,
5974,
5002,
1109,
4412,
7,
16,
692,
68438,
11,
1848,
1669,
292... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetSize(t *testing.T) {
d, done := newDS(t, nil)
defer done()
addTestCases(t, d, testcases)
size, err := d.GetSize(bg, ds.NewKey("/a/b/c"))
if err != nil {
t.Error(err)
}
if size != len(testcases["/a/b/c"]) {
t.Error("")
}
_, err = d.GetSize(bg, ds.NewKey("/a/b/c/d"))
if err != ds.ErrNotFound {
t.Error(err)
}
} | explode_data.jsonl/921 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 175
} | [
2830,
3393,
95379,
1155,
353,
8840,
836,
8,
341,
2698,
11,
2814,
1669,
501,
5936,
1155,
11,
2092,
340,
16867,
2814,
741,
12718,
2271,
37302,
1155,
11,
294,
11,
1273,
23910,
692,
13832,
11,
1848,
1669,
294,
87472,
59360,
11,
11472,
712... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVMNoInputInstructions(t *testing.T) {
_, _, err := testVM(t, []bpf.Instruction{})
if errStr(err) != "one or more Instructions must be specified" {
t.Fatalf("unexpected error: %v", err)
}
} | explode_data.jsonl/48020 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 77
} | [
2830,
3393,
11187,
2753,
2505,
55291,
1155,
353,
8840,
836,
8,
341,
197,
6878,
8358,
1848,
1669,
1273,
11187,
1155,
11,
3056,
65,
15897,
5337,
3024,
37790,
743,
1848,
2580,
3964,
8,
961,
330,
603,
476,
803,
38297,
1969,
387,
5189,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExec(t *testing.T) {
db := newTestDB(t, "foo")
defer closeDB(t, db)
exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool")
stmt, err := db.Prepare("INSERT|t1|name=?,age=?")
if err != nil {
t.Errorf("Stmt, err = %v, %v", stmt, err)
}
defer stmt.Close()
type execTest struct {
args []interface{}
wantErr string
}
execTests := []execTest{
// Okay:
{[]interface{}{"Brad", 31}, ""},
{[]interface{}{"Brad", int64(31)}, ""},
{[]interface{}{"Bob", "32"}, ""},
{[]interface{}{7, 9}, ""},
// Invalid conversions:
{[]interface{}{"Brad", int64(0xFFFFFFFF)}, "sql: converting argument $2 type: sql/driver: value 4294967295 overflows int32"},
{[]interface{}{"Brad", "strconv fail"}, `sql: converting argument $2 type: sql/driver: value "strconv fail" can't be converted to int32`},
// Wrong number of args:
{[]interface{}{}, "sql: expected 2 arguments, got 0"},
{[]interface{}{1, 2, 3}, "sql: expected 2 arguments, got 3"},
}
for n, et := range execTests {
_, err := stmt.Exec(et.args...)
errStr := ""
if err != nil {
errStr = err.Error()
}
if errStr != et.wantErr {
t.Errorf("stmt.Execute #%d: for %v, got error %q, want error %q",
n, et.args, errStr, et.wantErr)
}
}
} | explode_data.jsonl/15969 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 520
} | [
2830,
3393,
10216,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
501,
2271,
3506,
1155,
11,
330,
7975,
1138,
16867,
3265,
3506,
1155,
11,
2927,
340,
67328,
1155,
11,
2927,
11,
330,
22599,
91,
83,
16,
91,
606,
28,
917,
11,
424,
16563,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTestString(t *testing.T) {
abi, err := JSON(strings.NewReader(jsondata2))
if err != nil {
t.Error(err)
t.FailNow()
}
if _, err := abi.Pack("string", "hello world"); err != nil {
t.Error(err)
}
} | explode_data.jsonl/64552 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 93
} | [
2830,
3393,
2271,
703,
1155,
353,
8840,
836,
8,
341,
197,
25084,
11,
1848,
1669,
4718,
51442,
68587,
9304,
691,
17,
1171,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
3964,
340,
197,
3244,
57243,
7039,
741,
197,
630,
743,
8358,
1848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestSpanStatus_Message(t *testing.T) {
ms := NewSpanStatus()
assert.EqualValues(t, "", ms.Message())
testValMessage := "cancelled"
ms.SetMessage(testValMessage)
assert.EqualValues(t, testValMessage, ms.Message())
} | explode_data.jsonl/63304 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 82
} | [
2830,
3393,
12485,
2522,
50974,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
12485,
2522,
741,
6948,
12808,
6227,
1155,
11,
7342,
9829,
8472,
2398,
18185,
2208,
2052,
1669,
330,
95282,
698,
47691,
4202,
2052,
8623,
2208,
2052,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestParamsList(t *testing.T) {
file := "params-list"
out := &bytes.Buffer{}
cmd := newPackageListParamsCmd(fs, out)
if err := cmd.RunE(cmd, []string{"../packages/testdata/zk.tgz"}); err != nil {
t.Fatal(err)
}
gp := filepath.Join("testdata", file+".golden")
if *updateGolden {
t.Log("update golden file")
if err := ioutil.WriteFile(gp, out.Bytes(), 0644); err != nil {
t.Fatalf("failed to update golden file: %s", err)
}
}
g, err := ioutil.ReadFile(gp)
if err != nil {
t.Fatalf("failed reading .golden: %s", err)
}
assert.Equal(t, out.String(), string(g), "yaml does not match .golden file %s", gp)
} | explode_data.jsonl/37750 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 259
} | [
2830,
3393,
4870,
852,
1155,
353,
8840,
836,
8,
341,
17661,
1669,
330,
3519,
9029,
698,
13967,
1669,
609,
9651,
22622,
16094,
25920,
1669,
501,
13100,
852,
4870,
15613,
31856,
11,
700,
340,
743,
1848,
1669,
5439,
16708,
36,
14160,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func Test_MapField(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
type User struct {
Id int
Name string `params:"name"`
Pass string `my-tag1:"pass1" my-tag2:"pass2" params:"pass"`
}
var user *User
m, _ := structs.MapField(user, []string{"params"})
t.Assert(len(m), 3)
_, ok := m["Id"]
t.Assert(ok, true)
_, ok = m["Name"]
t.Assert(ok, false)
_, ok = m["name"]
t.Assert(ok, true)
_, ok = m["Pass"]
t.Assert(ok, false)
_, ok = m["pass"]
t.Assert(ok, true)
})
} | explode_data.jsonl/68148 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 253
} | [
2830,
3393,
56992,
1877,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
13158,
2657,
2036,
341,
298,
67211,
256,
526,
198,
298,
21297,
914,
1565,
3519,
2974,
606,
8805,
298,
10025,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTableDeclConforms(t *testing.T) {
decl, ok := testSchema(t).lookupDeclByName("ExampleTable", false)
if !ok {
t.Fatalf("lookupDeclByName failed")
}
tableDecl := decl.(*TableDecl)
checkConforms(t,
context{},
tableDecl,
[]conformTest{
conformOk{gidlir.Record{
Name: "ExampleTable",
Fields: []gidlir.Field{
{Key: gidlir.FieldKey{Name: "s"}, Value: "foo"},
},
}},
conformFail{gidlir.Record{
Name: "ExampleTable",
Fields: []gidlir.Field{
{Key: gidlir.FieldKey{Name: "DefinitelyNotS"}, Value: "foo"},
},
}, "field DefinitelyNotS: unknown"},
conformFail{gidlir.Record{
Name: "DefinitelyNotExampleTable",
Fields: []gidlir.Field{
{Key: gidlir.FieldKey{Name: "s"}, Value: "foo"},
},
}, "expecting table test.mixer/ExampleTable"},
conformFail{nil, "expecting non-null table"},
conformFail{"foo", "expecting table"},
conformFail{0, "expecting table"},
},
)
} | explode_data.jsonl/21402 | {
"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,
2556,
21629,
1109,
9807,
1155,
353,
8840,
836,
8,
341,
197,
10005,
11,
5394,
1669,
1273,
8632,
1155,
568,
21020,
21629,
16898,
445,
13314,
2556,
497,
895,
340,
743,
753,
562,
341,
197,
3244,
30762,
445,
21020,
21629,
16898,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetTotalUsersStat(t *testing.T) {
th := Setup(t)
defer th.TearDown()
total, _ := th.Server.Store.User().Count(model.UserCountOptions{
IncludeDeleted: false,
IncludeBotAccounts: true,
})
rstats, _, err := th.Client.GetTotalUsersStats("")
require.NoError(t, err)
require.Equal(t, total, rstats.TotalUsersCount)
} | explode_data.jsonl/47504 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 132
} | [
2830,
3393,
1949,
7595,
7137,
15878,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
340,
16867,
270,
836,
682,
4454,
2822,
34493,
11,
716,
1669,
270,
22997,
38047,
7344,
1005,
2507,
7635,
7344,
2507,
3798,
515,
197,
197,
22283,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGoCloak_ClientSecret(t *testing.T) {
t.Parallel()
cfg := GetConfig(t)
client := NewClientWithDebug(t)
token := GetAdminToken(t, client)
testClient := Client{
ID: GetRandomName("gocloak-client-secret-id-"),
ClientID: GetRandomName("gocloak-client-secret-client-id-"),
Secret: "initial-secret-key",
ServiceAccountsEnabled: true,
StandardFlowEnabled: true,
Enabled: true,
FullScopeAllowed: true,
Protocol: "openid-connect",
RedirectURIs: []string{"localhost"},
ClientAuthenticatorType: "client-secret",
}
err := client.CreateClient(
token.AccessToken,
cfg.GoCloak.Realm,
testClient,
)
FailIfErr(t, err, "CreateClient failed")
oldCreds, err := client.GetClientSecret(
token.AccessToken,
cfg.GoCloak.Realm,
testClient.ID,
)
FailIfErr(t, err, "GetClientSecret failed")
regeneratedCreds, err := client.RegenerateClientSecret(
token.AccessToken,
cfg.GoCloak.Realm,
testClient.ID,
)
FailIfErr(t, err, "RegenerateClientSecret failed")
AssertNotEquals(t, oldCreds.Value, regeneratedCreds.Value)
err = client.DeleteClient(token.AccessToken, cfg.GoCloak.Realm, testClient.ID)
assert.NoError(t, err, "DeleteClient failed")
} | explode_data.jsonl/79569 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 561
} | [
2830,
3393,
10850,
51236,
585,
46102,
19773,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
50286,
1669,
2126,
2648,
1155,
340,
25291,
1669,
1532,
2959,
2354,
7939,
1155,
340,
43947,
1669,
2126,
7210,
3323,
1155,
11,
2943,
692,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestApplyNewObject(t *testing.T) {
tests := []struct {
gvk schema.GroupVersionKind
obj []byte
}{
{
gvk: schema.FromAPIVersionAndKind("v1", "Pod"),
obj: getObjectBytes("pod.yaml"),
},
{
gvk: schema.FromAPIVersionAndKind("v1", "Node"),
obj: getObjectBytes("node.yaml"),
},
{
gvk: schema.FromAPIVersionAndKind("v1", "Endpoints"),
obj: getObjectBytes("endpoints.yaml"),
},
}
for _, test := range tests {
t.Run(test.gvk.String(), func(t *testing.T) {
f := NewDefaultTestFieldManager(test.gvk)
appliedObj := &unstructured.Unstructured{Object: map[string]interface{}{}}
if err := yaml.Unmarshal(test.obj, &appliedObj.Object); err != nil {
t.Fatalf("error decoding YAML: %v", err)
}
if err := f.Apply(appliedObj, "fieldmanager_test", false); err != nil {
t.Fatal(err)
}
})
}
} | explode_data.jsonl/53746 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 371
} | [
2830,
3393,
28497,
3564,
1190,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
3174,
48363,
10802,
5407,
5637,
10629,
198,
197,
22671,
3056,
3782,
198,
197,
59403,
197,
197,
515,
298,
3174,
48363,
25,
10802,
11439,
7082... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBasicAuthPassword(t *testing.T) {
providerServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
logger.Printf("%#v", r)
var payload string
switch r.URL.Path {
case "/oauth/token":
payload = `{"access_token": "my_auth_token"}`
default:
payload = r.Header.Get("Authorization")
if payload == "" {
payload = "No Authorization header found."
}
}
w.WriteHeader(200)
_, err := w.Write([]byte(payload))
if err != nil {
t.Fatal(err)
}
}))
basicAuthPassword := "This is a secure password"
opts := baseTestOptions()
opts.UpstreamServers = options.UpstreamConfig{
Upstreams: []options.Upstream{
{
ID: providerServer.URL,
Path: "/",
URI: providerServer.URL,
},
},
}
opts.Cookie.Secure = false
opts.InjectRequestHeaders = []options.Header{
{
Name: "Authorization",
Values: []options.HeaderValue{
{
ClaimSource: &options.ClaimSource{
Claim: "email",
BasicAuthPassword: &options.SecretSource{
Value: []byte(basicAuthPassword),
},
},
},
},
},
}
err := validation.Validate(opts)
assert.NoError(t, err)
providerURL, _ := url.Parse(providerServer.URL)
const emailAddress = "john.doe@example.com"
opts.SetProvider(NewTestProvider(providerURL, emailAddress))
proxy, err := NewOAuthProxy(opts, func(email string) bool {
return email == emailAddress
})
if err != nil {
t.Fatal(err)
}
// Save the required session
rw := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/", nil)
err = proxy.sessionStore.Save(rw, req, &sessions.SessionState{
Email: emailAddress,
})
assert.NoError(t, err)
// Extract the cookie value to inject into the test request
cookie := rw.Header().Values("Set-Cookie")[0]
req, _ = http.NewRequest("GET", "/", nil)
req.Header.Set("Cookie", cookie)
rw = httptest.NewRecorder()
proxy.ServeHTTP(rw, req)
// The username in the basic auth credentials is expected to be equal to the email address from the
// auth response, so we use the same variable here.
expectedHeader := "Basic " + base64.StdEncoding.EncodeToString([]byte(emailAddress+":"+basicAuthPassword))
assert.Equal(t, expectedHeader, rw.Body.String())
providerServer.Close()
} | explode_data.jsonl/36385 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 866
} | [
2830,
3393,
15944,
5087,
4876,
1155,
353,
8840,
836,
8,
341,
197,
19979,
5475,
1669,
54320,
70334,
7121,
5475,
19886,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
17060,
19367,
4430,
2,
85,
497,
435,
340,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_Revisions_AcceptAllRevisions(t *testing.T) {
config := ReadConfiguration(t)
client, ctx := PrepareTest(t, config)
remoteDataFolder := remoteBaseTestDataFolder + "/DocumentActions/Revisions"
localFile := "Common/test_multi_pages.docx"
remoteFileName := "TestAcceptAllRevisions.docx"
UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + "/" + remoteFileName)
options := map[string]interface{}{
"folder": remoteDataFolder,
"destFileName": baseTestOutPath + "/" + remoteFileName,
}
request := &models.AcceptAllRevisionsRequest{
Name: ToStringPointer(remoteFileName),
Optionals: options,
}
actual, _, err := client.WordsApi.AcceptAllRevisions(ctx, request)
if err != nil {
t.Error(err)
}
assert.NotNil(t, actual.Result, "Validate AcceptAllRevisions response.");
assert.NotNil(t, actual.Result.Dest, "Validate AcceptAllRevisions response.");
} | explode_data.jsonl/30932 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 359
} | [
2830,
3393,
50693,
40015,
1566,
66,
1484,
2403,
693,
40015,
1155,
353,
8840,
836,
8,
341,
262,
2193,
1669,
4457,
7688,
1155,
340,
262,
2943,
11,
5635,
1669,
31166,
2271,
1155,
11,
2193,
340,
262,
8699,
1043,
13682,
1669,
8699,
3978,
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... | 2 |
func TestWorkflowWithNSteps(t *testing.T) {
// This test is formatted a bit weird to test
// that the steps in a Workflow are executed.
// A pointer to a variable stepCount is passed
// into the Step arguments and every Step increments
// x by 1. To test x gets executed we do some pointer
// manipulation for testing purposes. Its not really a great
// idea in practice to be passing pointers to values since
// erroneous steps could change the value and error out entire workflows.
// the variable under tests we wanna increase
x := 0
// Step function used to increment x
incX := func(args interface{}) error {
x := args.(map[string]*int)["stepCount"]
*x++
return nil
}
// argument passed to every Step in the Workflow
args := map[string]*int{"stepCount": &x}
wf := NewWorkflow("testSteps", args)
stepCount := 20
for i := 0; i < stepCount; i++ {
stepName := fmt.Sprintf("step_%d", i)
// add new Step to the Workflow
// in this example we just want to create stepCount amount
// of steps and incremet x, stepCount amount of times.
wf.With(stepName, incX)
}
// Start the Workflow
err := wf.Start()
assert.Nil(t, err)
assert.Equal(t, stepCount, *args["stepCount"])
} | explode_data.jsonl/15565 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 382
} | [
2830,
3393,
62768,
2354,
45,
33951,
1155,
353,
8840,
836,
8,
341,
197,
322,
1096,
1273,
374,
23126,
264,
2699,
16283,
311,
1273,
198,
197,
322,
429,
279,
7354,
304,
264,
60173,
525,
15695,
624,
197,
322,
362,
7445,
311,
264,
3890,
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 TestMapProxy_PutTransientWhenExpire(t *testing.T) {
testKey := "testingKey"
testValue := "testingValue"
mp.Put(testKey, testValue)
mp.PutTransient(testKey, "nextValue", 1, time.Millisecond)
time.Sleep(5 * time.Second)
res, err := mp.Get(testKey)
AssertNilf(t, err, res, "putTransient failed")
mp.Clear()
} | explode_data.jsonl/56973 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 126
} | [
2830,
3393,
2227,
16219,
1088,
332,
48183,
4498,
8033,
554,
1155,
353,
8840,
836,
8,
341,
18185,
1592,
1669,
330,
8840,
1592,
698,
18185,
1130,
1669,
330,
8840,
1130,
698,
53230,
39825,
8623,
1592,
11,
1273,
1130,
340,
53230,
39825,
481... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRedisPubsubSuite(t *testing.T) {
pool, _ := conn.New(conn.ConnectionParam{
Address: "127.0.0.1:6379",
}, 1)
suite.Run(t, &RedisPubsubSuite{RedisSuite: test.NewSuite(pool)})
} | explode_data.jsonl/25277 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 86
} | [
2830,
3393,
48137,
29162,
1966,
28000,
1155,
353,
8840,
836,
8,
341,
85273,
11,
716,
1669,
4534,
7121,
20571,
17463,
2001,
515,
197,
98090,
25,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
21,
18,
22,
24,
756,
197,
2137,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_fsSource_ReadUp_FileError(t *testing.T) {
s := getTestSource(t, "sample-migrations")
s.migrations.Append(&migration{
Version: 4,
Identifier: "invalid",
Direction: "up",
Raw: "no_such_file",
})
_, _, err := s.ReadUp(4)
if !errors.Is(err, fs.ErrNotExist) {
t.Fatalf("expected ErrNotExist, got: %v", err)
}
} | explode_data.jsonl/81894 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 162
} | [
2830,
3393,
34470,
3608,
38381,
2324,
34061,
1454,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
633,
2271,
3608,
1155,
11,
330,
13611,
1448,
17824,
1138,
1903,
744,
17824,
8982,
2099,
80227,
515,
197,
77847,
25,
262,
220,
19,
345,
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... | 2 |
func TestIsEqFieldValidation(t *testing.T) {
validate := New()
var j uint64
var k float64
s := "abcd"
i := 1
j = 1
k = 1.543
arr := []string{"test"}
now := time.Now().UTC()
var j2 uint64
var k2 float64
s2 := "abcd"
i2 := 1
j2 = 1
k2 = 1.543
arr2 := []string{"test"}
arr3 := []string{"test", "test2"}
now2 := now
errs := validate.VarWithValue(s, s2, "eqfield")
Equal(t, errs, nil)
errs = validate.VarWithValue(i2, i, "eqfield")
Equal(t, errs, nil)
errs = validate.VarWithValue(j2, j, "eqfield")
Equal(t, errs, nil)
errs = validate.VarWithValue(k2, k, "eqfield")
Equal(t, errs, nil)
errs = validate.VarWithValue(arr2, arr, "eqfield")
Equal(t, errs, nil)
errs = validate.VarWithValue(now2, now, "eqfield")
Equal(t, errs, nil)
errs = validate.VarWithValue(arr3, arr, "eqfield")
NotEqual(t, errs, nil)
AssertError(t, errs, "", "", "", "", "eqfield")
type Test struct {
Start *time.Time `validate:"eqfield=End"`
End *time.Time
}
sv := &Test{
Start: &now,
End: &now,
}
errs = validate.Struct(sv)
Equal(t, errs, nil)
now3 := time.Now().UTC()
sv = &Test{
Start: &now,
End: &now3,
}
errs = validate.Struct(sv)
NotEqual(t, errs, nil)
AssertError(t, errs, "Test.Start", "Test.Start", "Start", "Start", "eqfield")
errs = validate.VarWithValue(nil, 1, "eqfield")
NotEqual(t, errs, nil)
AssertError(t, errs, "", "", "", "", "eqfield")
channel := make(chan string)
errs = validate.VarWithValue(5, channel, "eqfield")
NotEqual(t, errs, nil)
AssertError(t, errs, "", "", "", "", "eqfield")
errs = validate.VarWithValue(5, now, "eqfield")
NotEqual(t, errs, nil)
AssertError(t, errs, "", "", "", "", "eqfield")
type Test2 struct {
Start *time.Time `validate:"eqfield=NonExistantField"`
End *time.Time
}
sv2 := &Test2{
Start: &now,
End: &now,
}
errs = validate.Struct(sv2)
NotEqual(t, errs, nil)
AssertError(t, errs, "Test2.Start", "Test2.Start", "Start", "Start", "eqfield")
type Inner struct {
Name string
}
type TStruct struct {
Inner *Inner
CreatedAt *time.Time `validate:"eqfield=Inner"`
}
inner := &Inner{
Name: "NAME",
}
test := &TStruct{
Inner: inner,
CreatedAt: &now,
}
errs = validate.Struct(test)
NotEqual(t, errs, nil)
AssertError(t, errs, "TStruct.CreatedAt", "TStruct.CreatedAt", "CreatedAt", "CreatedAt", "eqfield")
} | explode_data.jsonl/77286 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1058
} | [
2830,
3393,
3872,
27312,
1877,
13799,
1155,
353,
8840,
836,
8,
1476,
197,
7067,
1669,
1532,
2822,
2405,
502,
2622,
21,
19,
198,
2405,
595,
2224,
21,
19,
198,
1903,
1669,
330,
68644,
698,
8230,
1669,
220,
16,
198,
12428,
284,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCreatePipeline(t *testing.T) {
store, _, pipeline := initWithPipeline(t)
defer store.Close()
pipelineExpected := &model.Pipeline{
UUID: DefaultFakeUUID,
CreatedAtInSec: 1,
Name: "p1",
Parameters: "[{\"name\":\"param1\"}]",
Status: model.PipelineReady,
}
assert.Equal(t, pipelineExpected, pipeline)
} | explode_data.jsonl/28347 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 164
} | [
2830,
3393,
4021,
34656,
1155,
353,
8840,
836,
8,
341,
57279,
11,
8358,
15301,
1669,
13864,
34656,
1155,
340,
16867,
3553,
10421,
741,
3223,
8790,
18896,
1669,
609,
2528,
1069,
8790,
515,
197,
15980,
6463,
25,
1843,
7899,
52317,
24754,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTable_ReadRandomNodesGetAll(t *testing.T) {
cfg := &quick.Config{
MaxCount: 200,
Rand: rand.New(rand.NewSource(time.Now().Unix())),
Values: func(args []reflect.Value, rand *rand.Rand) {
args[0] = reflect.ValueOf(make([]*enode.Node, rand.Intn(1000)))
},
}
test := func(buf []*enode.Node) bool {
transport := newPingRecorder()
tab, db := newTestTable(transport)
defer db.Close()
defer tab.close()
<-tab.initDone
for i := 0; i < len(buf); i++ {
ld := cfg.Rand.Intn(len(tab.buckets))
fillTable(tab, []*node{nodeAtDistance(tab.self().ID(), ld, intIP(ld))})
}
gotN := tab.ReadRandomNodes(buf)
if gotN != tab.len() {
t.Errorf("wrong number of nodes, got %d, want %d", gotN, tab.len())
return false
}
if hasDuplicates(wrapNodes(buf[:gotN])) {
t.Errorf("result contains duplicates")
return false
}
return true
}
if err := quick.Check(test, cfg); err != nil {
t.Error(err)
}
} | explode_data.jsonl/11768 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 410
} | [
2830,
3393,
2556,
38381,
13999,
12288,
1949,
2403,
1155,
353,
8840,
836,
8,
341,
50286,
1669,
609,
27763,
10753,
515,
197,
197,
5974,
2507,
25,
220,
17,
15,
15,
345,
197,
11143,
437,
25,
257,
10382,
7121,
37595,
7121,
3608,
9730,
1324... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateRevWithVPA(t *testing.T) {
controllerConfig := getTestControllerConfig()
kubeClient, _, servingClient, cachingClient, vpaClient, controller, kubeInformer, _, servingInformer, cachingInformer, _, _ := newTestControllerWithConfig(t, controllerConfig, &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: system.Namespace,
Name: autoscaler.ConfigName,
},
Data: map[string]string{
"enable-vertical-pod-autoscaling": "true",
"max-scale-up-rate": "1.0",
"container-concurrency-target-percentage": "0.5",
"container-concurrency-target-default": "10.0",
"stable-window": "5m",
"panic-window": "10s",
"scale-to-zero-threshold": "10m",
"concurrency-quantum-of-time": "100ms",
"tick-interval": "2s",
},
}, getTestControllerConfigMap(),
)
revClient := servingClient.ServingV1alpha1().Revisions(testNamespace)
rev := getTestRevision()
if !controller.Reconciler.(*Reconciler).getAutoscalerConfig().EnableVPA {
t.Fatal("EnableVPA = false, want true")
}
createRevision(t, kubeClient, kubeInformer, servingClient, servingInformer, cachingClient, cachingInformer, controller, rev)
createdVPA, err := vpaClient.PocV1alpha1().VerticalPodAutoscalers(testNamespace).Get(resourcenames.VPA(rev), metav1.GetOptions{})
if err != nil {
t.Fatalf("Couldn't get vpa: %v", err)
}
createdRev, err := revClient.Get(rev.Name, metav1.GetOptions{})
if err != nil {
t.Fatalf("Couldn't get revision: %v", err)
}
// Verify label selectors match
if want, got := createdRev.ObjectMeta.Labels, createdVPA.Spec.Selector.MatchLabels; reflect.DeepEqual(want, got) {
t.Fatalf("Mismatched labels. Wanted %v. Got %v.", want, got)
}
} | explode_data.jsonl/27417 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 777
} | [
2830,
3393,
4021,
36184,
2354,
53,
8041,
1155,
353,
8840,
836,
8,
341,
61615,
2648,
1669,
633,
2271,
2051,
2648,
741,
16463,
3760,
2959,
11,
8358,
13480,
2959,
11,
47430,
2959,
11,
348,
6595,
2959,
11,
6461,
11,
80958,
641,
34527,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestRunInContainerNoSuchPod(t *testing.T) {
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
defer testKubelet.Cleanup()
kubelet := testKubelet.kubelet
fakeRuntime := testKubelet.fakeRuntime
fakeRuntime.PodList = []*containertest.FakePod{}
podName := "podFoo"
podNamespace := "nsFoo"
containerName := "containerFoo"
output, err := kubelet.RunInContainer(
kubecontainer.GetPodFullName(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: podName, Namespace: podNamespace}}),
"",
containerName,
[]string{"ls"})
assert.Error(t, err)
assert.Nil(t, output, "output should be nil")
} | explode_data.jsonl/49882 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 233
} | [
2830,
3393,
6727,
641,
4502,
65531,
23527,
1155,
353,
8840,
836,
8,
341,
18185,
42,
3760,
1149,
1669,
501,
2271,
42,
3760,
1149,
1155,
11,
895,
1391,
6461,
30485,
89306,
5462,
639,
340,
16867,
1273,
42,
3760,
1149,
727,
60639,
741,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestLine(t *testing.T) {
cases := []struct {
name string
input string
expected int
}{
{
`line from tagaddress`,
`foo foo 99;"`,
99,
},
{
`line from tagfield`,
`foo foo /^foo$/;" line:100`,
100,
},
{
`no line`,
`foo foo /^foo$/;"`,
-1,
},
}
for _, tc := range cases {
r := NewReader(strings.NewReader(tc.input))
tags := r.ReadAll()
if actual := tags[0].Line(); actual != tc.expected {
t.Errorf(ctagsTestFormat, tc.name, tc.input, tc.expected, actual)
}
}
} | explode_data.jsonl/58898 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 257
} | [
2830,
3393,
2460,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
22427,
262,
914,
198,
197,
42400,
526,
198,
197,
59403,
197,
197,
515,
298,
197,
63,
1056,
504,
4772,
4995,
12892,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInterface(t *testing.T) {
testStr := `<?
interface MyInterface extends YourInterface, HerInterface {
public function TheirFunc();
private function MyFunc();
}`
p := NewParser()
p.disableScoping = true
a, _ := p.Parse("test.php", testStr)
tree := &ast.Interface{
Name: "MyInterface",
Inherits: []string{"YourInterface", "HerInterface"},
Methods: []ast.Method{
{
Visibility: ast.Public,
FunctionStmt: &ast.FunctionStmt{
FunctionDefinition: &ast.FunctionDefinition{
Name: "TheirFunc",
Arguments: []*ast.FunctionArgument{},
},
},
},
{
Visibility: ast.Private,
FunctionStmt: &ast.FunctionStmt{
FunctionDefinition: &ast.FunctionDefinition{
Name: "MyFunc",
Arguments: []*ast.FunctionArgument{},
},
},
},
},
}
if !assertEquals(a.Nodes[0], tree) {
t.Fatalf("Interface did not parse correctly")
}
} | explode_data.jsonl/28452 | {
"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,
5051,
1155,
353,
8840,
836,
8,
341,
18185,
2580,
1669,
1565,
53075,
220,
3749,
3017,
5051,
2239,
4615,
5051,
11,
6252,
5051,
341,
262,
584,
729,
10964,
9626,
543,
262,
869,
729,
3017,
9626,
543,
220,
335,
3989,
3223,
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 TestInitializeRemoteStorageIdentifierMismatch(t *testing.T) {
require.NoError(t, os.MkdirAll("data", 0777))
defer os.RemoveAll("data")
s := DefaultServer()
m := memory.Open()
storeData(t, m, "immudb.identifier", []byte{1, 2, 3, 4, 5})
_, err := getOrSetUUID("./data", "./data")
require.NoError(t, err)
err = s.initializeRemoteStorage(m)
require.Equal(t, ErrRemoteStorageDoesNotMatch, err)
} | explode_data.jsonl/38341 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 160
} | [
2830,
3393,
9928,
24703,
5793,
8714,
82572,
1155,
353,
8840,
836,
8,
341,
17957,
35699,
1155,
11,
2643,
1321,
12438,
2403,
445,
691,
497,
220,
15,
22,
22,
22,
1171,
16867,
2643,
84427,
445,
691,
5130,
1903,
1669,
7899,
5475,
741,
2109... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBaseName(t *testing.T) {
for _, test := range baseFileNames {
output := BaseName(test.input)
if output != test.expected {
t.Fatalf(Format, test.input, test.expected, output)
}
}
} | explode_data.jsonl/7069 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 76
} | [
2830,
3393,
3978,
675,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
2331,
1703,
7980,
341,
197,
21170,
1669,
5351,
675,
8623,
10046,
340,
197,
743,
2550,
961,
1273,
56835,
341,
298,
3244,
30762,
7,
4061,
11,
1273,
10046... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGenerateUnsealedCID(t *testing.T) {
pt := abi.RegisteredSealProof_StackedDrg2KiBV1
ups := int(abi.PaddedPieceSize(2048).Unpadded())
commP := func(b []byte) cid.Cid {
pf, werr, err := ToReadableFile(bytes.NewReader(b), int64(len(b)))
require.NoError(t, err)
c, err := ffi.GeneratePieceCIDFromFile(pt, pf, abi.UnpaddedPieceSize(len(b)))
require.NoError(t, err)
require.NoError(t, werr())
return c
}
testCommEq := func(name string, in [][]byte, expect [][]byte) {
t.Run(name, func(t *testing.T) {
upi := make([]abi.PieceInfo, len(in))
for i, b := range in {
upi[i] = abi.PieceInfo{
Size: abi.UnpaddedPieceSize(len(b)).Padded(),
PieceCID: commP(b),
}
}
sectorPi := []abi.PieceInfo{
{
Size: 2048,
PieceCID: commP(bytes.Join(expect, nil)),
},
}
expectCid, err := GenerateUnsealedCID(pt, sectorPi)
require.NoError(t, err)
actualCid, err := GenerateUnsealedCID(pt, upi)
require.NoError(t, err)
require.Equal(t, expectCid, actualCid)
})
}
barr := func(b byte, den int) []byte {
return bytes.Repeat([]byte{b}, ups/den)
}
// 0000
testCommEq("zero",
nil,
[][]byte{barr(0, 1)},
)
// 1111
testCommEq("one",
[][]byte{barr(1, 1)},
[][]byte{barr(1, 1)},
)
// 11 00
testCommEq("one|2",
[][]byte{barr(1, 2)},
[][]byte{barr(1, 2), barr(0, 2)},
)
// 1 0 00
testCommEq("one|4",
[][]byte{barr(1, 4)},
[][]byte{barr(1, 4), barr(0, 4), barr(0, 2)},
)
// 11 2 0
testCommEq("one|2-two|4",
[][]byte{barr(1, 2), barr(2, 4)},
[][]byte{barr(1, 2), barr(2, 4), barr(0, 4)},
)
// 1 0 22
testCommEq("one|4-two|2",
[][]byte{barr(1, 4), barr(2, 2)},
[][]byte{barr(1, 4), barr(0, 4), barr(2, 2)},
)
// 1 0 22 0000
testCommEq("one|8-two|4",
[][]byte{barr(1, 8), barr(2, 4)},
[][]byte{barr(1, 8), barr(0, 8), barr(2, 4), barr(0, 2)},
)
// 11 2 0 0000
testCommEq("one|4-two|8",
[][]byte{barr(1, 4), barr(2, 8)},
[][]byte{barr(1, 4), barr(2, 8), barr(0, 8), barr(0, 2)},
)
// 1 0 22 3 0 00 4444 5 0 00
testCommEq("one|16-two|8-three|16-four|4-five|16",
[][]byte{barr(1, 16), barr(2, 8), barr(3, 16), barr(4, 4), barr(5, 16)},
[][]byte{barr(1, 16), barr(0, 16), barr(2, 8), barr(3, 16), barr(0, 16), barr(0, 8), barr(4, 4), barr(5, 16), barr(0, 16), barr(0, 8)},
)
} | explode_data.jsonl/21306 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1215
} | [
2830,
3393,
31115,
1806,
75940,
54146,
1155,
353,
8840,
836,
8,
341,
60796,
1669,
61050,
19983,
291,
1514,
278,
31076,
62,
4336,
291,
35,
1984,
17,
72572,
59343,
16,
198,
197,
8602,
1669,
526,
7,
25084,
1069,
16828,
31209,
1695,
7,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSetGetOneOfDefaultValue(t *testing.T) {
md, err := desc.LoadMessageDescriptorForMessage((*testprotos.OneOfMessage)(nil))
testutil.Ok(t, err)
oneof := md.GetFile().FindSymbol("testprotos.OneOfMessage.value").(*desc.OneOfDescriptor)
var testCases = []struct {
fieldName string
fieldValue interface{}
}{
{"binary_value", []byte{}},
{"string_value", ""},
{"boolean_value", false},
{"int_value", int32(0)},
{"int64_value", int64(0)},
{"double_value", float64(0)},
{"float_value", float32(0)},
{"msg_value", (*testprotos.OneOfMessage)(nil)},
}
for _, tc := range testCases {
dm := NewMessage(md)
field := md.FindFieldByName(tc.fieldName)
dm.SetField(field, tc.fieldValue)
// Ensure that the zero-value is set correctly
oneOfField, resultValue := dm.GetOneOfField(oneof)
testutil.Eq(t, tc.fieldValue, resultValue)
testutil.Eq(t, field, oneOfField)
// Ensure that clearing the field results in no field being set
dm.ClearField(field)
oneOfField, resultValue = dm.GetOneOfField(oneof)
testutil.Eq(t, nil, resultValue)
testutil.Eq(t, (*desc.FieldDescriptor)(nil), oneOfField)
}
} | explode_data.jsonl/40962 | {
"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,
1649,
1949,
3966,
2124,
41533,
1155,
353,
8840,
836,
8,
341,
84374,
11,
1848,
1669,
6560,
13969,
2052,
11709,
2461,
2052,
26609,
1944,
4391,
436,
37067,
2124,
2052,
2376,
8385,
1171,
18185,
1314,
54282,
1155,
11,
1848,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func Test_PrintBoolean(t *testing.T) {
cases := []bool{
true, false, false, true,
}
for _, c := range cases {
output := Print(c)
assert.Equal(t, fmt.Sprintf("%+v\n", c), output)
}
} | explode_data.jsonl/43706 | {
"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,
45788,
6890,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
2641,
515,
197,
42808,
11,
895,
11,
895,
11,
830,
345,
197,
630,
2023,
8358,
272,
1669,
2088,
5048,
341,
197,
21170,
1669,
8213,
1337,
692,
197,
6948,
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
] | 2 |
func TestIdsDeduplicated(t *testing.T) {
fileCheck1 := &ipb.FileCheck{
FilesToCheck: []*ipb.FileSet{testconfigcreator.SingleFileWithPath("/path1")},
CheckType: &ipb.FileCheck_Existence{Existence: &ipb.ExistenceCheck{ShouldExist: true}},
}
fileCheck2 := &ipb.FileCheck{
FilesToCheck: []*ipb.FileSet{testconfigcreator.SingleFileWithPath("/path1")},
CheckType: &ipb.FileCheck_Existence{Existence: &ipb.ExistenceCheck{ShouldExist: false}},
}
scanInstruction1 := testconfigcreator.NewFileScanInstruction([]*ipb.FileCheck{fileCheck1})
scanInstruction2 := testconfigcreator.NewFileScanInstruction([]*ipb.FileCheck{fileCheck2})
config1 := testconfigcreator.NewBenchmarkConfig(t, "id", scanInstruction1)
config2 := testconfigcreator.NewBenchmarkConfig(t, "id", scanInstruction2)
checks, err := configchecks.CreateChecksFromConfig(
context.Background(),
&apb.ScanConfig{
BenchmarkConfigs: []*apb.BenchmarkConfig{config1, config2},
},
newFakeAPI())
if err != nil {
t.Fatalf("configchecks.CreateChecksFromConfig([%v %v]) returned an error: %v", config1, config2, err)
}
if len(checks) != 1 {
t.Errorf("configchecks.CreateChecksFromConfig([%v %v]) expected to create one check ,got %d", config1, config2, len(checks))
}
wantIDs := []string{"id"}
if diff := cmp.Diff(wantIDs, checks[0].BenchmarkIDs()); diff != "" {
t.Errorf("%v.BenchmarkIDs() returned unexpected diff (-want +got):\n%s", checks[0], diff)
}
} | explode_data.jsonl/24462 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 529
} | [
2830,
3393,
12701,
35,
291,
98984,
1155,
353,
8840,
836,
8,
341,
17661,
3973,
16,
1669,
609,
573,
65,
8576,
3973,
515,
197,
197,
10809,
1249,
3973,
25,
29838,
573,
65,
8576,
1649,
90,
1944,
1676,
32398,
23119,
1703,
89534,
4283,
2343,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMarshal2(t *testing.T) {
view := NewBlockView(123455)
view.AppliedIBatch = nil
view.DeleteMask = &roaring.Bitmap{}
view.DeleteMask.Add(0)
view.DeleteMask.Add(3)
view.DeleteMask.Add(88)
// _, err = view.Marshal()
// assert.Nil(t, err)
buf, err := view.Marshal()
assert.Nil(t, err)
view2 := NewBlockView(0)
view2.Unmarshal(buf)
assert.Equal(t, uint64(123455), view2.Ts)
assert.Equal(t, 3, int(view2.DeleteMask.GetCardinality()))
assert.True(t, view2.DeleteMask.Contains(0))
assert.True(t, view2.DeleteMask.Contains(3))
assert.True(t, view2.DeleteMask.Contains(88))
assert.Nil(t, view2.AppliedIBatch)
} | explode_data.jsonl/42523 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 272
} | [
2830,
3393,
55438,
17,
1155,
353,
8840,
836,
8,
341,
36867,
1669,
1532,
4713,
851,
7,
16,
17,
18,
19,
20,
20,
692,
36867,
22829,
3440,
3256,
754,
284,
2092,
271,
36867,
18872,
12686,
284,
609,
299,
3249,
36181,
16094,
36867,
18872,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNeedMoreAddresses(t *testing.T) {
n := New("testneedmoreaddresses", lookupFunc)
addrsToAdd := 1500
b := n.NeedMoreAddresses()
if !b {
t.Errorf("Expected that we need more addresses")
}
addrs := make([]*wire.NetAddress, addrsToAdd)
var err error
for i := 0; i < addrsToAdd; i++ {
s := fmt.Sprintf("%d.%d.173.147:8333", i/128+60, i%128+60)
addrs[i], err = n.DeserializeNetAddress(s)
if err != nil {
t.Errorf("Failed to turn %s into an address: %v", s, err)
}
}
srcAddr := wire.NewNetAddressIPPort(net.IPv4(173, 144, 173, 111), 8333, 0)
n.AddAddresses(addrs, srcAddr)
numAddrs := n.numAddresses()
if numAddrs > addrsToAdd {
t.Errorf("Number of addresses is too many %d vs %d", numAddrs, addrsToAdd)
}
b = n.NeedMoreAddresses()
if b {
t.Errorf("Expected that we don't need more addresses")
}
} | explode_data.jsonl/26480 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 354
} | [
2830,
3393,
23657,
7661,
52290,
1155,
353,
8840,
836,
8,
341,
9038,
1669,
1532,
445,
1944,
17046,
6384,
53789,
497,
18615,
9626,
340,
12718,
5428,
52113,
1669,
220,
16,
20,
15,
15,
198,
2233,
1669,
308,
2067,
12051,
7661,
52290,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestMultistoreSnapshot_Errors(t *testing.T) {
store := newMultiStoreWithMixedMountsAndBasicData(dbm.NewMemDB())
testcases := map[string]struct {
height uint64
format uint32
expectType error
}{
"0 height": {0, snapshottypes.CurrentFormat, nil},
"0 format": {1, 0, snapshottypes.ErrUnknownFormat},
"unknown height": {9, snapshottypes.CurrentFormat, nil},
"unknown format": {1, 9, snapshottypes.ErrUnknownFormat},
}
for name, tc := range testcases {
tc := tc
t.Run(name, func(t *testing.T) {
_, err := store.Snapshot(tc.height, tc.format)
require.Error(t, err)
if tc.expectType != nil {
assert.True(t, errors.Is(err, tc.expectType))
}
})
}
} | explode_data.jsonl/44875 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 291
} | [
2830,
3393,
40404,
380,
460,
15009,
93623,
1087,
1155,
353,
8840,
836,
8,
341,
57279,
1669,
501,
20358,
6093,
2354,
86433,
16284,
82,
3036,
15944,
1043,
9791,
76,
7121,
18816,
3506,
12367,
18185,
23910,
1669,
2415,
14032,
60,
1235,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestClientSuite(t *testing.T) {
suite.Run(t, &ClientTestSuite{
etcdConfig: struct {
name string
endpoints []string
timeout time.Duration
heartbeat int
}{
name: "test",
endpoints: []string{"localhost:2381"},
timeout: time.Second,
heartbeat: 1,
},
})
} | explode_data.jsonl/8454 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 136
} | [
2830,
3393,
2959,
28000,
1155,
353,
8840,
836,
8,
341,
96572,
16708,
1155,
11,
609,
2959,
2271,
28000,
515,
197,
197,
295,
4385,
2648,
25,
2036,
341,
298,
11609,
414,
914,
198,
298,
6246,
7706,
3056,
917,
198,
298,
78395,
256,
882,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDescribePodPriority(t *testing.T) {
priority := int32(1000)
fake := fake.NewSimpleClientset(&api.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "bar",
},
Spec: api.PodSpec{
PriorityClassName: "high-priority",
Priority: &priority,
},
})
c := &describeClient{T: t, Namespace: "", Interface: fake}
d := PodDescriber{c}
out, err := d.Describe("", "bar", printers.DescriberSettings{ShowEvents: true})
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if !strings.Contains(out, "high-priority") || !strings.Contains(out, "1000") {
t.Errorf("unexpected out: %s", out)
}
} | explode_data.jsonl/34929 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 252
} | [
2830,
3393,
74785,
23527,
20555,
1155,
353,
8840,
836,
8,
341,
3223,
8773,
1669,
526,
18,
17,
7,
16,
15,
15,
15,
340,
1166,
726,
1669,
12418,
7121,
16374,
2959,
746,
2099,
2068,
88823,
515,
197,
23816,
12175,
25,
77520,
16,
80222,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestScanSlice(t *testing.T) {
for _, tt := range scanSliceTests {
typ := reflect.ValueOf(tt.dest).Type()
dest := reflect.New(typ)
err := redis.ScanSlice(tt.src, dest.Interface(), tt.fieldNames...)
if tt.ok != (err == nil) {
t.Errorf("ScanSlice(%v, []%s, %v) returned error %v", tt.src, typ, tt.fieldNames, err)
continue
}
if tt.ok && !reflect.DeepEqual(dest.Elem().Interface(), tt.dest) {
t.Errorf("ScanSlice(src, []%s) returned %#v, want %#v", typ, dest.Elem().Interface(), tt.dest)
}
}
} | explode_data.jsonl/44284 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 229
} | [
2830,
3393,
26570,
33236,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17853,
1669,
2088,
8569,
33236,
18200,
1476,
197,
25314,
1669,
8708,
6167,
2124,
47152,
21489,
568,
929,
741,
197,
49616,
1669,
8708,
7121,
66783,
692,
197,
9859,
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... | 5 |
func TestGetExistingKeyInt(t *testing.T) {
name, ok := Config().Get("tel")
if name != "20289202982" {
t.Errorf("Expected '20289202982' and got '%s'", name)
}
if ok != true {
t.Errorf("Expected 'true' and got '%t'", ok)
}
if !ok {
t.Errorf("Expected ok=true and got ok=%+v", ok)
}
} | explode_data.jsonl/51564 | {
"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,
1949,
53067,
1592,
1072,
1155,
353,
8840,
836,
8,
341,
11609,
11,
5394,
1669,
5532,
1005,
1949,
445,
22924,
1138,
743,
829,
961,
330,
17,
15,
17,
23,
24,
17,
15,
17,
24,
23,
17,
1,
341,
197,
3244,
13080,
445,
18896,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIntegration_BucketIAM(t *testing.T) {
ctx := context.Background()
client, bucket := testConfig(ctx, t)
defer client.Close()
bkt := client.Bucket(bucket)
// This bucket is unique to this test run. So we don't have
// to worry about other runs interfering with our IAM policy
// changes.
member := "projectViewer:" + testutil.ProjID()
role := iam.RoleName("roles/storage.objectViewer")
// Get the bucket's IAM policy.
policy, err := bkt.IAM().Policy(ctx)
if err != nil {
t.Fatalf("Getting policy: %v", err)
}
// The member should not have the role.
if policy.HasRole(member, role) {
t.Errorf("member %q has role %q", member, role)
}
// Change the policy.
policy.Add(member, role)
if err := bkt.IAM().SetPolicy(ctx, policy); err != nil {
t.Fatalf("SetPolicy: %v", err)
}
// Confirm that the binding was added.
policy, err = bkt.IAM().Policy(ctx)
if err != nil {
t.Fatalf("Getting policy: %v", err)
}
if !policy.HasRole(member, role) {
t.Errorf("member %q does not have role %q", member, role)
}
// Check TestPermissions.
// This client should have all these permissions (and more).
perms := []string{"storage.buckets.get", "storage.buckets.delete"}
got, err := bkt.IAM().TestPermissions(ctx, perms)
if err != nil {
t.Fatalf("TestPermissions: %v", err)
}
sort.Strings(perms)
sort.Strings(got)
if !testutil.Equal(got, perms) {
t.Errorf("got %v, want %v", got, perms)
}
} | explode_data.jsonl/8911 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 535
} | [
2830,
3393,
52464,
1668,
11152,
73707,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
25291,
11,
15621,
1669,
1273,
2648,
7502,
11,
259,
340,
16867,
2943,
10421,
2822,
2233,
5840,
1669,
2943,
1785,
11152,
58934,
692,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestBuildMultiStageLayerLeak(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "broken in earlier versions")
ctx := context.TODO()
defer setupTest(t)()
// all commands need to match until COPY
dockerfile := `FROM busybox
WORKDIR /foo
COPY foo .
FROM busybox
WORKDIR /foo
COPY bar .
RUN [ -f bar ]
RUN [ ! -f foo ]
`
source := fakecontext.New(t, "",
fakecontext.WithFile("foo", "0"),
fakecontext.WithFile("bar", "1"),
fakecontext.WithDockerfile(dockerfile))
defer source.Close()
apiclient := testEnv.APIClient()
resp, err := apiclient.ImageBuild(ctx,
source.AsTarReader(t),
types.ImageBuildOptions{
Remove: true,
ForceRemove: true,
})
out := bytes.NewBuffer(nil)
assert.NilError(t, err)
_, err = io.Copy(out, resp.Body)
resp.Body.Close()
assert.NilError(t, err)
assert.Check(t, is.Contains(out.String(), "Successfully built"))
} | explode_data.jsonl/82586 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 388
} | [
2830,
3393,
11066,
20358,
19398,
9188,
2304,
585,
1155,
353,
8840,
836,
8,
341,
1903,
13389,
32901,
1155,
11,
1273,
14359,
909,
64,
7291,
1731,
13,
4233,
499,
621,
330,
27077,
497,
330,
81019,
1138,
1903,
13389,
32901,
1155,
11,
10795,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTopLevelExtension(t *testing.T) {
bm := &base.BaseMessage{
Height: proto.Int32(179),
}
width := proto.Int32(17)
err := proto.SetExtension(bm, user.E_Width, width)
if err != nil {
t.Fatal("Failed setting extension:", err)
}
buf, err := proto.Marshal(bm)
if err != nil {
t.Fatal("Failed encoding message with extension:", err)
}
bm_new := new(base.BaseMessage)
if err := proto.Unmarshal(buf, bm_new); err != nil {
t.Fatal("Failed decoding message with extension:", err)
}
if !proto.HasExtension(bm_new, user.E_Width) {
t.Fatal("Decoded message didn't contain extension.")
}
width_out, err := proto.GetExtension(bm_new, user.E_Width)
if err != nil {
t.Fatal("Failed getting extension:", err)
}
if w := width_out.(*int32); *w != *width {
t.Errorf("width_out = %v, expected %v", *w, *width)
}
proto.ClearExtension(bm_new, user.E_Width)
if proto.HasExtension(bm_new, user.E_Width) {
t.Fatal("Failed clearing extension.")
}
} | explode_data.jsonl/19871 | {
"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,
5366,
4449,
12049,
1155,
353,
8840,
836,
8,
341,
2233,
76,
1669,
609,
3152,
13018,
2052,
515,
197,
197,
3640,
25,
18433,
7371,
18,
17,
7,
16,
22,
24,
1326,
197,
630,
24219,
1669,
18433,
7371,
18,
17,
7,
16,
22,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestNewRestConfigFromClusterFieldErrors(t *testing.T) {
testcases := []struct {
name string
cluster *v1alpha2.Cluster
field string
}{
{
name: "an empty cluster object",
},
{
name: "a bad field path",
cluster: &v1alpha2.Cluster{},
field: "some field",
},
}
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
cfg, err := upgrade.NewRestConfigFromCAClusterField(tc.cluster, tc.field, "https://example.com:8888")
if err == nil {
t.Fatal("expected an error but did not get one")
}
if cfg != nil {
t.Fatal("*rest.Config should always be nil")
}
})
}
} | explode_data.jsonl/65358 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 278
} | [
2830,
3393,
3564,
12416,
2648,
3830,
28678,
1877,
13877,
1155,
353,
8840,
836,
8,
341,
18185,
23910,
1669,
3056,
1235,
341,
197,
11609,
262,
914,
198,
197,
197,
18855,
353,
85,
16,
7141,
17,
72883,
198,
197,
39250,
256,
914,
198,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestShingle(t *testing.T) {
sh := NewSimhash()
for _, tt := range shingleTests {
actual := sh.Shingle(tt.w, tt.words)
if !equal(actual, tt.expected) {
t.Errorf("Shingle(%d, %v): expected %v, got %v", tt.w, tt.words, tt.expected, actual)
}
}
} | explode_data.jsonl/20543 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 123
} | [
2830,
3393,
2016,
2173,
1155,
353,
8840,
836,
8,
341,
36196,
1669,
1532,
14027,
8296,
741,
2023,
8358,
17853,
1669,
2088,
557,
2173,
18200,
341,
197,
88814,
1669,
557,
10849,
2173,
47152,
1418,
11,
17853,
55912,
340,
197,
743,
753,
2579... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.