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 TestHooksCalled(t *testing.T) {
p := pipeline.New(
pipeline.Node(&NoOpProcessor{}),
)
preHookCalled := false
p.AddPreProcessingHook(func(ctx context.Context) (context.Context, error) {
preHookCalled = true
return ctx, nil
})
postHookCalled := false
p.AddPostProcessingHook(func(ctx context.Context, err error) error {
postHookCalled = true
return nil
})
err := <-p.Process(&SimpleReader{CountObject: 10})
assert.NoError(t, err)
assert.True(t, preHookCalled, "pre-hook not called")
assert.True(t, postHookCalled, "post-hook not called")
} | explode_data.jsonl/64697 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 219
} | [
2830,
3393,
67769,
20960,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
15301,
7121,
1006,
197,
3223,
8790,
21714,
2099,
2753,
7125,
22946,
6257,
1326,
197,
692,
40346,
31679,
20960,
1669,
895,
198,
3223,
1904,
4703,
28892,
31679,
18552,
7502... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPullList(t *testing.T) {
defer gock.Off()
gock.New("https://gitlab.com").
Get("/api/v4/projects/diaspora/diaspora/merge_requests").
MatchParam("page", "1").
MatchParam("per_page", "30").
MatchParam("state", "all").
Reply(200).
Type("application/json").
SetHeaders(mockHeaders).
SetHeaders(mockPageHeaders).
File("testdata/merges.json")
client := NewDefault()
got, res, err := client.PullRequests.List(context.Background(), "diaspora/diaspora", scm.PullRequestListOptions{Page: 1, Size: 30, Open: true, Closed: true})
if err != nil {
t.Error(err)
return
}
want := []*scm.PullRequest{}
raw, _ := ioutil.ReadFile("testdata/merges.json.golden")
json.Unmarshal(raw, &want)
if diff := cmp.Diff(got, want); diff != "" {
t.Errorf("Unexpected Results")
t.Log(diff)
}
t.Run("Request", testRequest(res))
t.Run("Rate", testRate(res))
t.Run("Page", testPage(res))
} | explode_data.jsonl/78652 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 368
} | [
2830,
3393,
36068,
852,
1155,
353,
8840,
836,
8,
341,
16867,
728,
377,
13,
4596,
2822,
3174,
1176,
7121,
445,
2428,
1110,
12882,
14380,
905,
38609,
197,
37654,
4283,
2068,
5457,
19,
39606,
3446,
3473,
70664,
3446,
3473,
70664,
14,
19052... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUintJsonError(t *testing.T) {
var ts TestUintStruct
jstr := `{"int":-10,"float":1.0,"bool":true,"string":"50","null_value":null}`
expected := `{"int":null,"float":null,"bool":null,"string":null,"null_value":null}`
err := json.Unmarshal([]byte(jstr), &ts)
if err == nil {
t.Error("Expected error when json.Unmarshal.")
}
b, err := json.Marshal(ts)
if err != nil {
t.Errorf("Not Expected error when json.Marshal. error:%v", err.Error())
}
actual := string(b)
if actual != expected {
t.Errorf("actual:%s, expected:%s", actual, expected)
}
} | explode_data.jsonl/13390 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 224
} | [
2830,
3393,
21570,
5014,
1454,
1155,
353,
8840,
836,
8,
341,
2405,
10591,
3393,
21570,
9422,
198,
12428,
495,
1669,
1565,
4913,
396,
52052,
16,
15,
1335,
3649,
788,
16,
13,
15,
1335,
2641,
788,
1866,
1335,
917,
3252,
20,
15,
2198,
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 TestGeneration(t *testing.T) {
r := PodAutoscaler{}
if a := r.GetGeneration(); a != 0 {
t.Errorf("empty pa generation should be 0 was: %d", a)
}
r.SetGeneration(5)
if e, a := int64(5), r.GetGeneration(); e != a {
t.Errorf("getgeneration mismatch expected: %d got: %d", e, a)
}
} | explode_data.jsonl/27220 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 124
} | [
2830,
3393,
37138,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
16821,
19602,
436,
63084,
16094,
743,
264,
1669,
435,
2234,
37138,
2129,
264,
961,
220,
15,
341,
197,
3244,
13080,
445,
3194,
7106,
9471,
1265,
387,
220,
15,
572,
25,
1018,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuildInfo(t *testing.T) {
b := &api.Build{
ObjectMeta: metav1.ObjectMeta{
Name: "sample-app",
Namespace: "default",
},
Spec: api.BuildSpec{
CommonSpec: api.CommonSpec{
Source: api.BuildSource{
Git: &api.GitBuildSource{
URI: "github.com/openshift/sample-app",
Ref: "master",
},
},
Strategy: api.BuildStrategy{
SourceStrategy: &api.SourceBuildStrategy{
Env: []kapi.EnvVar{
{Name: "RAILS_ENV", Value: "production"},
},
},
},
},
},
}
sourceInfo := &git.SourceInfo{}
sourceInfo.CommitID = "1575a90c569a7cc0eea84fbd3304d9df37c9f5ee"
got := buildInfo(b, sourceInfo)
want := []KeyValue{
{"OPENSHIFT_BUILD_NAME", "sample-app"},
{"OPENSHIFT_BUILD_NAMESPACE", "default"},
{"OPENSHIFT_BUILD_SOURCE", "github.com/openshift/sample-app"},
{"OPENSHIFT_BUILD_REFERENCE", "master"},
{"OPENSHIFT_BUILD_COMMIT", "1575a90c569a7cc0eea84fbd3304d9df37c9f5ee"},
{"RAILS_ENV", "production"},
}
if !reflect.DeepEqual(got, want) {
t.Errorf("buildInfo(%+v) = %+v; want %+v", b, got, want)
}
b.Spec.Revision = &api.SourceRevision{
Git: &api.GitSourceRevision{
Commit: "1575a90c569a7cc0eea84fbd3304d9df37c9f5ee",
},
}
got = buildInfo(b, nil)
if !reflect.DeepEqual(got, want) {
t.Errorf("buildInfo(%+v) = %+v; want %+v", b, got, want)
}
} | explode_data.jsonl/26151 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 667
} | [
2830,
3393,
11066,
1731,
1155,
353,
8840,
836,
8,
341,
2233,
1669,
609,
2068,
25212,
515,
197,
23816,
12175,
25,
77520,
16,
80222,
515,
298,
21297,
25,
414,
330,
13611,
20023,
756,
298,
90823,
25,
330,
2258,
756,
197,
197,
1583,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestVirtualMemoryStat_String(t *testing.T) {
v := VirtualMemoryStat{
Total: 10,
Available: 20,
Used: 30,
UsedPercent: 30.1,
Free: 40,
}
e := `{"total":10,"available":20,"used":30,"usedPercent":30.1,"free":40,"active":0,"inactive":0,"wired":0,"buffers":0,"cached":0}`
if e != fmt.Sprintf("%v", v) {
t.Errorf("VirtualMemoryStat string is invalid: %v", v)
}
} | explode_data.jsonl/973 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 180
} | [
2830,
3393,
33026,
10642,
15878,
31777,
1155,
353,
8840,
836,
8,
341,
5195,
1669,
20721,
10642,
15878,
515,
197,
197,
7595,
25,
981,
220,
16,
15,
345,
197,
197,
16485,
25,
256,
220,
17,
15,
345,
197,
197,
22743,
25,
286,
220,
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... | 2 |
func TestLRU_Add(t *testing.T) {
t.Parallel()
c := NewLRUCache(2000)
type fields struct {
Cache *lru.Cache
Hit int64
Miss int64
}
type args struct {
key string
value interface{}
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
{
name: "Test_LRU_Add_OK",
fields: fields{
Cache: c.Cache,
Hit: c.hit,
Miss: c.miss,
},
args: args{
key: "key",
value: "value",
},
wantErr: false,
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
c := &LRU{
Cache: tt.fields.Cache,
hit: tt.fields.Hit,
miss: tt.fields.Miss,
}
if err := c.Add(tt.args.key, tt.args.value); (err != nil) != tt.wantErr {
t.Errorf("Add() error = %v, wantErr %v", err, tt.wantErr)
}
got, err := c.Get(tt.args.key)
if (err != nil) != tt.wantErr {
t.Errorf("Get() from cache error = %v, wantErr %v", err, tt.wantErr)
}
if !tt.wantErr && !reflect.DeepEqual(got, tt.args.value) {
t.Errorf("expected in cache =%v, got =%v", tt.args.value, got)
}
})
}
} | explode_data.jsonl/46946 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 578
} | [
2830,
3393,
20117,
52,
21346,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1444,
1669,
1532,
20117,
5459,
1777,
7,
17,
15,
15,
15,
692,
13158,
5043,
2036,
341,
197,
6258,
1777,
353,
75,
2672,
46130,
198,
197,
13292,
275,
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... | 5 |
func TestFilteringServerGetSrvKeyspaceNamesFiltersKeyspaces(t *testing.T) {
_, _, f := newFiltering(stockFilters)
doTestGetSrvKeyspaceNames(t, f, stockCell, stockFilters, nil)
} | explode_data.jsonl/2377 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 67
} | [
2830,
3393,
5632,
287,
5475,
1949,
50,
10553,
8850,
1306,
7980,
28351,
8850,
27338,
1155,
353,
8840,
836,
8,
341,
197,
6878,
8358,
282,
1669,
501,
5632,
287,
67471,
28351,
340,
19935,
2271,
1949,
50,
10553,
8850,
1306,
7980,
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 |
func TestToRuntimeImage(t *testing.T) {
original := &docker.APIImages{
ID: "aeeea",
RepoTags: []string{"abc", "def"},
VirtualSize: 1234,
}
expected := &kubecontainer.Image{
ID: "aeeea",
RepoTags: []string{"abc", "def"},
Size: 1234,
}
actual, err := toRuntimeImage(original)
if err != nil {
t.Fatalf("unexpected error %v", err)
}
if !reflect.DeepEqual(expected, actual) {
t.Errorf("expected %#v, got %#v", expected, actual)
}
} | explode_data.jsonl/46275 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 211
} | [
2830,
3393,
1249,
15123,
1906,
1155,
353,
8840,
836,
8,
341,
197,
9889,
1669,
609,
28648,
24922,
14228,
515,
197,
29580,
25,
688,
330,
64,
2127,
12508,
756,
197,
197,
25243,
15930,
25,
262,
3056,
917,
4913,
13683,
497,
330,
750,
7115,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGracefulStop(t *testing.T) {
defer leakcheck.Check(t)
lis, err := net.Listen("tcp", "localhost:0")
if err != nil {
t.Fatalf("failed to create listener: %v", err)
}
server := NewServer()
go func() {
// make sure Serve() is called
time.Sleep(time.Millisecond * 500)
server.GracefulStop()
}()
err = server.Serve(lis)
if err != nil {
t.Fatalf("Serve() returned non-nil error on GracefulStop: %v", err)
}
} | explode_data.jsonl/74371 | {
"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,
86543,
1262,
10674,
1155,
353,
8840,
836,
8,
972,
16867,
23352,
2028,
10600,
1155,
7229,
8810,
285,
11,
1848,
1669,
4179,
68334,
445,
27161,
497,
330,
8301,
25,
15,
6060,
743,
1848,
961,
2092,
972,
197,
3244,
30762,
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,
1,
1,
1,
1... | 1 |
func TestParser_ParseDeck_FieldCount(t *testing.T) {
s := `
%% This is a field
%% This is a field
---`
d, err := anki.NewParser(strings.NewReader(s)).ParseDeck()
if err != nil {
t.Fatalf("unexpected error: %s", err)
} else if len(d.Cards[0].Fields) != 2 {
t.Fatalf("unexpected field count: %d", len(d.Cards[0].Fields))
}
} | explode_data.jsonl/40549 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 143
} | [
2830,
3393,
6570,
77337,
39368,
46272,
2507,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
22074,
197,
2769,
1096,
374,
264,
2070,
271,
197,
2769,
1096,
374,
264,
2070,
271,
197,
4421,
19324,
2698,
11,
1848,
1669,
458,
6642,
7121,
6570,
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... | 3 |
func TestDaoReportLogCount(t *testing.T) {
var (
c = context.TODO()
sql = ""
)
convey.Convey("ReportLogCount", t, func(ctx convey.C) {
count, err := d.ReportLogCount(c, sql)
ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
ctx.So(err, convey.ShouldBeNil)
ctx.So(count, convey.ShouldNotBeNil)
})
})
} | explode_data.jsonl/51303 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
12197,
10361,
2201,
2507,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
1444,
256,
284,
2266,
90988,
741,
197,
30633,
284,
8389,
197,
340,
37203,
5617,
4801,
5617,
445,
10361,
2201,
2507,
497,
259,
11,
2915,
7502,
20001,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnjail(t *testing.T) {
kb, err := keys.NewKeyBaseFromDir(InitClientHome(t, ""))
require.NoError(t, err)
addr, _ := CreateAddr(t, name1, pw, kb)
cleanup, valPubKeys, _, port := InitializeTestLCD(t, 1, []sdk.AccAddress{addr}, true)
defer cleanup()
// XXX: any less than this and it fails
tests.WaitForHeight(3, port)
pkString, _ := sdk.Bech32ifyConsPub(valPubKeys[0])
signingInfo := getSigningInfo(t, port, pkString)
tests.WaitForHeight(4, port)
require.Equal(t, true, signingInfo.IndexOffset > 0)
require.Equal(t, time.Unix(0, 0).UTC(), signingInfo.JailedUntil)
require.Equal(t, true, signingInfo.MissedBlocksCounter == 0)
} | explode_data.jsonl/25414 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 253
} | [
2830,
3393,
1806,
73,
604,
1155,
353,
8840,
836,
8,
341,
16463,
65,
11,
1848,
1669,
6894,
7121,
1592,
3978,
3830,
6184,
7,
3803,
2959,
7623,
1155,
11,
77561,
17957,
35699,
1155,
11,
1848,
340,
53183,
11,
716,
1669,
4230,
13986,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestQueryWithOrderBy(t *testing.T) {
cache := newTestCache(t)
input := []TestData{{S: "A", I: 2}, {S: "A", I: 1}, {S: "B", I: 3}}
cases := []struct {
orderBy string
expected []TestData
}{
{
orderBy: `["S", "I"]`,
expected: []TestData{{S: "A", I: 1}, {S: "A", I: 2}, {S: "B", I: 3}},
},
{
orderBy: `["-S", "I"]`,
expected: []TestData{{S: "B", I: 3}, {S: "A", I: 1}, {S: "A", I: 2}},
},
}
for _, tc := range cases {
t.Run(fmt.Sprintf("Order by %s", tc.orderBy), func(t *testing.T) {
output := []TestData{}
cache.insertJson("FOO", map[string]string{}, input)
cache.queryJson("FOO", map[string]string{}, fmt.Sprintf(`{"order_by": %s}`, tc.orderBy), "GET", &output)
compareTestData(t, output, tc.expected)
})
}
} | explode_data.jsonl/8989 | {
"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,
2859,
2354,
34605,
1155,
353,
8840,
836,
8,
341,
52680,
1669,
501,
2271,
8233,
1155,
340,
22427,
1669,
3056,
83920,
2979,
50,
25,
330,
32,
497,
358,
25,
220,
17,
2137,
314,
50,
25,
330,
32,
497,
358,
25,
220,
16,
2137,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestImages(t *testing.T) {
for _, imgURL := range candiesImgs {
t.Run(imgURL, func(t *testing.T) {
t.Parallel()
for i := 0; i < 3; i++ {
toobig, err := github.ImageTooBig(imgURL)
if err != nil {
t.Errorf("Failed reading image: %v", err)
continue
}
if toobig {
t.Errorf("Image %q too big", imgURL)
}
break
}
})
}
} | explode_data.jsonl/3990 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 189
} | [
2830,
3393,
14228,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
4964,
3144,
1669,
2088,
97397,
1427,
5857,
341,
197,
3244,
16708,
11022,
3144,
11,
2915,
1155,
353,
8840,
836,
8,
341,
298,
3244,
41288,
7957,
741,
298,
2023,
600,
1669,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestSuccessDescribeTags(t *testing.T) {
testRepo := newTestRepo(t)
defer testRepo.cleanup(t)
tag, err := testRepo.sut.Describe(
git.NewDescribeOptions().
WithRevision(testRepo.firstTagCommit).
WithAbbrev(0).
WithTags(),
)
require.Nil(t, err)
require.Equal(t, testRepo.firstTagName, tag)
} | explode_data.jsonl/13977 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 136
} | [
2830,
3393,
7188,
74785,
15930,
1155,
353,
8840,
836,
8,
341,
18185,
25243,
1669,
501,
2271,
25243,
1155,
340,
16867,
1273,
25243,
87689,
1155,
692,
60439,
11,
1848,
1669,
1273,
25243,
514,
332,
23548,
3114,
1006,
197,
90731,
7121,
74785,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSetScalarAttributeSuccess(t *testing.T) {
h := http.Header{}
h.Set("key_1", "value_1")
span := mock.NewSpan()
SetAttributesFromHeaders("request", headerMapAccessor{h}, span)
assert.Equal(t, "value_1", span.ReadAttribute("http.request.header.key_1").(string))
_ = span.ReadAttribute("container_id") // needed in containarized envs
assert.Zero(t, span.RemainingAttributes(), "unexpected remaining attribute: %v", span.Attributes)
} | explode_data.jsonl/28818 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 151
} | [
2830,
3393,
1649,
20639,
3907,
7188,
1155,
353,
8840,
836,
8,
341,
9598,
1669,
1758,
15753,
16094,
9598,
4202,
445,
792,
62,
16,
497,
330,
957,
62,
16,
1138,
197,
1480,
1669,
7860,
7121,
12485,
741,
22212,
10516,
3830,
10574,
445,
203... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSupportedVersion(t *testing.T) {
c := testSpec(t)
c.ClusterInfo = &client.ClusterInfo{Context: context.TODO()}
// Octopus is supported
v := &cephver.CephVersion{Major: 15, Minor: 2, Extra: 5}
assert.NoError(t, c.validateCephVersion(v))
// Pacific is supported
v = &cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}
assert.NoError(t, c.validateCephVersion(v))
// Quincy is supported
v = &cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}
assert.NoError(t, c.validateCephVersion(v))
// v18 is not supported
v = &cephver.CephVersion{Major: 18, Minor: 2, Extra: 0}
assert.Error(t, c.validateCephVersion(v))
// Unsupported versions are now valid
c.Spec.CephVersion.AllowUnsupported = true
assert.NoError(t, c.validateCephVersion(v))
} | explode_data.jsonl/15035 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 292
} | [
2830,
3393,
34636,
5637,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
1273,
8327,
1155,
340,
1444,
72883,
1731,
284,
609,
2972,
72883,
1731,
90,
1972,
25,
2266,
90988,
368,
630,
197,
322,
4915,
45870,
374,
7248,
198,
5195,
1669,
609,
587... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSaveStepsStatus(t *testing.T) {
stepsStatusReq := prepareStepsStatus()
saveStepStatusMock = func(stepStatus *models.StepsStatus) (status *models.StepsStatus, err error) {
return stepStatus, nil
}
response, err := SaveStepStatus(stepsStatusReq)
assert.NotNil(t, response)
assert.Nil(t, err)
assert.NotNil(t, response.ID)
assert.Equal(t, stepsStatusReq.StepName, response.StepName, fmt.Sprintf("Expected Step name to be %s but was %s", stepsStatusReq.StepName, response.StepName))
assert.Equal(t, stepsStatusReq.TotalTimeInMs, response.TotalTimeInMs, fmt.Sprintf("Expected Total time in ms to be %d but was %d", stepsStatusReq.TotalTimeInMs, response.TotalTimeInMs))
assert.Equal(t, stepsStatusReq.Status, response.Status, fmt.Sprintf("Expected Step status to be %s but was %s", stepsStatusReq.Status, response.Status))
saveStepStatusMock = func(stepStatus *models.StepsStatus) (status *models.StepsStatus, err error) {
status = &models.StepsStatus{}
return status, errors.New("insertion failed")
}
response, err = SaveStepStatus(stepsStatusReq)
assert.NotNil(t, err)
} | explode_data.jsonl/42472 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 377
} | [
2830,
3393,
8784,
33951,
2522,
1155,
353,
8840,
836,
8,
1476,
18388,
7124,
2522,
27234,
1669,
10549,
33951,
2522,
741,
49230,
8304,
2522,
11571,
284,
2915,
38436,
2522,
353,
6507,
7758,
7124,
2522,
8,
320,
2829,
353,
6507,
7758,
7124,
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 TestCorrelationIDSubscriberDecorator(t *testing.T) {
var fn CorrelationIDInserter = func(msg *message.Message, id string) {
msg.Metadata.Set("mycid", id)
}
pubsub := gochannel.NewGoChannel(gochannel.Config{}, watermill.NopLogger{})
sub, err := CorrelationIDSubscriberDecorator(fn)(pubsub)
if err != nil {
t.Fatal(err)
}
const topic = "topic"
messages, err := sub.Subscribe(context.Background(), topic)
if err != nil {
t.Fatal(err)
}
msg := message.NewMessage("uuid", []byte{1, 2, 3})
middleware.SetCorrelationID("id", msg)
err = pubsub.Publish(topic, msg)
if err != nil {
t.Fatal(err)
}
received, all := subscriber.BulkRead(messages, 1, time.Second)
if !all {
t.Fatal("no message received")
}
if got, want := received[0].Metadata.Get("mycid"), "id"; got != want {
t.Errorf("message correlation ID does not match the expected\nactual: %s\nexpected: %s", got, want)
}
} | explode_data.jsonl/76321 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 351
} | [
2830,
3393,
10580,
22221,
915,
40236,
47951,
1155,
353,
8840,
836,
8,
341,
2405,
5168,
4463,
22221,
915,
641,
90727,
284,
2915,
8119,
353,
1994,
8472,
11,
877,
914,
8,
341,
197,
21169,
46475,
4202,
445,
2408,
20558,
497,
877,
340,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test3DesECB(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
key := []byte("1111111111111234")
text := []byte("1234567812345678")
padding := gdes.NOPADDING
result := "a23ee24b98c26263a23ee24b98c26263"
// encrypt test
cipherText, err := gdes.EncryptECBTriple(text, key, padding)
t.AssertEQ(err, nil)
t.AssertEQ(hex.EncodeToString(cipherText), result)
// decrypt test
clearText, err := gdes.DecryptECBTriple(cipherText, key, padding)
t.AssertEQ(err, nil)
t.AssertEQ(string(clearText), "1234567812345678")
// err test
errEncrypt, err := gdes.EncryptECB(text, key, errPadding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
})
gtest.C(t, func(t *gtest.T) {
key := []byte("111111111111123412345678")
text := []byte("123456789")
padding := gdes.PKCS5PADDING
errPadding := 5
result := "37989b1effc07a6d00ff89a7d052e79f"
// encrypt test
cipherText, err := gdes.EncryptECBTriple(text, key, padding)
t.AssertEQ(err, nil)
t.AssertEQ(hex.EncodeToString(cipherText), result)
// decrypt test
clearText, err := gdes.DecryptECBTriple(cipherText, key, padding)
t.AssertEQ(err, nil)
t.AssertEQ(string(clearText), "123456789")
// err test, when key is err, but text and padding is right
errEncrypt, err := gdes.EncryptECBTriple(text, errKey, padding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
// when padding is err,but key and text is right
errEncrypt, err = gdes.EncryptECBTriple(text, key, errPadding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
// decrypt err test,when key is err
errEncrypt, err = gdes.DecryptECBTriple(text, errKey, padding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
})
} | explode_data.jsonl/61845 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 748
} | [
2830,
3393,
18,
4896,
7498,
33,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
23634,
1669,
3056,
3782,
445,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
17,
18,
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 TestCheckSetScriptWithProofs(t *testing.T) {
to, path := createCheckerTestObjects(t)
defer func() {
to.stor.close(t)
err := common.CleanTemporaryDirs(path)
assert.NoError(t, err, "failed to clean test data dirs")
}()
tx := createSetScriptWithProofs(t)
info := defaultCheckerInfo(t)
// Activate sponsorship.
to.stor.activateSponsorship(t)
// Activate SmartAccounts.
to.stor.activateFeature(t, int16(settings.SmartAccounts))
_, err := to.tc.checkSetScriptWithProofs(tx, info)
assert.NoError(t, err, "checkSetScriptWithProofs failed with valid SetScriptWithProofs tx")
// Check min fee.
feeConst, ok := feeConstants[proto.SetScriptTransaction]
assert.Equal(t, ok, true)
tx.Fee = FeeUnit*feeConst - 1
_, err = to.tc.checkSetScriptWithProofs(tx, info)
assert.Error(t, err, "checkSetScriptWithProofs did not fail with fee less than minimum")
assert.EqualError(t, err, fmt.Sprintf("checkFee(): fee %d is less than minimum value of %d\n", tx.Fee, FeeUnit*feeConst))
tx.Fee = FeeUnit * feeConst
_, err = to.tc.checkSetScriptWithProofs(tx, info)
assert.NoError(t, err, "checkSetScriptWithProofs failed with valid SetScriptWithProofs tx")
// Test script activation rules.
dir, err := getLocalDir()
assert.NoError(t, err, "getLocalDir() failed")
scriptV3Path := filepath.Join(dir, "testdata", "scripts", "version3.base64")
scriptBase64, err := ioutil.ReadFile(scriptV3Path)
assert.NoError(t, err)
scriptBytes, err := reader.ScriptBytesFromBase64(scriptBase64)
assert.NoError(t, err)
prevScript := tx.Script
tx.Script = scriptBytes
_, err = to.tc.checkSetScriptWithProofs(tx, info)
assert.Error(t, err, "checkSetScriptWithProofs did not fail with Script V3 before Ride4DApps activation")
tx.Script = prevScript
_, err = to.tc.checkSetScriptWithProofs(tx, info)
assert.NoError(t, err, "checkSetScriptWithProofs failed with valid SetScriptWithProofs tx")
complexScriptPath := filepath.Join(dir, "testdata", "scripts", "exceeds_complexity.base64")
scriptBase64, err = ioutil.ReadFile(complexScriptPath)
assert.NoError(t, err)
scriptBytes, err = reader.ScriptBytesFromBase64(scriptBase64)
assert.NoError(t, err)
tx.Script = scriptBytes
_, err = to.tc.checkSetScriptWithProofs(tx, info)
assert.Error(t, err, "checkSetScriptWithProofs did not fail with Script that exceeds complexity limit")
tx.Script = prevScript
_, err = to.tc.checkSetScriptWithProofs(tx, info)
assert.NoError(t, err, "checkSetScriptWithProofs failed with valid SetScriptWithProofs tx")
// Check invalid timestamp failure.
tx.Timestamp = 0
_, err = to.tc.checkSetScriptWithProofs(tx, info)
assert.Error(t, err, "checkSetScriptWithProofs did not fail with invalid timestamp")
} | explode_data.jsonl/63097 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 934
} | [
2830,
3393,
3973,
1649,
5910,
2354,
31076,
82,
1155,
353,
8840,
836,
8,
341,
31709,
11,
1815,
1669,
1855,
35188,
2271,
11543,
1155,
692,
16867,
2915,
368,
341,
197,
31709,
1236,
269,
4653,
1155,
692,
197,
9859,
1669,
4185,
727,
2675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestListObjectNames(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()
HandleListObjectNamesSuccessfully(t)
count := 0
options := &ListOpts{Full: false}
err := List(fake.ServiceClient(), "testContainer", options).EachPage(func(page pagination.Page) (bool, error) {
count++
actual, err := ExtractNames(page)
if err != nil {
t.Errorf("Failed to extract container names: %v", err)
return false, err
}
th.CheckDeepEquals(t, ExpectedListNames, actual)
return true, nil
})
th.AssertNoErr(t, err)
th.CheckEquals(t, count, 1)
} | explode_data.jsonl/30749 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 211
} | [
2830,
3393,
852,
1190,
7980,
1155,
353,
8840,
836,
8,
341,
70479,
39820,
9230,
741,
16867,
270,
94849,
37496,
9230,
741,
197,
6999,
852,
1190,
7980,
35959,
1155,
692,
18032,
1669,
220,
15,
198,
35500,
1669,
609,
852,
43451,
90,
9432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAbortSpanEncodeDecode(t *testing.T) {
defer leaktest.AfterTest(t)()
const rangeID = 123
testTxnID, err := uuid.FromString("0ce61c17-5eb4-4587-8c36-dcf4062ada4c")
if err != nil {
t.Fatal(err)
}
key := AbortSpanKey(rangeID, testTxnID)
txnID, err := DecodeAbortSpanKey(key, nil)
if err != nil {
t.Fatal(err)
}
if txnID != testTxnID {
t.Fatalf("expected txnID %q, got %q", testTxnID, txnID)
}
} | explode_data.jsonl/56587 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 201
} | [
2830,
3393,
85891,
12485,
32535,
32564,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
741,
4777,
2088,
915,
284,
220,
16,
17,
18,
198,
18185,
31584,
77,
915,
11,
1848,
1669,
16040,
11439,
703,
445,
15,
346,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestWorkflowOutputs(t *testing.T) {
wf := unmarshalWF(`
metadata:
name: my-wf
namespace: my-ns
spec:
entrypoint: main
templates:
- name: main
dag:
tasks:
- name: step-1
template: child
- name: child
container:
image: my-image
outputs:
parameters:
- name: my-param
valueFrom:
path: /my-path
`)
cancel, controller := newController(wf)
defer cancel()
woc := newWorkflowOperationCtx(wf, controller)
// reconcile
ctx := context.Background()
woc.operate(ctx)
assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase)
// make all created pods as successful
makePodsPhase(ctx, woc, apiv1.PodSucceeded, withOutputs(`{"parameters": [{"name": "my-param"}]}`))
// reconcile
woc = newWorkflowOperationCtx(woc.wf, controller)
woc.operate(ctx)
assert.Equal(t, wfv1.WorkflowSucceeded, woc.wf.Status.Phase)
} | explode_data.jsonl/71024 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 384
} | [
2830,
3393,
62768,
61438,
1155,
353,
8840,
836,
8,
341,
6692,
69,
1669,
650,
27121,
32131,
61528,
17637,
510,
220,
829,
25,
847,
2630,
69,
198,
220,
4473,
25,
847,
12,
4412,
198,
9535,
510,
220,
4343,
2768,
25,
1887,
198,
220,
19911... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestResourceMarkProcessed(t *testing.T) {
tests := []struct {
description string
c *counter
err error
expected counter
}{
{
description: "when deployment failed, counter is updated",
c: newCounter(10),
err: errors.New("some ae"),
expected: counter{total: 10, failed: 1, pending: 9},
},
{
description: "when deployment is successful, counter is updated",
c: newCounter(10),
expected: counter{total: 10, failed: 0, pending: 9},
},
{
description: "counter when 1 deployment is updated correctly",
c: newCounter(1),
expected: counter{total: 1, failed: 0, pending: 0},
},
}
for _, test := range tests {
testutil.Run(t, test.description, func(t *testutil.T) {
t.CheckDeepEqual(test.expected, test.c.markProcessed(test.err), cmp.AllowUnexported(counter{}))
})
}
} | explode_data.jsonl/65257 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 375
} | [
2830,
3393,
4783,
8949,
82535,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
42407,
914,
198,
197,
1444,
1843,
353,
8292,
198,
197,
9859,
260,
1465,
198,
197,
42400,
262,
5546,
198,
197,
59403,
197,
197,
515,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDecodeJsonWithInvalidStringTime(t *testing.T) {
dec := json.NewDecoder(strings.NewReader("{\"time\":\"1610760752.606\\\"\",\"event\":\"hello\"}"))
dec.More()
var msg Event
err := dec.Decode(&msg)
assert.Error(t, err)
} | explode_data.jsonl/5176 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 89
} | [
2830,
3393,
32564,
5014,
2354,
7928,
703,
1462,
1155,
353,
8840,
836,
8,
341,
197,
8169,
1669,
2951,
7121,
20732,
51442,
68587,
99141,
1678,
23488,
16,
21,
16,
15,
22,
21,
15,
22,
20,
17,
13,
21,
15,
21,
3422,
2105,
34333,
3087,
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 TestReceivedIncorrectChecksumIncrement(t *testing.T) {
c := context.New(t, defaultMTU)
defer c.Cleanup()
c.CreateConnected(context.TestInitialSequenceNumber, 30000, -1 /* epRcvBuf */)
stats := c.Stack().Stats()
want := stats.TCP.ChecksumErrors.Value() + 1
iss := seqnum.Value(context.TestInitialSequenceNumber).Add(1)
vv := c.BuildSegment([]byte{0x1, 0x2, 0x3}, &context.Headers{
SrcPort: context.TestPort,
DstPort: c.Port,
Flags: header.TCPFlagAck,
SeqNum: iss,
AckNum: c.IRS.Add(1),
RcvWnd: 30000,
})
tcpbuf := vv.ToView()[header.IPv4MinimumSize:]
// Overwrite a byte in the payload which should cause checksum
// verification to fail.
tcpbuf[(tcpbuf[header.TCPDataOffset]>>4)*4] = 0x4
c.SendSegment(vv)
if got := stats.TCP.ChecksumErrors.Value(); got != want {
t.Errorf("got stats.TCP.ChecksumErrors.Value() = %d, want = %d", got, want)
}
if got := c.EP.Stats().(*tcp.Stats).ReceiveErrors.ChecksumErrors.Value(); got != want {
t.Errorf("got EP stats Stats.ReceiveErrors.ChecksumErrors = %d, want = %d", got, want)
}
} | explode_data.jsonl/75991 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 447
} | [
2830,
3393,
23260,
40468,
73190,
38311,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
2266,
7121,
1155,
11,
1638,
8505,
52,
340,
16867,
272,
727,
60639,
741,
1444,
7251,
21146,
5378,
8787,
6341,
14076,
2833,
11,
220,
18,
15,
15,
15,
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... | 3 |
func TestValidTokenFromP8Bytes(t *testing.T) {
bytes, _ := ioutil.ReadFile("_fixtures/authkey-valid.p8")
_, err := token.AuthKeyFromBytes(bytes)
assert.NoError(t, err)
} | explode_data.jsonl/74817 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 69
} | [
2830,
3393,
4088,
3323,
3830,
47,
23,
7078,
1155,
353,
8840,
836,
8,
341,
70326,
11,
716,
1669,
43144,
78976,
16975,
45247,
17369,
792,
84810,
556,
23,
1138,
197,
6878,
1848,
1669,
3950,
25233,
1592,
3830,
7078,
23158,
340,
6948,
35699,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRDSWatchExpiryTimer(t *testing.T) {
oldWatchExpiryTimeout := defaultWatchExpiryTimeout
defaultWatchExpiryTimeout = 1 * time.Second
defer func() {
defaultWatchExpiryTimeout = oldWatchExpiryTimeout
}()
fakeServer, sCleanup := fakexds.StartServer(t)
client, cCleanup := fakeServer.GetClientConn(t)
defer func() {
cCleanup()
sCleanup()
}()
v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 })
defer v2c.close()
t.Log("Started xds v2Client...")
// Register an LDS watcher, and wait till the request is sent out, the
// response is received and the callback is invoked.
ldsCallbackCh := make(chan struct{})
v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) {
t.Logf("v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err)
close(ldsCallbackCh)
})
<-fakeServer.RequestChan
fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1}
<-ldsCallbackCh
// Wait till the request makes it to the fakeServer. This ensures that
// the watch request has been processed by the v2Client.
rdsCallbackCh := make(chan error, 1)
v2c.watchRDS(goodRouteName1, func(u rdsUpdate, err error) {
t.Logf("Received callback with rdsUpdate {%+v} and error {%v}", u, err)
if u.clusterName != "" {
rdsCallbackCh <- fmt.Errorf("received clusterName %v in rdsCallback, wanted empty string", u.clusterName)
}
if err == nil {
rdsCallbackCh <- errors.New("received nil error in rdsCallback")
}
rdsCallbackCh <- nil
})
<-fakeServer.RequestChan
timer := time.NewTimer(2 * time.Second)
select {
case <-timer.C:
t.Fatalf("Timeout expired when expecting RDS update")
case err := <-rdsCallbackCh:
timer.Stop()
if err != nil {
t.Fatal(err)
}
}
} | explode_data.jsonl/51253 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 641
} | [
2830,
3393,
49,
5936,
14247,
840,
48209,
10105,
1155,
353,
8840,
836,
8,
341,
61828,
14247,
840,
48209,
7636,
1669,
1638,
14247,
840,
48209,
7636,
198,
11940,
14247,
840,
48209,
7636,
284,
220,
16,
353,
882,
32435,
198,
16867,
2915,
368... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestModifySpawnHostProviderSettings(t *testing.T) {
require.NoError(t, db.Clear(host.VolumesCollection))
vol := host.Volume{
ID: "v0",
AvailabilityZone: "us-east-1a",
}
require.NoError(t, vol.Insert())
config := evergreen.Settings{}
config.Providers.AWS.Subnets = []evergreen.Subnet{{AZ: "us-east-1a", SubnetID: "new_id"}}
d := distro.Distro{
ProviderSettings: &map[string]interface{}{
"subnet_id": "old_id",
},
}
settingsList, err := modifySpawnHostProviderSettings(d, &config, "", vol.ID)
assert.NoError(t, err)
assert.Equal(t, "new_id", settingsList[0].LookupElement("subnet_id").Value().StringValue())
} | explode_data.jsonl/8685 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 262
} | [
2830,
3393,
44427,
41005,
9296,
5179,
6086,
1155,
353,
8840,
836,
8,
341,
17957,
35699,
1155,
11,
2927,
13524,
19973,
5058,
19705,
6482,
4390,
5195,
337,
1669,
3468,
79106,
515,
197,
29580,
25,
2290,
330,
85,
15,
756,
197,
197,
51703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGenerateHints(t *testing.T) {
tests := []struct {
message string
event bus.Event
len int
result common.MapStr
}{
{
message: "Empty event hints should return empty config",
event: bus.Event{
"host": "1.2.3.4",
"kubernetes": common.MapStr{
"container": common.MapStr{
"name": "foobar",
"id": "abc",
},
},
"docker": common.MapStr{
"container": common.MapStr{
"name": "foobar",
"id": "abc",
},
},
},
len: 0,
result: common.MapStr{},
},
{
message: "Hints without host should return nothing",
event: bus.Event{
"hints": common.MapStr{
"monitor": common.MapStr{
"type": "icmp",
},
},
},
len: 0,
result: common.MapStr{},
},
{
message: "Hints without matching port should return nothing in the hosts section",
event: bus.Event{
"host": "1.2.3.4",
"port": 9090,
"hints": common.MapStr{
"monitor": common.MapStr{
"type": "icmp",
"hosts": "${data.host}:8888",
},
},
},
len: 1,
result: common.MapStr{
"schedule": "@every 5s",
"type": "icmp",
},
},
{
message: "Hints with multiple hosts return only the matching one",
event: bus.Event{
"host": "1.2.3.4",
"port": 9090,
"hints": common.MapStr{
"monitor": common.MapStr{
"type": "icmp",
"hosts": "${data.host}:8888,${data.host}:9090",
},
},
},
len: 1,
result: common.MapStr{
"type": "icmp",
"schedule": "@every 5s",
"hosts": []interface{}{"1.2.3.4:9090"},
},
},
{
message: "Hints with multiple hosts return only the one with the template",
event: bus.Event{
"host": "1.2.3.4",
"port": 9090,
"hints": common.MapStr{
"monitor": common.MapStr{
"type": "icmp",
"hosts": "${data.host}:8888,${data.host}:${data.port}",
},
},
},
len: 1,
result: common.MapStr{
"type": "icmp",
"schedule": "@every 5s",
"hosts": []interface{}{"1.2.3.4:9090"},
},
},
{
message: "Monitor defined in monitors as a JSON string should return a config",
event: bus.Event{
"host": "1.2.3.4",
"hints": common.MapStr{
"monitor": common.MapStr{
"raw": "{\"enabled\":true,\"type\":\"icmp\",\"schedule\":\"@every 20s\",\"timeout\":\"3s\"}",
},
},
},
len: 1,
result: common.MapStr{
"type": "icmp",
"timeout": "3s",
"schedule": "@every 20s",
"enabled": true,
},
},
{
message: "Monitor with processor config must return an module having the processor defined",
event: bus.Event{
"host": "1.2.3.4",
"port": 9090,
"hints": common.MapStr{
"monitor": common.MapStr{
"type": "icmp",
"hosts": "${data.host}:9090",
"processors": common.MapStr{
"add_locale": common.MapStr{
"abbrevation": "MST",
},
},
},
},
},
len: 1,
result: common.MapStr{
"type": "icmp",
"hosts": []interface{}{"1.2.3.4:9090"},
"schedule": "@every 5s",
"processors": []interface{}{
map[string]interface{}{
"add_locale": map[string]interface{}{
"abbrevation": "MST",
},
},
},
},
},
{
message: "Hints with multiple monitors should return multiple",
event: bus.Event{
"host": "1.2.3.4",
"port": 9090,
"hints": common.MapStr{
"monitor": common.MapStr{
"1": common.MapStr{
"type": "icmp",
"hosts": "${data.host}:8888,${data.host}:9090",
},
"2": common.MapStr{
"type": "icmp",
"hosts": "${data.host}:8888,${data.host}:9090",
},
},
},
},
len: 2,
result: common.MapStr{
"type": "icmp",
"schedule": "@every 5s",
"hosts": []interface{}{"1.2.3.4:9090"},
},
},
}
for _, test := range tests {
m := heartbeatHints{
config: defaultConfig(),
logger: logp.NewLogger("hints.builder"),
}
cfgs := m.CreateConfig(test.event)
assert.Equal(t, len(cfgs), test.len, test.message)
if len(cfgs) != 0 {
config := common.MapStr{}
err := cfgs[0].Unpack(&config)
assert.Nil(t, err, test.message)
assert.Equal(t, test.result, config, test.message)
}
}
} | explode_data.jsonl/3967 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2176
} | [
2830,
3393,
31115,
74933,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
24753,
914,
198,
197,
28302,
256,
5828,
6904,
198,
197,
33111,
257,
526,
198,
197,
9559,
220,
4185,
10104,
2580,
198,
197,
59403,
197,
197,
515... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test_NamespacesTopics_Spec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) {
t.Parallel()
parameters := gopter.DefaultTestParameters()
parameters.MaxSize = 10
properties := gopter.NewProperties(parameters)
properties.Property(
"Round trip from NamespacesTopics_Spec to NamespacesTopics_Spec via AssignPropertiesToNamespacesTopicsSpec & AssignPropertiesFromNamespacesTopicsSpec returns original",
prop.ForAll(RunPropertyAssignmentTestForNamespacesTopicsSpec, NamespacesTopicsSpecGenerator()))
properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout))
} | explode_data.jsonl/36549 | {
"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,
1604,
971,
27338,
45003,
1098,
992,
62,
4498,
7903,
61941,
2568,
795,
21884,
1690,
26040,
39838,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
67543,
1669,
728,
73137,
13275,
2271,
9706,
741,
67543,
14535,
1695,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetServiceTags(t *testing.T) {
tests := []struct {
desc string
service *v1.Service
expected []string
}{
{
desc: "nil should be returned when service is nil",
service: nil,
expected: nil,
},
{
desc: "nil should be returned when service has no annotations",
service: &v1.Service{},
expected: nil,
},
{
desc: "single tag should be returned when service has set one annotations",
service: &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
ServiceAnnotationAllowedServiceTag: "tag1",
},
},
},
expected: []string{"tag1"},
},
{
desc: "multiple tags should be returned when service has set multi-annotations",
service: &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
ServiceAnnotationAllowedServiceTag: "tag1, tag2",
},
},
},
expected: []string{"tag1", "tag2"},
},
{
desc: "correct tags should be returned when comma or spaces are included in the annotations",
service: &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
ServiceAnnotationAllowedServiceTag: ", tag1, ",
},
},
},
expected: []string{"tag1"},
},
}
for i, c := range tests {
tags := getServiceTags(c.service)
assert.Equal(t, tags, c.expected, "TestCase[%d]: %s", i, c.desc)
}
} | explode_data.jsonl/33998 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 574
} | [
2830,
3393,
1949,
1860,
15930,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
41653,
257,
914,
198,
197,
52934,
220,
353,
85,
16,
13860,
198,
197,
42400,
3056,
917,
198,
197,
59403,
197,
197,
515,
298,
41653,
25,
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 TestCert(t *testing.T) {
cert := &ssh.Certificate{
Key: testPublicKeys["rsa"],
ValidBefore: ssh.CertTimeInfinity,
CertType: ssh.UserCert,
}
cert.SignCert(rand.Reader, testSigners["ecdsa"])
testAgent(t, testPrivateKeys["rsa"], cert, 0)
} | explode_data.jsonl/20858 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 111
} | [
2830,
3393,
36934,
1155,
353,
8840,
836,
8,
341,
1444,
529,
1669,
609,
25537,
727,
20962,
515,
197,
55242,
25,
260,
1273,
12676,
8850,
1183,
60869,
8097,
197,
197,
4088,
10227,
25,
29230,
727,
529,
1462,
45090,
345,
197,
6258,
529,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestISBN13Validation(t *testing.T) {
tests := []struct {
param string
expected bool
}{
{"", false},
{"foo", false},
{"3-8362-2119-5", false},
{"01234567890ab", false},
{"978 3 8362 2119 0", false},
{"9784873113685", true},
{"978-4-87311-368-5", true},
{"978 3401013190", true},
{"978-3-8362-2119-1", true},
}
validate := New()
for i, test := range tests {
errs := validate.Var(test.param, "isbn13")
if test.expected {
if !IsEqual(errs, nil) {
t.Fatalf("Index: %d ISBN13 failed Error: %s", i, errs)
}
} else {
if IsEqual(errs, nil) {
t.Fatalf("Index: %d ISBN13 failed Error: %s", i, errs)
} else {
val := getError(errs, "", "")
if val.Tag() != "isbn13" {
t.Fatalf("Index: %d ISBN13 failed Error: %s", i, errs)
}
}
}
}
} | explode_data.jsonl/77276 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 389
} | [
2830,
3393,
45185,
16,
18,
13799,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
36037,
262,
914,
198,
197,
42400,
1807,
198,
197,
59403,
197,
197,
4913,
497,
895,
1583,
197,
197,
4913,
7975,
497,
895,
1583,
197,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestFuzzFourArgs(t *testing.T) {
data := []byte{0x2, 0x41, 0x42, 0x1, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49}
f := &F{Data: data, T: t}
fuzzFourArgs(f)
} | explode_data.jsonl/69276 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 91
} | [
2830,
3393,
37,
8889,
26972,
4117,
1155,
353,
8840,
836,
8,
341,
8924,
1669,
3056,
3782,
90,
15,
87,
17,
11,
220,
15,
87,
19,
16,
11,
220,
15,
87,
19,
17,
11,
220,
15,
87,
16,
11,
220,
15,
87,
19,
18,
11,
220,
15,
87,
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 TestAdd(t *testing.T) {
testCases := []struct {
name string
sel Selector
key string
operator Operator
values []string
refSelector Selector
}{
{
"keyInOperator",
internalSelector{},
"key",
InOperator,
[]string{"value"},
internalSelector{Requirement{"key", InOperator, sets.NewString("value")}},
},
{
"keyEqualsOperator",
internalSelector{Requirement{"key", InOperator, sets.NewString("value")}},
"key2",
EqualsOperator,
[]string{"value2"},
internalSelector{
Requirement{"key", InOperator, sets.NewString("value")},
Requirement{"key2", EqualsOperator, sets.NewString("value2")},
},
},
}
for _, ts := range testCases {
req, err := NewRequirement(ts.key, ts.operator, sets.NewString(ts.values...))
if err != nil {
t.Errorf("%s - Unable to create labels.Requirement", ts.name)
}
ts.sel = ts.sel.Add(*req)
if !reflect.DeepEqual(ts.sel, ts.refSelector) {
t.Errorf("%s - Expected %v found %v", ts.name, ts.refSelector, ts.sel)
}
}
} | explode_data.jsonl/66800 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 458
} | [
2830,
3393,
2212,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
286,
914,
198,
197,
1903,
301,
260,
49610,
198,
197,
23634,
260,
914,
198,
197,
83041,
262,
28498,
198,
197,
45939,
414,
3056,
917,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestChatSrvEphemeralTeamRetention(t *testing.T) {
runWithMemberTypes(t, func(mt chat1.ConversationMembersType) {
switch mt {
case chat1.ConversationMembersType_TEAM:
default:
t.Logf("skipping %v stage", mt)
return
}
ctc := makeChatTestContext(t, "TestChatSrvTeamRetention", 2)
defer ctc.cleanup()
users := ctc.users()
ctx := ctc.as(t, users[0]).startCtx
_ = ctc.as(t, users[1]).startCtx
for i, u := range users {
t.Logf("user[%v] %v %v", i, u.Username, u.User.GetUID())
ctc.world.Tcs[u.Username].ChatG.Syncer.(*Syncer).isConnected = true
}
listener := newServerChatListener()
ctc.as(t, users[1]).h.G().NotifyRouter.AddListener(listener)
// 3 convs
// convA: inherit team expire policy (default)
// convB: expire policy
// convC: retain policy
var convs []chat1.ConversationInfoLocal
for i := 0; i < 3; i++ {
t.Logf("creating conv %v", i)
var topicName *string
if i > 0 {
s := fmt.Sprintf("regarding-%v-gons", i)
topicName = &s
}
conv := mustCreateChannelForTest(t, ctc, users[0], chat1.TopicType_CHAT,
topicName, mt, ctc.as(t, users[1]).user())
convs = append(convs, conv)
if i > 0 {
mustJoinConversationByID(t, ctc, users[1], conv.Id)
consumeJoinConv(t, listener)
}
}
convA := convs[0]
convB := convs[1]
convC := convs[2]
teamID := tlfIDToTeamIDForce(t, convA.Triple.Tlfid)
age := gregor1.ToDurationSec(time.Hour * 24)
policy := chat1.NewRetentionPolicyWithEphemeral(chat1.RpEphemeral{Age: age})
teamPolicy := policy
convExpirePolicy := policy
convRetainPolicy := chat1.NewRetentionPolicyWithRetain(chat1.RpRetain{})
latestMsgMap := make(map[string] /*convID*/ chat1.MessageID)
latestMsg := func(convID chat1.ConversationID) chat1.MessageID {
return latestMsgMap[convID.String()]
}
for i, conv := range convs {
t.Logf("conv (%v/%v) %v in team %v", i+1, len(convs), conv.Id, tlfIDToTeamIDForce(t, conv.Triple.Tlfid))
msgID := mustPostLocalForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"}))
latestMsgMap[conv.Id.String()] = msgID
}
// drain remote messages
drain := func() {
for {
select {
case msg := <-listener.newMessageRemote:
t.Logf("drained %v", msg.Message.GetMessageType())
case <-time.After(100 * time.Millisecond):
return
}
}
}
drain()
mustSetConvRetentionLocal(t, ctc, users[0], convB.Id, convExpirePolicy)
require.True(t, consumeSetConvRetention(t, listener).Eq(convB.Id))
msg := consumeNewMsgRemote(t, listener, chat1.MessageType_SYSTEM)
verifyChangeRetentionSystemMessage(t, msg, chat1.MessageSystemChangeRetention{
IsTeam: false,
IsInherit: false,
Policy: convExpirePolicy,
MembersType: mt,
User: users[0].Username,
})
mustSetTeamRetentionLocal(t, ctc, users[0], teamID, teamPolicy)
require.True(t, consumeSetTeamRetention(t, listener).Eq(teamID))
msg = consumeNewMsgRemote(t, listener, chat1.MessageType_SYSTEM)
verifyChangeRetentionSystemMessage(t, msg, chat1.MessageSystemChangeRetention{
IsTeam: true,
IsInherit: false,
Policy: teamPolicy,
MembersType: mt,
User: users[0].Username,
})
mustSetConvRetentionLocal(t, ctc, users[0], convC.Id, convRetainPolicy)
require.True(t, consumeSetConvRetention(t, listener).Eq(convC.Id))
msg = consumeNewMsgRemote(t, listener, chat1.MessageType_SYSTEM)
verifyChangeRetentionSystemMessage(t, msg, chat1.MessageSystemChangeRetention{
IsTeam: false,
IsInherit: false,
Policy: convRetainPolicy,
MembersType: mt,
User: users[0].Username,
})
for _, conv := range []chat1.ConversationInfoLocal{convA, convB} {
mustReactToMsg(ctx, t, ctc, users[0], conv, latestMsg(conv.Id), ":+1:")
consumeNewMsgRemote(t, listener, chat1.MessageType_REACTION)
ephemeralMsgID := mustPostLocalEphemeralForTest(t, ctc, users[0], conv,
chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"}), &age)
consumeNewMsgRemote(t, listener, chat1.MessageType_TEXT)
mustReactToMsg(ctx, t, ctc, users[0], conv, ephemeralMsgID, ":+1:")
consumeNewMsgRemote(t, listener, chat1.MessageType_REACTION)
}
// revert convC to inherit
convInheritPolicy := chat1.NewRetentionPolicyWithInherit(chat1.RpInherit{})
mustSetConvRetentionLocal(t, ctc, users[0], convC.Id, convInheritPolicy)
require.True(t, consumeSetConvRetention(t, listener).Eq(convC.Id))
msg = consumeNewMsgRemote(t, listener, chat1.MessageType_SYSTEM)
verifyChangeRetentionSystemMessage(t, msg, chat1.MessageSystemChangeRetention{
IsTeam: false,
IsInherit: true,
MembersType: mt,
Policy: teamPolicy,
User: users[0].Username,
})
})
} | explode_data.jsonl/63709 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2022
} | [
2830,
3393,
15672,
50,
10553,
36,
59941,
3253,
14597,
86329,
1155,
353,
8840,
836,
8,
341,
56742,
2354,
9366,
4173,
1155,
11,
2915,
81618,
6236,
16,
4801,
22323,
24371,
929,
8,
341,
197,
8961,
11965,
341,
197,
2722,
6236,
16,
4801,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTransitiveSimple(t *testing.T) {
ls := &ModuleInstance{
InstanceName: "location-store",
ClassName: "client",
}
endpoint := &ModuleInstance{
InstanceName: "getLocation",
ClassName: "endpoint",
RecursiveDependencies: map[string][]*ModuleInstance{
"client": {ls},
},
}
service := &ModuleInstance{
InstanceName: "edge-gateway",
ClassName: "service",
RecursiveDependencies: map[string][]*ModuleInstance{
"endpoint": {endpoint},
},
}
graph := map[string][]*ModuleInstance{
"client": {ls},
"endpoint": {endpoint},
"service": {service},
}
ms := &ModuleSystem{
classOrder: []string{"client", "endpoint", "service"},
}
results, err := ms.collectTransitiveDependencies([]ModuleDependency{
{
InstanceName: "location-store",
ClassName: "client",
},
}, graph)
assert.NoError(t, err)
t.Logf("%+v", results)
assert.Len(t, results["client"], 1)
assert.Equal(t, "location-store", results["client"][0].InstanceName)
assert.Len(t, results["endpoint"], 1)
assert.Equal(t, "getLocation", results["endpoint"][0].InstanceName)
assert.Len(t, results["service"], 1)
assert.Equal(t, "edge-gateway", results["service"][0].InstanceName)
} | explode_data.jsonl/34600 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 461
} | [
2830,
3393,
3167,
3404,
16374,
1155,
353,
8840,
836,
8,
341,
197,
4730,
1669,
609,
3332,
2523,
515,
197,
197,
2523,
675,
25,
330,
2527,
33252,
756,
197,
197,
14541,
25,
262,
330,
2972,
756,
197,
532,
6246,
2768,
1669,
609,
3332,
252... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHelmValuesHiddenDirectory(t *testing.T) {
SkipOnEnv(t, "HELM")
Given(t).
Path(".hidden-helm").
When().
AddFile("foo.yaml", "").
Create().
AppSet("--values", "foo.yaml").
Sync().
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(HealthIs(health.HealthStatusHealthy)).
Expect(SyncStatusIs(SyncStatusCodeSynced))
} | explode_data.jsonl/69411 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 143
} | [
2830,
3393,
39,
23162,
6227,
17506,
9310,
1155,
353,
8840,
836,
8,
341,
7568,
13389,
1925,
14359,
1155,
11,
330,
1799,
10994,
1138,
9600,
2071,
1155,
4292,
197,
69640,
5680,
6263,
2832,
23162,
38609,
197,
197,
4498,
25829,
197,
37972,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestScanTypeHashing(t *testing.T) {
hashValues := HashScanType(scanType)
fmt.Printf("Hash: %d", hashValues)
assert.Equal(
t,
hashValues,
uint64(5325045708601790156),
"Should hash scantype consistently",
)
} | explode_data.jsonl/24496 | {
"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,
26570,
929,
6370,
287,
1155,
353,
8840,
836,
8,
341,
50333,
6227,
1669,
6531,
26570,
929,
71588,
929,
692,
11009,
19367,
445,
6370,
25,
1018,
67,
497,
5175,
6227,
692,
6948,
12808,
1006,
197,
3244,
345,
197,
50333,
6227,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSaveAnnotationsWriterReturnsNoBody(t *testing.T) {
testTid := "tid_test"
testCtx := tid.TransactionAwareContext(context.Background(), testTid)
testUUID := uuid.New()
testAnnotations := AnnotationsBody{
Annotations: []Annotation{
{
Predicate: "foo",
ConceptID: "bar",
},
},
}
r := vestigo.NewRouter()
r.Put(draftsURL, mockSaveAnnotations(t, testTid, testUUID, "", "", http.StatusOK, false))
server := httptest.NewServer(r)
defer server.Close()
client, err := NewAnnotationsClient(server.URL+"/drafts/content/%s/annotations", testingClient)
require.NoError(t, err)
actual, _, err := client.SaveAnnotations(testCtx, testUUID, "", testAnnotations)
assert.NoError(t, err)
assert.Equal(t, testAnnotations, actual)
} | explode_data.jsonl/19424 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 286
} | [
2830,
3393,
8784,
21418,
6492,
16446,
2753,
5444,
1155,
353,
8840,
836,
8,
341,
18185,
51,
307,
1669,
330,
24449,
4452,
698,
18185,
23684,
1669,
13112,
29284,
58793,
1972,
5378,
19047,
1507,
1273,
51,
307,
340,
18185,
24754,
1669,
16040,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAdders(t *testing.T) {
var cu Compilation
if err := cu.AddFile("foo", strings.NewReader(""), nil, &gopb.GoPackageInfo{
ImportPath: "vanity.io/foo",
}); err != nil {
t.Errorf("AddFile failed: %v", err)
}
if err := cu.AddDetails(&gopb.GoDetails{
Goroot: "plover",
}); err != nil {
t.Errorf("AddDetails failed: %v", err)
}
unit := cu.Unit()
unit.VName = &spb.VName{Language: "go", Corpus: "kythe"}
unit.Argument = []string{"this", "isn't", "an", "argument"}
unit.OutputKey = "blathe.a"
unit.SourceFile = []string{"foo"}
want := &apb.CompilationUnit{
VName: &spb.VName{
Language: "go",
Corpus: "kythe",
},
RequiredInput: []*apb.CompilationUnit_FileInput{{
Info: &apb.FileInfo{
Path: "foo",
Digest: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
},
Details: []*anypb.Any{{
TypeUrl: "kythe.io/proto/kythe.proto.GoPackageInfo",
Value: []byte("\n\rvanity.io/foo"),
}},
}},
SourceFile: []string{"foo"},
OutputKey: "blathe.a",
Argument: []string{"this", "isn't", "an", "argument"},
Details: []*anypb.Any{{
TypeUrl: "kythe.io/proto/kythe.proto.GoDetails",
Value: []byte("\x1a\x06plover"),
}},
}
if got := cu.Unit(); !proto.Equal(got, want) {
t.Errorf("Incorrect proto constructed:\n got: %+v\nwant: %+v", got, want)
}
wantFile := &apb.FileData{
Content: []byte(""),
Info: &apb.FileInfo{
Path: "foo",
Digest: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
},
}
if n := len(cu.Files); n != 1 {
t.Errorf("Wrong number of files: got %d, wanted 1", n)
} else if got := cu.Files[0]; !proto.Equal(got, wantFile) {
t.Errorf("Wrong file data:\n got: %+v\nwant: %+v", got, want)
}
} | explode_data.jsonl/4023 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 810
} | [
2830,
3393,
2212,
388,
1155,
353,
8840,
836,
8,
341,
2405,
6871,
70081,
271,
743,
1848,
1669,
6871,
1904,
1703,
445,
7975,
497,
9069,
68587,
86076,
2092,
11,
609,
70,
453,
65,
67131,
13100,
1731,
515,
197,
197,
11511,
1820,
25,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestNestedStepGroupGlobalParams(t *testing.T) {
wf := unmarshalWF(nestedStepGroupGlobalParams)
cancel, controller := newController(wf)
defer cancel()
ctx := context.Background()
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
node := woc.wf.Status.Nodes.FindByDisplayName("generate")
if assert.NotNil(t, node) && assert.NotNil(t, node.Outputs) && assert.Len(t, node.Outputs.Parameters, 1) {
assert.Equal(t, "hello-param", node.Outputs.Parameters[0].Name)
assert.Equal(t, "global-param", node.Outputs.Parameters[0].GlobalName)
assert.Equal(t, "hello world", node.Outputs.Parameters[0].Value.String())
}
assert.Equal(t, "hello world", woc.wf.Status.Outputs.Parameters[0].Value.String())
assert.Equal(t, "global-param", woc.wf.Status.Outputs.Parameters[0].Name)
} | explode_data.jsonl/71006 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 304
} | [
2830,
3393,
71986,
8304,
2808,
11646,
4870,
1155,
353,
8840,
836,
8,
341,
6692,
69,
1669,
650,
27121,
32131,
1445,
9980,
8304,
2808,
11646,
4870,
340,
84441,
11,
6461,
1669,
501,
2051,
3622,
69,
340,
16867,
9121,
2822,
20985,
1669,
2266... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadManifest_Validate_BundleOutput_Error(t *testing.T) {
cxt := context.NewTestContext(t)
cxt.AddTestFile("testdata/outputs/bundle-outputs-error.yaml", config.Name)
_, err := LoadManifestFrom(cxt.Context, config.Name)
require.Error(t, err)
} | explode_data.jsonl/37724 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 97
} | [
2830,
3393,
4418,
38495,
62,
17926,
1668,
4206,
5097,
28651,
1155,
353,
8840,
836,
8,
341,
1444,
2252,
1669,
2266,
7121,
2271,
1972,
1155,
692,
1444,
2252,
1904,
2271,
1703,
445,
92425,
14,
41006,
3470,
4206,
12,
41006,
18917,
33406,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuildSuggestionsInvalid(t *testing.T) {
tests := []struct {
in *reviewdog.Comment
want string
}{
{
in: buildTestComment(
"two suggestions, one without range",
[]*rdf.Suggestion{
{
Text: "line3-fixed\nline4-fixed",
},
buildTestsSuggestion("line1-fixed\nline2-fixed", 10, 11),
},
),
want: strings.Join([]string{
"```suggestion:-0+1",
"line1-fixed",
"line2-fixed",
"```",
"",
}, "\n"),
},
{
in: buildTestComment(
"two suggestions, one without range end",
[]*rdf.Suggestion{
{
Text: "line3-fixed\nline4-fixed",
Range: &rdf.Range{
Start: &rdf.Position{
Line: 20,
},
},
},
buildTestsSuggestion("line1-fixed\nline2-fixed", 10, 11),
}),
want: strings.Join([]string{
"```suggestion:-0+1",
"line1-fixed",
"line2-fixed",
"```",
"",
}, "\n"),
},
}
for _, tt := range tests {
suggestion := buildSuggestions(tt.in)
if suggestion != tt.want {
t.Errorf("got unexpected suggestion.\ngot:\n%s\nwant:\n%s", suggestion, tt.want)
}
}
} | explode_data.jsonl/1735 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 563
} | [
2830,
3393,
11066,
98846,
7928,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
17430,
256,
353,
19417,
18457,
56730,
198,
197,
50780,
914,
198,
197,
59403,
197,
197,
515,
298,
17430,
25,
1936,
2271,
10677,
1006,
571,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestCompileLoops(t *testing.T) {
input := `+[+[+]+]+`
expected := []*Instruction{
&Instruction{Plus, 1},
&Instruction{JumpIfZero, 7},
&Instruction{Plus, 1},
&Instruction{JumpIfZero, 5},
&Instruction{Plus, 1},
&Instruction{JumpIfNotZero, 3},
&Instruction{Plus, 1},
&Instruction{JumpIfNotZero, 1},
&Instruction{Plus, 1},
}
compiler := NewCompiler(input)
bytecode := compiler.Compile()
if len(bytecode) != len(expected) {
t.Fatalf("wrong bytecode length. want=%+v, got=%+v",
len(expected), len(bytecode))
}
for i, op := range expected {
if *bytecode[i] != *op {
t.Errorf("wrong op. want=%+v, got=%+v", op, bytecode[i])
}
}
} | explode_data.jsonl/73948 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 288
} | [
2830,
3393,
46126,
4262,
3721,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
1565,
69735,
69735,
10,
7574,
7574,
3989,
42400,
1669,
29838,
16664,
515,
197,
197,
5,
16664,
90,
21807,
11,
220,
16,
1583,
197,
197,
5,
16664,
90,
33979,
2679,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestObjectPutWithReauth(t *testing.T) {
ctx := context.Background()
if !swift.IS_AT_LEAST_GO_16 {
return
}
c, rollback := makeConnectionWithContainer(t)
defer rollback()
// Simulate that our auth token expired
c.AuthToken = "expiredtoken"
r := strings.NewReader(CONTENTS)
_, err := c.ObjectPut(ctx, CONTAINER, OBJECT, r, true, "", "text/plain", nil)
if err != nil {
t.Fatal(err)
}
info, _, err := c.Object(ctx, CONTAINER, OBJECT)
if err != nil {
t.Error(err)
}
if info.ContentType != "text/plain" {
t.Error("Bad content type", info.ContentType)
}
if info.Bytes != CONTENT_SIZE {
t.Error("Bad length")
}
if info.Hash != CONTENT_MD5 {
t.Error("Bad length")
}
} | explode_data.jsonl/12673 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 282
} | [
2830,
3393,
1190,
19103,
2354,
693,
3242,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
743,
753,
70642,
11230,
8667,
5280,
6349,
39622,
62,
16,
21,
341,
197,
853,
198,
197,
532,
1444,
11,
60414,
1669,
1281,
4526,
2354,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStorageSpecConfig(t *testing.T) {
clientset := fake.NewSimpleClientset()
clusterInfo := &cephclient.ClusterInfo{
Namespace: "ns",
CephVersion: cephver.Nautilus,
}
clusterInfo.SetName("testing")
clusterInfo.OwnerInfo = cephclient.NewMinimumOwnerInfo(t)
context := &clusterd.Context{Clientset: clientset, ConfigDir: "/var/lib/rook", Executor: &exectest.MockExecutor{}}
spec := cephv1.ClusterSpec{
DataDirHostPath: context.ConfigDir,
Storage: cephv1.StorageScopeSpec{
Config: map[string]string{
"crushRoot": "custom-root",
},
Nodes: []cephv1.Node{
{
Name: "node1",
Config: map[string]string{
"databaseSizeMB": "10",
"walSizeMB": "20",
"metadataDevice": "nvme093",
},
Selection: cephv1.Selection{},
Resources: v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceCPU: *resource.NewQuantity(1024.0, resource.BinarySI),
v1.ResourceMemory: *resource.NewQuantity(4096.0, resource.BinarySI),
},
Requests: v1.ResourceList{
v1.ResourceCPU: *resource.NewQuantity(500.0, resource.BinarySI),
v1.ResourceMemory: *resource.NewQuantity(2048.0, resource.BinarySI),
},
},
},
},
},
}
c := New(context, clusterInfo, spec, "rook/rook:myversion")
n := c.spec.Storage.ResolveNode(spec.Storage.Nodes[0].Name)
storeConfig := config.ToStoreConfig(spec.Storage.Nodes[0].Config)
metadataDevice := config.MetadataDevice(spec.Storage.Nodes[0].Config)
osdProp := osdProperties{
crushHostname: n.Name,
devices: n.Devices,
selection: n.Selection,
resources: c.spec.Storage.Nodes[0].Resources,
storeConfig: storeConfig,
metadataDevice: metadataDevice,
}
dataPathMap := &provisionConfig{
DataPathMap: opconfig.NewDatalessDaemonDataPathMap(c.clusterInfo.Namespace, "/var/lib/rook"),
}
job, err := c.makeJob(osdProp, dataPathMap)
assert.NotNil(t, job)
assert.Nil(t, err)
assert.Equal(t, "rook-ceph-osd-prepare-node1", job.ObjectMeta.Name)
container := job.Spec.Template.Spec.InitContainers[0]
assert.NotNil(t, container)
container = job.Spec.Template.Spec.Containers[0]
assert.NotNil(t, container)
verifyEnvVar(t, container.Env, "ROOK_OSD_DATABASE_SIZE", "10", true)
verifyEnvVar(t, container.Env, "ROOK_OSD_WAL_SIZE", "20", true)
verifyEnvVar(t, container.Env, "ROOK_METADATA_DEVICE", "nvme093", true)
verifyEnvVar(t, container.Env, CrushRootVarName, "custom-root", true)
} | explode_data.jsonl/73003 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1064
} | [
2830,
3393,
5793,
8327,
2648,
1155,
353,
8840,
836,
8,
341,
25291,
746,
1669,
12418,
7121,
16374,
2959,
746,
741,
197,
18855,
1731,
1669,
609,
58722,
2972,
72883,
1731,
515,
197,
90823,
25,
256,
330,
4412,
756,
197,
6258,
23544,
5637,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfig(t *testing.T) {
testConfigStringField(&Config.Store.Driver, "", t)
testConfigStringField(&Config.Store.User, "", t)
testConfigIntField(&Config.RetryInterval, 9, t)
testConfigIntField(&Config.TimeoutToFail, 9, t)
} | explode_data.jsonl/24521 | {
"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,
2648,
1155,
353,
8840,
836,
8,
341,
18185,
2648,
703,
1877,
2099,
2648,
38047,
41768,
11,
7342,
259,
340,
18185,
2648,
703,
1877,
2099,
2648,
38047,
7344,
11,
7342,
259,
340,
18185,
2648,
1072,
1877,
2099,
2648,
2013,
15149,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIndirectIndex_Entries(t *testing.T) {
index := tsm1.NewDirectIndex()
index.Add("cpu", time.Unix(0, 0), time.Unix(1, 0), 10, 100)
index.Add("cpu", time.Unix(2, 0), time.Unix(3, 0), 20, 200)
index.Add("mem", time.Unix(0, 0), time.Unix(1, 0), 10, 100)
b, err := index.MarshalBinary()
if err != nil {
t.Fatalf("unexpected error marshaling index: %v", err)
}
indirect := tsm1.NewIndirectIndex()
if err := indirect.UnmarshalBinary(b); err != nil {
t.Fatalf("unexpected error unmarshaling index: %v", err)
}
exp := index.Entries("cpu")
entries := indirect.Entries("cpu")
if got, exp := len(entries), len(exp); got != exp {
t.Fatalf("entries length mismatch: got %v, exp %v", got, exp)
}
for i, exp := range exp {
got := entries[i]
if exp.MinTime != got.MinTime {
t.Fatalf("minTime mismatch: got %v, exp %v", got.MinTime, exp.MinTime)
}
if exp.MaxTime != got.MaxTime {
t.Fatalf("minTime mismatch: got %v, exp %v", got.MaxTime, exp.MaxTime)
}
if exp.Size != got.Size {
t.Fatalf("size mismatch: got %v, exp %v", got.Size, exp.Size)
}
if exp.Offset != got.Offset {
t.Fatalf("size mismatch: got %v, exp %v", got.Offset, exp.Offset)
}
}
} | explode_data.jsonl/82460 | {
"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,
1425,
1226,
1552,
62,
24533,
1155,
353,
8840,
836,
8,
341,
26327,
1669,
259,
3563,
16,
7121,
16027,
1552,
741,
26327,
1904,
445,
16475,
497,
882,
10616,
941,
7,
15,
11,
220,
15,
701,
882,
10616,
941,
7,
16,
11,
220,
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... | 9 |
func TestWellFormedConfigIsLoadedSuccessfully(t *testing.T) {
data := `
src_glob_patterns: ["path/*", "another/path/*.ext"]
warning_age_days: 5
jira_address: "https://my.jira.com"
`
c, err := LoadFromYAMLData([]byte(data))
require.NoError(t, err)
require.Contains(t, c.SrcGlobPatterns, "path/*")
require.Contains(t, c.SrcGlobPatterns, "another/path/*.ext")
require.Equal(t, 2, len(c.SrcGlobPatterns))
require.Equal(t, 5, c.WarningAgeDays)
require.Equal(t, "https://my.jira.com", c.JIRAAddress)
} | explode_data.jsonl/24919 | {
"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,
11395,
1838,
291,
2648,
3872,
22369,
35959,
1155,
353,
8840,
836,
8,
341,
8924,
1669,
22074,
3548,
95133,
64923,
25,
4383,
2343,
1057,
497,
330,
41963,
50976,
23540,
427,
7026,
18928,
32053,
28353,
25,
220,
20,
198,
73,
8832... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSNIOverTLS(t *testing.T) {
httpSrv := httptest.NewServer(httpTestHandler)
defer httpSrv.Close()
httpsSrv := httptest.NewTLSServer(httpTestHandler)
defer httpsSrv.Close()
sendData := make([]byte, 128)
rand.Read(sendData)
var sniProxyTests = []struct {
targetURL string
host string
pass bool
}{
{httpSrv.URL, "", true},
{httpSrv.URL, "example.com", true},
{httpsSrv.URL, "", true},
{httpsSrv.URL, "example.com", true},
}
for i, tc := range sniProxyTests {
tc := tc
t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) {
err := sniOverTLSRoundtrip(tc.targetURL, sendData, tc.host)
if err == nil {
if !tc.pass {
t.Errorf("#%d should failed", i)
}
} else {
// t.Logf("#%d %v", i, err)
if tc.pass {
t.Errorf("#%d got error: %v", i, err)
}
}
})
}
} | explode_data.jsonl/69777 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 407
} | [
2830,
3393,
50,
14912,
1918,
45439,
1155,
353,
8840,
836,
8,
341,
28080,
50,
10553,
1669,
54320,
70334,
7121,
5475,
19886,
2271,
3050,
340,
16867,
1758,
50,
10553,
10421,
741,
197,
2428,
50,
10553,
1669,
54320,
70334,
7121,
13470,
1220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFindAndReplaceOneOpt(t *testing.T) {
var bundle1 *ReplaceOneBundle
bundle1 = bundle1.Upsert(true).BypassDocumentValidation(false)
testhelpers.RequireNotNil(t, bundle1, "created bundle was nil")
bundle1Opts := []option.Optioner{
OptUpsert(true).ConvertReplaceOneOption(),
OptBypassDocumentValidation(false).ConvertReplaceOneOption(),
}
bundle1DedupOpts := []option.Optioner{
OptUpsert(true).ConvertReplaceOneOption(),
OptBypassDocumentValidation(false).ConvertReplaceOneOption(),
}
bundle2 := BundleReplaceOne(MaxTime(1))
bundle2Opts := []option.Optioner{
OptMaxTime(1).ConvertReplaceOneOption(),
}
bundle3 := BundleReplaceOne().
MaxTime(1).
MaxTime(2).
Upsert(false).
Upsert(true)
bundle3Opts := []option.Optioner{
OptMaxTime(1).ConvertReplaceOneOption(),
OptMaxTime(2).ConvertReplaceOneOption(),
OptUpsert(false).ConvertReplaceOneOption(),
OptUpsert(true).ConvertReplaceOneOption(),
}
bundle3DedupOpts := []option.Optioner{
OptMaxTime(2).ConvertReplaceOneOption(),
OptUpsert(true).ConvertReplaceOneOption(),
}
nilBundle := BundleReplaceOne()
var nilBundleOpts []option.Optioner
nestedBundle1 := createNestedReplaceOneBundle1(t)
nestedBundleOpts1 := []option.Optioner{
OptUpsert(true).ConvertReplaceOneOption(),
OptMaxTime(500).ConvertReplaceOneOption(),
OptUpsert(false).ConvertReplaceOneOption(),
OptMaxTime(1000).ConvertReplaceOneOption(),
}
nestedBundleDedupOpts1 := []option.Optioner{
OptUpsert(false).ConvertReplaceOneOption(),
OptMaxTime(1000).ConvertReplaceOneOption(),
}
nestedBundle2 := createNestedReplaceOneBundle2(t)
nestedBundleOpts2 := []option.Optioner{
OptUpsert(true).ConvertReplaceOneOption(),
OptMaxTime(500).ConvertReplaceOneOption(),
OptMaxTime(100).ConvertReplaceOneOption(),
OptUpsert(false).ConvertReplaceOneOption(),
OptMaxTime(1000).ConvertReplaceOneOption(),
}
nestedBundleDedupOpts2 := []option.Optioner{
OptUpsert(false).ConvertReplaceOneOption(),
OptMaxTime(1000).ConvertReplaceOneOption(),
}
nestedBundle3 := createNestedReplaceOneBundle3(t)
nestedBundleOpts3 := []option.Optioner{
OptMaxTime(100).ConvertReplaceOneOption(),
OptUpsert(true).ConvertReplaceOneOption(),
OptMaxTime(500).ConvertReplaceOneOption(),
OptMaxTime(100).ConvertReplaceOneOption(),
OptUpsert(false).ConvertReplaceOneOption(),
OptMaxTime(1000).ConvertReplaceOneOption(),
}
nestedBundleDedupOpts3 := []option.Optioner{
OptUpsert(false).ConvertReplaceOneOption(),
OptMaxTime(1000).ConvertReplaceOneOption(),
}
t.Run("TestAll", func(t *testing.T) {
c := &mongoopt.Collation{
Locale: "string locale",
}
proj := Projection(true)
sort := Sort(true)
opts := []ReplaceOneOption{
Collation(c),
MaxTime(5),
Projection(proj),
ReturnDocument(mongoopt.After),
Sort(sort),
Upsert(true),
}
params := make([]ReplaceOne, len(opts))
for i := range opts {
params[i] = opts[i]
}
bundle := BundleReplaceOne(params...)
deleteOpts, _, err := bundle.Unbundle(true)
testhelpers.RequireNil(t, err, "got non-nill error from unbundle: %s", err)
if len(deleteOpts) != len(opts) {
t.Errorf("expected unbundled opts len %d. got %d", len(opts), len(deleteOpts))
}
for i, opt := range opts {
if !reflect.DeepEqual(opt.ConvertReplaceOneOption(), deleteOpts[i]) {
t.Errorf("opt mismatch. expected %#v, got %#v", opt, deleteOpts[i])
}
}
})
t.Run("Nil Option Bundle", func(t *testing.T) {
sess := FindSessionOpt{}
opts, _, err := BundleReplaceOne(Upsert(true), BundleReplaceOne(nil), sess, nil).unbundle()
testhelpers.RequireNil(t, err, "got non-nil error from unbundle: %s", err)
if len(opts) != 1 {
t.Errorf("expected bundle length 1. got: %d", len(opts))
}
opts, _, err = BundleReplaceOne(nil, sess, BundleReplaceOne(nil), Upsert(true)).unbundle()
testhelpers.RequireNil(t, err, "got non-nil error from unbundle: %s", err)
if len(opts) != 1 {
t.Errorf("expected bundle length 1. got: %d", len(opts))
}
})
t.Run("MakeOptions", func(t *testing.T) {
head := bundle1
bundleLen := 0
for head != nil && head.option != nil {
bundleLen++
head = head.next
}
if bundleLen != len(bundle1Opts) {
t.Errorf("expected bundle length %d. got: %d", len(bundle1Opts), bundleLen)
}
})
t.Run("Unbundle", func(t *testing.T) {
var cases = []struct {
name string
dedup bool
bundle *ReplaceOneBundle
expectedOpts []option.Optioner
}{
{"NilBundle", false, nilBundle, nilBundleOpts},
{"Bundle1", false, bundle1, bundle1Opts},
{"Bundle1Dedup", true, bundle1, bundle1DedupOpts},
{"Bundle2", false, bundle2, bundle2Opts},
{"Bundle2Dedup", true, bundle2, bundle2Opts},
{"Bundle3", false, bundle3, bundle3Opts},
{"Bundle3Dedup", true, bundle3, bundle3DedupOpts},
{"NestedBundle1_DedupFalse", false, nestedBundle1, nestedBundleOpts1},
{"NestedBundle1_DedupTrue", true, nestedBundle1, nestedBundleDedupOpts1},
{"NestedBundle2_DedupFalse", false, nestedBundle2, nestedBundleOpts2},
{"NestedBundle2_DedupTrue", true, nestedBundle2, nestedBundleDedupOpts2},
{"NestedBundle3_DedupFalse", false, nestedBundle3, nestedBundleOpts3},
{"NestedBundle3_DedupTrue", true, nestedBundle3, nestedBundleDedupOpts3},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
options, _, err := tc.bundle.Unbundle(tc.dedup)
testhelpers.RequireNil(t, err, "got non-nill error from unbundle: %s", err)
if len(options) != len(tc.expectedOpts) {
t.Errorf("options length does not match expected length. got %d expected %d", len(options),
len(tc.expectedOpts))
} else {
for i, opt := range options {
if !reflect.DeepEqual(opt, tc.expectedOpts[i]) {
t.Errorf("expected: %s\nreceived: %s", opt, tc.expectedOpts[i])
}
}
}
})
}
})
} | explode_data.jsonl/6168 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2430
} | [
2830,
3393,
9885,
3036,
23107,
3966,
21367,
1155,
353,
8840,
836,
8,
341,
2405,
12894,
16,
353,
23107,
3966,
8409,
198,
2233,
4206,
16,
284,
12894,
16,
5255,
1690,
529,
3715,
568,
33,
49911,
7524,
13799,
3576,
340,
18185,
21723,
81288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTreeMarshal(t *testing.T) {
cases := [][]byte{
basicTestToml,
marshalTestToml,
emptyTestToml,
pointerTestToml,
}
for _, expected := range cases {
t.Run("", func(t *testing.T) {
tree, err := LoadBytes(expected)
if err != nil {
t.Fatal(err)
}
result, err := tree.Marshal()
if err != nil {
t.Fatal(err)
}
if !bytes.Equal(result, expected) {
t.Errorf("Bad marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result)
}
})
}
} | explode_data.jsonl/46357 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 239
} | [
2830,
3393,
6533,
55438,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
52931,
3782,
515,
197,
2233,
5971,
2271,
24732,
75,
345,
197,
2109,
28423,
2271,
24732,
75,
345,
197,
197,
3194,
2271,
24732,
75,
345,
197,
197,
16044,
2271,
247... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVerify(t *testing.T) {
now := time.Now()
testcases := []struct {
name string
claims *Claims
fail bool
errPrefix string
}{
{
name: "ok",
claims: NewClaims("user-1", "avatar-url", time.Hour, model.Role{
ProjectId: "project-1",
ProjectRole: model.Role_ADMIN,
}),
fail: false,
},
{
name: "wrong issuer",
claims: &Claims{
StandardClaims: jwtgo.StandardClaims{
Issuer: "test-issuer",
IssuedAt: now.Unix(),
NotBefore: now.Unix(),
ExpiresAt: now.Add(time.Hour).Unix(),
},
},
fail: true,
errPrefix: "invalid issuer",
},
{
name: "expired",
claims: &Claims{
StandardClaims: jwtgo.StandardClaims{
Issuer: Issuer,
IssuedAt: now.Add(-time.Hour).Unix(),
NotBefore: now.Add(-time.Hour).Unix(),
ExpiresAt: now.Add(-time.Minute).Unix(),
},
},
fail: true,
errPrefix: "unable to parse token: token is expired",
},
{
name: "missing issueAt",
claims: &Claims{
StandardClaims: jwtgo.StandardClaims{
Issuer: Issuer,
NotBefore: now.Unix(),
ExpiresAt: now.Add(time.Hour).Unix(),
},
},
fail: true,
errPrefix: "missing issuedAt",
},
{
name: "missing expiresAt",
claims: &Claims{
StandardClaims: jwtgo.StandardClaims{
Issuer: Issuer,
IssuedAt: now.Unix(),
NotBefore: now.Unix(),
},
},
fail: true,
errPrefix: "missing expiresAt",
},
{
name: "missing notBefore",
claims: &Claims{
StandardClaims: jwtgo.StandardClaims{
Issuer: Issuer,
IssuedAt: now.Unix(),
ExpiresAt: now.Add(time.Hour).Unix(),
},
},
fail: true,
errPrefix: "missing notBefore",
},
}
testFunc := func(s Signer, v Verifier) {
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
token, err := s.Sign(tc.claims)
require.NoError(t, err)
require.True(t, len(token) > 0)
got, err := v.Verify(token)
if tc.fail {
require.Error(t, err)
assert.Nil(t, got)
if tc.errPrefix != "" && !strings.HasPrefix(err.Error(), tc.errPrefix) {
assert.Fail(t, fmt.Sprintf("unexpected error prefix, expected: %s, got: %s", tc.errPrefix, err.Error()))
}
} else {
assert.NoError(t, err)
assert.Equal(t, tc.claims, got)
}
})
}
}
rsS, err := NewSigner(jwtgo.SigningMethodRS256, "testdata/private.key")
require.NoError(t, err)
require.NotNil(t, rsS)
rsV, err := NewVerifier(jwtgo.SigningMethodRS256, "testdata/public.key")
require.NoError(t, err)
require.NotNil(t, rsV)
testFunc(rsS, rsV)
hsS, err := NewSigner(jwtgo.SigningMethodHS256, "testdata/private.key")
require.NoError(t, err)
require.NotNil(t, hsS)
hsV, err := NewVerifier(jwtgo.SigningMethodHS256, "testdata/private.key")
require.NoError(t, err)
require.NotNil(t, hsV)
testFunc(hsS, hsV)
c := NewClaims("user", "avatar-url", time.Hour, model.Role{
ProjectId: "project",
ProjectRole: model.Role_ADMIN,
})
token, err := rsS.Sign(c)
require.NoError(t, err)
require.True(t, len(token) > 0)
got, err := hsV.Verify(token)
require.Error(t, err)
require.Nil(t, got)
token, err = hsS.Sign(c)
require.NoError(t, err)
require.True(t, len(token) > 0)
got, err = rsV.Verify(token)
require.Error(t, err)
require.Nil(t, got)
} | explode_data.jsonl/19188 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1611
} | [
2830,
3393,
32627,
1155,
353,
8840,
836,
8,
341,
80922,
1669,
882,
13244,
2822,
18185,
23910,
1669,
3056,
1235,
341,
197,
11609,
414,
914,
198,
197,
197,
48561,
262,
353,
51133,
198,
197,
63052,
414,
1807,
198,
197,
9859,
14335,
914,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestSyncPendingJobs(t *testing.T) {
var testcases = []struct {
name string
pj kube.ProwJob
pendingJobs map[string]int
builds map[string]Build
err error
// TODO: Change to pass a ProwJobStatus
expectedState kube.ProwJobState
expectedBuild bool
expectedURL string
expectedComplete bool
expectedReport bool
expectedEnqueued bool
expectedError bool
}{
{
name: "enqueued",
pj: kube.ProwJob{
ObjectMeta: metav1.ObjectMeta{
Name: "foofoo",
},
Spec: kube.ProwJobSpec{
Job: "test-job",
},
Status: kube.ProwJobStatus{
State: kube.PendingState,
Description: "Jenkins job enqueued.",
},
},
builds: map[string]Build{
"foofoo": {enqueued: true, Number: 10},
},
expectedState: kube.PendingState,
expectedEnqueued: true,
},
{
name: "finished queue",
pj: kube.ProwJob{
ObjectMeta: metav1.ObjectMeta{
Name: "boing",
},
Spec: kube.ProwJobSpec{
Job: "test-job",
},
Status: kube.ProwJobStatus{
State: kube.PendingState,
Description: "Jenkins job enqueued.",
},
},
builds: map[string]Build{
"boing": {enqueued: false, Number: 10},
},
expectedURL: "boing/pending",
expectedState: kube.PendingState,
expectedEnqueued: false,
expectedReport: true,
},
{
name: "building",
pj: kube.ProwJob{
ObjectMeta: metav1.ObjectMeta{
Name: "firstoutthetrenches",
},
Spec: kube.ProwJobSpec{
Job: "test-job",
},
Status: kube.ProwJobStatus{
State: kube.PendingState,
},
},
builds: map[string]Build{
"firstoutthetrenches": {enqueued: false, Number: 10},
},
expectedURL: "firstoutthetrenches/pending",
expectedState: kube.PendingState,
expectedReport: true,
},
{
name: "missing build",
pj: kube.ProwJob{
ObjectMeta: metav1.ObjectMeta{
Name: "blabla",
},
Spec: kube.ProwJobSpec{
Type: kube.PresubmitJob,
Job: "test-job",
Refs: &kube.Refs{
Pulls: []kube.Pull{{
Number: 1,
SHA: "fake-sha",
}},
},
},
Status: kube.ProwJobStatus{
State: kube.PendingState,
},
},
// missing build
builds: map[string]Build{
"other": {enqueued: false, Number: 10},
},
expectedURL: "https://github.com/kubernetes/test-infra/issues",
expectedState: kube.ErrorState,
expectedError: true,
expectedComplete: true,
expectedReport: true,
},
{
name: "finished, success",
pj: kube.ProwJob{
ObjectMeta: metav1.ObjectMeta{
Name: "winwin",
},
Spec: kube.ProwJobSpec{
Job: "test-job",
},
Status: kube.ProwJobStatus{
State: kube.PendingState,
},
},
builds: map[string]Build{
"winwin": {Result: pState(success), Number: 11},
},
expectedURL: "winwin/success",
expectedState: kube.SuccessState,
expectedComplete: true,
expectedReport: true,
},
{
name: "finished, failed",
pj: kube.ProwJob{
ObjectMeta: metav1.ObjectMeta{
Name: "whatapity",
},
Spec: kube.ProwJobSpec{
Job: "test-job",
},
Status: kube.ProwJobStatus{
State: kube.PendingState,
},
},
builds: map[string]Build{
"whatapity": {Result: pState(failure), Number: 12},
},
expectedURL: "whatapity/failure",
expectedState: kube.FailureState,
expectedComplete: true,
expectedReport: true,
},
}
for _, tc := range testcases {
t.Logf("scenario %q", tc.name)
totServ := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "42")
}))
defer totServ.Close()
fjc := &fjc{
err: tc.err,
}
fkc := &fkc{
prowjobs: []kube.ProwJob{tc.pj},
}
c := Controller{
kc: fkc,
jc: fjc,
log: logrus.NewEntry(logrus.StandardLogger()),
cfg: newFakeConfigAgent(t, 0, nil).Config,
totURL: totServ.URL,
lock: sync.RWMutex{},
pendingJobs: make(map[string]int),
}
reports := make(chan kube.ProwJob, 100)
if err := c.syncPendingJob(tc.pj, reports, tc.builds); err != nil {
t.Errorf("unexpected error: %v", err)
continue
}
close(reports)
actual := fkc.prowjobs[0]
if tc.expectedError && actual.Status.Description != "Error finding Jenkins job." {
t.Errorf("expected description %q, got %q", "Error finding Jenkins job.", actual.Status.Description)
continue
}
if actual.Status.State != tc.expectedState {
t.Errorf("expected state %q, got %q", tc.expectedState, actual.Status.State)
continue
}
if actual.Complete() != tc.expectedComplete {
t.Errorf("expected complete prowjob, got %v", actual)
continue
}
if tc.expectedReport && len(reports) != 1 {
t.Errorf("wanted one report but got %d", len(reports))
continue
}
if !tc.expectedReport && len(reports) != 0 {
t.Errorf("did not wany any reports but got %d", len(reports))
continue
}
if fjc.built != tc.expectedBuild {
t.Errorf("expected build: %t, got: %t", tc.expectedBuild, fjc.built)
continue
}
if tc.expectedEnqueued && actual.Status.Description != "Jenkins job enqueued." {
t.Errorf("expected enqueued prowjob, got %v", actual)
}
if tc.expectedURL != actual.Status.URL {
t.Errorf("expected status URL: %s, got: %s", tc.expectedURL, actual.Status.URL)
}
}
} | explode_data.jsonl/72988 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2555
} | [
2830,
3393,
12154,
32027,
40667,
1155,
353,
8840,
836,
8,
341,
2405,
1273,
23910,
284,
3056,
1235,
341,
197,
11609,
286,
914,
198,
197,
3223,
73,
688,
80958,
1069,
651,
12245,
198,
197,
3223,
2459,
40667,
2415,
14032,
63025,
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 TestServiceCreate(t *testing.T) {
t.Run("success", func(t *testing.T) {
// GIVEN
mockRepository := &automock.Repository{}
mockUID := &automock.UIDService{}
defer mockRepository.AssertExpectations(t)
defer mockUID.AssertExpectations(t)
in := model.LabelDefinition{
Key: "some-key",
Tenant: "tenant",
Schema: fixSchema(t),
}
defWithID := in
defWithID.ID = fixUID()
mockUID.On("Generate").Return(fixUID())
mockRepository.On("Create", mock.Anything, defWithID).Return(nil)
ctx := context.TODO()
sut := labeldef.NewService(mockRepository, mockUID)
// WHEN
actual, err := sut.Create(ctx, in)
// THEN
require.NoError(t, err)
assert.Equal(t, defWithID, actual)
})
t.Run("returns error if Label Definition is invalid", func(t *testing.T) {
// GIVEN
mockUID := &automock.UIDService{}
defer mockUID.AssertExpectations(t)
mockUID.On("Generate").Return(fixUID())
sut := labeldef.NewService(nil, mockUID)
// WHEN
_, err := sut.Create(context.TODO(), model.LabelDefinition{})
// THEN
require.EqualError(t, err, "while validation Label Definition: missing Tenant field")
})
t.Run("returns error if cannot persist Label Definition", func(t *testing.T) {
// GIVEN
mockUID := &automock.UIDService{}
defer mockUID.AssertExpectations(t)
mockRepository := &automock.Repository{}
defer mockRepository.AssertExpectations(t)
mockUID.On("Generate").Return(fixUID())
mockRepository.On("Create", mock.Anything, mock.Anything).Return(errors.New("some error"))
sut := labeldef.NewService(mockRepository, mockUID)
// WHEN
_, err := sut.Create(context.TODO(), model.LabelDefinition{Key: "key", Tenant: "tenant"})
// THEN
require.EqualError(t, err, "while storing Label Definition: some error")
})
} | explode_data.jsonl/76922 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 704
} | [
2830,
3393,
1860,
4021,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
5630,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
197,
322,
89836,
198,
197,
77333,
4624,
1669,
609,
27073,
1176,
25170,
16094,
197,
77333,
6463,
1669,
609,
270... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestManager_List(t *testing.T) {
store := setupStore(t)
manager := snapshots.NewManager(store, nil, nil)
mgrList, err := manager.List()
require.NoError(t, err)
storeList, err := store.List()
require.NoError(t, err)
require.NotEmpty(t, storeList)
assert.Equal(t, storeList, mgrList)
// list should not block or error on busy managers
manager = setupBusyManager(t)
list, err := manager.List()
require.NoError(t, err)
assert.Equal(t, []*types.Snapshot{}, list)
} | explode_data.jsonl/24068 | {
"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,
2043,
27104,
1155,
353,
8840,
836,
8,
341,
57279,
1669,
6505,
6093,
1155,
340,
92272,
1669,
61823,
7121,
2043,
31200,
11,
2092,
11,
2092,
692,
2109,
901,
852,
11,
1848,
1669,
6645,
5814,
741,
17957,
35699,
1155,
11,
1848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestServiceAccountNotAllowed(t *testing.T) {
env := BuildEnv(t)
logger := Logger{}
kapp := Kapp{t, env.Namespace, logger}
sas := ServiceAccounts{env.Namespace}
yaml1 := `
---
apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: test-sa-not-allowed
annotations:
kapp.k14s.io/change-group: kappctrl-e2e.k14s.io/apps
spec:
serviceAccountName: kappctrl-e2e-ns-sa
fetch:
- inline:
paths:
config.yml: |
kind: ConfigMap
apiVersion: v1
metadata:
name: test-not-allowed
namespace: kube-system #! <-- not allowed namespace
data:
not-allowed: ""
template:
- ytt: {}
deploy:
- kapp: {}
`+sas.ForNamespaceYAML()
yaml2 := `
---
apiVersion: kappctrl.k14s.io/v1alpha1
kind: App
metadata:
name: test-sa-not-allowed
annotations:
kapp.k14s.io/change-group: kappctrl-e2e.k14s.io/apps
spec:
serviceAccountName: kappctrl-e2e-ns-sa
fetch:
- inline:
paths:
config.yml: |
kind: ConfigMap
apiVersion: v1
metadata:
name: test-not-allowed
data:
not-allowed: ""
template:
- ytt: {}
deploy:
- kapp: {}
`+sas.ForNamespaceYAML()
name := "test-service-account-not-allowed"
cleanUp := func() {
kapp.Run([]string{"delete", "-a", name})
}
cleanUp()
defer cleanUp()
logger.Section("deploy forbidden resource", func() {
_, err := kapp.RunWithOpts([]string{"deploy", "-f", "-", "-a", name},
RunOpts{IntoNs: true, StdinReader: strings.NewReader(yaml1), AllowError: true})
if err == nil {
t.Fatalf("Expected err, but was nil")
}
if !strings.Contains(err.Error(), "Reconcile failed: (message: Deploying: exit status 1)") {
t.Fatalf("Expected err to contain service account failure, but was: %s", err)
}
out := kapp.Run([]string{"inspect", "-a", name, "--raw", "--tty=false", "--filter-kind=App"})
var cr v1alpha1.App
err = yaml.Unmarshal([]byte(out), &cr)
if err != nil {
t.Fatalf("Failed to unmarshal: %s", err)
}
expectedErr := `cannot get resource "configmaps" in API group "" in the namespace "kube-system" (reason: Forbidden)`
if !strings.Contains(cr.Status.Deploy.Stderr, expectedErr) {
t.Fatalf("Expected forbidden error in deploy output, but was: %#v", cr.Status.Deploy)
}
})
logger.Section("deploy allowed resources", func() {
kapp.RunWithOpts([]string{"deploy", "-f", "-", "-a", name},
RunOpts{IntoNs: true, StdinReader: strings.NewReader(yaml2)})
})
} | explode_data.jsonl/33473 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1106
} | [
2830,
3393,
1860,
7365,
97634,
1155,
353,
8840,
836,
8,
341,
57538,
1669,
7854,
14359,
1155,
340,
17060,
1669,
9514,
16094,
16463,
676,
1669,
730,
676,
90,
83,
11,
6105,
46011,
11,
5925,
532,
1903,
300,
1669,
5362,
41369,
90,
3160,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFileNoParamRequired(t *testing.T) {
type config struct {
SecretKey string `env:"SECRET_KEY,file,required"`
}
defer os.Clearenv()
cfg := config{}
err := Parse(&cfg)
assert.Error(t, err)
assert.EqualError(t, err, "env: required environment variable \"SECRET_KEY\" is not set")
} | explode_data.jsonl/78804 | {
"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,
1703,
2753,
2001,
8164,
1155,
353,
8840,
836,
8,
341,
13158,
2193,
2036,
341,
197,
7568,
50856,
1592,
914,
1565,
3160,
2974,
65310,
6600,
57476,
11,
6279,
8805,
197,
532,
16867,
2643,
727,
273,
9151,
85,
741,
50286,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCAConfigSecurityLevel(t *testing.T) {
backend, err := config.FromFile(configTestFilePath)()
if err != nil {
t.Fatal("Failed to get config backend")
}
customBackend := getCustomBackend(backend...)
cryptoConfig := ConfigFromBackend(customBackend).(*Config)
// Test Security Level
val, ok := customBackend.Lookup("client.BCCSP.security.level")
if !ok || val == nil {
t.Fatal("expected valid value")
}
if val.(int) != cryptoConfig.SecurityLevel() {
t.Fatal("Incorrect BCCSP Security Level")
}
} | explode_data.jsonl/58378 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 180
} | [
2830,
3393,
5049,
2648,
15352,
4449,
1155,
353,
8840,
836,
8,
341,
197,
20942,
11,
1848,
1669,
2193,
11439,
1703,
8754,
2271,
19090,
8,
741,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
445,
9408,
311,
633,
2193,
19163,
1138,
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... | 5 |
func TestUnspecifiedRecipient(t *testing.T) {
expected := "Recipient unspecified\n"
kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
md, err := ReadMessage(readerFromHex(recipientUnspecifiedHex), kring, nil, nil)
if err != nil {
t.Errorf("error reading message: %s", err)
return
}
contents, err := ioutil.ReadAll(md.UnverifiedBody)
if err != nil {
t.Errorf("error reading UnverifiedBody: %s", err)
}
if string(contents) != expected {
t.Errorf("bad UnverifiedBody got:%s want:%s", string(contents), expected)
}
} | explode_data.jsonl/2281 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 202
} | [
2830,
3393,
1806,
53434,
74432,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
330,
74432,
54311,
1699,
698,
197,
9855,
287,
11,
716,
1669,
4457,
1592,
43466,
21987,
3830,
20335,
8623,
8850,
16,
3036,
17,
16787,
20335,
4390,
84374,
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... | 4 |
func TestListRecycledInstances(t *testing.T) {
queryArgs := &ListRecycledInstancesArgs{
Marker: "your marker",
PaymentTiming: "your paymentTiming",
RecycleBegin: "RecycleBegin", // recycled begin time ,eg: 2020-11-23T17:18:24Z
RecycleEnd: "RecycleEnd",
MaxKeys: 10,
InstanceId: "InstanceId",
Name: "InstanceName",
}
if res, err := BBC_CLIENT.ListRecycledInstances(queryArgs); err != nil {
fmt.Println("list recycled bbc failed: ", err)
} else {
fmt.Println("list recycled bbc success, result: ", res)
}
} | explode_data.jsonl/4095 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 230
} | [
2830,
3393,
852,
3820,
36576,
42725,
1155,
353,
8840,
836,
8,
341,
27274,
4117,
1669,
609,
852,
3820,
36576,
42725,
4117,
515,
197,
197,
20613,
25,
286,
330,
21732,
11134,
756,
197,
10025,
6074,
62805,
25,
330,
21732,
8160,
62805,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestInvalidUpgrade(t *testing.T) {
state := make(map[string]map[string][]byte)
state["lscc"] = make(map[string][]byte)
v := newValidationInstance(state)
ccname := "mycc"
ccver := "2"
simresres, err := createCCDataRWset(ccname, ccname, ccver, nil)
assert.NoError(t, err)
tx, err := createLSCCTx(ccname, ccver, lscc.UPGRADE, simresres)
if err != nil {
t.Fatalf("createTx returned err %s", err)
}
envBytes, err := protoutil.GetBytesEnvelope(tx)
if err != nil {
t.Fatalf("GetBytesEnvelope returned err %s", err)
}
// good path: signed by the right MSP
policy, err := getSignedByMSPMemberPolicy(mspid)
if err != nil {
t.Fatalf("failed getting policy, err %s", err)
}
b := &common.Block{Data: &common.BlockData{Data: [][]byte{envBytes}}}
err = v.Validate(b, "lscc", 0, 0, policy)
assert.EqualError(t, err, "Upgrading non-existent chaincode mycc")
} | explode_data.jsonl/42506 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 346
} | [
2830,
3393,
7928,
43861,
1155,
353,
8840,
836,
8,
341,
24291,
1669,
1281,
9147,
14032,
60,
2186,
14032,
45725,
3782,
340,
24291,
1183,
4730,
638,
1341,
284,
1281,
9147,
14032,
45725,
3782,
692,
5195,
1669,
501,
13799,
2523,
8390,
692,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestWeekdayMask(t *testing.T) {
t.Parallel()
for i := time.Sunday; i <= time.Saturday; i++ {
assert.Equal(t, int(math.Pow(2, float64(i+1))), WeekdayMask(i), "Day %s", i)
}
} | explode_data.jsonl/13339 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 83
} | [
2830,
3393,
17053,
1292,
12686,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
2023,
600,
1669,
882,
808,
6676,
26,
600,
2651,
882,
808,
6970,
26,
600,
1027,
341,
197,
6948,
12808,
1155,
11,
526,
37270,
54891,
7,
17,
11,
222... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNilOpts(t *testing.T) {
var testOpts = []struct {
name string
opt *Options
}{
{
name: "nil",
opt: nil,
},
{
name: "nil env",
opt: &Options{Comments: true, TabIndent: true, TabWidth: 8},
},
{
name: "default",
opt: &Options{
Env: &ProcessEnv{
GOPATH: build.Default.GOPATH,
GOROOT: build.Default.GOROOT,
},
Comments: true,
TabIndent: true,
TabWidth: 8,
},
},
}
input := `package p
func _() {
fmt.Println()
}
`
want := `package p
import "fmt"
func _() {
fmt.Println()
}
`
for _, test := range testOpts {
// Test Process
got, err := Process("", []byte(input), test.opt)
if err != nil {
t.Errorf("%s: %s", test.name, err.Error())
}
if string(got) != want {
t.Errorf("%s: Process: Got:\n%s\nWant:\n%s\n", test.name, string(got), want)
}
// Test FixImports and ApplyFixes
fixes, err := FixImports("", []byte(input), test.opt)
if err != nil {
t.Errorf("%s: %s", test.name, err.Error())
}
got, err = ApplyFixes(fixes, "", []byte(input), test.opt, 0)
if err != nil {
t.Errorf("%s: %s", test.name, err.Error())
}
if string(got) != want {
t.Errorf("%s: ApplyFix: Got:\n%s\nWant:\n%s\n", test.name, string(got), want)
}
}
} | explode_data.jsonl/72350 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 601
} | [
2830,
3393,
19064,
43451,
1155,
353,
8840,
836,
8,
341,
2405,
1273,
43451,
284,
3056,
1235,
341,
197,
11609,
914,
198,
197,
64838,
220,
353,
3798,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,
330,
8385,
756,
298,
64838,
25,
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... | 7 |
func TestRetriesNew_Error(t *testing.T) {
err := NewRetriesResult(NewResult(500, "this is an example error, %s", "yep"), 0, time.Now(), nil)
const want = "500: this is an example error, yep"
got := err.Error()
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("Unexpected diff (-want, +got) = %v", diff)
}
} | explode_data.jsonl/66502 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
12020,
4019,
3564,
28651,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
1532,
12020,
4019,
2077,
35063,
2077,
7,
20,
15,
15,
11,
330,
574,
374,
458,
3110,
1465,
11,
1018,
82,
497,
330,
88,
747,
3975,
220,
15,
11,
882,
1324... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestMobileAppRequest(t *testing.T) {
// setup server endpoint to return bid.
service := CreateService(adapterstest.BidOnTags("1001"))
server := service.Server
ctx := context.TODO()
req := SampleRequest(1, t)
req.App = &openrtb.App{
ID: "com.facebook.katana",
Name: "facebook",
}
bidder := req.Bidders[0]
adapter := NewPulsePointAdapter(adapters.DefaultHTTPAdapterConfig, server.URL)
bids, _ := adapter.Call(ctx, req, bidder)
// one mobile app impression sent.
// verify appropriate fields are sent to pulsepoint endpoint.
adapterstest.VerifyIntValue(len(service.LastBidRequest.Imp), 1, t)
adapterstest.VerifyStringValue(service.LastBidRequest.App.ID, "com.facebook.katana", t)
adapterstest.VerifyIntValue(len(bids), 1, t)
adapterstest.VerifyStringValue(bids[0].AdUnitCode, "div-adunit-1", t)
} | explode_data.jsonl/24665 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 298
} | [
2830,
3393,
18370,
2164,
1900,
1155,
353,
8840,
836,
8,
341,
197,
322,
6505,
3538,
14887,
311,
470,
14103,
624,
52934,
1669,
4230,
1860,
42534,
267,
477,
1785,
307,
1925,
15930,
445,
16,
15,
15,
16,
5455,
41057,
1669,
2473,
22997,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetStateMultipleChannelsChannelGroups(t *testing.T) {
assert := assert.New(t)
pubnub.Config.UUID = "my-custom-uuid"
opts := &getStateOpts{
Channels: []string{"ch1", "ch2", "ch3"},
ChannelGroups: []string{"cg1", "cg2", "cg3"},
pubnub: pubnub,
}
path, err := opts.buildPath()
assert.Nil(err)
u := &url.URL{
Path: path,
}
h.AssertPathsEqual(t,
"/v2/presence/sub-key/sub_key/channel/ch1,ch2,ch3/uuid/my-custom-uuid",
u.EscapedPath(), []int{})
query, err := opts.buildQuery()
assert.Nil(err)
expected := &url.Values{}
expected.Set("channel-group", "cg1,cg2,cg3")
h.AssertQueriesEqual(t, expected, query, []string{"pnsdk", "uuid"}, []string{})
body, err := opts.buildBody()
assert.Nil(err)
assert.Equal([]byte{}, body)
} | explode_data.jsonl/32498 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 356
} | [
2830,
3393,
1949,
1397,
32089,
35925,
9629,
22173,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
62529,
77,
392,
10753,
39636,
284,
330,
2408,
36898,
12,
17128,
1837,
64734,
1669,
609,
62353,
43451,
515,
197,
197,
359... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReportWorkflowResource_ScheduledWorkflowIDNotEmpty_ExperimentNotFound(t *testing.T) {
store := NewFakeClientManagerOrFatal(util.NewFakeTimeForEpoch())
defer store.Close()
manager := NewResourceManager(store)
job := &api.Job{
Name: "j1",
Enabled: true,
PipelineSpec: &api.PipelineSpec{WorkflowManifest: testWorkflow.ToStringForStore()},
}
newJob, err := manager.CreateJob(job)
// report workflow
workflow := util.NewWorkflow(&v1alpha1.Workflow{
ObjectMeta: v1.ObjectMeta{
Name: "MY_NAME",
Namespace: "MY_NAMESPACE",
UID: "WORKFLOW_1",
OwnerReferences: []v1.OwnerReference{{
APIVersion: "kubeflow.org/v1beta1",
Kind: "ScheduledWorkflow",
Name: "SCHEDULE_NAME",
UID: types.UID(newJob.UUID),
}},
CreationTimestamp: v1.NewTime(time.Unix(11, 0).UTC()),
},
})
err = manager.ReportWorkflowResource(workflow)
println(err.Error())
assert.NotNil(t, err)
assert.Equal(t, codes.NotFound, err.(*util.UserError).ExternalStatusCode())
assert.Contains(t, err.Error(), "Experiment not found")
} | explode_data.jsonl/28391 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 460
} | [
2830,
3393,
10361,
62768,
4783,
1098,
26644,
62768,
915,
27416,
62531,
14329,
10372,
1155,
353,
8840,
836,
8,
341,
57279,
1669,
1532,
52317,
2959,
2043,
2195,
62396,
67811,
7121,
52317,
1462,
2461,
44338,
2398,
16867,
3553,
10421,
741,
9227... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAuthorizeOrder(t *testing.T) {
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
c.GetAccessToken()
_, err := c.AuthorizeOrder(testOrderID, &Amount{Total: "7.00", Currency: "USD"})
if err == nil {
t.Errorf("Order is expired, 400 error must be returned")
}
} | explode_data.jsonl/18450 | {
"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,
37483,
4431,
1155,
353,
8840,
836,
8,
341,
1444,
11,
716,
1669,
1532,
2959,
8623,
2959,
915,
11,
1273,
19773,
11,
5333,
3978,
47044,
1611,
340,
1444,
2234,
37649,
2822,
197,
6878,
1848,
1669,
272,
33858,
551,
4431,
8623,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestBeacon_Value(t *testing.T) {
genesisBlock := types.NewExistingBlock(types.GetEffectiveGenesis(), []byte("genesis"), nil)
block1 := types.NewExistingBlock(0, []byte("asghsfgdhn"), nil)
block2 := types.NewExistingBlock(0, []byte("asghdhn"), nil)
block3 := types.NewExistingBlock(0, []byte("asghsfg"), nil)
r := require.New(t)
b := NewBeacon(nil, 0, log.NewDefault(t.Name()))
c := newMockCacher()
b.cache = c
genesisGoodPtrn := map[types.BlockID]struct{}{}
genesisGoodPtrn[genesisBlock.ID()] = struct{}{}
valGoodPtrn := map[types.BlockID]struct{}{}
valGoodPtrn[block1.ID()] = struct{}{}
valGoodPtrn[block2.ID()] = struct{}{}
valGoodPtrn[block3.ID()] = struct{}{}
b.patternProvider = &mockPatternProvider{valGoodPtrn, genesisGoodPtrn, errFoo}
b.confidenceParam = cfg.ConfidenceParam
_, err := b.Value(100)
r.NotNil(err)
b.patternProvider = &mockPatternProvider{valGoodPtrn, genesisGoodPtrn, nil}
val, err := b.Value(100)
r.Nil(err)
r.Equal(calcValue(valGoodPtrn), val)
r.Equal(2, c.numGet)
r.Equal(1, c.numAdd)
// ensure cache
val, err = b.Value(100)
assert.Nil(t, err)
assert.Equal(t, calcValue(valGoodPtrn), val)
r.Equal(3, c.numGet)
r.Equal(1, c.numAdd)
val, err = b.Value(1)
assert.Nil(t, err)
assert.Equal(t, calcValue(genesisGoodPtrn), val)
} | explode_data.jsonl/60032 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 549
} | [
2830,
3393,
3430,
22379,
27867,
1155,
353,
8840,
836,
8,
341,
82281,
13774,
4713,
1669,
4494,
7121,
53067,
4713,
52613,
2234,
67539,
84652,
1507,
3056,
3782,
445,
77894,
3975,
2092,
692,
47996,
16,
1669,
4494,
7121,
53067,
4713,
7,
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 TestOutStep(t *testing.T) {
tc := newFakeTableClient()
tc.g.NewNode(graph.GenID(), graph.Metadata{"MAC": "123"})
tc.g.NewNode(graph.GenID(), graph.Metadata{"PeerIntfMAC": "456"})
tc.g.NewNode(graph.GenID(), graph.Metadata{"MAC": "789"})
_, flowChan := tc.t.Start()
defer tc.t.Stop()
for tc.t.State() != common.RunningState {
time.Sleep(100 * time.Millisecond)
}
icmp := newICMPFlow(222)
icmp.Link = &flow.FlowLayer{B: "123"}
flowChan <- icmp
icmp = newICMPFlow(444)
icmp.Link = &flow.FlowLayer{B: "456"}
flowChan <- icmp
icmp = newICMPFlow(666)
icmp.Link = &flow.FlowLayer{B: "123"}
flowChan <- icmp
time.Sleep(time.Second)
query := `G.Flows()`
res := execTraversalQuery(t, tc, query)
if len(res.Values()) != 3 {
t.Fatalf("Should return 2 result, returned: %v", res.Values())
}
query = `G.Flows().Out()`
res = execTraversalQuery(t, tc, query)
if len(res.Values()) != 3 {
t.Fatalf("Should return 2 result, returned: %v", res.Values())
}
query = `G.Flows().Out().Limit(1)`
res = execTraversalQuery(t, tc, query)
if len(res.Values()) != 1 {
t.Fatalf("Should return 1 result, returned: %v", res.Values())
}
} | explode_data.jsonl/45643 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 479
} | [
2830,
3393,
2662,
8304,
1155,
353,
8840,
836,
8,
341,
78255,
1669,
501,
52317,
2556,
2959,
2822,
78255,
1302,
7121,
1955,
24312,
65384,
915,
1507,
4771,
46475,
4913,
25788,
788,
330,
16,
17,
18,
23625,
78255,
1302,
7121,
1955,
24312,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLevels_TrieFull(t *testing.T) {
var (
branching = 4
chunkSize = 128
hashSize = 32
writes = 16384 // this is to get a balanced trie
s = mock.NewStorer()
pf = func() pipeline.ChainWriter {
lsw := store.NewStoreWriter(ctx, s, mode, nil)
return bmt.NewBmtWriter(lsw)
}
ht = hashtrie.NewHashTrieWriter(chunkSize, branching, hashSize, pf)
)
// to create a level wrap we need to do branching^(level-1) writes
for i := 0; i < writes; i++ {
a := &pipeline.PipeWriteArgs{Ref: addr.Bytes(), Span: span}
err := ht.ChainWrite(a)
if err != nil {
t.Fatal(err)
}
}
a := &pipeline.PipeWriteArgs{Ref: addr.Bytes(), Span: span}
err := ht.ChainWrite(a)
if !errors.Is(err, hashtrie.ErrTrieFull) {
t.Fatal(err)
}
// it is questionable whether the writer should go into some
// corrupt state after the last write which causes the trie full
// error, in which case we would return an error on Sum()
_, err = ht.Sum()
if err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/29829 | {
"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,
46991,
1139,
7231,
9432,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
197,
17940,
287,
284,
220,
19,
198,
197,
23049,
3122,
1695,
284,
220,
16,
17,
23,
198,
197,
50333,
1695,
220,
284,
220,
18,
17,
198,
197,
6692,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInferParametersInvalidCases(t *testing.T) {
catalogStore, err := store.Open("catalog_infer_params_invalid", store.DefaultOptions())
require.NoError(t, err)
defer os.RemoveAll("catalog_infer_params_invalid")
dataStore, err := store.Open("catalog_infer_params_invalid", store.DefaultOptions())
require.NoError(t, err)
defer os.RemoveAll("catalog_infer_params_invalid")
engine, err := NewEngine(catalogStore, dataStore, DefaultOptions().WithPrefix(sqlPrefix))
require.NoError(t, err)
_, err = engine.ExecStmt("CREATE DATABASE db1", nil, true)
require.NoError(t, err)
err = engine.UseDatabase("db1")
require.NoError(t, err)
_, err = engine.ExecStmt("CREATE TABLE mytable(id INTEGER, title VARCHAR, active BOOLEAN, PRIMARY KEY id)", nil, true)
require.NoError(t, err)
_, err = engine.InferParameters("INSERT INTO mytable(id, title) VALUES (@param1, @param1)")
require.Equal(t, ErrInferredMultipleTypes, err)
_, err = engine.InferParameters("INSERT INTO mytable(id, title) VALUES (@param1)")
require.Equal(t, ErrIllegalArguments, err)
_, err = engine.InferParameters("INSERT INTO mytable1(id, title) VALUES (@param1, @param2)")
require.Equal(t, ErrTableDoesNotExist, err)
_, err = engine.InferParameters("INSERT INTO mytable(id, note) VALUES (@param1, @param2)")
require.Equal(t, ErrColumnDoesNotExist, err)
_, err = engine.InferParameters("SELECT * FROM mytable WHERE id > @param1 AND (@param1 OR active)")
require.Equal(t, ErrInferredMultipleTypes, err)
_, err = engine.InferParameters("BEGIN TRANSACTION INSERT INTO mytable(id, title) VALUES (@param1, @param1) COMMIT")
require.Equal(t, ErrInferredMultipleTypes, err)
err = engine.Close()
require.NoError(t, err)
} | explode_data.jsonl/64088 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 609
} | [
2830,
3393,
641,
802,
9706,
7928,
37302,
1155,
353,
8840,
836,
8,
341,
1444,
7750,
6093,
11,
1848,
1669,
3553,
12953,
445,
26539,
1243,
802,
6745,
31433,
497,
3553,
13275,
3798,
2398,
17957,
35699,
1155,
11,
1848,
340,
16867,
2643,
8442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJsonListValue_Iterator(t *testing.T) {
list := NewJSONList(NewRegistry(), &structpb.ListValue{Values: []*structpb.Value{
{Kind: &structpb.Value_StringValue{StringValue: "hello"}},
{Kind: &structpb.Value_NumberValue{NumberValue: 1}},
{Kind: &structpb.Value_NumberValue{NumberValue: 2}},
{Kind: &structpb.Value_NumberValue{NumberValue: 3}}}})
it := list.Iterator()
for i := Int(0); it.HasNext() != False; i++ {
v := it.Next()
if v.Equal(list.Get(i)) != True {
t.Errorf("elem[%d] Got '%v', expected '%v'", i, v, list.Get(i))
}
}
if it.HasNext() != False {
t.Error("Iterator indicated more elements were left")
}
if it.Next() != nil {
t.Error("Calling Next() for a complete iterator resulted in a non-nil value.")
}
} | explode_data.jsonl/55361 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 293
} | [
2830,
3393,
5014,
852,
1130,
7959,
465,
850,
1155,
353,
8840,
836,
8,
341,
14440,
1669,
1532,
5370,
852,
35063,
15603,
1507,
609,
1235,
16650,
5814,
1130,
90,
6227,
25,
29838,
1235,
16650,
6167,
515,
197,
197,
90,
10629,
25,
609,
1235... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestState_HandleIntercepts(t *testing.T) {
ctx := dlog.NewTestContext(t, false)
a := assert.New(t)
f, s := makeFS(t)
var (
host string
port int32
cepts []*rpc.InterceptInfo
reviews []*rpc.ReviewInterceptRequest
)
// Setup worked
host, port = f.Target()
a.Equal(appHost, host)
a.Equal(appPort, port)
// Handle resets state on an empty intercept list
reviews = s.HandleIntercepts(ctx, cepts)
a.Len(reviews, 0)
a.False(f.Intercepting())
// Prepare some intercepts..
cepts = []*rpc.InterceptInfo{
{
Spec: &rpc.InterceptSpec{
Name: "cept1Name",
Client: "user@host1",
Agent: "agentName",
Mechanism: "tcp",
Namespace: "default",
},
Id: "intercept-01",
},
{
Spec: &rpc.InterceptSpec{
Name: "cept2Name",
Client: "user@host2",
Agent: "agentName",
Mechanism: "tcp",
Namespace: "default",
},
Id: "intercept-02",
},
}
// Handle ignores non-active and non-waiting intercepts
cepts[0].Disposition = rpc.InterceptDispositionType_NO_PORTS
cepts[1].Disposition = rpc.InterceptDispositionType_NO_CLIENT
reviews = s.HandleIntercepts(ctx, cepts)
a.Len(reviews, 0)
a.False(f.Intercepting())
// Handle reviews waiting intercepts
cepts[0].Disposition = rpc.InterceptDispositionType_WAITING
cepts[1].Disposition = rpc.InterceptDispositionType_WAITING
reviews = s.HandleIntercepts(ctx, cepts)
a.Len(reviews, 2)
a.False(f.Intercepting())
// Reviews are in the correct order
a.Equal(cepts[0].Id, reviews[0].Id)
a.Equal(cepts[1].Id, reviews[1].Id)
// First cept was accepted, second was rejected
a.Equal(rpc.InterceptDispositionType_ACTIVE, reviews[0].Disposition)
a.Equal(rpc.InterceptDispositionType_AGENT_ERROR, reviews[1].Disposition)
a.Equal("Conflicts with the currently-waiting-to-be-served intercept \"intercept-01\"", reviews[1].Message)
// Handle updates forwarding
cepts[0].Disposition = rpc.InterceptDispositionType_ACTIVE
cepts[1].Disposition = rpc.InterceptDispositionType_WAITING
reviews = s.HandleIntercepts(ctx, cepts)
a.Len(reviews, 1)
a.True(f.Intercepting())
a.Equal(rpc.InterceptDispositionType_AGENT_ERROR, reviews[0].Disposition)
a.Equal("Conflicts with the currently-served intercept \"intercept-01\"", reviews[0].Message)
// Handle resets state on an empty intercept list again
reviews = s.HandleIntercepts(ctx, nil)
a.Len(reviews, 0)
a.False(f.Intercepting())
} | explode_data.jsonl/19341 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 987
} | [
2830,
3393,
1397,
42714,
3306,
57771,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
294,
839,
7121,
2271,
1972,
1155,
11,
895,
340,
11323,
1669,
2060,
7121,
1155,
340,
1166,
11,
274,
1669,
1281,
8485,
1155,
692,
2405,
2399,
197,
63104,
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 Test_packetConnWriteToInvalidSockaddr(t *testing.T) {
_, err := (&packetConn{}).WriteTo(nil, &net.IPAddr{})
if want, got := unix.EINVAL, err; want != got {
t.Fatalf("unexpected error:\n- want: %v\n- got: %v", want, got)
}
} | explode_data.jsonl/35210 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 102
} | [
2830,
3393,
21078,
9701,
7985,
1249,
7928,
79812,
6214,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
15899,
24829,
9701,
6257,
568,
7985,
1249,
27907,
11,
609,
4711,
46917,
13986,
37790,
743,
1366,
11,
2684,
1669,
51866,
5142,
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 TestBuildCmdEnvFromSecretStore(t *testing.T) {
appName := "test1"
appNames := []string{"test1"}
env := []string{
"ANYTHING=must_be_kept",
"KAIGARA_ANYTHING=must_be_ignored",
}
err := secretStore.LoadSecrets(appName, scopes[0])
assert.NoError(t, err)
err = secretStore.SetSecret(appName, "key_"+scopes[0], "value_"+scopes[0], scopes[0])
assert.NoError(t, err)
err = secretStore.SaveSecrets(appName, scopes[0])
assert.NoError(t, err)
err = secretStore.LoadSecrets("global", "secret")
assert.NoError(t, err)
err = secretStore.SetSecret("global", "key_global", "value_global", scopes[0])
assert.NoError(t, err)
err = secretStore.SaveSecrets("global", scopes[0])
assert.NoError(t, err)
r := BuildCmdEnv(appNames, secretStore, env, scopes)
assert.Equal(t, map[string]*File{}, r.Files)
assert.ElementsMatch(t, []string{
"ANYTHING=must_be_kept",
"KEY_SECRET=value_secret",
"KEY_GLOBAL=value_global",
}, r.Vars)
} | explode_data.jsonl/8939 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 385
} | [
2830,
3393,
11066,
15613,
14359,
3830,
19773,
6093,
1155,
353,
8840,
836,
8,
341,
28236,
675,
1669,
330,
1944,
16,
698,
28236,
7980,
1669,
3056,
917,
4913,
1944,
16,
63159,
57538,
1669,
3056,
917,
515,
197,
197,
1,
17293,
56664,
28,
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 TestSubtractStrSlicesOverlap(t *testing.T) {
orig := []string{"a", "b"}
new := []string{"a"}
res := subtractStrSlices(orig, new)
require.Len(t, res, 1)
require.Equal(t, "b", res[0])
} | explode_data.jsonl/66963 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 84
} | [
2830,
3393,
3136,
2144,
2580,
50,
37414,
82171,
1155,
353,
8840,
836,
8,
341,
197,
4670,
1669,
3056,
917,
4913,
64,
497,
330,
65,
16707,
8638,
1669,
3056,
917,
4913,
64,
63159,
10202,
1669,
32256,
2580,
50,
37414,
54837,
11,
501,
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 |
func TestHandlesValidSCTFeedback(t *testing.T) {
s := createAndOpenStorage()
defer closeAndDeleteStorage(s)
v := mustCreateSignatureVerifiers(t)
h := newHandlerWithClock(s, v, testStuckClock(stuckClockTimeMillis))
rr := httptest.NewRecorder()
req, err := http.NewRequest("POST", "/.well-known/ct/v1/sct-feedback", strings.NewReader(addSCTFeedbackJSON))
if err != nil {
t.Fatalf("Failed to create request: %v", err)
}
h.HandleSCTFeedback(rr, req)
assert.Equal(t, http.StatusOK, rr.Code)
f := sctFeedbackFromString(t, addSCTFeedbackJSON)
for _, entry := range f.Feedback {
for _, sct := range entry.SCTData {
expectStorageHasFeedback(t, s, entry.X509Chain, sct)
}
}
} | explode_data.jsonl/80080 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 273
} | [
2830,
3393,
65928,
4088,
50,
1162,
35348,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1855,
3036,
5002,
5793,
741,
16867,
3265,
3036,
6435,
5793,
1141,
340,
5195,
1669,
1969,
4021,
25088,
10141,
11836,
1155,
340,
9598,
1669,
501,
3050,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNavigateTo(t *testing.T) {
ctx := context.Background()
d, err := CreateSession(ctx, wdAddress(), 3, nil)
if err != nil {
t.Fatal(err)
}
defer d.Quit(ctx)
u, err := url.Parse("https://www.google.com")
if err := d.NavigateTo(ctx, u); err != nil {
t.Fatal(err)
}
cu, err := d.CurrentURL(ctx)
if err != nil {
t.Fatal(err)
}
if !strings.Contains(cu.Hostname(), "google.com") {
t.Fatalf("got %v, expected to contain google.com", cu)
}
} | explode_data.jsonl/68735 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 201
} | [
2830,
3393,
73282,
1249,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
2822,
2698,
11,
1848,
1669,
4230,
5283,
7502,
11,
45404,
4286,
1507,
220,
18,
11,
2092,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestAsciiQ(t *testing.T) {
input := "=?US-ASCII?Q?Keith_Moore?="
expect := "Keith Moore"
result := DecodeHeader(input)
assert.Equal(t, expect, result)
} | explode_data.jsonl/31258 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 67
} | [
2830,
3393,
84135,
48,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
330,
19884,
2034,
12,
56450,
30,
48,
30,
90328,
1245,
78,
460,
30,
43488,
24952,
1669,
330,
90328,
20219,
698,
9559,
1669,
50194,
4047,
5384,
340,
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 |
func TestCancelOrder(t *testing.T) {
t.Parallel()
if !areTestAPIKeysSet() || !canManipulateRealOrders {
t.Skip("skipping test, either api keys or canManipulateRealOrders isn't set correctly")
}
currencyPair, err := currency.NewPairFromString(spotPair)
if err != nil {
t.Fatal(err)
}
c := order.Cancel{
ID: "12366984218",
Pair: currencyPair,
AssetType: asset.Spot,
}
if err := f.CancelOrder(context.Background(), &c); err != nil {
t.Error(err)
}
c.ClientOrderID = "1337"
if err := f.CancelOrder(context.Background(), &c); err != nil {
t.Error(err)
}
} | explode_data.jsonl/15192 | {
"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,
9269,
4431,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
743,
753,
546,
2271,
7082,
8850,
1649,
368,
1369,
753,
4814,
92876,
6334,
12768,
24898,
341,
197,
3244,
57776,
445,
4886,
5654,
1273,
11,
2987,
6330,
6894,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPodSpecWithStorageAndCloudStorageSpec(t *testing.T) {
coreops.SetInstance(coreops.New(fakek8sclient.NewSimpleClientset()))
nodeName := "testNode"
cluster := &corev1.StorageCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "px-cluster",
Namespace: "kube-system",
},
Spec: corev1.StorageClusterSpec{
Image: "portworx/oci-monitor:2.0.3.4",
CommonConfig: corev1.CommonConfig{
Storage: &corev1.StorageSpec{
JournalDevice: stringPtr("/dev/journal"),
},
},
CloudStorage: &corev1.CloudStorageSpec{
CloudStorageCommon: corev1.CloudStorageCommon{
JournalDeviceSpec: stringPtr("type=journal"),
},
},
},
}
driver := portworx{}
// Use storage spec over cloud storage spec if not empty
expectedArgs := []string{
"-c", "px-cluster",
"-x", "kubernetes",
"-j", "/dev/journal",
}
actual, err := driver.GetStoragePodSpec(cluster, nodeName)
require.NoError(t, err, "Unexpected error on GetStoragePodSpec")
assert.ElementsMatch(t, expectedArgs, actual.Containers[0].Args)
} | explode_data.jsonl/55444 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 410
} | [
2830,
3393,
23527,
8327,
2354,
5793,
3036,
16055,
5793,
8327,
1155,
353,
8840,
836,
8,
341,
71882,
3721,
4202,
2523,
47867,
3721,
7121,
74138,
74,
23,
82,
2972,
7121,
16374,
2959,
746,
12145,
20831,
675,
1669,
330,
1944,
1955,
1837,
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 TestSave(t *testing.T) {
profiles := client.DefaultProfiles()
makeTestConfigInDir(t, profiles)
// Profiles should be written to the local config if not specified.
err := profiles.Save(nil)
require.NoError(t, err)
actual, err := client.Load()
require.NoError(t, err)
require.Equal(t, profiles, actual)
// Profiles should be written to the specified config.
tmp, err := ioutil.TempDir("", "config-*")
require.NoError(t, err)
defer os.RemoveAll(tmp)
folder := &configdir.Config{
Path: tmp,
Type: configdir.Local,
}
err = profiles.Save(folder)
require.NoError(t, err)
data, err := os.ReadFile(filepath.Join(tmp, client.ProfileYAML))
require.NoError(t, err)
actual = &client.Profiles{}
err = yaml.Unmarshal(data, actual)
require.NoError(t, err)
require.Equal(t, profiles, actual)
} | explode_data.jsonl/71584 | {
"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,
8784,
1155,
353,
8840,
836,
8,
341,
197,
56195,
1669,
2943,
13275,
62719,
741,
77438,
2271,
2648,
641,
6184,
1155,
11,
20872,
692,
197,
322,
71727,
1265,
387,
5326,
311,
279,
2205,
2193,
421,
537,
5189,
624,
9859,
1669,
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 |
func TestModelConcat_Forward(t *testing.T) {
model := newTestModel(Concat)
g := ag.NewGraph()
ctx := nn.Context{Graph: g, Mode: nn.Training}
// == Forward
x1 := g.NewVariable(mat.NewVecDense([]mat.Float{0.5, 0.6}), true)
x2 := g.NewVariable(mat.NewVecDense([]mat.Float{0.7, -0.4}), true)
x3 := g.NewVariable(mat.NewVecDense([]mat.Float{0.0, -0.7}), true)
y := nn.Reify(ctx, model).(*Model).Forward(x1, x2, x3)
assert.InDeltaSlice(t, []mat.Float{
0.187746, -0.50052, 0.109558, -0.005277, -0.084306, -0.628766,
}, y[0].Value().Data(), 1.0e-06)
assert.InDeltaSlice(t, []mat.Float{
-0.704648, 0.200908, -0.064056, -0.329084, -0.237601, -0.449676,
}, y[1].Value().Data(), 1.0e-06)
assert.InDeltaSlice(t, []mat.Float{
0.256521, 0.725227, 0.781582, 0.129273, -0.716298, -0.263625,
}, y[2].Value().Data(), 1.0e-06)
// == Backward
y[0].PropagateGrad(mat.NewVecDense([]mat.Float{-0.4, -0.8, 0.1, 0.4, 0.6, -0.4}))
y[1].PropagateGrad(mat.NewVecDense([]mat.Float{0.6, 0.6, 0.7, 0.7, -0.6, 0.3}))
y[2].PropagateGrad(mat.NewVecDense([]mat.Float{-0.1, -0.1, 0.1, -0.8, 0.4, -0.5}))
g.BackwardAll()
// Important! average params by sequence length
nn.ForEachParam(model, func(param nn.Param) {
param.Grad().ProdScalarInPlace(1.0 / 3.0)
})
assert.InDeltaSlice(t, []mat.Float{1.031472, -0.627913}, x1.Grad().Data(), 0.006)
assert.InDeltaSlice(t, []mat.Float{-0.539497, -0.629167}, x2.Grad().Data(), 0.006)
assert.InDeltaSlice(t, []mat.Float{0.013097, -0.09932}, x3.Grad().Data(), 0.006)
assert.InDeltaSlice(t, []mat.Float{
0.001234, -0.107987,
0.175039, 0.015738,
0.213397, -0.046717,
}, model.Positive.(*srn.Model).W.Grad().Data(), 1.0e-06)
assert.InDeltaSlice(t, []mat.Float{
0.041817, -0.059241, 0.013592,
0.042229, -0.086071, 0.019157,
0.035331, -0.11595, 0.02512,
}, model.Positive.(*srn.Model).WRec.Grad().Data(), 1.0e-06)
assert.InDeltaSlice(t, []mat.Float{
-0.071016, 0.268027, 0.345019,
}, model.Positive.(*srn.Model).B.Grad().Data(), 1.0e-06)
assert.InDeltaSlice(t, []mat.Float{
0.145713, 0.234548,
0.050135, 0.070768,
-0.06125, -0.017281,
}, model.Negative.(*srn.Model).W.Grad().Data(), 1.0e-05)
assert.InDeltaSlice(t, []mat.Float{
-0.029278, -0.112568, -0.089725,
-0.074426, 0.003116, -0.070784,
0.022664, 0.040583, 0.044139,
}, model.Negative.(*srn.Model).WRec.Grad().Data(), 1.0e-06)
assert.InDeltaSlice(t, []mat.Float{
-0.03906, 0.237598, -0.137858,
}, model.Negative.(*srn.Model).B.Grad().Data(), 1.0e-06)
} | explode_data.jsonl/67748 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1274
} | [
2830,
3393,
1712,
78440,
84368,
1606,
1155,
353,
8840,
836,
8,
341,
19727,
1669,
501,
2271,
1712,
7,
78440,
340,
3174,
1669,
933,
7121,
11212,
741,
20985,
1669,
10883,
9328,
90,
11212,
25,
342,
11,
14562,
25,
10883,
8240,
2056,
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,
1... | 1 |
func TestDatabaseAndBack(t *testing.T) {
var Field, Operator, Value, Type string
var Left, Right int
var conditionRowsReturned []conditionSqlRow
equalityStr, logicStr, _ := testingTreeRoot.toMysql()
updateDatabase(equalityStr, logicStr, "")
// Get equality sql rows
rows, _ := common.DB.Query("SELECT COALESCE(field, ''), operator, COALESCE(value, ''), type, lt, rt FROM logictree.conditions ORDER BY lt")
for rows.Next() {
rows.Scan(&Field, &Operator, &Value, &Type, &Left, &Right)
conditionRowsReturned = append(conditionRowsReturned, conditionSqlRow{Field: Field, Operator: Operator, Value: Value, Type: Type, Left: Left, Right: Right})
}
if !conditionSqlMatchesArray(conditionRowsReturned, testingMysqlRows) {
t.Errorf("updateDatabase(%v) equalityReturned - got %v, want %v", testingTreeRoot, conditionRowsReturned, testingMysqlRows)
}
treeReturned := unserializeRawTree(conditionRowsReturned)
if !treeReturned.matches(testingTreeRoot) {
t.Errorf("unserializeRaw(%v) - got %v, want %v", conditionRowsReturned, treeReturned.print(), testingTreeRoot.print())
}
} | explode_data.jsonl/62583 | {
"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,
5988,
3036,
3707,
1155,
353,
8840,
836,
8,
341,
262,
762,
8601,
11,
28498,
11,
5162,
11,
3990,
914,
198,
262,
762,
13727,
11,
10083,
526,
198,
262,
762,
2971,
9024,
84804,
3056,
9056,
8269,
3102,
271,
262,
21777,
2580,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIndexerOnCreate(t *testing.T) {
var myRowID RowID = EncodeSequence(1)
specs := map[string]struct {
srcFunc IndexerFunc
expIndexKeys []interface{}
expRowIDs []RowID
expAddFuncCalled bool
expErr error
}{
"single key": {
srcFunc: func(value interface{}) ([]interface{}, error) {
return []interface{}{uint64(1)}, nil
},
expAddFuncCalled: true,
expIndexKeys: []interface{}{uint64(1)},
expRowIDs: []RowID{myRowID},
},
"multi key": {
srcFunc: func(value interface{}) ([]interface{}, error) {
return []interface{}{uint64(1), uint64(128)}, nil
},
expAddFuncCalled: true,
expIndexKeys: []interface{}{uint64(1), uint64(128)},
expRowIDs: []RowID{myRowID, myRowID},
},
"empty key in slice": {
srcFunc: func(value interface{}) ([]interface{}, error) {
return []interface{}{[]byte{}}, nil
},
expAddFuncCalled: false,
},
"nil key in slice": {
srcFunc: func(value interface{}) ([]interface{}, error) {
return []interface{}{nil}, nil
},
expErr: fmt.Errorf("type %T not allowed as key part", nil),
expAddFuncCalled: false,
},
"empty key": {
srcFunc: func(value interface{}) ([]interface{}, error) {
return []interface{}{}, nil
},
expAddFuncCalled: false,
},
"nil key": {
srcFunc: func(value interface{}) ([]interface{}, error) {
return nil, nil
},
expAddFuncCalled: false,
},
"error case": {
srcFunc: func(value interface{}) ([]interface{}, error) {
return nil, stdErrors.New("test")
},
expErr: stdErrors.New("test"),
expAddFuncCalled: false,
},
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
mockPolicy := &addFuncRecorder{}
idx, err := NewIndexer(spec.srcFunc)
require.NoError(t, err)
idx.addFunc = mockPolicy.add
err = idx.OnCreate(nil, myRowID, nil)
if spec.expErr != nil {
require.Equal(t, spec.expErr, err)
return
}
require.NoError(t, err)
assert.Equal(t, spec.expIndexKeys, mockPolicy.secondaryIndexKeys)
assert.Equal(t, spec.expRowIDs, mockPolicy.rowIDs)
assert.Equal(t, spec.expAddFuncCalled, mockPolicy.called)
})
}
} | explode_data.jsonl/42808 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1004
} | [
2830,
3393,
1552,
261,
1925,
4021,
1155,
353,
8840,
836,
8,
341,
2405,
847,
3102,
915,
10801,
915,
284,
56562,
14076,
7,
16,
692,
98100,
82,
1669,
2415,
14032,
60,
1235,
341,
197,
41144,
9626,
688,
8008,
261,
9626,
198,
197,
48558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIntArray_SubSlice(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
a1 := []int{0, 1, 2, 3, 4, 5, 6}
array1 := garray.NewIntArrayFrom(a1)
array2 := garray.NewIntArrayFrom(a1, true)
t.Assert(array1.SubSlice(6), []int{6})
t.Assert(array1.SubSlice(5), []int{5, 6})
t.Assert(array1.SubSlice(8), nil)
t.Assert(array1.SubSlice(0, 2), []int{0, 1})
t.Assert(array1.SubSlice(2, 2), []int{2, 3})
t.Assert(array1.SubSlice(5, 8), []int{5, 6})
t.Assert(array1.SubSlice(-1, 1), []int{6})
t.Assert(array1.SubSlice(-1, 9), []int{6})
t.Assert(array1.SubSlice(-2, 3), []int{5, 6})
t.Assert(array1.SubSlice(-7, 3), []int{0, 1, 2})
t.Assert(array1.SubSlice(-8, 3), nil)
t.Assert(array1.SubSlice(-1, -3), []int{3, 4, 5})
t.Assert(array1.SubSlice(-9, 3), nil)
t.Assert(array1.SubSlice(1, -1), []int{0})
t.Assert(array1.SubSlice(1, -3), nil)
t.Assert(array2.SubSlice(0, 2), []int{0, 1})
})
} | explode_data.jsonl/47608 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 488
} | [
2830,
3393,
95338,
36359,
33236,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
11323,
16,
1669,
3056,
396,
90,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestInvokeOKMetaUpdateOnly(t *testing.T) {
mspmgr := &mocks2.MSPManager{}
idThatSatisfiesPrincipal := &mocks2.Identity{}
idThatSatisfiesPrincipal.SatisfiesPrincipalReturns(errors.New("principal not satisfied"))
idThatSatisfiesPrincipal.GetIdentifierReturns(&msp.IdentityIdentifier{})
mspmgr.DeserializeIdentityReturns(idThatSatisfiesPrincipal, nil)
t.Run("V1.2", func(t *testing.T) {
l, v, cleanup := setupLedgerAndValidatorExplicitWithMSP(t, v12Capabilities(), &builtin.DefaultValidation{}, mspmgr)
defer cleanup()
testInvokeOKMetaUpdateOnly(t, l, v)
})
t.Run("V1.3", func(t *testing.T) {
l, v, cleanup := setupLedgerAndValidatorExplicitWithMSP(t, v13Capabilities(), &builtin.DefaultValidation{}, mspmgr)
defer cleanup()
testInvokeOKMetaUpdateOnly(t, l, v)
})
} | explode_data.jsonl/47803 | {
"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,
17604,
3925,
12175,
4289,
7308,
1155,
353,
8840,
836,
8,
341,
47691,
5187,
901,
1669,
609,
16712,
82,
17,
1321,
4592,
2043,
16094,
15710,
4792,
50,
7478,
550,
31771,
1669,
609,
16712,
82,
17,
24423,
16094,
15710,
4792,
50,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGitArtifact(t *testing.T) {
a := &GitArtifact{Repo: "my-repo"}
assert.True(t, a.HasLocation())
assert.Error(t, a.SetKey("my-key"))
_, err := a.GetKey()
assert.Error(t, err)
} | explode_data.jsonl/26019 | {
"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,
46562,
85578,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
609,
46562,
85578,
90,
25243,
25,
330,
2408,
5504,
5368,
16707,
6948,
32443,
1155,
11,
264,
16152,
4707,
2398,
6948,
6141,
1155,
11,
264,
4202,
1592,
445,
2408,
16173,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIssue141(t *testing.T) {
jsonStr := `{"data": [{"q": 11, "w": 12}, {"q": 21, "w": 22}, {"q": 31, "w": 32} ], "sql": "some stuff here"}`
assert(t, Get(jsonStr, "data.#").Int() == 3)
assert(t, Get(jsonStr, "data.#.{q}|@ugly").Raw == `[{"q":11},{"q":21},{"q":31}]`)
assert(t, Get(jsonStr, "data.#.q|@ugly").Raw == `[11,21,31]`)
} | explode_data.jsonl/43474 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 160
} | [
2830,
3393,
42006,
16,
19,
16,
1155,
353,
8840,
836,
8,
341,
30847,
2580,
1669,
1565,
4913,
691,
788,
61753,
80,
788,
220,
16,
16,
11,
330,
86,
788,
220,
16,
17,
2137,
5212,
80,
788,
220,
17,
16,
11,
330,
86,
788,
220,
17,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestWSAbnormalFailureOfWebServer(t *testing.T) {
o := testWSOptions()
s := RunServer(o)
defer s.Shutdown()
logger := &captureFatalLogger{fatalCh: make(chan string, 1)}
s.SetLogger(logger, false, false)
// Now close the WS listener to cause a WebServer error
s.mu.Lock()
s.websocket.listener.Close()
s.mu.Unlock()
select {
case e := <-logger.fatalCh:
if !strings.Contains(e, "websocket listener error") {
t.Fatalf("Unexpected error: %v", e)
}
case <-time.After(2 * time.Second):
t.Fatalf("Should have reported a fatal error")
}
} | explode_data.jsonl/42713 | {
"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,
7433,
5830,
8252,
17507,
2124,
5981,
5475,
1155,
353,
8840,
836,
8,
341,
22229,
1669,
1273,
7433,
3798,
741,
1903,
1669,
6452,
5475,
10108,
340,
16867,
274,
10849,
18452,
741,
17060,
1669,
609,
45070,
62396,
7395,
90,
74394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPluginEndorserNotFound(t *testing.T) {
pluginMapper := &mocks.PluginMapper{}
pluginMapper.On("PluginFactoryByName", endorser.PluginName("notfound")).Return(nil)
pluginEndorser := endorser.NewPluginEndorser(&endorser.PluginSupport{
PluginMapper: pluginMapper,
})
endorsement, prpBytes, err := pluginEndorser.EndorseWithPlugin("notfound", "", nil, nil)
assert.Nil(t, endorsement)
assert.Nil(t, prpBytes)
assert.Contains(t, err.Error(), "plugin with name notfound wasn't found")
} | explode_data.jsonl/1347 | {
"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,
11546,
3727,
269,
799,
10372,
1155,
353,
8840,
836,
8,
341,
197,
9138,
10989,
1669,
609,
16712,
82,
64378,
10989,
16094,
197,
9138,
10989,
8071,
445,
11546,
4153,
16898,
497,
835,
269,
799,
64378,
675,
445,
1921,
15105,
1519... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestThis2(t *testing.T) {
const SCRIPT = `
var o = {
prop: 37,
f: function() {
return this.prop;
}
};
var rv = o.f();
`
testScript(SCRIPT, intToValue(37), t)
} | explode_data.jsonl/75208 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 81
} | [
2830,
3393,
1986,
17,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
947,
297,
284,
341,
220,
2004,
25,
220,
18,
22,
345,
220,
282,
25,
729,
368,
341,
262,
470,
419,
18417,
280,
220,
456,
2315,
947,
17570,
284,
297,
833,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateOutlierDetection(t *testing.T) {
cases := []struct {
name string
in networking.OutlierDetection
valid bool
}{
{name: "valid outlier detection", in: networking.OutlierDetection{
ConsecutiveErrors: 5,
Interval: &types.Duration{Seconds: 2},
BaseEjectionTime: &types.Duration{Seconds: 2},
MaxEjectionPercent: 50,
}, valid: true},
{name: "invalid outlier detection, bad consecutive errors", in: networking.OutlierDetection{
ConsecutiveErrors: -1},
valid: false},
{name: "invalid outlier detection, bad interval", in: networking.OutlierDetection{
Interval: &types.Duration{Seconds: 2, Nanos: 5}},
valid: false},
{name: "invalid outlier detection, bad base ejection time", in: networking.OutlierDetection{
BaseEjectionTime: &types.Duration{Seconds: 2, Nanos: 5}},
valid: false},
{name: "invalid outlier detection, bad max ejection percent", in: networking.OutlierDetection{
MaxEjectionPercent: 105},
valid: false},
{name: "invalid outlier detection, panic threshold too low", in: networking.OutlierDetection{
MinHealthPercent: -1,
},
valid: false},
{name: "invalid outlier detection, panic threshold too high", in: networking.OutlierDetection{
MinHealthPercent: 101,
},
valid: false},
}
for _, c := range cases {
if got := validateOutlierDetection(&c.in); (got == nil) != c.valid {
t.Errorf("ValidateOutlierDetection failed on %v: got valid=%v but wanted valid=%v: %v",
c.name, got == nil, c.valid, got)
}
}
} | explode_data.jsonl/56926 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 563
} | [
2830,
3393,
17926,
2662,
5623,
54817,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
11609,
220,
914,
198,
197,
17430,
262,
28030,
47178,
5623,
54817,
198,
197,
56322,
1807,
198,
197,
59403,
197,
197,
47006,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestCreateAssetTxSyntacticVerifyNil(t *testing.T) {
ctx := NewContext(t)
_, c := setupCodec()
tx := (*CreateAssetTx)(nil)
if err := tx.SyntacticVerify(ctx, c, ids.Empty, 0, 0, 1); err == nil {
t.Fatalf("Nil CreateAssetTx should have errored")
}
} | explode_data.jsonl/73215 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 105
} | [
2830,
3393,
4021,
16604,
31584,
34667,
406,
23170,
32627,
19064,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1532,
1972,
1155,
340,
197,
6878,
272,
1669,
6505,
36913,
2822,
46237,
1669,
4609,
4021,
16604,
31584,
2376,
8385,
692,
743,
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... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.