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 TestFile(t *testing.T) {
f, err := ioutil.TempFile(os.TempDir(), "config")
assert.NoError(t, err)
_, err = Load(filepath.Join(f.Name()))
assert.NoError(t, err)
} | explode_data.jsonl/38050 | {
"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,
1703,
1155,
353,
8840,
836,
8,
341,
1166,
11,
1848,
1669,
43144,
65009,
1703,
9638,
65009,
6184,
1507,
330,
1676,
1138,
6948,
35699,
1155,
11,
1848,
340,
197,
6878,
1848,
284,
8893,
34793,
22363,
955,
2967,
12145,
6948,
3569... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestOldMessages(t *testing.T) {
tt := newNetwork(nil, nil, nil)
// make 0 leader @ term 3
tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgHup})
tt.send(pb.Message{From: 2, To: 2, Type: pb.MsgHup})
tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgHup})
// pretend we're an old leader trying to make progress; this entry is expected to be ignored.
tt.send(pb.Message{From: 2, To: 1, Type: pb.MsgApp, Term: 2, Entries: []pb.Entry{{Index: 3, Term: 2}}})
// commit a new entry
tt.send(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{Data: []byte("somedata")}}})
ilog := &raftLog{
storage: &MemoryStorage{
ents: []pb.Entry{
{}, {Data: nil, Term: 1, Index: 1},
{Data: nil, Term: 2, Index: 2}, {Data: nil, Term: 3, Index: 3},
{Data: []byte("somedata"), Term: 3, Index: 4},
},
},
unstable: unstable{offset: 5},
committed: 4,
}
base := ltoa(ilog)
for i, p := range tt.peers {
if sm, ok := p.(*raft); ok {
l := ltoa(sm.raftLog)
if g := diffu(base, l); g != "" {
t.Errorf("#%d: diff:\n%s", i, g)
}
} else {
t.Logf("#%d: empty log", i)
}
}
} | explode_data.jsonl/67342 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 508
} | [
2830,
3393,
18284,
15820,
1155,
353,
8840,
836,
8,
341,
3244,
83,
1669,
501,
12320,
27907,
11,
2092,
11,
2092,
340,
197,
322,
1281,
220,
15,
7653,
569,
4647,
220,
18,
198,
3244,
83,
5219,
76878,
8472,
90,
3830,
25,
220,
16,
11,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestClientDoTimeoutSuccess(t *testing.T) {
t.Parallel()
s := startEchoServer(t, "tcp", "127.0.0.1:")
defer s.Stop()
testClientDoTimeoutSuccess(t, &defaultClient, "http://"+s.Addr(), 100)
} | explode_data.jsonl/79363 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 82
} | [
2830,
3393,
2959,
5404,
7636,
7188,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1903,
1669,
1191,
74994,
5475,
1155,
11,
330,
27161,
497,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
34403,
16867,
274,
30213,
2822,
18185,
295... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMicrositeUpdateWithoutPassingModel(t *testing.T) {
setup()
defer teardown()
input := &Microsite{ID: 10005, Name: "Updated Microsite"}
addRestHandlerFunc("/assets/microsite/10005", func(w http.ResponseWriter, req *http.Request) {
testMethod(t, req, "PUT")
v := new(Microsite)
json.NewDecoder(req.Body).Decode(v)
testModels(t, "Microsites.Update(Without Model) body", v, input)
fmt.Fprintf(w, `{"type":"Microsite","id":"10005","name":"%s","isAuthenticated":"true", "enableWebTrackingOptIn": "disabled"}`, v.Name)
})
microsite, _, err := client.Microsites.Update(10005, "Updated Microsite", nil)
if err != nil {
t.Errorf("Microsites.Update(Without Model) recieved error: %v", err)
}
input.EnableWebTrackingOptIn = "disabled"
input.IsAuthenticated = true
input.Type = "Microsite"
testModels(t, "Microsites.Update(Without Model)", microsite, input)
} | explode_data.jsonl/7516 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 317
} | [
2830,
3393,
34609,
9513,
4289,
26040,
12187,
287,
1712,
1155,
353,
8840,
836,
8,
341,
84571,
741,
16867,
49304,
2822,
22427,
1669,
609,
34609,
9513,
90,
915,
25,
220,
16,
15,
15,
15,
20,
11,
3988,
25,
330,
16196,
18157,
9513,
63159,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestInvalidVersion(t *testing.T) {
_, err := loadYAML(`
version: 3
services:
foo:
image: busybox
`)
assert.Error(t, err)
assert.Contains(t, err.Error(), "version must be a string")
} | explode_data.jsonl/16384 | {
"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,
7928,
5637,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
2795,
56,
31102,
61528,
4366,
25,
220,
18,
198,
12779,
510,
220,
15229,
510,
262,
2168,
25,
13028,
2011,
198,
24183,
6948,
6141,
1155,
11,
1848,
340,
6948,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestStringMap_CopyTo(t *testing.T) {
dest := NewStringMap()
// Test CopyTo to empty
NewStringMap().CopyTo(dest)
assert.EqualValues(t, 0, dest.Len())
// Test CopyTo larger slice
generateTestStringMap().CopyTo(dest)
assert.EqualValues(t, generateTestStringMap(), dest)
// Test CopyTo same size slice
generateTestStringMap().CopyTo(dest)
assert.EqualValues(t, generateTestStringMap(), dest)
} | explode_data.jsonl/38211 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 137
} | [
2830,
3393,
703,
2227,
77637,
1249,
1155,
353,
8840,
836,
8,
341,
49616,
1669,
1532,
703,
2227,
741,
197,
322,
3393,
14540,
1249,
311,
4287,
198,
197,
3564,
703,
2227,
1005,
12106,
1249,
27010,
340,
6948,
12808,
6227,
1155,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestWithFile(t *testing.T) {
r, err := Prepare(&http.Request{},
WithFile(ioutil.NopCloser(strings.NewReader("Hello Gopher"))))
if err != nil {
t.Fatalf("autorest: WithFile failed with error (%v)", err)
}
b, err := ioutil.ReadAll(r.Body)
if err != nil {
t.Fatalf("autorest: WithFile failed with error (%v)", err)
}
if r.ContentLength != int64(len(b)) {
t.Fatalf("autorest:WithFile set Content-Length to %v, expected %v", r.ContentLength, len(b))
}
} | explode_data.jsonl/20964 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 199
} | [
2830,
3393,
2354,
1703,
1155,
353,
8840,
836,
8,
972,
7000,
11,
1848,
1669,
31166,
2099,
1254,
9659,
6257,
1871,
197,
197,
2354,
1703,
1956,
30158,
2067,
453,
51236,
799,
51442,
68587,
445,
9707,
479,
16940,
2761,
5784,
743,
1848,
961,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestPageDatesAllKinds(t *testing.T) {
t.Parallel()
assert := assert.New(t)
pageContent := `
---
title: Page
date: 2017-01-15
tags: ["hugo"]
categories: ["cool stuff"]
---
`
b := newTestSitesBuilder(t)
b.WithSimpleConfigFile().WithContent("page.md", pageContent)
b.WithContent("blog/page.md", pageContent)
b.CreateSites().Build(BuildCfg{})
assert.Equal(1, len(b.H.Sites))
s := b.H.Sites[0]
checkDate := func(t time.Time, msg string) {
assert.Equal(2017, t.Year(), msg)
}
checkDated := func(d resource.Dated, msg string) {
checkDate(d.Date(), "date: "+msg)
checkDate(d.Lastmod(), "lastmod: "+msg)
}
for _, p := range s.Pages() {
checkDated(p, p.Kind())
}
checkDate(s.Info.LastChange(), "site")
} | explode_data.jsonl/60605 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 303
} | [
2830,
3393,
2665,
55238,
2403,
42,
8673,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
6948,
1669,
2060,
7121,
1155,
692,
35272,
2762,
1669,
22074,
10952,
2102,
25,
5755,
198,
1028,
25,
220,
17,
15,
16,
22,
12,
15,
16,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestChunkStore_LabelNamesForMetricName(t *testing.T) {
ctx := context.Background()
now := model.Now()
fooMetric1 := labels.Labels{
{Name: labels.MetricName, Value: "foo"},
{Name: "bar", Value: "baz"},
{Name: "flip", Value: "flop"},
{Name: "toms", Value: "code"},
}
fooMetric2 := labels.Labels{
{Name: labels.MetricName, Value: "foo"},
{Name: "bar", Value: "beep"},
{Name: "toms", Value: "code"},
}
fooMetric3 := labels.Labels{
{Name: labels.MetricName, Value: "foo"},
{Name: "bar", Value: "bop"},
{Name: "flip", Value: "flap"},
}
// barMetric1 is a subset of barMetric2 to test over-matching bug.
barMetric1 := labels.Labels{
{Name: labels.MetricName, Value: "bar"},
{Name: "bar", Value: "baz"},
}
barMetric2 := labels.Labels{
{Name: labels.MetricName, Value: "bar"},
{Name: "bar", Value: "baz"},
{Name: "toms", Value: "code"},
}
fooChunk1 := dummyChunkFor(now, fooMetric1)
fooChunk2 := dummyChunkFor(now, fooMetric2)
fooChunk3 := dummyChunkFor(now, fooMetric3)
fooChunk4 := dummyChunkFor(now.Add(-time.Hour), fooMetric1) // same series but different chunk
barChunk1 := dummyChunkFor(now, barMetric1)
barChunk2 := dummyChunkFor(now, barMetric2)
for _, tc := range []struct {
metricName string
expect []string
}{
{
`foo`,
[]string{labels.MetricName, "bar", "flip", "toms"},
},
{
`bar`,
[]string{labels.MetricName, "bar", "toms"},
},
} {
for _, schema := range schemas {
for _, storeCase := range stores {
t.Run(fmt.Sprintf("%s / %s / %s ", tc.metricName, schema, storeCase.name), func(t *testing.T) {
t.Log("========= Running labelNames with metricName", tc.metricName, "with schema", schema)
storeCfg := storeCase.configFn()
store := newTestChunkStoreConfig(t, schema, storeCfg)
defer store.Stop()
if err := store.Put(ctx, []Chunk{
fooChunk1,
fooChunk2,
fooChunk3,
fooChunk4,
barChunk1,
barChunk2,
}); err != nil {
t.Fatal(err)
}
// Query with ordinary time-range
labelNames1, err := store.LabelNamesForMetricName(ctx, userID, now.Add(-time.Hour), now, tc.metricName)
require.NoError(t, err)
if !reflect.DeepEqual(tc.expect, labelNames1) {
t.Fatalf("%s: wrong label name - %s", tc.metricName, test.Diff(tc.expect, labelNames1))
}
// Pushing end of time-range into future should yield exact same resultset
labelNames2, err := store.LabelNamesForMetricName(ctx, userID, now.Add(-time.Hour), now.Add(time.Hour*24*10), tc.metricName)
require.NoError(t, err)
if !reflect.DeepEqual(tc.expect, labelNames2) {
t.Fatalf("%s: wrong label name - %s", tc.metricName, test.Diff(tc.expect, labelNames2))
}
// Query with both begin & end of time-range in future should yield empty resultset
labelNames3, err := store.LabelNamesForMetricName(ctx, userID, now.Add(time.Hour), now.Add(time.Hour*2), tc.metricName)
require.NoError(t, err)
if len(labelNames3) != 0 {
t.Fatalf("%s: future query should yield empty resultset ... actually got %v label names: %#v",
tc.metricName, len(labelNames3), labelNames3)
}
})
}
}
}
} | explode_data.jsonl/43818 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1380
} | [
2830,
3393,
28304,
6093,
53557,
7980,
2461,
54310,
675,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
80922,
1669,
1614,
13244,
2822,
197,
7975,
54310,
16,
1669,
9201,
4679,
82,
515,
197,
197,
63121,
25,
9201,
1321,
16340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVerbosePubSub(t *testing.T) {
s := runProtoServer()
defer s.Shutdown()
c := createClientConn(t, "localhost", PROTO_TEST_PORT)
defer c.Close()
doConnect(t, c, true, false, false)
send := sendCommand(t, c)
expect := expectCommand(t, c)
expect(okRe)
// Pub
send("PUB foo 2\r\nok\r\n")
expect(okRe)
// Sub
send("SUB foo 1\r\n")
expect(okRe)
// UnSub
send("UNSUB 1\r\n")
expect(okRe)
} | explode_data.jsonl/16815 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 191
} | [
2830,
3393,
63404,
29162,
3136,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1598,
31549,
5475,
741,
16867,
274,
10849,
18452,
2822,
1444,
1669,
1855,
2959,
9701,
1155,
11,
330,
8301,
497,
5308,
5207,
11641,
12377,
340,
16867,
272,
10421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMultiSystemChannel(t *testing.T) {
lf := ramledger.New(10)
for _, id := range []string{"foo", "bar"} {
rl, err := lf.GetOrCreate(id)
assert.NoError(t, err)
err = rl.Append(encoder.New(conf).GenesisBlockForChannel(id))
assert.NoError(t, err)
}
consenters := make(map[string]consensus.Consenter)
consenters[conf.Orderer.OrdererType] = &mockConsenter{}
assert.Panics(t, func() { NewRegistrar(lf, consenters, mockCrypto()) }, "Two system channels should have caused panic")
} | explode_data.jsonl/71398 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 190
} | [
2830,
3393,
20358,
2320,
9629,
1155,
353,
8840,
836,
8,
341,
8810,
69,
1669,
17823,
50704,
7121,
7,
16,
15,
692,
2023,
8358,
877,
1669,
2088,
3056,
917,
4913,
7975,
497,
330,
2257,
9207,
341,
197,
197,
2381,
11,
1848,
1669,
58080,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestInsertRun(t *testing.T) {
i := newTestInsert()
s, packageCh, _ := stressClient.NewTestStressTest()
// Listen to the other side of the directiveCh
go func() {
for pkg := range packageCh {
countPoints := i.Timestamp.Count
batchSize := s.BatchSize
got := len(strings.Split(string(pkg.Body), "\n"))
switch got {
case countPoints % batchSize:
case batchSize:
default:
t.Errorf("countPoints: %v\nbatchSize: %v\ngot: %v\n", countPoints, batchSize, got)
}
pkg.Tracer.Done()
}
}()
i.Run(s)
} | explode_data.jsonl/67936 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 237
} | [
2830,
3393,
13780,
6727,
1155,
353,
8840,
836,
8,
972,
8230,
1669,
501,
2271,
13780,
3568,
1903,
11,
6328,
1143,
11,
716,
1669,
8464,
2959,
7121,
2271,
623,
673,
2271,
3568,
197,
322,
32149,
311,
279,
1008,
3108,
315,
279,
33859,
1143... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIsValidAttestation(t *testing.T) {
for i := range attestationRequests {
t.Run(fmt.Sprintf("Run %d", i), func(t *testing.T) {
r := protocol.CredentialCreationOptions{}
if err := json.Unmarshal([]byte(attestationRequests[i]), &r); err != nil {
t.Fatal(err)
}
b := protocol.AttestationResponse{}
if err := json.Unmarshal([]byte(attestationResponses[i]), &b); err != nil {
t.Fatal(err)
}
p, err := protocol.ParseAttestationResponse(b)
if err != nil {
t.Fatal(err)
}
d, err := protocol.IsValidAttestation(p, r.PublicKey.Challenge, "", "")
if err != nil {
e := protocol.ToWebAuthnError(err)
t.Fatal(fmt.Sprintf("%s, %s: %s", e.Name, e.Description, e.Debug))
}
if !d {
t.Fatal("is not valid")
}
})
}
} | explode_data.jsonl/2148 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 356
} | [
2830,
3393,
55470,
1655,
1944,
367,
1155,
353,
8840,
836,
8,
341,
2023,
600,
1669,
2088,
1619,
63978,
35295,
341,
197,
3244,
16708,
28197,
17305,
445,
6727,
1018,
67,
497,
600,
701,
2915,
1155,
353,
8840,
836,
8,
341,
298,
7000,
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 TestAbsCollection_Diff(t *testing.T) {
intColl := NewIntCollection([]int{1, 2, 2, 3})
intColl2 := NewIntCollection([]int{2, 3, 4})
diff := intColl.Diff(intColl2)
// diff.DD()
if diff.Count() != 1 {
t.Fatal("diff 错误")
}
} | explode_data.jsonl/66456 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 103
} | [
2830,
3393,
27778,
6482,
1557,
3092,
1155,
353,
8840,
836,
8,
341,
2084,
15265,
1669,
1532,
1072,
6482,
10556,
396,
90,
16,
11,
220,
17,
11,
220,
17,
11,
220,
18,
3518,
2084,
15265,
17,
1669,
1532,
1072,
6482,
10556,
396,
90,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestRetriesNew_ErrorWithRetries(t *testing.T) {
err := NewRetriesResult(NewResult(500, "this is an example error, %s", "yep"), 10, time.Now(), nil)
const want = "500: this is an example error, yep (10x)"
got := err.Error()
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("Unexpected diff (-want, +got) = %v", diff)
}
} | explode_data.jsonl/66503 | {
"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,
12020,
4019,
3564,
28651,
2354,
12020,
4019,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
1532,
12020,
4019,
2077,
35063,
2077,
7,
20,
15,
15,
11,
330,
574,
374,
458,
3110,
1465,
11,
1018,
82,
497,
330,
88,
747,
3975,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateSectorIdentifierURL(t *testing.T) {
var payload string
var h http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(payload))
}
ts := httptest.NewTLSServer(h)
defer ts.Close()
v := NewValidatorWithClient(nil, ts.Client())
for k, tc := range []struct {
p string
r []string
u string
expectErr bool
}{
{
u: "",
expectErr: true,
},
{
u: "http://foo/bar",
expectErr: true,
},
{
u: ts.URL,
expectErr: true,
},
{
p: `["http://foo"]`,
u: ts.URL,
expectErr: false,
r: []string{"http://foo"},
},
{
p: `["http://foo"]`,
u: ts.URL,
expectErr: true,
r: []string{"http://foo", "http://not-foo"},
},
} {
t.Run(fmt.Sprintf("case=%d", k), func(t *testing.T) {
payload = tc.p
err := v.ValidateSectorIdentifierURL(tc.u, tc.r)
if tc.expectErr {
require.Error(t, err)
} else {
require.NoError(t, err)
}
})
}
} | explode_data.jsonl/70142 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 568
} | [
2830,
3393,
17926,
68188,
8714,
3144,
1155,
353,
8840,
836,
8,
341,
2405,
7729,
914,
271,
2405,
305,
1758,
89164,
284,
2915,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
6692,
4073,
10556,
3782,
26772,
1171,
197,
532,
574... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNewLoading(t *testing.T) {
l := New()
l.Loading("loading...")
l.Loading("loading...2")
l.Loading("loading...33")
l.NextTick(func() {
l.Loading(fmt.Sprintf(" trigger when next ticket, count down: %.2d", 10 - l.CountDownIndex() / (int(time.Second) / int(l.SleepDuration()))))
})
println("loading 1s")
time.Sleep(10 * time.Second)
l.Stop()
println("loading done")
time.Sleep(2 * time.Second)
} | explode_data.jsonl/27131 | {
"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,
3564,
8578,
1155,
353,
8840,
836,
8,
341,
8810,
1669,
1532,
741,
8810,
65730,
2228,
445,
10628,
33093,
8810,
65730,
2228,
445,
10628,
1112,
17,
1138,
8810,
65730,
2228,
445,
10628,
1112,
18,
18,
1138,
8810,
18501,
22213,
185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestObjectFileBasics(t *testing.T) {
s := RunBasicJetStreamServer()
defer shutdown(s)
nc, js := jsClient(t, s)
defer nc.Close()
obs, err := js.CreateObjectStore(&nats.ObjectStoreConfig{Bucket: "FILES"})
expectOk(t, err)
// Create ~8MB object.
blob := make([]byte, 8*1024*1024+33)
rand.Read(blob)
tmpFile, err := ioutil.TempFile("", "objfile")
expectOk(t, err)
defer os.Remove(tmpFile.Name()) // clean up
err = ioutil.WriteFile(tmpFile.Name(), blob, 0600)
expectOk(t, err)
_, err = obs.PutFile(tmpFile.Name())
expectOk(t, err)
tmpResult, err := ioutil.TempFile("", "objfileresult")
expectOk(t, err)
defer os.Remove(tmpResult.Name()) // clean up
err = obs.GetFile(tmpFile.Name(), tmpResult.Name())
expectOk(t, err)
// Make sure they are the same.
original, err := ioutil.ReadFile(tmpFile.Name())
expectOk(t, err)
restored, err := ioutil.ReadFile(tmpResult.Name())
expectOk(t, err)
if !bytes.Equal(original, restored) {
t.Fatalf("Files did not match")
}
} | explode_data.jsonl/75490 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 403
} | [
2830,
3393,
1190,
1703,
33603,
1211,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
6452,
15944,
35641,
3027,
5475,
741,
16867,
23766,
1141,
692,
197,
1016,
11,
6994,
1669,
6994,
2959,
1155,
11,
274,
340,
16867,
25126,
10421,
2822,
197,
5481... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDownloadStatus(t *testing.T) {
var (
bck = cmn.Bck{
Name: testBucketName,
Provider: cmn.ProviderAIS,
}
baseParams = tutils.BaseAPIParams()
m = ioContext{t: t}
)
m.initWithCleanupAndSaveState()
m.expectTargets(2)
var (
shortFileName = "shortFile"
longFileName = tutils.GenerateNotConflictingObjectName(shortFileName, "longFile", bck, m.smap)
)
files := map[string]string{
shortFileName: "https://raw.githubusercontent.com/NVIDIA/aistore/master/README.md",
longFileName: "https://storage.googleapis.com/nvdata-openimages/openimages-train-000001.tar",
}
clearDownloadList(t)
tutils.CreateBucketWithCleanup(t, m.proxyURL, bck, nil)
id, err := api.DownloadMulti(baseParams, generateDownloadDesc(), bck, files)
tassert.CheckFatal(t, err)
// Wait for the short file to be downloaded
err = tutils.WaitForObjectToBeDowloaded(baseParams, bck, shortFileName, 5*time.Second)
tassert.CheckFatal(t, err)
resp, err := api.DownloadStatus(baseParams, id)
tassert.CheckFatal(t, err)
tassert.Errorf(t, resp.Total == 2, "expected %d objects, got %d", 2, resp.Total)
tassert.Errorf(t, resp.FinishedCnt == 1, "expected the short file to be downloaded")
tassert.Fatalf(t, len(resp.CurrentTasks) == 1, "did not expect the long file to be already downloaded")
tassert.Fatalf(
t, resp.CurrentTasks[0].Name == longFileName,
"invalid file name in status message, expected: %s, got: %s",
longFileName, resp.CurrentTasks[0].Name,
)
checkDownloadList(t)
} | explode_data.jsonl/70383 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 584
} | [
2830,
3393,
11377,
2522,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
2233,
377,
284,
9961,
77,
1785,
377,
515,
298,
21297,
25,
257,
1273,
36018,
675,
345,
298,
197,
5179,
25,
9961,
77,
36208,
32,
1637,
345,
197,
197,
532,
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 TestMsgMultiSendMultipleOut(t *testing.T) {
acc1 := &authtypes.BaseAccount{
Address: addr1.String(),
}
acc2 := &authtypes.BaseAccount{
Address: addr2.String(),
}
genAccs := []authtypes.GenesisAccount{acc1, acc2}
app := simapp.SetupWithGenesisAccounts(genAccs)
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
err := app.BankKeeper.SetBalances(ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42)))
require.NoError(t, err)
err = app.BankKeeper.SetBalances(ctx, addr2, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 42)))
require.NoError(t, err)
app.Commit()
testCases := []appTestCase{
{
msgs: []sdk.Msg{multiSendMsg2},
accNums: []uint64{0},
accSeqs: []uint64{0},
expSimPass: true,
expPass: true,
privKeys: []cryptotypes.PrivKey{priv1},
expectedBalances: []expectedBalance{
{addr1, sdk.Coins{sdk.NewInt64Coin("foocoin", 32)}},
{addr2, sdk.Coins{sdk.NewInt64Coin("foocoin", 47)}},
{addr3, sdk.Coins{sdk.NewInt64Coin("foocoin", 5)}},
},
},
}
for _, tc := range testCases {
header := tmproto.Header{Height: app.LastBlockHeight() + 1}
txGen := simapp.MakeTestEncodingConfig().TxConfig
_, _, err := simapp.SignCheckDeliver(t, txGen, app.BaseApp, header, tc.msgs, "", tc.accNums, tc.accSeqs, tc.expSimPass, tc.expPass, tc.privKeys...)
require.NoError(t, err)
for _, eb := range tc.expectedBalances {
simapp.CheckBalance(t, app, eb.addr, eb.coins)
}
}
} | explode_data.jsonl/17263 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 636
} | [
2830,
3393,
6611,
20358,
11505,
32089,
2662,
1155,
353,
8840,
836,
8,
341,
197,
4475,
16,
1669,
609,
2717,
426,
1804,
13018,
7365,
515,
197,
98090,
25,
10789,
16,
6431,
3148,
197,
532,
197,
4475,
17,
1669,
609,
2717,
426,
1804,
13018,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnsafeDialPeers(t *testing.T) {
sw := p2p.MakeSwitch(cfg.DefaultP2PConfig(), 1, "testing", "123.123.123",
func(n int, sw *p2p.Switch) *p2p.Switch { return sw })
err := sw.Start()
require.NoError(t, err)
defer sw.Stop()
logger = log.TestingLogger()
p2pPeers = sw
testCases := []struct {
peers []string
isErr bool
}{
{[]string{}, true},
{[]string{"d51fb70907db1c6c2d5237e78379b25cf1a37ab4@127.0.0.1:41198"}, false},
{[]string{"127.0.0.1:41198"}, true},
}
for _, tc := range testCases {
res, err := UnsafeDialPeers(&rpctypes.Context{}, tc.peers, false)
if tc.isErr {
assert.Error(t, err)
} else {
assert.NoError(t, err)
assert.NotNil(t, res)
}
}
} | explode_data.jsonl/77198 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 328
} | [
2830,
3393,
78770,
35,
530,
10197,
388,
1155,
353,
8840,
836,
8,
341,
77295,
1669,
281,
17,
79,
50133,
16837,
28272,
13275,
47,
17,
47,
2648,
1507,
220,
16,
11,
330,
8840,
497,
330,
16,
17,
18,
13,
16,
17,
18,
13,
16,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestBadConn(t *testing.T) {
var err error
func() {
defer errRecover(&err)
panic(io.EOF)
}()
if err != driver.ErrBadConn {
t.Fatalf("expected driver.ErrBadConn, got: %#v", err)
}
func() {
defer errRecover(&err)
e := &Error{Severity: Efatal}
panic(e)
}()
if err != driver.ErrBadConn {
t.Fatalf("expected driver.ErrBadConn, got: %#v", err)
}
} | explode_data.jsonl/63427 | {
"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,
17082,
9701,
1155,
353,
8840,
836,
8,
341,
2405,
1848,
1465,
271,
29244,
368,
341,
197,
16867,
1848,
693,
3688,
2099,
615,
340,
197,
30764,
37258,
86492,
340,
197,
66816,
743,
1848,
961,
5579,
27862,
17082,
9701,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestBuildRingCol(t *testing.T) {
type testcase struct {
desc string
hm hitmap.Interface
icols [2][]maths.Pt
pt2my map[maths.Pt]int64
testYs bool
Col RingCol
}
tests := tbltest.Cases(
testcase{
desc: "Simple Rectangle",
testYs: true,
hm: hitmap.AllwaysInside,
icols: [2][]maths.Pt{
[]maths.Pt{{0, 0}, {0, 1}},
[]maths.Pt{{1, 0}, {1, 1}},
},
pt2my: map[maths.Pt]int64{},
Col: RingCol{
X1: 0,
X2: 1,
Rings: []Ring{
{
Label: maths.Inside,
Points: []maths.Pt{{0, 0}, {1, 0}, {1, 1}, {0, 1}},
},
},
Y1s: []YEdge{
{
Y: 0,
Descs: []RingDesc{{0, 0, maths.Inside}},
},
{
Y: 1,
Descs: []RingDesc{{0, 3, maths.Inside}},
},
},
Y2s: []YEdge{
{
Y: 0,
Descs: []RingDesc{{0, 1, maths.Inside}},
},
{
Y: 1,
Descs: []RingDesc{{0, 2, maths.Inside}},
},
},
},
},
testcase{
desc: "Simple Rectangle with constrined rightward line.",
hm: hitmap.AllwaysInside,
icols: [2][]maths.Pt{
[]maths.Pt{{0, 0}, {0, 1}},
[]maths.Pt{{1, 0}, {1, 1}},
},
pt2my: map[maths.Pt]int64{
{0, 0}: 100,
},
Col: RingCol{
X1: 0,
X2: 1,
Rings: []Ring{
{
Label: maths.Inside,
Points: []maths.Pt{{0, 0}, {1, 0}, {1, 1}, {0, 1}},
},
},
},
},
testcase{
desc: "Simple Rectangle with constrined rightward line 1.",
hm: hitmap.AllwaysInside,
icols: [2][]maths.Pt{
[]maths.Pt{{1, 0}, {1, 1}},
[]maths.Pt{{2, 0}, {2, 1}},
},
pt2my: map[maths.Pt]int64{
{1, 0}: 100,
},
Col: RingCol{
X1: 1,
X2: 2,
Rings: []Ring{
{
Label: maths.Inside,
Points: []maths.Pt{{1, 0}, {2, 0}, {2, 1}, {1, 1}},
},
},
},
},
testcase{ // special case.
desc: "Empty column (all outside) should be empty",
hm: new(hitmap.M), // Everything will be marked as outside
icols: [2][]maths.Pt{
[]maths.Pt{{0, 0}, {0, 1}, {0, 8}, {0, 9}},
[]maths.Pt{{1, 0}, {1, 1}, {1, 2}, {1, 4}, {1, 5}, {1, 7}, {1, 8}, {1, 9}},
},
pt2my: map[maths.Pt]int64{
{0, 0}: 0,
{0, 1}: 100,
{0, 8}: 800,
{0, 9}: 900,
},
Col: RingCol{
X1: 0,
X2: 1,
},
},
testcase{
desc: "Number Eight col 0",
hm: new(hitmap.M).AppendSegment(
hitmap.NewSegmentFromRing(maths.Inside, []maths.Pt{{0, 1}, {4, 1}, {4, 8}, {0, 8}}),
hitmap.NewSegmentFromRing(maths.Outside, []maths.Pt{{1, 2}, {3, 2}, {3, 4}, {1, 4}}),
hitmap.NewSegmentFromRing(maths.Outside, []maths.Pt{{1, 5}, {3, 5}, {3, 7}, {1, 7}}),
),
icols: [2][]maths.Pt{
[]maths.Pt{{0, 0}, {0, 1}, {0, 8}, {0, 9}},
[]maths.Pt{{1, 0}, {1, 1}, {1, 2}, {1, 4}, {1, 5}, {1, 7}, {1, 8}, {1, 9}},
},
pt2my: map[maths.Pt]int64{
{0, 0}: 0,
{0, 1}: 100,
{0, 8}: 800,
{0, 9}: 900,
},
Col: RingCol{
X1: 0,
X2: 1,
Rings: []Ring{
{
Label: maths.Outside,
Points: []maths.Pt{{0, 0}, {1, 0}, {1, 1}, {0, 1}},
},
{
Label: maths.Inside,
Points: []maths.Pt{{0, 1}, {1, 1}, {1, 2}, {1, 4}, {1, 5}, {1, 7}, {1, 8}, {0, 8}},
},
{
Label: maths.Outside,
Points: []maths.Pt{{0, 8}, {1, 8}, {1, 9}, {0, 9}},
},
},
},
},
)
tests.Run(func(idx int, test testcase) {
t.Logf("Running %v (%v)", idx, test.desc)
//var ys [2][]YEdge
col1 := BuildRingCol(context.Background(), test.hm, test.icols[0], test.icols[1], test.pt2my)
if ok, reason := ringDiff(&col1, &test.Col, test.testYs); ok {
t.Errorf("For %v (%v) %v", idx, test.desc, reason)
}
})
} | explode_data.jsonl/69516 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2164
} | [
2830,
3393,
11066,
43466,
6127,
1155,
353,
8840,
836,
8,
341,
13158,
70080,
2036,
341,
197,
41653,
256,
914,
198,
197,
9598,
76,
257,
4201,
2186,
41065,
198,
197,
197,
292,
3069,
220,
508,
17,
45725,
10374,
82,
1069,
83,
198,
197,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestUserCloneNilPermissions(t *testing.T) {
user := &User{
Username: "foo",
Password: "bar",
}
clone := user.clone()
if !reflect.DeepEqual(user, clone) {
t.Fatalf("Cloned Users are incorrect.\nexpected: %+v\ngot: %+v",
user, clone)
}
clone.Password = "baz"
if reflect.DeepEqual(user, clone) {
t.Fatal("Expected Users to be different")
}
} | explode_data.jsonl/75598 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 150
} | [
2830,
3393,
1474,
37677,
19064,
23851,
1155,
353,
8840,
836,
8,
341,
19060,
1669,
609,
1474,
515,
197,
197,
11115,
25,
330,
7975,
756,
197,
197,
4876,
25,
330,
2257,
756,
197,
630,
197,
19982,
1669,
1196,
15997,
2822,
743,
753,
34913,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReuse(t *testing.T) {
ms, account := create()
nn := make([]bool, 10)
for i := range nn {
nn[i] = true
}
account.nonces = append(account.nonces, nn...)
i := uint64(5)
ms.RemoveNonce(addr, account.nstart+i)
nonce := ms.NewNonce(addr)
if nonce != 105 {
t.Error("expected nonce to be 105. got", nonce)
}
} | explode_data.jsonl/57785 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 140
} | [
2830,
3393,
38081,
1155,
353,
8840,
836,
8,
341,
47691,
11,
2692,
1669,
1855,
2822,
197,
7370,
1669,
1281,
10556,
2641,
11,
220,
16,
15,
340,
2023,
600,
1669,
2088,
10883,
341,
197,
197,
7370,
989,
60,
284,
830,
198,
197,
532,
86866... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUrlExtractor_DateFromRoute(t *testing.T) {
t.Parallel()
pattern := "/{year}-{month}-{day}"
handler := func(actualDate *time.Time, err *error) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
obtainedDate, obtainedErr := extractor.DateFromRoute(r)
if obtainedDate != nil {
*actualDate = *obtainedDate
}
*err = obtainedErr
}
}
t.Run("It successfully extracts the date", func(t *testing.T) {
var actualDate time.Time
var err error
expectedDateStr := "2017-09-07"
expectedDate, err := time.Parse("2006-01-02", expectedDateStr)
assert.NoError(t, err)
executeRequest(t, pattern, "/"+expectedDateStr, handler(&actualDate, &err))
assert.Equal(t, err, nil)
assert.EqualValues(t, actualDate, expectedDate)
})
t.Run("It fails on invalid date", func(t *testing.T) {
invalidDate := "Two-Days-Later"
var actualDate time.Time
var err error
executeRequest(t, pattern, "/"+invalidDate, handler(&actualDate, &err))
assert.Error(t, err)
assert.EqualError(t, err, fmt.Sprintf("Invalid date %s", invalidDate))
assert.Equal(t, time.Time{}, actualDate)
})
} | explode_data.jsonl/15293 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 427
} | [
2830,
3393,
2864,
56118,
39564,
3830,
4899,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
3223,
3227,
1669,
3521,
90,
3157,
72013,
10249,
72013,
1292,
11195,
53326,
1669,
2915,
29721,
1916,
353,
1678,
16299,
11,
1848,
353,
841,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCheckListener(t *testing.T) {
listenerMock := &checkListenerMock{}
listenerMock.On("OnCheckRegistered", failingCheckName, mock.AnythingOfType("Result")).Return()
listenerMock.On("OnCheckRegistered", passingCheckName, mock.AnythingOfType("Result")).Return()
listenerMock.On("OnCheckStarted", failingCheckName).Return()
listenerMock.On("OnCheckStarted", passingCheckName).Return()
listenerMock.On("OnCheckCompleted", failingCheckName, mock.AnythingOfType("Result")).Return()
listenerMock.On("OnCheckCompleted", passingCheckName, mock.AnythingOfType("Result")).Return()
h := New(WithCheckListeners(listenerMock))
registerCheck(h, failingCheckName, false, false)
registerCheck(h, passingCheckName, true, false)
defer h.DeregisterAll()
// await first execution
time.Sleep(30 * time.Millisecond)
listenerMock.AssertExpectations(t)
completedChecks := listenerMock.getCompletedChecks()
assert.Equal(t, 2, len(completedChecks), "num completed checks")
for _, c := range completedChecks {
if c.name == failingCheckName {
assert.False(t, c.res.IsHealthy())
assert.Error(t, c.res.Error)
assert.Equal(t, "failed; i=1", c.res.Details)
} else {
assert.True(t, c.res.IsHealthy())
assert.NoError(t, c.res.Error)
assert.Equal(t, "success; i=1", c.res.Details)
}
}
} | explode_data.jsonl/28830 | {
"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,
3973,
2743,
1155,
353,
8840,
836,
8,
1476,
14440,
798,
11571,
1669,
609,
2028,
2743,
11571,
16094,
14440,
798,
11571,
8071,
445,
1925,
3973,
41430,
497,
21394,
3973,
675,
11,
7860,
13311,
1596,
34696,
445,
2077,
15197,
5598,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStreamDecompressionUnexpectedEOFHandling(t *testing.T) {
r := NewReader(&breakingReader{})
_, err := r.Read(make([]byte, 1024))
if err == nil {
t.Error("Underlying error was handled silently")
}
} | explode_data.jsonl/70466 | {
"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,
3027,
4900,
316,
4011,
29430,
23483,
38606,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
1532,
5062,
2099,
36657,
5062,
37790,
197,
6878,
1848,
1669,
435,
6503,
36944,
10556,
3782,
11,
220,
16,
15,
17,
19,
1171,
743,
1848,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewNeighbourWeightScalerUint64(t *testing.T) {
fullRange := uint64(0)
n1 := NewScalerUint64(0, fullRange)
require.Equal(t, uint32(fullRange), n1.max)
require.Equal(t, uint8(0), n1.shift)
fullRange = uint64(1 << 32)
n2 := NewScalerUint64(0, fullRange)
require.Equal(t, uint8(1), n2.shift)
require.Equal(t, uint32(fullRange>>1), n2.max)
} | explode_data.jsonl/30793 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 157
} | [
2830,
3393,
3564,
8813,
46818,
8295,
59553,
21570,
21,
19,
1155,
353,
8840,
836,
8,
341,
94042,
6046,
1669,
2622,
21,
19,
7,
15,
340,
9038,
16,
1669,
1532,
59553,
21570,
21,
19,
7,
15,
11,
2480,
6046,
340,
17957,
12808,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestValueBinder_Durations(t *testing.T) {
exampleDuration := 42 * time.Second
exampleDuration2 := 1 * time.Millisecond
var testCases = []struct {
name string
givenFailFast bool
givenBindErrors []error
whenURL string
whenMust bool
expectValue []time.Duration
expectError string
}{
{
name: "ok, binds value",
whenURL: "/search?param=42s¶m=1ms",
expectValue: []time.Duration{exampleDuration, exampleDuration2},
},
{
name: "ok, params values empty, value is not changed",
whenURL: "/search?nope=1",
expectValue: []time.Duration(nil),
},
{
name: "nok, previous errors fail fast without binding value",
givenFailFast: true,
givenBindErrors: []error{errors.New("previous error")},
whenURL: "/search?param=1¶m=100",
expectValue: []time.Duration(nil),
expectError: "previous error",
},
{
name: "ok (must), binds value",
whenMust: true,
whenURL: "/search?param=42s¶m=1ms",
expectValue: []time.Duration{exampleDuration, exampleDuration2},
},
{
name: "ok (must), params values empty, returns error, value is not changed",
whenMust: true,
whenURL: "/search?nope=1",
expectValue: []time.Duration(nil),
expectError: "code=400, message=required field value is empty, field=param",
},
{
name: "nok (must), previous errors fail fast without binding value",
givenFailFast: true,
givenBindErrors: []error{errors.New("previous error")},
whenMust: true,
whenURL: "/search?param=1¶m=100",
expectValue: []time.Duration(nil),
expectError: "previous error",
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
c := createTestContext(tc.whenURL, nil, nil)
b := QueryParamsBinder(c).FailFast(tc.givenFailFast)
b.errors = tc.givenBindErrors
var dest []time.Duration
var err error
if tc.whenMust {
err = b.MustDurations("param", &dest).BindError()
} else {
err = b.Durations("param", &dest).BindError()
}
assert.Equal(t, tc.expectValue, dest)
if tc.expectError != "" {
assert.EqualError(t, err, tc.expectError)
} else {
assert.NoError(t, err)
}
})
}
} | explode_data.jsonl/82557 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1011
} | [
2830,
3393,
1130,
44055,
1557,
21449,
1155,
353,
8840,
836,
8,
341,
8122,
1516,
12945,
1669,
220,
19,
17,
353,
882,
32435,
198,
8122,
1516,
12945,
17,
1669,
220,
16,
353,
882,
71482,
198,
2405,
1273,
37302,
284,
3056,
1235,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestIdentityConfig_ResolveExtendedProperties(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
pipelineMock := mock_common.NewMockAuthPipeline(ctrl)
var identityConfig IdentityConfig
var identityObject interface{}
var extendedIdentityObject interface{}
var authData interface{}
var err error
// Without extended properties
identityConfig = IdentityConfig{
Name: "test",
KubernetesAuth: &identity.KubernetesAuth{},
}
_ = json.Unmarshal([]byte(`{"sub":"foo","exp":1629884250}`), &identityObject)
pipelineMock.EXPECT().GetResolvedIdentity().Return(nil, identityObject)
extendedIdentityObject, err = identityConfig.ResolveExtendedProperties(pipelineMock)
assert.NilError(t, err)
assert.DeepEqual(t, identityObject, extendedIdentityObject)
// With extended properties
identityConfig = IdentityConfig{
Name: "test",
KubernetesAuth: &identity.KubernetesAuth{},
ExtendedProperties: []common.JSONProperty{
{Name: "prop1", Value: common.JSONValue{Static: "value1"}},
{Name: "prop2", Value: common.JSONValue{Pattern: "auth.identity.sub"}},
},
}
pipelineMock.EXPECT().GetResolvedIdentity().Return(nil, identityObject)
_ = json.Unmarshal([]byte(`{"context":{},"auth":{"identity":{"sub":"foo","exp":1629884250}}}`), &authData)
pipelineMock.EXPECT().GetDataForAuthorization().Return(authData)
extendedIdentityObject, err = identityConfig.ResolveExtendedProperties(pipelineMock)
assert.NilError(t, err)
extendedIdentityObjectJSON, _ := json.Marshal(extendedIdentityObject)
assert.Equal(t, string(extendedIdentityObjectJSON), `{"exp":1629884250,"prop1":"value1","prop2":"foo","sub":"foo"}`)
} | explode_data.jsonl/58121 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 597
} | [
2830,
3393,
18558,
2648,
62,
56808,
53190,
7903,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
3223,
8790,
11571,
1669,
7860,
21107,
7121,
11571,
5087,
34656,
62100,
692,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSetQueryOptions(t *testing.T) {
t.Parallel()
c, s := makeClient(t, nil, nil)
defer s.Stop()
r, _ := c.newRequest("GET", "/v1/jobs")
q := &QueryOptions{
Region: "foo",
Namespace: "bar",
AllowStale: true,
WaitIndex: 1000,
WaitTime: 100 * time.Second,
AuthToken: "foobar",
}
r.setQueryOptions(q)
if r.params.Get("region") != "foo" {
t.Fatalf("bad: %v", r.params)
}
if r.params.Get("namespace") != "bar" {
t.Fatalf("bad: %v", r.params)
}
if _, ok := r.params["stale"]; !ok {
t.Fatalf("bad: %v", r.params)
}
if r.params.Get("index") != "1000" {
t.Fatalf("bad: %v", r.params)
}
if r.params.Get("wait") != "100000ms" {
t.Fatalf("bad: %v", r.params)
}
if r.token != "foobar" {
t.Fatalf("bad: %v", r.token)
}
} | explode_data.jsonl/65018 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 367
} | [
2830,
3393,
1649,
2859,
3798,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
1444,
11,
274,
1669,
1281,
2959,
1155,
11,
2092,
11,
2092,
340,
16867,
274,
30213,
2822,
7000,
11,
716,
1669,
272,
4618,
1900,
445,
3806,
497,
3521,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestEnvoy(t *testing.T) {
_, tearDown := initLocalPilotTestEnv(t)
defer func() {
if testEnv != nil {
testEnv.TearDown()
}
tearDown()
}()
startEnvoy(t)
// Make sure tcp port is ready before starting the test.
env.WaitForPort(testEnv.Ports().TCPProxyPort)
t.Run("envoyInit", envoyInit)
t.Run("service", testService)
} | explode_data.jsonl/6871 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 141
} | [
2830,
3393,
14359,
2253,
1155,
353,
8840,
836,
8,
341,
197,
6878,
32825,
1669,
2930,
7319,
47,
23958,
2271,
14359,
1155,
340,
16867,
2915,
368,
341,
197,
743,
1273,
14359,
961,
2092,
341,
298,
18185,
14359,
836,
682,
4454,
741,
197,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestCopyingLabelsFromSpecToLocator(t *testing.T) {
s := NewSpecHandler()
opts := map[string]string{
"hello": "world",
}
spec := &api.VolumeSpec{
VolumeLabels: map[string]string{
"goodbye": "fornow",
},
}
_, locator, _, err := s.UpdateSpecFromOpts(opts, spec, nil, nil)
require.NoError(t, err)
require.Contains(t, locator.VolumeLabels, "hello")
require.Contains(t, locator.VolumeLabels, "goodbye")
} | explode_data.jsonl/51186 | {
"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,
86512,
23674,
3830,
8327,
1249,
33831,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1532,
8327,
3050,
741,
64734,
1669,
2415,
14032,
30953,
515,
197,
197,
1,
14990,
788,
330,
14615,
756,
197,
532,
98100,
1669,
609,
2068,
79106,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIdentifyAppSourceTypeByAppDirWithKustomizations(t *testing.T) {
sourceType, err := GetAppSourceType(context.Background(), &argoappv1.ApplicationSource{}, "./testdata/kustomization_yaml", "testapp", map[string]bool{})
assert.Nil(t, err)
assert.Equal(t, argoappv1.ApplicationSourceTypeKustomize, sourceType)
sourceType, err = GetAppSourceType(context.Background(), &argoappv1.ApplicationSource{}, "./testdata/kustomization_yml", "testapp", map[string]bool{})
assert.Nil(t, err)
assert.Equal(t, argoappv1.ApplicationSourceTypeKustomize, sourceType)
sourceType, err = GetAppSourceType(context.Background(), &argoappv1.ApplicationSource{}, "./testdata/Kustomization", "testapp", map[string]bool{})
assert.Nil(t, err)
assert.Equal(t, argoappv1.ApplicationSourceTypeKustomize, sourceType)
} | explode_data.jsonl/5685 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 276
} | [
2830,
3393,
28301,
1437,
2164,
93363,
1359,
2164,
6184,
2354,
42,
1450,
8040,
1155,
353,
8840,
836,
8,
341,
47418,
929,
11,
1848,
1669,
2126,
2164,
93363,
5378,
19047,
1507,
609,
12088,
676,
85,
16,
17521,
3608,
22655,
5924,
92425,
1410... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestBPCharAssignTo(t *testing.T) {
var (
str string
run rune
)
simpleTests := []struct {
src pgtype.BPChar
dst interface{}
expected interface{}
}{
{src: pgtype.BPChar{String: "simple", Status: pgtype.Present}, dst: &str, expected: "simple"},
{src: pgtype.BPChar{String: "嗨", Status: pgtype.Present}, dst: &run, expected: '嗨'},
}
for i, tt := range simpleTests {
err := tt.src.AssignTo(tt.dst)
if err != nil {
t.Errorf("%d: %v", i, err)
}
if dst := reflect.ValueOf(tt.dst).Elem().Interface(); dst != tt.expected {
t.Errorf("%d: expected %v to assign %v, but result was %v", i, tt.src, tt.expected, dst)
}
}
} | explode_data.jsonl/47331 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 295
} | [
2830,
3393,
26095,
4768,
28933,
1249,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
11355,
914,
198,
197,
56742,
63499,
198,
197,
340,
1903,
6456,
18200,
1669,
3056,
1235,
341,
197,
41144,
414,
17495,
1313,
1785,
47,
4768,
198,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestWriteTwoPcs(t *testing.T) {
tf.UnitTest(t)
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
paddedSize := abi.PaddedPieceSize(16 << 20)
n := 2
var rawBytes []byte
for i := 0; i < n; i++ {
buf := bytes.Repeat([]byte{0xab * byte(i)}, int(paddedSize.Unpadded()))
rawBytes = append(rawBytes, buf...)
rf, w, _ := commpffi.ToReadableFile(bytes.NewReader(buf), int64(len(buf)))
_, _, _, err := ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg32GiBV1, rf, abi.UnpaddedPieceSize(len(buf)), tf, nil)
if err != nil {
panic(err)
}
if err := w(); err != nil {
panic(err)
}
}
if _, err := tf.Seek(io.SeekStart, 0); err != nil { // nolint:staticcheck
panic(err)
}
ffiBytes, err := ioutil.ReadAll(tf)
if err != nil {
panic(err)
}
if err := tf.Close(); err != nil {
panic(err)
}
if err := os.Remove(tf.Name()); err != nil {
panic(err)
}
outBytes := make([]byte, int(paddedSize)*n)
fr32.Pad(rawBytes, outBytes)
require.Equal(t, ffiBytes, outBytes)
unpadBytes := make([]byte, int(paddedSize.Unpadded())*n)
fr32.Unpad(ffiBytes, unpadBytes)
require.Equal(t, rawBytes, unpadBytes)
} | explode_data.jsonl/30363 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 502
} | [
2830,
3393,
7985,
11613,
47,
4837,
1155,
353,
8840,
836,
8,
341,
3244,
69,
25159,
2271,
1155,
340,
3244,
69,
11,
716,
1669,
43144,
65009,
1703,
4283,
5173,
28105,
330,
2388,
10681,
12,
5130,
3223,
16828,
1695,
1669,
61050,
1069,
16828,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSignVote(t *testing.T) {
pv := mock.NewPV()
pk, _ := pv.GetPubKey()
vote := &tmproto.Vote{Height: 2}
pv.SignVote(chainID, vote)
msg := tmtypes.VoteSignBytes(chainID, vote)
ok := pk.VerifySignature(msg, vote.Signature)
require.True(t, ok)
} | explode_data.jsonl/35538 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 113
} | [
2830,
3393,
7264,
41412,
1155,
353,
8840,
836,
8,
341,
3223,
85,
1669,
7860,
7121,
48469,
741,
3223,
74,
11,
716,
1669,
33491,
2234,
29162,
1592,
2822,
5195,
1272,
1669,
609,
13730,
15110,
5058,
1272,
90,
3640,
25,
220,
17,
532,
3223,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCmdWithFeeHappyPathDefaultAmount(t *testing.T) {
sendMsg := &cash.SendMsg{
Metadata: &weave.Metadata{Schema: 1},
Source: fromHex(t, "b1ca7e78f74423ae01da3b51e676934d9105f282"),
Destination: fromHex(t, "E28AE9A6EB94FC88B73EB7CBD6B87BF93EB9BEF0"),
Amount: coin.NewCoinp(5, 0, "DOGE"),
Memo: "a memo",
}
sendTx := &blogapp.Tx{
Sum: &blogapp.Tx_CashSendMsg{
CashSendMsg: sendMsg,
},
}
cases := map[string]struct {
Conf cash.Configuration
Fees map[string]coin.Coin
WantFee *coin.Coin
}{
"only minimal fee": {
Conf: cash.Configuration{
Metadata: &weave.Metadata{Schema: 1},
MinimalFee: coin.NewCoin(4, 0, "BTC"),
},
Fees: nil,
WantFee: coin.NewCoinp(4, 0, "BTC"),
},
"only message fee": {
Conf: cash.Configuration{
Metadata: &weave.Metadata{Schema: 1},
MinimalFee: coin.NewCoin(0, 0, ""),
},
Fees: map[string]coin.Coin{
sendMsg.Path(): coin.NewCoin(17, 0, "IOV"),
},
WantFee: coin.NewCoinp(17, 0, "IOV"),
},
"custom message fee is more important than global setting": {
Conf: cash.Configuration{
Metadata: &weave.Metadata{Schema: 1},
MinimalFee: coin.NewCoin(123, 0, "IOV"),
},
Fees: map[string]coin.Coin{
sendMsg.Path(): coin.NewCoin(11, 0, "IOV"),
},
WantFee: coin.NewCoinp(11, 0, "IOV"),
},
}
for testName, tc := range cases {
t.Run(testName, func(t *testing.T) {
var input bytes.Buffer
if _, err := writeTx(&input, sendTx); err != nil {
t.Fatalf("cannot serialize transaction: %s", err)
}
tm := newCashConfTendermintServer(t, tc.Conf, tc.Fees)
defer tm.Close()
var output bytes.Buffer
args := []string{
// Instead of providing an amount, rely on what is configured
// for the network.
"-tm", tm.URL,
}
if err := cmdWithFee(&input, &output, args); err != nil {
t.Fatalf("cannot attach a fee to transaction: %s", err)
}
tx, _, err := readTx(&output)
if err != nil {
t.Fatalf("cannot unmarshal created transaction: %s", err)
}
assert.Equal(t, tc.WantFee, tx.Fees.Fees)
})
}
} | explode_data.jsonl/19677 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 980
} | [
2830,
3393,
15613,
2354,
41941,
32847,
1820,
3675,
10093,
1155,
353,
8840,
836,
8,
341,
32817,
6611,
1669,
609,
41271,
20176,
6611,
515,
197,
9209,
7603,
25,
262,
609,
896,
523,
46475,
90,
8632,
25,
220,
16,
1583,
197,
197,
3608,
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... | 4 |
func TestEntry_PasteUnicode(t *testing.T) {
e := widget.NewMultiLineEntry()
e.SetText("line")
e.CursorColumn = 4
clipboard := test.NewClipboard()
clipboard.SetContent("thing {\n\titem: 'val测试'\n}")
shortcut := &fyne.ShortcutPaste{Clipboard: clipboard}
e.TypedShortcut(shortcut)
assert.Equal(t, "thing {\n\titem: 'val测试'\n}", clipboard.Content())
assert.Equal(t, "linething {\n\titem: 'val测试'\n}", e.Text)
assert.Equal(t, 2, e.CursorRow)
assert.Equal(t, 1, e.CursorColumn)
} | explode_data.jsonl/12350 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 218
} | [
2830,
3393,
5874,
1088,
5525,
33920,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
9086,
7121,
20358,
2460,
5874,
741,
7727,
92259,
445,
1056,
1138,
7727,
29929,
2933,
284,
220,
19,
271,
197,
70848,
1669,
1273,
7121,
65141,
741,
197,
70848,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestValidateRedirectURL(t *testing.T) {
tests := []struct {
redirectURL string
msg string
}{
{
redirectURL: "http://www.nginx.com",
msg: "base redirect url",
},
{
redirectURL: "${scheme}://${host}/sorry",
msg: "multi variable redirect url",
},
{
redirectURL: "${http_x_forwarded_proto}://${host}/sorry",
msg: "x-forwarded-proto redirect url use case",
},
{
redirectURL: "http://${host}${request_uri}",
msg: "use multi variables, no scheme set",
},
{
redirectURL: "${scheme}://www.${host}${request_uri}",
msg: "use multi variables",
},
{
redirectURL: "http://example.com/redirect?source=abc",
msg: "arg variable use",
},
{
redirectURL: `\"${scheme}://${host}\"`,
msg: "url with escaped quotes",
},
{
redirectURL: "http://{abc}",
msg: "url with curly braces with no $ prefix",
},
}
for _, test := range tests {
allErrs := validateRedirectURL(test.redirectURL, field.NewPath("url"), validRedirectVariableNames)
if len(allErrs) > 0 {
t.Errorf("validateRedirectURL(%s) returned errors %v for valid input for the case of %s", test.redirectURL, allErrs, test.msg)
}
}
} | explode_data.jsonl/65835 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 559
} | [
2830,
3393,
17926,
17725,
3144,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
37921,
3144,
914,
198,
197,
21169,
260,
914,
198,
197,
59403,
197,
197,
515,
298,
37921,
3144,
25,
330,
1254,
1110,
2136,
42907,
20014,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestProd(t *testing.T) {
t.Parallel()
s := []float64{}
val := Prod(s)
if val != 1 {
t.Errorf("Val not returned as default when slice length is zero")
}
s = []float64{3, 4, 1, 7, 5}
val = Prod(s)
if val != 420 {
t.Errorf("Wrong prod returned. Expected %v returned %v", 420, val)
}
} | explode_data.jsonl/1235 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
41279,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
1903,
1669,
3056,
3649,
21,
19,
16094,
19302,
1669,
71272,
1141,
340,
743,
1044,
961,
220,
16,
341,
197,
3244,
13080,
445,
2208,
537,
5927,
438,
1638,
979,
15983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetUnprocessedEventCountWithoutCheckpointReturning1Message(t *testing.T) {
//After the first message the lastsequencenumber init to 0
partitionInfo := eventhub.HubPartitionRuntimeInformation{
PartitionID: "0",
LastSequenceNumber: 0,
BeginningSequenceNumber: 0,
}
unprocessedEventCountInPartition0 := GetUnprocessedEventCountWithoutCheckpoint(&partitionInfo)
if unprocessedEventCountInPartition0 != 1 {
t.Errorf("Expected 1 messages in partition 0, got %d", unprocessedEventCountInPartition0)
}
} | explode_data.jsonl/13469 | {
"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,
1949,
1806,
34022,
1556,
2507,
26040,
92688,
84814,
16,
2052,
1155,
353,
8840,
836,
8,
341,
197,
322,
6025,
279,
1156,
1943,
279,
1537,
6603,
954,
268,
890,
2930,
311,
220,
15,
198,
72872,
680,
1731,
1669,
1538,
26682,
383... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPlayer_IsDucking(t *testing.T) {
pl := playerWithProperty("m_fFlags", st.PropertyValue{IntVal: 0})
assert.False(t, pl.IsDucking())
assert.True(t, pl.IsStanding())
assert.False(t, pl.IsDuckingInProgress())
assert.False(t, pl.IsUnDuckingInProgress())
pl = playerWithProperty("m_fFlags", st.PropertyValue{IntVal: 1 << 1})
assert.False(t, pl.IsDucking())
assert.False(t, pl.IsStanding())
assert.False(t, pl.IsDuckingInProgress())
assert.True(t, pl.IsUnDuckingInProgress())
pl = playerWithProperty("m_fFlags", st.PropertyValue{IntVal: 1 << 2})
assert.False(t, pl.IsDucking())
assert.False(t, pl.IsStanding())
assert.True(t, pl.IsDuckingInProgress())
assert.False(t, pl.IsUnDuckingInProgress())
pl = playerWithProperty("m_fFlags", st.PropertyValue{IntVal: 1<<1 | 1<<2})
assert.True(t, pl.IsDucking())
assert.False(t, pl.IsStanding())
assert.False(t, pl.IsDuckingInProgress())
assert.False(t, pl.IsUnDuckingInProgress())
} | explode_data.jsonl/12183 | {
"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,
4476,
31879,
35,
46170,
1155,
353,
8840,
836,
8,
341,
72213,
1669,
2781,
2354,
3052,
445,
76,
761,
9195,
497,
357,
15727,
1130,
90,
1072,
2208,
25,
220,
15,
8824,
6948,
50757,
1155,
11,
625,
4506,
35,
46170,
2398,
6948,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSecretsDelete(t *testing.T) {
// prepare
nsn := types.NamespacedName{
Name: "TestSecretsDelete",
}
orig := corev1.Secret{}
orig.Name = nsn.Name
objs := []runtime.Object{
v1.NewJaeger(nsn),
&orig,
}
r, cl := getReconciler(objs)
r.strategyChooser = func(jaeger *v1.Jaeger) strategy.S {
return strategy.S{}
}
// test
_, err := r.Reconcile(reconcile.Request{NamespacedName: nsn})
assert.NoError(t, err)
// verify
persisted := &corev1.Secret{}
persistedName := types.NamespacedName{
Name: orig.Name,
Namespace: orig.Namespace,
}
err = cl.Get(context.Background(), persistedName, persisted)
assert.Empty(t, persisted.Name)
assert.Error(t, err) // not found
} | explode_data.jsonl/76530 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 292
} | [
2830,
3393,
19773,
82,
6435,
1155,
353,
8840,
836,
8,
341,
197,
322,
10549,
198,
84041,
77,
1669,
4494,
98932,
68552,
675,
515,
197,
21297,
25,
330,
2271,
19773,
82,
6435,
756,
197,
630,
197,
4670,
1669,
6200,
85,
16,
74779,
16094,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestUnitProcessModules(t *testing.T) {
// Test valid modules.
testVals := []struct {
in string
out string
}{
{"cghmrtwe", "cghmrtwe"},
{"CGHMRTWE", "cghmrtwe"},
{"c", "c"},
{"g", "g"},
{"h", "h"},
{"m", "m"},
{"r", "r"},
{"t", "t"},
{"w", "w"},
{"e", "e"},
{"C", "c"},
{"G", "g"},
{"H", "h"},
{"M", "m"},
{"R", "r"},
{"T", "t"},
{"W", "w"},
{"E", "e"},
}
for _, testVal := range testVals {
out, err := processModules(testVal.in)
if err != nil {
t.Error("processModules failed with error:", err)
}
if out != testVal.out {
t.Errorf("processModules returned incorrect modules: expected %s, got %s\n", testVal.out, out)
}
}
// Test invalid modules.
invalidModules := []string{"abdfijklnopqsuvxyz", "cghmrtwez", "cz", "z", "cc", "ccz", "ccm", "cmm", "ccmm"}
for _, invalidModule := range invalidModules {
_, err := processModules(invalidModule)
if err == nil {
t.Error("processModules didn't error on invalid module:", invalidModule)
}
}
} | explode_data.jsonl/63784 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 463
} | [
2830,
3393,
4562,
7423,
28201,
1155,
353,
8840,
836,
8,
341,
197,
322,
3393,
2697,
13454,
624,
18185,
52452,
1669,
3056,
1235,
341,
197,
17430,
220,
914,
198,
197,
13967,
914,
198,
197,
59403,
197,
197,
4913,
66,
866,
76,
3342,
896,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTx_GetTxID(t *testing.T) {
t.Parallel()
t.Run("valid tx id", func(t *testing.T) {
tx, err := bt.NewTxFromString("010000000193a35408b6068499e0d5abd799d3e827d9bfe70c9b75ebe209c91d2507232651000000006b483045022100c1d77036dc6cd1f3fa1214b0688391ab7f7a16cd31ea4e5a1f7a415ef167df820220751aced6d24649fa235132f1e6969e163b9400f80043a72879237dab4a1190ad412103b8b40a84123121d260f5c109bc5a46ec819c2e4002e5ba08638783bfb4e01435ffffffff02404b4c00000000001976a91404ff367be719efa79d76e4416ffb072cd53b208888acde94a905000000001976a91404d03f746652cfcb6cb55119ab473a045137d26588ac00000000")
assert.NoError(t, err)
assert.NotNil(t, tx)
assert.Equal(t, "19dcf16ecc9286c3734fdae3d45d4fc4eb6b25f841131e06460f4939bba0026e", tx.GetTxID())
})
t.Run("new tx, no data, but has default tx id", func(t *testing.T) {
tx := bt.NewTx()
assert.NotNil(t, tx)
assert.Equal(t, "d21633ba23f70118185227be58a63527675641ad37967e2aa461559f577aec43", tx.GetTxID())
})
} | explode_data.jsonl/28737 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 484
} | [
2830,
3393,
31584,
13614,
31584,
915,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
3244,
16708,
445,
1891,
9854,
877,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
46237,
11,
1848,
1669,
19592,
7121,
31584,
44491,
445,
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... | 1 |
func TestGetSupportingRuntimes(t *testing.T) {
g := gomega.NewGomegaWithT(t)
namespace := "default"
tfRuntime := "tf-runtime"
sklearnRuntime := "sklearn-runtime"
pmmlRuntime := "pmml-runtime"
mlserverRuntime := "mlserver-runtime"
servingRuntimeSpecs := map[string]v1alpha1.ServingRuntimeSpec{
tfRuntime: {
SupportedModelTypes: []v1alpha1.Framework{
{
Name: "tensorflow",
Version: proto.String("1"),
},
},
ServingRuntimePodSpec: v1alpha1.ServingRuntimePodSpec{
Containers: []v1alpha1.Container{
{
Name: "kserve-container",
Image: tfRuntime + "-image:latest",
},
},
},
Disabled: proto.Bool(false),
},
sklearnRuntime: {
SupportedModelTypes: []v1alpha1.Framework{
{
Name: "sklearn",
Version: proto.String("0"),
},
},
ServingRuntimePodSpec: v1alpha1.ServingRuntimePodSpec{
Containers: []v1alpha1.Container{
{
Name: "kserve-container",
Image: sklearnRuntime + "-image:latest",
},
},
},
Disabled: proto.Bool(false),
},
pmmlRuntime: {
SupportedModelTypes: []v1alpha1.Framework{
{
Name: "pmml",
Version: proto.String("4"),
},
},
ServingRuntimePodSpec: v1alpha1.ServingRuntimePodSpec{
Containers: []v1alpha1.Container{
{
Name: "kserve-container",
Image: pmmlRuntime + "-image:latest",
},
},
},
Disabled: proto.Bool(true),
},
mlserverRuntime: {
SupportedModelTypes: []v1alpha1.Framework{
{
Name: "sklearn",
Version: proto.String("0"),
},
{
Name: "xgboost",
Version: proto.String("1"),
},
{
Name: "lightgbm",
Version: proto.String("3"),
},
},
ServingRuntimePodSpec: v1alpha1.ServingRuntimePodSpec{
Containers: []v1alpha1.Container{
{
Name: "kserve-container",
Image: pmmlRuntime + "-image:latest",
},
},
},
GrpcMultiModelManagementEndpoint: proto.String("port:8085"),
Disabled: proto.Bool(false),
},
}
runtimes := &v1alpha1.ServingRuntimeList{
Items: []v1alpha1.ServingRuntime{
{
ObjectMeta: metav1.ObjectMeta{
Name: tfRuntime,
Namespace: namespace,
},
Spec: servingRuntimeSpecs[tfRuntime],
},
{
ObjectMeta: metav1.ObjectMeta{
Name: sklearnRuntime,
Namespace: namespace,
},
Spec: servingRuntimeSpecs[sklearnRuntime],
},
{
ObjectMeta: metav1.ObjectMeta{
Name: pmmlRuntime,
Namespace: namespace,
},
Spec: servingRuntimeSpecs[pmmlRuntime],
},
},
}
clusterRuntimes := &v1alpha1.ClusterServingRuntimeList{
Items: []v1alpha1.ClusterServingRuntime{
{
ObjectMeta: metav1.ObjectMeta{
Name: mlserverRuntime,
},
Spec: servingRuntimeSpecs[mlserverRuntime],
},
{
ObjectMeta: metav1.ObjectMeta{
Name: tfRuntime,
},
Spec: servingRuntimeSpecs[tfRuntime],
},
},
}
var storageUri = "s3://test/model"
scenarios := map[string]struct {
spec *ModelSpec
isMMS bool
expected []v1alpha1.ServingRuntimeSpec
}{
"BothClusterAndNamespaceRuntimesSupportModel": {
spec: &ModelSpec{
Framework: v1alpha1.Framework{
Name: "tensorflow",
},
PredictorExtensionSpec: PredictorExtensionSpec{
StorageURI: &storageUri,
},
},
isMMS: false,
expected: []v1alpha1.ServingRuntimeSpec{servingRuntimeSpecs[tfRuntime], servingRuntimeSpecs[tfRuntime]},
},
"RuntimeNotFound": {
spec: &ModelSpec{
Framework: v1alpha1.Framework{
Name: "nonexistent-framework",
},
PredictorExtensionSpec: PredictorExtensionSpec{
StorageURI: &storageUri,
},
},
isMMS: false,
expected: []v1alpha1.ServingRuntimeSpec{},
},
"FrameworkWithDisabledRuntimeSpecified": {
spec: &ModelSpec{
Framework: v1alpha1.Framework{
Name: "pmml",
},
PredictorExtensionSpec: PredictorExtensionSpec{
StorageURI: &storageUri,
},
},
isMMS: false,
expected: []v1alpha1.ServingRuntimeSpec{},
},
"ModelMeshCompatibleRuntimeFrameworkSpecified": {
spec: &ModelSpec{
Framework: v1alpha1.Framework{
Name: "sklearn",
},
PredictorExtensionSpec: PredictorExtensionSpec{
StorageURI: &storageUri,
},
},
isMMS: true,
expected: []v1alpha1.ServingRuntimeSpec{servingRuntimeSpecs[mlserverRuntime]},
},
"SMSRuntimeFrameworkSpecified": {
spec: &ModelSpec{
Framework: v1alpha1.Framework{
Name: "sklearn",
},
PredictorExtensionSpec: PredictorExtensionSpec{
StorageURI: &storageUri,
},
},
isMMS: false,
expected: []v1alpha1.ServingRuntimeSpec{servingRuntimeSpecs[sklearnRuntime]},
},
}
s := runtime.NewScheme()
v1alpha1.AddToScheme(s)
mockClient := fake.NewClientBuilder().WithLists(runtimes, clusterRuntimes).WithScheme(s).Build()
for name, scenario := range scenarios {
t.Run(name, func(t *testing.T) {
res, _ := scenario.spec.GetSupportingRuntimes(mockClient, namespace, scenario.isMMS)
if !g.Expect(res).To(gomega.Equal(scenario.expected)) {
t.Errorf("got %v, want %v", res, scenario.expected)
}
})
}
} | explode_data.jsonl/60405 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2378
} | [
2830,
3393,
1949,
7916,
287,
49,
3850,
1733,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
342,
32696,
7121,
38,
32696,
2354,
51,
1155,
340,
56623,
1669,
330,
2258,
1837,
3244,
69,
15123,
1669,
330,
8935,
68912,
698,
1903,
74,
12675,
1512... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGistFile_String(t *testing.T) {
v := GistFile{
Size: Int(0),
Filename: String(""),
Language: String(""),
Type: String(""),
RawURL: String(""),
Content: String(""),
}
want := `github.GistFile{Size:0, Filename:"", Language:"", Type:"", RawURL:"", Content:""}`
if got := v.String(); got != want {
t.Errorf("GistFile.String = %v, want %v", got, want)
}
} | explode_data.jsonl/33239 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 163
} | [
2830,
3393,
38,
380,
1703,
31777,
1155,
353,
8840,
836,
8,
341,
5195,
1669,
479,
380,
1703,
515,
197,
91224,
25,
257,
1333,
7,
15,
1326,
197,
12727,
4033,
25,
923,
445,
4461,
197,
197,
13806,
25,
923,
445,
4461,
197,
27725,
25,
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... | 2 |
func TestStoreRemovePlaceholderOnError(t *testing.T) {
defer leaktest.AfterTest(t)()
tc := testContext{}
stopper := stop.NewStopper()
defer stopper.Stop(context.TODO())
tc.Start(t, stopper)
s := tc.store
ctx := context.Background()
// Clobber the existing range so we can test nonoverlapping placeholders.
repl1, err := s.GetReplica(1)
if err != nil {
t.Fatal(err)
}
if err := s.RemoveReplica(context.Background(), repl1, repl1.Desc().NextReplicaID, RemoveOptions{
DestroyData: true,
}); err != nil {
t.Fatal(err)
}
// Generate a minimal fake snapshot.
snapData := &roachpb.RaftSnapshotData{
RangeDescriptor: *repl1.Desc(),
}
data, err := protoutil.Marshal(snapData)
if err != nil {
t.Fatal(err)
}
// Wrap the snapshot in a minimal header. The request will error because the
// replica tombstone for the range requires that a new replica have an ID
// greater than 1.
snapHeader := &SnapshotRequest_Header{
State: storagepb.ReplicaState{Desc: repl1.Desc()},
RaftMessageRequest: RaftMessageRequest{
RangeID: 1,
ToReplica: roachpb.ReplicaDescriptor{
NodeID: 1,
StoreID: 1,
ReplicaID: 0,
},
FromReplica: roachpb.ReplicaDescriptor{
NodeID: 2,
StoreID: 2,
ReplicaID: 2,
},
Message: raftpb.Message{
Type: raftpb.MsgSnap,
Snapshot: raftpb.Snapshot{
Data: data,
},
},
},
}
const expected = "preemptive snapshot from term 0 received"
if err := s.processRaftSnapshotRequest(ctx, snapHeader,
IncomingSnapshot{
SnapUUID: uuid.MakeV4(),
State: &storagepb.ReplicaState{Desc: repl1.Desc()},
}); !testutils.IsPError(err, expected) {
t.Fatalf("expected %s, but found %v", expected, err)
}
s.mu.Lock()
numPlaceholders := len(s.mu.replicaPlaceholders)
s.mu.Unlock()
if numPlaceholders != 0 {
t.Fatalf("expected 0 placeholders, but found %d", numPlaceholders)
}
if n := atomic.LoadInt32(&s.counts.removedPlaceholders); n != 1 {
t.Fatalf("expected 1 removed placeholder, but found %d", n)
}
} | explode_data.jsonl/75779 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 803
} | [
2830,
3393,
6093,
13021,
48305,
74945,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
741,
78255,
1669,
1273,
1972,
16094,
62644,
712,
1669,
2936,
7121,
10674,
712,
741,
16867,
2936,
712,
30213,
5378,
90988,
2398,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestCrUnmergedCreateInRemovedDir(t *testing.T) {
test(t,
users("alice", "bob"),
as(alice,
mkfile("a/b/c/d/e", "hello"),
),
as(bob,
disableUpdates(),
),
as(alice,
rm("a/b/c/d/e"),
rmdir("a/b/c/d"),
rmdir("a/b/c"),
rmdir("a/b"),
),
as(bob, noSync(),
write("a/b/c/d/f", "goodbye"),
reenableUpdates(),
lsdir("a/b/c/d", m{"f": "FILE"}),
read("a/b/c/d/f", "goodbye"),
),
as(alice,
lsdir("a/b/c/d", m{"f": "FILE"}),
read("a/b/c/d/f", "goodbye"),
),
)
} | explode_data.jsonl/31366 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 305
} | [
2830,
3393,
16001,
1806,
40354,
4021,
641,
42642,
6184,
1155,
353,
8840,
836,
8,
341,
18185,
1155,
345,
197,
90896,
445,
63195,
497,
330,
47086,
4461,
197,
60451,
17643,
558,
345,
298,
2109,
74,
1192,
445,
64,
3470,
2899,
3446,
16546,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestKubeadmConfigReconciler_Reconcile_GenerateCloudConfigData(t *testing.T) {
g := NewWithT(t)
cluster := newCluster("cluster")
cluster.Status.InfrastructureReady = true
controlPlaneInitMachine := newControlPlaneMachine(cluster, "control-plane-init-machine")
controlPlaneInitConfig := newControlPlaneInitKubeadmConfig(controlPlaneInitMachine, "control-plane-init-cfg")
objects := []client.Object{
cluster,
controlPlaneInitMachine,
controlPlaneInitConfig,
}
objects = append(objects, createSecrets(t, cluster, controlPlaneInitConfig)...)
myclient := helpers.NewFakeClientWithScheme(setupScheme(), objects...)
k := &KubeadmConfigReconciler{
Client: myclient,
KubeadmInitLock: &myInitLocker{},
}
request := ctrl.Request{
NamespacedName: client.ObjectKey{
Namespace: "default",
Name: "control-plane-init-cfg",
},
}
result, err := k.Reconcile(ctx, request)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(result.Requeue).To(BeFalse())
g.Expect(result.RequeueAfter).To(Equal(time.Duration(0)))
cfg, err := getKubeadmConfig(myclient, "control-plane-init-cfg")
g.Expect(err).NotTo(HaveOccurred())
g.Expect(cfg.Status.Ready).To(BeTrue())
g.Expect(cfg.Status.DataSecretName).NotTo(BeNil())
g.Expect(cfg.Status.ObservedGeneration).NotTo(BeNil())
assertHasTrueCondition(g, myclient, request, bootstrapv1.CertificatesAvailableCondition)
assertHasTrueCondition(g, myclient, request, bootstrapv1.DataSecretAvailableCondition)
// Ensure that we don't fail trying to refresh any bootstrap tokens
_, err = k.Reconcile(ctx, request)
g.Expect(err).NotTo(HaveOccurred())
} | explode_data.jsonl/44318 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 591
} | [
2830,
3393,
42,
392,
3149,
76,
2648,
693,
40446,
5769,
50693,
40446,
457,
2646,
13220,
16055,
2648,
1043,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
1532,
2354,
51,
1155,
692,
197,
18855,
1669,
501,
28678,
445,
18855,
1138,
197,
18855,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestScramGenerateSalt(t *testing.T) {
t.Run("valid", func(t *testing.T) {
saltLengths := []int{
scramDefaultSaltLength,
scramDefaultSaltLength * 2,
}
for _, saltLength := range saltLengths {
t.Run(fmt.Sprintf("salt length %d", saltLength), func(t *testing.T) {
salt, err := scramGenerateSalt(saltLength)
if err != nil {
t.Error(err)
}
if len(salt) != saltLength {
t.Errorf("expected: %d actual: %d", saltLength, len(salt))
}
})
}
})
t.Run("invalid", func(t *testing.T) {
saltLengths := []int{0, -1}
for _, saltLength := range saltLengths {
t.Run(fmt.Sprintf("salt length %d", saltLength), func(t *testing.T) {
if _, err := scramGenerateSalt(saltLength); err == nil {
t.Errorf("error expected for salt length of %d", saltLength)
}
})
}
})
} | explode_data.jsonl/28536 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 369
} | [
2830,
3393,
3326,
2396,
31115,
47318,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
1891,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
1903,
3145,
4373,
82,
1669,
3056,
396,
515,
298,
29928,
2396,
3675,
47318,
4373,
345,
298,
29928... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewPolicyFromBytes(t *testing.T) {
// Success
bytes, err := ioutil.ReadFile("./fixtures/policy.json")
require.NoError(t, err)
policy, err := NewPolicyFromBytes(bytes)
require.NoError(t, err)
assert.Equal(t, policyFixtureContents, policy)
// A failure case; most are tested in the individual method unit tests.
_, err = NewPolicyFromBytes([]byte(""))
require.Error(t, err)
assert.IsType(t, InvalidPolicyFormatError(""), err)
} | explode_data.jsonl/36492 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
3564,
13825,
3830,
7078,
1155,
353,
8840,
836,
8,
341,
197,
322,
13047,
198,
70326,
11,
1848,
1669,
43144,
78976,
13988,
45247,
4322,
8018,
4323,
1138,
17957,
35699,
1155,
11,
1848,
340,
3223,
8018,
11,
1848,
1669,
1532,
138... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFailedImport(t *testing.T) {
testenv.MustHaveGoBuild(t)
const src = `
package p
import foo "go/types/thisdirectorymustnotexistotherwisethistestmayfail/foo" // should only see an error here
const c = foo.C
type T = foo.T
var v T = c
func f(x T) T { return foo.F(x) }
`
f, err := parseSrc("src", src)
if err != nil {
t.Fatal(err)
}
files := []*syntax.File{f}
// type-check using all possible importers
for _, compiler := range []string{"gc", "gccgo", "source"} {
errcount := 0
conf := Config{
Error: func(err error) {
// we should only see the import error
if errcount > 0 || !strings.Contains(err.Error(), "could not import") {
t.Errorf("for %s importer, got unexpected error: %v", compiler, err)
}
errcount++
},
//Importer: importer.For(compiler, nil),
}
info := &Info{
Uses: make(map[*syntax.Name]Object),
}
pkg, _ := conf.Check("p", files, info)
if pkg == nil {
t.Errorf("for %s importer, type-checking failed to return a package", compiler)
continue
}
imports := pkg.Imports()
if len(imports) != 1 {
t.Errorf("for %s importer, got %d imports, want 1", compiler, len(imports))
continue
}
imp := imports[0]
if imp.Name() != "foo" {
t.Errorf(`for %s importer, got %q, want "foo"`, compiler, imp.Name())
continue
}
// verify that all uses of foo refer to the imported package foo (imp)
for ident, obj := range info.Uses {
if ident.Value == "foo" {
if obj, ok := obj.(*PkgName); ok {
if obj.Imported() != imp {
t.Errorf("%s resolved to %v; want %v", ident.Value, obj.Imported(), imp)
}
} else {
t.Errorf("%s resolved to %v; want package name", ident.Value, obj)
}
}
}
}
} | explode_data.jsonl/29398 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 718
} | [
2830,
3393,
9408,
11511,
1155,
353,
8840,
836,
8,
341,
18185,
3160,
50463,
12116,
10850,
11066,
1155,
692,
4777,
2286,
284,
22074,
1722,
281,
271,
474,
15229,
330,
3346,
20384,
14,
574,
23037,
24812,
1921,
28575,
1575,
48043,
769,
380,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOpenShiftTraitsWithWebAndConfig(t *testing.T) {
env := createTestEnv(t, v1alpha1.IntegrationPlatformClusterOpenShift, "from('undertow:http').to('log:info')")
env.Integration.Spec.Traits = make(map[string]v1alpha1.TraitSpec)
env.Integration.Spec.Traits["service"] = v1alpha1.TraitSpec{
Configuration: map[string]string{
"port": "7071",
},
}
res := processTestEnv(t, env)
assert.NotNil(t, env.GetTrait(ID("service")))
assert.NotNil(t, env.GetTrait(ID("route")))
assert.NotNil(t, res.GetService(func(svc *corev1.Service) bool {
return svc.Name == TestDeploymentName && svc.Spec.Ports[0].TargetPort.StrVal == "http"
}))
} | explode_data.jsonl/54523 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 260
} | [
2830,
3393,
5002,
24841,
42820,
2354,
5981,
3036,
2648,
1155,
353,
8840,
836,
8,
341,
57538,
1669,
1855,
2271,
14359,
1155,
11,
348,
16,
7141,
16,
7371,
17376,
17296,
28678,
5002,
24841,
11,
330,
1499,
492,
1241,
529,
363,
69459,
1823,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_DeleteUser(t *testing.T) {
// given
user := getDummyUser()
realm := getDummyRealm()
handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
assert.Equal(t, fmt.Sprintf(UserDeletePath, realm.Spec.Realm.Realm, user.ID), req.URL.Path)
w.WriteHeader(204)
})
server := httptest.NewServer(handler)
defer server.Close()
client := Client{
requester: server.Client(),
URL: server.URL,
token: "dummy",
}
// when
err := client.DeleteUser(user.ID, realm.Spec.Realm.Realm)
// then
// correct path expected on httptest server
assert.NoError(t, err)
} | explode_data.jsonl/49875 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 238
} | [
2830,
3393,
2959,
57418,
1474,
1155,
353,
8840,
836,
8,
341,
197,
322,
2661,
198,
19060,
1669,
633,
43344,
1474,
741,
17200,
7673,
1669,
633,
43344,
64290,
2822,
53326,
1669,
1758,
89164,
18552,
3622,
1758,
37508,
11,
4232,
353,
1254,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_GetSchemaInfo(t *testing.T) {
testCases := []struct {
testName string
testDirectory string
readDirErr error
dataset string
schemaErr error
expectedSequence int
expectedFeedVersion int
}{
{
"Success when file and directory exist",
"../fixtures/datafeeds/documents/docs_singleZip",
nil,
"singleZip",
nil,
11,
1,
},
{
"Picks correct schema",
"../fixtures/datafeeds/documents/docs_pickCorrectZip",
nil,
"pickCorrectZip",
nil,
8,
2,
},
{
"Returns highest Feed Version when multiple",
"../fixtures/datafeeds/documents/docs_multiFeedVersion",
nil,
"multiFeedVersion",
nil,
11,
2,
},
{
"Returns highest Sequence when multiple",
"../fixtures/datafeeds/documents/docs_multiSequence",
nil,
"multiSequence",
nil,
12,
1,
},
{
"Errors when no schema to process",
"../fixtures/datafeeds/documents/docs_missingSchema",
nil,
"missingSchema",
errors.New("No valid schema found in: "),
-1,
-1,
},
{
"Error when directory does not exist",
"../fixtures/datafeeds/documents/non_existent",
errors.New("no such file or directory"),
"non_existent",
nil,
11,
1,
},
}
for _, d := range testCases {
t.Run(d.testName, func(t *testing.T) {
files, err := ioutil.ReadDir(d.testDirectory)
if d.dataset == "non_existent" {
assert.Error(t, err, fmt.Sprintf("Test: %s failed, directory does not exist so should not be found", d.testName))
assert.Contains(t, err.Error(), d.readDirErr.Error(), fmt.Sprintf("Test: %s failed, mismatched error codes", d.testName))
} else {
assert.NoError(t, err, fmt.Sprintf("Test: %s failed, should read file with no error", d.testName))
fs := &Service{&MockSftpClient{files, d.readDirErr}, "", "../fixtures/datafeeds"}
pv, err := fs.GetSchemaInfo(pkg)
if d.dataset == "emptyDir" || d.dataset == "missingSchema" {
assert.Error(t, err, d.schemaErr, fmt.Sprintf("Test: %s failed, directory is empty should should not read schema", d.testName))
assert.Contains(t, err.Error(), d.schemaErr.Error(), fmt.Sprintf("Test: %s failed, mismatched error codes", d.testName))
} else {
assert.NoError(t, err, fmt.Sprintf("Test: %s failed, file does not exist", d.testName))
assert.Equal(t, d.expectedFeedVersion, pv.FeedVersion, fmt.Sprintf("Test: %s failed, feed version values are not equal!", d.testName))
assert.Equal(t, d.expectedSequence, pv.Sequence, fmt.Sprintf("Test: %s failed, sequence values are not equal!", d.testName))
}
}
})
}
} | explode_data.jsonl/57082 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1131
} | [
2830,
3393,
13614,
8632,
1731,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
18185,
675,
310,
914,
198,
197,
18185,
9310,
981,
914,
198,
197,
37043,
6184,
7747,
688,
1465,
198,
197,
2698,
8369,
1797,
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... | 4 |
func TestProcessOptionNormal(t *testing.T) {
testExecutor := &mockOptionsExecutor{}
// normal case
testExecutor.On("executeOptions", getMockArguments()...).
Return(normal, nil).Once()
assert := assert.New(t)
options := PkiInitOption{}
optsExecutor, _, _ := NewPkiInitOption(options)
optsExecutor.(*PkiInitOption).executor = testExecutor
exitCode, err := optsExecutor.ProcessOptions()
assert.Equal(normal.intValue(), exitCode)
assert.Nil(err)
testExecutor.AssertExpectations(t)
} | explode_data.jsonl/48133 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 175
} | [
2830,
3393,
7423,
5341,
12206,
1155,
353,
8840,
836,
8,
341,
18185,
25255,
1669,
609,
16712,
3798,
25255,
16094,
197,
322,
4622,
1142,
198,
18185,
25255,
8071,
445,
10257,
3798,
497,
633,
11571,
19139,
368,
1112,
4292,
197,
64906,
52080,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCloudConfigAsString(t *testing.T) {
tests := []struct {
name string
config *CloudConfig
contents string
}{
{
name: "minimum test",
config: &CloudConfig{
Global: GlobalOpts{
ProjectID: "my-project-id",
LocalZone: "my-zone",
NetworkName: "my-cool-network",
SubnetworkName: "my-cool-subnetwork",
TokenURL: "nil",
MultiZone: true,
Regional: true,
NodeTags: []string{"tag1", "tag2"},
},
},
contents: "[global]\n" +
"project-id = \"my-project-id\"\n" +
"local-zone = \"my-zone\"\n" +
"network-name = \"my-cool-network\"\n" +
"subnetwork-name = \"my-cool-subnetwork\"\n" +
"token-url = \"nil\"\n" +
"multizone = true\n" +
"regional = true\n" +
"node-tags = \"tag1\"\n" +
"node-tags = \"tag2\"\n",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
s, err := test.config.AsString()
if err != nil {
t.Fatalf("failed to convert to string: %v", err)
}
if s != test.contents {
t.Fatalf("output is not as expected")
}
})
}
} | explode_data.jsonl/13927 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 555
} | [
2830,
3393,
16055,
2648,
26582,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
25873,
256,
353,
16055,
2648,
198,
197,
197,
17610,
914,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAsyncBindingOperationsNotAllowedError(t *testing.T) {
err := AsyncBindingOperationsNotAllowedError{
reason: "test reason",
}
expectedOutput := "Asynchronous binding operations are not allowed: test reason"
if e, a := expectedOutput, err.Error(); e != a {
t.Fatalf("expected %v, got %v", e, a)
}
} | explode_data.jsonl/53563 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 106
} | [
2830,
3393,
6525,
15059,
35120,
97634,
1454,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
21433,
15059,
35120,
97634,
1454,
515,
197,
17200,
1497,
25,
330,
1944,
2874,
756,
197,
630,
42400,
5097,
1669,
330,
2121,
27834,
10970,
7525,
525,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestValidStorageURIPrefixOK(t *testing.T) {
g := gomega.NewGomegaWithT(t)
for _, prefix := range SupportedStorageURIPrefixList {
isvc := makeTestInferenceService()
isvc.Spec.Default.Predictor.Tensorflow.StorageURI = prefix + "foo/bar"
g.Expect(isvc.validate(c)).Should(gomega.Succeed())
}
} | explode_data.jsonl/1479 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 121
} | [
2830,
3393,
4088,
5793,
1511,
3298,
5060,
3925,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
342,
32696,
7121,
38,
32696,
2354,
51,
1155,
340,
2023,
8358,
9252,
1669,
2088,
48980,
5793,
1511,
3298,
5060,
852,
341,
197,
19907,
7362,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestFiles_SetVideoPosition(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/v2/files/1/start-from", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "Content-Type", "application/x-www-form-urlencoded")
fmt.Fprintln(w, `{"statutus":"OK"}`)
})
ctx := context.Background()
err := client.Files.SetVideoPosition(ctx, 1, 10)
if err != nil {
t.Error(err)
}
// negative id
err = client.Files.SetVideoPosition(ctx, -1, 10)
if err == nil {
t.Errorf("negative file id accepted")
}
// negative time
err = client.Files.SetVideoPosition(ctx, 1, -1)
if err == nil {
t.Errorf("negative time accepted")
}
} | explode_data.jsonl/48322 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 268
} | [
2830,
3393,
10809,
14812,
10724,
3812,
1155,
353,
8840,
836,
8,
341,
84571,
741,
16867,
49304,
2822,
2109,
2200,
63623,
4283,
85,
17,
33220,
14,
16,
69976,
38051,
497,
2915,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestJobSpecsController_Show_NotFound(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplication()
defer cleanup()
client := app.NewHTTPClient()
resp, cleanup := client.Get("/v2/specs/" + "garbage")
defer cleanup()
assert.Equal(t, 404, resp.StatusCode, "Response should be not found")
} | explode_data.jsonl/53694 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 107
} | [
2830,
3393,
12245,
8327,
82,
2051,
79665,
60816,
6650,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
28236,
11,
21290,
1669,
1185,
1944,
7121,
4988,
741,
16867,
21290,
741,
25291,
1669,
906,
7121,
9230,
2959,
2822,
34653,
11,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIPowOverflow(t *testing.T) {
const SCRIPT = `
Math.pow(65536, 6)
`
testScript1(SCRIPT, floatToValue(7.922816251426434e+28), t)
} | explode_data.jsonl/10465 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 66
} | [
2830,
3393,
3298,
363,
42124,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
197,
8815,
25290,
7,
21,
20,
20,
18,
21,
11,
220,
21,
340,
197,
19324,
18185,
5910,
16,
7,
24787,
11,
2224,
1249,
1130,
7,
22,
13,
24,
17,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestStxoSerialization(t *testing.T) {
t.Parallel()
tests := []struct {
name string
stxo SpentTxOut
serialized []byte
}{
// From block 170 in main blockchain.
{
name: "Spends last output of coinbase",
stxo: SpentTxOut{
Amount: 5000000000,
PkScript: hexToBytes("410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac"),
IsCoinBase: true,
Height: 9,
},
serialized: hexToBytes("1300320511db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5c"),
},
// Adapted from block 100025 in main blockchain.
{
name: "Spends last output of non coinbase",
stxo: SpentTxOut{
Amount: 13761000000,
PkScript: hexToBytes("76a914b2fb57eadf61e106a100a7445a8c3f67898841ec88ac"),
IsCoinBase: false,
Height: 100024,
},
serialized: hexToBytes("8b99700086c64700b2fb57eadf61e106a100a7445a8c3f67898841ec"),
},
// Adapted from block 100025 in main blockchain.
{
name: "Does not spend last output, legacy format",
stxo: SpentTxOut{
Amount: 34405000000,
PkScript: hexToBytes("76a9146edbc6c4d31bae9f1ccc38538a114bf42de65e8688ac"),
},
serialized: hexToBytes("0091f20f006edbc6c4d31bae9f1ccc38538a114bf42de65e86"),
},
}
for _, test := range tests {
// Ensure the function to calculate the serialized size without actually serializing it is calculated properly.
gotSize := spentTxOutSerializeSize(&test.stxo)
if gotSize != len(test.serialized) {
t.Errorf("SpentTxOutSerializeSize (%s): did not get "+
"expected size - got %d, want %d", test.name,
gotSize, len(test.serialized))
continue
}
// Ensure the stxo serializes to the expected value.
gotSerialized := make([]byte, gotSize)
gotBytesWritten := putSpentTxOut(gotSerialized, &test.stxo)
if !bytes.Equal(gotSerialized, test.serialized) {
t.Errorf("putSpentTxOut (%s): did not get expected "+
"bytes - got %x, want %x", test.name,
gotSerialized, test.serialized)
continue
}
if gotBytesWritten != len(test.serialized) {
t.Errorf("putSpentTxOut (%s): did not get expected "+
"number of bytes written - got %d, want %d",
test.name, gotBytesWritten,
len(test.serialized))
continue
}
// Ensure the serialized bytes are decoded back to the expected stxo.
var gotStxo SpentTxOut
gotBytesRead, err := decodeSpentTxOut(test.serialized, &gotStxo)
if err != nil {
t.Errorf("decodeSpentTxOut (%s): unexpected error: %v",
test.name, err)
continue
}
if !reflect.DeepEqual(gotStxo, test.stxo) {
t.Errorf("decodeSpentTxOut (%s) mismatched entries - "+
"got %v, want %v", test.name, gotStxo, test.stxo)
continue
}
if gotBytesRead != len(test.serialized) {
t.Errorf("decodeSpentTxOut (%s): did not get expected "+
"number of bytes read - got %d, want %d",
test.name, gotBytesRead, len(test.serialized))
continue
}
}
} | explode_data.jsonl/59826 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1305
} | [
2830,
3393,
623,
40822,
35865,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
78216,
1669,
3056,
1235,
341,
197,
11609,
981,
914,
198,
197,
18388,
40822,
981,
3089,
306,
31584,
2662,
198,
197,
197,
75277,
3056,
3782,
198,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestGetAllClones(t *testing.T) {
testcases := []struct {
name string
bugs []Bug
bugToBeSearched Bug
expectedClones sets.Int
}{
{
name: "Clones for the root node",
bugs: []Bug{
{Summary: "", ID: 1, Blocks: []int{2, 5}},
{Summary: "", ID: 2, DependsOn: []int{1}, Blocks: []int{3}},
{Summary: "", ID: 3, DependsOn: []int{2}},
{Summary: "Not a clone", ID: 4, DependsOn: []int{1}},
{Summary: "", ID: 5, DependsOn: []int{1}},
},
bugToBeSearched: Bug{Summary: "", ID: 1, Blocks: []int{2, 5}},
expectedClones: sets.NewInt(1, 2, 3, 5),
},
{
name: "Clones for child of root",
bugs: []Bug{
{Summary: "", ID: 1, Blocks: []int{2, 5}},
{Summary: "", ID: 2, DependsOn: []int{1}, Blocks: []int{3}},
{Summary: "", ID: 3, DependsOn: []int{2}},
{Summary: "Not a clone", ID: 4, DependsOn: []int{1}},
{Summary: "", ID: 5, DependsOn: []int{1}},
},
bugToBeSearched: Bug{Summary: "", ID: 2, DependsOn: []int{1}, Blocks: []int{3}},
expectedClones: sets.NewInt(1, 2, 3, 5),
},
{
name: "Clones for grandchild of root",
bugs: []Bug{
{Summary: "", ID: 1, Blocks: []int{2, 5}},
{Summary: "", ID: 2, DependsOn: []int{1}, Blocks: []int{3}},
{Summary: "", ID: 3, DependsOn: []int{2}},
{Summary: "Not a clone", ID: 4, DependsOn: []int{1}},
{Summary: "", ID: 5, DependsOn: []int{1}},
},
bugToBeSearched: Bug{Summary: "", ID: 3, DependsOn: []int{2}},
expectedClones: sets.NewInt(1, 2, 3, 5),
},
{
name: "Clones when no clone is expected",
bugs: []Bug{
{Summary: "", ID: 1, Blocks: []int{2, 5}},
{Summary: "", ID: 2, DependsOn: []int{1}, Blocks: []int{3}},
{Summary: "", ID: 3, DependsOn: []int{2}},
{Summary: "Not a clone", ID: 4, DependsOn: []int{1}},
{Summary: "", ID: 5, DependsOn: []int{1}},
},
bugToBeSearched: Bug{Summary: "Not a clone", ID: 4, DependsOn: []int{1}},
expectedClones: sets.NewInt(4),
},
}
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
fake := &Fake{
Bugs: map[int]Bug{},
BugComments: map[int][]Comment{},
}
for _, bug := range tc.bugs {
fake.Bugs[bug.ID] = bug
}
bugCache := newBugDetailsCache()
clones, err := getAllClones(fake, &tc.bugToBeSearched, bugCache)
if err != nil {
t.Errorf("Error occurred when none was expected: %v", err)
}
actualCloneSet := sets.NewInt()
for _, clone := range clones {
actualCloneSet.Insert(clone.ID)
}
if !tc.expectedClones.Equal(actualCloneSet) {
t.Errorf("clones mismatch - expected %v, got %v", tc.expectedClones, actualCloneSet)
}
})
}
} | explode_data.jsonl/24638 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1274
} | [
2830,
3393,
1949,
2403,
5066,
3154,
1155,
353,
8840,
836,
8,
1476,
18185,
23910,
1669,
3056,
1235,
341,
197,
11609,
310,
914,
198,
197,
2233,
13299,
310,
3056,
46773,
198,
197,
2233,
768,
1249,
3430,
50,
682,
2397,
30501,
198,
197,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInterpreterParentheses(t *testing.T) {
s, err := parseFile("src/parse/asp/test_data/interpreter/parentheses.build")
require.NoError(t, err)
assert.EqualValues(t, 1, s.Lookup("x"))
} | explode_data.jsonl/81062 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 75
} | [
2830,
3393,
58426,
83997,
38322,
1155,
353,
8840,
836,
8,
341,
1903,
11,
1848,
1669,
4715,
1703,
445,
3548,
14,
6400,
14,
13367,
12697,
1769,
14,
90554,
14,
41064,
38322,
13239,
1138,
17957,
35699,
1155,
11,
1848,
340,
6948,
12808,
6227... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestReadWithManifest(t *testing.T) {
files := [][2]string{
{"/.manifest", `{"revision": "quickbrownfaux"}`},
}
buf := archive.MustWriteTarGz(files)
bundle, err := NewReader(buf).Read()
if err != nil {
t.Fatal(err)
}
if bundle.Manifest.Revision != "quickbrownfaux" {
t.Fatalf("Unexpected manifest.revision value: %v", bundle.Manifest.Revision)
}
} | explode_data.jsonl/55366 | {
"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,
4418,
2354,
38495,
1155,
353,
8840,
836,
8,
341,
74075,
1669,
508,
1457,
17,
30953,
515,
197,
197,
90,
3115,
13,
42315,
497,
1565,
4913,
28342,
788,
330,
27763,
64461,
3632,
2200,
1,
5541,
1583,
197,
532,
26398,
1669,
1813... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewClient(t *testing.T) {
assert := assert.New(t)
url, err := url.Parse("test_url")
if err != nil {
t.Fatal(err)
}
t.Run("blank", func(t *testing.T) {
client := newClient(&config.AgentConfig{}, false)
transport := client.Transport.(*http.Transport)
assert.False(transport.TLSClientConfig.InsecureSkipVerify)
assert.Nil(transport.Proxy)
})
t.Run("no_proxy", func(t *testing.T) {
client := newClient(&config.AgentConfig{
SkipSSLValidation: true,
ProxyURL: url,
}, true)
transport := client.Transport.(*http.Transport)
assert.True(transport.TLSClientConfig.InsecureSkipVerify)
assert.Nil(transport.Proxy)
})
t.Run("proxy", func(t *testing.T) {
client := newClient(&config.AgentConfig{ProxyURL: url}, false)
transport := client.Transport.(*http.Transport)
goturl, _ := transport.Proxy(nil)
assert.False(transport.TLSClientConfig.InsecureSkipVerify)
assert.Equal("test_url", goturl.String())
})
} | explode_data.jsonl/1531 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 376
} | [
2830,
3393,
3564,
2959,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
19320,
11,
1848,
1669,
2515,
8937,
445,
1944,
2903,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
630,
3244,
16708,
445,
101... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNewDoFnSdf(t *testing.T) {
t.Run("valid", func(t *testing.T) {
tests := []struct {
dfn interface{}
main mainInputs
}{
{dfn: &GoodSdf{}, main: MainSingle},
{dfn: &GoodSdfKv{}, main: MainKv},
}
for _, test := range tests {
t.Run(reflect.TypeOf(test.dfn).String(), func(t *testing.T) {
// Valid DoFns should pass validation with and without KV info.
if _, err := NewDoFn(test.dfn); err != nil {
t.Fatalf("NewDoFn with SDF failed: %v", err)
}
if _, err := NewDoFn(test.dfn, NumMainInputs(test.main)); err != nil {
t.Fatalf("NewDoFn(NumMainInputs(%v)) with SDF failed: %v", test.main, err)
}
})
}
})
t.Run("invalid", func(t *testing.T) {
tests := []struct {
dfn interface{}
}{
// Validate missing SDF methods cause errors.
{dfn: &BadSdfMissingMethods{}},
// Validate param numbers.
{dfn: &BadSdfParamsCreateRest{}},
{dfn: &BadSdfParamsSplitRest{}},
{dfn: &BadSdfParamsRestSize{}},
{dfn: &BadSdfParamsCreateTracker{}},
// Validate return numbers.
{dfn: &BadSdfReturnsCreateRest{}},
{dfn: &BadSdfReturnsSplitRest{}},
{dfn: &BadSdfReturnsRestSize{}},
{dfn: &BadSdfReturnsCreateTracker{}},
// Validate element types consistent with ProcessElement.
{dfn: &BadSdfElementTCreateRest{}},
{dfn: &BadSdfElementTSplitRest{}},
{dfn: &BadSdfElementTRestSize{}},
// Validate restriction type consistent with CreateRestriction.
{dfn: &BadSdfRestTSplitRestParam{}},
{dfn: &BadSdfRestTSplitRestReturn{}},
{dfn: &BadSdfRestTRestSize{}},
{dfn: &BadSdfRestTCreateTracker{}},
// Validate other types
{dfn: &BadSdfRestSizeReturn{}},
{dfn: &BadSdfCreateTrackerReturn{}},
{dfn: &BadSdfMismatchedRTracker{}},
{dfn: &BadSdfMissingRTracker{}},
}
for _, test := range tests {
t.Run(reflect.TypeOf(test.dfn).String(), func(t *testing.T) {
if cfn, err := NewDoFn(test.dfn); err != nil {
t.Logf("NewDoFn with SDF failed as expected:\n%v", err)
} else {
t.Errorf("NewDoFn(%v) = %v, want failure", cfn.Name(), cfn)
}
// If validation fails with unknown main inputs, then it should
// always fail for any known number of main inputs, so test them
// all. Error messages won't necessarily match.
if cfn, err := NewDoFn(test.dfn, NumMainInputs(MainSingle)); err != nil {
t.Logf("NewDoFn(NumMainInputs(MainSingle)) with SDF failed as expected:\n%v", err)
} else {
t.Errorf("NewDoFn(%v, NumMainInputs(MainSingle)) = %v, want failure", cfn.Name(), cfn)
}
if cfn, err := NewDoFn(test.dfn, NumMainInputs(MainKv)); err != nil {
t.Logf("NewDoFn(NumMainInputs(MainKv)) with SDF failed as expected:\n%v", err)
} else {
t.Errorf("NewDoFn(%v, NumMainInputs(MainKv)) = %v, want failure", cfn.Name(), cfn)
}
})
}
})
} | explode_data.jsonl/11523 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1267
} | [
2830,
3393,
3564,
5404,
24911,
50,
2940,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
1891,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
78216,
1669,
3056,
1235,
341,
298,
2698,
8822,
220,
3749,
16094,
298,
36641,
1887,
31946,
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 TestPrivacyRules(t *testing.T) {
client := enttest.Open(t, "sqlite3",
"file:ent?mode=memory&cache=shared&_fk=1",
)
defer client.Close()
logf := rule.SetMutationLogFunc(func(string, ...interface{}) {
require.FailNow(t, "hook called on privacy deny")
})
ctx := context.Background()
_, err := client.Team.Create().SetName("ent").Save(ctx)
require.True(t, errors.Is(err, privacy.Deny), "policy requires viewer context")
view := viewer.NewContext(ctx, viewer.AppViewer{
Role: viewer.View,
})
_, err = client.Team.CreateBulk(
client.Team.Create().SetName("ent"),
client.Team.Create().SetName("ent-contrib"),
).Save(view)
require.True(t, errors.Is(err, privacy.Deny), "team policy requires admin user")
rule.SetMutationLogFunc(logf)
admin := viewer.NewContext(ctx, viewer.AppViewer{
Role: viewer.Admin,
})
teams := client.Team.CreateBulk(
client.Team.Create().SetName("ent"),
client.Team.Create().SetName("ent-contrib"),
).SaveX(admin)
_, err = client.User.Create().SetName("a8m").AddTeams(teams[0]).Save(view)
require.True(t, errors.Is(err, privacy.Deny), "user creation requires admin user")
a8m := client.User.Create().SetName("a8m").AddTeams(teams[0], teams[1]).SaveX(admin)
nat := client.User.Create().SetName("nati").AddTeams(teams[1]).SaveX(admin)
_, err = client.Task.Create().SetTitle("task 1").AddTeams(teams[0]).SetOwner(a8m).Save(ctx)
require.True(t, errors.Is(err, privacy.Deny), "task creation requires viewer/owner match")
a8mctx := viewer.NewContext(view, &viewer.UserViewer{User: a8m, Role: viewer.View | viewer.Edit})
client.Task.Create().SetTitle("task 1").AddTeams(teams[0]).SetOwner(a8m).SaveX(a8mctx)
_, err = client.Task.Create().SetTitle("task 2").AddTeams(teams[1]).SetOwner(nat).Save(a8mctx)
require.True(t, errors.Is(err, privacy.Deny), "task creation requires viewer/owner match")
natctx := viewer.NewContext(view, &viewer.UserViewer{User: nat, Role: viewer.View | viewer.Edit})
client.Task.Create().SetTitle("task 2").AddTeams(teams[1]).SetOwner(nat).SaveX(natctx)
tasks := client.Task.Query().AllX(a8mctx)
require.Len(t, tasks, 2, "returned tasks from teams 1, 2")
task2 := client.Task.Query().OnlyX(natctx)
require.Equal(t, "task 2", task2.Title, "returned tasks must be from the same team")
task3 := client.Task.Create().SetTitle("multi-team-task (1, 2)").AddTeams(teams...).SetOwner(a8m).SaveX(a8mctx)
_, err = task3.Update().SetStatus(task.StatusClosed).Save(natctx)
require.True(t, errors.Is(err, privacy.Deny), "viewer 2 is not allowed to change the task status")
// DecisionContext returns a new context from the parent with a decision attached to it.
task3.Update().SetStatus(task.StatusClosed).SaveX(privacy.DecisionContext(natctx, privacy.Allow))
task3.Update().SetStatus(task.StatusClosed).SaveX(a8mctx)
// Update description is allow for other users in the team.
task3.Update().SetDescription("boring description").SaveX(natctx)
task3.Update().SetDescription("boring description").SaveX(a8mctx)
} | explode_data.jsonl/1835 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1088
} | [
2830,
3393,
47832,
26008,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
1197,
1944,
12953,
1155,
11,
330,
37042,
18,
756,
197,
197,
1,
1192,
25,
306,
30,
8516,
28,
17269,
5,
9360,
28,
6100,
85047,
41718,
28,
16,
756,
197,
340,
16867,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAddStaticRouteDoesNotMatchForInvalidPath(t *testing.T) {
r := NewRouter()
r.AddStaticRoute("test", http.MethodGet, "/test", dummyHandler)
req := events.APIGatewayProxyRequest{
Path: "/blah",
HTTPMethod: http.MethodGet,
}
assert.False(t, r.Routes["test"].Match(req), "Expected static route matching to return false")
} | explode_data.jsonl/4486 | {
"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,
2212,
11690,
4899,
21468,
2623,
8331,
2461,
7928,
1820,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
1532,
9523,
741,
7000,
1904,
11690,
4899,
445,
1944,
497,
1758,
20798,
1949,
11,
3521,
1944,
497,
17292,
3050,
692,
24395,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestResourcesCheck(t *testing.T) {
mockOrderer := &mocks.OrdererConfig{}
mockOrdererCaps := &mocks.OrdererCapabilities{}
mockOrderer.CapabilitiesReturns(mockOrdererCaps)
mockChannel := &mocks.ChannelConfig{}
mockChannelCaps := &mocks.ChannelCapabilities{}
mockChannel.CapabilitiesReturns(mockChannelCaps)
mockResources := &mocks.Resources{}
mockResources.PolicyManagerReturns(&policies.ManagerImpl{})
t.Run("GoodResources", func(t *testing.T) {
mockResources.OrdererConfigReturns(mockOrderer, true)
mockResources.ChannelConfigReturns(mockChannel)
err := checkResources(mockResources)
assert.NoError(t, err)
})
t.Run("MissingOrdererConfigPanic", func(t *testing.T) {
mockResources.OrdererConfigReturns(nil, false)
err := checkResources(mockResources)
assert.Error(t, err)
assert.Regexp(t, "config does not contain orderer config", err.Error())
})
t.Run("MissingOrdererCapability", func(t *testing.T) {
mockResources.OrdererConfigReturns(mockOrderer, true)
mockOrdererCaps.SupportedReturns(errors.New("An error"))
err := checkResources(mockResources)
assert.Error(t, err)
assert.Regexp(t, "config requires unsupported orderer capabilities:", err.Error())
// reset
mockOrdererCaps.SupportedReturns(nil)
})
t.Run("MissingChannelCapability", func(t *testing.T) {
mockChannelCaps.SupportedReturns(errors.New("An error"))
err := checkResources(mockResources)
assert.Error(t, err)
assert.Regexp(t, "config requires unsupported channel capabilities:", err.Error())
})
t.Run("MissingOrdererConfigPanic", func(t *testing.T) {
mockResources.OrdererConfigReturns(nil, false)
assert.Panics(t, func() {
checkResourcesOrPanic(mockResources)
})
})
} | explode_data.jsonl/37986 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 602
} | [
2830,
3393,
11277,
3973,
1155,
353,
8840,
836,
8,
341,
77333,
4431,
261,
1669,
609,
16712,
82,
19664,
261,
2648,
16094,
77333,
4431,
261,
60741,
1669,
609,
16712,
82,
19664,
261,
55315,
16094,
77333,
4431,
261,
78963,
8456,
16446,
30389,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_generateJWT(t *testing.T) {
type args struct {
secret string
}
tests := []struct {
name string
args args
wantJwt string
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if gotJwt := generateJWT(tt.args.secret); gotJwt != tt.wantJwt {
t.Errorf("generateJWT() = %v, want %v", gotJwt, tt.wantJwt)
}
})
}
} | explode_data.jsonl/82305 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 185
} | [
2830,
3393,
48851,
55172,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
197,
20474,
914,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
262,
914,
198,
197,
31215,
262,
2827,
198,
197,
50780,
72756,
914,
198,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestChannelQueue(t *testing.T) {
handleChan := make(chan *testData)
handle := func(data ...Data) []Data {
for _, datum := range data {
testDatum := datum.(*testData)
handleChan <- testDatum
}
return nil
}
nilFn := func(_ func()) {}
queue, err := NewChannelQueue(handle,
ChannelQueueConfiguration{
WorkerPoolConfiguration: WorkerPoolConfiguration{
QueueLength: 0,
MaxWorkers: 10,
BlockTimeout: 1 * time.Second,
BoostTimeout: 5 * time.Minute,
BoostWorkers: 5,
},
Workers: 0,
Name: "TestChannelQueue",
}, &testData{})
assert.NoError(t, err)
assert.Equal(t, 5, queue.(*ChannelQueue).WorkerPool.boostWorkers)
go queue.Run(nilFn, nilFn)
test1 := testData{"A", 1}
go queue.Push(&test1)
result1 := <-handleChan
assert.Equal(t, test1.TestString, result1.TestString)
assert.Equal(t, test1.TestInt, result1.TestInt)
err = queue.Push(test1)
assert.Error(t, err)
} | explode_data.jsonl/17391 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 376
} | [
2830,
3393,
9629,
7554,
1155,
353,
8840,
836,
8,
341,
53822,
46019,
1669,
1281,
35190,
353,
1944,
1043,
340,
53822,
1669,
2915,
2592,
2503,
1043,
8,
3056,
1043,
341,
197,
2023,
8358,
41556,
1669,
2088,
821,
341,
298,
18185,
68036,
1669,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestRefreshCount(t *testing.T) { // Issue 2548.
var (
c = &Canvas{}
errCh = make(chan error)
freed uint64 = 0
refresh uint64 = 1000
)
c.Initialize(nil, func() {})
for i := uint64(0); i < refresh; i++ {
c.Refresh(canvas.NewRectangle(color.Gray16{Y: 1}))
}
go func() {
freed = c.FreeDirtyTextures()
if freed == 0 {
errCh <- errors.New("expected to free dirty textures but actually not freed")
return
}
errCh <- nil
}()
err := <-errCh
if err != nil {
t.Fatal(err)
}
if freed != refresh {
t.Fatalf("FreeDirtyTextures left refresh tasks behind in a frame, got %v, want %v", freed, refresh)
}
} | explode_data.jsonl/10256 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 285
} | [
2830,
3393,
14567,
2507,
1155,
353,
8840,
836,
8,
314,
442,
25226,
220,
17,
20,
19,
23,
624,
2405,
2399,
197,
1444,
1060,
284,
609,
18226,
16094,
197,
9859,
1143,
688,
284,
1281,
35190,
1465,
340,
197,
1166,
28516,
256,
2622,
21,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestKEY_Key(t *testing.T) {
tests := []struct {
name string
start *KEY
want string
}{
{
name: "Simple",
start: NewK(),
want: "Some valid key",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
k := tt.start
if got := k.Key(); got == "" {
t.Errorf("KEY.Key() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/20377 | {
"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,
4784,
35253,
1155,
353,
8840,
836,
8,
1476,
78216,
1669,
3056,
1235,
341,
197,
11609,
220,
914,
198,
197,
21375,
353,
4784,
198,
197,
50780,
220,
914,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,
220,
330,
16374,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestViewChannelShouldNotUpdateThreads(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true")
defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS")
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.ThreadAutoFollow = true
*cfg.ServiceSettings.CollapsedThreads = model.COLLAPSED_THREADS_DEFAULT_ON
})
channel := th.BasicChannel
user := th.BasicUser
user2 := th.BasicUser2
appErr := th.App.JoinChannel(th.Context, channel, user.Id)
require.Nil(t, appErr)
appErr = th.App.JoinChannel(th.Context, channel, user2.Id)
require.Nil(t, appErr)
p1, err := th.App.CreatePost(th.Context, &model.Post{UserId: user.Id, ChannelId: channel.Id, Message: "Hi @" + user2.Username}, channel, false, false)
require.Nil(t, err)
_, err2 := th.App.CreatePost(th.Context, &model.Post{RootId: p1.Id, UserId: user.Id, ChannelId: channel.Id, Message: "Hola"}, channel, false, false)
require.Nil(t, err2)
m, e := th.App.GetThreadMembershipsForUser(user2.Id, th.BasicTeam.Id)
require.NoError(t, e)
th.App.ViewChannel(&model.ChannelView{
ChannelId: channel.Id,
PrevChannelId: "",
}, user2.Id, "")
m1, e1 := th.App.GetThreadMembershipsForUser(user2.Id, th.BasicTeam.Id)
require.NoError(t, e1)
require.Equal(t, m[0].LastViewed, m1[0].LastViewed) // opening the channel shouldn't update threads
} | explode_data.jsonl/26446 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 553
} | [
2830,
3393,
851,
9629,
14996,
2623,
4289,
38666,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
568,
3803,
15944,
741,
16867,
270,
836,
682,
4454,
741,
25078,
4202,
3160,
445,
8035,
30827,
32748,
74317,
2537,
20275,
47519,
50,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestImplicitNodesIterate(t *testing.T) {
for _, test := range implicitNodesTests {
it := iterator.NewImplicitNodes(test.beg, test.end, test.new)
for i := 0; i < 2; i++ {
if it.Len() != len(test.want) {
t.Errorf("unexpected iterator length for round %d: got:%d want:%d", i, it.Len(), len(test.want))
}
var got []graph.Node
for it.Next() {
got = append(got, it.Node())
}
if !reflect.DeepEqual(got, test.want) {
t.Errorf("unexpected iterator output for round %d: got:%#v want:%#v", i, got, test.want)
}
it.Reset()
}
}
} | explode_data.jsonl/31424 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 253
} | [
2830,
3393,
59558,
12288,
8537,
349,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
17995,
12288,
18200,
341,
197,
23374,
1669,
15091,
7121,
59558,
12288,
8623,
948,
791,
11,
1273,
5073,
11,
1273,
4618,
340,
197,
2023,
600,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDurationStrToSecondsInt(t *testing.T) {
testCases := map[string]struct {
in string
out *int64
}{
"5s": {in: "5s", out: &[]int64{5}[0]},
"1m30s": {in: "1m30s", out: &[]int64{90}[0]},
"empty": {in: "", out: nil},
"onlynumber": {in: "2", out: nil},
"illegal": {in: "abc", out: nil},
}
for name, test := range testCases {
result, _ := DurationStrToSecondsInt(test.in)
if test.out == nil && result != nil {
t.Errorf("Case '%v' for TestDurationStrToSecondsInt fail, Expected 'nil' , got '%v'", name, *result)
}
if test.out != nil && result == nil {
t.Errorf("Case '%v' for TestDurationStrToSecondsInt fail, Expected '%v' , got 'nil'", name, *test.out)
}
if test.out != nil && result != nil && *test.out != *result {
t.Errorf("Case '%v' for TestDurationStrToSecondsInt fail, Expected '%v' , got '%v'", name, *test.out, *result)
}
}
} | explode_data.jsonl/58964 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 403
} | [
2830,
3393,
12945,
2580,
1249,
15343,
1072,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
2415,
14032,
60,
1235,
341,
197,
17430,
220,
914,
198,
197,
13967,
353,
396,
21,
19,
198,
197,
59403,
197,
197,
1,
20,
82,
788,
260,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRename(t *testing.T) {
s, err := Run()
ok(t, err)
defer s.Close()
c, err := proto.Dial(s.Addr())
ok(t, err)
defer c.Close()
// Non-existing key
mustDo(t, c,
"RENAME", "nosuch", "to",
proto.Error("ERR no such key"),
)
// Same key
mustDo(t, c,
"RENAME", "from", "from",
proto.Error("ERR no such key"),
)
t.Run("string key", func(t *testing.T) {
s.Set("from", "value")
mustOK(t, c, "RENAME", "from", "to")
equals(t, false, s.Exists("from"))
equals(t, true, s.Exists("to"))
s.CheckGet(t, "to", "value")
_, ok := s.dbs[0].ttl["to"]
equals(t, ok, false)
})
t.Run("hash key", func(t *testing.T) {
s.HSet("from", "key", "value")
mustOK(t, c, "RENAME", "from", "to")
equals(t, false, s.Exists("from"))
equals(t, true, s.Exists("to"))
equals(t, "value", s.HGet("to", "key"))
_, ok := s.dbs[0].ttl["to"]
equals(t, ok, false)
})
t.Run("ttl", func(t *testing.T) {
s.Set("TTLfrom", "value")
s.Set("TTLto", "value")
s.SetTTL("TTLto", time.Second*99999)
equals(t, time.Second*99999, s.TTL("TTLto"))
mustOK(t, c, "RENAME", "TTLfrom", "TTLto")
_, ok := s.dbs[0].ttl["TTLto"]
equals(t, ok, false)
})
t.Run("overwrite", func(t *testing.T) {
s.Set("from", "string value")
s.HSet("to", "key", "value")
s.SetTTL("from", time.Second*999999)
mustOK(t, c, "RENAME", "from", "to")
equals(t, false, s.Exists("from"))
equals(t, true, s.Exists("to"))
s.CheckGet(t, "to", "string value")
equals(t, time.Duration(0), s.TTL("from"))
equals(t, time.Second*999999, s.TTL("to"))
})
t.Run("errors", func(t *testing.T) {
mustDo(t, c,
"RENAME",
proto.Error(errWrongNumber("rename")),
)
mustDo(t, c,
"RENAME", "too few",
proto.Error(errWrongNumber("rename")),
)
mustDo(t, c,
"RENAME", "some", "spurious", "arguments",
proto.Error(errWrongNumber("rename")),
)
})
} | explode_data.jsonl/44821 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 933
} | [
2830,
3393,
88757,
1155,
353,
8840,
836,
8,
341,
1903,
11,
1848,
1669,
6452,
741,
59268,
1155,
11,
1848,
340,
16867,
274,
10421,
741,
1444,
11,
1848,
1669,
18433,
98462,
1141,
93626,
2398,
59268,
1155,
11,
1848,
340,
16867,
272,
10421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestV3AuthenticateWithDomainNameAndTenantName(t *testing.T) {
ctx := context.Background()
if !isV3Api() {
return
}
c, rollback := makeConnection(t)
defer rollback()
c.Tenant = os.Getenv("SWIFT_TENANT")
c.Domain = os.Getenv("SWIFT_API_DOMAIN")
c.TenantId = ""
c.DomainId = ""
err := c.Authenticate(ctx)
if err != nil {
t.Fatal("Auth failed", err)
}
if !c.Authenticated() {
t.Fatal("Not authenticated")
}
} | explode_data.jsonl/12655 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 181
} | [
2830,
3393,
53,
18,
99087,
2354,
13636,
675,
3036,
71252,
675,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
743,
753,
285,
53,
18,
6563,
368,
341,
197,
853,
198,
197,
630,
1444,
11,
60414,
1669,
1281,
4526,
1155,
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... | 4 |
func TestDeleteUserGroup(t *testing.T) {
if createdUserGroupID == 0 {
fmt.Println("User group doesn't created, skip to test!")
return
}
type args struct {
id int
}
tests := []struct {
name string
args args
wantErr bool
}{
{"Delete existing user group", args{id: createdUserGroupID}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := DeleteUserGroup(tt.args.id); (err != nil) != tt.wantErr {
t.Errorf("DeleteUserGroup() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
} | explode_data.jsonl/73818 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 229
} | [
2830,
3393,
6435,
1474,
2808,
1155,
353,
8840,
836,
8,
341,
743,
3465,
1474,
2808,
915,
621,
220,
15,
341,
197,
11009,
12419,
445,
1474,
1874,
3171,
944,
3465,
11,
10706,
311,
1273,
22988,
197,
853,
198,
197,
630,
13158,
2827,
2036,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSupervisedPool_ExecTTL_TimedOut(t *testing.T) {
var cfgExecTTL = &Config{
NumWorkers: uint64(1),
AllocateTimeout: time.Second,
DestroyTimeout: time.Second,
Supervisor: &SupervisorConfig{
WatchTick: 1 * time.Second,
TTL: 100 * time.Second,
IdleTTL: 100 * time.Second,
ExecTTL: 1 * time.Second,
MaxWorkerMemory: 100,
},
}
ctx := context.Background()
p, err := Initialize(
ctx,
func() *exec.Cmd { return exec.Command("php", "../tests/sleep.php", "pipes") },
pipe.NewPipeFactory(),
cfgExecTTL,
)
assert.NoError(t, err)
assert.NotNil(t, p)
defer p.Destroy(context.Background())
pid := p.Workers()[0].Pid()
resp, err := p.Exec(&payload.Payload{
Context: []byte(""),
Body: []byte("foo"),
})
assert.Error(t, err)
assert.Empty(t, resp)
time.Sleep(time.Second * 1)
// should be new worker with new pid
assert.NotEqual(t, pid, p.Workers()[0].Pid())
} | explode_data.jsonl/78513 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 422
} | [
2830,
3393,
10048,
77990,
10551,
62,
10216,
51,
13470,
1139,
75485,
2662,
1155,
353,
8840,
836,
8,
341,
2405,
13286,
10216,
51,
13470,
284,
609,
2648,
515,
197,
197,
4651,
74486,
25,
414,
2622,
21,
19,
7,
16,
1326,
197,
197,
75380,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNoOpChanges(t *testing.T) {
f := NewDefaultTestFieldManager(schema.FromAPIVersionAndKind("v1", "Pod"))
obj := &unstructured.Unstructured{Object: map[string]interface{}{}}
if err := yaml.Unmarshal([]byte(`{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"labels": {
"a": "b"
},
"creationTimestamp": null,
}
}`), &obj.Object); err != nil {
t.Fatalf("error decoding YAML: %v", err)
}
if err := f.Apply(obj, "fieldmanager_test_apply", false); err != nil {
t.Fatalf("failed to apply object: %v", err)
}
before := f.liveObj.DeepCopyObject()
// Wait to make sure the timestamp is different
time.Sleep(time.Second)
// Applying with a different fieldmanager will create an entry..
if err := f.Apply(obj, "fieldmanager_test_apply_other", false); err != nil {
t.Fatalf("failed to update object: %v", err)
}
if reflect.DeepEqual(before, f.liveObj) {
t.Fatalf("Applying no-op apply with new manager didn't change object: \n%v", f.liveObj)
}
before = f.liveObj.DeepCopyObject()
// Wait to make sure the timestamp is different
time.Sleep(time.Second)
if err := f.Update(obj, "fieldmanager_test_update"); err != nil {
t.Fatalf("failed to update object: %v", err)
}
if !reflect.DeepEqual(before, f.liveObj) {
t.Fatalf("No-op update has changed the object:\n%v\n---\n%v", before, f.liveObj)
}
before = f.liveObj.DeepCopyObject()
// Wait to make sure the timestamp is different
time.Sleep(time.Second)
if err := f.Apply(obj, "fieldmanager_test_apply", true); err != nil {
t.Fatalf("failed to re-apply object: %v", err)
}
if !reflect.DeepEqual(before, f.liveObj) {
t.Fatalf("No-op apply has changed the object:\n%v\n---\n%v", before, f.liveObj)
}
} | explode_data.jsonl/53749 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 652
} | [
2830,
3393,
2753,
7125,
11317,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
1532,
3675,
2271,
1877,
2043,
42735,
11439,
7082,
5637,
3036,
10629,
445,
85,
16,
497,
330,
23527,
28075,
22671,
1669,
609,
359,
51143,
10616,
51143,
90,
1190,
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... | 9 |
func TestTopDownDisjunction(t *testing.T) {
tests := []struct {
note string
rules []string
expected interface{}
}{
{"incr: query set", []string{`p[x] { a[i] = x }`, `p[y] { b[j] = y }`}, `[1,2,3,4,"hello","goodbye"]`},
{"incr: query set constants", []string{
`p[100] { true }`,
`p[x] { a[x] }`},
"[0,1,2,3,100]"},
{"incr: query object", []string{
`p[k] = v { b[v] = k }`,
`p[k] = v { a[i] = v; g[k][j] = v }`},
`{"b": 2, "c": 4, "hello": "v1", "goodbye": "v2", "a": 1}`},
{"incr: query object constant key", []string{
`p["a"] = 1 { true }`,
`p["b"] = 2 { true }`},
`{"a": 1, "b": 2}`},
{"incr: iter set", []string{
`p[x] { q[x] }`,
`q[x] { a[i] = x }`,
`q[y] { b[j] = y }`},
`[1,2,3,4,"hello","goodbye"]`},
{"incr: eval set", []string{
`p[x] { q = s; s[x] }`, // make p a set so that test assertion orders result
`q[x] { a[_] = x }`,
`q[y] { b[_] = y }`},
`[1,2,3,4,"hello","goodbye"]`},
{"incr: eval object", []string{
`p[k] = v { q[k] = v }`,
`q[k] = v { b[v] = k }`,
`q[k] = v { a[i] = v; g[k][j] = v }`},
`{"b": 2, "c": 4, "hello": "v1", "goodbye": "v2", "a": 1}`},
{"incr: eval object constant key", []string{
`p[k] = v { q[k] = v }`,
`q["a"] = 1 { true }`,
`q["b"] = 2 { true }`},
`{"a": 1, "b": 2}`},
{"complete: undefined", []string{`p = true { false }`, `p = true { false }`}, ""},
{"complete: error", []string{`p = true { true }`, `p = false { true }`}, completeDocConflictErr(nil)},
{"complete: valid", []string{`p = true { true }`, `p = true { true }`}, "true"},
{"complete: valid-2", []string{`p = true { true }`, `p = false { false }`}, "true"},
{"complete: reference error", []string{`p = true { q }`, `q = true { true }`, `q = false { true }`}, completeDocConflictErr(nil)},
{"complete: reference valid", []string{`p = true { q }`, `q = true { true }`, `q = true { true }`}, "true"},
}
data := loadSmallTestData()
for _, tc := range tests {
runTopDownTestCase(t, data, tc.note, tc.rules, tc.expected)
}
} | explode_data.jsonl/25204 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 993
} | [
2830,
3393,
5366,
4454,
4839,
72428,
1155,
353,
8840,
836,
8,
1476,
78216,
1669,
3056,
1235,
341,
197,
9038,
1272,
257,
914,
198,
197,
7000,
2425,
262,
3056,
917,
198,
197,
42400,
3749,
16094,
197,
59403,
197,
197,
4913,
98428,
25,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestManageBuyOfferDeleteOffer(t *testing.T) {
kp1 := newKeypair1()
sourceAccount := NewSimpleAccount(kp1.Address(), int64(41137196761105))
buyOffer := ManageBuyOffer{
Selling: NativeAsset{},
Buying: CreditAsset{"ABCD", kp1.Address()},
Amount: "0",
Price: "0.01",
OfferID: int64(2921622),
}
received, err := newSignedTransaction(
TransactionParams{
SourceAccount: &sourceAccount,
IncrementSequenceNum: true,
Operations: []Operation{&buyOffer},
BaseFee: MinBaseFee,
Timebounds: NewInfiniteTimeout(),
},
network.TestNetworkPassphrase,
kp1,
)
assert.NoError(t, err)
expected := "AAAAAgAAAAAlyvHaD8duz+iEXkJUUbsHkklIlH46oMrMMYrt0odkfgAAAGQAACVqAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAADAAAAAAAAAABQUJDRAAAAAAlyvHaD8duz+iEXkJUUbsHkklIlH46oMrMMYrt0odkfgAAAAAAAAAAAAAAAQAAAGQAAAAAACyUlgAAAAAAAAAB0odkfgAAAECLZ6PnKZlGBb8S3GFWg6J01d3Zr88/tki8yka2KFzqivMAmY3D/5IMzzJl4U7RdrYEPam9KwCGKR/f647WTwYG"
assert.Equal(t, expected, received, "Base 64 XDR should match")
} | explode_data.jsonl/20688 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 497
} | [
2830,
3393,
33076,
17482,
39462,
6435,
39462,
1155,
353,
8840,
836,
8,
341,
16463,
79,
16,
1669,
501,
6608,
1082,
1310,
16,
741,
47418,
7365,
1669,
1532,
16374,
7365,
5969,
79,
16,
26979,
1507,
526,
21,
19,
7,
19,
16,
16,
18,
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 TestGetFuturesAccountInfo(t *testing.T) {
t.Parallel()
if !areTestAPIKeysSet() {
t.Skip("skipping test: api keys not set")
}
_, err := b.GetFuturesAccountInfo(context.Background())
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/76629 | {
"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,
1949,
37,
74606,
7365,
1731,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
743,
753,
546,
2271,
7082,
8850,
1649,
368,
341,
197,
3244,
57776,
445,
4886,
5654,
1273,
25,
6330,
6894,
537,
738,
1138,
197,
532,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestFuturesBatchCancelOrders(t *testing.T) {
t.Parallel()
if !areTestAPIKeysSet() || !canManipulateRealOrders {
t.Skip("skipping test: api keys not set or canManipulateRealOrders set to false")
}
_, err := b.FuturesBatchCancelOrders(context.Background(), currency.NewPairWithDelimiter("BTCUSD", "PERP", "_"), []string{"123"}, []string{})
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/76620 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 147
} | [
2830,
3393,
37,
74606,
21074,
9269,
24898,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
743,
753,
546,
2271,
7082,
8850,
1649,
368,
1369,
753,
4814,
92876,
6334,
12768,
24898,
341,
197,
3244,
57776,
445,
4886,
5654,
1273,
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... | 4 |
func TestComment(t *testing.T) {
env, exec, stateDB, kvdb := InitEnv()
propID := "11111111111111"
Repcmt := "2222222222"
comment := "3333333333"
opt1 := &auty.Comment{
ProposalID: propID,
RepHash: Repcmt,
Comment: comment,
}
pbtx, err := commentPropTx(opt1)
assert.NoError(t, err)
pbtx, err = signTx(pbtx, PrivKeyA)
assert.NoError(t, err)
exec.SetEnv(env.blockHeight, env.blockTime, env.difficulty)
receipt, err := exec.Exec(pbtx, int(1))
assert.NoError(t, err)
assert.NotNil(t, receipt)
for _, kv := range receipt.KV {
stateDB.Set(kv.Key, kv.Value)
}
receiptData := &types.ReceiptData{Ty: receipt.Ty, Logs: receipt.Logs}
set, err := exec.ExecLocal(pbtx, receiptData, int(1))
assert.NoError(t, err)
assert.NotNil(t, set)
for _, kv := range set.KV {
kvdb.Set(kv.Key, kv.Value)
}
// check
value, err := kvdb.Get(calcCommentHeight(propID, drivers.HeightIndexStr(env.blockHeight, 1)))
assert.NoError(t, err)
cmt := &auty.RelationCmt{}
err = types.Decode(value, cmt)
assert.NoError(t, err)
assert.Equal(t, cmt.Comment, comment)
assert.Equal(t, cmt.RepHash, Repcmt)
} | explode_data.jsonl/34713 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 495
} | [
2830,
3393,
10677,
1155,
353,
8840,
836,
8,
341,
57538,
11,
3883,
11,
1584,
3506,
11,
16178,
1999,
1669,
15690,
14359,
2822,
79244,
915,
1669,
330,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
698,
197,
693,
3992,
250... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLoadConfig(t *testing.T) {
// Parse a valid file that sets a global scrape timeout. This tests whether parsing
// an overwritten default field in the global config permanently changes the default.
_, err := LoadFile("testdata/global_timeout.good.yml")
require.NoError(t, err)
c, err := LoadFile("testdata/conf.good.yml")
require.NoError(t, err)
require.Equal(t, expectedConf, c)
} | explode_data.jsonl/81272 | {
"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,
5879,
2648,
1155,
353,
8840,
836,
8,
341,
197,
322,
14775,
264,
2697,
1034,
429,
7289,
264,
3644,
57128,
9632,
13,
1096,
7032,
3425,
22314,
198,
197,
322,
458,
59173,
1638,
2070,
304,
279,
3644,
2193,
30759,
4344,
279,
163... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestVersionSetterGetter(t *testing.T) {
logger := defaultLogger()
pruningOpt := baseapp.SetPruning(storetypes.PruneDefault)
db := dbm.NewMemDB()
name := t.Name()
app := baseapp.NewBaseApp(name, logger, db, pruningOpt)
require.Equal(t, "", app.Version())
res := app.Query(abci.RequestQuery{Path: "app/version"})
require.True(t, res.IsOK())
require.Equal(t, "", string(res.Value))
versionString := "1.0.0"
app.SetVersion(versionString)
require.Equal(t, versionString, app.Version())
res = app.Query(abci.RequestQuery{Path: "app/version"})
require.True(t, res.IsOK())
require.Equal(t, versionString, string(res.Value))
} | explode_data.jsonl/30025 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 245
} | [
2830,
3393,
5637,
44294,
31485,
1155,
353,
8840,
836,
8,
341,
17060,
1669,
1638,
7395,
741,
25653,
37202,
21367,
1669,
2331,
676,
4202,
3533,
37202,
31200,
9242,
17947,
2886,
3675,
340,
20939,
1669,
2927,
76,
7121,
18816,
3506,
741,
11609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestImageDestOptionsNewSystemContext(t *testing.T) {
// Default state
opts := fakeImageDestOptions(t, "dest-", []string{}, []string{})
res, err := opts.newSystemContext()
require.NoError(t, err)
assert.Equal(t, &types.SystemContext{
DockerRegistryUserAgent: defaultUserAgent,
}, res)
oldXRD, hasXRD := os.LookupEnv("REGISTRY_AUTH_FILE")
defer func() {
if hasXRD {
os.Setenv("REGISTRY_AUTH_FILE", oldXRD)
} else {
os.Unsetenv("REGISTRY_AUTH_FILE")
}
}()
authFile := "/tmp/auth.json"
// Make sure when REGISTRY_AUTH_FILE is set the auth file is used
os.Setenv("REGISTRY_AUTH_FILE", authFile)
// Explicitly set everything to default, except for when the default is “not present”
opts = fakeImageDestOptions(t, "dest-", []string{}, []string{
"--dest-compress=false",
})
res, err = opts.newSystemContext()
require.NoError(t, err)
assert.Equal(t, &types.SystemContext{
AuthFilePath: authFile,
DockerRegistryUserAgent: defaultUserAgent,
}, res)
// Set everything to non-default values.
opts = fakeImageDestOptions(t, "dest-", []string{
"--registries.d", "/srv/registries.d",
"--override-arch", "overridden-arch",
"--override-os", "overridden-os",
"--override-variant", "overridden-variant",
"--tmpdir", "/srv",
}, []string{
"--authfile", "/srv/authfile",
"--dest-cert-dir", "/srv/cert-dir",
"--dest-shared-blob-dir", "/srv/shared-blob-dir",
"--dest-compress=true",
"--dest-daemon-host", "daemon-host.example.com",
"--dest-tls-verify=false",
"--dest-creds", "creds-user:creds-password",
"--dest-registry-token", "faketoken",
})
res, err = opts.newSystemContext()
require.NoError(t, err)
assert.Equal(t, &types.SystemContext{
RegistriesDirPath: "/srv/registries.d",
AuthFilePath: "/srv/authfile",
ArchitectureChoice: "overridden-arch",
OSChoice: "overridden-os",
VariantChoice: "overridden-variant",
OCISharedBlobDirPath: "/srv/shared-blob-dir",
DockerCertPath: "/srv/cert-dir",
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
DockerAuthConfig: &types.DockerAuthConfig{Username: "creds-user", Password: "creds-password"},
DockerBearerRegistryToken: "faketoken",
DockerDaemonCertPath: "/srv/cert-dir",
DockerDaemonHost: "daemon-host.example.com",
DockerDaemonInsecureSkipTLSVerify: true,
DockerRegistryUserAgent: defaultUserAgent,
DirForceCompress: true,
BigFilesTemporaryDir: "/srv",
}, res)
// Invalid option values in imageOptions
opts = fakeImageDestOptions(t, "dest-", []string{}, []string{"--dest-creds", ""})
_, err = opts.newSystemContext()
assert.Error(t, err)
} | explode_data.jsonl/81903 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1273
} | [
2830,
3393,
1906,
34830,
3798,
3564,
2320,
1972,
1155,
353,
8840,
836,
8,
341,
197,
322,
7899,
1584,
198,
64734,
1669,
12418,
1906,
34830,
3798,
1155,
11,
330,
4979,
73918,
3056,
917,
22655,
3056,
917,
37790,
10202,
11,
1848,
1669,
1218... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_GetPostIDFromText(t *testing.T) {
testcases := map[string]struct{
message *data.TMessage
expected int
}{
"link-in-text": {&data.TMessage{Text: sptr("https://" + api.Endpoint + "/posts/1000")}, 1000},
"link-in-caption": {&data.TMessage{Caption: sptr("https://" + api.FilteredEndpoint + "/posts/1000")}, 1000},
"link-in-url-entity": {&data.TMessage{Text: sptr("hi"), Entities: &[]data.TMessageEntity{data.TMessageEntity{Url: sptr("https://" + api.Endpoint + "/posts/1000")}}}, 1000},
"second-link-in-url-entity": {&data.TMessage{Text: sptr("hi"), Entities: &[]data.TMessageEntity{data.TMessageEntity{Url: sptr("https://" + api.Endpoint + "/posts/1000")}, data.TMessageEntity{Url: sptr("https://" + api.Endpoint + "/posts/2000")}}}, 1000},
"md5-in-text": {&data.TMessage{Text: sptr("md5:0000000000000000000000001F2A0000")}, 1},
"md5-in-caption": {&data.TMessage{Caption: sptr("md5:0000000000000000000000001F2A0000")}, 1},
"md5-in-url-entity": {&data.TMessage{Text: sptr("hi"), Entities: &[]data.TMessageEntity{data.TMessageEntity{Url: sptr("md5:0000000000000000000000001F2A0000")}}}, 1},
"second-md5-in-url-entity": {&data.TMessage{Text: sptr("hi"), Entities: &[]data.TMessageEntity{data.TMessageEntity{Url: sptr("md5:FFFF000000000000000000001F2A0000")}, data.TMessageEntity{Url: sptr("md5:0000000000000000000000001F2A0000")}}}, NONEXISTENT_POST},
"post-id-in-text": {&data.TMessage{Text: sptr("2000")}, 2000},
"post-id-in-caption": {&data.TMessage{Caption: sptr("2000")}, 2000},
"post-id-in-url-entity": {&data.TMessage{Text: sptr("hi"), Entities: &[]data.TMessageEntity{data.TMessageEntity{Url: sptr("1234")}}}, NONEXISTENT_POST},
}
for k, v := range testcases {
t.Run(k, func(t *testing.T) {
out := GetPostIDFromMessage(v.message)
if out != v.expected { t.Errorf("Unexpected result: got %d, expected %d", out, v.expected) }
})
}
} | explode_data.jsonl/42358 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 756
} | [
2830,
3393,
13614,
4133,
915,
3830,
1178,
1155,
353,
8840,
836,
8,
341,
18185,
23910,
1669,
2415,
14032,
60,
1235,
515,
197,
24753,
353,
691,
836,
2052,
198,
197,
42400,
526,
198,
197,
59403,
197,
197,
1,
2080,
3419,
9345,
788,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestServiceCreateScale(t *testing.T) {
action, created, _, err := fakeServiceCreate([]string{
"service", "create", "foo", "--image", "gcr.io/foo/bar:baz",
"--scale", "5", "--no-wait"}, false)
if err != nil {
t.Fatal(err)
} else if !action.Matches("create", "services") {
t.Fatalf("Bad action %v", action)
}
template := &created.Spec.Template
actualAnnos := template.Annotations
expectedAnnos := []string{
"autoscaling.knative.dev/minScale", "5",
"autoscaling.knative.dev/maxScale", "5",
}
for i := 0; i < len(expectedAnnos); i += 2 {
anno := expectedAnnos[i]
if actualAnnos[anno] != expectedAnnos[i+1] {
t.Fatalf("Unexpected annotation value for %s : %s (actual) != %s (expected)",
anno, actualAnnos[anno], expectedAnnos[i+1])
}
}
} | explode_data.jsonl/42450 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 311
} | [
2830,
3393,
1860,
4021,
6947,
1155,
353,
8840,
836,
8,
341,
38933,
11,
3465,
11,
8358,
1848,
1669,
12418,
1860,
4021,
10556,
917,
515,
197,
197,
1,
7936,
497,
330,
3182,
497,
330,
7975,
497,
14482,
1805,
497,
330,
70,
5082,
4245,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReturn(t *testing.T) {
gopClTest(t, `
func foo(format string, args ...interface{}) (int, error) {
return printf(format, args...)
}
func main() {
}
`, `package main
import fmt "fmt"
func foo(format string, args ...interface {
}) (int, error) {
return fmt.Printf(format, args...)
}
func main() {
}
`)
} | explode_data.jsonl/73679 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 117
} | [
2830,
3393,
5598,
1155,
353,
8840,
836,
8,
341,
3174,
453,
5066,
2271,
1155,
11,
22074,
2830,
15229,
20698,
914,
11,
2827,
2503,
4970,
28875,
320,
396,
11,
1465,
8,
341,
853,
4100,
20698,
11,
2827,
31218,
630,
2830,
1887,
368,
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 |
func TestTrim(t *testing.T) {
for i, this := range []struct {
v1 interface{}
v2 string
expect interface{}
}{
{"1234 my way 13", "123 ", "4 my way"},
{" my way ", " ", "my way"},
{1234, "14", "23"},
{tstNoStringer{}, " ", false},
} {
result, err := trim(this.v1, this.v2)
if b, ok := this.expect.(bool); ok && !b {
if err == nil {
t.Errorf("[%d] trim didn't return an expected error", i)
}
} else {
if err != nil {
t.Errorf("[%d] failed: %s", i, err)
continue
}
if !reflect.DeepEqual(result, this.expect) {
t.Errorf("[%d] got '%s' but expected %s", i, result, this.expect)
}
}
}
} | explode_data.jsonl/9244 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 318
} | [
2830,
3393,
25656,
1155,
353,
8840,
836,
8,
1476,
2023,
600,
11,
419,
1669,
2088,
3056,
1235,
341,
197,
5195,
16,
257,
3749,
16094,
197,
5195,
17,
257,
914,
198,
197,
24952,
3749,
16094,
197,
59403,
197,
197,
4913,
16,
17,
18,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestAzurermCompute_SSHPublicKey(t *testing.T) {
dummyError := errors.New("this is an error")
tests := []struct {
test string
dirName string
mocks func(*repository.MockComputeRepository, *mocks.AlerterInterface)
wantErr error
}{
{
test: "no public key",
dirName: "azurerm_ssh_public_key_empty",
mocks: func(repository *repository.MockComputeRepository, alerter *mocks.AlerterInterface) {
repository.On("ListAllSSHPublicKeys").Return([]*armcompute.SSHPublicKeyResource{}, nil)
},
},
{
test: "error listing public keys",
dirName: "azurerm_ssh_public_key_empty",
mocks: func(repository *repository.MockComputeRepository, alerter *mocks.AlerterInterface) {
repository.On("ListAllSSHPublicKeys").Return(nil, dummyError)
},
wantErr: remoteerr.NewResourceListingError(dummyError, resourceazure.AzureSSHPublicKeyResourceType),
},
{
test: "multiple public keys",
dirName: "azurerm_ssh_public_key_multiple",
mocks: func(repository *repository.MockComputeRepository, alerter *mocks.AlerterInterface) {
repository.On("ListAllSSHPublicKeys").Return([]*armcompute.SSHPublicKeyResource{
{
Resource: armcompute.Resource{
ID: to.StringPtr("/subscriptions/7bfb2c5c-7308-46ed-8ae4-fffa356eb406/resourceGroups/TESTRESGROUP/providers/Microsoft.Compute/sshPublicKeys/example-key"),
Name: to.StringPtr("example-key"),
},
},
{
Resource: armcompute.Resource{
ID: to.StringPtr("/subscriptions/7bfb2c5c-7308-46ed-8ae4-fffa356eb406/resourceGroups/TESTRESGROUP/providers/Microsoft.Compute/sshPublicKeys/example-key2"),
Name: to.StringPtr("example-key2"),
},
},
}, nil)
},
},
}
providerVersion := "2.71.0"
schemaRepository := testresource.InitFakeSchemaRepository("azurerm", providerVersion)
resourceazure.InitResourcesMetadata(schemaRepository)
factory := terraform.NewTerraformResourceFactory(schemaRepository)
deserializer := resource.NewDeserializer(factory)
for _, c := range tests {
t.Run(c.test, func(tt *testing.T) {
shouldUpdate := c.dirName == *goldenfile.Update
scanOptions := ScannerOptions{Deep: true}
providerLibrary := terraform.NewProviderLibrary()
remoteLibrary := common.NewRemoteLibrary()
// Initialize mocks
alerter := &mocks.AlerterInterface{}
fakeRepo := &repository.MockComputeRepository{}
c.mocks(fakeRepo, alerter)
var repo repository.ComputeRepository = fakeRepo
providerVersion := "2.71.0"
realProvider, err := terraform2.InitTestAzureProvider(providerLibrary, providerVersion)
if err != nil {
t.Fatal(err)
}
provider := terraform2.NewFakeTerraformProvider(realProvider)
provider.WithResponse(c.dirName)
// Replace mock by real resources if we are in update mode
if shouldUpdate {
err := realProvider.Init()
if err != nil {
t.Fatal(err)
}
provider.ShouldUpdate()
cred, err := azidentity.NewDefaultAzureCredential(&azidentity.DefaultAzureCredentialOptions{})
if err != nil {
t.Fatal(err)
}
con := arm.NewDefaultConnection(cred, nil)
repo = repository.NewComputeRepository(con, realProvider.GetConfig(), cache.New(0))
}
remoteLibrary.AddEnumerator(azurerm.NewAzurermSSHPublicKeyEnumerator(repo, factory))
remoteLibrary.AddDetailsFetcher(resourceazure.AzureSSHPublicKeyResourceType, common.NewGenericDetailsFetcher(resourceazure.AzureSSHPublicKeyResourceType, provider, deserializer))
testFilter := &filter.MockFilter{}
testFilter.On("IsTypeIgnored", mock.Anything).Return(false)
s := NewScanner(remoteLibrary, alerter, scanOptions, testFilter)
got, err := s.Resources()
assert.Equal(tt, c.wantErr, err)
if err != nil {
return
}
test.TestAgainstGoldenFile(got, resourceazure.AzureSSHPublicKeyResourceType, c.dirName, provider, deserializer, shouldUpdate, tt)
alerter.AssertExpectations(tt)
fakeRepo.AssertExpectations(tt)
})
}
} | explode_data.jsonl/43882 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1584
} | [
2830,
3393,
37199,
324,
4195,
46254,
57207,
6610,
475,
1592,
1155,
353,
8840,
836,
8,
1476,
2698,
8574,
1454,
1669,
5975,
7121,
445,
574,
374,
458,
1465,
5130,
78216,
1669,
3056,
1235,
341,
197,
18185,
262,
914,
198,
197,
48532,
675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPromiseAll(t *testing.T) {
const SCRIPT = `
var p1 = new Promise(function() {});
var p2 = new Promise(function() {});
var p3 = new Promise(function() {});
var callCount = 0;
var currentThis = p1;
var nextThis = p2;
var afterNextThis = p3;
p1.then = p2.then = p3.then = function(a, b) {
assert.sameValue(typeof a, 'function', 'type of first argument');
assert.sameValue(
a.length,
1,
'ES6 25.4.1.3.2: The length property of a promise resolve function is 1.'
);
assert.sameValue(typeof b, 'function', 'type of second argument');
assert.sameValue(
b.length,
1,
'ES6 25.4.1.3.1: The length property of a promise reject function is 1.'
);
assert.sameValue(arguments.length, 2, '"then"" invoked with two arguments');
assert.sameValue(this, currentThis, '"this" value');
currentThis = nextThis;
nextThis = afterNextThis;
afterNextThis = null;
callCount += 1;
};
Promise.all([p1, p2, p3]);
assert.sameValue(callCount, 3, '"then"" invoked once for every iterated value');
`
testScript1(TESTLIB+SCRIPT, _undefined, t)
} | explode_data.jsonl/10537 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 395
} | [
2830,
3393,
21041,
2403,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
947,
281,
16,
284,
501,
7303,
2920,
368,
35311,
947,
281,
17,
284,
501,
7303,
2920,
368,
35311,
947,
281,
18,
284,
501,
7303,
2920,
368,
35311,
947,
161... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.