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 TestValidateTransactionName(t *testing.T) {
validatePayloads(t, func(tracer *apm.Tracer) {
tracer.StartTransaction(strings.Repeat("x", 1025), "type").End()
})
} | explode_data.jsonl/783 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 63
} | [
2830,
3393,
17926,
8070,
675,
1155,
353,
8840,
836,
8,
341,
197,
7067,
29683,
82,
1155,
11,
2915,
7624,
9584,
353,
391,
76,
8240,
9584,
8,
341,
197,
25583,
9584,
12101,
8070,
51442,
2817,
10979,
445,
87,
497,
220,
16,
15,
17,
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 |
func TestTerragruntBeforeAndAfterHook(t *testing.T) {
t.Parallel()
cleanupTerraformFolder(t, TEST_FIXTURE_HOOKS_BEFORE_AND_AFTER_PATH)
tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_HOOKS_BEFORE_AND_AFTER_PATH)
rootPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_HOOKS_BEFORE_AND_AFTER_PATH)
stdout := bytes.Buffer{}
stderr := bytes.Buffer{}
err := runTerragruntCommand(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath), &stdout, &stderr)
_, beforeException := ioutil.ReadFile(rootPath + "/before.out")
_, afterException := ioutil.ReadFile(rootPath + "/after.out")
output := stderr.String()
if err != nil {
t.Errorf("Did not expect to get error: %s", err.Error())
}
assert.Equal(t, 0, strings.Count(output, "BEFORE_TERRAGRUNT_READ_CONFIG"), "terragrunt-read-config before_hook should not be triggered")
t.Logf("output: %s", output)
assert.Equal(t, 1, strings.Count(output, "AFTER_TERRAGRUNT_READ_CONFIG"), "Hooks on terragrunt-read-config command executed more than once")
assert.NoError(t, beforeException)
assert.NoError(t, afterException)
} | explode_data.jsonl/10067 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 434
} | [
2830,
3393,
51402,
68305,
3850,
10227,
3036,
6025,
31679,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1444,
60639,
51,
13886,
627,
13682,
1155,
11,
13602,
42635,
41486,
82251,
50,
82218,
21767,
72339,
7944,
340,
20082,
14359,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFuncPanicRecovery(t *testing.T) {
var buf syncWriter
cron := New(WithParser(secondParser),
WithChain(Recover(newBufLogger(&buf))))
cron.Start()
defer cron.Stop()
cron.AddFunc("* * * * * ?", func() {
panic("YOLO")
})
select {
case <-time.After(OneSecond):
if !strings.Contains(buf.String(), "YOLO") {
t.Error("expected a panic to be logged, got none")
}
return
}
} | explode_data.jsonl/8292 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
9626,
47,
31270,
693,
7449,
1155,
353,
8840,
836,
8,
341,
2405,
6607,
12811,
6492,
198,
1444,
2248,
1669,
1532,
7,
2354,
6570,
45858,
6570,
1326,
197,
197,
2354,
18837,
7,
693,
3688,
1755,
15064,
7395,
2099,
5909,
22788,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetIdentities(t *testing.T) {
_, err := localMsp.GetDefaultSigningIdentity()
if err != nil {
t.Fatalf("GetDefaultSigningIdentity failed with err %s", err)
return
}
} | explode_data.jsonl/38892 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 68
} | [
2830,
3393,
1949,
764,
10499,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
2205,
83816,
2234,
3675,
93358,
18558,
741,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
1949,
3675,
93358,
18558,
4641,
448,
1848,
1018,
82,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestShould200CreateItemUseCase(t *testing.T) {
mockRequestItem := domain.Item{
Nome: "Tarefa 1",
Descricao: "Descrição da tarefa 1",
Data: "2020-02-02",
Sigla: "vin",
}
mockResponseItem := domain.Item{
ID: 1,
Nome: "Tarefa 1",
Descricao: "Descrição da tarefa 1",
Data: "2020-02-02 00:00:00",
Sigla: "vin",
}
j, err := json.Marshal(mockRequestItem)
assert.NoError(t, err)
req := httptest.NewRequest("POST", "/item", strings.NewReader(string(j)))
res := httptest.NewRecorder()
repository := new(mocks.ItemRepository)
repository.On("Create", mock.Anything).Return(&mockResponseItem, nil)
usecase := usecase.ItemUseCaseImpl(repository)
usecase.Create(res, req)
result := res.Result()
_, err = ioutil.ReadAll(result.Body)
if err != nil {
t.Fatal(err)
}
result.Body.Close()
if http.StatusOK != result.StatusCode {
t.Error("expected", http.StatusOK, "got", result.StatusCode)
}
} | explode_data.jsonl/34609 | {
"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,
14996,
17,
15,
15,
4021,
1234,
10253,
4207,
1155,
353,
8840,
836,
8,
341,
77333,
1900,
1234,
1669,
7947,
9399,
515,
197,
18317,
635,
25,
414,
330,
51,
75251,
220,
16,
756,
197,
10957,
3300,
27673,
25,
330,
62664,
5903,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestOCMProvider_GetClusterDNS(t *testing.T) {
type fields struct {
ocmClient ocm.Client
}
type args struct {
clusterSpec *types.ClusterSpec
}
internalId := "test-internal-id"
spec := &types.ClusterSpec{
InternalID: internalId,
ExternalID: "",
Status: "",
AdditionalInfo: nil,
}
dns := "test.foo.bar.com"
tests := []struct {
name string
fields fields
args args
want string
wantErr bool
}{
{
name: "should return dns value from OCM",
fields: fields{
ocmClient: &ocm.ClientMock{
GetClusterDNSFunc: func(clusterID string) (string, error) {
return dns, nil
},
},
},
args: args{
clusterSpec: spec,
},
want: dns,
wantErr: false,
},
{
name: "should return error",
fields: fields{
ocmClient: &ocm.ClientMock{
GetClusterDNSFunc: func(clusterID string) (string, error) {
return "", errors.Errorf("failed to get dns value from OCM")
},
},
},
args: args{
clusterSpec: spec,
},
want: "",
wantErr: true,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
RegisterTestingT(t)
p := newOCMProvider(test.fields.ocmClient, nil, &ocm.OCMConfig{})
resp, err := p.GetClusterDNS(test.args.clusterSpec)
Expect(resp).To(Equal(test.want))
if test.wantErr {
Expect(err).NotTo(BeNil())
}
})
}
} | explode_data.jsonl/4833 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 662
} | [
2830,
3393,
7612,
44,
5179,
13614,
28678,
61088,
1155,
353,
8840,
836,
8,
341,
13158,
5043,
2036,
341,
197,
197,
509,
76,
2959,
297,
6226,
11716,
198,
197,
532,
13158,
2827,
2036,
341,
197,
197,
18855,
8327,
353,
9242,
72883,
8327,
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 TestPutAfterSessionCacheEvict(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
vnet := getVirtualNetwork()
ig := testinstance.NewTestInstanceGenerator(vnet, nil, nil)
defer ig.Close()
bgen := blocksutil.NewBlockGenerator()
blks := bgen.Blocks(2500)
inst := ig.Instances(1)
a := inst[0]
ses := a.Exchange.NewSession(ctx)
var allcids []cid.Cid
for _, blk := range blks[1:] {
allcids = append(allcids, blk.Cid())
}
blkch, err := ses.GetBlocks(ctx, allcids)
if err != nil {
t.Fatal(err)
}
// wait to ensure that all the above cids were added to the sessions cache
time.Sleep(time.Millisecond * 50)
if err := a.Exchange.HasBlock(blks[17]); err != nil {
t.Fatal(err)
}
select {
case <-blkch:
case <-time.After(time.Millisecond * 50):
t.Fatal("timed out waiting for block")
}
} | explode_data.jsonl/2227 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 337
} | [
2830,
3393,
19103,
6025,
5283,
8233,
34112,
849,
1155,
353,
8840,
836,
8,
341,
20985,
11,
9121,
1669,
2266,
26124,
9269,
5378,
19047,
2398,
16867,
9121,
2822,
5195,
4711,
1669,
633,
33026,
12320,
741,
197,
343,
1669,
1273,
4851,
7121,
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... | 6 |
func TestCanonical(t *testing.T) {
constants := []string{
Accept,
AcceptCharset,
AcceptEncoding,
AcceptLanguage,
AcceptRanges,
Age,
Allow,
Authorization,
CacheControl,
Connection,
ContentDisposition,
ContentEncoding,
ContentLength,
ContentRange,
ContentType,
ETag,
Expect,
Expires,
IfMatch,
IfModifiedSince,
IfNoneMatch,
IfRange,
IfUnmodifiedSince,
KeepAlive,
LastModified,
Location,
Range,
RetryAfter,
TransferEncoding,
Vary,
WWWAuthenticate,
XContentTypeOptions,
XForwardedFor,
XForwardedHost,
XForwardedProto,
}
for _, c := range constants {
if want := http.CanonicalHeaderKey(c); want != c {
t.Errorf("Canonical form of %q is %q", c, want)
}
}
} | explode_data.jsonl/73175 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 318
} | [
2830,
3393,
70914,
1155,
353,
8840,
836,
8,
341,
4777,
1783,
1669,
3056,
917,
515,
197,
197,
16646,
345,
197,
197,
16646,
78172,
345,
197,
197,
16646,
14690,
345,
197,
197,
16646,
13806,
345,
197,
197,
16646,
74902,
345,
197,
197,
167... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateSignParams(t *testing.T) {
tests := map[string]struct {
args []string
params signCmdParams
wantErr bool
err error
}{
"no_args": {
[]string{},
newSignCmdParams(),
true, fmt.Errorf("specify atleast one path containing policy and/or data files"),
},
"no_signing_key": {
[]string{"foo"},
newSignCmdParams(),
true, fmt.Errorf("specify the secret (HMAC) or path of the PEM file containing the private key (RSA and ECDSA)"),
},
"non_bundle_mode": {
[]string{"foo"},
signCmdParams{key: "foo"},
true, fmt.Errorf("enable bundle mode (ie. --bundle) to sign bundle files or directories"),
},
"no_error": {
[]string{"foo"},
signCmdParams{key: "foo", bundleMode: true},
false, nil,
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
err := validateSignParams(tc.args, tc.params)
if tc.wantErr {
if err == nil {
t.Fatal("Expected error but got nil")
}
if tc.err != nil && tc.err.Error() != err.Error() {
t.Fatalf("Expected error message %v but got %v", tc.err.Error(), err.Error())
}
} else {
if err != nil {
t.Fatalf("Unexpected error %v", err)
}
}
})
}
} | explode_data.jsonl/46765 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 522
} | [
2830,
3393,
17926,
7264,
4870,
1155,
353,
8840,
836,
8,
1476,
78216,
1669,
2415,
14032,
60,
1235,
341,
197,
31215,
262,
3056,
917,
198,
197,
25856,
220,
1841,
15613,
4870,
198,
197,
50780,
7747,
1807,
198,
197,
9859,
257,
1465,
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... | 6 |
func TestCommentFetcher(t *testing.T) {
instOptions, err := testutil.GetOptions()
if err != nil {
t.Errorf("Environment Error: %v", err)
}
inst, err := aetest.NewInstance(&instOptions)
if err != nil {
t.Fatalf("Failed to create instance: %v", err)
}
defer inst.Close()
req, err := inst.NewRequest("GET", "/", nil)
ctx := appengine.NewContext(req)
fetcher := CommentFetcher{
Opts: Options{
Tables: []string{"ghissues.test_bed"},
Conditions: []string{
bq.In("type", "IssueCommentEvent"),
bq.In("repo_name", "GoogleCloudPlatform/google-cloud-node"),
bq.In(bq.JExtract("payload", "action"), "created"),
},
Limit: 1,
},
}
got, err := fetcher.Fetch(ctx)
if err != nil {
t.Errorf("CommentFetcher() failed with error: %v", err)
}
want := int64(319215574)
if got[0].ID != want {
t.Errorf(`CommentFetcher() gave invalid result.Expected Comment With ID: 319215574\n
Got: %v`, got)
}
} | explode_data.jsonl/31107 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 387
} | [
2830,
3393,
10677,
97492,
1155,
353,
8840,
836,
8,
1476,
88656,
3798,
11,
1848,
1669,
1273,
1314,
2234,
3798,
741,
743,
1848,
961,
2092,
341,
197,
3244,
13080,
445,
12723,
4600,
25,
1018,
85,
497,
1848,
340,
197,
630,
88656,
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... | 5 |
func TestNewRGBFromHEX(t *testing.T) {
tests := []struct {
hex string
want RGB
}{
{hex: "#ff0009", want: RGB{R: 255, G: 0, B: 9}},
{hex: "ff0009", want: RGB{R: 255, G: 0, B: 9}},
{hex: "ff00090x", want: RGB{R: 255, G: 0, B: 9}},
{hex: "ff00090X", want: RGB{R: 255, G: 0, B: 9}},
{hex: "#fba", want: RGB{R: 255, G: 187, B: 170}},
{hex: "fba", want: RGB{R: 255, G: 187, B: 170}},
{hex: "fba0x", want: RGB{R: 255, G: 187, B: 170}},
}
for _, test := range tests {
t.Run("", func(t *testing.T) {
rgb, err := NewRGBFromHEX(test.hex)
assert.Equal(t, test.want, rgb)
assert.NoError(t, err)
})
}
testsFail := []struct {
hex string
want error
}{
{hex: "faba0x", want: ErrHexCodeIsInvalid},
{hex: "faba", want: ErrHexCodeIsInvalid},
{hex: "#faba", want: ErrHexCodeIsInvalid},
{hex: "faba0x", want: ErrHexCodeIsInvalid},
{hex: "#fax", want: assert.AnError},
}
for _, test := range testsFail {
t.Run("", func(t *testing.T) {
_, err := NewRGBFromHEX(test.hex)
assert.Error(t, test.want, err)
})
}
} | explode_data.jsonl/62944 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 511
} | [
2830,
3393,
3564,
18184,
3830,
1799,
55,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
9598,
327,
220,
914,
198,
197,
50780,
20978,
198,
197,
59403,
197,
197,
90,
17308,
25,
5869,
542,
15,
15,
15,
24,
497,
1366,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStoreGateway_RingLifecyclerShouldAutoForgetUnhealthyInstances(t *testing.T) {
const unhealthyInstanceID = "unhealthy-id"
const heartbeatTimeout = time.Minute
ctx := context.Background()
gatewayCfg := mockGatewayConfig()
gatewayCfg.ShardingEnabled = true
gatewayCfg.ShardingRing.HeartbeatPeriod = 100 * time.Millisecond
gatewayCfg.ShardingRing.HeartbeatTimeout = heartbeatTimeout
storageCfg := mockStorageConfig(t)
ringStore := consul.NewInMemoryClient(ring.GetCodec())
bucketClient := &bucket.ClientMock{}
bucketClient.MockIter("", []string{}, nil)
g, err := newStoreGateway(gatewayCfg, storageCfg, bucketClient, ringStore, defaultLimitsOverrides(t), mockLoggingLevel(), log.NewNopLogger(), nil)
require.NoError(t, err)
require.NoError(t, services.StartAndAwaitRunning(ctx, g))
defer services.StopAndAwaitTerminated(ctx, g) //nolint:errcheck
// Add an unhealthy instance to the ring.
require.NoError(t, ringStore.CAS(ctx, RingKey, func(in interface{}) (interface{}, bool, error) {
ringDesc := ring.GetOrCreateRingDesc(in)
instance := ringDesc.AddIngester(unhealthyInstanceID, "1.1.1.1", "", generateSortedTokens(RingNumTokens), ring.ACTIVE, time.Now())
instance.Timestamp = time.Now().Add(-(ringAutoForgetUnhealthyPeriods + 1) * heartbeatTimeout).Unix()
ringDesc.Ingesters[unhealthyInstanceID] = instance
return ringDesc, true, nil
}))
// Ensure the unhealthy instance is removed from the ring.
test.Poll(t, time.Second, false, func() interface{} {
d, err := ringStore.Get(ctx, RingKey)
if err != nil {
return err
}
_, ok := ring.GetOrCreateRingDesc(d).Ingesters[unhealthyInstanceID]
return ok
})
} | explode_data.jsonl/57963 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 566
} | [
2830,
3393,
6093,
40709,
2568,
287,
43,
333,
757,
10760,
14996,
13253,
87283,
1806,
37028,
42725,
1155,
353,
8840,
836,
8,
341,
4777,
52708,
2523,
915,
284,
330,
359,
37028,
12897,
698,
4777,
52105,
7636,
284,
882,
75770,
271,
20985,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDeletionOfOneIngressAnnotation(t *testing.T) {
iCmd := RecreateCommand("ingress",
"-n",
"test-1",
"-a",
"--remove-annotations",
"anno1")
mustExecute(t, iCmd)
ingressesAfter := mustLsIngress(t, "test-1")
for _, ingress := range ingressesAfter {
for annotation := range ingress.ObjectMeta.Annotations {
assert.NotEqual(t, "anno1", annotation)
}
}
} | explode_data.jsonl/68720 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 156
} | [
2830,
3393,
1912,
52625,
2124,
3966,
641,
2483,
19711,
1155,
353,
8840,
836,
8,
341,
8230,
15613,
1669,
4067,
964,
4062,
445,
287,
673,
756,
197,
197,
34294,
77,
756,
197,
197,
1,
1944,
12,
16,
756,
197,
197,
34294,
64,
756,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestParseVolumeWithBindOptionsWindows(t *testing.T) {
volume, err := parseVolume("C:\\source\\foo:D:\\target:ro,rprivate")
expected := types.ServiceVolumeConfig{
Type: "bind",
Source: "C:\\source\\foo",
Target: "D:\\target",
ReadOnly: true,
Bind: &types.ServiceVolumeBind{Propagation: "rprivate"},
}
assert.NoError(t, err)
assert.Equal(t, expected, volume)
} | explode_data.jsonl/70100 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 154
} | [
2830,
3393,
14463,
18902,
2354,
9950,
3798,
13164,
1155,
353,
8840,
836,
8,
341,
5195,
4661,
11,
1848,
1669,
4715,
18902,
445,
34,
23817,
2427,
3422,
7975,
63843,
23817,
5657,
25,
299,
15883,
1996,
1138,
42400,
1669,
4494,
13860,
18902,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBlockingCallback(t *testing.T) {
c := make(chan int)
go func() {
for i := 0; i < 10; i++ {
c <- <-c
}
}()
nestedCall(t, func() {
for i := 0; i < 10; i++ {
c <- i
if j := <-c; j != i {
t.Errorf("out of sync %d != %d", j, i)
}
}
})
} | explode_data.jsonl/54663 | {
"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,
48266,
7494,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
1281,
35190,
526,
340,
30680,
2915,
368,
341,
197,
2023,
600,
1669,
220,
15,
26,
600,
366,
220,
16,
15,
26,
600,
1027,
341,
298,
1444,
9119,
9119,
66,
198,
197,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestMatchURL(t *testing.T) {
rules := []string{
"||ads.example.com^",
}
matcher := NewMatcher()
matcher.AddSrules(rules)
if ok, _, _ := matcher.MatchURL("http://ads.example.com/foo.gif"); !ok {
t.Fatal()
}
} | explode_data.jsonl/81624 | {
"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,
8331,
3144,
1155,
353,
8840,
836,
8,
341,
7000,
2425,
1669,
3056,
917,
515,
197,
197,
1,
8484,
7664,
7724,
905,
61,
756,
197,
532,
2109,
28058,
1669,
1532,
37554,
741,
2109,
28058,
1904,
50,
21977,
90094,
692,
743,
5394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPodUpdateActiveDeadlineSeconds(t *testing.T) {
_, s, closeFn := framework.RunAnAPIServer(nil)
defer closeFn()
ns := framework.CreateTestingNamespace("pod-activedeadline-update", t)
defer framework.DeleteTestingNamespace(ns, t)
client := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
var (
iZero = int64(0)
i30 = int64(30)
i60 = int64(60)
iNeg = int64(-1)
)
prototypePod := func() *v1.Pod {
return &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "xxx",
},
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Name: "fake-name",
Image: "fakeimage",
},
},
},
}
}
cases := []struct {
name string
original *int64
update *int64
valid bool
}{
{
name: "no change, nil",
original: nil,
update: nil,
valid: true,
},
{
name: "no change, set",
original: &i30,
update: &i30,
valid: true,
},
{
name: "change to positive from nil",
original: nil,
update: &i60,
valid: true,
},
{
name: "change to smaller positive",
original: &i60,
update: &i30,
valid: true,
},
{
name: "change to larger positive",
original: &i30,
update: &i60,
valid: false,
},
{
name: "change to negative from positive",
original: &i30,
update: &iNeg,
valid: false,
},
{
name: "change to negative from nil",
original: nil,
update: &iNeg,
valid: false,
},
// zero is not allowed, must be a positive integer
{
name: "change to zero from positive",
original: &i30,
update: &iZero,
valid: false,
},
{
name: "change to nil from positive",
original: &i30,
update: nil,
valid: false,
},
}
for i, tc := range cases {
pod := prototypePod()
pod.Spec.ActiveDeadlineSeconds = tc.original
pod.ObjectMeta.Name = fmt.Sprintf("activedeadlineseconds-test-%v", i)
if _, err := client.CoreV1().Pods(ns.Name).Create(context.TODO(), pod, metav1.CreateOptions{}); err != nil {
t.Errorf("Failed to create pod: %v", err)
}
pod.Spec.ActiveDeadlineSeconds = tc.update
_, err := client.CoreV1().Pods(ns.Name).Update(context.TODO(), pod, metav1.UpdateOptions{})
if tc.valid && err != nil {
t.Errorf("%v: failed to update pod: %v", tc.name, err)
} else if !tc.valid && err == nil {
t.Errorf("%v: unexpected allowed update to pod", tc.name)
}
integration.DeletePodOrErrorf(t, client, ns.Name, pod.Name)
}
} | explode_data.jsonl/73841 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1191
} | [
2830,
3393,
23527,
4289,
5728,
83593,
15343,
1155,
353,
8840,
836,
8,
341,
197,
6878,
274,
11,
3265,
24911,
1669,
12626,
16708,
2082,
2537,
1637,
2836,
27907,
340,
16867,
3265,
24911,
2822,
84041,
1669,
12626,
7251,
16451,
22699,
445,
390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestProtocolSelection(t *testing.T) {
p := NewProxy("bad_address", transport.DNS)
stateUDP := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)}
stateTCP := request.Request{W: &test.ResponseWriter{TCP: true}, Req: new(dns.Msg)}
ctx := context.TODO()
go func() {
p.Connect(ctx, stateUDP, options{})
p.Connect(ctx, stateUDP, options{forceTCP: true})
p.Connect(ctx, stateUDP, options{preferUDP: true})
p.Connect(ctx, stateUDP, options{preferUDP: true, forceTCP: true})
p.Connect(ctx, stateTCP, options{})
p.Connect(ctx, stateTCP, options{forceTCP: true})
p.Connect(ctx, stateTCP, options{preferUDP: true})
p.Connect(ctx, stateTCP, options{preferUDP: true, forceTCP: true})
}()
for i, exp := range []string{"udp", "tcp", "udp", "tcp", "tcp", "tcp", "udp", "tcp"} {
proto := <-p.transport.dial
p.transport.ret <- nil
if proto != exp {
t.Errorf("Unexpected protocol in case %d, expected %q, actual %q", i, exp, proto)
}
}
} | explode_data.jsonl/46576 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 401
} | [
2830,
3393,
20689,
11177,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
1532,
16219,
445,
13855,
6744,
497,
7557,
909,
2448,
692,
24291,
41648,
1669,
1681,
9659,
90,
54,
25,
609,
1944,
37508,
22655,
82458,
25,
501,
1500,
4412,
30365,
10569,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPostValidate(t *testing.T) {
t.Parallel()
setupMore := func(h *testHarness) *mocks.User {
user := &mocks.User{Email: "test@test.com"}
h.storer.Users[user.Email] = user
h.setSession(authboss.SessionKey, user.Email)
h.session.ClientValues[authboss.SessionKey] = user.Email
return user
}
t.Run("NoTOTPActivated", func(t *testing.T) {
h := testSetup()
r, w, _ := h.newHTTP("POST")
setupMore(h)
h.loadClientState(w, &r)
// No session
if err := h.totp.PostValidate(w, r); err != nil {
t.Fatal(err)
}
if h.responder.Page != PageTOTPValidate {
t.Error("page wrong:", h.responder.Page)
}
if got := h.responder.Data[authboss.DataErr]; got != "totp 2fa not active" {
t.Error("data wrong:", got)
}
})
t.Run("WrongCode", func(t *testing.T) {
h := testSetup()
r, w, _ := h.newHTTP("POST")
h.loadClientState(w, &r)
user := setupMore(h)
secret := makeSecretKey(h, user.Email)
user.TOTPSecretKey = secret
h.bodyReader.Return = mocks.Values{Code: "wrong"}
if err := h.totp.PostValidate(w, r); err != nil {
t.Error(err)
}
if h.responder.Page != PageTOTPValidate {
t.Error("page wrong:", h.responder.Page)
}
if got := h.responder.Data[authboss.DataValidation].(map[string][]string); got[FormValueCode][0] != "2fa code was invalid" {
t.Error("data wrong:", got)
}
})
t.Run("OkRecovery", func(t *testing.T) {
h := testSetup()
r, w, _ := h.newHTTP("POST")
user := setupMore(h)
secret := makeSecretKey(h, user.Email)
user.TOTPSecretKey = secret
// Create a single recovery code
codes, err := twofactor.GenerateRecoveryCodes()
if err != nil {
t.Fatal(err)
}
b, err := bcrypt.GenerateFromPassword([]byte(codes[0]), bcrypt.DefaultCost)
if err != nil {
t.Fatal(err)
}
user.RecoveryCodes = string(b)
// User inputs the only code he has
h.bodyReader.Return = mocks.Values{Recovery: codes[0]}
h.setSession(SessionTOTPPendingPID, user.Email)
h.setSession(SessionTOTPSecret, "secret")
h.setSession(authboss.SessionHalfAuthKey, "true")
h.loadClientState(w, &r)
if err := h.totp.PostValidate(w, r); err != nil {
t.Error(err)
}
// Flush client state
w.WriteHeader(http.StatusOK)
if pid := h.session.ClientValues[authboss.SessionKey]; pid != user.Email {
t.Error("session pid should be set:", pid)
}
if twofa := h.session.ClientValues[authboss.Session2FA]; twofa != "totp" {
t.Error("session 2fa should be totp:", twofa)
}
cleared := []string{SessionTOTPSecret, SessionTOTPPendingPID, authboss.SessionHalfAuthKey}
for _, c := range cleared {
if _, ok := h.session.ClientValues[c]; ok {
t.Error(c, "was not cleared")
}
}
opts := h.redirector.Options
if opts.Code != http.StatusTemporaryRedirect {
t.Error("status wrong:", opts.Code)
}
if !opts.FollowRedirParam {
t.Error("it should follow redirects")
}
if opts.RedirectPath != h.ab.Paths.AuthLoginOK {
t.Error("path wrong:", opts.RedirectPath)
}
})
} | explode_data.jsonl/63404 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1266
} | [
2830,
3393,
4133,
17926,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
84571,
7661,
1669,
2915,
3203,
353,
1944,
74248,
8,
353,
16712,
82,
7344,
341,
197,
19060,
1669,
609,
16712,
82,
7344,
90,
4781,
25,
330,
1944,
47327,
905... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAddCustomerRewardPoints(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, "someclient", r.URL.Query().Get("clientCode"))
assert.Equal(t, "somesess", r.URL.Query().Get("sessionKey"))
assert.Equal(t, "addCustomerRewardPoints", r.URL.Query().Get("request"))
assert.Equal(t, "1232131", r.URL.Query().Get("customerID"))
assert.Equal(t, "34456", r.URL.Query().Get("invoiceID"))
assert.Equal(t, "11", r.URL.Query().Get("points"))
resp := AddCustomerRewardPointsResponse{
Status: sharedCommon.Status{ResponseStatus: "ok"},
AddCustomerRewardPointsResults: []AddCustomerRewardPointsResult{{TransactionID: 999, CustomerID: 22}},
}
jsonRaw, err := json.Marshal(resp)
assert.NoError(t, err)
_, err = w.Write(jsonRaw)
assert.NoError(t, err)
}))
defer srv.Close()
inpt := map[string]string{
"customerID": "1232131",
"invoiceID": "34456",
"points": "11",
}
cli := common.NewClient("somesess", "someclient", "", nil, nil)
cli.Url = srv.URL
cl := NewClient(cli)
resp, err := cl.AddCustomerRewardPoints(context.Background(), inpt)
assert.NoError(t, err)
if err != nil {
return
}
assert.Equal(t, int64(999), resp.TransactionID)
assert.Equal(t, int64(22), resp.CustomerID)
} | explode_data.jsonl/66217 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 530
} | [
2830,
3393,
2212,
12792,
59622,
11411,
1155,
353,
8840,
836,
8,
341,
1903,
10553,
1669,
54320,
70334,
7121,
5475,
19886,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
6948,
12808,
1155,
11,
330,
14689,
2972,
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 TestLintNamesUnderscore(t *testing.T) {
var testcases = []struct {
problem lint.Problem
expectedSuggestion string
}{
{
problem: lint.Problem{
Position: token.Position{
Filename: "qux.go",
},
Text: "don't use underscores in Go names; func Qux_1 should be Qux1",
Link: "http://golang.org/doc/effective_go.html#mixed-caps",
Category: "naming",
LineText: "func Qux_1() error {",
Confidence: 100.00,
},
expectedSuggestion: "```suggestion\nfunc Qux1() error {```\n",
},
{
problem: lint.Problem{
Position: token.Position{
Filename: "qux.go",
},
Text: "don't use underscores in Go names; func Qux_Foo_Func should be QuxFooFunc",
Link: "http://golang.org/doc/effective_go.html#mixed-caps",
Category: "naming",
LineText: "func Qux_Foo_Func() error {",
Confidence: 100.00,
},
expectedSuggestion: "```suggestion\nfunc QuxFooFunc() error {```\n",
},
{
problem: lint.Problem{
Position: token.Position{
Filename: "qux.go",
},
Text: "don't use underscores in Go names; func Qux_Foo_Func should be QuxFooFunc",
Link: "http://golang.org/doc/effective_go.html#mixed-caps",
Category: "naming",
LineText: "func QuxCorrectFunc() error {",
Confidence: 100.00,
},
expectedSuggestion: "",
},
}
for _, test := range testcases {
suggestion := SuggestCodeChange(test.problem)
if suggestion != test.expectedSuggestion {
t.Errorf("Excepted code suggestion %s but got %s for LineText %s", test.expectedSuggestion, suggestion, test.problem.LineText)
}
}
} | explode_data.jsonl/3105 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 733
} | [
2830,
3393,
47556,
7980,
19957,
388,
2153,
1155,
353,
8840,
836,
8,
341,
2405,
1273,
23910,
284,
3056,
1235,
341,
197,
197,
34586,
310,
57920,
7763,
10121,
198,
197,
42400,
50,
42116,
914,
198,
197,
59403,
197,
197,
515,
298,
197,
345... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestChunks(t *testing.T) {
ctx := createSweeperTestContext(t)
// Sweep five inputs.
for _, input := range spendableInputs[:5] {
_, err := ctx.sweeper.SweepInput(input, defaultFeePref)
if err != nil {
t.Fatal(err)
}
}
ctx.tick()
// We expect two txes to be published because of the max input count of
// three.
sweepTx1 := ctx.receiveTx()
if len(sweepTx1.TxIn) != 3 {
t.Fatalf("Expected first tx to sweep 3 inputs, but contains %v "+
"inputs instead", len(sweepTx1.TxIn))
}
sweepTx2 := ctx.receiveTx()
if len(sweepTx2.TxIn) != 2 {
t.Fatalf("Expected first tx to sweep 2 inputs, but contains %v "+
"inputs instead", len(sweepTx1.TxIn))
}
ctx.backend.mine()
ctx.finish(1)
} | explode_data.jsonl/34223 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 295
} | [
2830,
3393,
89681,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1855,
50,
896,
10436,
2271,
1972,
1155,
692,
197,
322,
85022,
4236,
11127,
624,
2023,
8358,
1946,
1669,
2088,
8329,
480,
31946,
3447,
20,
60,
341,
197,
197,
6878,
1848,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestStatsTimestampTime(t *testing.T) {
for _, test := range []struct {
Timestamp StatsTimestamp
WantTime time.Time
}{
{
Timestamp: 0,
WantTime: time.Unix(0, 0),
},
{
Timestamp: 1,
WantTime: time.Unix(0, 1e6),
},
{
Timestamp: 0.001,
WantTime: time.Unix(0, 1e3),
},
} {
if got, want := test.Timestamp.Time(), test.WantTime.UTC(); got != want {
t.Fatalf("StatsTimestamp(%v).Time() = %v, want %v", test.Timestamp, got, want)
}
}
} | explode_data.jsonl/37902 | {
"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,
16635,
20812,
1462,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
10261,
4702,
29927,
20812,
198,
197,
17300,
517,
1462,
220,
882,
16299,
198,
197,
59403,
197,
197,
515,
298,
10261,
4702,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewNonNils(t *testing.T) {
t.Parallel()
// arrange
ti, l, d := "title", "link", "description"
// act
p := podcast.New(ti, l, d, &createdDate, &updatedDate)
// assert
assert.EqualValues(t, ti, p.Title)
assert.EqualValues(t, l, p.Link)
assert.EqualValues(t, d, p.Description)
assert.True(t, createdDate.Format(time.RFC1123Z) >= p.PubDate)
assert.True(t, updatedDate.Format(time.RFC1123Z) >= p.LastBuildDate)
} | explode_data.jsonl/73065 | {
"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,
3564,
8121,
45,
8669,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
322,
30893,
198,
72859,
11,
326,
11,
294,
1669,
330,
2102,
497,
330,
2080,
497,
330,
4684,
1837,
197,
322,
1160,
198,
3223,
1669,
17711,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestWildcardMatch(t *testing.T) {
t.Parallel()
assert.False(t, logtail.WildcardMatch("!!!!", nil))
assert.True(t, logtail.WildcardMatch("", nil))
assert.True(t, logtail.WildcardMatch("", []byte("abcd")))
assert.False(t, logtail.WildcardMatch("!!!!", []byte("a")))
assert.False(t, logtail.WildcardMatch("!!!!", []byte("abcd")))
assert.False(t, logtail.WildcardMatch("!!!!", []byte("123a")))
assert.True(t, logtail.WildcardMatch("!!!!", []byte("1234")))
assert.True(t, logtail.WildcardMatch("!!!!", []byte("1234abcd")))
assert.True(t, logtail.WildcardMatch("!!!!-!!-!!", []byte("2021-01-01")))
assert.False(t, logtail.WildcardMatch("!!!!-!!-!!", []byte("2021001001")))
assert.False(t, logtail.WildcardMatch("~~~~", []byte("1234abcd")))
assert.True(t, logtail.WildcardMatch("~~~~", []byte("abcd")))
assert.True(t, logtail.WildcardMatch("~~~~", []byte("abcd1234")))
assert.True(t, logtail.WildcardMatch("????", []byte("1234")))
assert.True(t, logtail.WildcardMatch("????", []byte("abcd")))
} | explode_data.jsonl/70500 | {
"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,
92988,
8331,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
6948,
50757,
1155,
11,
1487,
14586,
1175,
695,
4951,
8331,
445,
17085,
497,
2092,
1171,
6948,
32443,
1155,
11,
1487,
14586,
1175,
695,
4951,
8331,
19814,
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 TestIssue28867(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
orgEnable := core.PreparedPlanCacheEnabled()
defer core.SetPreparedPlanCache(orgEnable)
core.SetPreparedPlanCache(true)
se, err := session.CreateSession4TestWithOpt(store, &session.Opt{
PreparedPlanCache: kvcache.NewSimpleLRUCache(100, 0.1, math.MaxUint64),
})
require.NoError(t, err)
tk := testkit.NewTestKitWithSession(t, store, se)
tk.MustExec("use test")
tk.MustExec("drop table if exists t1, t2")
tk.MustExec(`CREATE TABLE t1 (c_int int, c_str varchar(40), PRIMARY KEY (c_int, c_str))`)
tk.MustExec(`CREATE TABLE t2 (c_str varchar(40), PRIMARY KEY (c_str))`)
tk.MustExec(`insert into t1 values (1, '1')`)
tk.MustExec(`insert into t2 values ('1')`)
tk.MustExec(`prepare stmt from 'select /*+ INL_JOIN(t1,t2) */ * from t1 join t2 on t1.c_str <= t2.c_str where t1.c_int in (?,?)'`)
tk.MustExec(`set @a=10, @b=20`)
tk.MustQuery(`execute stmt using @a, @b`).Check(testkit.Rows())
tk.MustExec(`set @a=1, @b=2`)
tk.MustQuery(`execute stmt using @a, @b`).Check(testkit.Rows("1 1 1"))
// test case for IndexJoin + PlanCache
tk.MustExec(`drop table t1, t2`)
tk.MustExec(`create table t1 (a int, b int, c int, index idxab(a, b, c))`)
tk.MustExec(`create table t2 (a int, b int)`)
tk.MustExec(`prepare stmt from 'select /*+ INL_JOIN(t1,t2) */ * from t1, t2 where t1.a=t2.a and t1.b=?'`)
tk.MustExec(`set @a=1`)
tk.MustExec(`execute stmt using @a`)
tk.MustExec(`execute stmt using @a`)
tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1"))
tk.MustExec(`prepare stmt from 'select /*+ INL_JOIN(t1,t2) */ * from t1, t2 where t1.a=t2.a and t1.c=?'`)
tk.MustExec(`set @a=1`)
tk.MustExec(`execute stmt using @a`)
tk.MustExec(`execute stmt using @a`)
tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1"))
} | explode_data.jsonl/5519 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 812
} | [
2830,
3393,
42006,
17,
23,
23,
21,
22,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
1155,
340,
16867,
4240,
741,
87625,
11084,
1669,
6200,
28770,
7212,
20485,
8233,
5462,
741,
16867,
6200,
4202,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWriterErrors(t *testing.T) {
errorTests := []struct {
svg string
n []int
}{
{`<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "foo.dtd" [ <!ENTITY x "bar"> ]>`, []int{0}},
{`abc`, []int{0}},
{`<style>abc</style>`, []int{2}},
{`<![CDATA[ <<<< ]]>`, []int{0}},
{`<![CDATA[ <<<<< ]]>`, []int{0}},
{`<path d="x"/>`, []int{0, 1, 2, 3, 4, 5}},
{`<path></path>`, []int{1}},
{`<svg>x</svg>`, []int{1, 3}},
{`<svg>x</svg >`, []int{3}},
}
m := minify.New()
for _, tt := range errorTests {
for _, n := range tt.n {
t.Run(fmt.Sprint(tt.svg, " ", tt.n), func(t *testing.T) {
r := bytes.NewBufferString(tt.svg)
w := test.NewErrorWriter(n)
err := Minify(m, w, r, nil)
test.T(t, err, test.ErrPlain)
})
}
}
} | explode_data.jsonl/7358 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 419
} | [
2830,
3393,
6492,
13877,
1155,
353,
8840,
836,
8,
341,
18290,
18200,
1669,
3056,
1235,
341,
197,
1903,
7239,
914,
198,
197,
9038,
256,
3056,
396,
198,
197,
59403,
197,
197,
90,
63,
13543,
15458,
26852,
31416,
66896,
54,
18,
34,
322,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIncreaseLevelTryDecrease(t *testing.T) {
errorOut := &bytes.Buffer{}
opts := []Option{
ErrorOutput(zapcore.AddSync(errorOut)),
}
withLogger(t, WarnLevel, opts, func(logger *Logger, logs *observer.ObservedLogs) {
logger.Warn("original warn log")
debugLogger := logger.WithOptions(IncreaseLevel(DebugLevel))
debugLogger.Debug("ignored debug log")
debugLogger.Warn("increase level warn log")
debugLogger.Error("increase level error log")
assert.Equal(t, []observer.LoggedEntry{
newLoggedEntry(WarnLevel, "original warn log"),
newLoggedEntry(WarnLevel, "increase level warn log"),
newLoggedEntry(ErrorLevel, "increase level error log"),
}, logs.AllUntimed(), "unexpected logs")
assert.Equal(t,
"failed to IncreaseLevel: invalid increase level, as level \"info\" is allowed by increased level, but not by existing core\n",
errorOut.String(),
"unexpected error output",
)
})
} | explode_data.jsonl/13568 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 324
} | [
2830,
3393,
69556,
4449,
21453,
94843,
519,
1155,
353,
8840,
836,
8,
341,
18290,
2662,
1669,
609,
9651,
22622,
16094,
64734,
1669,
3056,
5341,
515,
197,
58421,
5097,
13174,
391,
2153,
1904,
12154,
6390,
2662,
6965,
197,
532,
46948,
7395,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTransformWithNoTypePrefix(t *testing.T) {
schema := []byte(`
syntax = "proto3";
package test;
import "google/protobuf/timestamp.proto";
message ErrorStatus {
google.protobuf.Timestamp time = 1;
}
message SearchResponse {
message Result {
string url = 1;
string title = 2;
repeated string snippets = 3;
}
repeated Result results = 1;
}
message SomeOtherMessage {
SearchResponse.Result result = 1;
}
`)
input := new(bytes.Buffer)
input.Write(schema)
output := new(bytes.Buffer)
transformer := proto2gql.NewTransformer(output)
transformer.DisablePrefix(true)
transformer.Import("google/protobuf/timestamp.proto", "https://raw.githubusercontent.com/google/protobuf/master/src/google/protobuf/timestamp.proto")
if err := transformer.Transform(input); err != nil {
t.Fatal(err)
}
expected := `
type ErrorStatus {
time: Timestamp
}
type SearchResponse {
results: [SearchResponseResult]
}
type SearchResponseResult {
url: String
title: String
snippets: [String]
}
type SomeOtherMessage {
result: SearchResponseResult
}
type Timestamp {
seconds: Int
nanos: Int
}
`
expected = strings.TrimSpace(expected)
actual := strings.TrimSpace(output.String())
if expected != actual {
t.Fatalf("Expected %s to equal to %s", expected, actual)
}
} | explode_data.jsonl/2075 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 503
} | [
2830,
3393,
8963,
2354,
2753,
929,
14335,
1155,
353,
8840,
836,
8,
341,
1903,
3416,
1669,
3056,
3782,
61528,
197,
1903,
13662,
284,
330,
15110,
18,
876,
197,
197,
1722,
1273,
401,
197,
21918,
330,
17485,
14,
32921,
5523,
4702,
57322,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDeprecated(t *testing.T) {
app := iris.New()
writeVesion := func(ctx iris.Context) {
ctx.WriteString(versioning.GetVersion(ctx))
}
opts := versioning.DeprecationOptions{
WarnMessage: "deprecated, see <this link>",
DeprecationDate: time.Now().UTC(),
DeprecationInfo: "a bigger version is available, see <this link> for more information",
}
app.Get("/", versioning.Deprecated(writeVesion, opts))
e := httptest.New(t, app)
ex := e.GET("/").WithHeader(versioning.AcceptVersionHeaderKey, "1.0").Expect()
ex.Status(iris.StatusOK).Body().Equal("1.0")
ex.Header("X-API-Warn").Equal(opts.WarnMessage)
expectedDateStr := opts.DeprecationDate.Format(app.ConfigurationReadOnly().GetTimeFormat())
ex.Header("X-API-Deprecation-Date").Equal(expectedDateStr)
} | explode_data.jsonl/53868 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 290
} | [
2830,
3393,
51344,
1155,
353,
8840,
836,
8,
341,
28236,
1669,
63942,
7121,
2822,
24945,
53,
55981,
1669,
2915,
7502,
63942,
9328,
8,
341,
197,
20985,
44747,
37770,
287,
2234,
5637,
7502,
1171,
197,
630,
64734,
1669,
2319,
287,
34848,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNavigation_WidthRatio(t *testing.T) {
f, cleanup := setupNav()
defer cleanup()
evals(f.Evaler, `@edit:navigation:width-ratio = 1 1 1`)
f.TTYCtrl.Inject(term.K('N', ui.Ctrl))
f.TestTTY(t,
filepath.Join("~", "d"), "> ", term.DotHere, "\n",
" NAVIGATING \n", Styles,
"************ ",
" d a \n", Styles,
"################ ++++++++++++++++ ",
" e ", Styles,
" ////////////////",
)
} | explode_data.jsonl/49811 | {
"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,
16399,
77609,
22777,
1155,
353,
8840,
836,
8,
341,
1166,
11,
21290,
1669,
6505,
10096,
741,
16867,
21290,
2822,
7727,
25596,
955,
5142,
831,
261,
11,
1565,
31,
3587,
19266,
4372,
25,
3098,
3795,
6266,
284,
220,
16,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetFinalizerName(t *testing.T) {
tests := []struct {
input string
output string
}{
{
"no-Change",
"external-attacher/no-Change",
},
{
"s!a@n#i$t(i%z^e&d*",
"external-attacher/s-a-n-i-t-i-z-e-d-X",
},
}
for _, test := range tests {
output := GetFinalizerName(test.input)
if output != test.output {
t.Errorf("expected %q, got %q", test.output, output)
}
}
} | explode_data.jsonl/42156 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 197
} | [
2830,
3393,
1949,
19357,
3135,
675,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
22427,
220,
914,
198,
197,
21170,
914,
198,
197,
59403,
197,
197,
515,
298,
197,
1,
2152,
12,
4072,
756,
298,
197,
1,
20921,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test__AverMedia__Extract(t *testing.T) {
assert := assert.New(t)
testTable := []struct {
filename string
expectedTime string
}{
{
filename: "20180506_170735.mp4",
expectedTime: "2018-05-06T17:07:35",
},
}
for _, testItem := range testTable {
timeObj, err := NewAverMedia().Extract(newFilerStub("", testItem.filename))
assert.Nil(err)
assert.Equal(testItem.expectedTime, timeObj.Format("2006-01-02T15:04:05"), testItem.filename)
}
} | explode_data.jsonl/11612 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 197
} | [
2830,
3393,
563,
32,
423,
12661,
563,
28959,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
18185,
2556,
1669,
3056,
1235,
341,
197,
66434,
257,
914,
198,
197,
42400,
1462,
914,
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... | 2 |
func TestOtherRequests(t *testing.T) {
a := allocator{}
ip, _, err := a.RequestAddress(defaultPoolID, nil, nil)
if err != nil {
t.Fatal(err)
}
if ip != nil {
t.Fatalf("Unexpected address returned: %v", ip)
}
_, _, err = a.RequestAddress("anypid", nil, nil)
if err == nil {
t.Fatal("Unexpected success")
}
} | explode_data.jsonl/62137 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 135
} | [
2830,
3393,
11409,
35295,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
43655,
31483,
46531,
11,
8358,
1848,
1669,
264,
9659,
4286,
18978,
10551,
915,
11,
2092,
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... | 4 |
func TestSetTunnel(t *testing.T) {
var tests = []struct {
desc string
a Action
action string
err error
}{
{
desc: "set tunnel OK",
a: SetTunnel(0xa),
action: "set_tunnel:0xa",
},
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
action, err := tt.a.MarshalText()
if want, got := tt.err, err; want != got {
t.Fatalf("unexpected error:\n- want: %v\n- got: %v",
want, got)
}
if err != nil {
return
}
if want, got := tt.action, string(action); want != got {
t.Fatalf("unexpected Action:\n- want: %q\n- got: %q",
want, got)
}
})
}
} | explode_data.jsonl/49517 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 320
} | [
2830,
3393,
1649,
51,
40292,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
1235,
341,
197,
41653,
256,
914,
198,
197,
11323,
414,
5586,
198,
197,
38933,
914,
198,
197,
9859,
262,
1465,
198,
197,
59403,
197,
197,
515,
298,
416... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDefaultPodLabels(t *testing.T) {
testCases := []struct {
id string
jobSpec *api.JobSpec
expectedLabels map[string]string
}{
{
id: "Refs defined, expected labels with org/repo/branch information",
jobSpec: &api.JobSpec{
JobSpec: downwardapi.JobSpec{
Refs: &prowapi.Refs{
Org: "org",
Repo: "repo",
BaseRef: "master",
},
},
},
expectedLabels: map[string]string{
"created-by-ci": "true",
"prow.k8s.io/id": "",
"build-id": "",
"job": "",
"ci.openshift.io/refs.org": "org",
"ci.openshift.io/refs.repo": "repo",
"ci.openshift.io/refs.branch": "master",
},
},
{
id: "nil Refs, expected labels without org/repo/branch information",
jobSpec: &api.JobSpec{
JobSpec: downwardapi.JobSpec{
Refs: nil,
},
},
expectedLabels: map[string]string{
"created-by-ci": "true",
"prow.k8s.io/id": "",
"build-id": "",
"job": "",
},
},
{
id: "nil Refs but ExtraRefs is > 0, expected labels with extraref[0] org/repo/branch information",
jobSpec: &api.JobSpec{
JobSpec: downwardapi.JobSpec{
Refs: nil,
ExtraRefs: []prowapi.Refs{
{
Org: "extraorg",
Repo: "extrarepo",
BaseRef: "master",
},
},
},
},
expectedLabels: map[string]string{
"created-by-ci": "true",
"prow.k8s.io/id": "",
"build-id": "",
"job": "",
"ci.openshift.io/refs.org": "extraorg",
"ci.openshift.io/refs.repo": "extrarepo",
"ci.openshift.io/refs.branch": "master",
},
},
{
id: "non-nil Refs and ExtraRefs is > 0, expected labels with refs org/repo/branch information",
jobSpec: &api.JobSpec{
JobSpec: downwardapi.JobSpec{
Refs: &prowapi.Refs{
Org: "org",
Repo: "repo",
BaseRef: "master",
},
ExtraRefs: []prowapi.Refs{
{
Org: "extraorg",
Repo: "extrarepo",
BaseRef: "master",
},
},
},
},
expectedLabels: map[string]string{
"created-by-ci": "true",
"prow.k8s.io/id": "",
"build-id": "",
"job": "",
"ci.openshift.io/refs.org": "org",
"ci.openshift.io/refs.repo": "repo",
"ci.openshift.io/refs.branch": "master",
},
},
}
for _, tc := range testCases {
t.Run(tc.id, func(t *testing.T) {
labels := defaultPodLabels(tc.jobSpec)
if !reflect.DeepEqual(labels, tc.expectedLabels) {
t.Fatal(diff.ObjectReflectDiff(labels, tc.expectedLabels))
}
})
}
} | explode_data.jsonl/75139 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1573
} | [
2830,
3393,
3675,
23527,
23674,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
15710,
1797,
914,
198,
197,
68577,
8327,
286,
353,
2068,
45293,
8327,
198,
197,
42400,
23674,
2415,
14032,
30953,
198,
197,
59403,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIdentifierSanitize(t *testing.T) {
t.Parallel()
tests := []struct {
ident pgx.Identifier
expected string
}{
{
ident: pgx.Identifier{`foo`},
expected: `"foo"`,
},
{
ident: pgx.Identifier{`select`},
expected: `"select"`,
},
{
ident: pgx.Identifier{`foo`, `bar`},
expected: `"foo"."bar"`,
},
{
ident: pgx.Identifier{`you should " not do this`},
expected: `"you should "" not do this"`,
},
{
ident: pgx.Identifier{`you should " not do this`, `please don't`},
expected: `"you should "" not do this"."please don't"`,
},
{
ident: pgx.Identifier{`you should ` + string([]byte{0}) + `not do this`},
expected: `"you should not do this"`,
},
}
for i, tt := range tests {
qval := tt.ident.Sanitize()
if qval != tt.expected {
t.Errorf("%d. Expected Sanitize %v to return %v but it was %v", i, tt.ident, tt.expected, qval)
}
}
} | explode_data.jsonl/40024 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 426
} | [
2830,
3393,
8714,
23729,
26310,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
78216,
1669,
3056,
1235,
341,
197,
197,
1713,
262,
17495,
87,
70520,
198,
197,
42400,
914,
198,
197,
59403,
197,
197,
515,
298,
197,
1713,
25,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConditionDelete(t *testing.T) {
clock := clockwork.NewFakeClock()
ns := []*corev1.Namespace{
{
ObjectMeta: metav1.ObjectMeta{
Name: "ns",
},
},
}
seeds := make([]pipelinetest.Clients, 0)
for i := 0; i < 3; i++ {
conditions := []*v1alpha1.Condition{
tb.Condition("condition1", "ns", cb.ConditionCreationTime(clock.Now().Add(-1*time.Minute))),
}
s, _ := test.SeedTestData(t, pipelinetest.Data{Conditions: conditions, Namespaces: ns})
seeds = append(seeds, s)
}
testParams := []struct {
name string
command []string
input pipelinetest.Clients
inputStream io.Reader
wantError bool
want string
}{
{
name: "Invalid namespace",
command: []string{"rm", "condition1", "-n", "invalid"},
input: seeds[0],
inputStream: nil,
wantError: true,
want: "namespaces \"invalid\" not found",
},
{
name: "With force delete flag (shorthand)",
command: []string{"rm", "condition1", "-n", "ns", "-f"},
input: seeds[0],
inputStream: nil,
wantError: false,
want: "Condition deleted: condition1\n",
},
{
name: "With force delete flag",
command: []string{"rm", "condition1", "-n", "ns", "--force"},
input: seeds[1],
inputStream: nil,
wantError: false,
want: "Condition deleted: condition1\n",
},
{
name: "Without force delete flag, reply no",
command: []string{"rm", "condition1", "-n", "ns"},
input: seeds[2],
inputStream: strings.NewReader("n"),
wantError: true,
want: "canceled deleting condition \"condition1\"",
},
{
name: "Without force delete flag, reply yes",
command: []string{"rm", "condition1", "-n", "ns"},
input: seeds[2],
inputStream: strings.NewReader("y"),
wantError: false,
want: "Are you sure you want to delete condition \"condition1\" (y/n): Condition deleted: condition1\n",
},
{
name: "Remove non existent resource",
command: []string{"rm", "nonexistent", "-n", "ns"},
input: seeds[2],
inputStream: strings.NewReader("y"),
wantError: true,
want: "failed to delete condition \"nonexistent\": conditions.tekton.dev \"nonexistent\" not found",
},
}
for _, tp := range testParams {
t.Run(tp.name, func(t *testing.T) {
p := &test.Params{Tekton: tp.input.Pipeline, Kube: tp.input.Kube}
condition := Command(p)
if tp.inputStream != nil {
condition.SetIn(tp.inputStream)
}
out, err := test.ExecuteCommand(condition, tp.command...)
if tp.wantError {
if err == nil {
t.Errorf("error expected here")
}
test.AssertOutput(t, tp.want, err.Error())
} else {
if err != nil {
t.Errorf("unexpected Error")
}
test.AssertOutput(t, tp.want, out)
}
})
}
} | explode_data.jsonl/61201 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1293
} | [
2830,
3393,
10547,
6435,
1155,
353,
8840,
836,
8,
341,
84165,
1669,
8866,
1778,
7121,
52317,
26104,
2822,
84041,
1669,
29838,
98645,
16,
46011,
515,
197,
197,
515,
298,
23816,
12175,
25,
77520,
16,
80222,
515,
571,
21297,
25,
330,
4412,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewDNSProvider(t *testing.T) {
testCases := []struct {
desc string
envVars map[string]string
expected string
}{
{
desc: "success",
envVars: map[string]string{
EnvSecretAPIKey: "secret",
EnvAPIKey: "key",
},
},
{
desc: "missing secret API key",
envVars: map[string]string{
EnvSecretAPIKey: "",
EnvAPIKey: "key",
},
expected: "porkbun: some credentials information are missing: PORKBUN_SECRET_API_KEY",
},
{
desc: "missing API key",
envVars: map[string]string{
EnvSecretAPIKey: "secret",
EnvAPIKey: "",
},
expected: "porkbun: some credentials information are missing: PORKBUN_API_KEY",
},
{
desc: "missing all credentials",
envVars: map[string]string{
EnvSecretAPIKey: "",
EnvAPIKey: "",
},
expected: "porkbun: some credentials information are missing: PORKBUN_SECRET_API_KEY,PORKBUN_API_KEY",
},
}
for _, test := range testCases {
t.Run(test.desc, func(t *testing.T) {
defer envTest.RestoreEnv()
envTest.ClearEnv()
envTest.Apply(test.envVars)
p, err := NewDNSProvider()
if test.expected == "" {
require.NoError(t, err)
require.NotNil(t, p)
require.NotNil(t, p.config)
} else {
require.EqualError(t, err, test.expected)
}
})
}
} | explode_data.jsonl/69081 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 612
} | [
2830,
3393,
3564,
61088,
5179,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
41653,
257,
914,
198,
197,
57538,
28305,
220,
2415,
14032,
30953,
198,
197,
42400,
914,
198,
197,
59403,
197,
197,
515,
298,
41653,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfig_InlineTables(t *testing.T) {
// #4098
c := NewConfig()
err := c.LoadConfig("./testdata/inline_table.toml")
assert.NoError(t, err)
require.Equal(t, 2, len(c.Outputs))
outputHTTP, ok := c.Outputs[1].Output.(*httpOut.HTTP)
assert.Equal(t, true, ok)
assert.Equal(t, map[string]string{"Authorization": "Token $TOKEN", "Content-Type": "application/json"}, outputHTTP.Headers)
assert.Equal(t, []string{"org_id"}, c.Outputs[0].Config.Filter.TagInclude)
} | explode_data.jsonl/67107 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 187
} | [
2830,
3393,
2648,
62,
25324,
21670,
1155,
353,
8840,
836,
8,
341,
197,
322,
671,
19,
15,
24,
23,
198,
1444,
1669,
1532,
2648,
741,
9859,
1669,
272,
13969,
2648,
13988,
92425,
14,
5057,
5237,
73494,
75,
1138,
6948,
35699,
1155,
11,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRecover(t *testing.T) {
t.Parallel()
r, _, _ := testSetup()
storage := r.Storage()
if storage[r.PrimaryID] != authboss.String {
t.Error("Expected storage KV:", r.PrimaryID, authboss.String)
}
if storage[authboss.StoreEmail] != authboss.String {
t.Error("Expected storage KV:", authboss.StoreEmail, authboss.String)
}
if storage[authboss.StorePassword] != authboss.String {
t.Error("Expected storage KV:", authboss.StorePassword, authboss.String)
}
if storage[StoreRecoverToken] != authboss.String {
t.Error("Expected storage KV:", StoreRecoverToken, authboss.String)
}
if storage[StoreRecoverTokenExpiry] != authboss.String {
t.Error("Expected storage KV:", StoreRecoverTokenExpiry, authboss.String)
}
routes := r.Routes()
if routes["/recover"] == nil {
t.Error("Expected route '/recover' with handleFunc")
}
if routes["/recover/complete"] == nil {
t.Error("Expected route '/recover/complete' with handleFunc")
}
} | explode_data.jsonl/61492 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 349
} | [
2830,
3393,
693,
3688,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
7000,
11,
8358,
716,
1669,
1273,
21821,
2822,
197,
16172,
1669,
435,
43771,
741,
743,
5819,
16131,
34884,
915,
60,
961,
4166,
33314,
6431,
341,
197,
3244,
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... | 8 |
func TestEmbeddedBug(t *testing.T) {
testtype.SkipUnlessTestType(t, testtype.UnitTestType)
v := BugB{
BugA{"A"},
"B",
}
b, err := Marshal(v)
if err != nil {
t.Fatal("Marshal:", err)
}
want := `{"S":"B"}`
got := string(b)
if got != want {
t.Fatalf("Marshal: got %s want %s", got, want)
}
// Now check that the duplicate field, S, does not appear.
x := BugX{
A: 23,
}
b, err = Marshal(x)
if err != nil {
t.Fatal("Marshal:", err)
}
want = `{"A":23}`
got = string(b)
if got != want {
t.Fatalf("Marshal: got %s want %s", got, want)
}
} | explode_data.jsonl/4569 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 261
} | [
2830,
3393,
83466,
46773,
1155,
353,
8840,
836,
8,
341,
18185,
1313,
57776,
35587,
2271,
929,
1155,
11,
1273,
1313,
25159,
2271,
929,
692,
5195,
1669,
30501,
33,
515,
197,
12791,
768,
32,
4913,
32,
7115,
197,
197,
63590,
756,
197,
532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEventForwardingReturnsError(t *testing.T) {
called := 0
cfg := &conf.AdvancedConfig{
SplitUpdateQueueSize: 10000,
SegmentUpdateQueueSize: 10000,
}
logger := logging.NewLogger(nil)
synchronizer := &pushMocks.LocalSyncMock{}
token := &dtos.Token{
Token: `eyJhbGciOiJIUzI1NiIsImtpZCI6IjVZOU05US45QnJtR0EiLCJ0eXAiOiJKV1QifQ.eyJ4LWFibHktY2FwYWJpbGl0eSI6IntcIk56TTJNREk1TXpjMF9NVGd5TlRnMU1UZ3dOZz09X3NlZ21lbnRzXCI6W1wic3Vic2NyaWJlXCJdLFwiTnpNMk1ESTVNemMwX01UZ3lOVGcxTVRnd05nPT1fc3BsaXRzXCI6W1wic3Vic2NyaWJlXCJdLFwiY29udHJvbF9wcmlcIjpbXCJzdWJzY3JpYmVcIixcImNoYW5uZWwtbWV0YWRhdGE6cHVibGlzaGVyc1wiXSxcImNvbnRyb2xfc2VjXCI6W1wic3Vic2NyaWJlXCIsXCJjaGFubmVsLW1ldGFkYXRhOnB1Ymxpc2hlcnNcIl19IiwieC1hYmx5LWNsaWVudElkIjoiY2xpZW50SWQiLCJleHAiOjE2MTMzNDUyMzAsImlhdCI6MTYxMzM0MTYzMH0.Z3jKyiJq6t00hWFV_xIlh5w4xAYF3Rj0gfcTxgLjcOc`,
PushEnabled: true,
}
authMock := &serviceMocks.MockAuthClient{
AuthenticateCall: func() (*dtos.Token, error) { return token, nil },
}
feedback := make(chan int64, 100)
telemetryStorageMock := mocks.MockTelemetryStorage{
RecordSuccessfulSyncCall: func(resource int, tm int64) {
if resource != telemetry.TokenSync {
t.Error("Resource should be token")
}
},
RecordSyncLatencyCall: func(resource int, latency int64) {
if resource != telemetry.TokenSync {
t.Error("Resource should be token")
}
},
RecordTokenRefreshesCall: func() {},
RecordStreamingEventCall: func(streamingEvent *dtos.StreamingEvent) {
switch called {
case 0:
if streamingEvent.Type != telemetry.EventTypeTokenRefresh {
t.Error("Should record next token refresh")
}
case 1:
if streamingEvent.Type != telemetry.EventTypeSSEConnectionEstablished {
t.Error("It should record connection established")
}
}
called++
},
}
manager, err := NewManager(logger, synchronizer, cfg, feedback, authMock, telemetryStorageMock, dtos.Metadata{}, nil)
if err != nil {
t.Error("no error should be returned upon manager instantiation", err)
return
}
waiter := make(chan struct{}, 1)
manager.sseClient = &sseMocks.StreamingClientMock{
ConnectStreamingCall: func(tok string, status chan int, channels []string, handler func(sse.IncomingMessage)) {
if tok != token.Token {
t.Error("incorrect token received.")
}
go func() {
status <- sse.StatusFirstEventOk
<-waiter
handler(&rawSseMocks.RawEventMock{IDCall: func() string { return "abc" }})
<-waiter
status <- sse.StatusDisconnected
}()
},
StopStreamingCall: func() {
waiter <- struct{}{}
},
}
handled := int32(0)
manager.parser = &pushMocks.NotificationParserMock{
ParseAndForwardCall: func(e sse.IncomingMessage) (*int64, error) {
if e.ID() != "abc" {
t.Error("wrong id. expected abc. got: ", e.ID())
}
atomic.AddInt32(&handled, 1)
return nil, fmt.Errorf("something")
},
}
manager.Start()
message := <-feedback
if message != StatusUp {
t.Error("push manager should have proapgated a push up status. Got: ", message)
}
if manager.nextRefresh == nil {
t.Error("a token refresh should have been scheduled after a successful connection.")
}
waiter <- struct{}{} // free the goroutine to send an event to the parser
time.Sleep(1 * time.Second)
if h := atomic.LoadInt32(&handled); h != 1 {
t.Error("handler should have been executed once. Was: ", h)
}
message = <-feedback
if message != StatusRetryableError {
t.Error("should have gotten no message after an expected disconnection. Got: ", message)
}
} | explode_data.jsonl/44447 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1512
} | [
2830,
3393,
1556,
25925,
287,
16446,
1454,
1155,
353,
8840,
836,
8,
341,
1444,
4736,
1669,
220,
15,
198,
50286,
1669,
609,
6135,
17865,
88087,
2648,
515,
197,
7568,
2292,
4289,
7554,
1695,
25,
256,
220,
16,
15,
15,
15,
15,
345,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCancelByID(t *testing.T) {
client := v1.New(&v1.Config{
Key: os.Getenv("BFKEY"),
Secret: os.Getenv("BFSECRET"),
})
err := client.CancelByID(cancels.NewByID(
types.FXBTCJPY,
"JRF20200314-044600-538282",
))
assert.NoError(t, err)
fmt.Printf("%+v %+v\n", client.Limit.Remain(true), client.Limit.Remain(false))
} | explode_data.jsonl/41212 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 159
} | [
2830,
3393,
9269,
60572,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
348,
16,
7121,
2099,
85,
16,
10753,
515,
197,
55242,
25,
262,
2643,
64883,
445,
19883,
4784,
4461,
197,
7568,
50856,
25,
2643,
64883,
445,
19883,
65310,
4461,
197,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestListIssueEvents(t *testing.T) {
ts := simpleTestServer(
t,
"/repos/org/repo/issues/1/events",
[]ListedIssueEvent{
{Event: IssueActionLabeled},
{Event: IssueActionClosed},
},
)
defer ts.Close()
c := getClient(ts.URL)
events, err := c.ListIssueEvents("org", "repo", 1)
if err != nil {
t.Errorf("Didn't expect error: %v", err)
} else if len(events) != 2 {
t.Errorf("Expected two events, found %d: %v", len(events), events)
return
}
if events[0].Event != IssueActionLabeled {
t.Errorf("Wrong event for index 0: %v", events[0])
}
if events[1].Event != IssueActionClosed {
t.Errorf("Wrong event for index 1: %v", events[1])
}
} | explode_data.jsonl/6291 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 275
} | [
2830,
3393,
852,
42006,
7900,
1155,
353,
8840,
836,
8,
341,
57441,
1669,
4285,
2271,
5475,
1006,
197,
3244,
345,
197,
197,
3115,
68354,
41361,
10758,
5368,
38745,
14,
16,
42764,
756,
197,
197,
1294,
852,
291,
42006,
1556,
515,
298,
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... | 5 |
func TestSetAppOperations(t *testing.T) {
t.Run("Application not existing", func(t *testing.T) {
appIf := appclientset.NewSimpleClientset().ArgoprojV1alpha1().Applications("default")
app, err := SetAppOperation(appIf, "someapp", &argoappv1.Operation{Sync: &argoappv1.SyncOperation{Revision: "aaa"}})
assert.Error(t, err)
assert.Nil(t, app)
})
t.Run("Operation already in progress", func(t *testing.T) {
a := argoappv1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "someapp",
Namespace: "default",
},
Operation: &argoappv1.Operation{Sync: &argoappv1.SyncOperation{Revision: "aaa"}},
}
appIf := appclientset.NewSimpleClientset(&a).ArgoprojV1alpha1().Applications("default")
app, err := SetAppOperation(appIf, "someapp", &argoappv1.Operation{Sync: &argoappv1.SyncOperation{Revision: "aaa"}})
assert.Error(t, err)
assert.Contains(t, err.Error(), "operation is already in progress")
assert.Nil(t, app)
})
t.Run("Operation unspecified", func(t *testing.T) {
a := argoappv1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "someapp",
Namespace: "default",
},
}
appIf := appclientset.NewSimpleClientset(&a).ArgoprojV1alpha1().Applications("default")
app, err := SetAppOperation(appIf, "someapp", &argoappv1.Operation{Sync: nil})
assert.Error(t, err)
assert.Contains(t, err.Error(), "Operation unspecified")
assert.Nil(t, app)
})
t.Run("Success", func(t *testing.T) {
a := argoappv1.Application{
ObjectMeta: metav1.ObjectMeta{
Name: "someapp",
Namespace: "default",
},
}
appIf := appclientset.NewSimpleClientset(&a).ArgoprojV1alpha1().Applications("default")
app, err := SetAppOperation(appIf, "someapp", &argoappv1.Operation{Sync: &argoappv1.SyncOperation{Revision: "aaa"}})
assert.NoError(t, err)
assert.NotNil(t, app)
})
} | explode_data.jsonl/49997 | {
"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,
1649,
2164,
35120,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
4988,
537,
6350,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
28236,
2679,
1669,
906,
2972,
746,
7121,
16374,
2959,
746,
1005,
2735,
45926,
73,
53,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCouchDBResultsIterator_Next_Internal(t *testing.T) {
t.Run("Error returned from result rows", func(t *testing.T) {
iterator := &couchDBResultsIterator{
resultRows: &mockRows{err: errors.New("result rows error")},
}
nextCallResult, err := iterator.Next()
require.EqualError(t, err, "failure during iteration of result rows: result rows error")
require.False(t, nextCallResult)
})
t.Run("Fail to close result rows before fetching new page", func(t *testing.T) {
iterator := &couchDBResultsIterator{
resultRows: &mockRows{errClose: errors.New("close error")},
}
nextCallResult, err := iterator.Next()
require.EqualError(t, err, "failed to close result rows before fetching new page: close error")
require.False(t, nextCallResult)
})
t.Run("Failure while fetching another page", func(t *testing.T) {
iterator := &couchDBResultsIterator{
store: &store{db: &mockDB{}},
resultRows: &mockRows{},
}
nextCallResult, err := iterator.Next()
require.EqualError(t, err, "failure while fetching new page: "+
"failure while sending request to CouchDB find endpoint: mockDB Find always fails")
require.False(t, nextCallResult)
})
t.Run("Failure while logging a warning", func(t *testing.T) {
iterator := &couchDBResultsIterator{
resultRows: &mockRows{warning: "Some warning"},
marshal: failingMarshal,
}
nextCallResult, err := iterator.Next()
require.EqualError(t, err, "failed to log a warning: "+
"failed to marshal find query for log: marshal failure")
require.False(t, nextCallResult)
})
} | explode_data.jsonl/72588 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 552
} | [
2830,
3393,
34,
3026,
3506,
9801,
11951,
1604,
427,
37238,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
1454,
5927,
504,
1102,
6978,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
197,
6854,
1669,
609,
66,
3026,
3506,
9801,
11951,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFunctionReturnTypeDeclaration(t *testing.T) {
testStr := `<?php function TestFn(MyClass $myClass): string {}`
p := NewParser()
tree, err := p.Parse("", testStr)
if err != nil {
t.Fatalf("parse: %v", err)
}
tp := tree.Nodes[0].Children()[0].(*ast.FunctionDefinition).Type
if tp != "string" {
t.Fatalf("invalid return type: %v", t)
}
} | explode_data.jsonl/28434 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 140
} | [
2830,
3393,
5152,
84362,
24489,
1155,
353,
8840,
836,
8,
341,
18185,
2580,
1669,
1565,
1316,
1208,
729,
3393,
24911,
37485,
1957,
400,
2408,
1957,
1648,
914,
4687,
3989,
3223,
1669,
1532,
6570,
741,
51968,
11,
1848,
1669,
281,
8937,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestContainerUpdate(t *testing.T) {
ctx := context.Background()
c, rollback := makeConnectionWithContainer(t)
defer rollback()
err := c.ContainerUpdate(ctx, CONTAINER, m2.ContainerHeaders())
if err != nil {
t.Fatal(err)
}
_, headers, err := c.Container(ctx, CONTAINER)
if err != nil {
t.Fatal(err)
}
compareMaps(t, headers.ContainerMetadata(), map[string]string{})
} | explode_data.jsonl/12667 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 144
} | [
2830,
3393,
4502,
4289,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
1444,
11,
60414,
1669,
1281,
4526,
2354,
4502,
1155,
340,
16867,
60414,
741,
9859,
1669,
272,
33672,
4289,
7502,
11,
16120,
34521,
11,
296,
17,
33672,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestServer_Request_Get(t *testing.T) {
testServerRequest(t, func(st *serverTester) {
st.writeHeaders(HeadersFrameParam{
StreamID: 1, // clients send odd numbers
BlockFragment: st.encodeHeader("foo-bar", "some-value"),
EndStream: true, // no DATA frames
EndHeaders: true,
})
}, func(r *http.Request) {
if r.Method != "GET" {
t.Errorf("Method = %q; want GET", r.Method)
}
if r.URL.Path != "/" {
t.Errorf("URL.Path = %q; want /", r.URL.Path)
}
if r.ContentLength != 0 {
t.Errorf("ContentLength = %v; want 0", r.ContentLength)
}
if r.Close {
t.Error("Close = true; want false")
}
if !strings.Contains(r.RemoteAddr, ":") {
t.Errorf("RemoteAddr = %q; want something with a colon", r.RemoteAddr)
}
if r.Proto != "HTTP/2.0" || r.ProtoMajor != 2 || r.ProtoMinor != 0 {
t.Errorf("Proto = %q Major=%v,Minor=%v; want HTTP/2.0", r.Proto, r.ProtoMajor, r.ProtoMinor)
}
wantHeader := http.Header{
"Foo-Bar": []string{"some-value"},
}
if !reflect.DeepEqual(r.Header, wantHeader) {
t.Errorf("Header = %#v; want %#v", r.Header, wantHeader)
}
if n, err := r.Body.Read([]byte(" ")); err != io.EOF || n != 0 {
t.Errorf("Read = %d, %v; want 0, EOF", n, err)
}
})
} | explode_data.jsonl/71605 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 562
} | [
2830,
3393,
5475,
44024,
13614,
1155,
353,
8840,
836,
8,
341,
18185,
5475,
1900,
1155,
11,
2915,
5895,
353,
4030,
58699,
8,
341,
197,
18388,
3836,
10574,
7,
10574,
4369,
2001,
515,
298,
197,
3027,
915,
25,
414,
220,
16,
11,
442,
823... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewCustomListenerSelector(t *testing.T) {
Convey("Test NewCustomListenerSelector", t, func() {
Convey("Test NewCustomListenerSelector with host and port", func() {
selector, err := nettool.NewCustomListenerSelector("tcp", "", 1031, 8, nettool.Equal_Mode)
So(err, ShouldBeNil)
So(selector, ShouldNotBeNil)
go selector.Serve()
defer selector.Close()
})
Convey("Test NewCustomListenerSelector with address string", func() {
selector, err := nettool.NewCustomListenerSelectorByAddr("tcp", ":1032", 8, nettool.Equal_Mode)
So(err, ShouldBeNil)
So(selector, ShouldNotBeNil)
go selector.Serve()
defer selector.Close()
})
Convey("Test NewCustomListenerSelector with listener", func() {
l, err := net.Listen("tcp", ":1033")
So(err, ShouldBeNil)
selector, err := nettool.NewCustomListenerSelectorByListener(l, 8, nettool.Equal_Mode)
So(err, ShouldBeNil)
So(selector, ShouldNotBeNil)
go selector.Serve()
defer selector.Close()
})
})
} | explode_data.jsonl/22088 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 390
} | [
2830,
3393,
3564,
10268,
2743,
5877,
1155,
353,
8840,
836,
8,
1476,
93070,
5617,
445,
2271,
1532,
10268,
2743,
5877,
497,
259,
11,
2915,
368,
341,
197,
93070,
5617,
445,
2271,
1532,
10268,
2743,
5877,
448,
3468,
323,
2635,
497,
2915,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIntegration_BlockHistoryEstimator(t *testing.T) {
t.Parallel()
var initialDefaultGasPrice int64 = 5000000000
c := cltest.NewTestEVMConfig(t)
c.Overrides.EvmGasPriceDefault = big.NewInt(initialDefaultGasPrice)
c.Overrides.GasEstimatorMode = null.StringFrom("BlockHistory")
c.Overrides.BlockHistoryEstimatorBlockDelay = null.IntFrom(0)
c.Overrides.BlockHistoryEstimatorBlockHistorySize = null.IntFrom(2)
// Limit the headtracker backfill depth just so we aren't here all week
c.Overrides.EvmFinalityDepth = null.IntFrom(3)
ethClient, sub, assertMocksCalled := cltest.NewEthMocks(t)
defer assertMocksCalled()
chchNewHeads := make(chan chan<- *models.Head, 1)
app, cleanup := cltest.NewApplicationWithConfigAndKey(t, c,
ethClient,
)
defer cleanup()
b41 := gas.Block{
Number: 41,
Hash: utils.NewHash(),
Transactions: cltest.TransactionsFromGasPrices(41000000000, 41500000000),
}
b42 := gas.Block{
Number: 42,
Hash: utils.NewHash(),
Transactions: cltest.TransactionsFromGasPrices(44000000000, 45000000000),
}
b43 := gas.Block{
Number: 43,
Hash: utils.NewHash(),
Transactions: cltest.TransactionsFromGasPrices(48000000000, 49000000000, 31000000000),
}
h40 := models.Head{Hash: utils.NewHash(), Number: 40}
h41 := models.Head{Hash: b41.Hash, ParentHash: h40.Hash, Number: 41}
h42 := models.Head{Hash: b42.Hash, ParentHash: h41.Hash, Number: 42}
sub.On("Err").Return(nil)
sub.On("Unsubscribe").Return(nil).Maybe()
ethClient.On("SubscribeNewHead", mock.Anything, mock.Anything).
Run(func(args mock.Arguments) { chchNewHeads <- args.Get(1).(chan<- *models.Head) }).
Return(sub, nil)
// Nonce syncer
ethClient.On("PendingNonceAt", mock.Anything, mock.Anything).Maybe().Return(uint64(0), nil)
// BlockHistoryEstimator boot calls
ethClient.On("HeadByNumber", mock.Anything, mock.AnythingOfType("*big.Int")).Return(&h42, nil)
ethClient.On("BatchCallContext", mock.Anything, mock.MatchedBy(func(b []rpc.BatchElem) bool {
return len(b) == 2 &&
b[0].Method == "eth_getBlockByNumber" && b[0].Args[0] == "0x29" &&
b[1].Method == "eth_getBlockByNumber" && b[1].Args[0] == "0x2a"
})).Return(nil).Run(func(args mock.Arguments) {
elems := args.Get(1).([]rpc.BatchElem)
elems[0].Result = &b41
elems[1].Result = &b42
})
ethClient.On("Dial", mock.Anything).Return(nil)
ethClient.On("ChainID", mock.Anything).Return(c.ChainID(), nil)
ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(oneETH.ToInt(), nil)
require.NoError(t, app.Start())
var newHeads chan<- *models.Head
select {
case newHeads = <-chchNewHeads:
case <-time.After(10 * time.Second):
t.Fatal("timed out waiting for app to subscribe")
}
estimator := app.TxManager.GetGasEstimator()
gasPrice, gasLimit, err := estimator.EstimateGas(nil, 500000)
require.NoError(t, err)
assert.Equal(t, uint64(500000), gasLimit)
assert.Equal(t, "41500000000", gasPrice.String())
assert.Equal(t, initialDefaultGasPrice, c.EvmGasPriceDefault().Int64()) // unchanged
// BlockHistoryEstimator new blocks
ethClient.On("BatchCallContext", mock.Anything, mock.MatchedBy(func(b []rpc.BatchElem) bool {
return len(b) == 2 &&
b[0].Method == "eth_getBlockByNumber" && b[0].Args[0] == "0x2a" &&
b[1].Method == "eth_getBlockByNumber" && b[1].Args[0] == "0x2b"
})).Return(nil).Run(func(args mock.Arguments) {
elems := args.Get(1).([]rpc.BatchElem)
elems[0].Result = &b43
elems[1].Result = &b42
})
// HeadTracker backfill
ethClient.On("HeadByNumber", mock.Anything, big.NewInt(42)).Return(&h42, nil)
ethClient.On("HeadByNumber", mock.Anything, big.NewInt(41)).Return(&h41, nil)
// Simulate one new head and check the gas price got updated
newHeads <- cltest.Head(43)
gomega.NewGomegaWithT(t).Eventually(func() string {
gasPrice, _, err := estimator.EstimateGas(nil, 500000)
require.NoError(t, err)
return gasPrice.String()
}, cltest.DBWaitTimeout, cltest.DBPollingInterval).Should(gomega.Equal("45000000000"))
} | explode_data.jsonl/29846 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1576
} | [
2830,
3393,
52464,
51779,
13424,
13782,
13689,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
2405,
2856,
3675,
58728,
6972,
526,
21,
19,
284,
220,
20,
15,
15,
15,
15,
15,
15,
15,
15,
15,
271,
1444,
1669,
1185,
1944,
7121,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTableMapper_Encode(t *testing.T) {
tm := dbsteps.TableMapper{}
for _, tc := range []struct {
v interface{}
s string
}{
{"abc", "abc"},
{123, "123"},
{123.45, "123.45"},
{nil, "NULL"},
{(*time.Time)(nil), "NULL"},
{time.Time{}, "0001-01-01T00:00:00Z"},
{&time.Time{}, "0001-01-01T00:00:00Z"},
{new(int), "0"},
} {
s, err := tm.Encode(tc.v)
assert.NoError(t, err)
assert.Equal(t, tc.s, s)
}
} | explode_data.jsonl/54745 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 220
} | [
2830,
3393,
2556,
10989,
93529,
534,
1155,
353,
8840,
836,
8,
341,
3244,
76,
1669,
2927,
24080,
18257,
10989,
31483,
2023,
8358,
17130,
1669,
2088,
3056,
1235,
341,
197,
5195,
3749,
16094,
197,
1903,
914,
198,
197,
59403,
197,
197,
4913... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSendSingle(t *testing.T) {
s, port := tcpudp.NewUDPServer(&defaultConf, true)
defer s.Stop()
m := createTimelineManager(port, true, false, defaultTransportSize, time.Second, nil)
defer m.Shutdown()
number := newNumberPoint(1)
err := m.SendJSON(numberPoint, toGenericParametersN(number)...)
if !assert.NoError(t, err, "no error expected when sending number") {
return
}
message := <-s.MessageChannel()
testReceivedData(t, &message, number, true)
} | explode_data.jsonl/68113 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 162
} | [
2830,
3393,
11505,
10888,
1155,
353,
8840,
836,
8,
1476,
1903,
11,
2635,
1669,
28051,
31101,
7121,
4656,
5012,
2836,
2099,
2258,
15578,
11,
830,
340,
16867,
274,
30213,
2822,
2109,
1669,
1855,
59641,
2043,
21230,
11,
830,
11,
895,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSummaryDataPoint_Sum(t *testing.T) {
ms := NewSummaryDataPoint()
assert.EqualValues(t, float64(0.0), ms.Sum())
testValSum := float64(17.13)
ms.SetSum(testValSum)
assert.EqualValues(t, testValSum, ms.Sum())
} | explode_data.jsonl/32752 | {
"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,
19237,
1043,
2609,
1098,
372,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
19237,
1043,
2609,
741,
6948,
12808,
6227,
1155,
11,
2224,
21,
19,
7,
15,
13,
15,
701,
9829,
41676,
2398,
18185,
2208,
9190,
1669,
2224,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestConstraintsToVCPUs(t *testing.T) {
assert := assert.New(t)
vcpus := ConstraintsToVCPUs(0, 100)
assert.Zero(vcpus)
vcpus = ConstraintsToVCPUs(100, 0)
assert.Zero(vcpus)
expectedVCPUs := uint(4)
vcpus = ConstraintsToVCPUs(4000, 1000)
assert.Equal(expectedVCPUs, vcpus)
vcpus = ConstraintsToVCPUs(4000, 1200)
assert.Equal(expectedVCPUs, vcpus)
} | explode_data.jsonl/8210 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 164
} | [
2830,
3393,
12925,
1249,
53,
7123,
3558,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
5195,
4672,
355,
1669,
87473,
1249,
53,
7123,
3558,
7,
15,
11,
220,
16,
15,
15,
340,
6948,
35489,
3747,
4672,
355,
692,
5195,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTomlLoader(t *testing.T) {
Convey("Load a toml structure into a layer", t, func() {
buf := bytes.NewBufferString(testNormal)
Convey("Check if the file is loaded correctly ", func() {
layer, err := NewStreamLayer(buf, "toml", nil)
So(err, ShouldBeNil)
o := New(layer)
So(o.GetStringDefault("str", ""), ShouldEqual, "string_data")
So(o.GetStringDefault("nested.key1", ""), ShouldEqual, "string")
So(o.GetIntDefault("nested.key2", 0), ShouldEqual, 100)
So(o.GetBoolDefault("bool", false), ShouldBeTrue)
})
bufInvalid := bytes.NewBufferString(`invalid toml file`)
Convey("Check for the invalid file content", func() {
_, err := NewStreamLayer(bufInvalid, "toml", nil)
So(err, ShouldNotBeNil)
})
bufferWithDottedKeys := bytes.NewBufferString(testWithDottedKeys)
Convey("Check if the file is loaded correctly, even with dots ", func() {
layer, err := NewStreamLayer(bufferWithDottedKeys, "toml", nil)
So(err, ShouldBeNil)
o := New(layer)
So(o.GetStringDefault("name", ""), ShouldEqual, "Orange")
So(o.GetStringDefault("physical.color", ""), ShouldEqual, "orange")
So(o.GetIntDefault("physical.weight", 0), ShouldEqual, 3)
mergedLayers := utils.MergeLayersData(o.LayersData())
physicalMap, isAMap := mergedLayers["physical"].(map[string]interface{})
So(isAMap, ShouldBeTrue)
So(physicalMap["color"], ShouldEqual, "orange")
So(physicalMap["weight"], ShouldEqual, 3)
})
})
} | explode_data.jsonl/21808 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 553
} | [
2830,
3393,
24732,
75,
9181,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
5879,
264,
311,
1014,
5944,
1119,
264,
6193,
497,
259,
11,
2915,
368,
341,
197,
26398,
1669,
5820,
7121,
4095,
703,
8623,
12206,
340,
197,
93070,
5617,
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 |
func TestSet_Merge(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
s1 := gset.New(true)
s2 := gset.New(true)
s1.Add("a", "a2", "b", "c")
s2.Add("b", "b1", "e", "f")
ss := s1.Merge(s2)
t.Assert(ss.Contains("a2"), true)
t.Assert(ss.Contains("b1"), true)
})
} | explode_data.jsonl/34392 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 154
} | [
2830,
3393,
1649,
1245,
10080,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
1903,
16,
1669,
342,
746,
7121,
3715,
340,
197,
1903,
17,
1669,
342,
746,
7121,
3715,
340,
197,
1903,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIPSlice(t *testing.T) {
var args struct {
Host []net.IP
}
err := parse("--host 192.168.0.1 127.0.0.1", &args)
require.NoError(t, err)
require.Len(t, args.Host, 2)
assert.Equal(t, "192.168.0.1", args.Host[0].String())
assert.Equal(t, "127.0.0.1", args.Host[1].String())
} | explode_data.jsonl/13056 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 135
} | [
2830,
3393,
25944,
4754,
1155,
353,
8840,
836,
8,
341,
2405,
2827,
2036,
341,
197,
197,
9296,
3056,
4711,
46917,
198,
197,
532,
9859,
1669,
4715,
21549,
3790,
220,
16,
24,
17,
13,
16,
21,
23,
13,
15,
13,
16,
220,
16,
17,
22,
13,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDumpmasterkey(t *testing.T) {
expected := "b4d8b25c324dd6eaa328c9906e8a2a3c6038552a042ced4326cfff210c62957a\n"
cmd := exec.Command("../gocryptfs-xray", "-dumpmasterkey", "aesgcm_fs/gocryptfs.conf")
// Password = "test"
cmd.Stdin = bytes.NewBuffer([]byte("test"))
out1, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
out := string(out1)
if out != expected {
t.Errorf("Wrong output")
fmt.Printf("expected: %s\n", expected)
fmt.Printf("have: %s\n", out)
}
} | explode_data.jsonl/39055 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 225
} | [
2830,
3393,
51056,
13629,
792,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
330,
65,
19,
67,
23,
65,
17,
20,
66,
18,
17,
19,
631,
21,
68,
5305,
18,
17,
23,
66,
24,
24,
15,
21,
68,
23,
64,
17,
64,
18,
66,
21,
15,
18,
23,
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... | 3 |
func TestLinuxConnIntegrationConcurrent(t *testing.T) {
execN := func(n int, wg *sync.WaitGroup) {
c, err := Dial(unix.NETLINK_GENERIC, nil)
if err != nil {
panic(fmt.Sprintf("failed to dial netlink: %v", err))
}
req := Message{
Header: Header{
Flags: HeaderFlagsRequest | HeaderFlagsAcknowledge,
},
}
for i := 0; i < n; i++ {
vmsg, err := c.Send(req)
if err != nil {
panic(fmt.Sprintf("failed to send request: %v", err))
}
msgs, err := c.Receive()
if err != nil {
panic(fmt.Sprintf("failed to receive reply: %v", err))
}
if l := len(msgs); l != 1 {
panic(fmt.Sprintf("unexpected number of reply messages: %d", l))
}
if err := Validate(vmsg, msgs); err != nil {
panic(fmt.Sprintf("failed to validate request and reply: %v\n- req: %+v\n- rep: %+v",
err, vmsg, msgs))
}
}
_ = c.Close()
wg.Done()
}
const (
workers = 16
iterations = 10000
)
var wg sync.WaitGroup
wg.Add(workers)
for i := 0; i < workers; i++ {
go execN(iterations, &wg)
}
wg.Wait()
} | explode_data.jsonl/33493 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 480
} | [
2830,
3393,
46324,
9701,
52464,
1109,
3231,
1155,
353,
8840,
836,
8,
341,
67328,
45,
1669,
2915,
1445,
526,
11,
63581,
353,
12996,
28384,
2808,
8,
341,
197,
1444,
11,
1848,
1669,
66155,
18364,
941,
36515,
35956,
25274,
11,
2092,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestDestinationStateAudit(t *testing.T) {
cases := []testCase{
{
"has-all",
NewDestinationStateAudit(
params.NewNetworkAppearance(1),
params.NewRoutingContext(2),
params.NewAffectedPointCode(3, 4),
params.NewInfoString("deadbeef"),
),
[]byte{
// Header
0x01, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x38,
// NetworkAppearance
0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
// RoutingContext
0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02,
// AffectedPointCode
0x00, 0x12, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
// InfoString
0x00, 0x04, 0x00, 0x0c, 0x64, 0x65, 0x61, 0x64, 0x62, 0x65, 0x65, 0x66,
},
},
}
runTests(t, cases, func(b []byte) (serializeable, error) {
v, err := DecodeDestinationStateAudit(b)
if err != nil {
return nil, err
}
v.Payload = nil
return v, nil
})
} | explode_data.jsonl/69240 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 508
} | [
2830,
3393,
33605,
1397,
74516,
1155,
353,
8840,
836,
8,
972,
1444,
2264,
1669,
3056,
66194,
1666,
197,
197,
1666,
298,
197,
1,
4648,
22346,
4723,
298,
197,
3564,
33605,
1397,
74516,
7805,
571,
25856,
7121,
12320,
29227,
7,
16,
9912,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAttrDeleteConfig_SetFlags(t *testing.T) {
actual := AttrDeleteConfig{}
cmdFlags := actual.GetPFlagSet("")
assert.True(t, cmdFlags.HasFlags())
t.Run("Test_attrFile", func(t *testing.T) {
t.Run("DefaultValue", func(t *testing.T) {
// Test that default value is set properly
if vString, err := cmdFlags.GetString("attrFile"); err == nil {
assert.Equal(t, string(DefaultDelConfig.AttrFile), vString)
} else {
assert.FailNow(t, err.Error())
}
})
t.Run("Override", func(t *testing.T) {
testValue := "1"
cmdFlags.Set("attrFile", testValue)
if vString, err := cmdFlags.GetString("attrFile"); err == nil {
testDecodeJson_AttrDeleteConfig(t, fmt.Sprintf("%v", vString), &actual.AttrFile)
} else {
assert.FailNow(t, err.Error())
}
})
})
} | explode_data.jsonl/57081 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 324
} | [
2830,
3393,
13371,
6435,
2648,
14812,
9195,
1155,
353,
8840,
836,
8,
341,
88814,
1669,
50943,
6435,
2648,
16094,
25920,
9195,
1669,
5042,
2234,
47,
12135,
1649,
31764,
6948,
32443,
1155,
11,
5439,
9195,
16152,
9195,
12367,
3244,
16708,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSubmitOrder(t *testing.T) {
TestSetRealOrderDefaults(t)
var orderSubmission = &order.Submit{
Pair: currency.Pair{
Base: currency.BTC,
Quote: currency.USD,
},
Side: order.Buy,
Type: order.Limit,
Price: -1,
Amount: 1,
ClientID: "meowOrder",
AssetType: asset.Spot,
}
response, err := o.SubmitOrder(orderSubmission)
if areTestAPIKeysSet() && (err != nil || !response.IsOrderPlaced) {
t.Errorf("Order failed to be placed: %v", err)
} else if !areTestAPIKeysSet() && err == nil {
t.Error("Expecting an error when no keys are set")
}
} | explode_data.jsonl/30200 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 243
} | [
2830,
3393,
8890,
4431,
1155,
353,
8840,
836,
8,
341,
73866,
1649,
12768,
4431,
16273,
1155,
340,
2405,
1973,
86621,
284,
609,
1358,
98309,
515,
197,
10025,
1310,
25,
11413,
1069,
1310,
515,
298,
66732,
25,
220,
11413,
1785,
7749,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestLoadDaemonConfigWithLegacyRegistryOptions(t *testing.T) {
content := `{"disable-legacy-registry": true}`
tempFile := tempfile.NewTempFile(t, "config", content)
defer tempFile.Remove()
opts := defaultOptions(tempFile.Name())
loadedConfig, err := loadDaemonCliConfig(opts)
assert.NilError(t, err)
assert.NotNil(t, loadedConfig)
assert.Equal(t, loadedConfig.V2Only, true)
} | explode_data.jsonl/12069 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 140
} | [
2830,
3393,
5879,
89177,
2648,
2354,
77415,
15603,
3798,
1155,
353,
8840,
836,
8,
341,
27751,
1669,
1565,
4913,
18015,
12,
39884,
12,
29172,
788,
830,
31257,
16280,
1703,
1669,
54819,
7121,
12151,
1703,
1155,
11,
330,
1676,
497,
2213,
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 TestContextFinalizer(t *testing.T) {
t.Parallel()
ctx := NewIsolate().NewContext()
fin := make(chan bool)
// Reset the finalizer so we test if it is working
runtime.SetFinalizer(ctx, nil)
runtime.SetFinalizer(ctx, func(ctx *Context) {
close(fin)
ctx.release()
})
ctx = nil
if !runGcUntilReceivedOrTimedOut(fin, 4*time.Second) {
t.Fatal("finalizer of ctx didn't run")
}
} | explode_data.jsonl/81587 | {
"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,
1972,
19357,
3135,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
20985,
1669,
1532,
3872,
33066,
1005,
3564,
1972,
2822,
1166,
258,
1669,
1281,
35190,
1807,
340,
197,
322,
16932,
279,
1590,
3135,
773,
582,
1273,
421,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateAndUseAccount(t *testing.T) {
ctx := accountFixture.Given(t)
ctx.
Name("test").
When().
Create().
Then().
And(func(account *account.Account, err error) {
assert.Equal(t, account.Name, ctx.GetName())
assert.Equal(t, account.Capabilities, []string{"login"})
}).
When().
Login().
Then().
CurrentUser(func(user *session.GetUserInfoResponse, err error) {
assert.Equal(t, user.LoggedIn, true)
assert.Equal(t, user.Username, ctx.GetName())
})
} | explode_data.jsonl/20983 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 200
} | [
2830,
3393,
4021,
3036,
10253,
7365,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2692,
18930,
1224,
2071,
1155,
340,
20985,
624,
197,
21297,
445,
1944,
38609,
197,
197,
4498,
25829,
197,
75569,
25829,
197,
197,
12209,
25829,
197,
197,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTypeSystem_ObjectsMustAdhereToInterfaceTheyImplement_AcceptsAnObjectWithASubtypedInterfaceField_Union(t *testing.T) {
anotherInterface := graphql.NewInterface(graphql.InterfaceConfig{
Name: "AnotherInterface",
ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object {
return nil
},
Fields: graphql.Fields{
"field": &graphql.Field{
Type: someUnionType,
},
},
})
anotherObject := graphql.NewObject(graphql.ObjectConfig{
Name: "AnotherObject",
Interfaces: []*graphql.Interface{anotherInterface},
Fields: graphql.Fields{
"field": &graphql.Field{
Type: someObjectType,
},
},
})
_, err := schemaWithFieldType(anotherObject)
if err != nil {
t.Fatalf(`unexpected error: %v for type "%v"`, err, anotherObject)
}
} | explode_data.jsonl/79200 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 294
} | [
2830,
3393,
929,
2320,
62,
11543,
31776,
2589,
6739,
1249,
5051,
6865,
62980,
1566,
66,
57771,
2082,
1190,
2354,
1911,
392,
44181,
5051,
1877,
62,
32658,
1155,
353,
8840,
836,
8,
341,
197,
41963,
5051,
1669,
48865,
7121,
5051,
24312,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTaskQueueTryDo_Serial_CalledInOrder(t *testing.T) {
v := validator{t: t}
tq := NewTaskQueue(5)
v.Add(3)
v.IsTrue(tq.TryDo(func() { v.Done("a") }))
v.IsTrue(tq.TryDo(func() { v.Done("b") }))
v.IsTrue(tq.TryDo(func() { v.Done("c") }))
v.Validate("abc")
} | explode_data.jsonl/22723 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 134
} | [
2830,
3393,
6262,
7554,
21453,
5404,
1098,
2848,
920,
4736,
641,
4431,
1155,
353,
8840,
836,
8,
341,
5195,
1669,
22935,
90,
83,
25,
259,
532,
3244,
80,
1669,
1532,
6262,
7554,
7,
20,
340,
5195,
1904,
7,
18,
340,
5195,
32672,
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 Test_FullLoggerNameGenerator_usesCustomizer(t *testing.T) {
before := FullLoggerNameCustomizer
defer func() { FullLoggerNameCustomizer = before }()
givenSomething := struct{ foo string }{"bar"}
called := false
FullLoggerNameCustomizer = func(something interface{}) string {
assert.ToBeEqual(t, givenSomething, something)
called = true
return "xyz"
}
actual := FullLoggerNameGenerator(givenSomething)
assert.ToBeEqual(t, true, called)
assert.ToBeEqual(t, "xyz", actual)
} | explode_data.jsonl/57919 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
1400,
617,
7395,
675,
12561,
62,
4776,
10268,
3135,
1155,
353,
8840,
836,
8,
341,
63234,
1669,
8627,
7395,
675,
10268,
3135,
198,
16867,
2915,
368,
314,
8627,
7395,
675,
10268,
3135,
284,
1573,
335,
2822,
3174,
2071,
23087,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRecordRaw(t *testing.T) {
b := bytes.Buffer{}
r := RecordRaw{W: &b}
if d := r.Duplex(); d != conn.Half {
t.Fatal(d)
}
if s := r.String(); s != "recordraw" {
t.Fatal(s)
}
if r.Tx(nil, []byte{0}) == nil {
t.Fatal("cannot accept read buffer")
}
if err := r.Tx([]byte{'a'}, nil); err != nil {
t.Fatal(err)
}
if s := b.String(); s != "a" {
t.Fatal(s)
}
} | explode_data.jsonl/44849 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 191
} | [
2830,
3393,
6471,
20015,
1155,
353,
8840,
836,
8,
341,
2233,
1669,
5820,
22622,
16094,
7000,
1669,
13583,
20015,
90,
54,
25,
609,
65,
532,
743,
294,
1669,
435,
909,
454,
2571,
2129,
294,
961,
4534,
3839,
3104,
341,
197,
3244,
26133,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestFreqProducesCorrectFrequencyTableForInput(t *testing.T) {
t.Parallel()
input := strings.Join([]string{
"apple",
"orange",
"banana",
"banana",
"apple",
"orange",
"kumquat",
"apple",
"orange",
"apple",
"banana",
"banana",
"apple",
"apple",
"orange",
"apple",
"apple",
"apple",
"apple",
}, "\n")
want := "10 apple\n 4 banana\n 4 orange\n 1 kumquat\n"
got, err := script.Echo(input).Freq().String()
if err != nil {
t.Error(err)
}
if want != got {
t.Error(cmp.Diff(want, got))
}
} | explode_data.jsonl/51481 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 254
} | [
2830,
3393,
55096,
49112,
33092,
38614,
2556,
2461,
2505,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
22427,
1669,
9069,
22363,
10556,
917,
515,
197,
197,
1,
22377,
756,
197,
197,
1,
34164,
756,
197,
197,
1,
87747,
756,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestGetRawTransaction(t *testing.T) {
client := neorpc.NewClient("http://localhost:30333")
if client == nil {
t.Fail()
}
txID := "bde02f8c6482e23d5b465259e3e438f0acacaba2a7a938d5eecd90bba0e9d1ad"
result := client.GetRawTransaction(txID)
log.Printf("%+v", result)
} | explode_data.jsonl/9988 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 126
} | [
2830,
3393,
1949,
20015,
8070,
1155,
353,
8840,
836,
8,
1476,
25291,
1669,
834,
269,
3992,
7121,
2959,
445,
1254,
1110,
8301,
25,
18,
15,
18,
18,
18,
1138,
743,
2943,
621,
2092,
341,
197,
3244,
57243,
741,
197,
532,
46237,
915,
1669... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestBuildCreateNoCache(t *testing.T) {
testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {
b1 := fxBuild
var b2 structs.Build
opts := structs.BuildCreateOptions{
Description: options.String("description"),
Manifest: options.String("manifest"),
NoCache: options.Bool(true),
}
ro := stdsdk.RequestOptions{
Params: stdsdk.Params{
"description": "description",
"manifest": "manifest",
"no-cache": "true",
"url": "https://host/path",
},
}
p.On("BuildCreate", "app1", "https://host/path", opts).Return(&b1, nil)
err := c.Post("/apps/app1/builds", ro, &b2)
require.NoError(t, err)
require.Equal(t, b1, b2)
})
} | explode_data.jsonl/71415 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 313
} | [
2830,
3393,
11066,
4021,
2753,
8233,
1155,
353,
8840,
836,
8,
341,
18185,
5475,
1155,
11,
2915,
1337,
353,
1834,
51295,
11716,
11,
281,
353,
1235,
82,
24664,
5179,
8,
341,
197,
2233,
16,
1669,
33219,
11066,
198,
197,
2405,
293,
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 TestRecordsAdd(t *testing.T) {
rs := records([]*record{
newRecord("rls-a.v1", releaseStub("rls-a", 1, "default", rspb.Status_SUPERSEDED)),
newRecord("rls-a.v2", releaseStub("rls-a", 2, "default", rspb.Status_DEPLOYED)),
})
var tests = []struct {
desc string
key string
ok bool
rec *record
}{
{
"add valid key",
"rls-a.v3",
false,
newRecord("rls-a.v3", releaseStub("rls-a", 3, "default", rspb.Status_SUPERSEDED)),
},
{
"add already existing key",
"rls-a.v1",
true,
newRecord("rls-a.v1", releaseStub("rls-a", 1, "default", rspb.Status_DEPLOYED)),
},
}
for _, tt := range tests {
if err := rs.Add(tt.rec); err != nil {
if !tt.ok {
t.Fatalf("failed: %q: %s\n", tt.desc, err)
}
}
}
} | explode_data.jsonl/45341 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 376
} | [
2830,
3393,
25876,
2212,
1155,
353,
8840,
836,
8,
341,
41231,
1669,
7424,
85288,
8548,
515,
197,
8638,
6471,
445,
2381,
82,
7409,
3133,
16,
497,
4879,
33838,
445,
2381,
82,
7409,
497,
220,
16,
11,
330,
2258,
497,
42160,
65,
10538,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestChatIsPrivate(t *testing.T) {
chat := tgbotapi.Chat{ID: 10, Type: "private"}
if chat.IsPrivate() != true {
t.Fail()
}
} | explode_data.jsonl/25809 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 56
} | [
2830,
3393,
15672,
3872,
16787,
1155,
353,
8840,
836,
8,
341,
197,
9686,
1669,
53188,
6331,
2068,
58844,
90,
915,
25,
220,
16,
15,
11,
3990,
25,
330,
1996,
63159,
743,
6236,
4506,
16787,
368,
961,
830,
341,
197,
3244,
57243,
741,
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
] | 2 |
func Test_Hoverfly_GetSimulation_ReturnsMultipleDelays(t *testing.T) {
RegisterTestingT(t)
unit := NewHoverflyWithConfiguration(&Configuration{})
delay1 := models.ResponseDelay{
UrlPattern: "test-pattern",
Delay: 100,
}
delay2 := models.ResponseDelay{
HttpMethod: "test",
Delay: 200,
}
responseDelays := models.ResponseDelayList{delay1, delay2}
unit.Simulation.ResponseDelays = &responseDelays
simulation, err := unit.GetSimulation()
Expect(err).To(BeNil())
Expect(simulation.DataViewV5.GlobalActions.Delays).To(HaveLen(2))
Expect(simulation.DataViewV5.GlobalActions.Delays[0].UrlPattern).To(Equal("test-pattern"))
Expect(simulation.DataViewV5.GlobalActions.Delays[0].HttpMethod).To(Equal(""))
Expect(simulation.DataViewV5.GlobalActions.Delays[0].Delay).To(Equal(100))
Expect(simulation.DataViewV5.GlobalActions.Delays[1].UrlPattern).To(Equal(""))
Expect(simulation.DataViewV5.GlobalActions.Delays[1].HttpMethod).To(Equal("test"))
Expect(simulation.DataViewV5.GlobalActions.Delays[1].Delay).To(Equal(200))
} | explode_data.jsonl/45369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 400
} | [
2830,
3393,
2039,
1975,
21642,
13614,
64554,
53316,
82,
32089,
16532,
942,
1155,
353,
8840,
836,
8,
341,
79096,
16451,
51,
1155,
692,
81189,
1669,
1532,
34379,
21642,
2354,
7688,
2099,
7688,
6257,
692,
55174,
16,
1669,
4119,
12574,
20039,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGCChunkAccess(t *testing.T) {
// Put a chunk, select it. GC it and then access it.
h, err := NewHead(nil, nil, nil, 1000)
testutil.Ok(t, err)
defer h.Close()
h.initTime(0)
s, _ := h.getOrCreate(1, labels.FromStrings("a", "1"))
s.chunks = []*memChunk{
{minTime: 0, maxTime: 999},
{minTime: 1000, maxTime: 1999},
}
idx := h.indexRange(0, 1500)
var (
lset labels.Labels
chunks []chunks.Meta
)
testutil.Ok(t, idx.Series(1, &lset, &chunks))
testutil.Equals(t, labels.Labels{{
Name: "a", Value: "1",
}}, lset)
testutil.Equals(t, 2, len(chunks))
cr := h.chunksRange(0, 1500)
_, err = cr.Chunk(chunks[0].Ref)
testutil.Ok(t, err)
_, err = cr.Chunk(chunks[1].Ref)
testutil.Ok(t, err)
testutil.Ok(t, h.Truncate(1500)) // Remove a chunk.
_, err = cr.Chunk(chunks[0].Ref)
testutil.Equals(t, ErrNotFound, err)
_, err = cr.Chunk(chunks[1].Ref)
testutil.Ok(t, err)
} | explode_data.jsonl/38168 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 422
} | [
2830,
3393,
22863,
28304,
6054,
1155,
353,
8840,
836,
8,
341,
197,
322,
10224,
264,
11879,
11,
3293,
432,
13,
22381,
432,
323,
1221,
2615,
432,
624,
9598,
11,
1848,
1669,
1532,
12346,
27907,
11,
2092,
11,
2092,
11,
220,
16,
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... | 1 |
func TestMatMerge(t *testing.T) {
src := NewMatWithSize(101, 102, MatTypeCV8U)
src2 := NewMatWithSize(101, 102, MatTypeCV8U)
src3 := NewMatWithSize(101, 102, MatTypeCV8U)
dst := NewMat()
Merge([]Mat{src, src2, src3}, &dst)
if dst.Empty() {
t.Error("TestMatMerge dst should not be empty.")
}
} | explode_data.jsonl/81714 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
11575,
52096,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
1532,
11575,
2354,
1695,
7,
16,
15,
16,
11,
220,
16,
15,
17,
11,
6867,
929,
19589,
23,
52,
340,
41144,
17,
1669,
1532,
11575,
2354,
1695,
7,
16,
15,
16,
11,
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... | 2 |
func Test_SetConfig_ValidatesAlertmanagerConfig(t *testing.T) {
setup(t)
defer cleanup(t)
userID := makeUserID()
for i, test := range amCfgValidationTests {
cfg := userconfig.Config{AlertmanagerConfig: test.config}
resp := requestAsUser(t, userID, "POST", "/api/prom/configs/alertmanager", "", readerFromConfig(t, cfg))
if !test.shouldFail {
assert.Equal(t, http.StatusNoContent, resp.Code, "test case %d", i)
continue
}
assert.Equal(t, http.StatusBadRequest, resp.Code, "test case %d", i)
assert.Contains(t, resp.Body.String(), test.errContains, "test case %d", i)
}
} | explode_data.jsonl/37318 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 226
} | [
2830,
3393,
14812,
2648,
97279,
973,
9676,
13297,
2648,
1155,
353,
8840,
836,
8,
341,
84571,
1155,
340,
16867,
21290,
1155,
692,
19060,
915,
1669,
1281,
36899,
741,
2023,
600,
11,
1273,
1669,
2088,
1079,
42467,
13799,
18200,
341,
197,
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 TestContainer(t *testing.T) {
ctx := context.Background()
c, rollback := makeConnectionWithContainer(t)
defer rollback()
info, headers, err := c.Container(ctx, CONTAINER)
if err != nil {
t.Fatal(err)
}
compareMaps(t, headers.ContainerMetadata(), map[string]string{"hello": "1", "potato-salad": "2"})
if CONTAINER != info.Name {
t.Error("Bad container count")
}
if headers["X-Container-Bytes-Used"] != fmt.Sprintf("%d", info.Bytes) {
t.Error("Bad bytes count")
}
if headers["X-Container-Object-Count"] != fmt.Sprintf("%d", info.Count) {
t.Error("Bad objects count")
}
} | explode_data.jsonl/12664 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 223
} | [
2830,
3393,
4502,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
1444,
11,
60414,
1669,
1281,
4526,
2354,
4502,
1155,
340,
16867,
60414,
741,
27043,
11,
7102,
11,
1848,
1669,
272,
33672,
7502,
11,
16120,
34521,
340,
743,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestBatch(t *testing.T) {
const (
initialTreasuryTokens uint64 = 10_000_000_000
migratedFundsCount = 127 + 128 + 1
migrationTokens uint64 = 1_000_000
totalMigrationTokens = migratedFundsCount * migrationTokens
)
// receipts per migrated at index
receipts := map[uint32]int{1: 1, 2: 2, 3: 1}
var totalReceipts int
for _, n := range receipts {
totalReceipts += n
}
n, err := f.CreateStaticNetwork("test_migration_batch", &framework.IntegrationNetworkConfig{
SpawnWhiteFlagMockServer: true,
WhiteFlagMockServerConfig: framework.DefaultWhiteFlagMockServerConfig("wfmock_batch", "wfmock_config_batch.json"),
}, framework.DefaultStaticPeeringLayout(), func(index int, cfg *framework.AppConfig) {
cfg.Receipts.IgnoreSoftErrors = false
cfg.Receipts.Validate = true
cfg.Receipts.Validator.APIAddress = "http://wfmock_batch:14265"
cfg.Receipts.Validator.APITimeout = 5 * time.Second
cfg.Receipts.Validator.CoordinatorAddress = "QYO9OXGLVLUKMCEONVAPEWXUFQTGTTHPZZOTOFHYUFVPJJLLFAYBIOFMTUSVXVRQFSUIQXJUGZQDDDULY"
cfg.Receipts.Validator.CoordinatorMerkleTreeDepth = 8
switch {
case index == 0:
cfg.WithReceipts()
cfg.INXCoo.Validator = cfg.Receipts.Validator
cfg.INXCoo.Migrator.StartIndex = 1
default:
cfg.Plugins.Enabled = append(cfg.Plugins.Enabled, "Receipts")
}
cfg.Snapshot.FullSnapshotFilePath = "/assets/migration_full_snapshot.bin"
cfg.Snapshot.DeltaSnapshotFilePath = "/assets/migration_delta_snapshot.bin" // doesn't exist so the node will only load the full one
})
require.NoError(t, err)
defer framework.ShutdownNetwork(t, n)
syncCtx, syncCtxCancel := context.WithTimeout(context.Background(), 30*time.Second)
defer syncCtxCancel()
assert.NoError(t, n.AwaitAllSync(syncCtx))
// eventually all migrations should have happened
log.Println("waiting for treasury to be reduced to correct amount after migrations...")
require.Eventually(t, func() bool {
treasury, err := n.Coordinator().DebugNodeAPIClient.Treasury(context.Background())
if err != nil {
log.Printf("failed to get current treasury: %s", err)
return false
}
amount, err := iotago.DecodeUint64(treasury.Amount)
if err != nil {
log.Printf("failed to decode treasury amount: %s", err)
return false
}
return amount == initialTreasuryTokens-totalMigrationTokens
}, 2*time.Minute, time.Second)
// checking that funds were migrated in appropriate receipts
log.Println("checking receipts...")
receiptTuples, err := n.Coordinator().DebugNodeAPIClient.Receipts(context.Background())
require.NoError(t, err)
require.Lenf(t, receiptTuples, totalReceipts, "expected %d receipts in total", totalReceipts)
for migratedAt, numReceipts := range receipts {
receiptTuples, err := n.Coordinator().DebugNodeAPIClient.ReceiptsByMigratedAtIndex(context.Background(), migratedAt)
require.NoError(t, err)
require.Lenf(t, receiptTuples, numReceipts, "expected %d receipts for index %d", totalReceipts, migratedAt)
}
// check that indeed the funds were correctly minted
log.Println("checking that migrated funds are available...")
for i := 0; i < migratedFundsCount; i++ {
var addr iotago.Ed25519Address
binary.LittleEndian.PutUint32(addr[:], uint32(i))
balance, err := n.Coordinator().DebugNodeAPIClient.BalanceByAddress(context.Background(), &addr)
require.NoError(t, err)
require.EqualValues(t, migrationTokens, balance)
}
} | explode_data.jsonl/33442 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1256
} | [
2830,
3393,
21074,
1155,
353,
8840,
836,
8,
341,
4777,
2399,
197,
85270,
65775,
26102,
29300,
2622,
21,
19,
284,
220,
16,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
198,
197,
2109,
94830,
37,
42950,
2507,
1843,
284,
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... | 2 |
func TestAccountUUIDMiddlewareWithDisabledAccount(t *testing.T) {
svcCache.Invalidate(AccountsKey, "failure")
next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
m := AccountUUID(
Logger(log.NewLogger()),
TokenManagerConfig(config.TokenManager{JWTSecret: "secret"}),
AccountsClient(mockAccountUUIDMiddlewareAccSvc(false, false)),
SettingsRoleService(mockAccountUUIDMiddlewareRolesSvc(false)),
)(next)
r := httptest.NewRequest(http.MethodGet, "http://www.example.com", nil)
w := httptest.NewRecorder()
ctx := oidc.NewContext(r.Context(), &oidc.StandardClaims{Email: "failure"})
r = r.WithContext(ctx)
m.ServeHTTP(w, r)
rsp := w.Result()
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusUnauthorized {
t.Errorf("expected a disabled account to be unauthorized, got: %d", rsp.StatusCode)
}
} | explode_data.jsonl/33792 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 314
} | [
2830,
3393,
7365,
24754,
24684,
2354,
25907,
7365,
1155,
353,
8840,
836,
8,
341,
1903,
7362,
8233,
5337,
7067,
65360,
82,
1592,
11,
330,
28939,
1138,
28144,
1669,
1758,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
35248... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPacketICMPv6RouterAdvertisement(t *testing.T) {
p := gopacket.NewPacket(testPacketICMPv6RouterAdvertisement, LinkTypeEthernet, gopacket.Default)
if p.ErrorLayer() != nil {
t.Error("Failed to decode packet:", p.ErrorLayer().Error())
}
checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeIPv6, LayerTypeICMPv6, LayerTypeICMPv6RouterAdvertisement}, t)
} | explode_data.jsonl/80130 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 138
} | [
2830,
3393,
16679,
1317,
5781,
85,
21,
9523,
13582,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
342,
453,
5709,
7121,
16679,
8623,
16679,
1317,
5781,
85,
21,
9523,
13582,
11,
5948,
929,
98006,
11,
342,
453,
5709,
13275,
340,
743,
281,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAppWithSecrets(t *testing.T) {
closer, client, err := ArgoCDClientset.NewApplicationClient()
assert.NoError(t, err)
defer io.Close(closer)
Given(t).
Path("secrets").
When().
Create().
Sync().
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
res := FailOnErr(client.GetResource(context.Background(), &applicationpkg.ApplicationResourceRequest{
Namespace: app.Spec.Destination.Namespace,
Kind: kube.SecretKind,
Group: "",
Name: &app.Name,
Version: "v1",
ResourceName: "test-secret",
})).(*applicationpkg.ApplicationResourceResponse)
assetSecretDataHidden(t, res.Manifest)
manifests, err := client.GetManifests(context.Background(), &applicationpkg.ApplicationManifestQuery{Name: &app.Name})
errors.CheckError(err)
for _, manifest := range manifests.Manifests {
assetSecretDataHidden(t, manifest)
}
diffOutput := FailOnErr(RunCli("app", "diff", app.Name)).(string)
assert.Empty(t, diffOutput)
// patch secret and make sure app is out of sync and diff detects the change
FailOnErr(KubeClientset.CoreV1().Secrets(DeploymentNamespace()).Patch(context.Background(),
"test-secret", types.JSONPatchType, []byte(`[
{"op": "remove", "path": "/data/username"},
{"op": "add", "path": "/stringData", "value": {"password": "foo"}}
]`), metav1.PatchOptions{}))
}).
When().
Refresh(RefreshTypeNormal).
Then().
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
And(func(app *Application) {
diffOutput, err := RunCli("app", "diff", app.Name)
assert.Error(t, err)
assert.Contains(t, diffOutput, "username: ++++++++")
assert.Contains(t, diffOutput, "password: ++++++++++++")
// local diff should ignore secrets
diffOutput = FailOnErr(RunCli("app", "diff", app.Name, "--local", "testdata/secrets")).(string)
assert.Empty(t, diffOutput)
// ignore missing field and make sure diff shows no difference
app.Spec.IgnoreDifferences = []ResourceIgnoreDifferences{{
Kind: kube.SecretKind, JSONPointers: []string{"/data"},
}}
FailOnErr(client.UpdateSpec(context.Background(), &applicationpkg.ApplicationUpdateSpecRequest{Name: &app.Name, Spec: app.Spec}))
}).
When().
Refresh(RefreshTypeNormal).
Then().
Expect(OperationPhaseIs(OperationSucceeded)).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
diffOutput := FailOnErr(RunCli("app", "diff", app.Name)).(string)
assert.Empty(t, diffOutput)
})
} | explode_data.jsonl/66676 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 953
} | [
2830,
3393,
2164,
2354,
19773,
82,
1155,
353,
8840,
836,
8,
341,
1444,
69215,
11,
2943,
11,
1848,
1669,
1644,
3346,
6484,
2959,
746,
7121,
4988,
2959,
741,
6948,
35699,
1155,
11,
1848,
340,
16867,
6399,
10421,
1337,
69215,
692,
9600,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHashJoiner(t *testing.T) {
defer leaktest.AfterTest(t)()
ctx := context.Background()
st := cluster.MakeTestingClusterSettings()
evalCtx := tree.MakeTestingEvalContext(st)
defer evalCtx.Stop(ctx)
flowCtx := &runbase.FlowCtx{
EvalCtx: &evalCtx,
Cfg: &runbase.ServerConfig{Settings: st},
}
for _, outputBatchSize := range []uint16{1, 17, coldata.BatchSize()} {
for _, tc := range tcs {
inputs := []tuples{tc.leftTuples, tc.rightTuples}
typs := [][]coltypes.T{tc.leftTypes, tc.rightTypes}
runTestsWithTyps(t, inputs, typs, tc.expectedTuples, unorderedVerifier, func(sources []Operator) (Operator, error) {
spec := createSpecForHashJoiner(tc)
args := NewColOperatorArgs{
Spec: spec,
Inputs: sources,
StreamingMemAccount: testMemAcc,
UseStreamingMemAccountForBuffering: true,
}
result, err := NewColOperator(ctx, flowCtx, args)
if err != nil {
return nil, err
}
if hj, ok := result.Op.(*hashJoinEqOp); ok {
hj.outputBatchSize = outputBatchSize
}
return result.Op, nil
})
}
}
} | explode_data.jsonl/4246 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 539
} | [
2830,
3393,
6370,
12292,
261,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
20985,
1669,
2266,
19047,
741,
18388,
1669,
10652,
50133,
16451,
28678,
6086,
741,
93413,
23684,
1669,
4916,
50133,
16451,
54469,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestKustomize(t *testing.T) {
testCase := &tests.KustomizeTestCase{
Package: "../../../../istio/add-anonymous-user-filter/base",
Expected: "test_data/expected",
}
tests.RunTestCase(t, testCase)
} | explode_data.jsonl/9261 | {
"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,
42,
1450,
551,
1155,
353,
8840,
836,
8,
341,
18185,
4207,
1669,
609,
23841,
11352,
1450,
551,
16458,
515,
197,
10025,
1434,
25,
220,
63392,
380,
815,
19627,
18883,
9757,
8694,
32448,
26090,
756,
197,
197,
18896,
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 |
func TestItemInSlice(t *testing.T) {
item := "this"
list := []string{"hello", "brah"}
result := itemInSlice("goodbye", list)
if result {
t.Error(fmt.Sprintf("'%s' should not have been found in slice.", item))
}
item = "hello"
result = itemInSlice(item, list)
if !result {
t.Error(fmt.Sprintf("'%s' should have been found in slice.", item))
}
} | explode_data.jsonl/31664 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 140
} | [
2830,
3393,
1234,
641,
33236,
1155,
353,
8840,
836,
8,
341,
22339,
1669,
330,
574,
698,
14440,
1669,
3056,
917,
4913,
14990,
497,
330,
14383,
71,
16707,
9559,
1669,
1509,
641,
33236,
445,
18536,
28374,
497,
1140,
340,
743,
1102,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestIsCheckmate(t *testing.T) {
tests := []struct {
sfen string
checkmate bool
}{
{"ln3k2l/3R5/p1p4p1/2s5p/6Pn1/4P1b1P/L+pPP3s1/3s3K1/1N2+s+r1NL b B4GP7p 1", true},
{"lR2+R2+B1/+N3kg3/pPPp4p/3spsN2/5p1K1/Pp2S3P/n1N2P2L/3P5/L8 w B2GS6Pgl 1", true},
{"ln7/2+R6/p1pppp1+Bp/1Nn6/L1S+b5/S1k6/P1LPP3P/1GG2P1P1/1N2KGS1L w GPrs5p 1", true},
{"ln7/2+R6/p1pppp1+Bp/1Nn6/L1S+b5/S1k6/P1PPP3P/1GG2P1P1/1N2KGS1L w GPrs5p 1", false},
{"8k/8P/7+R1/9/9/9/9/9/9 w - 1", true},
{"8k/8P/7R1/9/9/9/9/9/9 w - 1", false},
{"lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1", false},
}
for _, test := range tests {
p, err := NewPositionFromSFEN(test.sfen)
if err != nil {
t.Fatal(err)
}
if p.IsCheckmate() != test.checkmate {
t.Errorf("%v.IsCheckmate(): want %v, got %v", test.sfen, test.checkmate, p.IsCheckmate())
}
}
} | explode_data.jsonl/40642 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 553
} | [
2830,
3393,
3872,
3973,
18052,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
1903,
30353,
414,
914,
198,
197,
25157,
18052,
1807,
198,
197,
59403,
197,
197,
4913,
2261,
18,
74,
17,
75,
14,
18,
49,
20,
4322,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestCompressionHCLevels(t *testing.T) {
input, err := ioutil.ReadFile("sample.txt")
if err != nil {
t.Fatal(err)
}
cases := []struct {
Level int
Outsize int
}{
{0, 4317},
{1, 4415},
{2, 4359},
{3, 4339},
{4, 4321},
{5, 4317},
{6, 4317},
{7, 4317},
{8, 4317},
{9, 4317},
{10, 4317},
{11, 4317},
{12, 4317},
{13, 4317},
{14, 4317},
{15, 4317},
{16, 4317},
}
for _, tt := range cases {
output := make([]byte, CompressBound(input))
outSize, err := CompressHCLevel(output, input, tt.Level)
if err != nil {
t.Fatal(err)
}
if want := tt.Outsize; want != outSize {
t.Errorf("HC level %d length != expected: %d != %d",
tt.Level, want, outSize)
}
}
} | explode_data.jsonl/62978 | {
"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,
81411,
22455,
46991,
1155,
353,
8840,
836,
8,
341,
22427,
11,
1848,
1669,
43144,
78976,
445,
13611,
3909,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
630,
1444,
2264,
1669,
3056,
1235,
341,
197,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestEncodeMutationArray(t *testing.T) {
for _, test := range []struct {
name string
ms []*Mutation
want []*sppb.Mutation
wantErr error
}{
{
"Multiple Mutations",
[]*Mutation{
&Mutation{opDelete, "t_test", Key{"bar"}, nil, nil},
&Mutation{opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}},
},
[]*sppb.Mutation{
&sppb.Mutation{
Operation: &sppb.Mutation_Delete_{
Delete: &sppb.Mutation_Delete{
Table: "t_test",
KeySet: &sppb.KeySet{
Keys: []*proto3.ListValue{listValueProto(stringProto("bar"))},
},
},
},
},
&sppb.Mutation{
Operation: &sppb.Mutation_InsertOrUpdate{
InsertOrUpdate: &sppb.Mutation_Write{
Table: "t_test",
Columns: []string{"key", "val"},
Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))},
},
},
},
},
nil,
},
{
"Multiple Mutations - Bad Mutation",
[]*Mutation{
&Mutation{opDelete, "t_test", Key{"bar"}, nil, nil},
&Mutation{opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", struct{}{}}},
},
[]*sppb.Mutation{},
errEncoderUnsupportedType(struct{}{}),
},
} {
gotProto, gotErr := mutationsProto(test.ms)
if gotErr != nil {
if !reflect.DeepEqual(gotErr, test.wantErr) {
t.Errorf("%v: mutationsProto(%v) returns error %v, want %v", test.name, test.ms, gotErr, test.wantErr)
}
continue
}
if !reflect.DeepEqual(gotProto, test.want) {
t.Errorf("%v: mutationsProto(%v) = (%v, nil), want (%v, nil)", test.name, test.ms, gotProto, test.want)
}
}
} | explode_data.jsonl/50038 | {
"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,
32535,
53998,
1857,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
11609,
262,
914,
198,
197,
47691,
414,
29838,
53998,
198,
197,
50780,
262,
29838,
82,
602,
65,
1321,
22705,
198,
197,
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... | 5 |
func TestAttributeMap_UpdateWithNilValues(t *testing.T) {
origWithNil := []*otlpcommon.KeyValue{
nil,
{
Key: "test_key",
Value: &otlpcommon.AnyValue{Value: &otlpcommon.AnyValue_StringValue{StringValue: "test_value"}},
},
nil,
{
Key: "test_key2",
Value: nil,
},
nil,
{
Key: "test_key3",
Value: &otlpcommon.AnyValue{Value: nil},
},
}
sm := AttributeMap{
orig: &origWithNil,
}
av, exists := sm.Get("test_key")
assert.True(t, exists)
assert.EqualValues(t, AttributeValueSTRING, av.Type())
assert.EqualValues(t, "test_value", av.StringVal())
av.SetIntVal(123)
av2, exists := sm.Get("test_key")
assert.True(t, exists)
assert.EqualValues(t, AttributeValueINT, av2.Type())
assert.EqualValues(t, 123, av2.IntVal())
av, exists = sm.Get("test_key2")
assert.True(t, exists)
assert.EqualValues(t, AttributeValueNULL, av.Type())
assert.EqualValues(t, "", av.StringVal())
av.SetIntVal(123)
av2, exists = sm.Get("test_key2")
assert.True(t, exists)
assert.EqualValues(t, AttributeValueINT, av2.Type())
assert.EqualValues(t, 123, av2.IntVal())
av, exists = sm.Get("test_key3")
assert.True(t, exists)
assert.EqualValues(t, AttributeValueNULL, av.Type())
assert.EqualValues(t, "", av.StringVal())
av.SetBoolVal(true)
av2, exists = sm.Get("test_key3")
assert.True(t, exists)
assert.EqualValues(t, AttributeValueBOOL, av2.Type())
assert.EqualValues(t, true, av2.BoolVal())
} | explode_data.jsonl/38204 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 613
} | [
2830,
3393,
3907,
2227,
47393,
2354,
19064,
6227,
1155,
353,
8840,
836,
8,
341,
197,
4670,
2354,
19064,
1669,
29838,
354,
13545,
5464,
9610,
1130,
515,
197,
84131,
345,
197,
197,
515,
298,
55242,
25,
256,
330,
1944,
3097,
756,
298,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAccDataSourceKeyVaultKey_complete(t *testing.T) {
data := acceptance.BuildTestData(t, "data.azurerm_key_vault_key", "test")
r := KeyVaultKeyDataSource{}
data.DataSourceTest(t, []acceptance.TestStep{
{
Config: r.complete(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("key_type").HasValue("RSA"),
check.That(data.ResourceName).Key("tags.%").HasValue("1"),
check.That(data.ResourceName).Key("tags.hello").HasValue("world"),
),
},
})
} | explode_data.jsonl/51557 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 198
} | [
2830,
3393,
14603,
17173,
1592,
79177,
1592,
27675,
1155,
353,
8840,
836,
8,
341,
8924,
1669,
25505,
25212,
83920,
1155,
11,
330,
691,
13,
1370,
324,
4195,
3097,
2273,
945,
3097,
497,
330,
1944,
1138,
7000,
1669,
5309,
79177,
1592,
1717... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNodeCommand(t *testing.T) {
dir := testutils.InitTestEnv(ModuleName, t)
c, mgr, driver := initTestContext(t, dir)
defer driver.Close()
defer c.Close()
defer mgr.Stop()
schema := catalog.MockSchemaAll(14)
schema.BlockMaxRows = 10000
schema.SegmentMaxBlocks = 10
schema.PrimaryKey = 13
bat := compute.MockBatch(schema.Types(), 15000, int(schema.PrimaryKey), nil)
txn := mgr.StartTxn(nil)
db, _ := txn.CreateDatabase("db")
rel, _ := db.CreateRelation(schema)
table, _ := txn.GetStore().(*txnStore).getOrSetTable(rel.ID())
tbl := table.(*txnTable)
err := tbl.Append(bat)
assert.Nil(t, err)
err = tbl.RangeDeleteLocalRows(100, 200)
assert.Nil(t, err)
for i, inode := range tbl.inodes {
cmd, entry, err := inode.MakeCommand(uint32(i), false)
assert.Nil(t, err)
if i == 0 {
assert.Equal(t, 2, len(cmd.(*AppendCmd).Cmds))
} else {
assert.Equal(t, 1, len(cmd.(*AppendCmd).Cmds))
}
if entry != nil {
entry.WaitDone()
entry.Free()
}
t.Log(cmd.String())
}
} | explode_data.jsonl/14644 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 440
} | [
2830,
3393,
1955,
4062,
1155,
353,
8840,
836,
8,
341,
48532,
1669,
1273,
6031,
26849,
2271,
14359,
75295,
675,
11,
259,
340,
1444,
11,
57897,
11,
5579,
1669,
2930,
2271,
1972,
1155,
11,
5419,
340,
16867,
5579,
10421,
741,
16867,
272,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAPIReposGitCommitListDifferentBranch(t *testing.T) {
defer prepareTestEnv(t)()
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
// Login as User2.
session := loginUser(t, user.Name)
token := getTokenForLoggedInUser(t, session)
// Test getting commits (Page=1, Branch=good-sign)
req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo16/commits?token="+token+"&sha=good-sign", user.Name)
resp := session.MakeRequest(t, req, http.StatusOK)
var apiData []api.Commit
DecodeJSON(t, resp, &apiData)
assert.Equal(t, 1, len(apiData))
assert.Equal(t, "f27c2b2b03dcab38beaf89b0ab4ff61f6de63441", apiData[0].CommitMeta.SHA)
} | explode_data.jsonl/2220 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 276
} | [
2830,
3393,
7082,
693,
966,
46562,
33441,
852,
69123,
18197,
1155,
353,
8840,
836,
8,
341,
16867,
10549,
2271,
14359,
1155,
8,
741,
19060,
1669,
4119,
11711,
15575,
3036,
5879,
10437,
1155,
11,
609,
6507,
7344,
90,
915,
25,
220,
17,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestProcessEvent(t *testing.T) {
bucket := e.S3Bucket{Name: "io.kubesure-esyhealth-policy-issued-dev"}
object := e.S3Object{Key: "unprocessed/1234567890.pdf"}
r := e.S3EventRecord{}
r.S3.Bucket = bucket
r.S3.Object = object
err := processEvent(r)
if err != nil {
t.Errorf("S3 Event Processed %v", err)
}
} | explode_data.jsonl/67071 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 150
} | [
2830,
3393,
75002,
1155,
353,
8840,
836,
8,
972,
2233,
11152,
1669,
384,
808,
18,
36018,
63121,
25,
330,
815,
5202,
50625,
552,
31854,
88,
12120,
66420,
12,
58226,
25758,
1,
1771,
35798,
1669,
384,
808,
18,
1190,
90,
1592,
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... | 2 |
func TestOption_WithUserAgent(t *testing.T) {
v := "beego"
client, err := NewClient("test", "http://httpbin.org/",
WithUserAgent(v))
if err != nil {
t.Fatal(err)
}
resp := &respCarrier{}
err = client.Get(resp, "/headers")
if err != nil {
t.Fatal(err)
}
t.Log(resp.String())
n := strings.Index(resp.String(), v)
if n == -1 {
t.Fatal(v + " not found in user-agent")
}
} | explode_data.jsonl/68687 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 171
} | [
2830,
3393,
5341,
62,
2354,
1474,
16810,
1155,
353,
8840,
836,
8,
341,
5195,
1669,
330,
1371,
13243,
698,
25291,
11,
1848,
1669,
1532,
2959,
445,
1944,
497,
330,
1254,
1110,
1254,
6863,
2659,
35075,
197,
197,
2354,
1474,
16810,
3747,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSuggestPrice(t *testing.T) {
backend := &TestBackend{
block: 1,
totalGasPowerLeft: 0,
rules: photon.FakeNetRules(),
pendingRules: photon.FakeNetRules(),
}
gpo := NewOracle(backend, Config{})
maxMul := big.NewInt(10 * DecimalUnit)
gpo.cfg.MiddlePriceMultiplierRatio = big.NewInt(2 * DecimalUnit)
gpo.cfg.MaxPriceMultiplierRatio = maxMul
// all the gas is consumed, price should be high
require.Equal(t, "10000000000", gpo.SuggestPrice().String())
// increase MaxPriceMultiplierRatio
maxMul = big.NewInt(100 * DecimalUnit)
gpo.cfg.MaxPriceMultiplierRatio = maxMul
// test the cache as well
require.Equal(t, "10000000000", gpo.SuggestPrice().String())
backend.block++
require.Equal(t, "100000000000", gpo.SuggestPrice().String())
backend.block++
// all the gas is free, price should be low
backend.totalGasPowerLeft = gpo.maxTotalGasPower().Uint64()
require.Equal(t, uint64(0x92aeed1c000), backend.totalGasPowerLeft)
require.Equal(t, "1000000000", gpo.SuggestPrice().String())
backend.block++
// edge case with totalGasPowerLeft exceeding maxTotalGasPower
backend.totalGasPowerLeft = 2 * gpo.maxTotalGasPower().Uint64()
require.Equal(t, "1000000000", gpo.SuggestPrice().String())
backend.block++
// half of the gas is free, price should be 2x
backend.totalGasPowerLeft = gpo.maxTotalGasPower().Uint64() / 2
require.Equal(t, "2000000000", gpo.SuggestPrice().String())
backend.block++
// third of the gas is free, price should be higher
backend.totalGasPowerLeft = gpo.maxTotalGasPower().Uint64() / 3
require.Equal(t, "34666830000", gpo.SuggestPrice().String())
backend.block++
// check the 5% wall
gpo.cfg.GasPowerWallRatio = big.NewInt(DecimalUnit / 20)
require.Equal(t, "41543980000", gpo.SuggestPrice().String())
backend.block++
// check the 10% wall
gpo.cfg.GasPowerWallRatio = big.NewInt(DecimalUnit / 10)
require.Equal(t, "49185334000", gpo.SuggestPrice().String())
backend.block++
// check the 20% wall
gpo.cfg.GasPowerWallRatio = big.NewInt(DecimalUnit / 5)
require.Equal(t, "67333464000", gpo.SuggestPrice().String())
backend.block++
// check the 33.3% wall
gpo.cfg.GasPowerWallRatio = big.NewInt(DecimalUnit * 0.333)
require.Equal(t, "99902196000", gpo.SuggestPrice().String())
backend.block++
// check the 50.0% wall
gpo.cfg.GasPowerWallRatio = big.NewInt(DecimalUnit / 2)
require.Equal(t, "100000000000", gpo.SuggestPrice().String())
backend.block++
// check the maximum wall
gpo.cfg.GasPowerWallRatio = NewOracle(nil, Config{
GasPowerWallRatio: DecimalUnitBn,
}).cfg.GasPowerWallRatio
require.Equal(t, "100000000000", gpo.SuggestPrice().String())
backend.block++
// check max price hard limit
gpo.cfg.MaxPrice = big.NewInt(2000000000)
backend.totalGasPowerLeft = gpo.maxTotalGasPower().Uint64() / 3
require.Equal(t, "2000000000", gpo.SuggestPrice().String())
backend.block++
// check min price hard limit
gpo.cfg.MinPrice = big.NewInt(2000000001)
backend.totalGasPowerLeft = gpo.maxTotalGasPower().Uint64() / 3
require.Equal(t, "2000000001", gpo.SuggestPrice().String())
backend.block++
} | explode_data.jsonl/26129 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1170
} | [
2830,
3393,
50,
3799,
6972,
1155,
353,
8840,
836,
8,
341,
197,
20942,
1669,
609,
2271,
29699,
515,
197,
47996,
25,
1797,
220,
16,
345,
197,
34493,
58728,
14986,
5415,
25,
220,
15,
345,
197,
7000,
2425,
25,
1797,
67910,
991,
726,
695... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestResponse_GetWeightsVerboseEqual(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedResponse_GetWeights(popr, false)
data, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
}
msg := &Response_GetWeights{}
if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
panic(err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
}
} | explode_data.jsonl/42030 | {
"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,
2582,
13614,
55630,
63404,
2993,
1155,
353,
8840,
836,
8,
341,
3223,
46288,
1669,
6888,
33864,
7121,
37270,
33864,
7121,
3608,
9730,
13244,
1005,
55832,
83819,
12145,
3223,
1669,
1532,
11598,
7757,
2582,
13614,
55630,
40148,
81,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_POST_statuses_repost(t *testing.T) {
t.SkipNow()
kws := map[string]interface{}{
"id": "3551749023600582",
}
result := new(Status)
err := api.POST_statuses_repost(kws, result)
debugCheckError(err)
debugPrintln(*result)
} | explode_data.jsonl/64152 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 99
} | [
2830,
3393,
20506,
83702,
1288,
2203,
1155,
353,
8840,
836,
8,
341,
3244,
57776,
7039,
741,
16463,
8915,
1669,
2415,
14032,
31344,
67066,
197,
197,
28700,
788,
330,
18,
20,
20,
16,
22,
19,
24,
15,
17,
18,
21,
15,
15,
20,
23,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.