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 TestLog_Lshortfile(t *testing.T) {
var buf bytes.Buffer
l := logx.NewLog(logx.NewTextAppender(&buf, logx.Lshortfile), "test")
l.Notice("lineno")
assert.Contains(t, buf.String(), "log_test.go:46")
} | explode_data.jsonl/65671 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
2201,
2351,
8676,
1192,
1155,
353,
8840,
836,
8,
341,
2405,
6607,
5820,
22622,
198,
8810,
1669,
1487,
87,
7121,
2201,
12531,
87,
7121,
1178,
2164,
1659,
2099,
5909,
11,
1487,
87,
1214,
8676,
1192,
701,
330,
1944,
1138,
881... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCertificateServiceAdd(t *testing.T) {
service := createCertificateService(t)
require.NotNil(t, service)
resource, err := service.Add(nil)
require.Equal(t, err, createInvalidParameterError(OperationAdd, ParameterResource))
require.Nil(t, resource)
invalidResource := &CertificateResource{}
resource, err = service.Add(invalidResource)
require.Equal(t, createValidationFailureError("Add", invalidResource.Validate()), err)
require.Nil(t, resource)
resource, err = createCertificate(t)
require.NoError(t, err)
require.NotNil(t, resource)
resource, err = service.Add(resource)
require.NoError(t, err)
require.NotNil(t, resource)
err = service.DeleteByID(resource.GetID())
require.NoError(t, err)
} | explode_data.jsonl/71910 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 244
} | [
2830,
3393,
33202,
1860,
2212,
1155,
353,
8840,
836,
8,
341,
52934,
1669,
1855,
33202,
1860,
1155,
340,
17957,
93882,
1155,
11,
2473,
692,
50346,
11,
1848,
1669,
2473,
1904,
27907,
340,
17957,
12808,
1155,
11,
1848,
11,
1855,
7928,
4971... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMigrate(t *testing.T) {
type args struct {
v220GenState v220government.GenesisState
}
tests := []struct {
name string
args args
want *types.GenesisState
}{
{
name: "empty",
args: args{v220GenState: v220government.GenesisState{}},
want: &types.GenesisState{},
},
{
name: "genesis state correctly migrated",
args: args{
v220GenState: v220government.GenesisState{
GovernmentAddress: testGov,
TumblerAddress: testTumblerAddress,
},
},
want: &types.GenesisState{
GovernmentAddress: testGov.String(),
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Migrate(tt.args.v220GenState); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Migrate() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/35815 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 347
} | [
2830,
3393,
44,
34479,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
5195,
17,
17,
15,
9967,
1397,
348,
17,
17,
15,
86763,
65384,
13774,
1397,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
3121... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetAudits(t *testing.T) {
th := Setup().InitBasic()
Client := th.BasicClient
team := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
rteam, _ := Client.CreateTeam(&team)
Client.Logout()
user := model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", Password: "passwd1"}
ruser, _ := Client.CreateUser(&user, "")
LinkUserToTeam(ruser.Data.(*model.User), rteam.Data.(*model.Team))
store.Must(app.Srv.Store.User().VerifyEmail(ruser.Data.(*model.User).Id))
time.Sleep(100 * time.Millisecond)
Client.Login(user.Email, user.Password)
time.Sleep(100 * time.Millisecond)
if result, err := Client.GetAudits(ruser.Data.(*model.User).Id, ""); err != nil {
t.Fatal(err)
} else {
if len(result.Data.(model.Audits)) != 1 {
t.Fatal(result.Data.(model.Audits))
}
if cache_result, err := Client.GetAudits(ruser.Data.(*model.User).Id, result.Etag); err != nil {
t.Fatal(err)
} else if cache_result.Data.(model.Audits) != nil {
t.Fatal("cache should be empty")
}
}
if _, err := Client.GetAudits("FORBIDDENERROR", ""); err == nil {
t.Fatal("audit log shouldn't exist")
}
} | explode_data.jsonl/13806 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 491
} | [
2830,
3393,
1949,
52949,
1199,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1005,
3803,
15944,
741,
71724,
1669,
270,
48868,
2959,
271,
197,
9196,
1669,
1614,
65842,
90,
26456,
25,
330,
675,
497,
3988,
25,
330,
89,
9141,
27651,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestSyncPodsStartPod(t *testing.T) {
testKubelet := newTestKubelet(t)
testKubelet.fakeCadvisor.On("MachineInfo").Return(&cadvisorapi.MachineInfo{}, nil)
testKubelet.fakeCadvisor.On("DockerImagesFsInfo").Return(cadvisorapiv2.FsInfo{}, nil)
testKubelet.fakeCadvisor.On("RootFsInfo").Return(cadvisorapiv2.FsInfo{}, nil)
kubelet := testKubelet.kubelet
fakeRuntime := testKubelet.fakeRuntime
pods := []*api.Pod{
{
ObjectMeta: api.ObjectMeta{
UID: "12345678",
Name: "foo",
Namespace: "new",
},
Spec: api.PodSpec{
Containers: []api.Container{
{Name: "bar"},
},
},
},
}
kubelet.podManager.SetPods(pods)
kubelet.HandlePodSyncs(pods)
fakeRuntime.AssertStartedPods([]string{string(pods[0].UID)})
} | explode_data.jsonl/43296 | {
"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,
12154,
23527,
82,
3479,
23527,
1155,
353,
8840,
836,
8,
341,
18185,
42,
3760,
1149,
1669,
501,
2271,
42,
3760,
1149,
1155,
340,
18185,
42,
3760,
1149,
94624,
34,
81794,
8071,
445,
21605,
1731,
1827,
5598,
2099,
34455,
38012,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCacheKVMergeIteratorRandom(t *testing.T) {
st := newCacheKVStore()
truth := dbm.NewMemDB()
start, end := 25, 975
max := 1000
setRange(t, st, truth, start, end)
// do an op, test the iterator
for i := 0; i < 2000; i++ {
doRandomOp(t, st, truth, max)
assertIterateDomainCompare(t, st, truth)
}
} | explode_data.jsonl/6655 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 127
} | [
2830,
3393,
8233,
42,
11187,
10080,
11951,
13999,
1155,
353,
8840,
836,
8,
341,
18388,
1669,
501,
8233,
82707,
6093,
741,
25583,
940,
1669,
2927,
76,
7121,
18816,
3506,
2822,
21375,
11,
835,
1669,
220,
17,
20,
11,
220,
24,
22,
20,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestTraceExporter_WithSpan_ReturnError(t *testing.T) {
want := errors.New("my_error")
te, err := NewTraceExporter(fakeTraceExporterConfig, zap.NewNop(), newTraceDataPusher(want))
require.Nil(t, err)
require.NotNil(t, te)
checkWrapSpanForTraceExporter(t, te, want, 1)
} | explode_data.jsonl/70313 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 114
} | [
2830,
3393,
6550,
88025,
62,
2354,
12485,
53316,
1454,
1155,
353,
8840,
836,
8,
341,
50780,
1669,
5975,
7121,
445,
2408,
4096,
1138,
197,
665,
11,
1848,
1669,
1532,
6550,
88025,
74138,
6550,
88025,
2648,
11,
32978,
7121,
45,
453,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestErrors_dir(t *testing.T) {
c := &up.Config{
Name: "app",
ErrorPages: config.ErrorPages{
Dir: "testdata/templates",
Enable: true,
},
}
assert.NoError(t, c.Default(), "default")
assert.NoError(t, c.Validate(), "validate")
test(t, c)
} | explode_data.jsonl/45493 | {
"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,
13877,
4334,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
609,
454,
10753,
515,
197,
21297,
25,
330,
676,
756,
197,
58421,
17713,
25,
2193,
6141,
17713,
515,
298,
197,
6184,
25,
262,
330,
92425,
38941,
756,
298,
197,
11084,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPlanNodes(t *testing.T) {
shards := []meta.ShardInfo{
{
ID: 1,
Owners: []meta.ShardOwner{
{NodeID: 1},
{NodeID: 3},
},
}, {
ID: 2,
Owners: []meta.ShardOwner{
{NodeID: 2},
{NodeID: 4},
},
}, {
ID: 3,
Owners: []meta.ShardOwner{
{NodeID: 1},
{NodeID: 5},
},
}, {
ID: 4,
Owners: []meta.ShardOwner{
{NodeID: 2},
{NodeID: 5},
},
},
}
result := PlanNodes(0, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
result = PlanNodes(0, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
result = PlanNodes(0, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
result = PlanNodes(0, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
result = PlanNodes(0, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
result = PlanNodes(0, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
// local node
resultLocal := PlanNodes(1, shards, nil)
assert.True(t, verifyPlan(t, resultLocal, shards))
result = PlanNodes(1, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
assert.Equal(t, len(resultLocal[1]), len(result[1]))
result = PlanNodes(1, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
assert.Equal(t, len(resultLocal[1]), len(result[1]))
result = PlanNodes(1, shards, nil)
assert.True(t, verifyPlan(t, result, shards))
assert.Equal(t, len(resultLocal[1]), len(result[1]))
// black list
result = PlanNodes(0, shards, map[uint64]bool{
1: true,
})
assert.True(t, verifyPlan(t, result, shards))
assert.Equal(t, 0, len(result[1]))
result = PlanNodes(0, shards, map[uint64]bool{
2: true,
})
assert.True(t, verifyPlan(t, result, shards))
assert.Equal(t, 0, len(result[2]))
} | explode_data.jsonl/43796 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 768
} | [
2830,
3393,
20485,
12288,
1155,
353,
8840,
836,
8,
341,
36196,
2347,
1669,
3056,
5490,
10849,
567,
1731,
515,
197,
197,
515,
298,
29580,
25,
220,
16,
345,
298,
197,
57762,
25,
3056,
5490,
10849,
567,
13801,
515,
571,
197,
90,
1955,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNeedsInput(t *testing.T) {
if testing.Short() {
t.Skip("skip test in short mode")
}
sess := newSessionForTesting(t)
defer sess.Close()
builder, err := sess.NewExperimentBuilder("web_connectivity")
if err != nil {
t.Fatal(err)
}
if builder.InputPolicy() != InputOrQueryBackend {
t.Fatal("web_connectivity certainly needs input")
}
} | explode_data.jsonl/26314 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 133
} | [
2830,
3393,
65064,
2505,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
445,
20599,
1273,
304,
2805,
3856,
1138,
197,
532,
1903,
433,
1669,
501,
5283,
2461,
16451,
1155,
340,
16867,
21875,
10421,
741,
44546,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTlfHistoryRenamesAndDeletes(t *testing.T) {
aliceName, bobName := "alice", "bob"
aliceUID, bobUID := keybase1.MakeTestUID(1), keybase1.MakeTestUID(2)
tlfID, err := tlf.MakeRandomID(tlf.Private)
require.NoError(t, err)
var aliceMessages, bobMessages []string
nn := nextNotification{1, 0, tlfID, nil}
// Alice creates modifies "c" (later overwritten).
_ = nn.make("c", NotificationCreate, aliceUID, nil, time.Time{})
aliceMessages = append(aliceMessages, nn.encode(t))
// Bob modifies "c" (later overwritten).
_ = nn.make("c", NotificationModify, bobUID, nil, time.Time{})
bobMessages = append(bobMessages, nn.encode(t))
// Alice creates "b".
aliceCreateB := nn.make("b", NotificationCreate, aliceUID, nil, time.Time{})
aliceMessages = append(aliceMessages, nn.encode(t))
// Bob moves "b" to "c".
_ = nn.make("c", NotificationRename, bobUID, &NotificationParams{
OldFilename: "b",
}, time.Time{})
bobMessages = append(bobMessages, nn.encode(t))
aliceCreateB.Filename = "c"
// Alice creates "a".
_ = nn.make("a", NotificationCreate, aliceUID, nil, time.Time{})
aliceMessages = append(aliceMessages, nn.encode(t))
// Bob modifies "a".
_ = nn.make("a", NotificationModify, aliceUID, nil, time.Time{})
bobMessages = append(bobMessages, nn.encode(t))
// Alice moves "a" to "b".
_ = nn.make("b", NotificationRename, aliceUID, &NotificationParams{
OldFilename: "a",
}, time.Time{})
bobMessages = append(bobMessages, nn.encode(t))
// Bob creates "a".
_ = nn.make("a", NotificationCreate, bobUID, nil, time.Time{})
bobMessages = append(bobMessages, nn.encode(t))
// Alice deletes "b".
aliceDeleteB := nn.make("b", NotificationDelete, aliceUID, nil, time.Time{})
aliceMessages = append(aliceMessages, nn.encode(t))
// Bob modifies "a".
bobModA := nn.make("a", NotificationModify, bobUID, nil, time.Time{})
bobMessages = append(bobMessages, nn.encode(t))
expected := writersByRevision{
{bobName, []NotificationMessage{bobModA}, nil},
{aliceName, []NotificationMessage{aliceCreateB}, nil},
}
// Alice, then Bob.
th := NewTlfHistory()
rev, err := th.AddNotifications(aliceName, aliceMessages)
require.NoError(t, err)
require.Equal(t, aliceDeleteB.Revision, rev)
rev, err = th.AddNotifications(bobName, bobMessages)
require.NoError(t, err)
require.Equal(t, bobModA.Revision, rev)
checkTlfHistory(t, th, expected, aliceName)
} | explode_data.jsonl/34567 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 942
} | [
2830,
3393,
51,
11008,
13424,
49,
32954,
3036,
61317,
1155,
353,
8840,
836,
8,
341,
197,
63195,
675,
11,
35192,
675,
1669,
330,
63195,
497,
330,
47086,
698,
197,
63195,
6463,
11,
35192,
6463,
1669,
1376,
3152,
16,
50133,
2271,
6463,
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 TestRongCloud_GroupSend(t *testing.T) {
rc := NewRongCloud(
os.Getenv("APP_KEY"),
os.Getenv("APP_SECRET"),
)
msg := TXTMsg{
Content: "hello",
Extra: "helloExtra",
}
err := rc.GroupSend(
"7Szq13MKRVortoknTAk7W8",
[]string{"CFtiYbXNQNYtSr7rzUfHco"},
[]string{},
"RC:TxtMsg",
&msg,
"",
"",
1,
0,
)
t.Log(err)
} | explode_data.jsonl/38996 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 194
} | [
2830,
3393,
49,
644,
16055,
52619,
11505,
1155,
353,
8840,
836,
8,
1476,
30295,
1669,
1532,
49,
644,
16055,
1006,
197,
25078,
64883,
445,
14707,
6600,
4461,
197,
25078,
64883,
445,
14707,
31408,
4461,
197,
692,
21169,
1669,
72429,
6611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUpdateMetrics(t *testing.T) {
app := testNode()
data, _ := json.Marshal(map[string]string{"test": "publish"})
err := <-app.Publish(proto.NewMessage("channel-0", data, "", nil), nil)
assert.Equal(t, nil, err)
config := app.Config()
config.NodeMetricsInterval = 1 * time.Millisecond
app.SetConfig(&config)
app.updateMetricsOnce()
// Absolute metrics should be updated
assert.True(t, metricsRegistry.Counters.LoadValues()["node_num_client_msg_published"] > 0)
} | explode_data.jsonl/53962 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 170
} | [
2830,
3393,
4289,
27328,
1155,
353,
8840,
836,
8,
341,
28236,
1669,
1273,
1955,
741,
8924,
11,
716,
1669,
2951,
37271,
9147,
14032,
30953,
4913,
1944,
788,
330,
27502,
23625,
9859,
1669,
9119,
676,
83935,
73963,
7121,
2052,
445,
10119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewConfigFromEnvWithExplicitUserAgent(t *testing.T) {
os.Setenv("VINYLDNS_USER_AGENT", "some customer UA")
defaultConfig := NewConfigFromEnv()
expectSame(t, defaultConfig.UserAgent, "some customer UA", "defaultConfig.UserAgent")
} | explode_data.jsonl/74263 | {
"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,
3564,
2648,
3830,
14359,
2354,
98923,
1474,
16810,
1155,
353,
8840,
836,
8,
341,
25078,
4202,
3160,
445,
53,
64953,
12335,
2448,
9107,
52499,
497,
330,
14689,
6002,
45570,
5130,
11940,
2648,
1669,
1532,
2648,
3830,
14359,
2822... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestKDakuten(t *testing.T) {
const want = "gagigugego"
for _, v := range [2]string{"がぎぐげご", "ガギグゲゴ"} {
got, err := KanaToRomaji(v)
assert.Equal(t, want, got)
assert.Nil(t, err)
}
} | explode_data.jsonl/11297 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 104
} | [
2830,
3393,
89609,
585,
13160,
1155,
353,
8840,
836,
8,
341,
4777,
1366,
284,
330,
70,
351,
343,
4733,
3346,
1837,
2023,
8358,
348,
1669,
2088,
508,
17,
30953,
4913,
28195,
124902,
125161,
124682,
47054,
497,
330,
125059,
125647,
40658,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestClientReceivingPartialMetadata(t *testing.T) {
seedBroker := NewMockBroker(t, 1)
leader := NewMockBroker(t, 5)
metadataResponse1 := new(MetadataResponse)
metadataResponse1.AddBroker(leader.Addr(), leader.BrokerID())
seedBroker.Returns(metadataResponse1)
config := NewTestConfig()
config.Metadata.Retry.Max = 0
client, err := NewClient([]string{seedBroker.Addr()}, config)
if err != nil {
t.Fatal(err)
}
replicas := []int32{leader.BrokerID(), seedBroker.BrokerID()}
metadataPartial := new(MetadataResponse)
metadataPartial.AddBroker(seedBroker.Addr(), 1)
metadataPartial.AddBroker(leader.Addr(), 5)
metadataPartial.AddTopic("new_topic", ErrLeaderNotAvailable)
metadataPartial.AddTopicPartition("new_topic", 0, leader.BrokerID(), replicas, replicas, []int32{}, ErrNoError)
metadataPartial.AddTopicPartition("new_topic", 1, -1, replicas, []int32{}, []int32{}, ErrLeaderNotAvailable)
seedBroker.Returns(metadataPartial)
if err := client.RefreshMetadata("new_topic"); err != nil {
t.Error("ErrLeaderNotAvailable should not make RefreshMetadata respond with an error")
}
// Even though the metadata was incomplete, we should be able to get the leader of a partition
// for which we did get a useful response, without doing additional requests.
partition0Leader, err := client.Leader("new_topic", 0)
if err != nil {
t.Error(err)
} else if partition0Leader.Addr() != leader.Addr() {
t.Error("Unexpected leader returned", partition0Leader.Addr())
}
// If we are asking for the leader of a partition that didn't have a leader before,
// we will do another metadata request.
seedBroker.Returns(metadataPartial)
// Still no leader for the partition, so asking for it should return an error.
_, err = client.Leader("new_topic", 1)
if err != ErrLeaderNotAvailable {
t.Error("Expected ErrLeaderNotAvailable, got", err)
}
safeClose(t, client)
seedBroker.Close()
leader.Close()
} | explode_data.jsonl/54405 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 628
} | [
2830,
3393,
2959,
693,
46344,
37314,
14610,
1155,
353,
8840,
836,
8,
341,
197,
22602,
65545,
1669,
1532,
11571,
65545,
1155,
11,
220,
16,
340,
197,
37391,
1669,
1532,
11571,
65545,
1155,
11,
220,
20,
692,
2109,
7603,
2582,
16,
1669,
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... | 6 |
func TestNoErrors(t *testing.T) {
var uid int64 = 999
testcases := map[string]struct {
request *securityapi.PodSecurityPolicyReview
sccs []*securityapi.SecurityContextConstraints
allowedSAs []string
}{
"default in pod": {
request: &securityapi.PodSecurityPolicyReview{
Spec: securityapi.PodSecurityPolicyReviewSpec{
Template: kapi.PodTemplateSpec{
Spec: kapi.PodSpec{
Containers: []kapi.Container{
{
Name: "ctr",
Image: "image",
ImagePullPolicy: "IfNotPresent",
TerminationMessagePolicy: kapi.TerminationMessageReadFile,
},
},
RestartPolicy: kapi.RestartPolicyAlways,
SecurityContext: &kapi.PodSecurityContext{},
DNSPolicy: kapi.DNSClusterFirst,
ServiceAccountName: "default",
SchedulerName: kapi.DefaultSchedulerName,
},
},
},
},
sccs: []*securityapi.SecurityContextConstraints{
{
ObjectMeta: metav1.ObjectMeta{
SelfLink: "/api/version/securitycontextconstraints/scc-sa",
Name: "scc-sa",
},
RunAsUser: securityapi.RunAsUserStrategyOptions{
Type: securityapi.RunAsUserStrategyMustRunAsRange,
},
SELinuxContext: securityapi.SELinuxContextStrategyOptions{
Type: securityapi.SELinuxStrategyMustRunAs,
},
FSGroup: securityapi.FSGroupStrategyOptions{
Type: securityapi.FSGroupStrategyMustRunAs,
},
SupplementalGroups: securityapi.SupplementalGroupsStrategyOptions{
Type: securityapi.SupplementalGroupsStrategyMustRunAs,
},
Groups: []string{"system:serviceaccounts"},
},
},
allowedSAs: []string{"default"},
},
"failure creating provider": {
request: &securityapi.PodSecurityPolicyReview{
Spec: securityapi.PodSecurityPolicyReviewSpec{
Template: kapi.PodTemplateSpec{
Spec: kapi.PodSpec{
Containers: []kapi.Container{
{
Name: "ctr",
Image: "image",
ImagePullPolicy: "IfNotPresent",
SecurityContext: &kapi.SecurityContext{
Capabilities: &kapi.Capabilities{
Add: []kapi.Capability{"foo"},
},
},
TerminationMessagePolicy: kapi.TerminationMessageReadFile,
},
},
RestartPolicy: kapi.RestartPolicyAlways,
SecurityContext: &kapi.PodSecurityContext{},
DNSPolicy: kapi.DNSClusterFirst,
ServiceAccountName: "default",
SchedulerName: kapi.DefaultSchedulerName,
},
},
},
},
sccs: []*securityapi.SecurityContextConstraints{
{
ObjectMeta: metav1.ObjectMeta{
SelfLink: "/api/version/securitycontextconstraints/restrictive",
Name: "restrictive",
},
RunAsUser: securityapi.RunAsUserStrategyOptions{
Type: securityapi.RunAsUserStrategyMustRunAs,
UID: &uid,
},
SELinuxContext: securityapi.SELinuxContextStrategyOptions{
Type: securityapi.SELinuxStrategyMustRunAs,
SELinuxOptions: &kapi.SELinuxOptions{
Level: "s9:z0,z1",
},
},
FSGroup: securityapi.FSGroupStrategyOptions{
Type: securityapi.FSGroupStrategyMustRunAs,
Ranges: []securityapi.IDRange{
{Min: 999, Max: 999},
},
},
SupplementalGroups: securityapi.SupplementalGroupsStrategyOptions{
Type: securityapi.SupplementalGroupsStrategyMustRunAs,
Ranges: []securityapi.IDRange{
{Min: 999, Max: 999},
},
},
Groups: []string{"system:serviceaccounts"},
},
},
allowedSAs: nil,
},
}
for testName, testcase := range testcases {
sccIndexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
sccCache := securitylisters.NewSecurityContextConstraintsLister(sccIndexer)
for _, scc := range testcase.sccs {
if err := sccIndexer.Add(scc); err != nil {
t.Fatalf("error adding sccs to store: %v", err)
}
}
saIndexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
saCache := internalversion.NewServiceAccountLister(saIndexer)
namespace := admissionttesting.CreateNamespaceForTest()
serviceAccount := admissionttesting.CreateSAForTest()
serviceAccount.Namespace = namespace.Name
saIndexer.Add(serviceAccount)
csf := clientsetfake.NewSimpleClientset(namespace)
storage := REST{scc.NewDefaultSCCMatcher(sccCache), saCache, csf}
ctx := apirequest.WithNamespace(apirequest.NewContext(), namespace.Name)
obj, err := storage.Create(ctx, testcase.request, false)
if err != nil {
t.Errorf("%s - Unexpected error: %v", testName, err)
continue
}
pspsr, ok := obj.(*securityapi.PodSecurityPolicyReview)
if !ok {
t.Errorf("%s - unable to convert cretated runtime.Object to PodSecurityPolicyReview", testName)
continue
}
var allowedSas []string
for _, sa := range pspsr.Status.AllowedServiceAccounts {
allowedSas = append(allowedSas, sa.Name)
}
if !reflect.DeepEqual(allowedSas, testcase.allowedSAs) {
t.Errorf("%s - expected allowed ServiceAccout names %v got %v", testName, testcase.allowedSAs, allowedSas)
}
}
} | explode_data.jsonl/17756 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2313
} | [
2830,
3393,
2753,
13877,
1155,
353,
8840,
836,
8,
341,
2405,
14617,
526,
21,
19,
284,
220,
24,
24,
24,
198,
18185,
23910,
1669,
2415,
14032,
60,
1235,
341,
197,
23555,
262,
353,
17039,
2068,
88823,
15352,
13825,
19432,
198,
197,
1903,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWebsocketOriginCheck(t *testing.T) {
t.Parallel()
var (
srv = newTestServer()
httpsrv = httptest.NewServer(srv.WebsocketHandler([]string{"http://example.com"}))
wsURL = "ws:" + strings.TrimPrefix(httpsrv.URL, "http:")
)
defer srv.Stop()
defer httpsrv.Close()
client, err := DialWebsocket(context.Background(), wsURL, "http://ekzample.com")
if err == nil {
client.Close()
t.Fatal("no error for wrong origin")
}
wantErr := wsHandshakeError{websocket.ErrBadHandshake, "403 Forbidden"}
if !reflect.DeepEqual(err, wantErr) {
t.Fatalf("wrong error for wrong origin: %q", err)
}
// Connections without origin header should work.
client, err = DialWebsocket(context.Background(), wsURL, "")
if err != nil {
t.Fatal("error for empty origin")
}
client.Close()
} | explode_data.jsonl/21970 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 310
} | [
2830,
3393,
5981,
9556,
13298,
3973,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
2405,
2399,
197,
1903,
10553,
257,
284,
501,
2271,
5475,
741,
197,
197,
2428,
10553,
284,
54320,
70334,
7121,
5475,
1141,
10553,
6473,
9556,
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... | 4 |
func TestProcessClusterLocalShutdownViaAPI(t *testing.T) {
removeArangodProcesses(t)
needTestMode(t, testModeProcess)
needStarterMode(t, starterModeCluster)
dataDir := SetUniqueDataDir(t)
defer os.RemoveAll(dataDir)
start := time.Now()
child := Spawn(t, "${STARTER} --starter.local "+createEnvironmentStarterOptions())
defer child.Close()
if ok := WaitUntilStarterReady(t, whatCluster, 3, child); ok {
t.Logf("Cluster start took %s", time.Since(start))
testCluster(t, insecureStarterEndpoint(0*portIncrement), false)
testCluster(t, insecureStarterEndpoint(1*portIncrement), false)
testCluster(t, insecureStarterEndpoint(2*portIncrement), false)
}
waitForCallFunction(t,
ShutdownStarterCall(insecureStarterEndpoint(0*portIncrement)))
} | explode_data.jsonl/44679 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 268
} | [
2830,
3393,
7423,
28678,
7319,
62004,
54428,
7082,
1155,
353,
8840,
836,
8,
341,
47233,
6953,
524,
347,
92727,
1155,
340,
197,
17046,
2271,
3636,
1155,
11,
1273,
3636,
7423,
340,
197,
17046,
623,
5295,
3636,
1155,
11,
26697,
3636,
28678... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIntegration(t *testing.T) {
Expect := NewWithT(t).Expect
file, err := os.Open("../integration.json")
Expect(err).NotTo(HaveOccurred())
Expect(json.NewDecoder(file).Decode(&settings.Config)).To(Succeed())
Expect(file.Close()).To(Succeed())
file, err = os.Open("../buildpack.toml")
Expect(err).NotTo(HaveOccurred())
_, err = toml.NewDecoder(file).Decode(&buildpackInfo)
Expect(err).NotTo(HaveOccurred())
Expect(file.Close()).To(Succeed())
root, err := filepath.Abs("./..")
Expect(err).ToNot(HaveOccurred())
buildpackStore := occam.NewBuildpackStore()
settings.Buildpacks.Pip.Online, err = buildpackStore.Get.
WithVersion("1.2.3").
Execute(root)
Expect(err).NotTo(HaveOccurred())
settings.Buildpacks.Pip.Offline, err = buildpackStore.Get.
WithVersion("1.2.3").
WithOfflineDependencies().
Execute(root)
Expect(err).NotTo(HaveOccurred())
settings.Buildpacks.CPython.Online, err = buildpackStore.Get.
Execute(settings.Config.CPython)
Expect(err).NotTo(HaveOccurred())
settings.Buildpacks.CPython.Offline, err = buildpackStore.Get.
WithOfflineDependencies().
Execute(settings.Config.CPython)
Expect(err).NotTo(HaveOccurred())
settings.Buildpacks.BuildPlan.Online, err = buildpackStore.Get.
Execute(settings.Config.BuildPlan)
Expect(err).NotTo(HaveOccurred())
SetDefaultEventuallyTimeout(5 * time.Second)
suite := spec.New("Integration", spec.Report(report.Terminal{}))
suite("Default", testDefault, spec.Parallel())
suite("LayerReuse", testLayerReuse, spec.Parallel())
suite("Offline", testOffline, spec.Parallel())
suite.Run(t)
} | explode_data.jsonl/43024 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 586
} | [
2830,
3393,
52464,
1155,
353,
8840,
836,
8,
341,
35911,
1669,
1532,
2354,
51,
1155,
568,
17536,
271,
17661,
11,
1848,
1669,
2643,
12953,
17409,
60168,
4323,
1138,
35911,
3964,
568,
2623,
1249,
83844,
12367,
35911,
9304,
7121,
20732,
4866,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVectorsJWE(t *testing.T) {
plaintext := []byte("The true sign of intelligence is not knowledge but imagination.")
publicKey := &rsa.PublicKey{
N: fromBase64Int(`
oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW
cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S
psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a
sbOenSZeyaxziK72UwxrrKoExv6kc5twXTq4h-QChLOln0_mtUZwfsRaMS
tPs6mS6XrgxnxbWhojf663tuEQueGC-FCMfra36C9knDFGzKsNa7LZK2dj
YgyD3JR_MB_4NUJW_TqOQtwHYbxevoJArm-L5StowjzGy-_bq6Gw`),
E: 65537,
}
expectedCompact := stripWhitespace(`
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.ROQCfge4JPm_
yACxv1C1NSXmwNbL6kvmCuyxBRGpW57DvlwByjyjsb6g8m7wtLMqKEyhFCn
tV7sjippEePIlKln6BvVnz5ZLXHNYQgmubuNq8MC0KTwcaGJ_C0z_T8j4PZ
a1nfpbhSe-ePYaALrf_nIsSRKu7cWsrwOSlaRPecRnYeDd_ytAxEQWYEKFi
Pszc70fP9geZOB_09y9jq0vaOF0jGmpIAmgk71lCcUpSdrhNokTKo5y8MH8
3NcbIvmuZ51cjXQj1f0_AwM9RW3oCh2Hu0z0C5l4BujZVsDuGgMsGZsjUhS
RZsAQSXHCAmlJ2NlnN60U7y4SPJhKv5tKYw.48V1_ALb6US04U3b.5eym8T
W_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6jiS
diwkIr3ajwQzaBtQD_A.XFBoMYUZodetZdvTiFvSkQ`)
expectedFull := stripWhitespace(`
{ "protected":"eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ",
"encrypted_key":
"ROQCfge4JPm_yACxv1C1NSXmwNbL6kvmCuyxBRGpW57DvlwByjyjsb
6g8m7wtLMqKEyhFCntV7sjippEePIlKln6BvVnz5ZLXHNYQgmubuNq
8MC0KTwcaGJ_C0z_T8j4PZa1nfpbhSe-ePYaALrf_nIsSRKu7cWsrw
OSlaRPecRnYeDd_ytAxEQWYEKFiPszc70fP9geZOB_09y9jq0vaOF0
jGmpIAmgk71lCcUpSdrhNokTKo5y8MH83NcbIvmuZ51cjXQj1f0_Aw
M9RW3oCh2Hu0z0C5l4BujZVsDuGgMsGZsjUhSRZsAQSXHCAmlJ2Nln
N60U7y4SPJhKv5tKYw",
"iv": "48V1_ALb6US04U3b",
"ciphertext":
"5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFS
hS8iB7j6jiSdiwkIr3ajwQzaBtQD_A",
"tag":"XFBoMYUZodetZdvTiFvSkQ" }`)
// Mock random reader
randReader = bytes.NewReader([]byte{
// Encryption key
177, 161, 244, 128, 84, 143, 225, 115, 63, 180, 3, 255, 107, 154,
212, 246, 138, 7, 110, 91, 112, 46, 34, 105, 47, 130, 203, 46, 122,
234, 64, 252,
// Randomness for RSA-OAEP
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
// Initialization vector
227, 197, 117, 252, 2, 219, 233, 68, 180, 225, 77, 219})
defer resetRandReader()
// Encrypt with a dummy key
encrypter, err := NewEncrypter(RSA_OAEP, A256GCM, publicKey)
if err != nil {
panic(err)
}
object, err := encrypter.Encrypt(plaintext)
if err != nil {
panic(err)
}
serialized, err := object.CompactSerialize()
if serialized != expectedCompact {
t.Error("Compact serialization is not what we expected", serialized, expectedCompact)
}
serialized = object.FullSerialize()
if serialized != expectedFull {
t.Error("Full serialization is not what we expected")
}
} | explode_data.jsonl/14780 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1719
} | [
2830,
3393,
84744,
41,
12457,
1155,
353,
8840,
836,
8,
972,
197,
71223,
1669,
3056,
3782,
445,
785,
830,
1841,
315,
11229,
374,
537,
6540,
714,
27799,
13,
30218,
1219,
1592,
1669,
609,
60869,
49139,
1592,
1666,
197,
18317,
25,
504,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestDirExists(t *testing.T) {
t.Run("dirExists: should check if a directory exists when given a path", func(t *testing.T) {
assert.True(t, dirExists("webpage"))
assert.False(t, dirExists("nonExistingDir"))
})
} | explode_data.jsonl/67952 | {
"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,
6184,
15575,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
3741,
15575,
25,
1265,
1779,
421,
264,
6220,
6724,
979,
2661,
264,
1815,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
6948,
32443,
1155,
11,
5419,
15575,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestStoreCertificateStoresInPEMFormat(t *testing.T) {
t.Parallel()
_, _, certificate, _ := CreateSampleCertKeyPair(t, nil, nil, false, nil)
tmpPath := StoreCertToTempFile(t, certificate)
defer os.Remove(tmpPath)
// Verify the format. We use openssl binary to read in the file and if it doesn't error, then we know the
// certificate is formatted correctly.
// See: https://stackoverflow.com/questions/26259432/how-to-check-a-public-rsa-key-file/26260514#26260514
cmd := shell.Command{
Command: "openssl",
Args: []string{"x509", "-inform", "PEM", "-in", tmpPath, "-noout"},
}
shell.RunCommand(t, cmd)
} | explode_data.jsonl/62201 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 225
} | [
2830,
3393,
6093,
33202,
69026,
641,
1740,
44,
4061,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
6878,
8358,
15748,
11,
716,
1669,
4230,
17571,
36934,
1592,
12443,
1155,
11,
2092,
11,
2092,
11,
895,
11,
2092,
692,
2008... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContainerTypePodContainer(t *testing.T) {
var ociSpec specs.Spec
ociSpec.Annotations = map[string]string{
annotations.ContainerType: annotations.ContainerTypeContainer,
}
testContainerTypeSuccessful(t, ociSpec, vc.PodContainer)
} | explode_data.jsonl/44041 | {
"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,
4502,
929,
23527,
4502,
1155,
353,
8840,
836,
8,
341,
2405,
93975,
8327,
32247,
36473,
271,
197,
2119,
8327,
91172,
284,
2415,
14032,
30953,
515,
197,
197,
39626,
33672,
929,
25,
32207,
33672,
929,
4502,
345,
197,
630,
18185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInvokeServiceFromHTTPResponse(t *testing.T) {
mockDirectMessaging := new(daprt.MockDirectMessaging)
// Setup Dapr API server
fakeAPI := &api{
id: "fakeAPI",
directMessaging: mockDirectMessaging,
}
var httpResponseTests = []struct {
status int
statusMessage string
grpcStatusCode codes.Code
grpcMessage string
errHTTPCode string
errHTTPMessage string
}{
{
status: 200,
statusMessage: "OK",
grpcStatusCode: codes.OK,
grpcMessage: "",
errHTTPCode: "",
errHTTPMessage: "",
},
{
status: 201,
statusMessage: "Accepted",
grpcStatusCode: codes.OK,
grpcMessage: "",
errHTTPCode: "",
errHTTPMessage: "",
},
{
status: 204,
statusMessage: "No Content",
grpcStatusCode: codes.OK,
grpcMessage: "",
errHTTPCode: "",
errHTTPMessage: "",
},
{
status: 404,
statusMessage: "NotFound",
grpcStatusCode: codes.NotFound,
grpcMessage: "Not Found",
errHTTPCode: "404",
errHTTPMessage: "fakeDirectMessageResponse",
},
}
for _, tt := range httpResponseTests {
t.Run(fmt.Sprintf("handle http %d response code", tt.status), func(t *testing.T) {
fakeResp := invokev1.NewInvokeMethodResponse(int32(tt.status), tt.statusMessage, nil)
fakeResp.WithRawData([]byte(tt.errHTTPMessage), "application/json")
// Set up direct messaging mock
mockDirectMessaging.Calls = nil // reset call count
mockDirectMessaging.On("Invoke",
mock.AnythingOfType("*context.valueCtx"),
"fakeAppID",
mock.AnythingOfType("*v1.InvokeMethodRequest")).Return(fakeResp, nil).Once()
// Run test server
port, _ := freeport.GetFreePort()
server := startDaprAPIServer(port, fakeAPI, "")
defer server.Stop()
// Create gRPC test client
clientConn := createTestClient(port)
defer clientConn.Close()
// act
client := runtimev1pb.NewDaprClient(clientConn)
req := &runtimev1pb.InvokeServiceRequest{
Id: "fakeAppID",
Message: &commonv1pb.InvokeRequest{
Method: "fakeMethod",
Data: &anypb.Any{Value: []byte("testData")},
},
}
var header metadata.MD
_, err := client.InvokeService(context.Background(), req, grpc.Header(&header))
// assert
mockDirectMessaging.AssertNumberOfCalls(t, "Invoke", 1)
s, ok := status.FromError(err)
assert.True(t, ok)
statusHeader := header.Get(daprHTTPStatusHeader)
assert.Equal(t, strconv.Itoa(tt.status), statusHeader[0])
assert.Equal(t, tt.grpcStatusCode, s.Code())
assert.Equal(t, tt.grpcMessage, s.Message())
if tt.errHTTPCode != "" {
errInfo := s.Details()[0].(*epb.ErrorInfo)
assert.Equal(t, 1, len(s.Details()))
assert.Equal(t, tt.errHTTPCode, errInfo.Metadata["http.code"])
assert.Equal(t, tt.errHTTPMessage, errInfo.Metadata["http.error_message"])
}
})
}
} | explode_data.jsonl/21727 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1275
} | [
2830,
3393,
17604,
1860,
3830,
9230,
2582,
1155,
353,
8840,
836,
8,
341,
77333,
16027,
91049,
1669,
501,
1500,
391,
3342,
24664,
16027,
91049,
692,
197,
322,
18626,
422,
59817,
5333,
3538,
198,
1166,
726,
7082,
1669,
609,
2068,
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... | 2 |
func Test_SetUnion(t *testing.T) {
a := NewSet()
b := NewSet()
b.Add(1)
b.Add(2)
b.Add(3)
b.Add(4)
b.Add(5)
c := a.Union(b)
if c.Cardinality() != 5 {
t.Error("set c is unioned with an empty set and therefore should have 5 elements in it")
}
d := NewSet()
d.Add(10)
d.Add(14)
d.Add(0)
e := c.Union(d)
if e.Cardinality() != 8 {
t.Error("set e should should have 8 elements in it after being unioned with set c to d")
}
f := NewSet()
f.Add(14)
f.Add(3)
g := f.Union(e)
if g.Cardinality() != 8 {
t.Error("set g should still have 8 elements in it after being unioned with set f that has duplicates")
}
} | explode_data.jsonl/190 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 277
} | [
2830,
3393,
14812,
32658,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
1532,
1649,
2822,
2233,
1669,
1532,
1649,
741,
2233,
1904,
7,
16,
340,
2233,
1904,
7,
17,
340,
2233,
1904,
7,
18,
340,
2233,
1904,
7,
19,
340,
2233,
1904,
7,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestLiveUpdateDockerBuildLocalContainerDiffImgMultipleContainers(t *testing.T) {
f := newBDFixture(t, k8s.EnvDockerDesktop, container.RuntimeDocker)
defer f.TearDown()
sanchoTarg := NewSanchoLiveUpdateImageTarget(f)
sidecarTarg := NewSanchoSidecarLiveUpdateImageTarget(f)
tCase := testCase{
manifest: manifestbuilder.New(f, "sanchoWithSidecar").
WithK8sYAML(testyaml.SanchoSidecarYAML).
WithImageTargets(sanchoTarg, sidecarTarg).
Build(),
runningContainersByTarget: map[model.TargetID][]container.ID{
sanchoTarg.ID(): []container.ID{"c1"},
sidecarTarg.ID(): []container.ID{"c2"},
},
changedFiles: []string{"a.txt"},
expectDockerBuildCount: 0,
expectDockerPushCount: 0,
// one of each operation per container
expectDockerCopyCount: 2,
expectDockerExecCount: 2,
expectDockerRestartCount: 2,
}
runTestCase(t, f, tCase)
} | explode_data.jsonl/35155 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 364
} | [
2830,
3393,
20324,
4289,
35,
13659,
11066,
7319,
4502,
21751,
13033,
32089,
74632,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
501,
33,
5262,
12735,
1155,
11,
595,
23,
82,
81214,
35,
13659,
23597,
11,
5476,
16706,
35,
13659,
340,
16867,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestKubePatch(t *testing.T) {
patchSuites := []struct {
description string
original string
patch string
expected string
}{
{
"(RFC7386) Merge type: add new field for all original objects",
`{"kind":"pod","name":"podA"}{"kind":"pod","name":"podB"}`,
`{"filters":{"name":".*"},"type":"merge","patch":{"metadata":"new"}}`,
`{"kind":"pod","metadata":"new","name":"podA"}{"kind":"pod","metadata":"new","name":"podB"}`,
},
{
"(RFC7386) Merge type: add new field with intermediate keys for all original objects",
`{"kind":"pod","name":"podA"}{"kind":"pod","name":"podB"}`,
`{"filters":{"name":".*"},"type":"merge","patch":{"metadata":{"label":"new"}}}`,
`{"kind":"pod","metadata":{"label":"new"},"name":"podA"}{"kind":"pod","metadata":{"label":"new"},"name":"podB"}`,
},
{
"(RFC7386) Merge type: override existing items for all original objects",
`{"kind":"pod","name":"podA"}{"kind":"pod","name":"podB"}`,
`{"filters":{"name":".*"},"type":"merge","patch":{"kind":"new"}}`,
`{"kind":"new","name":"podA"}{"kind":"new","name":"podB"}`,
},
{
"(RFC7386) Merge type: override existing items for a specific object",
`{"kind":"pod","name":"podA"}{"kind":"pod","name":"podB"}`,
`{"filters":{"name":"podA"},"type":"merge","patch":{"kind":"new"}}`,
`{"kind":"new","name":"podA"}{"kind":"pod","name":"podB"}`,
},
{
"(RFC6902) JSON type: add new field for all original objects",
`{"kind":"pod","name":"podA"}{"kind":"pod","name":"podB"}`,
`{"filters":{"name":".*"}, "type":"json", "patch": [{"op": "add", "path": "/metadata", "value": "new"}]}`,
`{"kind":"pod","metadata":"new","name":"podA"}{"kind":"pod","metadata":"new","name":"podB"}`,
},
{
"(RFC6902) JSON type: remove field for a specific objects",
`{"kind":"pod","name":"podA"}{"kind":"pod","name":"podB"}`,
`{"filters":{"name":"podB"}, "type":"json", "patch": [{"op": "remove", "path": "/kind"}]}`,
`{"kind":"pod","name":"podA"}{"name":"podB"}`,
},
{
"(RFC6902 & RFC7386) JSON and Merge types: combination of patches",
`{"kind":"pod","name":"podA"}{"kind":"pod","name":"podB"}`,
`{"filters":{"name":"podB"}, "type":"json", "patch": [{"op": "remove", "path": "/kind"}]}{"filters":{"name":".*"},"type":"merge","patch":{"metadata":"new"}}`,
`{"kind":"pod","metadata":"new","name":"podA"}{"metadata":"new","name":"podB"}`,
},
}
for _, s := range patchSuites {
t.Log("suite:", s.description)
kd := &kubernetes.KubeInstall{
BuiltManifest: []byte(s.original),
}
err := kd.ProcessPatches([]byte(s.patch))
if err != nil {
t.Errorf(err.Error())
}
assert.Equal(t, s.expected, string(kd.BuiltManifest), "they should be equal")
// if s.assert != string(kd.BuiltManifest) {
// t.Errorf("Test suite object %v doesn't match to the generated data %v", s.assert, string(kd.BuiltManifest))
// }
}
} | explode_data.jsonl/34897 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1192
} | [
2830,
3393,
42,
3760,
43622,
1155,
353,
8840,
836,
8,
341,
220,
10900,
62898,
288,
1669,
3056,
1235,
341,
262,
4008,
914,
198,
262,
4024,
262,
914,
198,
262,
10900,
981,
914,
198,
262,
3601,
262,
914,
198,
220,
335,
515,
262,
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 TestNewAttributeValueSlice(t *testing.T) {
events := NewAttributeValueSlice(0)
assert.EqualValues(t, 0, len(events))
n := rand.Intn(10)
events = NewAttributeValueSlice(n)
assert.EqualValues(t, n, len(events))
for event := range events {
assert.NotNil(t, event)
}
} | explode_data.jsonl/38195 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 108
} | [
2830,
3393,
3564,
78554,
33236,
1155,
353,
8840,
836,
8,
341,
90873,
1669,
1532,
78554,
33236,
7,
15,
340,
6948,
12808,
6227,
1155,
11,
220,
15,
11,
2422,
50496,
4390,
9038,
1669,
10382,
7371,
77,
7,
16,
15,
340,
90873,
284,
1532,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestOrderGT(t *testing.T) {
gt := Pair(&G1{curveGen}, &G2{twistGen})
g := new(GT).ScalarMult(gt, Order)
if !g.p.IsOne() {
t.Error("GT has incorrect order")
}
} | explode_data.jsonl/52899 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 79
} | [
2830,
3393,
4431,
25388,
1155,
353,
8840,
836,
8,
341,
3174,
83,
1669,
25995,
2099,
38,
16,
90,
50051,
9967,
2137,
609,
38,
17,
90,
15560,
380,
9967,
3518,
3174,
1669,
501,
6699,
51,
568,
20639,
40404,
79342,
11,
7217,
340,
743,
753... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSeasonDesignation(t *testing.T) {
assert.EqualString(t, Detect("Simpsons 07x01 - Who Shot Mr Burns (Part 2)").SeasonDesignation(), "S07")
} | explode_data.jsonl/44957 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 50
} | [
2830,
3393,
34860,
20470,
367,
1155,
353,
8840,
836,
8,
341,
6948,
12808,
703,
1155,
11,
33287,
445,
50,
6664,
37348,
220,
15,
22,
87,
15,
16,
481,
10479,
32347,
4392,
49916,
320,
5800,
220,
17,
63554,
34860,
20470,
367,
1507,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestStopperRunTaskPanic(t *testing.T) {
s := stop.NewStopper()
// If RunTask were not panic-safe, Stop() would deadlock.
defer s.Stop()
func() {
defer func() {
_ = recover()
}()
s.RunTask(func() {
panic("ouch")
})
}()
} | explode_data.jsonl/2426 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 109
} | [
2830,
3393,
10674,
712,
6727,
6262,
47,
31270,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
2936,
7121,
10674,
712,
741,
197,
322,
1416,
6452,
6262,
1033,
537,
21975,
55119,
11,
14215,
368,
1035,
93345,
624,
16867,
274,
30213,
741,
29244,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRPCQueryAllParams(t *testing.T) {
codec.UpgradeHeight = 7000
_, _, cleanup := NewInMemoryTendermintNode(t, oneValTwoNodeGenesisState())
_, stopCli, evtChan := subscribeTo(t, tmTypes.EventNewBlock)
<-evtChan // Wait for block
var params = HeightParams{
Height: 0,
}
q := newQueryRequest("allparams", newBody(params))
rec := httptest.NewRecorder()
AllParams(rec, q, httprouter.Params{})
resp := getJSONResponse(rec)
assert.NotNil(t, resp)
assert.NotEmpty(t, resp)
<-evtChan // Wait for block
params = HeightParams{
Height: 2,
}
q = newQueryRequest("allparams", newBody(params))
rec = httptest.NewRecorder()
AllParams(rec, q, httprouter.Params{})
resp = getJSONResponse(rec)
assert.NotNil(t, resp)
assert.NotEmpty(t, resp)
cleanup()
stopCli()
} | explode_data.jsonl/44724 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 306
} | [
2830,
3393,
29528,
2859,
2403,
4870,
1155,
353,
8840,
836,
8,
341,
43343,
66,
13,
43861,
3640,
284,
220,
22,
15,
15,
15,
198,
197,
6878,
8358,
21290,
1669,
1532,
641,
10642,
51,
1659,
67791,
1955,
1155,
11,
825,
2208,
11613,
1955,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIntExpressionBIT_SHIFT_LEFT(t *testing.T) {
assertClauseSerialize(t, table1ColInt.BIT_SHIFT_LEFT(table2ColInt), "(table1.col_int << table2.col_int)")
assertClauseSerialize(t, table1ColInt.BIT_SHIFT_LEFT(Int(11)), "(table1.col_int << $1)", int64(11))
} | explode_data.jsonl/41465 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 109
} | [
2830,
3393,
1072,
9595,
20917,
22657,
19013,
1155,
353,
8840,
836,
8,
341,
6948,
28482,
15680,
1155,
11,
1965,
16,
6127,
1072,
1785,
952,
22657,
19013,
15761,
17,
6127,
1072,
701,
11993,
2005,
16,
13414,
4042,
1115,
1965,
17,
13414,
404... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRedundantColumnResolve(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t1, t2")
tk.MustExec("create table t1(a int not null)")
tk.MustExec("create table t2(a int not null)")
tk.MustExec("insert into t1 values(1)")
tk.MustExec("insert into t2 values(1)")
tk.MustQuery("select a, count(*) from t1 join t2 using (a) group by a").Check(testkit.Rows("1 1"))
tk.MustQuery("select a, count(*) from t1 natural join t2 group by a").Check(testkit.Rows("1 1"))
err := tk.ExecToErr("select a, count(*) from t1 join t2 on t1.a=t2.a group by a")
require.Error(t, err, "[planner:1052]Column 'a' in field list is ambiguous")
tk.MustQuery("select t1.a, t2.a from t1 join t2 using (a) group by t1.a").Check(testkit.Rows("1 1"))
err = tk.ExecToErr("select t1.a, t2.a from t1 join t2 using(a) group by a")
require.Error(t, err, "[planner:1052]Column 'a' in group statement is ambiguous")
tk.MustQuery("select t2.a from t1 join t2 using (a) group by t1.a").Check(testkit.Rows("1"))
tk.MustQuery("select t1.a from t1 join t2 using (a) group by t1.a").Check(testkit.Rows("1"))
tk.MustQuery("select t2.a from t1 join t2 using (a) group by t2.a").Check(testkit.Rows("1"))
// The test below cannot pass now since we do not infer functional dependencies from filters as MySQL, hence would fail in only_full_group_by check.
// tk.MustQuery("select t1.a from t1 join t2 using (a) group by t2.a").Check(testkit.Rows("1"))
tk.MustQuery("select count(*) from t1 join t2 using (a) group by t2.a").Check(testkit.Rows("1"))
tk.MustQuery("select t2.a from t1 join t2 using (a) group by a").Check(testkit.Rows("1"))
tk.MustQuery("select t1.a from t1 join t2 using (a) group by a").Check(testkit.Rows("1"))
tk.MustQuery("select * from t1 join t2 using(a)").Check(testkit.Rows("1"))
tk.MustQuery("select t1.a, t2.a from t1 join t2 using(a)").Check(testkit.Rows("1 1"))
tk.MustQuery("select * from t1 natural join t2").Check(testkit.Rows("1"))
tk.MustQuery("select t1.a, t2.a from t1 natural join t2").Check(testkit.Rows("1 1"))
} | explode_data.jsonl/65589 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 830
} | [
2830,
3393,
6033,
1241,
517,
2933,
56808,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
340,
3244,
74,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_addSubscriber_Success(t *testing.T) {
chain, mock33 := createBlockChain(t)
defer mock33.Close()
subscribe := new(types.PushSubscribeReq)
subscribe.Name = "push-test"
subscribe.URL = "http://localhost"
key := calcPushKey(subscribe.Name)
subInfo, err := chain.push.store.GetKey(key)
assert.NotEqual(t, err, nil)
assert.NotEqual(t, subInfo, nil)
err = chain.push.addSubscriber(subscribe)
assert.Equal(t, err, nil)
subInfo, err = chain.push.store.GetKey(key)
assert.Equal(t, err, nil)
assert.NotEqual(t, subInfo, nil)
var originSubInfo types.PushWithStatus
err = types.Decode(subInfo, &originSubInfo)
assert.Equal(t, err, nil)
assert.Equal(t, originSubInfo.Push.URL, subscribe.URL)
pushes, _ := chain.ProcListPush()
assert.Equal(t, subscribe.Name, pushes.Pushes[0].Name)
//重新创建push,能够从数据库中恢复原先注册成功的push
chainAnother := &BlockChain{
isRecordBlockSequence: true,
enablePushSubscribe: true,
}
chainAnother.push = newpush(chain.blockStore, chain.blockStore, chain.client.GetConfig())
recoverpushes, _ := chainAnother.ProcListPush()
assert.Equal(t, subscribe.Name, recoverpushes.Pushes[0].Name)
} | explode_data.jsonl/61717 | {
"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,
2891,
40236,
87161,
1155,
353,
8840,
836,
8,
341,
197,
8819,
11,
7860,
18,
18,
1669,
1855,
4713,
18837,
1155,
340,
16867,
7860,
18,
18,
10421,
741,
28624,
6273,
1669,
501,
52613,
34981,
28573,
27234,
340,
28624,
6273,
2967,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseRedisEnterpriseID(t *testing.T) {
testData := []struct {
Input string
Error bool
Expected *RedisEnterpriseId
}{
{
// Incomplete URI
Input: "",
Error: true,
},
{
// Incomplete URI
Input: "/subscriptions",
Error: true,
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012",
Error: true,
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups",
Error: true,
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group",
Error: true,
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers",
Error: true,
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache",
Error: true,
},
{
// Incomplete URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise",
Error: true,
},
{
// Valid URI
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/clusterValue",
Expected: &RedisEnterpriseId{
SubscriptionId: "12345678-1234-9876-4563-123456789012",
ResourceGroupName: "example-resource-group",
ClusterName: "clusterValue",
},
},
{
// Invalid (Valid Uri with Extra segment)
Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/clusterValue/extra",
Error: true,
},
}
for _, v := range testData {
t.Logf("[DEBUG] Testing %q", v.Input)
actual, err := ParseRedisEnterpriseID(v.Input)
if err != nil {
if v.Error {
continue
}
t.Fatalf("Expect a value but got an error: %+v", err)
}
if v.Error {
t.Fatal("Expect an error but didn't get one")
}
if actual.SubscriptionId != v.Expected.SubscriptionId {
t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId)
}
if actual.ResourceGroupName != v.Expected.ResourceGroupName {
t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName)
}
if actual.ClusterName != v.Expected.ClusterName {
t.Fatalf("Expected %q but got %q for ClusterName", v.Expected.ClusterName, actual.ClusterName)
}
}
} | explode_data.jsonl/1712 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1080
} | [
2830,
3393,
14463,
48137,
85647,
915,
1155,
353,
8840,
836,
8,
341,
18185,
1043,
1669,
3056,
1235,
341,
197,
66588,
262,
914,
198,
197,
58421,
262,
1807,
198,
197,
197,
18896,
353,
48137,
85647,
764,
198,
197,
59403,
197,
197,
515,
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... | 8 |
func TestFcpXML_SetVersion(t *testing.T) {
fcpxml := New()
res := Resources.NewResources()
res.SetEffect(Resources.NewEffect())
format := Resources.NewFormat().
SetWidth(1440).
SetHeight(1080).
SetFrameRate(23.98).Render()
res.SetFormat(format)
fcpxml.SetResources(res)
gap := Gap.NewGap(180.2)
textStyleDef := Title.NewTextStyleDef(1)
text := Title.NewContent(1, "4:00")
title := Title.NewTitle("4:00 - 基本字幕", 4.0, 7.8).SetTextStyleDef(textStyleDef).SetText(text)
title.AddParam(Title.NewParams("位置", "9999/999166631/999166633/1/100/101", "0 -450"))
title.AddParam(Title.NewParams("对齐", "9999/999166631/999166633/2/354/999169573/401", "1 (居中)"))
title.AddParam(Title.NewParams("展平", "9999/999166631/999166633/2/351", "1"))
gap.AddTitle(title)
spine := Spine.NewSpine().SetGap(gap)
seq := Sequence.NewSequence(180.2).SetSpine(spine)
project := Project.NewProject("ceshi").SetSequence(seq)
event := Event.NewEvent().SetProject(project)
lib := Library.NewLibrary("未命名 1").SetEvent(event)
fcpxml.SetLibrary(lib)
e, _ := xml.MarshalIndent(&fcpxml, "", " ")
t.Log(string(e))
} | explode_data.jsonl/26273 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 478
} | [
2830,
3393,
37,
4672,
10609,
14812,
5637,
1155,
353,
8840,
836,
8,
341,
1166,
66,
1767,
1014,
1669,
1532,
741,
10202,
1669,
16209,
7121,
11277,
741,
10202,
4202,
7738,
69266,
7121,
7738,
2398,
59416,
1669,
16209,
7121,
4061,
25829,
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 TestValidTextAndCells(t *testing.T) {
tests := []struct {
desc string
text string // All runes checked individually.
wantErr bool
}{
{
desc: "empty text is not valid",
wantErr: true,
},
{
desc: "digits are allowed",
text: "0123456789",
},
{
desc: "all printable ASCII characters are allowed",
text: func() string {
var b strings.Builder
for i := 0; i < unicode.MaxASCII; i++ {
r := rune(i)
if unicode.IsPrint(r) {
b.WriteRune(r)
}
}
return b.String()
}(),
},
{
desc: "all printable Unicode characters in the Latin-1 space are allowed",
text: func() string {
var b strings.Builder
for i := 0; i < unicode.MaxLatin1; i++ {
r := rune(i)
if unicode.IsPrint(r) {
b.WriteRune(r)
}
}
return b.String()
}(),
},
{
desc: "sample of half-width unicode runes that are allowed",
text: "セカイ☆",
},
{
desc: "sample of full-width unicode runes that are allowed",
text: "世界",
},
{
desc: "spaces are allowed",
text: " ",
},
{
desc: "no other space characters",
text: fmt.Sprintf("\t\v\f\r%c%c", 0x85, 0xA0),
wantErr: true,
},
{
desc: "no control characters",
text: fmt.Sprintf("%c%c", 0x0000, 0x007f),
wantErr: true,
},
{
desc: "newlines are allowed",
text: " ",
},
}
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
{
err := ValidText(tc.text)
if (err != nil) != tc.wantErr {
t.Errorf("ValidText => unexpected error: %v, wantErr: %v", err, tc.wantErr)
}
}
// All individual runes must give the same result.
for _, r := range tc.text {
err := ValidText(string(r))
if (err != nil) != tc.wantErr {
t.Errorf("ValidText => unexpected error: %v, wantErr: %v", err, tc.wantErr)
}
}
var cells []*buffer.Cell
for _, r := range tc.text {
cells = append(cells, buffer.NewCell(r))
}
{
err := ValidCells(cells)
if (err != nil) != tc.wantErr {
t.Errorf("ValidCells => unexpected error: %v, wantErr: %v", err, tc.wantErr)
}
}
})
}
} | explode_data.jsonl/62775 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1036
} | [
2830,
3393,
4088,
1178,
3036,
20857,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
41653,
262,
914,
198,
197,
15425,
262,
914,
442,
2009,
79918,
10067,
31299,
624,
197,
50780,
7747,
1807,
198,
197,
59403,
197,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestOpDoubleNegative(t *testing.T) {
assert := assert.New(t)
jl := NewEmpty()
AddOpDoubleNegative(jl)
TestCases{
// http://jsonlogic.com/operations.html
{Logic: `{"!!":[true]}`, Data: `null`, Result: true},
{Logic: `{"!!":true}`, Data: `null`, Result: true},
// Zero param.
{Logic: `{"!!":[]}`, Data: `null`, Err: true},
// One param.
{Logic: `{"!!":null}`, Data: `null`, Result: false},
{Logic: `{"!!":false}`, Data: `null`, Result: false},
{Logic: `{"!!":true}`, Data: `null`, Result: true},
{Logic: `{"!!":0}`, Data: `null`, Result: false},
{Logic: `{"!!":-1}`, Data: `null`, Result: true},
{Logic: `{"!!":""}`, Data: `null`, Result: false},
{Logic: `{"!!":"x"}`, Data: `null`, Result: true},
{Logic: `{"!!":[[]]}`, Data: `null`, Result: false},
{Logic: `{"!!":[["x"]]}`, Data: `null`, Result: true},
{Logic: `{"!!":{}}`, Data: `null`, Result: true},
{Logic: `{"!!":{"1":2,"3":4}}`, Data: `null`, Result: true},
}.Run(assert, jl)
} | explode_data.jsonl/38299 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 418
} | [
2830,
3393,
7125,
7378,
38489,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
12428,
75,
1669,
1532,
3522,
741,
37972,
7125,
7378,
38489,
3325,
75,
340,
73866,
37302,
515,
197,
197,
322,
1758,
1110,
2236,
24225,
905,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIssueStats_String(t *testing.T) {
v := IssueStats{
TotalIssues: Int(0),
OpenIssues: Int(0),
ClosedIssues: Int(0),
}
want := `github.IssueStats{TotalIssues:0, OpenIssues:0, ClosedIssues:0}`
if got := v.String(); got != want {
t.Errorf("IssueStats.String = %v, want %v", got, want)
}
} | explode_data.jsonl/33252 | {
"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,
42006,
16635,
31777,
1155,
353,
8840,
836,
8,
341,
5195,
1669,
25226,
16635,
515,
197,
197,
7595,
85828,
25,
220,
1333,
7,
15,
1326,
197,
197,
5002,
85828,
25,
256,
1333,
7,
15,
1326,
197,
6258,
9259,
85828,
25,
1333,
7,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestNetGenesisState(t *testing.T) {
gen := types.NewGenesisState(nil)
assert.NotNil(t, gen.GenTxs) // https://github.com/mydexchain/chain-sdk/issues/5086
gen = types.NewGenesisState(
[]json.RawMessage{
[]byte(`{"foo":"bar"}`),
},
)
assert.Equal(t, string(gen.GenTxs[0]), `{"foo":"bar"}`)
} | explode_data.jsonl/76044 | {
"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,
6954,
84652,
1397,
1155,
353,
8840,
836,
8,
341,
82281,
1669,
4494,
7121,
84652,
1397,
27907,
340,
6948,
93882,
1155,
11,
4081,
65384,
51,
18561,
8,
442,
3703,
1110,
5204,
905,
34198,
91769,
8819,
14,
8819,
35478,
38745,
14,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMemberNotFound_Is(t *testing.T) {
mnf := &callbacks.MemberNotFound{}
if errors.Is(nil, &callbacks.MemberNotFound{}) {
t.Error(invalidErrorAssertion)
}
if errors.Is(fmt.Errorf(wrapMsg), &callbacks.MemberNotFound{}) {
t.Error(invalidErrorAssertion)
}
if !errors.Is(mnf, &callbacks.MemberNotFound{}) {
t.Errorf(invalidErrorAssertion)
}
} | explode_data.jsonl/56077 | {
"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,
9366,
10372,
31879,
1155,
353,
8840,
836,
8,
341,
2109,
31737,
1669,
609,
68311,
46404,
10372,
31483,
743,
5975,
4506,
27907,
11,
609,
68311,
46404,
10372,
28875,
341,
197,
3244,
6141,
5900,
1891,
1454,
68639,
340,
197,
630,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSetCellBool(t *testing.T) {
f := NewFile()
assert.EqualError(t, f.SetCellBool("Sheet1", "A", true), `cannot convert cell "A" to coordinates: invalid cell name "A"`)
} | explode_data.jsonl/950 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 68
} | [
2830,
3393,
1649,
3599,
11233,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
1532,
1703,
741,
6948,
12808,
1454,
1155,
11,
282,
4202,
3599,
11233,
445,
10541,
16,
497,
330,
32,
497,
830,
701,
1565,
33260,
5508,
2779,
330,
32,
1,
311,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestMfsHugeDir(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, rt := setupRoot(ctx, t)
for i := 0; i < 10000; i++ {
err := Mkdir(rt, fmt.Sprintf("/dir%d", i), MkdirOpts{Mkparents: false, Flush: false})
if err != nil {
t.Fatal(err)
}
}
} | explode_data.jsonl/35821 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 131
} | [
2830,
3393,
44,
3848,
39,
4733,
6184,
1155,
353,
8840,
836,
8,
341,
20985,
11,
9121,
1669,
2266,
26124,
9269,
5378,
19047,
2398,
16867,
9121,
741,
197,
6878,
16677,
1669,
6505,
8439,
7502,
11,
259,
692,
2023,
600,
1669,
220,
15,
26,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestCertificateList(t *testing.T) {
withTestClient(t, func(config *CmdConfig, tm *tcMocks) {
tm.certificates.On("List").Return(testCertificateList, nil)
err := RunCertificateList(config)
assert.NoError(t, err)
})
} | explode_data.jsonl/4820 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 87
} | [
2830,
3393,
33202,
852,
1155,
353,
8840,
836,
8,
341,
46948,
2271,
2959,
1155,
11,
2915,
8754,
353,
15613,
2648,
11,
17333,
353,
10413,
72577,
8,
341,
197,
3244,
76,
67016,
24405,
8071,
445,
852,
1827,
5598,
8623,
33202,
852,
11,
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 |
func TestBadStaticConfigsYML(t *testing.T) {
content, err := ioutil.ReadFile("testdata/static_config.bad.yml")
require.NoError(t, err)
var tg targetgroup.Group
err = yaml.UnmarshalStrict(content, &tg)
require.Error(t, err)
} | explode_data.jsonl/81280 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 92
} | [
2830,
3393,
17082,
11690,
84905,
56,
2668,
1155,
353,
8840,
836,
8,
341,
27751,
11,
1848,
1669,
43144,
78976,
445,
92425,
36643,
5332,
31563,
33936,
1138,
17957,
35699,
1155,
11,
1848,
340,
2405,
53188,
2169,
4074,
5407,
198,
9859,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCatalogConversionMultipleClusterServiceClasses(t *testing.T) {
// catalog := &osb.CatalogResponse{}
// err := json.Unmarshal([]byte(testCatalogWithMultipleServices), &catalog)
// if err != nil {
// t.Fatalf("Failed to unmarshal test catalog: %v", err)
// }
// serviceClasses, err := convertAndFilterCatalog(catalog)
// if err != nil {
// t.Fatalf("Failed to convertAndFilterCatalog: %v", err)
// }
// if len(serviceClasses) != 2 {
// t.Fatalf("Expected 2 serviceclasses for empty catalog, but got: %d", len(serviceClasses))
// }
// foundSvcMeta1 := false
// // foundSvcMeta2 := false
// // foundPlanMeta := false
// for _, sc := range serviceClasses {
// // For service1 make sure we have service level metadata with field1 = value1 as the blob
// // and for service1 plan s1plan2 we have planmeta = planvalue as the blob.
// if sc.Name == "service1" {
// if sc.Description != "service 1 description" {
// t.Fatalf("Expected service1's description to be \"service 1 description\", but was: %s", sc.Description)
// }
// if sc.ExternalMetadata != nil && len(sc.ExternalMetadata.Raw) > 0 {
// m := make(map[string]string)
// if err := json.Unmarshal(sc.ExternalMetadata.Raw, &m); err == nil {
// if m["field1"] == "value1" {
// foundSvcMeta1 = true
// }
// }
// }
// if len(sc.Plans) != 2 {
// t.Fatalf("Expected 2 plans for service1 but got: %d", len(sc.Plans))
// }
// for _, sp := range sc.Plans {
// if sp.Name == "s1plan2" {
// if sp.ExternalMetadata != nil && len(sp.ExternalMetadata.Raw) > 0 {
// m := make(map[string]string)
// if err := json.Unmarshal(sp.ExternalMetadata.Raw, &m); err != nil {
// t.Fatalf("Failed to unmarshal plan metadata: %s: %v", string(sp.ExternalMetadata.Raw), err)
// }
// if m["planmeta"] == "planvalue" {
// foundPlanMeta = true
// }
// }
// }
// }
// }
// // For service2 make sure we have service level metadata with three element array with elements
// // "first", "second", and "third"
// if sc.Name == "service2" {
// if sc.Description != "service 2 description" {
// t.Fatalf("Expected service2's description to be \"service 2 description\", but was: %s", sc.Description)
// }
// if sc.ExternalMetadata != nil && len(sc.ExternalMetadata.Raw) > 0 {
// m := make([]string, 0)
// if err := json.Unmarshal(sc.ExternalMetadata.Raw, &m); err != nil {
// t.Fatalf("Failed to unmarshal service metadata: %s: %v", string(sc.ExternalMetadata.Raw), err)
// }
// if len(m) != 3 {
// t.Fatalf("Expected 3 fields in metadata, but got %d", len(m))
// }
// foundFirst := false
// foundSecond := false
// foundThird := false
// for _, e := range m {
// if e == "first" {
// foundFirst = true
// }
// if e == "second" {
// foundSecond = true
// }
// if e == "third" {
// foundThird = true
// }
// }
// if !foundFirst {
// t.Fatalf("Didn't find 'first' in plan metadata")
// }
// if !foundSecond {
// t.Fatalf("Didn't find 'second' in plan metadata")
// }
// if !foundThird {
// t.Fatalf("Didn't find 'third' in plan metadata")
// }
// foundSvcMeta2 = true
// }
// }
// }
// if !foundSvcMeta1 {
// t.Fatalf("Didn't find metadata in service1")
// }
// if !foundSvcMeta2 {
// t.Fatalf("Didn't find metadata in service2")
// }
// if !foundPlanMeta {
// t.Fatalf("Didn't find metadata '' in service1 plan2")
// }
} | explode_data.jsonl/40488 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1525
} | [
2830,
3393,
41606,
48237,
32089,
28678,
1860,
20077,
1155,
353,
8840,
836,
8,
341,
197,
322,
16403,
1669,
609,
436,
65,
727,
7750,
2582,
16094,
197,
322,
1848,
1669,
2951,
38097,
10556,
3782,
8623,
41606,
2354,
32089,
11025,
701,
609,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIoBufferAppendByte(t *testing.T) {
bi := newIoBuffer(1)
b := bi.(*ioBuffer)
input := make([]byte, 0, 1024)
n := randN(1024)
for i := 0; i < n; i++ {
err := b.AppendByte(byte(i))
if err != nil {
t.Fatal(err)
}
input = append(input, byte(i))
}
if b.Len() != n {
t.Errorf("Expect %d bytes, but got %d", n, b.Len())
}
if !bytes.Equal(b.Peek(n), input) {
t.Errorf("Expect %x, but got %x", input, b.Peek(n))
}
} | explode_data.jsonl/24052 | {
"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,
42799,
4095,
23877,
7153,
1155,
353,
8840,
836,
8,
341,
2233,
72,
1669,
501,
42799,
4095,
7,
16,
340,
2233,
1669,
6032,
41399,
815,
4095,
340,
22427,
1669,
1281,
10556,
3782,
11,
220,
15,
11,
220,
16,
15,
17,
19,
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... | 5 |
func TestApplePublicKey_Fetch(t *testing.T) {
teardown := prepareAppleKeysTestServer(t, 8982)
defer teardown()
// valid response checking
ctx := context.Background()
url := fmt.Sprintf("http://127.0.0.1:%d/keys", 8982)
set, err := fetchAppleJWK(ctx, url)
assert.NoError(t, err)
assert.NotEqual(t, appleKeySet{}, set)
// check service response error
url = fmt.Sprintf("http://127.0.0.1:%d/error", 8982)
_, err = fetchAppleJWK(ctx, url)
assert.Error(t, err)
url = fmt.Sprintf("http://127.0.0.1:%d/no-answer", 8982)
ctx, cancelFunc := context.WithTimeout(ctx, time.Second*2)
_, err = fetchAppleJWK(ctx, url)
defer cancelFunc()
assert.Error(t, err)
} | explode_data.jsonl/74293 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 277
} | [
2830,
3393,
26567,
61822,
1400,
2995,
1155,
353,
8840,
836,
8,
341,
197,
665,
37496,
1669,
10549,
26567,
8850,
2271,
5475,
1155,
11,
220,
23,
24,
23,
17,
692,
16867,
49304,
2822,
197,
322,
2697,
2033,
13295,
198,
20985,
1669,
2266,
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 Test_Token_TextEquals_CN(t *testing.T) {
token := Token{
text: []Text{
[]byte("中国"),
[]byte("文字"),
},
}
assert.True(t, token.TextEquals("中国文字"))
} | explode_data.jsonl/78428 | {
"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,
1139,
1679,
20550,
4315,
56621,
1155,
353,
8840,
836,
8,
341,
43947,
1669,
9660,
515,
197,
15425,
25,
3056,
1178,
515,
298,
197,
1294,
3782,
445,
58695,
4461,
298,
197,
1294,
3782,
445,
87335,
4461,
197,
197,
1583,
197,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEnvInfo_GetContainerPorts(t *testing.T) {
fs := filesystem.NewFakeFs()
type fields struct {
devfileObj parser.DevfileObj
componentSettings ComponentSettings
}
tests := []struct {
name string
fields fields
container string
want []string
wantErr bool
}{
{
name: "case 1: Returns ports of specified container in multi container devfile",
fields: fields{
devfileObj: odoTestingUtil.GetTestDevfileObjWithMultipleEndpoints(fs),
},
want: []string{"8080"},
container: "runtime-debug",
},
{
name: "case 2: Returns error if no container is provided",
fields: fields{
devfileObj: odoTestingUtil.GetTestDevfileObjWithMultipleEndpoints(fs),
},
wantErr: true,
},
{
name: "case 3: Returns error if invalid container is specified",
fields: fields{
devfileObj: odoTestingUtil.GetTestDevfileObjWithMultipleEndpoints(fs),
},
container: "invalidcontainer",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ei := &EnvInfo{
devfileObj: tt.fields.devfileObj,
componentSettings: tt.fields.componentSettings,
}
got, err := ei.GetContainerPorts(tt.container)
if (err != nil) != tt.wantErr {
t.Errorf("GetContainerPorts() error = %v, wantErr %v", err, tt.wantErr)
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetContainerPorts() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/72361 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 610
} | [
2830,
3393,
14359,
1731,
13614,
4502,
68273,
1155,
353,
8840,
836,
8,
341,
53584,
1669,
38389,
7121,
52317,
48300,
2822,
13158,
5043,
2036,
341,
197,
27302,
1192,
5261,
286,
6729,
77611,
1192,
5261,
198,
197,
52228,
6086,
5578,
6086,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestQueueRecovery(t *testing.T) {
queue := NewQueue(
SetQueueFile("./queue_periodically"),
SetQueueRecoveryControl(true),
)
if queue.Len() != 3 {
t.Fatal("Recovery error:", queue.Len())
}
v, err := queue.DeQueue()
if err != nil {
t.Fatal(err)
}
if v != 6 {
t.Fatal("Wrong value:", v)
}
v, err = queue.DeQueue()
if err != nil {
t.Fatal(err)
}
if v != 8 {
t.Fatal("Wrong value:", v)
}
v, err = queue.DeQueue()
if err != nil {
t.Fatal(err)
}
if v != 10 {
t.Fatal("Wrong value:", v)
}
} | explode_data.jsonl/55231 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 248
} | [
2830,
3393,
7554,
693,
7449,
1155,
353,
8840,
836,
8,
341,
46993,
1669,
1532,
7554,
1006,
197,
22212,
7554,
1703,
13988,
4584,
20818,
2673,
4461,
197,
22212,
7554,
693,
7449,
3273,
3715,
1326,
197,
692,
743,
7177,
65819,
368,
961,
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... | 8 |
func Test_can_list_roles_assigned_to_a_user(t *testing.T) {
ctx, client, err := tests.NewClient(context.TODO())
require.NoError(t, err)
p := &okta.PasswordCredential{
Value: "Abcd1234",
}
uc := &okta.UserCredentials{
Password: p,
}
profile := okta.UserProfile{}
profile["firstName"] = "John"
profile["lastName"] = "list_roles"
profile["email"] = randomEmail()
profile["login"] = profile["email"]
u := &okta.CreateUserRequest{
Credentials: uc,
Profile: &profile,
}
user, _, err := client.User.CreateUser(ctx, *u, nil)
require.NoError(t, err, "Creating a new user should not error")
role := okta.AssignRoleRequest{
Type: "SUPER_ADMIN",
}
_, _, err = client.User.AssignRoleToUser(ctx, user.Id, role, nil)
require.NoError(t, err, "adding role to user must not error")
roles, response, err := client.User.ListAssignedRolesForUser(ctx, user.Id, nil)
require.NoError(t, err, "listing administrator roles must not error")
require.IsType(t, &okta.Response{}, response, "did not return `*okta.Response` type as second variable")
require.IsType(t, []*okta.Role{}, roles, "did not return `[]*okta.Role` as first variable")
assert.Equal(t, "GET", response.Response.Request.Method, "did not make a get request")
assert.Equal(t, "/api/v1/users/"+user.Id+"/roles", response.Response.Request.URL.Path, "path for request was incorrect")
assert.NotEmpty(t, roles, "listing roles result should not be empty")
assert.NotEmpty(t, roles[0].Id, "id should not be empty")
assert.NotEmpty(t, roles[0].Label, "label should not be empty")
assert.NotEmpty(t, roles[0].Type, "type should not be empty")
assert.NotEmpty(t, roles[0].Status, "status should not be empty")
assert.NotEmpty(t, roles[0].Created, "created should not be empty")
assert.NotEmpty(t, roles[0].LastUpdated, "lastUpdated should not be empty")
assert.NotEmpty(t, roles[0].AssignmentType, "assignmentType should not be empty")
_, err = client.User.DeactivateUser(ctx, user.Id, nil)
require.NoError(t, err, "Should not error when deactivating")
_, err = client.User.DeactivateOrDeleteUser(ctx, user.Id, nil)
require.NoError(t, err, "Should not error when deleting")
} | explode_data.jsonl/31229 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 774
} | [
2830,
3393,
27421,
2019,
43061,
85515,
2346,
4306,
3317,
1155,
353,
8840,
836,
8,
341,
20985,
11,
2943,
11,
1848,
1669,
7032,
7121,
2959,
5378,
90988,
2398,
17957,
35699,
1155,
11,
1848,
340,
3223,
1669,
609,
562,
2565,
25690,
48265,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWatch(t *testing.T) {
storage, server := newStorage(t)
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestWatch(
validNewPodTemplate("foo"),
// matching labels
[]labels.Set{},
// not matching labels
[]labels.Set{
{"foo": "bar"},
},
// matching fields
[]fields.Set{},
// not matching fields
[]fields.Set{
{"metadata.name": "bar"},
{"name": "foo"},
},
)
} | explode_data.jsonl/1752 | {
"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,
14247,
1155,
353,
8840,
836,
8,
341,
197,
16172,
11,
3538,
1669,
501,
5793,
1155,
340,
16867,
3538,
836,
261,
34016,
1155,
340,
16867,
5819,
38047,
57011,
9626,
741,
18185,
1669,
19424,
1944,
7121,
1155,
11,
5819,
38047,
340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFindAllAfterDeleteSingleWord(t *testing.T) {
filter := New()
filter.AddWord("有一个东西")
filter.AddWord("一个东西")
filter.AddWord("一个")
filter.AddWord("东西")
filter.AddWord("个东")
testcases := []struct {
Text string
Expect []string
DelWord string
ThenExpect []string
}{
{"我有一个东东西", []string{"一个", "个东", "东西"}, "一个", []string{"个东", "东西"}},
{"我有一个东西", []string{"有一个东西", "一个", "一个东西", "个东", "东西"}, "有一个东西", []string{"一个", "一个东西", "个东", "东西"}},
{"一个东西", []string{"一个", "一个东西", "个东", "东西"}, "一个东西", []string{"一个", "个东", "东西"}},
{"两个东西", []string{"个东", "东西"}, "东西", []string{"个东"}},
{"一个物体", []string{"一个"}, "一个", nil},
}
for _, tc := range testcases {
if got := filter.FindAll(tc.Text); !reflect.DeepEqual(tc.Expect, got) {
t.Errorf("findall %s, got %s, expect %s", tc.Text, got, tc.Expect)
}
filter.DelWord(tc.DelWord)
if got := filter.FindAll(tc.Text); !reflect.DeepEqual(tc.ThenExpect, got) {
t.Errorf("after del a word, findall %s, got %s, expect %s", tc.Text, got, tc.ThenExpect)
}
filter.AddWord(tc.DelWord)
}
} | explode_data.jsonl/80997 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 635
} | [
2830,
3393,
9885,
2403,
6025,
6435,
10888,
10879,
1155,
353,
8840,
836,
8,
341,
50108,
1669,
1532,
741,
50108,
1904,
10879,
445,
104133,
100413,
1138,
50108,
1904,
10879,
445,
46944,
100413,
1138,
50108,
1904,
10879,
445,
46944,
1138,
50108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStructure(t *testing.T) {
f := forest.NewForest()
// Create the following forest:
// foo -> bar
// |
// -> fooRC (RequiredChild of foo)
foo := createNS(f, "foo", nil)
bar := createNS(f, "bar", nil)
createOwnedNS(f, "fooRC", foo)
createNS(f, "baz", nil)
bar.SetParent(foo)
h := &Hierarchy{Forest: f}
l := zap.Logger(false)
tests := []struct {
name string
nnm string
pnm string
rcm []string
fail bool
}{
{name: "ok", nnm: "foo", pnm: "baz"},
{name: "missing parent", nnm: "foo", pnm: "brumpf", fail: true},
{name: "self-cycle", nnm: "foo", pnm: "foo", fail: true},
{name: "other cycle", nnm: "foo", pnm: "bar", fail: true},
{name: "rc ok", rcm: []string{"bar-baz"}, nnm: "foo"},
{name: "rc upper invalid", rcm: []string{"BAR"}, nnm: "foo", fail: true},
{name: "rc begin invalid", rcm: []string{"^bar"}, nnm: "foo", fail: true},
{name: "rc end invalid", rcm: []string{"bar^"}, nnm: "foo", fail: true},
{name: "rc char invalid", rcm: []string{"bar.baz"}, nnm: "foo", fail: true},
{name: "rc max str len", rcm: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, nnm: "foo"},
{name: "rc over max str len", rcm: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, nnm: "foo", fail: true},
{name: "rc ok", rcm: []string{"bar"}, nnm: "foo"},
{name: "rc invalid - is an rc of another NS", rcm: []string{"fooRC"}, nnm: "bar", fail: true},
{name: "rc invalid - is a child of another NS", rcm: []string{"bar"}, nnm: "fooRC", fail: true},
{name: "rc invalid - is a root", rcm: []string{"foo"}, nnm: "bar", fail: true},
{name: "parent ok", nnm: "bar", pnm: "fooRC"},
{name: "parent invalid - is an rc of another NS", nnm: "fooRC", pnm: "bar", fail: true},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
// Setup
g := NewGomegaWithT(t)
hc := &api.HierarchyConfiguration{Spec: api.HierarchyConfigurationSpec{Parent: tc.pnm, RequiredChildren: tc.rcm}}
hc.ObjectMeta.Name = api.Singleton
hc.ObjectMeta.Namespace = tc.nnm
req := &request{hc: hc}
// Test
got := h.handle(context.Background(), l, req)
// Report
logResult(t, got.AdmissionResponse.Result)
g.Expect(got.AdmissionResponse.Allowed).ShouldNot(Equal(tc.fail))
})
}
} | explode_data.jsonl/35732 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 941
} | [
2830,
3393,
22952,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
13638,
7121,
49578,
741,
197,
322,
4230,
279,
2701,
13638,
510,
197,
322,
15229,
1464,
3619,
198,
197,
322,
257,
9248,
197,
322,
257,
1464,
15229,
7380,
320,
8164,
3652,
315... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExistUtxo(t *testing.T) {
chainDb, chainDbTearDown, err := GetDb("TstExistUtoxChainDb")
if !assert.Nil(t, err) {
t.Fatal(err)
}
defer chainDbTearDown()
s, walletDb, teardown, err := testTxStore("TstExistUtxo", chainDb)
if !assert.Nil(t, err) {
t.Fatal(err)
}
defer teardown()
err = mwdb.Update(walletDb, func(ns mwdb.DBTransaction) error {
wIds := s.ksmgr.ListKeystoreNames()
err = s.ksmgr.UseKeystoreForWallet(wIds[0])
if err != nil {
return err
}
allMinedBalances := map[string]massutil.Amount{
wIds[0]: massutil.ZeroAmount(),
}
for _, block := range blks200[0:10] {
blockMeta := &BlockMeta{
block.MsgBlock().Header.Height,
*block.Hash(),
block.MsgBlock().Header.Timestamp,
}
for _, tx := range block.Transactions() {
rec, err := NewTxRecordFromMsgTx(tx.MsgTx(), time.Now())
if err != nil {
return err
}
rec, err = simpleFilterTx(rec, tx.MsgTx(), s, blockMeta, wIds[0])
if err != nil {
return err
}
err = s.AddRelevantTx(ns, allMinedBalances, rec, blockMeta)
if err != nil {
return err
}
}
}
return nil
})
assert.Nil(t, err)
mwdb.View(walletDb, func(ns mwdb.ReadTransaction) error {
for j, block := range blks200[0:15] {
for _, tx := range block.Transactions() {
txhash := tx.Hash()
for i, _ := range tx.MsgTx().TxOut {
outPoint := wire.OutPoint{Hash: *txhash, Index: uint32(i)}
f, err := s.ExistsUtxo(ns, &outPoint)
if j >= 10 {
assert.Equal(t, ErrNotFound, err)
} else {
assert.Nil(t, err)
assert.NotNil(t, f)
assert.False(t, f.Spent)
assert.False(t, f.SpentByUnmined)
}
}
}
}
return nil
})
} | explode_data.jsonl/9768 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 818
} | [
2830,
3393,
25613,
52,
3998,
78,
1155,
353,
8840,
836,
8,
341,
197,
8819,
7994,
11,
8781,
7994,
51,
682,
4454,
11,
1848,
1669,
2126,
7994,
445,
51,
267,
25613,
52,
983,
87,
18837,
7994,
1138,
743,
753,
2207,
59678,
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... | 7 |
func TestInterface(t *testing.T) {
t.Parallel()
// Create a new database to run tests against.
dbPath := filepath.Join(os.TempDir(), "ffldb-interfacetest")
_ = os.RemoveAll(dbPath)
db, err := database.Create(dbType, dbPath, blockDataNet)
if err != nil {
t.Errorf("Failed to create test database (%s) %v", dbType, err)
return
}
defer os.RemoveAll(dbPath)
defer db.Close()
// Ensure the driver type is the expected value.
gotDbType := db.Type()
if gotDbType != dbType {
t.Errorf("Type: unepxected driver type - got %v, want %v",
gotDbType, dbType)
return
}
// Run all of the interface tests against the database.
runtime.GOMAXPROCS(runtime.NumCPU())
// Change the maximum file size to a small value to force multiple flat
// files with the test data set.
ffldb.TstRunWithMaxBlockFileSize(db, 2048, func() {
testInterface(t, db)
})
} | explode_data.jsonl/26988 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 313
} | [
2830,
3393,
5051,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
322,
4230,
264,
501,
4625,
311,
1598,
7032,
2348,
624,
20939,
1820,
1669,
26054,
22363,
9638,
65009,
6184,
1507,
330,
542,
56925,
44894,
22185,
57824,
1138,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLastContent(t *testing.T) {
for _, tt := range []struct {
rule string
want *Content
}{
{
rule: `alert udp $HOME_NET any -> $EXTERNAL_NET any (sid:1337; msg:"foo"; content:"bar";)`,
want: &Content{Pattern: []byte("bar")},
},
{
rule: `alert udp $HOME_NET any -> $EXTERNAL_NET any (sid:1337; msg:"foo"; content:"bar"; pcre:"/foo.*bar/iU"; content:"foo"; within:40; pcre:"/foo.*bar.*baz/iU";)`,
want: &Content{
Pattern: []byte("foo"),
Options: []*ContentOption{
{
Name: "within",
Value: "40",
},
},
},
},
{
rule: `alert udp $HOME_NET any -> $EXTERNAL_NET any (sid:1337; msg:"foo";)`,
want: nil,
},
} {
r, err := ParseRule(tt.rule)
if err != nil {
t.Fatalf("re: parse rule failed: %v", err)
}
diff := pretty.Compare(r.LastContent(), tt.want)
if diff != "" {
t.Fatalf(fmt.Sprintf("diff (-got +want):\n%s", diff))
}
}
} | explode_data.jsonl/59694 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 431
} | [
2830,
3393,
5842,
2762,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17853,
1669,
2088,
3056,
1235,
341,
197,
7000,
1111,
914,
198,
197,
50780,
353,
2762,
198,
197,
59403,
197,
197,
515,
298,
7000,
1111,
25,
1565,
5083,
49219,
400,
27546... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestClientWithClaims(t *testing.T) {
testKey := "testKey"
mapClaims := jwt.MapClaims{}
mapClaims["name"] = "xiaoli"
claims := jwt.NewWithClaims(jwt.SigningMethodHS256, mapClaims)
token, err := claims.SignedString([]byte(testKey))
if err != nil {
panic(err)
}
tProvider := func(*jwt.Token) (interface{}, error) {
return []byte(testKey), nil
}
test := struct {
name string
expectError error
tokenProvider jwt.Keyfunc
}{
name: "normal",
expectError: nil,
tokenProvider: tProvider,
}
t.Run(test.name, func(t *testing.T) {
next := func(ctx context.Context, req interface{}) (interface{}, error) {
return "reply", nil
}
handler := Client(test.tokenProvider, WithClaims(mapClaims))(next)
header := &headerCarrier{}
_, err2 := handler(transport.NewClientContext(context.Background(), &Transport{reqHeader: header}), "ok")
if !errors.Is(test.expectError, err2) {
t.Errorf("except error %v, but got %v", test.expectError, err2)
}
if err2 == nil {
if !reflect.DeepEqual(header.Get(authorizationKey), fmt.Sprintf(bearerFormat, token)) {
t.Errorf("except header %s, but got %s", fmt.Sprintf(bearerFormat, token), header.Get(authorizationKey))
}
}
})
} | explode_data.jsonl/47111 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 494
} | [
2830,
3393,
2959,
2354,
51133,
1155,
353,
8840,
836,
8,
341,
18185,
1592,
1669,
330,
1944,
1592,
698,
19567,
51133,
1669,
24589,
10104,
51133,
16094,
19567,
51133,
1183,
606,
1341,
284,
330,
67194,
14225,
698,
197,
48561,
1669,
24589,
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... | 1 |
func TestCreateChannel(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
defer th.TearDown()
Client := th.Client
team := th.BasicTeam
channel := &model.Channel{DisplayName: "Test API Name", Name: GenerateTestChannelName(), Type: model.CHANNEL_OPEN, TeamId: team.Id}
private := &model.Channel{DisplayName: "Test API Name", Name: GenerateTestChannelName(), Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
rchannel, resp := Client.CreateChannel(channel)
CheckNoError(t, resp)
CheckCreatedStatus(t, resp)
if rchannel.Name != channel.Name {
t.Fatal("names did not match")
}
if rchannel.DisplayName != channel.DisplayName {
t.Fatal("display names did not match")
}
if rchannel.TeamId != channel.TeamId {
t.Fatal("team ids did not match")
}
rprivate, resp := Client.CreateChannel(private)
CheckNoError(t, resp)
if rprivate.Name != private.Name {
t.Fatal("names did not match")
}
if rprivate.Type != model.CHANNEL_PRIVATE {
t.Fatal("wrong channel type")
}
if rprivate.CreatorId != th.BasicUser.Id {
t.Fatal("wrong creator id")
}
_, resp = Client.CreateChannel(channel)
CheckErrorMessage(t, resp, "store.sql_channel.save_channel.exists.app_error")
CheckBadRequestStatus(t, resp)
direct := &model.Channel{DisplayName: "Test API Name", Name: GenerateTestChannelName(), Type: model.CHANNEL_DIRECT, TeamId: team.Id}
_, resp = Client.CreateChannel(direct)
CheckErrorMessage(t, resp, "api.channel.create_channel.direct_channel.app_error")
CheckBadRequestStatus(t, resp)
Client.Logout()
_, resp = Client.CreateChannel(channel)
CheckUnauthorizedStatus(t, resp)
userNotOnTeam := th.CreateUser()
Client.Login(userNotOnTeam.Email, userNotOnTeam.Password)
_, resp = Client.CreateChannel(channel)
CheckForbiddenStatus(t, resp)
_, resp = Client.CreateChannel(private)
CheckForbiddenStatus(t, resp)
th.LoginBasic()
// Check permissions with policy config changes
isLicensed := utils.IsLicensed()
license := utils.License()
restrictPublicChannel := *th.App.Config().TeamSettings.RestrictPublicChannelCreation
restrictPrivateChannel := *th.App.Config().TeamSettings.RestrictPrivateChannelCreation
defer func() {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictPublicChannelCreation = restrictPublicChannel })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictPrivateChannelCreation = restrictPrivateChannel })
utils.SetIsLicensed(isLicensed)
utils.SetLicense(license)
th.App.SetDefaultRolesBasedOnConfig()
}()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictPublicChannelCreation = model.PERMISSIONS_ALL })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictPrivateChannelCreation = model.PERMISSIONS_ALL })
utils.SetIsLicensed(true)
utils.SetLicense(&model.License{Features: &model.Features{}})
utils.License().Features.SetDefaults()
th.App.SetDefaultRolesBasedOnConfig()
channel.Name = GenerateTestChannelName()
_, resp = Client.CreateChannel(channel)
CheckNoError(t, resp)
private.Name = GenerateTestChannelName()
_, resp = Client.CreateChannel(private)
CheckNoError(t, resp)
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.TeamSettings.RestrictPublicChannelCreation = model.PERMISSIONS_TEAM_ADMIN
})
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.TeamSettings.RestrictPrivateChannelCreation = model.PERMISSIONS_TEAM_ADMIN
})
th.App.SetDefaultRolesBasedOnConfig()
_, resp = Client.CreateChannel(channel)
CheckForbiddenStatus(t, resp)
_, resp = Client.CreateChannel(private)
CheckForbiddenStatus(t, resp)
th.LoginTeamAdmin()
channel.Name = GenerateTestChannelName()
_, resp = Client.CreateChannel(channel)
CheckNoError(t, resp)
private.Name = GenerateTestChannelName()
_, resp = Client.CreateChannel(private)
CheckNoError(t, resp)
channel.Name = GenerateTestChannelName()
_, resp = th.SystemAdminClient.CreateChannel(channel)
CheckNoError(t, resp)
private.Name = GenerateTestChannelName()
_, resp = th.SystemAdminClient.CreateChannel(private)
CheckNoError(t, resp)
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.TeamSettings.RestrictPublicChannelCreation = model.PERMISSIONS_SYSTEM_ADMIN
})
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.TeamSettings.RestrictPrivateChannelCreation = model.PERMISSIONS_SYSTEM_ADMIN
})
th.App.SetDefaultRolesBasedOnConfig()
th.LoginBasic()
_, resp = Client.CreateChannel(channel)
CheckForbiddenStatus(t, resp)
_, resp = Client.CreateChannel(private)
CheckForbiddenStatus(t, resp)
th.LoginTeamAdmin()
_, resp = Client.CreateChannel(channel)
CheckForbiddenStatus(t, resp)
_, resp = Client.CreateChannel(private)
CheckForbiddenStatus(t, resp)
channel.Name = GenerateTestChannelName()
_, resp = th.SystemAdminClient.CreateChannel(channel)
CheckNoError(t, resp)
private.Name = GenerateTestChannelName()
_, resp = th.SystemAdminClient.CreateChannel(private)
CheckNoError(t, resp)
// Check that if unlicensed the policy restriction is not enforced.
utils.SetIsLicensed(false)
utils.SetLicense(nil)
th.App.SetDefaultRolesBasedOnConfig()
channel.Name = GenerateTestChannelName()
_, resp = Client.CreateChannel(channel)
CheckNoError(t, resp)
private.Name = GenerateTestChannelName()
_, resp = Client.CreateChannel(private)
CheckNoError(t, resp)
if r, err := Client.DoApiPost("/channels", "garbage"); err == nil {
t.Fatal("should have errored")
} else {
if r.StatusCode != http.StatusBadRequest {
t.Log("actual: " + strconv.Itoa(r.StatusCode))
t.Log("expected: " + strconv.Itoa(http.StatusBadRequest))
t.Fatal("wrong status code")
}
}
} | explode_data.jsonl/65642 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1915
} | [
2830,
3393,
4021,
9629,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1005,
3803,
15944,
1005,
3803,
2320,
7210,
741,
16867,
270,
836,
682,
4454,
741,
71724,
1669,
270,
11716,
198,
197,
9196,
1669,
270,
48868,
14597,
271,
71550,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDebugCallGrowStack(t *testing.T) {
g, after := startDebugCallWorker(t)
defer after()
// Inject a call that grows the stack. debugCallWorker checks
// for stack pointer breakage.
if _, err := runtime.InjectDebugCall(g, func() { growStack(nil) }, nil, nil, debugCallTKill, false); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/9339 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 116
} | [
2830,
3393,
7939,
7220,
56788,
4336,
1155,
353,
8840,
836,
8,
341,
3174,
11,
1283,
1669,
1191,
7939,
7220,
21936,
1155,
340,
16867,
1283,
2822,
197,
322,
21843,
264,
1618,
429,
27715,
279,
5611,
13,
7390,
7220,
21936,
12341,
198,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNoCrashReturningTransportAltConn(t *testing.T) {
cert, err := tls.X509KeyPair(internal.LocalhostCert, internal.LocalhostKey)
if err != nil {
t.Fatal(err)
}
ln := newLocalListener(t)
defer ln.Close()
var wg sync.WaitGroup
SetPendingDialHooks(func() { wg.Add(1) }, wg.Done)
defer SetPendingDialHooks(nil, nil)
testDone := make(chan struct{})
defer close(testDone)
go func() {
tln := tls.NewListener(ln, &tls.Config{
NextProtos: []string{"foo"},
Certificates: []tls.Certificate{cert},
})
sc, err := tln.Accept()
if err != nil {
t.Error(err)
return
}
if err := sc.(*tls.Conn).Handshake(); err != nil {
t.Error(err)
return
}
<-testDone
sc.Close()
}()
addr := ln.Addr().String()
req, _ := NewRequest("GET", "https://fake.tld/", nil)
cancel := make(chan struct{})
req.Cancel = cancel
doReturned := make(chan bool, 1)
madeRoundTripper := make(chan bool, 1)
tr := &Transport{
DisableKeepAlives: true,
TLSNextProto: map[string]func(string, *tls.Conn) RoundTripper{
"foo": func(authority string, c *tls.Conn) RoundTripper {
madeRoundTripper <- true
return funcRoundTripper(func() {
t.Error("foo RoundTripper should not be called")
})
},
},
Dial: func(_, _ string) (net.Conn, error) {
panic("shouldn't be called")
},
DialTLS: func(_, _ string) (net.Conn, error) {
tc, err := tls.Dial("tcp", addr, &tls.Config{
InsecureSkipVerify: true,
NextProtos: []string{"foo"},
})
if err != nil {
return nil, err
}
if err := tc.Handshake(); err != nil {
return nil, err
}
close(cancel)
<-doReturned
return tc, nil
},
}
c := &Client{Transport: tr}
_, err = c.Do(req)
if ue, ok := err.(*url.Error); !ok || ue.Err != ExportErrRequestCanceledConn {
t.Fatalf("Do error = %v; want url.Error with errRequestCanceledConn", err)
}
doReturned <- true
<-madeRoundTripper
wg.Wait()
} | explode_data.jsonl/14153 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 838
} | [
2830,
3393,
2753,
16001,
988,
84814,
27560,
26017,
9701,
1155,
353,
8840,
836,
8,
341,
1444,
529,
11,
1848,
1669,
55026,
4338,
20,
15,
24,
1592,
12443,
98364,
20856,
3790,
36934,
11,
5306,
20856,
3790,
1592,
340,
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... | 1 |
func TestStartInstance(t *testing.T) {
singleton := GetInstance()
singleton2 := GetInstance()
n := 5000
fmt.Printf("Before invoking singleton.Addone(), current count is %d\n", singleton.GetCount())
for i := 0; i < n; i++ {
go singleton.AddOne()
go singleton2.AddOne()
}
fmt.Printf("Before loop to GetCount, current count is %d\n", singleton.GetCount())
var val int
for val != n*2 {
val = singleton.GetCount()
time.Sleep(10 * time.Millisecond)
}
} | explode_data.jsonl/49641 | {
"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,
3479,
2523,
1155,
353,
8840,
836,
8,
341,
1903,
75710,
1669,
2126,
2523,
741,
1903,
75710,
17,
1669,
2126,
2523,
2822,
9038,
1669,
220,
20,
15,
15,
15,
198,
11009,
19367,
445,
10227,
46028,
36903,
1904,
603,
1507,
1482,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestProxyUpgradeErrorResponse(t *testing.T) {
var (
responder *fakeResponder
expectedErr = errors.New("EXPECTED")
)
proxy := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
transport := http.DefaultTransport.(*http.Transport)
transport.Dial = func(network, addr string) (net.Conn, error) {
return &fakeConn{err: expectedErr}, nil
}
responder = &fakeResponder{t: t, w: w}
proxyHandler := &UpgradeAwareProxyHandler{
Location: &url.URL{
Host: "fake-backend",
},
UpgradeRequired: true,
Responder: responder,
Transport: transport,
}
proxyHandler.ServeHTTP(w, r)
}))
defer proxy.Close()
// Send request to proxy server.
req, err := http.NewRequest("POST", "http://"+proxy.Listener.Addr().String()+"/some/path", nil)
require.NoError(t, err)
req.Header.Set(httpstream.HeaderConnection, httpstream.HeaderUpgrade)
resp, err := http.DefaultClient.Do(req)
require.NoError(t, err)
defer resp.Body.Close()
// Expect error response.
assert.True(t, responder.called)
assert.Equal(t, fakeStatusCode, resp.StatusCode)
msg, err := ioutil.ReadAll(resp.Body)
require.NoError(t, err)
assert.Contains(t, string(msg), expectedErr.Error())
} | explode_data.jsonl/13574 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 470
} | [
2830,
3393,
16219,
43861,
55901,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
10202,
20328,
256,
353,
30570,
30884,
198,
197,
42400,
7747,
284,
5975,
7121,
445,
80002,
1138,
197,
340,
197,
22803,
1669,
54320,
70334,
7121,
5475,
19886,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExtending(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
l1 := New()
l2 := New()
l1.PushBack(1)
l1.PushBack(2)
l1.PushBack(3)
l2.PushBack(4)
l2.PushBack(5)
l3 := New()
l3.PushBackList(l1)
checkList(t, l3, []interface{}{1, 2, 3})
l3.PushBackList(l2)
checkList(t, l3, []interface{}{1, 2, 3, 4, 5})
l3 = New()
l3.PushFrontList(l2)
checkList(t, l3, []interface{}{4, 5})
l3.PushFrontList(l1)
checkList(t, l3, []interface{}{1, 2, 3, 4, 5})
checkList(t, l1, []interface{}{1, 2, 3})
checkList(t, l2, []interface{}{4, 5})
l3 = New()
l3.PushBackList(l1)
checkList(t, l3, []interface{}{1, 2, 3})
l3.PushBackList(l3)
checkList(t, l3, []interface{}{1, 2, 3, 1, 2, 3})
l3 = New()
l3.PushFrontList(l1)
checkList(t, l3, []interface{}{1, 2, 3})
l3.PushFrontList(l3)
checkList(t, l3, []interface{}{1, 2, 3, 1, 2, 3})
l3 = New()
l1.PushBackList(l3)
checkList(t, l1, []interface{}{1, 2, 3})
l1.PushFrontList(l3)
checkList(t, l1, []interface{}{1, 2, 3})
})
} | explode_data.jsonl/30887 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 545
} | [
2830,
3393,
6756,
2459,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
8810,
16,
1669,
1532,
741,
197,
8810,
17,
1669,
1532,
2822,
197,
8810,
16,
34981,
3707,
7,
16,
340,
197,
88... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEmptyResync(t *testing.T) {
RegisterTestingT(t)
// prepare KV Scheduler
scheduler := NewPlugin(UseDeps(func(deps *Deps) {
deps.HTTPHandlers = nil
}))
err := scheduler.Init()
Expect(err).To(BeNil())
// prepare mocks
mockSB := test.NewMockSouthbound()
descriptor1 := test.NewMockDescriptor(&KVDescriptor{
Name: descriptor1Name,
NBKeyPrefix: prefixA,
KeySelector: prefixSelector(prefixA),
WithMetadata: true,
}, mockSB, 0)
// register descriptor with the scheduler
scheduler.RegisterKVDescriptor(descriptor1)
nbPrefixes := scheduler.GetRegisteredNBKeyPrefixes()
Expect(nbPrefixes).To(HaveLen(1))
Expect(nbPrefixes).To(ContainElement(prefixA))
// get metadata map created for the descriptor
metadataMap := scheduler.GetMetadataMap(descriptor1.Name)
_, withMetadataMap := metadataMap.(test.NameToInteger)
Expect(withMetadataMap).To(BeTrue())
// transaction history should be initially empty
Expect(scheduler.GetTransactionHistory(time.Time{}, time.Time{})).To(BeEmpty())
// run transaction with empty resync
startTime := time.Now()
ctx := WithResync(testCtx, FullResync, true)
description := "testing empty resync"
ctx = WithDescription(ctx, description)
seqNum, err := scheduler.StartNBTransaction().Commit(ctx)
stopTime := time.Now()
Expect(seqNum).To(BeEquivalentTo(0))
Expect(err).ShouldNot(HaveOccurred())
// check the state of SB
Expect(mockSB.GetKeysWithInvalidData()).To(BeEmpty())
Expect(mockSB.GetValues(nil)).To(BeEmpty())
// check metadata
Expect(metadataMap.ListAllNames()).To(BeEmpty())
// check executed operations
opHistory := mockSB.PopHistoryOfOps()
Expect(opHistory).To(HaveLen(1))
Expect(opHistory[0].OpType).To(Equal(test.MockRetrieve))
Expect(opHistory[0].CorrelateRetrieve).To(BeEmpty())
Expect(opHistory[0].Descriptor).To(BeEquivalentTo(descriptor1Name))
// single transaction consisted of zero operations
txnHistory := scheduler.GetTransactionHistory(time.Time{}, time.Time{})
Expect(txnHistory).To(HaveLen(1))
txn := txnHistory[0]
Expect(txn.PreRecord).To(BeFalse())
Expect(txn.Start.After(startTime)).To(BeTrue())
Expect(txn.Start.Before(txn.Stop)).To(BeTrue())
Expect(txn.Stop.Before(stopTime)).To(BeTrue())
Expect(txn.SeqNum).To(BeEquivalentTo(0))
Expect(txn.TxnType).To(BeEquivalentTo(NBTransaction))
Expect(txn.RetryAttempt).To(BeEquivalentTo(0))
Expect(txn.RetryForTxn).To(BeEquivalentTo(0))
Expect(txn.ResyncType).To(BeEquivalentTo(FullResync))
Expect(txn.Description).To(Equal(description))
Expect(txn.Values).To(BeEmpty())
Expect(txn.Planned).To(BeEmpty())
Expect(txn.Executed).To(BeEmpty())
// check flag stats
graphR := scheduler.graph.Read()
errorStats := graphR.GetFlagStats(ErrorFlagIndex, nil)
Expect(errorStats.TotalCount).To(BeEquivalentTo(0))
pendingStats := graphR.GetFlagStats(UnavailValueFlagIndex, nil)
Expect(pendingStats.TotalCount).To(BeEquivalentTo(0))
derivedStats := graphR.GetFlagStats(DerivedFlagIndex, nil)
Expect(derivedStats.TotalCount).To(BeEquivalentTo(0))
lastUpdateStats := graphR.GetFlagStats(LastUpdateFlagIndex, nil)
Expect(lastUpdateStats.TotalCount).To(BeEquivalentTo(0))
descriptorStats := graphR.GetFlagStats(DescriptorFlagIndex, nil)
Expect(descriptorStats.TotalCount).To(BeEquivalentTo(0))
valueStateStats := graphR.GetFlagStats(ValueStateFlagIndex, nil)
Expect(valueStateStats.TotalCount).To(BeEquivalentTo(0))
graphR.Release()
// close scheduler
err = scheduler.Close()
Expect(err).To(BeNil())
} | explode_data.jsonl/6531 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1279
} | [
2830,
3393,
3522,
1061,
1721,
1155,
353,
8840,
836,
8,
341,
79096,
16451,
51,
1155,
692,
197,
322,
10549,
84648,
44759,
198,
1903,
15222,
1669,
1532,
11546,
7,
10253,
35,
7124,
18552,
12797,
1690,
353,
35,
7124,
8,
341,
197,
58351,
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 TestSetMinimumMemoryLimit(t *testing.T) {
testTask := &Task{
Containers: []*apicontainer.Container{
{
Name: "c1",
Memory: uint(1),
},
},
}
hostconfig, err := testTask.DockerHostConfig(testTask.Containers[0], dockerMap(testTask), defaultDockerClientAPIVersion,
&config.Config{})
assert.Nil(t, err)
assert.Equal(t, int64(apicontainer.DockerContainerMinimumMemoryInBytes), hostconfig.Memory)
hostconfig, err = testTask.DockerHostConfig(testTask.Containers[0], dockerMap(testTask), dockerclient.Version_1_18,
&config.Config{})
assert.Nil(t, err)
assert.Equal(t, int64(apicontainer.DockerContainerMinimumMemoryInBytes), hostconfig.Memory)
} | explode_data.jsonl/37229 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 255
} | [
2830,
3393,
1649,
28695,
10642,
16527,
1155,
353,
8840,
836,
8,
341,
18185,
6262,
1669,
609,
6262,
515,
197,
197,
74632,
25,
29838,
391,
51160,
1743,
33672,
515,
298,
197,
515,
571,
21297,
25,
256,
330,
66,
16,
756,
571,
9209,
4731,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ddosxDomainWAFAdvancedRuleCreateCmd_Args(t *testing.T) {
t.Run("ValidArgs_NoError", func(t *testing.T) {
cmd := ddosxDomainWAFAdvancedRuleCreateCmd()
err := cmd.Args(nil, []string{"testdomain1.co.uk"})
assert.Nil(t, err)
})
t.Run("MissingDomain_Error", func(t *testing.T) {
cmd := ddosxDomainWAFAdvancedRuleCreateCmd()
err := cmd.Args(nil, []string{})
assert.NotNil(t, err)
assert.Equal(t, "Missing domain", err.Error())
})
} | explode_data.jsonl/43033 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 185
} | [
2830,
3393,
43174,
436,
87,
13636,
54,
8276,
35457,
11337,
4021,
15613,
87581,
82,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
4088,
4117,
36989,
1454,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
25920,
1669,
19647,
436,
87,
136... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNestedMounts(t *testing.T) {
sc, c, cleanup := createContexts(t)
defer cleanup()
root, mts, _, stopper := createNamespace(t, sc)
runNestedMountTables(t, sc, mts)
defer stopper()
ns := v23.GetNamespace(c)
ns.SetRoots(root.name)
// Set up some nested mounts and verify resolution.
for _, m := range []string{"mt4/foo", "mt4/foo/bar"} {
testResolve(t, c, ns, m, mts[m].name)
}
testResolveToMountTable(t, c, ns, "mt4/foo",
naming.JoinAddressName(mts[mt4MP].name, "foo"))
testResolveToMountTable(t, c, ns, "mt4/foo/bar",
naming.JoinAddressName(mts["mt4/foo"].name, "bar"))
testResolveToMountTable(t, c, ns, "mt4/foo/baz",
naming.JoinAddressName(mts["mt4/foo"].name, "baz"))
} | explode_data.jsonl/8226 | {
"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,
71986,
16284,
82,
1155,
353,
8840,
836,
8,
341,
29928,
11,
272,
11,
21290,
1669,
83674,
82,
1155,
340,
16867,
21290,
2822,
33698,
11,
296,
2576,
11,
8358,
2936,
712,
1669,
1855,
22699,
1155,
11,
1136,
340,
56742,
71986,
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... | 2 |
func TestIterateLiens(t *testing.T) {
ctx, _, _, _, keeper := makeTestKit().expand()
var liens map[string]types.Lien
cb := func(a sdk.AccAddress, l types.Lien) bool {
liens[a.String()] = l
return false
}
reset := func() {
liens = make(map[string]types.Lien)
}
// Empty
reset()
keeper.IterateLiens(ctx, cb)
if len(liens) > 0 {
t.Errorf("empty lien store has %v", liens)
}
// One
reset()
amt1 := ubld(123)
keeper.SetLien(ctx, addr1, types.Lien{Coins: amt1})
keeper.IterateLiens(ctx, cb)
wantLiens := map[string]types.Lien{
addr1.String(): {Coins: amt1},
}
if !reflect.DeepEqual(liens, wantLiens) {
t.Errorf("singleton lien store has liens %v, want %v", liens, wantLiens)
}
// Several (including zero)
reset()
amt2 := ubld(456)
keeper.SetLien(ctx, addr2, types.Lien{Coins: amt2})
keeper.SetLien(ctx, addr3, types.Lien{})
keeper.IterateLiens(ctx, cb)
wantLiens[addr2.String()] = types.Lien{Coins: amt2}
if !reflect.DeepEqual(liens, wantLiens) {
t.Errorf("multiple lien store has liens %v, want %v", liens, wantLiens)
}
// Early termination
reset()
keeper.IterateLiens(ctx, func(a sdk.AccAddress, l types.Lien) bool {
liens[a.String()] = l
return true
})
// map iteration is non-deterministic, so just check number of results
if len(liens) != 1 {
t.Errorf("early termination has liens %v, want just one", liens)
}
} | explode_data.jsonl/40988 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 584
} | [
2830,
3393,
8537,
349,
45421,
724,
1155,
353,
8840,
836,
8,
341,
20985,
11,
8358,
8358,
8358,
53416,
1669,
1281,
2271,
7695,
1005,
32317,
2822,
2405,
898,
724,
2415,
14032,
60,
9242,
1214,
3591,
198,
63810,
1669,
2915,
2877,
45402,
7753... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIsExcluded(t *testing.T) {
containerdCheck := &ContainerdCheck{
instance: &ContainerdConfig{},
CheckBase: corechecks.NewCheckBase("containerd"),
}
var err error
// GetShareFilter gives us the OOB exclusion of pause container images from most supported platforms
containerdCheck.filters, err = containersutil.GetSharedFilter()
require.NoError(t, err)
img := &mockImage{}
c := &mockContainer{
mockImage: func() (containerd.Image, error) {
img.imageName = "kubernetes/pause"
return containerd.Image(img), nil
},
}
// kubernetes/pause is excluded
isEc := isExcluded(c, context.Background(), containerdCheck.filters)
require.True(t, isEc)
c.mockImage = func() (containerd.Image, error) {
img.imageName = "kubernetes/pawz"
return containerd.Image(img), nil
}
// kubernetes/pawz although not an available image (yet ?) is not ignored
isEc = isExcluded(c, context.Background(), containerdCheck.filters)
require.False(t, isEc)
} | explode_data.jsonl/1859 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 337
} | [
2830,
3393,
3872,
840,
10181,
1155,
353,
8840,
836,
8,
341,
53290,
67,
3973,
1669,
609,
4502,
67,
3973,
515,
197,
56256,
25,
220,
609,
4502,
67,
2648,
38837,
197,
69472,
3978,
25,
6200,
49383,
7121,
3973,
3978,
445,
3586,
67,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSortedArray_FilterNil(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
values := g.Slice{0, 1, 2, 3, 4, "", g.Slice{}}
array := garray.NewSortedArrayFromCopy(values, gutil.ComparatorInt)
t.Assert(array.FilterNil().Slice(), g.Slice{0, "", g.Slice{}, 1, 2, 3, 4})
})
gtest.C(t, func(t *gtest.T) {
array := garray.NewSortedArrayFromCopy(g.Slice{nil, 1, 2, 3, 4, nil}, gutil.ComparatorInt)
t.Assert(array.FilterNil(), g.Slice{1, 2, 3, 4})
})
} | explode_data.jsonl/67037 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 221
} | [
2830,
3393,
51051,
1857,
68935,
19064,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
45939,
1669,
342,
95495,
90,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
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 TestGetPointsFromGetMeterRealtimeDataJSON(t *testing.T) {
var data, err = ioutil.ReadFile("testfiles/GetMeterRealtimeData.json")
if err != nil {
t.Fatal(err)
}
result, err := getPointsFromGetMeterRealtimeDataJSON(data)
if err != nil {
t.Fatal(err)
}
if len(result) != 1 {
t.Fatalf("Should be 1 was %d", len(result))
}
tags := result[0].Tags()
if tags[FunctionKey] != "GetMeterRealtimeData" {
t.Errorf("tag %s != \"GetMeterRealtimeData\" (%s)", FunctionKey, tags[FunctionKey])
}
if tags[DeviceIDKey] != "0" {
t.Errorf("tag %s != \"0\" (%s)", DeviceIDKey, tags[DeviceIDKey])
}
fields, _ := result[0].Fields()
const expectedLength = 35
if len(fields) != expectedLength {
t.Errorf("Should be %d was %d", expectedLength, len(fields))
}
} | explode_data.jsonl/55792 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 303
} | [
2830,
3393,
1949,
11411,
3830,
1949,
68224,
12768,
1678,
1043,
5370,
1155,
353,
8840,
836,
8,
341,
2405,
821,
11,
1848,
284,
43144,
78976,
445,
1944,
7198,
14,
1949,
68224,
12768,
1678,
1043,
4323,
1138,
743,
1848,
961,
2092,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestColorForStatus(t *testing.T) {
testCases := map[string]struct {
status status.Status
expectedSetColor bool
expectedColor Color
}{
"status with color": {
status: status.CurrentStatus,
expectedSetColor: true,
expectedColor: GREEN,
},
"status without color": {
status: status.NotFoundStatus,
expectedSetColor: false,
},
}
for tn, tc := range testCases {
t.Run(tn, func(t *testing.T) {
color, setColor := ColorForStatus(tc.status)
assert.Equal(t, setColor, tc.expectedSetColor)
if tc.expectedSetColor {
assert.Equal(t, color, tc.expectedColor)
}
})
}
} | explode_data.jsonl/10796 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 277
} | [
2830,
3393,
1636,
2461,
2522,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
2415,
14032,
60,
1235,
341,
197,
23847,
1843,
2639,
10538,
198,
197,
42400,
92156,
1807,
198,
197,
42400,
1636,
262,
3478,
198,
197,
59403,
197,
197,
1,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestConfigServiceV2DeleteSinkError(t *testing.T) {
errCode := codes.Internal
mockConfig.err = grpc.Errorf(errCode, "test error")
var formattedSinkName string = ConfigSinkPath("[PROJECT]", "[SINK]")
var request = &loggingpb.DeleteSinkRequest{
SinkName: formattedSinkName,
}
c, err := NewConfigClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
err = c.DeleteSink(context.Background(), request)
if c := grpc.Code(err); c != errCode {
t.Errorf("got error code %q, want %q", c, errCode)
}
} | explode_data.jsonl/77776 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 199
} | [
2830,
3393,
2648,
1860,
53,
17,
6435,
45094,
1454,
1155,
353,
8840,
836,
8,
341,
9859,
2078,
1669,
13912,
32579,
198,
77333,
2648,
18441,
284,
47900,
13080,
3964,
2078,
11,
330,
1944,
1465,
5130,
2405,
23126,
45094,
675,
914,
284,
5532,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCipherSuitePreference(t *testing.T) {
serverConfig := &Config{
CipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA},
Certificates: testConfig.Certificates,
MaxVersion: VersionTLS11,
}
clientConfig := &Config{
CipherSuites: []uint16{TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_RC4_128_SHA},
InsecureSkipVerify: true,
}
state, err := testHandshake(clientConfig, serverConfig)
if err != nil {
t.Fatalf("handshake failed: %s", err)
}
if state.CipherSuite != TLS_RSA_WITH_AES_128_CBC_SHA {
// By default the server should use the client's preference.
t.Fatalf("Client's preference was not used, got %x", state.CipherSuite)
}
serverConfig.PreferServerCipherSuites = true
state, err = testHandshake(clientConfig, serverConfig)
if err != nil {
t.Fatalf("handshake failed: %s", err)
}
if state.CipherSuite != TLS_RSA_WITH_RC4_128_SHA {
t.Fatalf("Server's preference was not used, got %x", state.CipherSuite)
}
} | explode_data.jsonl/80552 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 417
} | [
2830,
3393,
79460,
28000,
31173,
1155,
353,
8840,
836,
8,
341,
41057,
2648,
1669,
609,
2648,
515,
197,
6258,
10558,
62898,
288,
25,
3056,
2496,
16,
21,
90,
45439,
76994,
23929,
41414,
19,
62,
16,
17,
23,
38096,
11,
41654,
76994,
23929... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSelect_Build(t *testing.T) {
testCases := []struct {
Select *clause.Select
Result *syntax.ClauseSet
}{
{
&clause.Select{Columns: []syntax.Column{{Name: "column"}}},
&syntax.ClauseSet{Keyword: "SELECT", Value: "column"},
},
{
&clause.Select{Columns: []syntax.Column{{Name: "column", Alias: "c"}}},
&syntax.ClauseSet{Keyword: "SELECT", Value: "column AS c"},
},
{
&clause.Select{Columns: []syntax.Column{
{Name: "column1", Alias: "c1"},
{Name: "column2", Alias: "c2"},
}},
&syntax.ClauseSet{Keyword: "SELECT", Value: "column1 AS c1, column2 AS c2"},
},
}
for _, testCase := range testCases {
actual, err := testCase.Select.Build()
if err != nil {
t.Errorf("Error was occurred: %v", err)
continue
}
if diff := cmp.Diff(testCase.Result, actual); diff != "" {
t.Errorf("Differs: (-want +got)\n%s", diff)
}
}
} | explode_data.jsonl/6191 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 390
} | [
2830,
3393,
3379,
96686,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
197,
3379,
353,
82082,
14752,
198,
197,
56503,
353,
56193,
21610,
3454,
1649,
198,
197,
59403,
197,
197,
515,
298,
197,
5,
82082,
14752,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIsConstant(t *testing.T) {
tests := []struct {
term string
expected bool
}{
{`[{"foo": {true, false, [1, 2]}}]`, true},
{`[{"foo": {x}}]`, false},
}
for _, tc := range tests {
term := MustParseTerm(tc.term)
if IsConstant(term.Value) != tc.expected {
t.Fatalf("Expected IsConstant(%v) = %v", term, tc.expected)
}
}
} | explode_data.jsonl/2915 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 158
} | [
2830,
3393,
3872,
15472,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
197,
4991,
257,
914,
198,
197,
42400,
1807,
198,
197,
59403,
197,
197,
90,
63,
58,
4913,
7975,
788,
314,
1866,
11,
895,
11,
508,
16,
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... | 3 |
func TestPrettyWeekdays(t *testing.T) {
type args struct {
days []models.Weekday
}
tests := []struct {
name string
args args
want string
}{
{"", args{[]models.Weekday{models.Monday, models.Wednesday, models.Friday}}, "Monday Wednesday Friday"},
{"", args{[]models.Weekday{models.Friday}}, "Friday"},
{"", args{[]models.Weekday{models.Sunday, models.Friday, models.Saturday}}, "Friday Saturday Sunday"},
{"", args{[]models.Weekday{}}, ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := models.PrettyWeekdays(tt.args.days); got != tt.want {
t.Errorf("PrettyWeekdays() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/74979 | {
"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,
51940,
17053,
13778,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
2698,
942,
3056,
6507,
22404,
1225,
1292,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
31215,
2827,
198,
197,
50780,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestProposal_NewProposalHandler(t *testing.T) {
fakeTokenKeeper := newMockTokenKeeper()
fakeSupplyKeeper := newMockSupplyKeeper()
mApp, mDexKeeper, err := newMockApp(fakeTokenKeeper, fakeSupplyKeeper, 10)
require.True(t, err == nil)
mApp.BeginBlock(abci.RequestBeginBlock{Header: abci.Header{Height: 2}})
ctx := mApp.BaseApp.NewContext(false, abci.Header{})
proposalHandler := NewProposalHandler(mDexKeeper.Keeper)
params := types.DefaultParams()
require.NotNil(t, params.String())
mDexKeeper.SetParams(ctx, *params)
tokenPair := GetBuiltInTokenPair()
content := types.NewDelistProposal("delist xxb_okb", "delist asset from dex",
tokenPair.Owner, tokenPair.BaseAssetSymbol, tokenPair.QuoteAssetSymbol)
content.Proposer = tokenPair.Owner
proposal := govTypes.Proposal{Content: content}
// error case : fail to handle proposal because product(token pair) not exist
err = proposalHandler(ctx, &proposal)
require.Error(t, err)
// error case : fail to handle proposal because proposal not exist
err = proposalHandler(ctx, &govTypes.Proposal{})
require.Error(t, err)
// save wrong tokenpair
tokenPair.Deposits = sdk.NewDecCoin("xxb", sdk.NewInt(50))
saveErr := mApp.dexKeeper.SaveTokenPair(ctx, tokenPair)
require.Nil(t, saveErr)
// error case : fail to withdraw deposits because deposits is not okt
err = proposalHandler(ctx, &proposal)
require.Error(t, err)
// save right tokenpair
tokenPair.Deposits = sdk.NewDecCoin(sdk.DefaultBondDenom, sdk.NewInt(50))
saveErr = mApp.dexKeeper.SaveTokenPair(ctx, tokenPair)
require.Nil(t, saveErr)
// successful case : withdraw successfully
err = proposalHandler(ctx, &proposal)
require.Nil(t, err)
lock := ordertypes.ProductLock{}
mDexKeeper.LockTokenPair(ctx, ordertypes.TestTokenPair, &lock)
err = proposalHandler(ctx, &proposal)
require.Error(t, err)
} | explode_data.jsonl/30314 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 658
} | [
2830,
3393,
98637,
39582,
98637,
3050,
1155,
353,
8840,
836,
8,
1476,
1166,
726,
3323,
77233,
1669,
501,
11571,
3323,
77233,
741,
1166,
726,
51296,
77233,
1669,
501,
11571,
51296,
77233,
2822,
2109,
2164,
11,
296,
35,
327,
77233,
11,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMeterSnapshot(t *testing.T) {
m := NewMeter()
m.Mark(1)
if snapshot := m.Snapshot(); m.RateMean() != snapshot.RateMean() {
t.Fatal(snapshot)
}
} | explode_data.jsonl/10862 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 70
} | [
2830,
3393,
68224,
15009,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
1532,
68224,
741,
2109,
75888,
7,
16,
340,
743,
16295,
1669,
296,
808,
9601,
2129,
296,
2013,
349,
18783,
368,
961,
16295,
2013,
349,
18783,
368,
341,
197,
3244,
2613... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPrivateWeave(t *testing.T) {
runTestAWS(t, "privateweave.example.com", "privateweave", "v1alpha1", true, 1, true)
runTestAWS(t, "privateweave.example.com", "privateweave", "v1alpha2", true, 1, true)
} | explode_data.jsonl/25367 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
16787,
1654,
523,
1155,
353,
8840,
836,
8,
341,
56742,
2271,
36136,
1155,
11,
330,
1996,
896,
523,
7724,
905,
497,
330,
1996,
896,
523,
497,
330,
85,
16,
7141,
16,
497,
830,
11,
220,
16,
11,
830,
340,
56742,
2271,
3613... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestResponseError_Error(t *testing.T) {
err := &ResponseError{
Status: 400,
Messages: []string{
"error1",
"error2",
},
}
expectedMsg := "KairosDB response error: status=400, messages=[error1, error2]"
assert.Equal(t, expectedMsg, err.Error())
} | explode_data.jsonl/56653 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 104
} | [
2830,
3393,
2582,
1454,
28651,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
609,
2582,
1454,
515,
197,
58321,
25,
220,
19,
15,
15,
345,
197,
9209,
3737,
25,
3056,
917,
515,
298,
197,
1,
841,
16,
756,
298,
197,
1,
841,
17,
756,
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 TestIssue11505(t *testing.T) {
// parsing a rsa private key with p or q == 1 used to panic due to a divide by zero
_, _ = Read(readerFromHex("9c3004303030300100000011303030000000000000010130303030303030303030303030303030303030303030303030303030303030303030303030303030303030"))
} | explode_data.jsonl/48199 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 112
} | [
2830,
3393,
42006,
16,
16,
20,
15,
20,
1155,
353,
8840,
836,
8,
341,
197,
322,
22314,
264,
68570,
869,
1376,
448,
281,
476,
2804,
621,
220,
16,
1483,
311,
21975,
4152,
311,
264,
21749,
553,
7168,
198,
197,
6878,
716,
284,
4457,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTargetingCache(t *testing.T) {
bids := runTargetingAuction(t, mockBids, true, true, true, false)
// Make sure that the cache keys exist on the bids where they're expected to
assertKeyExists(t, bids["winning-bid"], string(openrtb_ext.HbCacheKey), true)
assertKeyExists(t, bids["winning-bid"], openrtb_ext.HbCacheKey.BidderKey(openrtb_ext.BidderAppnexus, maxKeyLength), true)
assertKeyExists(t, bids["contending-bid"], string(openrtb_ext.HbCacheKey), false)
assertKeyExists(t, bids["contending-bid"], openrtb_ext.HbCacheKey.BidderKey(openrtb_ext.BidderRubicon, maxKeyLength), true)
assertKeyExists(t, bids["losing-bid"], string(openrtb_ext.HbCacheKey), false)
assertKeyExists(t, bids["losing-bid"], openrtb_ext.HbCacheKey.BidderKey(openrtb_ext.BidderAppnexus, maxKeyLength), false)
} | explode_data.jsonl/6881 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 299
} | [
2830,
3393,
6397,
287,
8233,
1155,
353,
8840,
836,
8,
341,
2233,
3365,
1669,
1598,
6397,
287,
32,
2654,
1155,
11,
7860,
33,
3365,
11,
830,
11,
830,
11,
830,
11,
895,
692,
197,
322,
7405,
2704,
429,
279,
6500,
6894,
3000,
389,
279,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDepositHistory(t *testing.T) {
t.Parallel()
if areTestAPIKeysSet() && !canManipulateRealOrders && !mockTests {
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
}
_, err := b.DepositHistory(context.Background(), currency.ETH, "", time.Time{}, time.Time{}, 0, 10000)
switch {
case areTestAPIKeysSet() && err != nil:
t.Error(err)
case !areTestAPIKeysSet() && err == nil && !mockTests:
t.Error("expecting an error when no keys are set")
}
} | explode_data.jsonl/76676 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 177
} | [
2830,
3393,
78982,
13424,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
743,
525,
2271,
7082,
8850,
1649,
368,
1009,
753,
4814,
92876,
6334,
12768,
24898,
1009,
753,
16712,
18200,
341,
197,
3244,
57776,
445,
7082,
6894,
738,
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... | 9 |
func Test_Protocol(t *testing.T) {
var (
c = context.TODO()
err error
missionID = int64(10364)
p *activity.Protocol
)
convey.Convey("Protocol", t, func(ctx convey.C) {
defer gock.OffAll()
url := fmt.Sprintf(d.ActProtocolURI, 10364)
httpMock("GET", url).Reply(200).JSON(`{"code":0,"data":{"id":"231","sid":"10364","protocol":"说明不超过201234567890123","types":"","tags":"","hot":"0","bgm_id":"0","paster_id":"0","oids":"","screen_set":"1"}}`)
p, err = d.Protocol(c, missionID)
ctx.Convey("Then err should be nil.has should not be nil.", func(ctx convey.C) {
ctx.So(err, convey.ShouldBeNil)
ctx.So(p, convey.ShouldNotBeNil)
})
})
} | explode_data.jsonl/3439 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 307
} | [
2830,
3393,
1088,
4640,
4547,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
1444,
260,
284,
2266,
90988,
741,
197,
9859,
981,
1465,
198,
197,
197,
2728,
915,
284,
526,
21,
19,
7,
16,
15,
18,
21,
19,
340,
197,
3223,
260,
353,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDescribeClusterQuota(t *testing.T) {
testStatus := &corev1.ResourceQuotaStatus{
Hard: map[corev1.ResourceName]resource.Quantity{
corev1.ResourceCPU: resource.MustParse("1"),
corev1.ResourceLimitsCPU: resource.MustParse("2"),
corev1.ResourceLimitsMemory: resource.MustParse("2G"),
corev1.ResourceMemory: resource.MustParse("1G"),
corev1.ResourceRequestsCPU: resource.MustParse("1"),
corev1.ResourceRequestsMemory: resource.MustParse("1G"),
corev1.ResourcePods: resource.MustParse("1000"),
},
Used: map[corev1.ResourceName]resource.Quantity{
corev1.ResourceCPU: resource.MustParse("300m"),
corev1.ResourceLimitsCPU: resource.MustParse("1"),
corev1.ResourceLimitsMemory: resource.MustParse("0G"),
corev1.ResourceMemory: resource.MustParse("100M"),
corev1.ResourceRequestsCPU: resource.MustParse("500m"),
corev1.ResourceRequestsMemory: resource.MustParse("1000Ki"),
corev1.ResourcePods: resource.MustParse("20"),
},
}
tests := []struct {
quota v1.ClusterResourceQuota
want []string
}{
{
quota: v1.ClusterResourceQuota{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
},
Spec: v1.ClusterResourceQuotaSpec{
Selector: v1.ClusterResourceQuotaSelector{
LabelSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "test",
},
},
},
},
Status: v1.ClusterResourceQuotaStatus{
Namespaces: []v1.ResourceQuotaStatusByNamespace{
{
Namespace: "test",
Status: *testStatus.DeepCopy(),
},
},
Total: *testStatus.DeepCopy(),
},
},
want: []string{
"Name:\\s+test",
"Namespace Selector:\\s+\\[\"test\"\\]",
"Label Selector:\\s+app=test",
"Resource\\s+Used\\s+Hard",
"cpu\\s+300m\\s+1",
"limits.cpu\\s+1\\s+2",
"limits.memory\\s+0\\s+2G",
"memory\\s+100M\\s+1G",
"pods\\s+20\\s+1k",
"requests.cpu\\s+500m\\s+1",
"requests.memory\\s+1024k\\s+1G",
},
},
}
for i := range tests {
tt := tests[i]
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
out, err := DescribeClusterQuota(&tt.quota)
if err != nil {
t.Fatal(err)
}
for _, match := range tt.want {
if got := out; !regexp.MustCompile(match).MatchString(got) {
t.Errorf("%s\nshould contain %q", got, match)
}
}
})
}
} | explode_data.jsonl/6489 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1168
} | [
2830,
3393,
74785,
28678,
2183,
6089,
1155,
353,
8840,
836,
8,
341,
18185,
2522,
1669,
609,
98645,
16,
20766,
2183,
6089,
2522,
515,
197,
13292,
567,
25,
2415,
58,
98645,
16,
20766,
675,
60,
9233,
66267,
515,
298,
71882,
85,
16,
20766... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestServerEarlyEOF(t *testing.T) {
t.Parallel()
c := Config{
HMACKey: []byte("0x24FEEDFACEDEADBEEFCAFE"),
MaxSize: 5120 * 1024,
RequestTimeout: time.Duration(500) * time.Millisecond,
MaxRedirects: 3,
ServerName: "go-camo",
noIPFiltering: true,
}
ts := httptest.NewServer(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "image/png")
w.Header().Set("Connection", "close")
w.Header().Set("Content-Length", "100")
w.WriteHeader(200)
},
))
defer ts.Close()
req, err := makeReq(c, ts.URL)
assert.Nil(t, err)
// response is a 200, not much we can do about that since we response
// streaming (chunked)...
resp, err := processRequest(req, 200, c, nil)
assert.Nil(t, err)
body, err := ioutil.ReadAll(resp.Body)
assert.Nil(t, err)
assert.Empty(t, body)
} | explode_data.jsonl/24302 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 373
} | [
2830,
3393,
5475,
41198,
23483,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
1444,
1669,
5532,
515,
197,
13292,
25788,
1592,
25,
286,
3056,
3782,
445,
15,
87,
17,
19,
11419,
1479,
19759,
1150,
94373,
7099,
37,
5049,
11419,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestStripLocationModifer(t *testing.T) {
expected := "ok.com"
actual := stripLocationModifer("~*ok.com")
if expected != actual {
t.Errorf("Expected '%v' but returned '%v'", expected, actual)
}
} | explode_data.jsonl/80605 | {
"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,
5901,
4707,
4459,
11437,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
330,
562,
905,
698,
88814,
1669,
13316,
4707,
4459,
11437,
81012,
9,
562,
905,
5130,
743,
3601,
961,
5042,
341,
197,
3244,
13080,
445,
18896,
7677,
85,
6,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestCrudFlagsWithFailures(t *testing.T) {
var res middleware.Responder
db := entity.NewTestDB()
c := &crud{}
defer db.Close()
defer gostub.StubFunc(&getDB, db).Reset()
t.Run("GetFlag - can't find non-exist flag", func(t *testing.T) {
res = c.GetFlag(flag.GetFlagParams{FlagID: int64(1)})
assert.NotZero(t, res.(*flag.GetFlagDefault).Payload)
})
t.Run("GetFlag - got e2r MapFlag error", func(t *testing.T) {
c.CreateFlag(flag.CreateFlagParams{
Body: &models.CreateFlagRequest{
Description: util.StringPtr("funny flag"),
Key: "flag_key_1",
},
})
defer gostub.StubFunc(&e2rMapFlag, nil, fmt.Errorf("e2r MapFlag error")).Reset()
res = c.GetFlag(flag.GetFlagParams{FlagID: int64(1)})
assert.NotZero(t, res.(*flag.GetFlagDefault).Payload)
})
t.Run("FindFlags - got e2r MapFlags error", func(t *testing.T) {
defer gostub.StubFunc(&e2rMapFlags, nil, fmt.Errorf("e2r MapFlags error")).Reset()
res = c.FindFlags(flag.FindFlagsParams{})
assert.NotZero(t, res.(*flag.FindFlagsDefault).Payload)
})
t.Run("FindFlags - db generic error", func(t *testing.T) {
db.Error = fmt.Errorf("db generic error")
res = c.FindFlags(flag.FindFlagsParams{})
assert.NotZero(t, res.(*flag.FindFlagsDefault).Payload)
db.Error = nil
})
t.Run("CreateFlag - got e2r MapFlag error", func(t *testing.T) {
defer gostub.StubFunc(&e2rMapFlag, nil, fmt.Errorf("e2r MapFlag error")).Reset()
res = c.CreateFlag(flag.CreateFlagParams{
Body: &models.CreateFlagRequest{
Description: util.StringPtr("funny flag"),
},
})
assert.NotZero(t, res.(*flag.CreateFlagDefault).Payload)
})
t.Run("CreateFlag - db generic error", func(t *testing.T) {
db.Error = fmt.Errorf("db generic error")
res = c.CreateFlag(flag.CreateFlagParams{
Body: &models.CreateFlagRequest{
Description: util.StringPtr("funny flag"),
},
})
assert.NotZero(t, res.(*flag.CreateFlagDefault).Payload)
db.Error = nil
})
t.Run("CreateFlag - invalid key error", func(t *testing.T) {
res = c.CreateFlag(flag.CreateFlagParams{
Body: &models.CreateFlagRequest{
Description: util.StringPtr(" flag with a space"),
Key: " 1-2-3", // invalid key
},
})
assert.NotZero(t, res.(*flag.CreateFlagDefault).Payload)
})
t.Run("PutFlag - try to update a non-existing flag", func(t *testing.T) {
res = c.PutFlag(flag.PutFlagParams{
FlagID: int64(99999),
Body: &models.PutFlagRequest{
Description: util.StringPtr("another funny flag"),
DataRecordsEnabled: util.BoolPtr(true),
}},
)
assert.NotZero(t, res.(*flag.PutFlagDefault).Payload)
})
t.Run("PutFlag - got e2r MapFlag error", func(t *testing.T) {
defer gostub.StubFunc(&e2rMapFlag, nil, fmt.Errorf("e2r MapFlag error")).Reset()
res = c.PutFlag(flag.PutFlagParams{
FlagID: int64(1),
Body: &models.PutFlagRequest{
Description: util.StringPtr("another funny flag"),
DataRecordsEnabled: util.BoolPtr(true),
}},
)
assert.NotZero(t, res.(*flag.PutFlagDefault).Payload)
})
t.Run("PutFlag - db generic error", func(t *testing.T) {
db.Error = fmt.Errorf("db generic error")
res = c.PutFlag(flag.PutFlagParams{
FlagID: int64(1),
Body: &models.PutFlagRequest{
Description: util.StringPtr("another funny flag"),
DataRecordsEnabled: util.BoolPtr(true),
}},
)
assert.NotZero(t, res.(*flag.PutFlagDefault).Payload)
db.Error = nil
})
t.Run("PutFlag - cannot set duplicate flag_key", func(t *testing.T) {
res = c.PutFlag(flag.PutFlagParams{
FlagID: int64(2),
Body: &models.PutFlagRequest{
Description: util.StringPtr("another funny flag"),
DataRecordsEnabled: util.BoolPtr(true),
Key: util.StringPtr("flag_key_1"),
}},
)
assert.NotZero(t, res.(*flag.PutFlagDefault).Payload)
})
t.Run("SetFlagEnabledState - try to set on a non-existing flag", func(t *testing.T) {
res = c.SetFlagEnabledState(flag.SetFlagEnabledParams{
FlagID: int64(99999),
Body: &models.SetFlagEnabledRequest{
Enabled: util.BoolPtr(true),
}},
)
assert.NotZero(t, res.(*flag.SetFlagEnabledDefault).Payload)
})
t.Run("SetFlagEnabledState - got e2r error", func(t *testing.T) {
defer gostub.StubFunc(&e2rMapFlag, nil, fmt.Errorf("e2r MapFlag error")).Reset()
res = c.SetFlagEnabledState(flag.SetFlagEnabledParams{
FlagID: int64(1),
Body: &models.SetFlagEnabledRequest{
Enabled: util.BoolPtr(true),
}},
)
assert.NotZero(t, res.(*flag.SetFlagEnabledDefault).Payload)
})
t.Run("SetFlagEnabledState - db generic error", func(t *testing.T) {
db.Error = fmt.Errorf("db generic error")
res = c.SetFlagEnabledState(flag.SetFlagEnabledParams{
FlagID: int64(1),
Body: &models.SetFlagEnabledRequest{
Enabled: util.BoolPtr(true),
}},
)
assert.NotZero(t, res.(*flag.SetFlagEnabledDefault).Payload)
db.Error = nil
})
t.Run("DeleteFlag - db generic error", func(t *testing.T) {
db.Error = fmt.Errorf("db generic error")
res = c.DeleteFlag(flag.DeleteFlagParams{FlagID: int64(99999)})
assert.NotZero(t, res.(*flag.DeleteFlagDefault).Payload)
db.Error = nil
})
t.Run("GetFlagSnapshots - db generic error", func(t *testing.T) {
db.Error = fmt.Errorf("db generic error")
res = c.GetFlagSnapshots(flag.GetFlagSnapshotsParams{FlagID: int64(99999)})
assert.NotZero(t, res.(*flag.GetFlagSnapshotsDefault).Payload)
db.Error = nil
})
t.Run("GetFlagSnapshots - e2r MapFlagSnapshots error", func(t *testing.T) {
defer gostub.StubFunc(&e2rMapFlagSnapshots, nil, fmt.Errorf("e2r MapFlag error")).Reset()
res = c.GetFlagSnapshots(flag.GetFlagSnapshotsParams{FlagID: int64(99999)})
assert.NotZero(t, res.(*flag.GetFlagSnapshotsDefault).Payload)
})
} | explode_data.jsonl/19449 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2369
} | [
2830,
3393,
92061,
9195,
2354,
19524,
1413,
1155,
353,
8840,
836,
8,
341,
2405,
592,
29679,
8377,
20328,
198,
20939,
1669,
5387,
7121,
2271,
3506,
741,
1444,
1669,
609,
53569,
31483,
16867,
2927,
10421,
741,
16867,
67934,
392,
7758,
392,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConsumingBodyOnNextConn(t *testing.T) {
defer afterTest(t)
conn := new(testConn)
for i := 0; i < 2; i++ {
conn.readBuf.Write([]byte(
"POST / HTTP/1.1\r\n" +
"Host: test\r\n" +
"Content-Length: 11\r\n" +
"\r\n" +
"foo=1&bar=1"))
}
reqNum := 0
ch := make(chan *Request)
servech := make(chan error)
listener := &oneConnListener{conn}
handler := func(res ResponseWriter, req *Request) {
reqNum++
ch <- req
}
go func() {
servech <- Serve(listener, HandlerFunc(handler))
}()
var req *Request
req = <-ch
if req == nil {
t.Fatal("Got nil first request.")
}
if req.Method != "POST" {
t.Errorf("For request #1's method, got %q; expected %q",
req.Method, "POST")
}
req = <-ch
if req == nil {
t.Fatal("Got nil first request.")
}
if req.Method != "POST" {
t.Errorf("For request #2's method, got %q; expected %q",
req.Method, "POST")
}
if serveerr := <-servech; serveerr != io.EOF {
t.Errorf("Serve returned %q; expected EOF", serveerr)
}
} | explode_data.jsonl/22391 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 443
} | [
2830,
3393,
41966,
287,
5444,
1925,
5847,
9701,
1155,
353,
8840,
836,
8,
341,
16867,
1283,
2271,
1155,
340,
32917,
1669,
501,
8623,
9701,
340,
2023,
600,
1669,
220,
15,
26,
600,
366,
220,
17,
26,
600,
1027,
341,
197,
32917,
4125,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestBytesToUnsigned(t *testing.T) {
for _, tc := range testCases {
if tc.number > 0 {
num := FromBytesUnsigned(tc.buf)
assert.Equal(t, tc.number, num.Int64(), "expected %x, got %x", tc.number, num.Int64())
}
}
for _, tc := range unsignedCases {
num := FromBytesUnsigned(tc.buf)
assert.Equal(t, tc.number, num.Int64(), "expected %x, got %x", tc.number, num.Int64())
}
} | explode_data.jsonl/64288 | {
"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,
7078,
1249,
56421,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
1273,
37302,
341,
197,
743,
17130,
14341,
861,
220,
15,
341,
298,
22431,
1669,
5542,
7078,
56421,
44415,
44485,
340,
298,
6948,
12808,
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... | 4 |
func TestReconcileLoadBalancerRemoveAllPortsRemovesFrontendConfig(t *testing.T) {
az := getTestCloud()
clusterResources := getClusterResources(az, 1, 1)
svc := getTestService("servicea", v1.ProtocolTCP, 80)
lb, err := az.reconcileLoadBalancer(testClusterName, &svc, clusterResources.nodes, true /* wantLb */)
if err != nil {
t.Errorf("Unexpected error: %q", err)
}
validateLoadBalancer(t, lb, svc)
svcUpdated := getTestService("servicea", v1.ProtocolTCP)
lb, err = az.reconcileLoadBalancer(testClusterName, &svcUpdated, clusterResources.nodes, false /* wantLb*/)
if err != nil {
t.Errorf("Unexpected error: %q", err)
}
// ensure we abandoned the frontend ip configuration
if len(*lb.FrontendIPConfigurations) != 0 {
t.Error("Expected the loadbalancer to have no frontend ip configuration")
}
validateLoadBalancer(t, lb, svcUpdated)
} | explode_data.jsonl/50393 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 309
} | [
2830,
3393,
693,
40446,
457,
5879,
93825,
13021,
2403,
68273,
6590,
10088,
23395,
408,
2648,
1155,
353,
8840,
836,
8,
341,
197,
1370,
1669,
633,
2271,
16055,
741,
197,
18855,
11277,
1669,
633,
28678,
11277,
7,
1370,
11,
220,
16,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestGetManifests(t *testing.T) {
conf, cleanup := testutil.InitConfig(t)
defer cleanup(t)
manifests := conf.GetManifests()
require.NotNil(t, manifests)
assert.EqualValues(t, manifests[0].PrimaryRepositoryName, "primary")
} | explode_data.jsonl/57915 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
1949,
38495,
82,
1155,
353,
8840,
836,
8,
341,
67850,
11,
21290,
1669,
1273,
1314,
26849,
2648,
1155,
340,
16867,
21290,
1155,
692,
197,
42315,
82,
1669,
2335,
2234,
38495,
82,
741,
17957,
93882,
1155,
11,
83232,
692,
6948,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestNonStructInput(t *testing.T) {
ass := assert.New(t)
m, err := Map(10, "")
ass.Nil(m)
ass.Equal(ErrNoneStructTarget, err)
} | explode_data.jsonl/18650 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 61
} | [
2830,
3393,
8121,
9422,
2505,
1155,
353,
8840,
836,
8,
341,
197,
395,
1669,
2060,
7121,
1155,
340,
2109,
11,
1848,
1669,
5027,
7,
16,
15,
11,
14676,
197,
395,
59678,
1255,
340,
197,
395,
12808,
7,
7747,
4064,
9422,
6397,
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 |
func TestRound(t *testing.T) {
type testData struct {
in float64
in2 int
out float64
}
tests := []testData{
{in: 183.467, in2: 2, out: 183.47},
{in: 183.467, in2: 5, out: 183.46700},
{in: 146.7032, in2: 0, out: 147},
{in: -12.455787, in2: 2, out: -12.46},
{in: 1.79, in2: 308, out: 1.79},
}
for i, test := range tests {
num, _ := Round(test.in, test.in2)
if err := a.AssertDeepEqual(test.out, num); err != nil {
t.Error(m.ErrorMessageTestCount(i+1, err))
}
}
} | explode_data.jsonl/9015 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 242
} | [
2830,
3393,
27497,
1155,
353,
8840,
836,
8,
341,
13158,
67348,
2036,
341,
197,
17430,
220,
2224,
21,
19,
198,
197,
17430,
17,
526,
198,
197,
13967,
2224,
21,
19,
198,
197,
630,
78216,
1669,
3056,
1944,
1043,
515,
197,
197,
90,
258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRead_truncated(t *testing.T) {
assert := assert.New(t)
server, log, cleanup := setup(t)
defer cleanup()
server.append([][]byte{[]byte("hello"), []byte("world")})
entriesCh := make(chan []blog.Entry, 4)
err := log.Read(context.Background(), 0, entriesCh)
assert.True(blog.IsTruncatedError(err))
} | explode_data.jsonl/54 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 115
} | [
2830,
3393,
4418,
3547,
38007,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
41057,
11,
1487,
11,
21290,
1669,
6505,
1155,
340,
16867,
21290,
741,
41057,
2057,
10556,
1294,
3782,
90,
1294,
3782,
445,
14990,
3975,
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... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.