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 TestSortComparatorReturnValues(t *testing.T) {
const SCRIPT = `
var a = [];
for (var i = 0; i < 12; i++) {
a[i] = i;
}
a.sort(function(x, y) { return y - x });
for (var i = 0; i < 12; i++) {
if (a[i] !== 11-i) {
throw new Error("Value at index " + i + " is incorrect: " + a[i]);
}
}
`
testScript1(SCRIPT, _undefined, t)
} | explode_data.jsonl/10490 | {
"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,
10231,
38658,
5598,
6227,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
2405,
264,
284,
5907,
2023,
320,
947,
600,
284,
220,
15,
26,
600,
366,
220,
16,
17,
26,
600,
2457,
341,
2760,
264,
989,
60,
284,
600,
280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRetryPipelineBuild(t *testing.T) {
mux, server, client := setup()
defer teardown(server)
mux.HandleFunc("/projects/1/pipelines/5949167/retry", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
fmt.Fprintln(w, `{"id":1, "status":"pending"}`)
})
pipeline, _, err := client.Pipelines.RetryPipelineBuild(1, 5949167)
if err != nil {
t.Errorf("Pipelines.RetryPipelineBuild returned error: %v", err)
}
want := &Pipeline{ID: 1, Status: "pending"}
if !reflect.DeepEqual(want, pipeline) {
t.Errorf("Pipelines.RetryPipelineBuild returned %+v, want %+v", pipeline, want)
}
} | explode_data.jsonl/5216 | {
"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,
51560,
34656,
11066,
1155,
353,
8840,
836,
8,
341,
2109,
2200,
11,
3538,
11,
2943,
1669,
6505,
741,
16867,
49304,
21421,
692,
2109,
2200,
63623,
4283,
17161,
14,
16,
4322,
93997,
14,
20,
24,
19,
24,
16,
21,
22,
10758,
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 TestGenerateSaveCoinKey(t *testing.T) {
t.Parallel()
kb, err := keyring.New(t.Name(), "test", t.TempDir(), nil)
require.NoError(t, err)
addr, mnemonic, err := server.GenerateSaveCoinKey(kb, "keyname", false, hd.Secp256k1)
require.NoError(t, err)
// Test key was actually saved
info, err := kb.Key("keyname")
require.NoError(t, err)
require.Equal(t, addr, info.GetAddress())
// Test in-memory recovery
info, err = keyring.NewInMemory().NewAccount("xxx", mnemonic, "", hd.NewFundraiserParams(0, types.GetConfig().GetCoinType(), 0).String(), hd.Secp256k1)
require.NoError(t, err)
require.Equal(t, addr, info.GetAddress())
} | explode_data.jsonl/54499 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 249
} | [
2830,
3393,
31115,
8784,
41180,
1592,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
16463,
65,
11,
1848,
1669,
1376,
12640,
7121,
1155,
2967,
1507,
330,
1944,
497,
259,
65009,
6184,
1507,
2092,
340,
17957,
35699,
1155,
11,
1848... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSpan(t *testing.T) {
t.Parallel()
receiver1 := make([]float64, 5)
truth := []float64{1, 2, 3, 4, 5}
receiver2 := Span(receiver1, 1, 5)
areSlicesEqual(t, truth, receiver1, "Improper linspace from mutator")
areSlicesEqual(t, truth, receiver2, "Improper linspace from returned slice")
receiver1 = make([]float64, 6)
truth = []float64{0, 0.2, 0.4, 0.6, 0.8, 1.0}
Span(receiver1, 0, 1)
areSlicesEqual(t, truth, receiver1, "Improper linspace")
if !Panics(func() { Span(nil, 1, 5) }) {
t.Errorf("Span accepts nil argument")
}
if !Panics(func() { Span(make([]float64, 1), 1, 5) }) {
t.Errorf("Span accepts argument of len = 1")
}
for _, test := range []struct {
n int
l, u float64
want []float64
}{
{
n: 4, l: math.Inf(-1), u: math.Inf(1),
want: []float64{math.Inf(-1), math.Inf(-1), math.Inf(1), math.Inf(1)},
},
{
n: 4, l: math.Inf(1), u: math.Inf(-1),
want: []float64{math.Inf(1), math.Inf(1), math.Inf(-1), math.Inf(-1)},
},
{
n: 5, l: math.Inf(-1), u: math.Inf(1),
want: []float64{math.Inf(-1), math.Inf(-1), 0, math.Inf(1), math.Inf(1)},
},
{
n: 5, l: math.Inf(1), u: math.Inf(-1),
want: []float64{math.Inf(1), math.Inf(1), 0, math.Inf(-1), math.Inf(-1)},
},
{
n: 5, l: math.Inf(1), u: math.Inf(1),
want: []float64{math.Inf(1), math.Inf(1), math.Inf(1), math.Inf(1), math.Inf(1)},
},
{
n: 5, l: math.Inf(-1), u: math.Inf(-1),
want: []float64{math.Inf(-1), math.Inf(-1), math.Inf(-1), math.Inf(-1), math.Inf(-1)},
},
{
n: 5, l: math.Inf(-1), u: math.NaN(),
want: []float64{math.Inf(-1), math.NaN(), math.NaN(), math.NaN(), math.NaN()},
},
{
n: 5, l: math.Inf(1), u: math.NaN(),
want: []float64{math.Inf(1), math.NaN(), math.NaN(), math.NaN(), math.NaN()},
},
{
n: 5, l: math.NaN(), u: math.Inf(-1),
want: []float64{math.NaN(), math.NaN(), math.NaN(), math.NaN(), math.Inf(-1)},
},
{
n: 5, l: math.NaN(), u: math.Inf(1),
want: []float64{math.NaN(), math.NaN(), math.NaN(), math.NaN(), math.Inf(1)},
},
{
n: 5, l: 42, u: math.Inf(-1),
want: []float64{42, math.Inf(-1), math.Inf(-1), math.Inf(-1), math.Inf(-1)},
},
{
n: 5, l: 42, u: math.Inf(1),
want: []float64{42, math.Inf(1), math.Inf(1), math.Inf(1), math.Inf(1)},
},
{
n: 5, l: 42, u: math.NaN(),
want: []float64{42, math.NaN(), math.NaN(), math.NaN(), math.NaN()},
},
{
n: 5, l: math.Inf(-1), u: 42,
want: []float64{math.Inf(-1), math.Inf(-1), math.Inf(-1), math.Inf(-1), 42},
},
{
n: 5, l: math.Inf(1), u: 42,
want: []float64{math.Inf(1), math.Inf(1), math.Inf(1), math.Inf(1), 42},
},
{
n: 5, l: math.NaN(), u: 42,
want: []float64{math.NaN(), math.NaN(), math.NaN(), math.NaN(), 42},
},
} {
got := Span(make([]float64, test.n), test.l, test.u)
areSlicesSame(t, test.want, got,
fmt.Sprintf("Unexpected slice of length %d for %f to %f", test.n, test.l, test.u))
}
} | explode_data.jsonl/1240 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1473
} | [
2830,
3393,
12485,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
17200,
12862,
16,
1669,
1281,
10556,
3649,
21,
19,
11,
220,
20,
340,
25583,
940,
1669,
3056,
3649,
21,
19,
90,
16,
11,
220,
17,
11,
220,
18,
11,
220,
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... | 1 |
func TestHandshakeServerX25519(t *testing.T) {
config := testConfig.Clone()
config.CurvePreferences = []CurveID{X25519}
test := &serverTest{
name: "X25519",
command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256", "-curves", "X25519"},
config: config,
}
runServerTestTLS12(t, test)
runServerTestTLS13(t, test)
} | explode_data.jsonl/36333 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 178
} | [
2830,
3393,
2314,
29661,
5475,
55,
17,
20,
20,
16,
24,
1155,
353,
8840,
836,
8,
341,
25873,
1669,
1273,
2648,
64463,
741,
25873,
727,
73047,
14306,
284,
3056,
31325,
915,
90,
55,
17,
20,
20,
16,
24,
630,
18185,
1669,
609,
4030,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestUpdateNodeStatusError(t *testing.T) {
testKubelet := newTestKubelet(t, false /* controllerAttachDetachEnabled */)
defer testKubelet.Cleanup()
kubelet := testKubelet.kubelet
kubelet.kubeClient = nil // ensure only the heartbeat client is used
// No matching node for the kubelet
testKubelet.fakeKubeClient.ReactionChain = fake.NewSimpleClientset(&v1.NodeList{Items: []v1.Node{}}).ReactionChain
assert.Error(t, kubelet.updateNodeStatus())
assert.Len(t, testKubelet.fakeKubeClient.Actions(), nodeStatusUpdateRetry)
} | explode_data.jsonl/69719 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 182
} | [
2830,
3393,
4289,
1955,
2522,
1454,
1155,
353,
8840,
836,
8,
341,
18185,
42,
3760,
1149,
1669,
501,
2271,
42,
3760,
1149,
1155,
11,
895,
1391,
6461,
30485,
89306,
5462,
639,
340,
16867,
1273,
42,
3760,
1149,
727,
60639,
741,
16463,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTraceExporter_WithSpan(t *testing.T) {
te, err := NewTraceExporter(fakeTraceExporterConfig, newPushTraceData(0, nil))
require.Nil(t, err)
require.NotNil(t, te)
checkWrapSpanForTraceExporter(t, te, nil, 1)
} | explode_data.jsonl/1573 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 93
} | [
2830,
3393,
6550,
88025,
62,
2354,
12485,
1155,
353,
8840,
836,
8,
341,
197,
665,
11,
1848,
1669,
1532,
6550,
88025,
74138,
6550,
88025,
2648,
11,
501,
16644,
6550,
1043,
7,
15,
11,
2092,
1171,
17957,
59678,
1155,
11,
1848,
340,
17957... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestServer_BadTemplate(t *testing.T) {
log.SetOutput(ioutil.Discard)
defer log.SetOutput(os.Stdout)
assert.Panics(t, badTemplateCall, "templates.MustGet() did not panic() as currently expected")
} | explode_data.jsonl/3787 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 73
} | [
2830,
3393,
5475,
1668,
329,
7275,
1155,
353,
8840,
836,
8,
341,
6725,
4202,
5097,
1956,
30158,
909,
47560,
340,
16867,
1487,
4202,
5097,
9638,
83225,
692,
6948,
1069,
276,
1211,
1155,
11,
3873,
7275,
7220,
11,
330,
15463,
50463,
1949,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOptionContains(t *testing.T) {
o := gs.Some(100)
assert.True(t, o.Contains(100, gs.Eq[int]))
assert.False(t, o.Contains(101, gs.Eq[int]))
o = gs.None[int]()
assert.False(t, o.Contains(0, gs.Eq[int]))
assert.False(t, o.Contains(100, gs.Eq[int]))
} | explode_data.jsonl/32428 | {
"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,
5341,
23805,
1155,
353,
8840,
836,
8,
341,
22229,
1669,
28081,
86833,
7,
16,
15,
15,
340,
6948,
32443,
1155,
11,
297,
11545,
7,
16,
15,
15,
11,
28081,
5142,
80,
18640,
10907,
6948,
50757,
1155,
11,
297,
11545,
7,
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... | 1 |
func TestIsDup(t *testing.T) {
ast := require.New(t)
ast.False(IsDup(nil))
ast.False(IsDup(errors.New("invaliderror")))
ast.True(IsDup(errors.New("E11000")))
} | explode_data.jsonl/40716 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 76
} | [
2830,
3393,
3872,
85713,
1155,
353,
8840,
836,
8,
341,
88836,
1669,
1373,
7121,
1155,
340,
88836,
50757,
65473,
85713,
27907,
1171,
88836,
50757,
65473,
85713,
38881,
7121,
445,
11808,
841,
29836,
88836,
32443,
65473,
85713,
38881,
7121,
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 |
func TestRWFileHandleMethodsWrite(t *testing.T) {
r, vfs, fh, cleanup := rwHandleCreateWriteOnly(t)
defer cleanup()
// String
assert.Equal(t, "file1 (rw)", fh.String())
assert.Equal(t, "<nil *RWFileHandle>", (*RWFileHandle)(nil).String())
assert.Equal(t, "<nil *RWFileHandle.file>", new(RWFileHandle).String())
// Node
node := fh.Node()
assert.Equal(t, "file1", node.Name())
offset := func() int64 {
n, err := fh.Seek(0, io.SeekCurrent)
require.NoError(t, err)
return n
}
// Offset #1
assert.Equal(t, int64(0), offset())
assert.Equal(t, int64(0), node.Size())
// Size #1
assert.Equal(t, int64(0), fh.Size())
// Write
n, err := fh.Write([]byte("hello"))
assert.NoError(t, err)
assert.Equal(t, 5, n)
// Offset #2
assert.Equal(t, int64(5), offset())
assert.Equal(t, int64(5), node.Size())
// Size #2
assert.Equal(t, int64(5), fh.Size())
// WriteString
n, err = fh.WriteString(" world!")
assert.NoError(t, err)
assert.Equal(t, 7, n)
// Sync
err = fh.Sync()
assert.NoError(t, err)
// Stat
var fi os.FileInfo
fi, err = fh.Stat()
assert.NoError(t, err)
assert.Equal(t, int64(12), fi.Size())
assert.Equal(t, "file1", fi.Name())
// Truncate
err = fh.Truncate(11)
assert.NoError(t, err)
// Close
assert.NoError(t, fh.Close())
// Check double close
err = fh.Close()
assert.Equal(t, ECLOSED, err)
// check vfs
root, err := vfs.Root()
require.NoError(t, err)
checkListing(t, root, []string{"file1,11,false"})
// check the underlying r.Fremote but not the modtime
file1 := fstest.NewItem("file1", "hello world", t1)
vfs.WaitForWriters(waitForWritersDelay)
fstest.CheckListingWithPrecision(t, r.Fremote, []fstest.Item{file1}, []string{}, fs.ModTimeNotSupported)
} | explode_data.jsonl/7343 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 736
} | [
2830,
3393,
56368,
1703,
6999,
17856,
7985,
1155,
353,
8840,
836,
8,
341,
7000,
11,
92941,
11,
36075,
11,
21290,
1669,
25991,
6999,
4021,
7985,
7308,
1155,
340,
16867,
21290,
2822,
197,
322,
923,
198,
6948,
12808,
1155,
11,
330,
1192,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBadSignatureWithTwoKeys(t *testing.T) {
publicKeys := []*rsa.PublicKey{getPublicKey(publicKeyModulusHexStringMatching), getPublicKey(publicKeyModulusHexStringMismatching)}
valid := signatures.IsSignatureValid([]byte(invalidFile), []byte(signature), publicKeys)
if valid {
t.Error("Invalid signature not recognized to be invalid.")
}
} | explode_data.jsonl/4968 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 110
} | [
2830,
3393,
17082,
25088,
2354,
11613,
8850,
1155,
353,
8840,
836,
8,
341,
1219,
8850,
1669,
29838,
60869,
49139,
1592,
90,
455,
61822,
31688,
1592,
4459,
19425,
49137,
64430,
701,
633,
61822,
31688,
1592,
4459,
19425,
49137,
82572,
287,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBundles(t *testing.T) {
s := Store{
dataPath: dataRoot,
Logger: olog.NewLogger(
olog.Color(true),
olog.Pretty(true),
olog.Level("info"),
),
}
// write bundles
for i := range bundleScenarios {
index := i
t.Run(bundleScenarios[index].name, func(t *testing.T) {
filePath := s.buildFilePathForBundle(bundleScenarios[index].bundle.Id, true)
if err := s.writeRecordToFile(bundleScenarios[index].bundle, filePath); err != nil {
t.Error(err)
}
assert.FileExists(t, filePath)
})
}
// check that ListBundles only returns bundles with type DEFAULT
bundles, err := s.ListBundles(proto.Bundle_TYPE_DEFAULT, []string{})
if err != nil {
t.Error(err)
}
for i := range bundles {
assert.Equal(t, proto.Bundle_TYPE_DEFAULT, bundles[i].Type)
}
// check that ListBundles filtered by an id only returns that bundle
filteredBundles, err := s.ListBundles(proto.Bundle_TYPE_DEFAULT, []string{bundle2})
if err != nil {
t.Error(err)
}
assert.Equal(t, 1, len(filteredBundles))
if len(filteredBundles) == 1 {
assert.Equal(t, bundle2, filteredBundles[0].Id)
}
// check that ListRoles only returns bundles with type ROLE
roles, err := s.ListBundles(proto.Bundle_TYPE_ROLE, []string{})
if err != nil {
t.Error(err)
}
for i := range roles {
assert.Equal(t, proto.Bundle_TYPE_ROLE, roles[i].Type)
}
burnRoot()
} | explode_data.jsonl/19351 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 565
} | [
2830,
3393,
33,
49204,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
9129,
515,
197,
8924,
1820,
25,
821,
8439,
345,
197,
55861,
25,
297,
839,
7121,
7395,
1006,
298,
197,
1609,
6669,
3715,
1326,
298,
197,
1609,
1069,
21322,
3715,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPadding(t *testing.T) {
for _, tt := range []struct {
padding, offset, result int64
}{
{},
{
padding: 8,
offset: 2,
result: 0,
},
{
padding: 8,
offset: 9,
result: 8,
},
{
padding: 8,
offset: 8,
result: 8,
},
{
padding: 1024,
offset: 413,
result: 0,
},
{
offset: 514,
result: 514,
},
} {
t.Run(fmt.Sprintf("%d_%d", tt.padding, tt.offset), func(t *testing.T) {
require.Equal(t, tt.result, nearestOffset(tt.padding, tt.offset))
})
}
} | explode_data.jsonl/21774 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 283
} | [
2830,
3393,
21616,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17853,
1669,
2088,
3056,
1235,
341,
197,
40512,
11,
4347,
11,
1102,
526,
21,
19,
198,
197,
59403,
197,
197,
38837,
197,
197,
515,
298,
40512,
25,
220,
23,
345,
298,
40668,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOTLPClientIP(t *testing.T) {
systemtest.CleanupElasticsearch(t)
srv := apmservertest.NewServer(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
err := sendOTLPTrace(ctx, srv, sdktrace.Config{})
assert.NoError(t, err)
err = sendOTLPTrace(ctx, srv, sdktrace.Config{
Resource: sdkresource.NewWithAttributes(label.String("service.name", "service1")),
})
require.NoError(t, err)
err = sendOTLPTrace(ctx, srv, sdktrace.Config{
Resource: sdkresource.NewWithAttributes(
label.String("service.name", "service2"),
label.String("telemetry.sdk.name", "iOS"),
label.String("telemetry.sdk.language", "swift"),
),
})
require.NoError(t, err)
// Non-iOS agent documents should have no client.ip field set.
result := systemtest.Elasticsearch.ExpectDocs(t, "apm-*", estest.TermQuery{
Field: "service.name", Value: "service1",
})
assert.False(t, gjson.GetBytes(result.Hits.Hits[0].RawSource, "client.ip").Exists())
// iOS agent documents should have a client.ip field set.
result = systemtest.Elasticsearch.ExpectDocs(t, "apm-*", estest.TermQuery{
Field: "service.name", Value: "service2",
})
assert.True(t, gjson.GetBytes(result.Hits.Hits[0].RawSource, "client.ip").Exists())
} | explode_data.jsonl/41682 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 468
} | [
2830,
3393,
1793,
12567,
2959,
3298,
1155,
353,
8840,
836,
8,
341,
40293,
1944,
727,
60639,
36,
51179,
1836,
1155,
340,
1903,
10553,
1669,
1443,
76,
799,
1621,
477,
7121,
5475,
1155,
692,
20985,
11,
9121,
1669,
2266,
26124,
9269,
5378,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGobMarshalInt(t *testing.T) {
s := test.RunServerOnPort(TEST_PORT)
defer s.Shutdown()
ec := NewGobEncodedConn(t)
defer ec.Close()
ch := make(chan bool)
testN := 22
ec.Subscribe("gob_int", func(n int) {
if n != testN {
t.Fatalf("Received test int of '%d', wanted '%d'\n", n, testN)
}
ch <- true
})
ec.Publish("gob_int", testN)
if e := test.Wait(ch); e != nil {
t.Fatal("Did not receive the message")
}
} | explode_data.jsonl/39502 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 193
} | [
2830,
3393,
38,
674,
55438,
1072,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1273,
16708,
5475,
1925,
7084,
50320,
12377,
340,
16867,
274,
10849,
18452,
2822,
197,
757,
1669,
1532,
38,
674,
46795,
9701,
1155,
340,
16867,
11942,
10421,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSSH(t *testing.T) {
td := t.TempDir()
// Create a keypair
keyPath := filepath.Join(td, "id_rsa")
pubPath := filepath.Join(td, "id_rsa.pub")
if err := ioutil.WriteFile(pubPath, []byte(sshPublicKey), 0600); err != nil {
t.Fatal(err)
}
if err := ioutil.WriteFile(keyPath, []byte(sshPrivateKey), 0600); err != nil {
t.Fatal(err)
}
// Create a random artifact and sign it.
artifactPath := filepath.Join(td, "artifact")
sigPath := filepath.Join(td, "signature.sig")
artifact := createArtifact(t, artifactPath)
sig := SSHSign(t, strings.NewReader(artifact))
if err := ioutil.WriteFile(sigPath, []byte(sig), 0600); err != nil {
t.Fatal(err)
}
// Now upload to the log!
out := runCli(t, "upload", "--artifact", artifactPath, "--signature", sigPath,
"--public-key", pubPath, "--pki-format", "ssh")
outputContains(t, out, "Created entry at")
uuid := getUUIDFromUploadOutput(t, out)
out = runCli(t, "verify", "--artifact", artifactPath, "--signature", sigPath,
"--public-key", pubPath, "--pki-format", "ssh")
outputContains(t, out, "Inclusion Proof")
out = runCli(t, "search", "--public-key", pubPath, "--pki-format", "ssh")
outputContains(t, out, uuid)
} | explode_data.jsonl/20318 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 478
} | [
2830,
3393,
62419,
1155,
353,
8840,
836,
8,
341,
76373,
1669,
259,
65009,
6184,
741,
197,
322,
4230,
264,
1376,
12670,
198,
23634,
1820,
1669,
26054,
22363,
61241,
11,
330,
307,
82522,
1138,
62529,
1820,
1669,
26054,
22363,
61241,
11,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestMarkMsgAsHandled(t *testing.T) {
mgHeader := xuperp2p.XuperMessage_MessageHeader{
Version: "xuperchain2.4",
Logid: "logidaaa",
From: "localhost",
Bcname: "xuper",
Type: xuperp2p.XuperMessage_SENDBLOCK,
DataCheckSum: 123,
}
mgData := xuperp2p.XuperMessage_MessageData{
MsgInfo: []byte{1},
}
var mg xuperp2p.XuperMessage
mg.Header = &mgHeader
mg.Data = &mgData
// new a HandlerMap
lg := log.New("module", "p2pv2")
hm, err := NewHandlerMap(lg)
defer func() {
if hm != nil {
hm.Stop()
}
}()
if err != nil {
//t.Error("Expect nil, got ", err)
}
if hm != nil {
if ok1 := hm.IsMsgAsHandled(&mg); ok1 {
//t.Error("Expect ok1 false, got ", ok1)
}
hm.MarkMsgAsHandled(&mg)
if ok2 := hm.IsMsgAsHandled(&mg); !ok2 {
//t.Error("Expect ok2 true, got ", ok2)
}
}
} | explode_data.jsonl/969 | {
"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,
8949,
6611,
2121,
90909,
1155,
353,
8840,
836,
8,
341,
2109,
70,
4047,
1669,
856,
3466,
79,
17,
79,
4338,
3466,
2052,
50974,
4047,
515,
197,
77847,
25,
414,
330,
87,
3466,
8819,
17,
13,
19,
756,
197,
24201,
307,
25,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestExprWithLocation(t *testing.T) {
cases := []struct {
note string
input string
expected []*Location
}{
{
note: "base",
input: "a with b as c",
expected: []*Location{
{
Row: 1,
Col: 3,
Offset: 2,
Text: []byte("with b as c"),
},
},
},
{
note: "with line break",
input: "a with b\nas c",
expected: []*Location{
{
Row: 1,
Col: 3,
Offset: 2,
Text: []byte("with b\nas c"),
},
},
},
{
note: "multiple withs on single line",
input: "a with b as c with d as e",
expected: []*Location{
{
Row: 1,
Col: 3,
Offset: 2,
Text: []byte("with b as c"),
},
{
Row: 1,
Col: 15,
Offset: 14,
Text: []byte("with d as e"),
},
},
},
{
note: "multiple withs on multiple line",
input: "a with b as c\n\t\twith d as e",
expected: []*Location{
{
Row: 1,
Col: 3,
Offset: 2,
Text: []byte("with b as c"),
},
{
Row: 2,
Col: 3,
Offset: 16,
Text: []byte("with d as e"),
},
},
},
}
for _, tc := range cases {
t.Run(tc.note, func(t *testing.T) {
parsed, err := ParseStatement(tc.input)
if err != nil {
t.Errorf("Unexpected error on %s: %s", tc.input, err)
return
}
body := parsed.(Body)
if len(body) != 1 {
t.Errorf("Parser returned multiple expressions: %v", body)
return
}
expr := body[0]
if len(expr.With) != len(tc.expected) {
t.Fatalf("Expected %d with statements, got %d", len(expr.With), len(tc.expected))
}
for i, with := range expr.With {
if !with.Location.Equal(tc.expected[i]) {
t.Errorf("Expected location %+v for '%v' but got %+v ", *(tc.expected[i]), with.String(), *with.Location)
}
}
})
}
} | explode_data.jsonl/50475 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 973
} | [
2830,
3393,
16041,
2354,
4707,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
9038,
1272,
257,
914,
198,
197,
22427,
262,
914,
198,
197,
42400,
29838,
4707,
198,
197,
59403,
197,
197,
515,
298,
9038,
1272,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestStatReturnsFileInfo(t *testing.T) {
beforeTest(t)
conn := _getConnection(t)
defer conn.Close()
client := agaveproto.NewSftpRelayClient(conn)
tmpTestFilePath, err := _createTempFile("", ".txt")
if err != nil {
assert.FailNowf(t, err.Error(), "Unable to create temp test file: %s", err.Error())
}
tmpTestFileInfo, err := os.Stat(_resolveTestPath(tmpTestFilePath, LocalSharedTestDir))
if err != nil {
assert.FailNowf(t, err.Error(), "Unable to open temp test file: %s", err.Error())
}
remoteTestFilePath := _resolveTestPath(tmpTestFilePath, SFTP_SHARED_TEST_DIR)
req := &agaveproto.SrvStatRequest{
SystemConfig: _createRemoteSystemConfig(),
RemotePath: remoteTestFilePath,
}
grpcResponse, err := client.Stat(context.Background(), req)
if err != nil {
assert.Nilf(t, err, "Error while calling RPC Stat: %v", err)
}
assert.Equal(t, "", grpcResponse.Error, "Stat on existing file should return empty error")
if grpcResponse.Error == "" {
assert.Equal(t, tmpTestFileInfo.Size(), grpcResponse.RemoteFileInfo.Size, "Returned file size should match the test file size")
assert.Equal(t, tmpTestFileInfo.Name(), grpcResponse.RemoteFileInfo.Name, "Returned file name should match the name of the test file")
assert.Equal(t, remoteTestFilePath, grpcResponse.RemoteFileInfo.Path, "Returned file path should match the path of the test file")
assert.Equal(t, tmpTestFileInfo.IsDir(), grpcResponse.RemoteFileInfo.IsDirectory, "Returned directory flag should match the flag of the test file")
assert.Equal(t, tmpTestFileInfo.Mode().String(), grpcResponse.RemoteFileInfo.Mode, "Returned mode should match the mode of the test file")
assert.Equal(t, tmpTestFileInfo.ModTime().Unix(), grpcResponse.RemoteFileInfo.LastUpdated, "Returned last updated timestamp should match the test file")
}
afterTest(t)
} | explode_data.jsonl/32538 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 611
} | [
2830,
3393,
15878,
16446,
45430,
1155,
353,
8840,
836,
8,
341,
63234,
2271,
1155,
692,
32917,
1669,
716,
52414,
1155,
340,
16867,
4534,
10421,
2822,
25291,
1669,
933,
523,
15110,
7121,
50,
25068,
6740,
352,
2959,
20571,
692,
20082,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestHasDefaultStorageClass(t *testing.T) {
type TestCase struct {
Input v1.StorageClassList
Expected bool
}
cases := []TestCase{
{
Input: v1.StorageClassList{
Items: []v1.StorageClass{
{
Parameters: map[string]string{
"storageclass.beta.kubernetes.io/is-default-class": "true",
},
},
},
},
Expected: true,
},
{
Input: v1.StorageClassList{
Items: []v1.StorageClass{
{
Parameters: map[string]string{
"storageclass.beta.kubernetes.io/is-default-class": "false",
},
},
},
},
Expected: true,
},
}
for _, c := range cases {
result := hasDefaultStorage(&c.Input)
if result != c.Expected {
t.Errorf("hasDefaultStorage(%v) not correct; got %v; want %v", c.Input, result, c.Expected)
}
}
} | explode_data.jsonl/25461 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 379
} | [
2830,
3393,
10281,
3675,
5793,
1957,
1155,
353,
8840,
836,
8,
341,
13158,
30573,
2036,
341,
197,
66588,
262,
348,
16,
43771,
1957,
852,
198,
197,
197,
18896,
1807,
198,
197,
630,
1444,
2264,
1669,
3056,
16458,
515,
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... | 3 |
func TestIntegrationOBFS4ConnectGoodWithDoT(t *testing.T) {
ctx := context.Background()
config := obfs4config()
config.DNSServerNetwork = "dot"
config.DNSServerAddress = "9.9.9.9:853"
results := OBFS4Connect(ctx, config)
if results.Error != nil {
t.Fatal(results.Error)
}
} | explode_data.jsonl/53548 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 109
} | [
2830,
3393,
52464,
20608,
8485,
19,
14611,
15216,
2354,
5404,
51,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
25873,
1669,
1508,
3848,
19,
1676,
741,
25873,
909,
53302,
2836,
12320,
284,
330,
16119,
698,
25873,
909,
533... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPartialAppendToValueLog(t *testing.T) {
dir, err := ioutil.TempDir("", "badger-test")
require.NoError(t, err)
defer removeDir(dir)
// Create skeleton files.
opts := getTestOptions(dir)
opts.Truncate = true
opts.ValueLogFileSize = 100 * 1024 * 1024 // 100Mb
kv, err := Open(opts)
require.NoError(t, err)
require.NoError(t, kv.Close())
var (
k0 = []byte("k0")
k1 = []byte("k1")
k2 = []byte("k2")
k3 = []byte("k3")
v0 = []byte("value0-01234567890123456789012012345678901234567890123")
v1 = []byte("value1-01234567890123456789012012345678901234567890123")
v2 = []byte("value2-01234567890123456789012012345678901234567890123")
v3 = []byte("value3-01234567890123456789012012345678901234567890123")
)
// Values need to be long enough to actually get written to value log.
require.True(t, len(v3) >= kv.opt.ValueThreshold)
// Create truncated vlog to simulate a partial append.
// k0 - single transaction, k1 and k2 in another transaction
buf := createVlog(t, []*Entry{
{Key: k0, Value: v0},
{Key: k1, Value: v1},
{Key: k2, Value: v2},
})
buf = buf[:len(buf)-6]
require.NoError(t, ioutil.WriteFile(vlogFilePath(dir, 0), buf, 0777))
// Badger should now start up
kv, err = Open(opts)
require.NoError(t, err)
require.NoError(t, kv.View(func(txn *Txn) error {
item, err := txn.Get(k0)
require.NoError(t, err)
require.Equal(t, v0, getItemValue(t, item))
_, err = txn.Get(k1)
require.Equal(t, ErrKeyNotFound, err)
_, err = txn.Get(k2)
require.Equal(t, ErrKeyNotFound, err)
return nil
}))
// When K3 is set, it should be persisted after a restart.
txnSet(t, kv, k3, v3, 0)
require.NoError(t, kv.Close())
kv, err = Open(opts)
require.NoError(t, err)
checkKeys(t, kv, [][]byte{k3})
// Replay value log from beginning, badger head is past k2.
require.NoError(t, kv.vlog.Close())
require.NoError(t,
kv.vlog.open(kv, valuePointer{Fid: 0}, kv.replayFunction()))
require.NoError(t, kv.Close())
} | explode_data.jsonl/39096 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 871
} | [
2830,
3393,
37314,
23877,
1249,
1130,
2201,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
13855,
1389,
16839,
1138,
17957,
35699,
1155,
11,
1848,
340,
16867,
4057,
6184,
14161,
692,
197,
322,
4230,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJsonEscapeCharacters(t *testing.T) {
assert := assert.New(t)
settings := testutil.Settings().WithSections().With(&print.Settings{
EscapeCharacters: true,
}).Build()
expected, err := testutil.GetExpected("json", "json-EscapeCharacters")
assert.Nil(err)
options := module.NewOptions()
module, err := testutil.GetModule(options)
assert.Nil(err)
printer := NewJSON(settings)
actual, err := printer.Print(module, settings)
assert.Nil(err)
assert.Equal(expected, actual)
} | explode_data.jsonl/40857 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 169
} | [
2830,
3393,
5014,
48124,
37489,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
62930,
1669,
1273,
1314,
27000,
1005,
2354,
38122,
1005,
2354,
2099,
1350,
27000,
515,
197,
197,
48124,
37489,
25,
830,
345,
197,
16630,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestVersion(t *testing.T) {
version := make(map[string]string)
version["app.kubernetes.io/version"] = "v1"
out := FindVersion(version)
test.AssertOutput(t, "v1", out)
} | explode_data.jsonl/20213 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 70
} | [
2830,
3393,
5637,
1155,
353,
8840,
836,
8,
341,
74954,
1669,
1281,
9147,
14032,
30953,
692,
74954,
1183,
676,
5202,
29827,
4245,
64413,
1341,
284,
330,
85,
16,
1837,
13967,
1669,
7379,
5637,
37770,
692,
18185,
11711,
5097,
1155,
11,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestPluginLoadingFailure(t *testing.T) {
gt := NewGomegaWithT(t)
peer, err := gexec.Build("github.com/Randyshu2018/fabric/cmd/peer")
gt.Expect(err).NotTo(HaveOccurred())
defer gexec.CleanupBuildArtifacts()
parentDir, err := filepath.Abs("../..")
gt.Expect(err).NotTo(HaveOccurred())
tempDir, err := ioutil.TempDir("", "plugin-failure")
gt.Expect(err).NotTo(HaveOccurred())
defer os.RemoveAll(tempDir)
peerListener, err := net.Listen("tcp", "localhost:0")
gt.Expect(err).NotTo(HaveOccurred())
peerListenAddress := peerListener.Addr()
chaincodeListener, err := net.Listen("tcp", "localhost:0")
gt.Expect(err).NotTo(HaveOccurred())
chaincodeListenAddress := chaincodeListener.Addr()
operationsListener, err := net.Listen("tcp", "localhost:0")
gt.Expect(err).NotTo(HaveOccurred())
operationsListenAddress := operationsListener.Addr()
err = peerListener.Close()
gt.Expect(err).NotTo(HaveOccurred())
err = chaincodeListener.Close()
gt.Expect(err).NotTo(HaveOccurred())
err = operationsListener.Close()
gt.Expect(err).NotTo(HaveOccurred())
for _, plugin := range []string{
"ENDORSERS_ESCC",
"VALIDATORS_VSCC",
} {
plugin := plugin
t.Run(plugin, func(t *testing.T) {
cmd := exec.Command(peer, "node", "start")
cmd.Env = []string{
fmt.Sprintf("CORE_PEER_FILESYSTEMPATH=%s", tempDir),
fmt.Sprintf("CORE_PEER_HANDLERS_%s_LIBRARY=%s", plugin, filepath.Join(parentDir, "internal/peer/testdata/invalid_plugins/invalidplugin.so")),
fmt.Sprintf("CORE_PEER_LISTENADDRESS=%s", peerListenAddress),
fmt.Sprintf("CORE_PEER_CHAINCODELISTENADDRESS=%s", chaincodeListenAddress),
fmt.Sprintf("CORE_PEER_MSPCONFIGPATH=%s", "msp"),
fmt.Sprintf("CORE_OPERATIONS_LISTENADDRESS=%s", operationsListenAddress),
"CORE_OPERATIONS_TLS_ENABLED=false",
fmt.Sprintf("FABRIC_CFG_PATH=%s", filepath.Join(parentDir, "sampleconfig")),
}
sess, err := gexec.Start(cmd, nil, nil)
gt.Expect(err).NotTo(HaveOccurred())
gt.Eventually(sess, time.Minute).Should(gexec.Exit(2))
gt.Expect(sess.Err).To(gbytes.Say(fmt.Sprintf("panic: Error opening plugin at path %s", filepath.Join(parentDir, "internal/peer/testdata/invalid_plugins/invalidplugin.so"))))
gt.Expect(sess.Err).To(gbytes.Say("plugin.Open"))
})
}
} | explode_data.jsonl/19274 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 919
} | [
2830,
3393,
11546,
8578,
17507,
1155,
353,
8840,
836,
8,
341,
3174,
83,
1669,
1532,
38,
32696,
2354,
51,
1155,
340,
197,
16537,
11,
1848,
1669,
342,
11748,
25212,
445,
5204,
905,
19382,
13331,
927,
84,
17,
15,
16,
23,
6663,
28897,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMsgGrantGetAuthorization(t *testing.T) {
require := require.New(t)
m := authz.MsgGrant{}
require.Nil(m.GetAuthorization())
g := authz.GenericAuthorization{Msg: "some_type"}
var err error
m.Grant.Authorization, err = cdctypes.NewAnyWithValue(&g)
require.NoError(err)
a, err := m.GetAuthorization()
require.NoError(err)
require.Equal(a, &g)
g = authz.GenericAuthorization{Msg: "some_type2"}
m.SetAuthorization(&g)
a, err = m.GetAuthorization()
require.NoError(err)
require.Equal(a, &g)
} | explode_data.jsonl/74941 | {
"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,
6611,
67971,
1949,
18124,
1155,
353,
8840,
836,
8,
341,
17957,
1669,
1373,
7121,
1155,
692,
2109,
1669,
4166,
89,
30365,
67971,
16094,
17957,
59678,
1255,
2234,
18124,
12367,
3174,
1669,
4166,
89,
4341,
18124,
90,
6611,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestStartContainerTransitionsInvokesHandleContainerChange(t *testing.T) {
eventStreamName := "TESTTASKENGINE"
// Create a container with the intent to do
// CREATERD -> STOPPED transition. This triggers
// `managedTask.handleContainerChange()` and generates the following
// events:
// 1. container state change event for Submit* API
// 2. task state change event for Submit* API
// 3. container state change event for the internal event stream
firstContainerName := "container1"
firstContainer := &apicontainer.Container{
KnownStatusUnsafe: apicontainerstatus.ContainerCreated,
DesiredStatusUnsafe: apicontainerstatus.ContainerStopped,
Name: firstContainerName,
}
containerChangeEventStream := eventstream.NewEventStream(eventStreamName, context.Background())
containerChangeEventStream.StartListening()
stateChangeEvents := make(chan statechange.Event)
task := &managedTask{
Task: &apitask.Task{
Containers: []*apicontainer.Container{
firstContainer,
},
DesiredStatusUnsafe: apitaskstatus.TaskRunning,
},
engine: &DockerTaskEngine{
containerChangeEventStream: containerChangeEventStream,
stateChangeEvents: stateChangeEvents,
},
stateChangeEvents: stateChangeEvents,
containerChangeEventStream: containerChangeEventStream,
dockerMessages: make(chan dockerContainerChange),
}
eventsGenerated := sync.WaitGroup{}
eventsGenerated.Add(2)
containerChangeEventStream.Subscribe(eventStreamName, func(events ...interface{}) error {
assert.NotNil(t, events)
assert.Len(t, events, 1)
event := events[0]
containerChangeEvent, ok := event.(dockerapi.DockerContainerChangeEvent)
assert.True(t, ok)
assert.Equal(t, containerChangeEvent.Status, apicontainerstatus.ContainerStopped)
eventsGenerated.Done()
return nil
})
defer containerChangeEventStream.Unsubscribe(eventStreamName)
// account for container and task state change events for Submit* API
go func() {
<-stateChangeEvents
<-stateChangeEvents
eventsGenerated.Done()
}()
go task.waitEvent(nil)
canTransition, _, transitions, _ := task.startContainerTransitions(
func(cont *apicontainer.Container, nextStatus apicontainerstatus.ContainerStatus) {
t.Error("Invalid code path. The transition function should not be invoked when transitioning container from CREATED -> STOPPED")
})
assert.True(t, canTransition)
assert.Empty(t, transitions)
eventsGenerated.Wait()
} | explode_data.jsonl/24574 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 779
} | [
2830,
3393,
3479,
4502,
3167,
5930,
15174,
7940,
6999,
4502,
4072,
1155,
353,
8840,
836,
8,
341,
28302,
3027,
675,
1669,
330,
10033,
65813,
66652,
1837,
197,
322,
4230,
264,
5476,
448,
279,
7385,
311,
653,
198,
197,
322,
49608,
19157,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfigTxContext_AddClusterNode(t *testing.T) {
t.Skip("Add node is a config update, TODO in issue: https://github.com/hyperledger-labs/orion-server/issues/40")
clientCryptoDir := testutils.GenerateTestClientCrypto(t, []string{"admin", "server"})
testServer, _, _, err := SetupTestServer(t, clientCryptoDir)
defer func() {
if testServer != nil {
_ = testServer.Stop()
}
}()
require.NoError(t, err)
StartTestServer(t, testServer)
serverPort, err := testServer.Port()
require.NoError(t, err)
bcdb := createDBInstance(t, clientCryptoDir, serverPort)
session1 := openUserSession(t, bcdb, "admin", clientCryptoDir)
tx, err := session1.ConfigTx()
require.NoError(t, err)
config, err := tx.GetClusterConfig()
require.NoError(t, err)
node2 := &types.NodeConfig{
Id: "testNode2",
Address: config.Nodes[0].Address,
Port: config.Nodes[0].Port + 1,
Certificate: config.Nodes[0].Certificate,
}
peer2 := &types.PeerConfig{
NodeId: "testNode2",
RaftId: config.ConsensusConfig.Members[0].RaftId + 1,
PeerHost: config.ConsensusConfig.Members[0].PeerHost,
PeerPort: config.ConsensusConfig.Members[0].PeerPort + 1,
}
err = tx.AddClusterNode(node2, peer2)
require.NoError(t, err)
txID, receipt, err := tx.Commit(true)
require.NoError(t, err)
require.NotNil(t, txID)
require.NotNil(t, receipt)
require.Equal(t, types.Flag_VALID, receipt.Header.ValidationInfo[receipt.GetTxIndex()].Flag)
tx2, err := session1.ConfigTx()
require.NoError(t, err)
clusterConfig, err := tx2.GetClusterConfig()
require.NoError(t, err)
require.NotNil(t, clusterConfig)
require.Len(t, clusterConfig.Nodes, 2)
found, index := NodeExists("testNode2", clusterConfig.Nodes)
require.True(t, found)
require.Equal(t, clusterConfig.Nodes[index].Port, node2.Port)
} | explode_data.jsonl/65330 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 714
} | [
2830,
3393,
2648,
31584,
1972,
21346,
28678,
1955,
1155,
353,
8840,
836,
8,
341,
3244,
57776,
445,
2212,
2436,
374,
264,
2193,
2647,
11,
5343,
304,
4265,
25,
3703,
1110,
5204,
905,
7530,
39252,
50704,
2852,
3435,
5144,
290,
26300,
38745... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestClient_ListETHKeys(t *testing.T) {
t.Parallel()
ethClient := newEthMock(t)
ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(42), nil)
ethClient.On("GetLINKBalance", mock.Anything, mock.Anything).Return(assets.NewLinkFromJuels(42), nil)
app := startNewApplication(t,
withKey(),
withMocks(ethClient),
withConfigSet(func(c *configtest.TestGeneralConfig) {
c.Overrides.EVMEnabled = null.BoolFrom(true)
c.Overrides.GlobalEvmNonceAutoSync = null.BoolFrom(false)
c.Overrides.GlobalBalanceMonitorEnabled = null.BoolFrom(false)
}),
)
client, r := app.NewClientAndRenderer()
assert.Nil(t, client.ListETHKeys(cltest.EmptyCLIContext()))
require.Equal(t, 1, len(r.Renders))
balances := *r.Renders[0].(*cmd.EthKeyPresenters)
assert.Equal(t, app.Key.Address.Hex(), balances[0].Address)
ethClient.AssertExpectations(t)
} | explode_data.jsonl/79043 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 343
} | [
2830,
3393,
2959,
27104,
7625,
8850,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
769,
2959,
1669,
501,
65390,
11571,
1155,
340,
197,
769,
2959,
8071,
445,
21190,
1655,
497,
7860,
13311,
1596,
11,
7860,
13311,
1596,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestHashStruct(t *testing.T) {
hash, err := typedData.HashStruct(typedData.PrimaryType, typedData.Message)
if err != nil {
t.Fatal(err)
}
mainHash := fmt.Sprintf("0x%s", common.Bytes2Hex(hash))
if mainHash != "0xc52c0ee5d84264471806290a3f2c4cecfc5490626bf912d01f240d7a274b371e" {
t.Errorf("Expected different hashStruct result (got %s)", mainHash)
}
hash, err = typedData.HashStruct("EIP712Domain", typedData.Domain.Map())
if err != nil {
t.Error(err)
}
domainHash := fmt.Sprintf("0x%s", common.Bytes2Hex(hash))
if domainHash != "0xf2cee375fa42b42143804025fc449deafd50cc031ca257e0b194a650a912090f" {
t.Errorf("Expected different domain hashStruct result (got %s)", domainHash)
}
} | explode_data.jsonl/29997 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 293
} | [
2830,
3393,
6370,
9422,
1155,
353,
8840,
836,
8,
341,
50333,
11,
1848,
1669,
31969,
1043,
15103,
9422,
1155,
32501,
1043,
34884,
929,
11,
31969,
1043,
8472,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
36641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLd_Responsible(t *testing.T) {
type fields struct {
request request
}
type args struct {
id int
}
tests := []struct {
name string
fields fields
args args
want []*lead
wantErr bool
}{
{"error", fields{request{}}, args{0}, nil, true},
}
for _, tt := range tests {
if tt.name == "error" {
OpenConnection("error", "error", "error")
}
t.Run(tt.name, func(t *testing.T) {
l := Ld{
request: tt.fields.request,
}
got, err := l.Responsible(tt.args.id)
if (err != nil) != tt.wantErr {
t.Errorf("Ld.Responsible() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Ld.Responsible() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/15591 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 359
} | [
2830,
3393,
43,
67,
92815,
42319,
1155,
353,
8840,
836,
8,
341,
13158,
5043,
2036,
341,
197,
23555,
1681,
198,
197,
532,
13158,
2827,
2036,
341,
197,
15710,
526,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
262,
914,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAddPodWillReplaceAssumed(t *testing.T) {
now := time.Now()
ttl := 10 * time.Second
assumedPod := makeBasePod(t, "assumed-node-1", "test-1", "100m", "500", "", []v1.ContainerPort{{HostPort: 80}})
addedPod := makeBasePod(t, "actual-node", "test-1", "100m", "500", "", []v1.ContainerPort{{HostPort: 80}})
updatedPod := makeBasePod(t, "actual-node", "test-1", "200m", "500", "", []v1.ContainerPort{{HostPort: 90}})
tests := []struct {
podsToAssume []*v1.Pod
podsToAdd []*v1.Pod
podsToUpdate [][]*v1.Pod
wNodeInfo map[string]*NodeInfo
}{{
podsToAssume: []*v1.Pod{assumedPod.DeepCopy()},
podsToAdd: []*v1.Pod{addedPod.DeepCopy()},
podsToUpdate: [][]*v1.Pod{{addedPod.DeepCopy(), updatedPod.DeepCopy()}},
wNodeInfo: map[string]*NodeInfo{
"assumed-node": nil,
"actual-node": {
requestedResource: &Resource{
MilliCPU: 200,
Memory: 500,
},
nonzeroRequest: &Resource{
MilliCPU: 200,
Memory: 500,
},
TransientInfo: newTransientSchedulerInfo(),
allocatableResource: &Resource{},
pods: []*v1.Pod{updatedPod.DeepCopy()},
usedPorts: newHostPortInfoBuilder().add("TCP", "0.0.0.0", 90).build(),
imageStates: make(map[string]*ImageStateSummary),
},
},
}}
for i, tt := range tests {
cache := newSchedulerCache(ttl, time.Second, nil)
for _, podToAssume := range tt.podsToAssume {
if err := assumeAndFinishBinding(cache, podToAssume, now); err != nil {
t.Fatalf("assumePod failed: %v", err)
}
}
for _, podToAdd := range tt.podsToAdd {
if err := cache.AddPod(podToAdd); err != nil {
t.Fatalf("AddPod failed: %v", err)
}
}
for _, podToUpdate := range tt.podsToUpdate {
if err := cache.UpdatePod(podToUpdate[0], podToUpdate[1]); err != nil {
t.Fatalf("UpdatePod failed: %v", err)
}
}
for nodeName, expected := range tt.wNodeInfo {
t.Log(nodeName)
n := cache.nodes[nodeName]
deepEqualWithoutGeneration(t, i, n, expected)
}
}
} | explode_data.jsonl/19646 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 912
} | [
2830,
3393,
2212,
23527,
9945,
23107,
5615,
38155,
1155,
353,
8840,
836,
8,
341,
80922,
1669,
882,
13244,
741,
3244,
11544,
1669,
220,
16,
15,
353,
882,
32435,
271,
197,
395,
38155,
23527,
1669,
1281,
3978,
23527,
1155,
11,
330,
395,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
func TestMCP23017DriverSetGPIOPolarity(t *testing.T) {
mcp, adaptor := initTestMCP23017DriverWithStubbedAdaptor(0)
gobottest.Assert(t, mcp.Start(), nil)
adaptor.i2cReadImpl = func(b []byte) (int, error) {
return len(b), nil
}
adaptor.i2cWriteImpl = func([]byte) (int, error) {
return 0, nil
}
err := mcp.SetGPIOPolarity(7, 0, "A")
gobottest.Assert(t, err, nil)
// write error
mcp, adaptor = initTestMCP23017DriverWithStubbedAdaptor(0)
gobottest.Assert(t, mcp.Start(), nil)
adaptor.i2cReadImpl = func(b []byte) (int, error) {
return len(b), nil
}
adaptor.i2cWriteImpl = func([]byte) (int, error) {
return 0, errors.New("write error")
}
err = mcp.SetGPIOPolarity(7, 0, "A")
gobottest.Assert(t, err, errors.New("write error"))
} | explode_data.jsonl/42321 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 325
} | [
2830,
3393,
44,
7123,
17,
18,
15,
16,
22,
11349,
1649,
38,
1893,
3067,
72527,
1155,
353,
8840,
836,
8,
341,
2109,
4672,
11,
91941,
1669,
2930,
2271,
44,
7123,
17,
18,
15,
16,
22,
11349,
2354,
33838,
2721,
2589,
32657,
7,
15,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFn(t *testing.T) {
a := new(Animal)
a.speak()
a.speakTo("Alice")
dog := new(Dog)
dog.speak()
// 父类并不能调用子类Dog的speak方法,这里并不能达到继承多态的效果
dog.speakTo("Bob")
t.Log("exit")
} | explode_data.jsonl/8549 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 129
} | [
2830,
3393,
24911,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
501,
7,
41415,
340,
11323,
514,
22792,
741,
11323,
514,
22792,
1249,
445,
61686,
5130,
2698,
538,
1669,
501,
5432,
538,
340,
2698,
538,
514,
22792,
741,
197,
322,
10236,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestErroredBlockingSeek(t *testing.T) {
mm := newMockMultichainManager()
ms := mm.chains[systemChainID]
l := ms.ledger
for i := 1; i < ledgerSize; i++ {
l.Append(ledger.CreateNextBlock(l, []*cb.Envelope{&cb.Envelope{Payload: []byte(fmt.Sprintf("%d", i))}}, ""))
}
m := newMockD()
defer close(m.recvChan)
ds := NewHandlerImpl(mm)
go ds.Handle(m)
m.recvChan <- makeSeek(systemChainID, &ab.SeekInfo{Start: seekSpecified(uint64(ledgerSize - 1)), Stop: seekSpecified(ledgerSize), Behavior: ab.SeekInfo_BLOCK_UNTIL_READY})
select {
case deliverReply := <-m.sendChan:
assert.NotNil(t, deliverReply.GetBlock(), "Expected first block")
case <-time.After(time.Second):
t.Fatalf("Timed out waiting to get first block")
}
close(ms.erroredChan)
select {
case deliverReply := <-m.sendChan:
assert.Equal(t, cb.Status_SERVICE_UNAVAILABLE, deliverReply.GetStatus(), "Mock support errored")
case <-time.After(time.Second):
t.Fatalf("Timed out waiting for error response")
}
} | explode_data.jsonl/36266 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 393
} | [
2830,
3393,
36560,
1151,
48266,
39350,
1155,
353,
8840,
836,
8,
341,
2109,
76,
1669,
501,
11571,
40404,
713,
466,
2043,
741,
47691,
1669,
9465,
5329,
1735,
58,
8948,
18837,
915,
921,
8810,
1669,
9829,
13,
50704,
198,
2023,
600,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestControllerIgnoresPodOperationsOtherThanCreateAndDelete(t *testing.T) {
controller, _ := newTestController("", "")
request := &admv1.AdmissionRequest{
UID: "uid",
Kind: metav1.GroupVersionKind{
Version: "v1",
Kind: "Pod",
},
Namespace: "NAMESPACE",
Name: "POD",
Operation: "UPDATE",
}
requireReviewAdmissionSuccess(t, controller, admv1.AdmissionReview{
Request: request,
})
} | explode_data.jsonl/32151 | {
"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,
2051,
40,
70,
2152,
416,
23527,
35120,
11409,
26067,
4021,
3036,
6435,
1155,
353,
8840,
836,
8,
341,
61615,
11,
716,
1669,
501,
2271,
2051,
19814,
85617,
23555,
1669,
609,
329,
26002,
16,
17865,
2728,
1900,
515,
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... | 1 |
func TestColDecimal128_DecodeColumn(t *testing.T) {
t.Parallel()
const rows = 50
var data ColDecimal128
for i := 0; i < rows; i++ {
v := Decimal128FromInt(i)
data.Append(v)
require.Equal(t, v, data.Row(i))
}
var buf Buffer
data.EncodeColumn(&buf)
t.Run("Golden", func(t *testing.T) {
t.Parallel()
gold.Bytes(t, buf.Buf, "col_decimal128")
})
t.Run("Ok", func(t *testing.T) {
br := bytes.NewReader(buf.Buf)
r := NewReader(br)
var dec ColDecimal128
require.NoError(t, dec.DecodeColumn(r, rows))
require.Equal(t, data, dec)
require.Equal(t, rows, dec.Rows())
dec.Reset()
require.Equal(t, 0, dec.Rows())
require.Equal(t, ColumnTypeDecimal128, dec.Type())
})
t.Run("ZeroRows", func(t *testing.T) {
r := NewReader(bytes.NewReader(nil))
var dec ColDecimal128
require.NoError(t, dec.DecodeColumn(r, 0))
})
t.Run("ErrUnexpectedEOF", func(t *testing.T) {
r := NewReader(bytes.NewReader(nil))
var dec ColDecimal128
require.ErrorIs(t, dec.DecodeColumn(r, rows), io.ErrUnexpectedEOF)
})
t.Run("NoShortRead", func(t *testing.T) {
var dec ColDecimal128
requireNoShortRead(t, buf.Buf, colAware(&dec, rows))
})
t.Run("ZeroRowsEncode", func(t *testing.T) {
var v ColDecimal128
v.EncodeColumn(nil) // should be no-op
})
} | explode_data.jsonl/68543 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 561
} | [
2830,
3393,
6127,
11269,
16,
17,
23,
78668,
534,
2933,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
4777,
6978,
284,
220,
20,
15,
198,
2405,
821,
4254,
11269,
16,
17,
23,
198,
2023,
600,
1669,
220,
15,
26,
600,
366,
6978,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIteratorSeekOptErrors(t *testing.T) {
var keys []InternalKey
var vals [][]byte
var errorIter errorSeekIter
newIter := func(opts IterOptions) *Iterator {
cmp := DefaultComparer.Compare
equal := DefaultComparer.Equal
split := func(a []byte) int { return len(a) }
iter := &fakeIter{
lower: opts.GetLowerBound(),
upper: opts.GetUpperBound(),
keys: keys,
vals: vals,
}
errorIter = errorSeekIter{internalIterator: newInvalidatingIter(iter)}
// NB: This Iterator cannot be cloned since it is not constructed
// with a readState. It suffices for this test.
return &Iterator{
opts: opts,
cmp: cmp,
equal: equal,
split: split,
merge: DefaultMerger.Merge,
iter: &errorIter,
}
}
datadriven.RunTest(t, "testdata/iterator_seek_opt_errors", func(d *datadriven.TestData) string {
switch d.Cmd {
case "define":
keys = keys[:0]
vals = vals[:0]
for _, key := range strings.Split(d.Input, "\n") {
j := strings.Index(key, ":")
keys = append(keys, base.ParseInternalKey(key[:j]))
vals = append(vals, []byte(key[j+1:]))
}
return ""
case "iter":
var opts IterOptions
var injectSeekGEErrorCounts []int
for _, arg := range d.CmdArgs {
if len(arg.Vals) < 1 {
return fmt.Sprintf("%s: %s=<value>", d.Cmd, arg.Key)
}
switch arg.Key {
case "lower":
opts.LowerBound = []byte(arg.Vals[0])
case "upper":
opts.UpperBound = []byte(arg.Vals[0])
case "seek-error":
for i := 0; i < len(arg.Vals); i++ {
n, err := strconv.Atoi(arg.Vals[i])
if err != nil {
return err.Error()
}
injectSeekGEErrorCounts = append(injectSeekGEErrorCounts, n)
}
default:
return fmt.Sprintf("%s: unknown arg: %s", d.Cmd, arg.Key)
}
}
iter := newIter(opts)
errorIter.injectSeekErrorCounts = injectSeekGEErrorCounts
return runIterCmd(d, iter, true)
default:
return fmt.Sprintf("unknown command: %s", d.Cmd)
}
})
} | explode_data.jsonl/53975 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 893
} | [
2830,
3393,
11951,
39350,
21367,
13877,
1155,
353,
8840,
836,
8,
341,
2405,
6894,
3056,
11569,
1592,
198,
2405,
28356,
52931,
3782,
271,
2405,
1465,
8537,
1465,
39350,
8537,
198,
8638,
8537,
1669,
2915,
30885,
13704,
3798,
8,
353,
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 Test_LevelPrefix(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
l := New()
t.Assert(l.GetLevelPrefix(LEVEL_DEBU), defaultLevelPrefixes[LEVEL_DEBU])
t.Assert(l.GetLevelPrefix(LEVEL_INFO), defaultLevelPrefixes[LEVEL_INFO])
t.Assert(l.GetLevelPrefix(LEVEL_NOTI), defaultLevelPrefixes[LEVEL_NOTI])
t.Assert(l.GetLevelPrefix(LEVEL_WARN), defaultLevelPrefixes[LEVEL_WARN])
t.Assert(l.GetLevelPrefix(LEVEL_ERRO), defaultLevelPrefixes[LEVEL_ERRO])
t.Assert(l.GetLevelPrefix(LEVEL_CRIT), defaultLevelPrefixes[LEVEL_CRIT])
l.SetLevelPrefix(LEVEL_DEBU, "debug")
t.Assert(l.GetLevelPrefix(LEVEL_DEBU), "debug")
l.SetLevelPrefixes(map[int]string{
LEVEL_CRIT: "critical",
})
t.Assert(l.GetLevelPrefix(LEVEL_DEBU), "debug")
t.Assert(l.GetLevelPrefix(LEVEL_INFO), defaultLevelPrefixes[LEVEL_INFO])
t.Assert(l.GetLevelPrefix(LEVEL_NOTI), defaultLevelPrefixes[LEVEL_NOTI])
t.Assert(l.GetLevelPrefix(LEVEL_WARN), defaultLevelPrefixes[LEVEL_WARN])
t.Assert(l.GetLevelPrefix(LEVEL_ERRO), defaultLevelPrefixes[LEVEL_ERRO])
t.Assert(l.GetLevelPrefix(LEVEL_CRIT), "critical")
})
gtest.C(t, func(t *gtest.T) {
buffer := bytes.NewBuffer(nil)
l := New()
l.SetWriter(buffer)
l.Debug(ctx, "test1")
t.Assert(gstr.Contains(buffer.String(), defaultLevelPrefixes[LEVEL_DEBU]), true)
buffer.Reset()
l.SetLevelPrefix(LEVEL_DEBU, "debug")
l.Debug(ctx, "test2")
t.Assert(gstr.Contains(buffer.String(), defaultLevelPrefixes[LEVEL_DEBU]), false)
t.Assert(gstr.Contains(buffer.String(), "debug"), true)
buffer.Reset()
l.SetLevelPrefixes(map[int]string{
LEVEL_ERRO: "error",
})
l.Error(ctx, "test3")
t.Assert(gstr.Contains(buffer.String(), defaultLevelPrefixes[LEVEL_ERRO]), false)
t.Assert(gstr.Contains(buffer.String(), "error"), true)
})
} | explode_data.jsonl/2604 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 793
} | [
2830,
3393,
78861,
14335,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
8810,
1669,
1532,
741,
197,
3244,
11711,
2333,
2234,
4449,
14335,
7,
39877,
2881,
14928,
701,
1638,
4449,
143... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHealthCheckExtensionUsageWithCheckCollectorPipeline(t *testing.T) {
config := Config{
TCPAddr: confignet.TCPAddr{
Endpoint: testutil.GetAvailableLocalAddress(t),
},
CheckCollectorPipeline: checkCollectorPipelineSettings{
Enabled: true,
Interval: "5m",
ExporterFailureThreshold: 1,
},
Path: "/",
}
hcExt := newServer(config, zap.NewNop())
require.NotNil(t, hcExt)
require.NoError(t, hcExt.Start(context.Background(), componenttest.NewNopHost()))
t.Cleanup(func() { require.NoError(t, hcExt.Shutdown(context.Background())) })
// Give a chance for the server goroutine to run.
runtime.Gosched()
newView := view.View{Name: exporterFailureView}
currentTime := time.Now()
vd1 := &view.Data{
View: &newView,
Start: currentTime.Add(-2 * time.Minute),
End: currentTime,
Rows: nil,
}
vd2 := &view.Data{
View: &newView,
Start: currentTime.Add(-1 * time.Minute),
End: currentTime,
Rows: nil,
}
client := &http.Client{}
url := "http://" + config.TCPAddr.Endpoint
resp0, err := client.Get(url)
require.NoError(t, err)
defer resp0.Body.Close()
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, vd1)
require.NoError(t, hcExt.Ready())
resp1, err := client.Get(url)
require.NoError(t, err)
defer resp1.Body.Close()
require.Equal(t, http.StatusOK, resp1.StatusCode)
require.NoError(t, hcExt.NotReady())
resp2, err := client.Get(url)
require.NoError(t, err)
defer resp2.Body.Close()
require.Equal(t, http.StatusInternalServerError, resp2.StatusCode)
hcExt.exporter.exporterFailureQueue = append(hcExt.exporter.exporterFailureQueue, vd2)
require.NoError(t, hcExt.Ready())
resp3, err := client.Get(url)
require.NoError(t, err)
defer resp3.Body.Close()
require.Equal(t, http.StatusInternalServerError, resp3.StatusCode)
} | explode_data.jsonl/11619 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 761
} | [
2830,
3393,
14542,
3973,
12049,
14783,
2354,
3973,
53694,
34656,
1155,
353,
8840,
836,
8,
341,
25873,
1669,
5532,
515,
197,
10261,
7123,
13986,
25,
2335,
84858,
836,
7123,
13986,
515,
298,
197,
27380,
25,
1273,
1314,
2234,
16485,
7319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCatalog_ListDatacenters_DistanceSort(t *testing.T) {
t.Parallel()
dir1, s1 := testServer(t)
defer os.RemoveAll(dir1)
defer s1.Shutdown()
codec := rpcClient(t, s1)
defer codec.Close()
dir2, s2 := testServerDC(t, "dc2")
defer os.RemoveAll(dir2)
defer s2.Shutdown()
dir3, s3 := testServerDC(t, "acdc")
defer os.RemoveAll(dir3)
defer s3.Shutdown()
// Try to join
joinWAN(t, s2, s1)
joinWAN(t, s3, s1)
testrpc.WaitForLeader(t, s1.RPC, "dc1")
var out []string
if err := msgpackrpc.CallWithCodec(codec, "Catalog.ListDatacenters", struct{}{}, &out); err != nil {
t.Fatalf("err: %v", err)
}
// It's super hard to force the Serfs into a known configuration of
// coordinates, so the best we can do is make sure that the sorting
// function is getting called (it's tested extensively in rtt_test.go).
// Since this is relative to dc1, it will be listed first (proving we
// went into the sort fn).
if len(out) != 3 {
t.Fatalf("bad: %v", out)
}
if out[0] != "dc1" {
t.Fatalf("bad: %v", out)
}
} | explode_data.jsonl/49220 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 424
} | [
2830,
3393,
41606,
27104,
1043,
85441,
1557,
3924,
10231,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
48532,
16,
11,
274,
16,
1669,
1273,
5475,
1155,
340,
16867,
2643,
84427,
14161,
16,
340,
16867,
274,
16,
10849,
18452,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestScanRows(t *testing.T) {
user1 := User{Name: "ScanRowsUser1", Age: 1, Birthday: parseTime("2000-1-1")}
user2 := User{Name: "ScanRowsUser2", Age: 10, Birthday: parseTime("2010-1-1")}
user3 := User{Name: "ScanRowsUser3", Age: 20, Birthday: parseTime("2020-1-1")}
DB.Save(&user1).Save(&user2).Save(&user3)
rows, err := DB.Table("users").Where("name = ? or name = ?", user2.Name, user3.Name).Select("name, age").Rows()
if err != nil {
t.Errorf("Not error should happen, got %v", err)
}
type Result struct {
Name string
Age int
}
var results []Result
for rows.Next() {
var result Result
if err := DB.ScanRows(rows, &result); err != nil {
t.Errorf("should get no error, but got %v", err)
}
results = append(results, result)
}
if !reflect.DeepEqual(results, []Result{{Name: "ScanRowsUser2", Age: 10}, {Name: "ScanRowsUser3", Age: 20}}) {
t.Errorf("Should find expected results")
}
} | explode_data.jsonl/28048 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 360
} | [
2830,
3393,
26570,
9024,
1155,
353,
8840,
836,
8,
341,
19060,
16,
1669,
2657,
63121,
25,
330,
26570,
9024,
1474,
16,
497,
13081,
25,
220,
16,
11,
36240,
25,
4715,
1462,
445,
17,
15,
15,
15,
12,
16,
12,
16,
42132,
19060,
17,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestRegExpr_Match(t *testing.T) {
var useCases = []struct {
description string
prefix string
suffix string
filter string
location string
expect bool
}{
{
description: "prefix match",
prefix: "foo/",
location: "foo/abc.txt",
expect: true,
},
{
description: "prefix no match",
prefix: "zfoo/",
location: "foo/abc.txt",
expect: false,
},
{
description: "suffix match",
suffix: "txt",
location: "foo/abc.txt",
expect: true,
},
{
description: "suffix no match",
suffix: ".abc",
location: "foo/abc.txt",
expect: false,
},
{
description: "regexpr match",
filter: "asset\\d+\\.txt",
location: "asset0001.txt",
expect: true,
},
{
description: "regexpr no match",
filter: "asset\\d+\\.txt",
location: "asset.txt",
expect: false,
},
}
for _, useCase := range useCases {
matcher, err := NewBasic(useCase.prefix, useCase.suffix, useCase.filter)
if !assert.Nil(t, err, useCase.description) {
continue
}
parent, name := path.Split(useCase.location)
info := file.NewInfo(name, 0, 0644, time.Now(), false)
actual := matcher.Match(parent, info)
assert.EqualValues(t, useCase.expect, actual, useCase.description)
}
} | explode_data.jsonl/62378 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 637
} | [
2830,
3393,
3477,
16041,
1245,
754,
1155,
353,
8840,
836,
8,
1476,
2405,
990,
37302,
284,
3056,
1235,
341,
197,
42407,
914,
198,
197,
3223,
5060,
414,
914,
198,
197,
1903,
13554,
414,
914,
198,
197,
50108,
414,
914,
198,
197,
53761,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_SetIsSuperset(t *testing.T) {
a := NewSet()
a.Add(9)
a.Add(5)
a.Add(2)
a.Add(1)
a.Add(11)
b := NewSet()
b.Add(5)
b.Add(2)
b.Add(11)
if !a.IsSuperset(b) {
t.Error("set a should be a superset of set b")
}
b.Add(42)
if a.IsSuperset(b) {
t.Error("set a should not be a superset of set b because set b has a 42")
}
} | explode_data.jsonl/186 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 180
} | [
2830,
3393,
14812,
3872,
10048,
44146,
1155,
353,
8840,
836,
8,
341,
11323,
1669,
1532,
1649,
741,
11323,
1904,
7,
24,
340,
11323,
1904,
7,
20,
340,
11323,
1904,
7,
17,
340,
11323,
1904,
7,
16,
340,
11323,
1904,
7,
16,
16,
692,
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... | 3 |
func Test_Multi(t *testing.T) {
assert := assert.New(t)
//SetMulti
err := cMem.SetMulti(map[string]string{
"k1": "111",
"k2": "222",
}, time.Minute)
assert.Nil(err)
//GetMulti
data0, err := cMem.GetMulti([]string{"k1", "k2"})
assert.Nil(err)
assert.Equal("111", data0["k1"])
assert.Equal("222", data0["k2"])
//DelMulti
err = cMem.DelMulti([]string{"k1", "k2"})
assert.Nil(err)
_data, err := cMem.GetMulti([]string{"k1", "k2"})
assert.NotNil(err)
_, ok := _data["k1"]
assert.False(ok)
_, ok = _data["k2"]
assert.False(ok)
} | explode_data.jsonl/74760 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 262
} | [
2830,
3393,
1245,
7068,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
197,
322,
1649,
20358,
198,
9859,
1669,
272,
18816,
4202,
20358,
9147,
14032,
30953,
515,
197,
197,
62911,
16,
788,
330,
16,
16,
16,
756,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSQLManagerMigrateFromMajor0Minor6ToMajor0Minor7(t *testing.T) {
// Setting up the Migration is easy:
// var db = getSqlDatabaseFromSomewhere()
// s := NewSQLManager(db, nil)
//
// if _, err := s.CreateSchemas(); err != nil {
// log.Fatalf("Could not create mysql schema: %v", err)
// }
//
// migrator = &SQLManagerMigrateFromMajor0Minor6ToMajor0Minor7{
// DB:db,
// SQLManager:s,
// }
for k, s := range map[string]ladon.ManagerMigrator{
"postgres": migrators["postgres"],
"mysql": migrators["mysql"],
} {
t.Run(fmt.Sprintf("manager=%s", k), func(t *testing.T) {
// This create part is only necessary to populate the data store with some values. If you
// migrate you won't need this
for _, c := range ladon.TestManagerPolicies {
t.Run(fmt.Sprintf("create=%s", k), func(t *testing.T) {
require.NoError(t, s.Create(c))
})
}
require.NoError(t, s.Migrate())
for _, c := range ladon.TestManagerPolicies {
t.Run(fmt.Sprintf("fetch=%s", k), func(t *testing.T) {
get, err := s.GetManager().Get(c.GetID())
require.NoError(t, err)
ladon.AssertPolicyEqual(t, c, get)
require.NoError(t, s.GetManager().Delete(c.GetID()))
})
}
})
}
} | explode_data.jsonl/69012 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 529
} | [
2830,
3393,
6688,
2043,
44,
34479,
3830,
34475,
15,
57024,
21,
1249,
34475,
15,
57024,
22,
1155,
353,
8840,
836,
8,
341,
197,
322,
20037,
705,
279,
21248,
374,
4135,
510,
197,
322,
220,
762,
2927,
284,
633,
8269,
5988,
3830,
49882,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAgent_RegisterService_ManagedConnectProxy_Disabled(t *testing.T) {
t.Parallel()
assert := assert.New(t)
a := NewTestAgent(t.Name(), ``)
defer a.Shutdown()
// Register a proxy. Note that the destination doesn't exist here on
// this agent or in the catalog at all. This is intended and part
// of the design.
args := &api.AgentServiceRegistration{
Name: "web",
Port: 8000,
Connect: &api.AgentServiceConnect{
Proxy: &api.AgentServiceConnectProxy{
ExecMode: "script",
Command: []string{"proxy.sh"},
Config: map[string]interface{}{
"foo": "bar",
},
},
},
}
req, _ := http.NewRequest("PUT", "/v1/agent/service/register?token=abc123", jsonReader(args))
resp := httptest.NewRecorder()
_, err := a.srv.AgentRegisterService(resp, req)
assert.Error(err)
// Ensure the target service does not exist
_, ok := a.State.Services()["web"]
assert.False(ok, "does not has service")
} | explode_data.jsonl/33630 | {
"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,
16810,
73124,
1860,
71628,
3279,
14611,
16219,
45525,
2312,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
6948,
1669,
2060,
7121,
1155,
340,
11323,
1669,
1532,
2271,
16810,
1155,
2967,
1507,
9902,
340,
16867,
264,
108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExportWildcardFSNodeCommonJS(t *testing.T) {
default_suite.expectBundled(t, bundled{
files: map[string]string{
"/entry.js": `
export * from 'fs'
`,
},
entryPaths: []string{"/entry.js"},
options: config.Options{
Mode: config.ModeBundle,
OutputFormat: config.FormatCommonJS,
AbsOutputFile: "/out.js",
Platform: config.PlatformNode,
},
})
} | explode_data.jsonl/38504 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 173
} | [
2830,
3393,
16894,
92988,
8485,
1955,
10839,
12545,
1155,
353,
8840,
836,
8,
341,
11940,
57239,
25952,
33,
1241,
832,
1155,
11,
51450,
515,
197,
74075,
25,
2415,
14032,
30953,
515,
298,
197,
3115,
4085,
2857,
788,
22074,
571,
59440,
353... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTableBuild_walk_noTranslate(t *testing.T) {
tbl := Table{
Name: "mytable",
IndexAsTag: true,
Fields: []Field{
{
Name: "myfield1",
Oid: ".1.0.0.0.1.1",
IsTag: true,
},
{
Name: "myfield2",
Oid: ".1.0.0.0.1.2",
},
{
Name: "myfield3",
Oid: ".1.0.0.0.1.3",
Conversion: "float",
},
{
Name: "myfield4",
Oid: ".1.0.0.2.1.5",
OidIndexSuffix: ".9.9",
},
{
Name: "myfield5",
Oid: ".1.0.0.2.1.5",
OidIndexLength: 1,
},
},
}
tb, err := tbl.Build(tsc, true)
require.NoError(t, err)
require.Equal(t, tb.Name, "mytable")
rtr1 := RTableRow{
Tags: map[string]string{
"myfield1": "foo",
"index": "0",
},
Fields: map[string]interface{}{
"myfield2": 1,
"myfield3": float64(0.123),
"myfield4": 11,
"myfield5": 11,
},
}
rtr2 := RTableRow{
Tags: map[string]string{
"myfield1": "bar",
"index": "1",
},
Fields: map[string]interface{}{
"myfield2": 2,
"myfield3": float64(0.456),
"myfield4": 22,
"myfield5": 22,
},
}
rtr3 := RTableRow{
Tags: map[string]string{
"index": "2",
},
Fields: map[string]interface{}{
"myfield2": 0,
"myfield3": float64(0.0),
},
}
rtr4 := RTableRow{
Tags: map[string]string{
"index": "3",
},
Fields: map[string]interface{}{
"myfield3": float64(9.999),
},
}
require.Len(t, tb.Rows, 4)
require.Contains(t, tb.Rows, rtr1)
require.Contains(t, tb.Rows, rtr2)
require.Contains(t, tb.Rows, rtr3)
require.Contains(t, tb.Rows, rtr4)
} | explode_data.jsonl/50791 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 920
} | [
2830,
3393,
2556,
11066,
56131,
6536,
27473,
1155,
353,
8840,
836,
8,
341,
3244,
2024,
1669,
6633,
515,
197,
21297,
25,
981,
330,
2408,
2005,
756,
197,
197,
1552,
2121,
5668,
25,
830,
345,
197,
197,
8941,
25,
3056,
1877,
515,
298,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_Execution_CheckHealthy_Never_Healthy_TG(t *testing.T) {
// Should end in Alert Bad Thing Happened State
release := models.MockRelease(t)
maws := models.MockAwsClients(release)
maws.ALB.DescribeTargetHealthResp["web-elb-target"] = &mocks.DescribeTargetHealthResponse{}
stateMachine := createTestStateMachine(t, maws)
exec, err := stateMachine.Execute(release)
assert.Error(t, err)
ep := exec.Path()
assert.Equal(t, []string{
"Validate",
"Lock",
"ValidateResources",
"Deploy",
"WaitForDeploy",
"WaitForHealthy",
"CheckHealthy"}, ep[0:7])
assert.Equal(t, []string{
"CleanUpFailure",
"ReleaseLockFailure",
"FailureClean",
}, ep[len(ep)-3:len(ep)])
assert.Regexp(t, "Timeout", exec.LastOutputJSON)
assert.Regexp(t, "success\": false", exec.LastOutputJSON)
} | explode_data.jsonl/3587 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 307
} | [
2830,
3393,
62,
20294,
28188,
96113,
1604,
2054,
62,
96113,
1139,
38,
1155,
353,
8840,
836,
8,
341,
197,
322,
12260,
835,
304,
13975,
11461,
37200,
34700,
6758,
3234,
198,
17200,
1623,
1669,
4119,
24664,
16077,
1155,
692,
2109,
8635,
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 TestReapMaxBytesMaxGas(t *testing.T) {
app := kvstore.NewApplication()
cc := proxy.NewLocalClientCreator(app)
mempool, cleanup := newMempoolWithApp(cc)
defer cleanup()
// Ensure gas calculation behaves as expected
checkTxs(t, mempool, 10, UnknownPeerID)
//tx0 := mempool.TxsFront().Value.(*mempoolTx)
////// assert that kv store has gas wanted = 1.
//require.Equal(t, app.CheckTx(abci.RequestCheckTx{Tx: tx0.tx}).GasWanted, int64(1), "KVStore had a gas value neq to 1")
//require.Equal(t, tx0.gasWanted, int64(1), "transactions gas was set incorrectly")
////// ensure each tx is 20 bytes long
//require.Equal(t, len(tx0.tx), 20, "Tx is longer than 20 bytes")
//mempool.Flush()
//
//// each table driven test creates numTxsToCreate txs with checkTx, and at the end clears all remaining txs.
//// each tx has 20 bytes
//tests := []struct {
// numTxsToCreate int
// maxBytes int64
// maxGas int64
// expectedNumTxs int
//}{
//{20, -1, -1, 20},
//{20, -1, 0, 0},
//{20, -1, 10, 10},
//{20, -1, 30, 20},
//{20, 0, -1, 0},
//{20, 0, 10, 0},
//{20, 10, 10, 0},
//{20, 24, 10, 1},
//{20, 240, 5, 5},
//{20, 240, -1, 10},
//{20, 240, 10, 10},
//{20, 240, 15, 10},
//{20, 20000, -1, 20},
//{20, 20000, 5, 5},
//{20, 20000, 30, 20},
//}
//for tcIndex, tt := range tests {
// checkTxs(t, mempool, tt.numTxsToCreate, UnknownPeerID) //随机生成20个交易,并进行检测
// got := mempool.ReapMaxBytesMaxGas(tt.maxBytes, tt.maxGas)
// assert.Equal(t, tt.expectedNumTxs, len(got), "Got %d txs, expected %d, tc #%d",
// len(got), tt.expectedNumTxs, tcIndex)
// for _,tx := range got{
// fmt.Println(tx.String())
// }
//
// mempool.Flush()
//}
} | explode_data.jsonl/14608 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 769
} | [
2830,
3393,
693,
391,
5974,
7078,
5974,
58728,
1155,
353,
8840,
836,
8,
341,
28236,
1669,
16178,
4314,
7121,
4988,
741,
63517,
1669,
13291,
7121,
7319,
2959,
31865,
11462,
340,
2109,
3262,
1749,
11,
21290,
1669,
501,
44,
3262,
1749,
235... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSaveState(t *testing.T) {
testActorRuntime := newTestActorsRuntime()
actorType, actorID := getTestActorTypeAndID()
fakeData := strconv.Quote("fakeData")
var val interface{}
jsoniter.ConfigFastest.Unmarshal([]byte(fakeData), &val)
// act
actorKey := testActorRuntime.constructCompositeKey(actorType, actorID)
fakeCallAndActivateActor(testActorRuntime, actorKey)
err := testActorRuntime.SaveState(&SaveStateRequest{
ActorID: actorID,
ActorType: actorType,
Key: TestKeyName,
Value: val,
})
assert.NoError(t, err)
// assert
response, err := testActorRuntime.GetState(&GetStateRequest{
ActorID: actorID,
ActorType: actorType,
Key: TestKeyName,
})
assert.NoError(t, err)
assert.Equal(t, fakeData, string(response.Data))
} | explode_data.jsonl/12887 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 288
} | [
2830,
3393,
8784,
1397,
1155,
353,
8840,
836,
8,
341,
18185,
18870,
15123,
1669,
501,
2271,
2414,
1087,
15123,
741,
93410,
929,
11,
12089,
915,
1669,
633,
2271,
18870,
929,
3036,
915,
741,
1166,
726,
1043,
1669,
33317,
13,
19466,
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 Test405StatusCodev0(t *testing.T) {
tests := []struct {
note string
reqs []tr
}{
{"v0 data one levels 405", []tr{
{http.MethodHead, "/data/lvl2", "", 405, ""},
{http.MethodConnect, "/data/lvl2", "", 405, ""},
{http.MethodDelete, "/data/lvl2", "", 405, ""},
{http.MethodOptions, "/data/lvl2", "", 405, ""},
{http.MethodTrace, "/data/lvl2", "", 405, ""},
{http.MethodGet, "/data/lvl2", "", 405, ""},
{http.MethodPatch, "/data/lvl2", "", 405, ""},
{http.MethodPut, "/data/lvl2", "", 405, ""},
}},
{"v0 data 405", []tr{
{http.MethodHead, "/data", "", 405, ""},
{http.MethodConnect, "/data", "", 405, ""},
{http.MethodDelete, "/data", "", 405, ""},
{http.MethodOptions, "/data", "", 405, ""},
{http.MethodTrace, "/data", "", 405, ""},
{http.MethodGet, "/data", "", 405, ""},
{http.MethodPatch, "/data", "", 405, ""},
{http.MethodPut, "/data", "", 405, ""},
}},
}
for _, tc := range tests {
test.Subtest(t, tc.note, func(t *testing.T) {
executeRequestsv0(t, tc.reqs)
})
}
} | explode_data.jsonl/78983 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 465
} | [
2830,
3393,
19,
15,
20,
15872,
85,
15,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
9038,
1272,
914,
198,
197,
24395,
82,
3056,
376,
198,
197,
59403,
197,
197,
4913,
85,
15,
821,
825,
5866,
220,
19,
15,
20,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestHeavy(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Error("Recovered in TestHeavy", r)
}
return
}()
s, e := ioutil.ReadFile("big-poetry.txt")
if e != nil {
t.Error("Cant read file")
}
err := compareInOut(string(s))
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/71762 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 133
} | [
2830,
3393,
64469,
1155,
353,
8840,
836,
8,
341,
16867,
2915,
368,
341,
197,
743,
435,
1669,
11731,
2129,
435,
961,
2092,
341,
298,
3244,
6141,
445,
81476,
304,
3393,
64469,
497,
435,
340,
197,
197,
532,
197,
853,
198,
197,
69826,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDocumentSymbol(t *testing.T) {
t.Parallel()
symbolContext.setup(t)
test := func(t *testing.T, data map[string][]string) {
for k, v := range data {
testDocumentSymbol(t, &documentSymbolTestCase{input: k, output: v})
}
}
t.Run("basic document symbol", func(t *testing.T) {
test(t, map[string][]string{
"basic/a.go": {"basic/a.go:function:A:1:17"},
"basic/b.go": {"basic/b.go:function:B:1:17"},
})
})
t.Run("detailed document symbol", func(t *testing.T) {
test(t, map[string][]string{
"detailed/a.go": {"detailed/a.go:field:T.F:1:28", "detailed/a.go:class:T:1:17"},
})
})
t.Run("exported defs unexported type", func(t *testing.T) {
test(t, map[string][]string{
"exported_on_unexported/a.go": {"exported_on_unexported/a.go:field:t.F:1:28", "exported_on_unexported/a.go:class:t:1:17"},
})
})
t.Run("xtest", func(t *testing.T) {
test(t, map[string][]string{
"xtest/y_test.go": {"xtest/y_test.go:function:Y:1:22"},
"xtest/b_test.go": {"xtest/b_test.go:function:Y:1:17"},
})
})
t.Run("subdirectory document symbol", func(t *testing.T) {
test(t, map[string][]string{
"subdirectory/a.go": {"subdirectory/a.go:function:A:1:17"},
"subdirectory/d2/b.go": {"subdirectory/d2/b.go:function:B:1:86"},
})
})
t.Run("multiple packages in dir", func(t *testing.T) {
test(t, map[string][]string{
"multiple/a.go": {"multiple/a.go:function:A:1:17"},
})
})
t.Run("go root", func(t *testing.T) {
test(t, map[string][]string{
"goroot/a.go": {"goroot/a.go:variable:x:1:51"},
})
})
t.Run("go project", func(t *testing.T) {
test(t, map[string][]string{
"goproject/a/a.go": {"goproject/a/a.go:function:A:1:17"},
"goproject/b/b.go": {},
})
})
t.Run("go symbols", func(t *testing.T) {
test(t, map[string][]string{
"symbols/abc.go": {
"symbols/abc.go:class:XYZ:3:6",
"symbols/abc.go:method:XYZ.ABC:5:14",
"symbols/abc.go:variable:A:8:2",
"symbols/abc.go:constant:B:12:2",
"symbols/abc.go:class:C:17:2",
"symbols/abc.go:interface:UVW:20:6",
"symbols/abc.go:class:T:22:6"},
"symbols/bcd.go": {
"symbols/bcd.go:class:YZA:3:6",
"symbols/bcd.go:method:YZA.BCD:5:14"},
"symbols/cde.go": {
"symbols/cde.go:variable:a:4:2",
"symbols/cde.go:variable:b:4:5",
"symbols/cde.go:variable:c:5:2"},
"symbols/xyz.go": {
"symbols/xyz.go:function:yza:3:6"},
})
})
t.Run("unexpected paths", func(t *testing.T) {
test(t, map[string][]string{
"unexpected_paths/a.go": {"unexpected_paths/a.go:function:A:1:17"},
})
})
t.Run("recv in different file", func(t *testing.T) {
test(t, map[string][]string{
"different/abc.go": {"different/abc.go:class:XYZ:2:6"},
"different/bcd.go": {"different/bcd.go:method:XYZ.ABC:2:14"},
})
})
} | explode_data.jsonl/40218 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1396
} | [
2830,
3393,
7524,
15090,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1903,
4001,
1972,
25338,
1155,
692,
18185,
1669,
2915,
1155,
353,
8840,
836,
11,
821,
2415,
14032,
45725,
917,
8,
341,
197,
2023,
595,
11,
348,
1669,
2088... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGenerateDockerBuild(t *testing.T) {
dir, err := ioutil.TempDir("", "nodejs-chaincode-test")
if err != nil {
t.Fatal(err)
}
content := []byte(`
{
"name": "fabric-shim-test",
"version": "1.0.0-snapshot",
"script": {
"start": "node chaincode.js"
},
"dependencies": {
"is-sorted": "*"
}
}`)
defer os.RemoveAll(dir) // clean up
tmpfn := filepath.Join(dir, "package.json")
if err := ioutil.WriteFile(tmpfn, content, 0666); err != nil {
t.Fatal(err)
}
content = []byte(`
const shim = require('fabric-shim');
var chaincode = {};
chaincode.Init = function(stub) {
return Promise.resolve(shim.success());
};
chaincode.Invoke = function(stub) {
console.log('Transaction ID: ' + stub.getTxID());
return stub.getState('dummy')
.then(() => {
return shim.success();
}, () => {
return shim.error();
});
};
shim.start(chaincode);`)
tmpfn = filepath.Join(dir, "chaincode.js")
if err := ioutil.WriteFile(tmpfn, content, 0666); err != nil {
t.Fatal(err)
}
ccSpec := &peer.ChaincodeSpec{
Type: peer.ChaincodeSpec_NODE,
ChaincodeId: &peer.ChaincodeID{Path: dir},
Input: &peer.ChaincodeInput{Args: [][]byte{[]byte("init")}}}
cp, _ := platform.GetDeploymentPayload(ccSpec.Path())
cds := &peer.ChaincodeDeploymentSpec{
ChaincodeSpec: ccSpec,
CodePackage: cp}
payload := bytes.NewBuffer(nil)
gw := gzip.NewWriter(payload)
tw := tar.NewWriter(gw)
err = platform.GenerateDockerBuild(cds.Path(), cds.Bytes(), tw)
if err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/58619 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 692
} | [
2830,
3393,
31115,
35,
13659,
11066,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
3509,
2519,
65186,
1851,
16839,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
630,
27751,
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 TestCustomParserBasicType(t *testing.T) {
type ConstT int32
type config struct {
Const ConstT `env:"CONST_"`
}
exp := ConstT(123)
os.Setenv("CONST_", fmt.Sprintf("%d", exp))
customParserFunc := func(v string) (interface{}, error) {
i, err := strconv.Atoi(v)
if err != nil {
return nil, err
}
r := ConstT(i)
return r, nil
}
cfg := &config{}
err := ParseWithFuncs(cfg, map[reflect.Type]ParserFunc{
reflect.TypeOf(ConstT(0)): customParserFunc,
})
assert.NoError(t, err)
assert.Equal(t, exp, cfg.Const)
} | explode_data.jsonl/78788 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 230
} | [
2830,
3393,
10268,
6570,
15944,
929,
1155,
353,
8840,
836,
8,
341,
13158,
24522,
51,
526,
18,
17,
271,
13158,
2193,
2036,
341,
197,
197,
19167,
24522,
51,
1565,
3160,
2974,
41795,
62,
8805,
197,
630,
48558,
1669,
24522,
51,
7,
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... | 2 |
func TestYouonB(t *testing.T) {
const want = "byabyubyobyabyibyubyebyo"
for _, v := range [2]string{"びゃびゅびょびぁびぃびぅびぇびぉ", "ビャビュビョビァビィビゥビェビォ"} {
got, err := KanaToRomaji(v)
assert.Equal(t, want, got)
assert.Nil(t, err)
}
} | explode_data.jsonl/11330 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 145
} | [
2830,
3393,
2610,
263,
33,
1155,
353,
8840,
836,
8,
341,
4777,
1366,
284,
330,
1694,
6115,
20028,
27015,
6115,
579,
88,
392,
9011,
1694,
78,
1837,
2023,
8358,
348,
1669,
2088,
508,
17,
30953,
4913,
124406,
124234,
124406,
138218,
124406... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRegister(t *testing.T) {
SchedulerConfigLoader = func(policyGroup string) (config *SchedulerConfig, e error) {
return nil, fmt.Errorf("error")
}
cw := CreateConfigWatcher("rm-id", "p-group", 3*time.Second)
reloader := &FakeConfigReloader{}
cw.RegisterCallback(reloader)
assert.Equal(t, cw.reloader, reloader)
} | explode_data.jsonl/26850 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
8690,
1155,
353,
8840,
836,
8,
341,
7568,
15222,
2648,
9181,
284,
2915,
72782,
2808,
914,
8,
320,
1676,
353,
38878,
2648,
11,
384,
1465,
8,
341,
197,
853,
2092,
11,
8879,
13080,
445,
841,
1138,
197,
630,
1444,
86,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDependencyOutputTypeConversion(t *testing.T) {
t.Parallel()
cleanupTerraformFolder(t, TEST_FIXTURE_GET_OUTPUT)
cleanupTerraformFolder(t, TEST_FIXTURE_INPUTS)
tmpEnvPath := copyEnvironment(t, ".")
inputsPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_INPUTS)
rootPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_GET_OUTPUT, "type-conversion")
// First apply the inputs module
runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", inputsPath))
// Then apply the outputs module
showStdout := bytes.Buffer{}
showStderr := bytes.Buffer{}
assert.NoError(
t,
runTerragruntCommand(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath), &showStdout, &showStderr),
)
logBufferContentsLineByLine(t, showStdout, "show stdout")
logBufferContentsLineByLine(t, showStderr, "show stderr")
// Now check the outputs to make sure they are as expected
stdout := bytes.Buffer{}
stderr := bytes.Buffer{}
require.NoError(
t,
runTerragruntCommand(t, fmt.Sprintf("terragrunt output -no-color -json --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath), &stdout, &stderr),
)
outputs := map[string]TerraformOutput{}
require.NoError(t, json.Unmarshal([]byte(stdout.String()), &outputs))
assert.Equal(t, outputs["bool"].Value, true)
assert.Equal(t, outputs["list_bool"].Value, []interface{}{true, false})
assert.Equal(t, outputs["list_number"].Value, []interface{}{1.0, 2.0, 3.0})
assert.Equal(t, outputs["list_string"].Value, []interface{}{"a", "b", "c"})
assert.Equal(t, outputs["map_bool"].Value, map[string]interface{}{"foo": true, "bar": false, "baz": true})
assert.Equal(t, outputs["map_number"].Value, map[string]interface{}{"foo": 42.0, "bar": 12345.0})
assert.Equal(t, outputs["map_string"].Value, map[string]interface{}{"foo": "bar"})
assert.Equal(t, outputs["number"].Value, 42.0)
assert.Equal(t, outputs["object"].Value, map[string]interface{}{"list": []interface{}{1.0, 2.0, 3.0}, "map": map[string]interface{}{"foo": "bar"}, "num": 42.0, "str": "string"})
assert.Equal(t, outputs["string"].Value, "string")
assert.Equal(t, outputs["from_env"].Value, "default")
} | explode_data.jsonl/10140 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 869
} | [
2830,
3393,
36387,
5097,
929,
48237,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1444,
60639,
51,
13886,
627,
13682,
1155,
11,
13602,
42635,
41486,
12702,
23981,
340,
1444,
60639,
51,
13886,
627,
13682,
1155,
11,
13602,
42635,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateValid(t *testing.T) {
ctx := kapi.WithUser(kapi.WithNamespace(kapi.NewContext(), "unittest"), &user.DefaultInfo{Name: "system:admin"})
storage := makeTestStorage()
storage.Create(ctx, &authorizationapi.PolicyBinding{
ObjectMeta: kapi.ObjectMeta{Name: bootstrappolicy.DefaultMasterAuthorizationNamespace, Namespace: "unittest"},
})
roleBinding := &authorizationapi.RoleBinding{
ObjectMeta: kapi.ObjectMeta{Name: "my-roleBinding"},
RoleRef: kapi.ObjectReference{Name: "admin", Namespace: bootstrappolicy.DefaultMasterAuthorizationNamespace},
}
obj, err := storage.Create(ctx, roleBinding)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
switch obj.(type) {
case *kapi.Status:
t.Errorf("Got back unexpected status: %#v", obj)
case *authorizationapi.RoleBinding:
// expected case
default:
t.Errorf("Got unexpected type: %#v", obj)
}
} | explode_data.jsonl/9642 | {
"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,
4021,
4088,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
595,
2068,
26124,
1474,
5969,
2068,
26124,
22699,
5969,
2068,
7121,
1972,
1507,
330,
91005,
3975,
609,
872,
13275,
1731,
63121,
25,
330,
8948,
25,
2882,
1,
8824,
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 TestMapValue_Iterator(t *testing.T) {
mapValue := NewDynamicMap(map[string]map[int32]float32{
"nested": {1: -1.0, 2: 2.0},
"empty": {}}).(traits.Mapper)
it := mapValue.Iterator()
var i = 0
var fieldNames []interface{}
for ; it.HasNext() == True; i++ {
if value := mapValue.Get(it.Next()); IsError(value) {
t.Error(value)
} else {
fieldNames = append(fieldNames, value)
}
}
if len(fieldNames) != 2 {
t.Errorf("Did not find the correct number of fields: %v", fieldNames)
}
if it.Next() != nil {
t.Error("Iterator ran off the end of the field names")
}
} | explode_data.jsonl/13232 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 239
} | [
2830,
3393,
2227,
1130,
7959,
465,
850,
1155,
353,
8840,
836,
8,
341,
19567,
1130,
1669,
1532,
21752,
2227,
9147,
14032,
60,
2186,
18640,
18,
17,
60,
3649,
18,
17,
515,
197,
197,
1,
59271,
788,
314,
16,
25,
481,
16,
13,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func Test_extractHostInfo(t *testing.T) {
cases := []struct {
s string
e sshHostInfo
}{
{s: "host", e: sshHostInfo{host: "host"}},
{s: "root@host", e: sshHostInfo{user: "root", host: "host"}},
{s: "root@host:22", e: sshHostInfo{user: "root", host: "host", port: "22"}},
{s: "host:22", e: sshHostInfo{host: "host", port: "22"}},
{s: "dokku@simple-task-02efb9c544", e: sshHostInfo{host: "simple-task-02efb9c544", user: "dokku"}},
}
for _, c := range cases {
i := extractHostInfo(c.s)
assert.Equal(t, c.e, i)
}
} | explode_data.jsonl/6483 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 246
} | [
2830,
3393,
39123,
9296,
1731,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
1903,
914,
198,
197,
7727,
29230,
9296,
1731,
198,
197,
59403,
197,
197,
84386,
25,
330,
3790,
497,
384,
25,
29230,
9296,
1731,
90,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestMetricDataToLogService(t *testing.T) {
logger := zap.NewNop()
md := pdata.NewMetrics()
md.ResourceMetrics().AppendEmpty() // Add an empty ResourceMetrics
rm := md.ResourceMetrics().AppendEmpty()
rm.Resource().Attributes().InsertString("labelB", "valueB")
rm.Resource().Attributes().InsertString("labelA", "valueA")
rm.Resource().Attributes().InsertString("a", "b")
ilms := rm.InstrumentationLibraryMetrics()
ilms.AppendEmpty() // Add an empty InstrumentationLibraryMetrics
ilm := ilms.AppendEmpty()
metrics := ilm.Metrics()
badNameMetric := metrics.AppendEmpty()
badNameMetric.SetName("")
noneMetric := metrics.AppendEmpty()
noneMetric.SetName("none")
intGaugeMetric := metrics.AppendEmpty()
intGaugeMetric.SetDataType(pdata.MetricDataTypeIntGauge)
intGaugeMetric.SetName("int_gauge")
intGauge := intGaugeMetric.IntGauge()
intGaugeDataPoints := intGauge.DataPoints()
intGaugeDataPoint := intGaugeDataPoints.AppendEmpty()
intGaugeDataPoint.LabelsMap().Insert("innerLabel", "innerValue")
intGaugeDataPoint.SetValue(10)
intGaugeDataPoint.SetTimestamp(pdata.Timestamp(100_000_000))
doubleGaugeMetric := metrics.AppendEmpty()
doubleGaugeMetric.SetDataType(pdata.MetricDataTypeGauge)
doubleGaugeMetric.SetName("double_gauge")
doubleGauge := doubleGaugeMetric.Gauge()
doubleGaugeDataPoints := doubleGauge.DataPoints()
doubleGaugeDataPoint := doubleGaugeDataPoints.AppendEmpty()
doubleGaugeDataPoint.LabelsMap().Insert("innerLabel", "innerValue")
doubleGaugeDataPoint.SetValue(10.1)
doubleGaugeDataPoint.SetTimestamp(pdata.Timestamp(100_000_000))
intSumMetric := metrics.AppendEmpty()
intSumMetric.SetDataType(pdata.MetricDataTypeIntSum)
intSumMetric.SetName("int_sum")
intSum := intSumMetric.IntSum()
intSumDataPoints := intSum.DataPoints()
intSumDataPoint := intSumDataPoints.AppendEmpty()
intSumDataPoint.LabelsMap().Insert("innerLabel", "innerValue")
intSumDataPoint.SetValue(11)
intSumDataPoint.SetTimestamp(pdata.Timestamp(100_000_000))
doubleSumMetric := metrics.AppendEmpty()
doubleSumMetric.SetDataType(pdata.MetricDataTypeSum)
doubleSumMetric.SetName("double_sum")
doubleSum := doubleSumMetric.Sum()
doubleSumDataPoints := doubleSum.DataPoints()
doubleSumDataPoint := doubleSumDataPoints.AppendEmpty()
doubleSumDataPoint.LabelsMap().Insert("innerLabel", "innerValue")
doubleSumDataPoint.SetValue(10.1)
doubleSumDataPoint.SetTimestamp(pdata.Timestamp(100_000_000))
doubleHistogramMetric := metrics.AppendEmpty()
doubleHistogramMetric.SetDataType(pdata.MetricDataTypeHistogram)
doubleHistogramMetric.SetName("double_$histogram")
doubleHistogram := doubleHistogramMetric.Histogram()
doubleHistogramDataPoints := doubleHistogram.DataPoints()
doubleHistogramDataPoint := doubleHistogramDataPoints.AppendEmpty()
doubleHistogramDataPoint.LabelsMap().Insert("innerLabel", "innerValue")
doubleHistogramDataPoint.SetCount(2)
doubleHistogramDataPoint.SetSum(10.1)
doubleHistogramDataPoint.SetTimestamp(pdata.Timestamp(100_000_000))
doubleHistogramDataPoint.SetBucketCounts([]uint64{1, 2, 3})
doubleHistogramDataPoint.SetExplicitBounds([]float64{1, 2})
doubleSummaryMetric := metrics.AppendEmpty()
doubleSummaryMetric.SetDataType(pdata.MetricDataTypeSummary)
doubleSummaryMetric.SetName("double-summary")
doubleSummary := doubleSummaryMetric.Summary()
doubleSummaryDataPoints := doubleSummary.DataPoints()
doubleSummaryDataPoint := doubleSummaryDataPoints.AppendEmpty()
doubleSummaryDataPoint.SetCount(2)
doubleSummaryDataPoint.SetSum(10.1)
doubleSummaryDataPoint.SetTimestamp(pdata.Timestamp(100_000_000))
doubleSummaryDataPoint.LabelsMap().Insert("innerLabel", "innerValue")
quantileVal := doubleSummaryDataPoint.QuantileValues().AppendEmpty()
quantileVal.SetValue(10.2)
quantileVal.SetQuantile(0.9)
quantileVal2 := doubleSummaryDataPoint.QuantileValues().AppendEmpty()
quantileVal2.SetValue(10.5)
quantileVal2.SetQuantile(0.95)
gotLogs := metricsDataToLogServiceData(logger, md)
gotLogPairs := make([][]logKeyValuePair, 0, len(gotLogs))
for _, log := range gotLogs {
pairs := make([]logKeyValuePair, 0, len(log.Contents))
for _, content := range log.Contents {
pairs = append(pairs, logKeyValuePair{
Key: content.GetKey(),
Value: content.GetValue(),
})
}
gotLogPairs = append(gotLogPairs, pairs)
}
wantLogs := make([][]logKeyValuePair, 0, len(gotLogs))
if err := loadFromJSON("./testdata/logservice_metric_data.json", &wantLogs); err != nil {
t.Errorf("Failed load log key value pairs from file, error: %v", err)
return
}
assert.Equal(t, len(wantLogs), len(gotLogs))
for j := 0; j < len(gotLogs); j++ {
sort.Sort(logKeyValuePairs(gotLogPairs[j]))
sort.Sort(logKeyValuePairs(wantLogs[j]))
if !reflect.DeepEqual(gotLogPairs[j], wantLogs[j]) {
t.Errorf("Unsuccessful conversion \nGot:\n\t%v\nWant:\n\t%v", gotLogPairs, wantLogs)
}
}
} | explode_data.jsonl/48127 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1745
} | [
2830,
3393,
54310,
1043,
1249,
2201,
1860,
1155,
353,
8840,
836,
8,
341,
17060,
1669,
32978,
7121,
45,
453,
2822,
84374,
1669,
70311,
7121,
27328,
741,
84374,
20766,
27328,
1005,
23877,
3522,
368,
442,
2691,
458,
4287,
11765,
27328,
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... | 6 |
func TestWritePrettyBackupList_LongColumnsValues(t *testing.T) {
expectedRes := "+---+-----------+----------+-----------------------------------+------------+-------------+----------+---------+------------+-----------+------------+-----------+\n" +
"| # | NAME | MODIFIED | WAL SEGMENT BACKUP START | START TIME | FINISH TIME | HOSTNAME | DATADIR | PG VERSION | START LSN | FINISH LSN | PERMANENT |\n" +
"+---+-----------+----------+-----------------------------------+------------+-------------+----------+---------+------------+-----------+------------+-----------+\n" +
"| 0 | backup000 | - | veryVeryVeryVeryVeryLongWallName0 | - | - | | | 0 | 0 | 0 | false |\n" +
"| 1 | backup001 | - | veryVeryVeryVeryVeryLongWallName1 | - | - | | | 0 | 0 | 0 | false |\n" +
"+---+-----------+----------+-----------------------------------+------------+-------------+----------+---------+------------+-----------+------------+-----------+\n"
b := bytes.Buffer{}
postgres.WritePrettyBackupListDetails(longBackups, &b)
assert.Equal(t, expectedRes, b.String())
} | explode_data.jsonl/23909 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 466
} | [
2830,
3393,
7985,
51940,
56245,
852,
88240,
13965,
6227,
1155,
353,
8840,
836,
8,
341,
42400,
1061,
1669,
6630,
4421,
10,
18088,
10,
15340,
10,
1408,
4421,
10,
5161,
10,
19528,
10,
15340,
10,
22738,
10,
5161,
10,
18088,
10,
5161,
10,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGenerateAnchorPeersUpdate(t *testing.T) {
configTxDest := filepath.Join(tmpDir, "anchorPeerUpdate")
config := configtxgentest.Load(genesisconfig.SampleSingleMSPChannelProfile)
assert.NoError(t, doOutputAnchorPeersUpdate(config, "foo", configTxDest, genesisconfig.SampleOrgName), "Good anchorPeerUpdate request")
} | explode_data.jsonl/14591 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 105
} | [
2830,
3393,
31115,
14677,
10197,
388,
4289,
1155,
353,
8840,
836,
8,
341,
25873,
51,
15764,
477,
1669,
26054,
22363,
10368,
6184,
11,
330,
17109,
30888,
4289,
5130,
25873,
1669,
2193,
3998,
15772,
477,
13969,
36884,
13774,
1676,
76266,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnAuthorizeTask(t *testing.T) {
taskIdArgs := &TaskIdArgs{
TaskId: BBC_TestTaskId,
}
err := BBC_CLIENT.UnAuthorizeRepairTask(taskIdArgs)
ExpectEqual(t.Errorf, err, nil)
} | explode_data.jsonl/4080 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 78
} | [
2830,
3393,
1806,
37483,
6262,
1155,
353,
8840,
836,
8,
341,
49115,
764,
4117,
1669,
609,
6262,
764,
4117,
515,
197,
81153,
764,
25,
18096,
32541,
6262,
764,
345,
197,
532,
9859,
1669,
18096,
22521,
10616,
37483,
98386,
6262,
17483,
764... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestArtTreeInsert3AndSearchWords(t *testing.T) {
tree := NewArtTree()
searchTerms := []string{"A", "a", "aa"}
for i := range searchTerms {
tree.Insert([]byte(searchTerms[i]), searchTerms[i])
}
for i := range searchTerms {
res := tree.Search([]byte(searchTerms[i]))
if res == nil {
t.Error("Could not find Leaf Node with expected key.")
} else {
if res != searchTerms[i] {
t.Error("Unexpected search result.")
}
}
}
} | explode_data.jsonl/43950 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 179
} | [
2830,
3393,
9286,
6533,
13780,
18,
3036,
5890,
23489,
1155,
353,
8840,
836,
8,
341,
51968,
1669,
1532,
9286,
6533,
2822,
45573,
43128,
1669,
3056,
917,
4913,
32,
497,
330,
64,
497,
330,
5305,
63159,
2023,
600,
1669,
2088,
2711,
43128,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMapProxy_RemoveIfSameWithNonSerializableValue(t *testing.T) {
_, err := mp.RemoveIfSame("test", student{})
AssertErrorNotNil(t, err, "removeIfSame did not return an error for nonserializable value")
mp.Clear()
} | explode_data.jsonl/57050 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 74
} | [
2830,
3393,
2227,
16219,
66843,
2679,
19198,
2354,
8121,
29268,
1130,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
10490,
13270,
2679,
19198,
445,
1944,
497,
5458,
37790,
18017,
1454,
96144,
1155,
11,
1848,
11,
330,
5399,
2679,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestAllocIndirect(t *testing.T) {
// skip alloc test, since that's tested in driver/tests/.
t.Run("noalloc", func(t *testing.T) {
str := "hello, world"
ptr1 := &str
ptr2 := &ptr1
typ, ptr := AllocIndirect(reflect.TypeOf(ptr2), unsafe.Pointer(&ptr2))
if typ != reflect.TypeOf("") {
t.Fatalf("unexpected (not string) type: %v", typ)
}
if ptr != unsafe.Pointer(&str) {
t.Fatalf("unexpected ptr returned: expected %p got %p", unsafe.Pointer(&str), ptr)
}
})
} | explode_data.jsonl/9682 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 195
} | [
2830,
3393,
25154,
1425,
1226,
1155,
353,
8840,
836,
8,
341,
197,
322,
10706,
5574,
1273,
11,
2474,
429,
594,
12510,
304,
5579,
62468,
83900,
3244,
16708,
445,
2152,
4742,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
11355,
1669,
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... | 3 |
func TestFlushExporter(t *testing.T) {
// No exporter - no action should be taken
setCurMetricsConfig(nil)
if want, got := false, FlushExporter(); got != want {
t.Errorf("Expected %v, got %v.", want, got)
}
// Prometheus exporter shouldn't do anything because
// it doesn't implement Flush()
c := &metricsConfig{
domain: servingDomain,
component: testComponent,
reportingPeriod: 1 * time.Minute,
backendDestination: Prometheus,
}
e, err := newMetricsExporter(c, TestLogger(t))
if err != nil {
t.Errorf("Expected no error. got %v", err)
} else {
setCurMetricsExporter(e)
if want, got := false, FlushExporter(); got != want {
t.Errorf("Expected %v, got %v.", want, got)
}
}
// Fake Stackdriver exporter should export
newStackdriverExporterFunc = newFakeExporter
c = &metricsConfig{
domain: servingDomain,
component: testComponent,
backendDestination: Stackdriver,
allowStackdriverCustomMetrics: true,
isStackdriverBackend: true,
reportingPeriod: 1 * time.Minute,
stackdriverProjectID: "test",
stackdriverMetricTypePrefix: path.Join(servingDomain, testComponent),
stackdriverCustomMetricTypePrefix: path.Join(defaultCustomMetricSubDomain, testComponent),
}
e, err = newMetricsExporter(c, TestLogger(t))
if err != nil {
t.Errorf("Expected no error. got %v", err)
} else {
setCurMetricsExporter(e)
if want, got := true, FlushExporter(); got != want {
t.Errorf("Expected %v, got %v.", want, got)
}
}
// Real Stackdriver exporter should export as well.
newStackdriverExporterFunc = newOpencensusSDExporter
e, err = newMetricsExporter(c, TestLogger(t))
if err != nil {
t.Errorf("Expected no error. got %v", err)
} else {
setCurMetricsExporter(e)
if want, got := true, FlushExporter(); got != want {
t.Errorf("Expected %v, got %v.", want, got)
}
}
} | explode_data.jsonl/29324 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 818
} | [
2830,
3393,
46874,
88025,
1155,
353,
8840,
836,
8,
341,
197,
322,
2308,
57378,
481,
902,
1917,
1265,
387,
4429,
198,
8196,
16704,
27328,
2648,
27907,
340,
743,
1366,
11,
2684,
1669,
895,
11,
57626,
88025,
2129,
2684,
961,
1366,
341,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestClient_SetSor(t *testing.T) {
resp, err := cli.SetSor(&ReqSor{
Number: "aaa",
Type: "00",
})
if err != nil {
log.Fatal(err)
}
log.Println(resp)
} | explode_data.jsonl/82689 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
2959,
14812,
50,
269,
1155,
353,
8840,
836,
8,
341,
34653,
11,
1848,
1669,
21348,
4202,
50,
269,
2099,
27234,
50,
269,
515,
197,
197,
2833,
25,
330,
32646,
756,
197,
27725,
25,
256,
330,
15,
15,
756,
197,
3518,
743,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestStrOpsTextJustify_XValue_01(t *testing.T) {
txtJustify := TextJustify(0).Center()
currValue := txtJustify.XValue()
if currValue != TxtJustify.Center() {
t.Errorf("Error: Expected return of object='TxtJustify.Center()'.\n"+
"Instead, object integer value = '%v'\n",
txtJustify.XValueInt())
}
} | explode_data.jsonl/29334 | {
"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,
2580,
38904,
1178,
9952,
1437,
6859,
1130,
62,
15,
16,
1155,
353,
8840,
836,
8,
1476,
68272,
9952,
1437,
1669,
2918,
9952,
1437,
7,
15,
568,
9392,
2822,
54966,
1130,
1669,
7932,
9952,
1437,
4338,
1130,
2822,
743,
9804,
113... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTester(t *testing.T) {
f1, err := ioutil.TempFile("", "iotest")
if err != nil {
t.Fatal(err)
}
f2, err := ioutil.TempFile("", "iotest")
if err != nil {
t.Fatal(err)
}
ft := &Tester{T: t, F1: f1, F2: f2}
ft.Run()
} | explode_data.jsonl/56108 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
58699,
1155,
353,
8840,
836,
8,
341,
1166,
16,
11,
1848,
1669,
43144,
65009,
1703,
19814,
330,
11098,
477,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
1166,
17,
11,
1848,
1669,
43144,
65009,
170... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewStringDecoder_ko(t *testing.T) {
decoder := NewStringDecoder(false)
errorMsg := erroredReader("some error")
var result map[string]interface{}
if err := decoder(errorMsg, &result); err == nil || err.Error() != errorMsg.Error() {
t.Error("Unexpected error:", err)
}
} | explode_data.jsonl/43264 | {
"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,
3564,
703,
20732,
4698,
78,
1155,
353,
8840,
836,
8,
341,
197,
48110,
1669,
1532,
703,
20732,
3576,
340,
18290,
6611,
1669,
36310,
1151,
5062,
445,
14689,
1465,
1138,
2405,
1102,
2415,
14032,
31344,
16094,
743,
1848,
1669,
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 TestIncDelete(t *testing.T) {
const SCRIPT = `
var o = {x: 1};
o.x += (delete o.x, 1);
o.x;
`
testScript1(SCRIPT, intToValue(2), t)
} | explode_data.jsonl/75312 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 71
} | [
2830,
3393,
39245,
6435,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
2405,
297,
284,
314,
87,
25,
220,
16,
2440,
22229,
1993,
1421,
320,
4542,
297,
1993,
11,
220,
16,
317,
22229,
1993,
280,
197,
3989,
18185,
5910,
16,
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 |
func TestListSpaces(t *testing.T) {
Convey("List Space", t, func() {
mocks := []MockRoute{
{"GET", "/v2/spaces", listSpacesPayload, "", 200, "", nil},
{"GET", "/v2/spacesPage2", listSpacesPayloadPage2, "", 200, "", nil},
}
setupMultiple(mocks, t)
defer teardown()
c := &Config{
ApiAddress: server.URL,
Token: "foobar",
}
client, err := NewClient(c)
So(err, ShouldBeNil)
spaces, err := client.ListSpaces()
So(err, ShouldBeNil)
So(len(spaces), ShouldEqual, 4)
So(spaces[0].Guid, ShouldEqual, "8efd7c5c-d83c-4786-b399-b7bd548839e1")
So(spaces[0].CreatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00")
So(spaces[0].UpdatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00")
So(spaces[0].Name, ShouldEqual, "dev")
So(spaces[0].OrganizationGuid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b")
So(spaces[1].Guid, ShouldEqual, "657b5923-7de0-486a-9928-b4d78ee24931")
So(spaces[1].CreatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00")
So(spaces[1].UpdatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00")
So(spaces[1].Name, ShouldEqual, "demo")
So(spaces[1].OrganizationGuid, ShouldEqual, "da0dba14-6064-4f7a-b15a-ff9e677e49b2")
So(spaces[2].Guid, ShouldEqual, "9ffd7c5c-d83c-4786-b399-b7bd54883977")
So(spaces[2].CreatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00")
So(spaces[2].UpdatedAt, ShouldEqual, "2014-09-24T13:54:54+00:00")
So(spaces[2].Name, ShouldEqual, "test")
So(spaces[2].OrganizationGuid, ShouldEqual, "a537761f-9d93-4b30-af17-3d73dbca181b")
So(spaces[3].Guid, ShouldEqual, "329b5923-7de0-486a-9928-b4d78ee24982")
So(spaces[3].CreatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00")
So(spaces[3].UpdatedAt, ShouldEqual, "2014-09-26T13:37:31+00:00")
So(spaces[3].Name, ShouldEqual, "prod")
So(spaces[3].OrganizationGuid, ShouldEqual, "da0dba14-6064-4f7a-b15a-ff9e677e49b2")
})
} | explode_data.jsonl/59977 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 937
} | [
2830,
3393,
852,
71324,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
852,
11487,
497,
259,
11,
2915,
368,
341,
197,
2109,
25183,
1669,
3056,
11571,
4899,
515,
298,
197,
4913,
3806,
497,
3521,
85,
17,
26734,
2434,
497,
1140,
71324,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVerifyAddress(t *testing.T) {
thisTime := time.Now()
nowString := thisTime.Format("2006-01-02 15:04:05 Monday")
t.Log("Starting unit test at " + nowString)
// mock resource
recipient := "test-recipient@example.com"
mockSvc := &mockSESClient{}
err := SendVerification(mockSvc, &recipient)
if err != nil {
t.Fatal(err)
}
t.Log("Verified email address " + recipient)
} | explode_data.jsonl/28152 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 170
} | [
2830,
3393,
32627,
4286,
1155,
353,
8840,
836,
8,
341,
262,
419,
1462,
1669,
882,
13244,
741,
262,
1431,
703,
1669,
419,
1462,
9978,
445,
17,
15,
15,
21,
12,
15,
16,
12,
15,
17,
220,
16,
20,
25,
15,
19,
25,
15,
20,
7014,
1138,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestBenchmarkGetWorkflowsWithoutAPIAsAdmin(t *testing.T) {
t.SkipNow()
db, cache := test.SetupPG(t)
// Init project
key := sdk.RandomString(10)
proj := assets.InsertTestProject(t, db, cache, key, key)
// Init pipeline
pip := sdk.Pipeline{
Name: "pipeline1",
ProjectID: proj.ID,
}
assert.NoError(t, pipeline.InsertPipeline(db, &pip))
app := sdk.Application{
Name: sdk.RandomString(10),
}
assert.NoError(t, application.Insert(db, *proj, &app))
prj, err := project.Load(db, proj.Key,
project.LoadOptions.WithPipelines,
project.LoadOptions.WithApplications,
project.LoadOptions.WithWorkflows,
)
assert.NoError(t, err)
for i := 0; i < 300; i++ {
wf := sdk.Workflow{
ProjectID: proj.ID,
ProjectKey: proj.Key,
Name: sdk.RandomString(10),
WorkflowData: sdk.WorkflowData{
Node: sdk.Node{
Name: "root",
Context: &sdk.NodeContext{
PipelineID: pip.ID,
ApplicationID: app.ID,
},
},
},
}
assert.NoError(t, workflow.Insert(context.TODO(), db, cache, *prj, &wf))
}
res := testing.Benchmark(func(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
if _, err := workflow.LoadAll(db, prj.Key); err != nil {
b.Logf("Cannot load workflows : %v", err)
b.Fail()
return
}
}
b.StopTimer()
})
t.Logf("N : %d", res.N)
t.Logf("ns/op : %d", res.NsPerOp())
assert.False(t, res.NsPerOp() >= 500000000, "Workflows load is too long: GOT %d and EXPECTED lower than 500000000 (500ms)", res.NsPerOp())
} | explode_data.jsonl/31081 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 685
} | [
2830,
3393,
84971,
1949,
6776,
38140,
26040,
7082,
2121,
7210,
1155,
353,
8840,
836,
8,
341,
3244,
57776,
7039,
2822,
20939,
11,
6500,
1669,
1273,
39820,
11383,
1155,
692,
197,
322,
15690,
2390,
198,
23634,
1669,
45402,
26709,
703,
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... | 3 |
func TestAccDataSourceStorageBucketObjectContent_Basic(t *testing.T) {
bucket := "tf-bucket-object-content-" + randString(t, 10)
content := "qwertyuioasdfghjk1234567!!@#$*"
vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourceStorageBucketObjectContent_Basic(content, bucket),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("data.google_storage_bucket_object_content.default", "content"),
resource.TestCheckResourceAttr("data.google_storage_bucket_object_content.default", "content", content),
),
},
},
})
} | explode_data.jsonl/23357 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 251
} | [
2830,
3393,
14603,
17173,
5793,
36018,
1190,
2762,
1668,
5971,
1155,
353,
8840,
836,
8,
1476,
2233,
11152,
1669,
330,
8935,
1455,
11152,
40432,
6808,
27651,
488,
10382,
703,
1155,
11,
220,
16,
15,
340,
27751,
1669,
330,
69291,
1344,
84,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBodyStructure_Parse(t *testing.T) {
for i, test := range bodyStructureTests {
bs := &BodyStructure{}
if err := bs.Parse(test.fields); err != nil {
t.Errorf("Cannot parse #%v: %v", i, err)
} else if !reflect.DeepEqual(bs, test.bodyStructure) {
t.Errorf("Invalid body structure for #%v: got \n%+v\n but expected \n%+v", i, bs, test.bodyStructure)
}
}
} | explode_data.jsonl/43054 | {
"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,
5444,
22952,
77337,
1155,
353,
8840,
836,
8,
341,
2023,
600,
11,
1273,
1669,
2088,
2487,
22952,
18200,
341,
197,
93801,
1669,
609,
5444,
22952,
31483,
197,
743,
1848,
1669,
17065,
8937,
8623,
12920,
1215,
1848,
961,
2092,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTasks_GetTask(t *testing.T) {
taskId := 3
task, err := tm.GetTask(taskId)
t.Log(task)
if err != nil {
t.Error("Failed to get task by id")
}
if task.Id != taskId {
t.Error("Task id does not match in get task by id")
}
} | explode_data.jsonl/66639 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 102
} | [
2830,
3393,
25449,
13614,
6262,
1155,
353,
8840,
836,
8,
341,
49115,
764,
1669,
220,
18,
198,
49115,
11,
1848,
1669,
17333,
2234,
6262,
17483,
764,
340,
3244,
5247,
17483,
340,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
445,
9408,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestError(t *testing.T) {
testError(t, "\x00", "1:1", "illegal character NUL", 0)
testError(t, "\x80", "1:1", "illegal UTF-8 encoding", utf8.RuneError)
testError(t, "\xff", "1:1", "illegal UTF-8 encoding", utf8.RuneError)
testError(t, "a\x00", "1:2", "illegal character NUL", Ident)
testError(t, "ab\x80", "1:3", "illegal UTF-8 encoding", Ident)
testError(t, "abc\xff", "1:4", "illegal UTF-8 encoding", Ident)
testError(t, `"a`+"\x00", "1:3", "illegal character NUL", String)
testError(t, `"ab`+"\x80", "1:4", "illegal UTF-8 encoding", String)
testError(t, `"abc`+"\xff", "1:5", "illegal UTF-8 encoding", String)
testError(t, "`a"+"\x00", "1:3", "illegal character NUL", String)
testError(t, "`ab"+"\x80", "1:4", "illegal UTF-8 encoding", String)
testError(t, "`abc"+"\xff", "1:5", "illegal UTF-8 encoding", String)
testError(t, `'\"'`, "1:3", "illegal char escape", Char)
testError(t, `"\'"`, "1:3", "illegal char escape", String)
testError(t, `01238`, "1:6", "illegal octal number", Int)
testError(t, `01238123`, "1:9", "illegal octal number", Int)
testError(t, `0x`, "1:3", "illegal hexadecimal number", Int)
testError(t, `0xg`, "1:3", "illegal hexadecimal number", Int)
testError(t, `'aa'`, "1:4", "illegal char literal", Char)
testError(t, `'`, "1:2", "literal not terminated", Char)
testError(t, `'`+"\n", "1:2", "literal not terminated", Char)
testError(t, `"abc`, "1:5", "literal not terminated", String)
testError(t, `"abc`+"\n", "1:5", "literal not terminated", String)
testError(t, "`abc\n", "2:1", "literal not terminated", String)
testError(t, `/*/`, "1:4", "comment not terminated", EOF)
} | explode_data.jsonl/56535 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 687
} | [
2830,
3393,
1454,
1155,
353,
8840,
836,
8,
341,
18185,
1454,
1155,
11,
2917,
87,
15,
15,
497,
330,
16,
25,
16,
497,
330,
75998,
3668,
451,
1094,
497,
220,
15,
340,
18185,
1454,
1155,
11,
2917,
87,
23,
15,
497,
330,
16,
25,
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 TestMigrateTables(t *testing.T) {
ms := &vtctldatapb.MaterializeSettings{
Workflow: "workflow",
SourceKeyspace: "sourceks",
TargetKeyspace: "targetks",
TableSettings: []*vtctldatapb.TableMaterializeSettings{{
TargetTable: "t1",
SourceExpression: "select * from t1",
}},
}
env := newTestMaterializerEnv(t, ms, []string{"0"}, []string{"0"})
defer env.close()
env.tmc.expectVRQuery(100, mzCheckJournal, &sqltypes.Result{})
env.tmc.expectVRQuery(200, mzSelectFrozenQuery, &sqltypes.Result{})
env.tmc.expectVRQuery(200, insertPrefix, &sqltypes.Result{})
env.tmc.expectVRQuery(200, mzSelectIDQuery, &sqltypes.Result{})
env.tmc.expectVRQuery(200, mzUpdateQuery, &sqltypes.Result{})
ctx := context.Background()
err := env.wr.MoveTables(ctx, "workflow", "sourceks", "targetks", "t1", "", "", false, "", true, false, "", false, "")
require.NoError(t, err)
vschema, err := env.wr.ts.GetSrvVSchema(ctx, env.cell)
require.NoError(t, err)
got := fmt.Sprintf("%v", vschema)
want := []string{
`keyspaces:{key:"sourceks" value:{}} keyspaces:{key:"targetks" value:{tables:{key:"t1" value:{}}}}`,
`rules:{from_table:"t1" to_tables:"sourceks.t1"}`,
`rules:{from_table:"targetks.t1" to_tables:"sourceks.t1"}`,
}
for _, wantstr := range want {
require.Contains(t, got, wantstr)
}
} | explode_data.jsonl/61849 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 547
} | [
2830,
3393,
44,
34479,
21670,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
609,
9708,
302,
507,
266,
391,
65,
44253,
551,
6086,
515,
197,
197,
62768,
25,
981,
330,
56249,
756,
197,
197,
3608,
8850,
1306,
25,
330,
2427,
2787,
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... | 2 |
func TestImport(t *testing.T) {
src := &fakeSource{
clips: []*video.Clip{
{
Name: "foo",
Paths: []string{
"foo/1",
"foo/2",
},
TotalSize: int64(len(foo1Data) + len(foo2Data)),
},
{
Name: "bar",
Paths: []string{
"bar/1",
"bar/2",
},
TotalSize: int64(len(bar1Data) + len(bar2Data)),
},
},
files: map[string]string{
"foo/1": foo1Data,
"foo/2": foo2Data,
"bar/1": bar1Data,
"bar/2": bar2Data,
},
}
s := newFakeStorage()
imp := New(s)
st := imp.Import(src, "", src.clips)
want := &Status{
Active: false,
BytesCopied: int64(totalDataSize),
BytesTotal: int64(totalDataSize),
Pending: []*video.Clip{},
Results: []Result{
{
Clip: src.clips[0],
Error: nil,
},
{
Clip: src.clips[1],
Error: nil,
},
},
}
if !statusEq(st, want) {
t.Errorf("Import(...) =\n%+v, want\n%+v", st, want)
}
st = imp.Status()
if !statusEq(st, want) {
t.Errorf("Status() =\n%+v, want\n%+v", st, want)
}
for path, want := range src.files {
buf := s.files[path]
if buf == nil {
t.Errorf("did not write to %s", path)
} else if s := buf.String(); s != want {
t.Errorf("stored %q to %s, want %q", s, path, want)
}
}
} | explode_data.jsonl/975 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 649
} | [
2830,
3393,
11511,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
609,
30570,
3608,
515,
197,
39407,
3077,
25,
29838,
9986,
21610,
573,
515,
298,
197,
515,
571,
21297,
25,
330,
7975,
756,
571,
197,
26901,
25,
3056,
917,
515,
464,
197,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestIntegrationsUpdateAws(t *testing.T) {
var (
intgGUID = intgguid.New()
apiPath = fmt.Sprintf("external/integrations/%s", intgGUID)
fakeServer = lacework.MockServer()
)
fakeServer.MockAPI(apiPath, func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, "PATCH", r.Method, "UpdateAws should be a PATCH method")
if assert.NotNil(t, r.Body) {
body := httpBodySniffer(r)
assert.Contains(t, body, intgGUID, "INTG_GUID missing")
assert.Contains(t, body, "integration_name", "integration name is missing")
assert.Contains(t, body, "AWS_CT_SQS", "wrong integration type")
assert.Contains(t, body, "arn:foo:bar", "wrong role arn")
assert.Contains(t, body, "0123456789", "wrong external ID")
assert.Contains(t, body, "ENABLED\":1", "integration is not enabled")
}
fmt.Fprintf(w, awsIntegrationJsonResponse(intgGUID))
})
defer fakeServer.Close()
c, err := api.NewClient("test",
api.WithToken("TOKEN"),
api.WithURL(fakeServer.URL()),
)
assert.Nil(t, err)
data := api.NewAwsIntegration("integration_name",
api.AwsCloudTrailIntegration,
api.AwsIntegrationData{
Credentials: &api.AwsCrossAccountCreds{
RoleArn: "arn:foo:bar",
ExternalID: "0123456789",
},
},
)
assert.Equal(t, "integration_name", data.Name, "AWS integration name mismatch")
assert.Equal(t, "AWS_CT_SQS", data.Type, "a new AWS integration should match its type")
assert.Equal(t, 1, data.Enabled, "a new AWS integration should be enabled")
data.IntgGuid = intgGUID
response, err := c.Integrations.UpdateAws(data)
assert.Nil(t, err)
assert.NotNil(t, response)
assert.Equal(t, "SUCCESS", response.Message)
assert.Equal(t, 1, len(response.Data))
assert.Equal(t, intgGUID, response.Data[0].IntgGuid)
} | explode_data.jsonl/81117 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 719
} | [
2830,
3393,
1072,
14412,
804,
4289,
47359,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
2084,
70,
41778,
256,
284,
526,
14398,
2423,
7121,
741,
197,
54299,
1820,
262,
284,
8879,
17305,
445,
20921,
31114,
14412,
804,
12627,
82,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestAWSFuncs(t *testing.T) {
m := aws.NewDummyEc2Meta()
i := aws.NewDummyEc2Info(m)
af := &Funcs{meta: m, info: i}
assert.Equal(t, "unknown", must(af.EC2Region()))
assert.Equal(t, "", must(af.EC2Meta("foo")))
assert.Equal(t, "", must(af.EC2Tag("foo")))
assert.Equal(t, "unknown", must(af.EC2Region()))
} | explode_data.jsonl/44503 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 148
} | [
2830,
3393,
36136,
9626,
82,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
31521,
7121,
43344,
50730,
17,
12175,
741,
8230,
1669,
31521,
7121,
43344,
50730,
17,
1731,
1255,
340,
197,
2577,
1669,
609,
9626,
82,
90,
5490,
25,
296,
11,
3546,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAddServiceWithServiceProperty(t *testing.T) {
r := newTestResolver(t)
defer r.Close()
ctx := viewertest.NewContext(context.Background(), r.client)
mr := r.Mutation()
serviceType, err := mr.AddServiceType(ctx, models.ServiceTypeCreateData{
Name: "service_type", HasCustomer: false})
require.NoError(t, err)
service1, err := mr.AddService(ctx, models.ServiceCreateData{
Name: "service_1",
ServiceTypeID: serviceType.ID,
Status: pointerToServiceStatus(models.ServiceStatusPending),
})
require.NoError(t, err)
index := 0
servicePropType := models.PropertyTypeInput{
Name: "service_prop",
Type: "node",
Index: &index,
}
propTypeInputs := []*models.PropertyTypeInput{&servicePropType}
serviceTypeWithServiceProp, err := mr.AddServiceType(ctx, models.ServiceTypeCreateData{
Name: "service_type_with_service_prop",
HasCustomer: true,
Properties: propTypeInputs,
})
require.NoError(t, err)
propType := serviceTypeWithServiceProp.QueryPropertyTypes().OnlyX(ctx)
servicePropInput := models.PropertyInput{
PropertyTypeID: propType.ID,
NodeIDValue: &service1.ID,
}
service2, err := mr.AddService(ctx, models.ServiceCreateData{
Name: "service_2",
ServiceTypeID: serviceTypeWithServiceProp.ID,
Status: pointerToServiceStatus(models.ServiceStatusPending),
Properties: []*models.PropertyInput{&servicePropInput},
})
require.NoError(t, err)
serviceProp := service2.QueryProperties().Where(property.HasTypeWith(propertytype.Name("service_prop"))).OnlyX(ctx)
serviceValue := serviceProp.QueryServiceValue().OnlyX(ctx)
require.Equal(t, "service_1", serviceValue.Name)
} | explode_data.jsonl/7213 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 601
} | [
2830,
3393,
2212,
1860,
2354,
1860,
3052,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
501,
2271,
18190,
1155,
340,
16867,
435,
10421,
741,
20985,
1669,
1651,
83386,
7121,
1972,
5378,
19047,
1507,
435,
6581,
692,
2109,
81,
1669,
435,
1321,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCannotStartWhenPendingOperations(t *testing.T) {
dbfile := tests.Tempfile()
defer os.Remove(dbfile)
// create a app that will only be used to set up the test
app := NewTestApp(dbfile)
tests.Assert(t, app != nil)
// populate the db with a "dummy" pending op entry. this should
// trigger a panic the next time an app is instantiated
err := app.db.Update(func(tx *bolt.Tx) error {
op := NewPendingOperationEntry(NEW_ID)
op.Type = OperationCreateVolume
op.Save(tx)
return nil
})
tests.Assert(t, err == nil, "expected err == nil, got:", err)
app.Close()
defer func() {
// check that we (a) panicked (b) had the right error message
r := recover()
tests.Assert(t, r != nil, "expected r != nil, got:", r)
tests.Assert(t,
strings.Contains(r.(error).Error(), "pending operations are present"),
`expected "pending operations are present" in r.Error(), got:`,
r.(error).Error())
}()
// now creating a new app should panic
app = NewTestApp(dbfile)
t.Fatalf("Test should not reach this line")
} | explode_data.jsonl/51874 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 365
} | [
2830,
3393,
17444,
3479,
4498,
32027,
35120,
1155,
353,
8840,
836,
8,
341,
20939,
1192,
1669,
7032,
65009,
1192,
741,
16867,
2643,
13270,
9791,
1192,
692,
197,
322,
1855,
264,
906,
429,
686,
1172,
387,
1483,
311,
738,
705,
279,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPKSPodSpec(t *testing.T) {
coreops.SetInstance(coreops.New(fakek8sclient.NewSimpleClientset()))
expected := getExpectedPodSpecFromDaemonset(t, "testspec/pks.yaml")
nodeName := "testNode"
cluster := &corev1.StorageCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "px-cluster",
Namespace: "kube-system",
Annotations: map[string]string{
pxutil.AnnotationIsPKS: "true",
},
},
Spec: corev1.StorageClusterSpec{
Image: "portworx/oci-monitor:2.0.3.4",
Placement: &corev1.PlacementSpec{
NodeAffinity: &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
NodeSelectorTerms: []v1.NodeSelectorTerm{
{
MatchExpressions: []v1.NodeSelectorRequirement{
{
Key: "px/enabled",
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"false"},
},
{
Key: "node-role.kubernetes.io/master",
Operator: v1.NodeSelectorOpDoesNotExist,
},
},
},
},
},
},
},
Kvdb: &corev1.KvdbSpec{
Internal: true,
},
SecretsProvider: stringPtr("k8s"),
CommonConfig: corev1.CommonConfig{
Storage: &corev1.StorageSpec{
UseAll: boolPtr(true),
},
},
},
}
driver := portworx{}
actual, err := driver.GetStoragePodSpec(cluster, nodeName)
assert.NoError(t, err, "Unexpected error on GetStoragePodSpec")
assertPodSpecEqual(t, expected, &actual)
} | explode_data.jsonl/55455 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 711
} | [
2830,
3393,
22242,
4592,
347,
8327,
1155,
353,
8840,
836,
8,
341,
71882,
3721,
4202,
2523,
47867,
3721,
7121,
74138,
74,
23,
82,
2972,
7121,
16374,
2959,
746,
12145,
42400,
1669,
633,
18896,
23527,
8327,
3830,
89177,
746,
1155,
11,
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... | 1 |
func TestConstants(t *testing.T) {
if StatusUnclassified != "unclassified" {
t.Error("Expected status unclassified to be «unclassified», was", StatusUnclassified)
}
if StatusSuccess != "success" {
t.Error("Expected status success to be «success», was", StatusSuccess)
}
if StatusError != "error" {
t.Error("Expected status error to be «error», was", StatusError)
}
if StatusFail != "fail" {
t.Error("Expected status fail to be «fail», was", StatusFail)
}
} | explode_data.jsonl/71743 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 160
} | [
2830,
3393,
9386,
1155,
353,
8840,
836,
8,
1476,
743,
8104,
63718,
447,
1870,
961,
330,
359,
64874,
1,
341,
197,
3244,
6141,
445,
18896,
2639,
650,
64874,
311,
387,
12486,
359,
64874,
60212,
572,
497,
8104,
63718,
447,
1870,
340,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestGetMovementHistory(t *testing.T) {
t.Parallel()
_, err := b.GetMovementHistory("USD", "bitcoin", time.Time{}, time.Time{}, 1)
if err == nil {
t.Error("Test Failed - GetMovementHistory() error")
}
} | explode_data.jsonl/79956 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 80
} | [
2830,
3393,
1949,
38050,
13424,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
6878,
1848,
1669,
293,
2234,
38050,
13424,
445,
26749,
497,
330,
83910,
497,
882,
16299,
22655,
882,
16299,
22655,
220,
16,
340,
743,
1848,
621,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCustomPipelineParsing(t *testing.T) {
_, err := gstadapter.NewWithCustomPipeline("daniel")
assert.Error(t, err)
_, err = gstadapter.NewWithCustomPipeline("queue name=my_filesrc ! fakesink")
assert.Error(t, err)
_, err = gstadapter.NewWithCustomPipeline("queue name=audio_target ! fakesink")
assert.Error(t, err)
gsta, err := gstadapter.NewWithCustomPipeline("rtpmux name=mux ! fakesink \n queue name=audio_target ! mux.sink_0 \n queue name=video_target ! mux.sink_1")
assert.NoError(t, err)
assert.NotNil(t, gsta)
} | explode_data.jsonl/4252 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 212
} | [
2830,
3393,
10268,
34656,
68839,
1155,
353,
8840,
836,
8,
1476,
197,
6878,
1848,
1669,
43769,
19731,
7121,
2354,
10268,
34656,
445,
67,
12046,
1138,
6948,
6141,
1155,
11,
1848,
692,
197,
6878,
1848,
284,
43769,
19731,
7121,
2354,
10268,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLineBreak(t *testing.T) {
var tests = []string{
"this line \nhas a break\n",
"<p>this line<br />\nhas a break</p>\n",
"this line \ndoes not\n",
"<p>this line\ndoes not</p>\n",
"this has an \nextra space\n",
"<p>this has an<br />\nextra space</p>\n",
}
doTestsInline(t, tests)
} | explode_data.jsonl/57352 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 146
} | [
2830,
3393,
2460,
22524,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
917,
515,
197,
197,
1,
574,
1555,
220,
1124,
77,
4648,
264,
1438,
1699,
756,
197,
197,
22476,
79,
89810,
1555,
9480,
76246,
77,
4648,
264,
1438,
522,
79,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTx_Get_NotFound(t *testing.T) {
db := MustOpenDB()
defer db.MustClose()
if err := db.Update(func(tx *bolt.Tx) error {
b, err := tx.CreateBucket([]byte("widgets"))
if err != nil {
t.Fatal(err)
}
if err := b.Put([]byte("foo"), []byte("bar")); err != nil {
t.Fatal(err)
}
if b.Get([]byte("no_such_key")) != nil {
t.Fatal("expected nil value")
}
return nil
}); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/1688 | {
"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,
31584,
13614,
60816,
6650,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
15465,
5002,
3506,
741,
16867,
2927,
50463,
7925,
741,
743,
1848,
1669,
2927,
16689,
18552,
27301,
353,
52433,
81362,
8,
1465,
341,
197,
2233,
11,
1848,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestGetByID(t *testing.T) {
db, mock, err := sqlmock.New()
if err != nil {
t.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
}
rows := sqlmock.NewRows([]string{"id", "user_id", "date", "grand_total"}).
AddRow(1, 1, time.Now(), 100)
query := "SELECT id, user_id, date, grand_total FROM transactions WHERE id = \\?"
mock.ExpectQuery(query).WillReturnRows(rows)
a := transactionRepo.NewMysqlTransactionRepository(db)
num := int64(5)
anTransaction, err := a.GetByID(context.TODO(), num)
assert.NoError(t, err)
assert.NotNil(t, anTransaction)
} | explode_data.jsonl/18315 | {
"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,
1949,
60572,
1155,
353,
8840,
836,
8,
341,
20939,
11,
7860,
11,
1848,
1669,
5704,
16712,
7121,
741,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
276,
1465,
7677,
82,
6,
572,
537,
3601,
979,
8568,
264,
13633,
4625,
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... | 2 |
func Test_CheckUserExists(t *testing.T) {
if testUser == nil || testUser.Id == -1 {
t.Skip("Skipping due to previous failure")
}
exist, err := conn.CheckUserExists(testUser.Name)
if err != nil {
t.Fatal(err)
}
if !exist {
t.Fatal("User doesn't exist when they should")
}
} | explode_data.jsonl/22010 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 114
} | [
2830,
3393,
28188,
1474,
15575,
1155,
353,
8840,
836,
8,
341,
743,
1273,
1474,
621,
2092,
1369,
1273,
1474,
6444,
621,
481,
16,
341,
197,
3244,
57776,
445,
85945,
4152,
311,
3681,
7901,
1138,
197,
630,
8122,
380,
11,
1848,
1669,
4534,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStackVal_MarshalJSON_GotFalse(t *testing.T) {
var sampleInp struct {
Val BoolString `json:"val"`
}
sampleInp.Val.Flag = false
var sampleOut = []byte(`{"val":false}`)
data, _ := json.Marshal(sampleInp)
if bytes.Compare(data, sampleOut) != 0 {
t.Errorf("should be %s but got %s", sampleOut, data)
}
} | explode_data.jsonl/31038 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 128
} | [
2830,
3393,
4336,
2208,
1245,
28423,
5370,
2646,
354,
4049,
1155,
353,
8840,
836,
8,
341,
2405,
6077,
641,
79,
2036,
341,
197,
197,
2208,
12608,
703,
1565,
2236,
2974,
831,
8805,
197,
532,
1903,
1516,
641,
79,
77819,
80911,
284,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestGocloak_GetClientScopes(t *testing.T) {
t.Parallel()
cfg := GetConfig(t)
client := NewClientWithDebug(t)
token := GetAdminToken(t, client)
// Getting client scopes
scopes, err := client.GetClientScopes(
token.AccessToken,
cfg.GoCloak.Realm)
assert.NoError(t, err, "GetClientScopes failed")
// Checking that GetClientScopes returns scopes
assert.NotZero(t, len(scopes), "there should be client scopes")
} | explode_data.jsonl/79531 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 153
} | [
2830,
3393,
38,
509,
385,
585,
13614,
2959,
3326,
18523,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
50286,
1669,
2126,
2648,
1155,
340,
25291,
1669,
1532,
2959,
2354,
7939,
1155,
340,
43947,
1669,
2126,
7210,
3323,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.