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 TestHostNetwork(t *testing.T) {
volSize := resource.NewQuantity(100000.0, resource.BinarySI)
c := New(&clusterd.Context{Clientset: testop.New(1)}, "ns", "myversion", "", "", *volSize, rookalpha.Annotations{}, rookalpha.Placement{},
edgefsv1beta1.NetworkSpec{ServerIfName: "eth0"}, edgefsv1beta1.DashboardSpec{}, v1.ResourceRequirements{},
"", metav1.OwnerReference{}, false)
d := c.makeDeployment("mgr-a", "a", "edgefs", 1)
assert.NotNil(t, d)
assert.Equal(t, true, d.Spec.Template.Spec.HostNetwork)
assert.Equal(t, v1.DNSClusterFirstWithHostNet, d.Spec.Template.Spec.DNSPolicy)
} | explode_data.jsonl/4578 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 234
} | [
2830,
3393,
9296,
12320,
1155,
353,
8840,
836,
8,
341,
5195,
337,
1695,
1669,
5101,
7121,
17342,
7,
16,
15,
15,
15,
15,
15,
13,
15,
11,
5101,
49983,
13817,
340,
1444,
1669,
1532,
2099,
18855,
67,
9328,
90,
2959,
746,
25,
1273,
453... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestShareWith(t *testing.T) {
tests := []struct {
name, expected string
}{
{"", "One for you, one for me."},
{"Alice", "One for Alice, one for me."},
{"Bob", "One for Bob, one for me."},
}
for _, test := range tests {
if observed := ShareWith(test.name); observed != test.expected {
t.Fatalf("ShareWith(%s) = %v, want %v", test.name, observed, test.expected)
}
}
} | explode_data.jsonl/21301 | {
"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,
12115,
2354,
1155,
353,
8840,
836,
8,
972,
78216,
1669,
3056,
1235,
972,
197,
11609,
11,
3601,
914,
319,
197,
92,
1666,
197,
197,
4913,
497,
330,
3966,
369,
498,
11,
825,
369,
752,
1189,
11557,
197,
197,
4913,
61686,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestShout(t *testing.T) {
if Shout("Test") != "Test!" {
t.Errorf("Got %s but want \"Test!\"", Shout("Test"))
}
if Shout("") != "!" {
t.Errorf("Got %s but want \"!\"", Shout(""))
}
} | explode_data.jsonl/35080 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 88
} | [
2830,
3393,
2016,
411,
1155,
353,
8840,
836,
8,
341,
743,
1417,
411,
445,
2271,
899,
961,
330,
2271,
8958,
341,
197,
3244,
13080,
445,
32462,
1018,
82,
714,
1366,
7245,
2271,
0,
55853,
1417,
411,
445,
2271,
5455,
197,
532,
743,
1417... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestError(t *testing.T) {
query := makeQuery(nil)
q := graphql.MustParse(`
query foo {
error
}
`, map[string]interface{}{})
if err := graphql.PrepareQuery(context.Background(), query, q.SelectionSet); err != nil {
t.Error(err)
}
e := testgraphql.NewExecutorWrapper(t)
_, err := e.Execute(context.Background(), query, nil, q)
if err == nil || err.Error() != "foo.error: test error" {
t.Error("expected test error")
}
} | explode_data.jsonl/72161 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 172
} | [
2830,
3393,
1454,
1155,
353,
8840,
836,
8,
341,
27274,
1669,
1281,
2859,
27907,
692,
18534,
1669,
48865,
50463,
14463,
61528,
197,
27274,
15229,
341,
298,
18290,
198,
197,
197,
532,
197,
7808,
2415,
14032,
31344,
6257,
6257,
692,
743,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestBuildStatus(t *testing.T) {
d := entity.Definition{
StatusCode: http.StatusOK,
}
assert.Equal(t, http.StatusOK, d.BuildStatusCode())
d = entity.Definition{
StatusCode: 700,
}
assert.Equal(t, 700, d.BuildStatusCode())
} | explode_data.jsonl/68888 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 92
} | [
2830,
3393,
11066,
2522,
1155,
353,
8840,
836,
8,
341,
2698,
1669,
5387,
49947,
4054,
515,
197,
197,
15872,
25,
1758,
52989,
345,
197,
630,
6948,
12808,
1155,
11,
1758,
52989,
11,
294,
25212,
15872,
12367,
2698,
284,
5387,
49947,
4054,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTabletServerStreamExecuteComments(t *testing.T) {
db, tsv := setupTabletServerTest(t, "")
defer tsv.StopService()
defer db.Close()
executeSQL := "/* leading */ select * from test_table limit 1000 /* trailing */"
executeSQLResult := &sqltypes.Result{
Fields: []*querypb.Field{
{Type: sqltypes.VarBinary},
},
Rows: [][]sqltypes.Value{
{sqltypes.NewVarBinary("row01")},
},
}
db.AddQuery(executeSQL, executeSQLResult)
target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY}
callback := func(*sqltypes.Result) error { return nil }
ch := tabletenv.StatsLogger.Subscribe("test stats logging")
defer tabletenv.StatsLogger.Unsubscribe(ch)
if err := tsv.StreamExecute(ctx, &target, executeSQL, nil, 0, 0, nil, callback); err != nil {
t.Fatalf("TabletServer.StreamExecute should success: %s, but get error: %v",
executeSQL, err)
}
wantSQL := executeSQL
select {
case out := <-ch:
stats, ok := out.(*tabletenv.LogStats)
if !ok {
t.Errorf("Unexpected value in query logs: %#v (expecting value of type %T)", out, &tabletenv.LogStats{})
}
if wantSQL != stats.OriginalSQL {
t.Errorf("logstats: SQL want %s got %s", wantSQL, stats.OriginalSQL)
}
default:
t.Fatal("stats are empty")
}
} | explode_data.jsonl/80002 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 472
} | [
2830,
3393,
2556,
83,
5475,
3027,
17174,
17373,
1155,
353,
8840,
836,
8,
341,
20939,
11,
259,
3492,
1669,
6505,
2556,
83,
5475,
2271,
1155,
11,
14676,
16867,
259,
3492,
30213,
1860,
741,
16867,
2927,
10421,
2822,
8122,
3068,
6688,
1669,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCollaterals(t *testing.T) {
client := v1.New(&v1.Config{
Key: os.Getenv("BFKEY"),
Secret: os.Getenv("BFSECRET"),
})
res, err := client.Collaterals(list.NewForCollaterals(
500, 0, 0,
))
assert.NoError(t, err)
for i, v := range *res {
fmt.Printf("%d %+v\n", i, v)
}
s := new(list.SFDFactors)
s.Set(res)
fmt.Printf("CUL SFD FACTOR: %+v\n", s)
fmt.Printf("%+v %+v\n", client.Limit.Remain(true), client.Limit.Remain(false))
} | explode_data.jsonl/41220 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 225
} | [
2830,
3393,
15265,
962,
1127,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
348,
16,
7121,
2099,
85,
16,
10753,
515,
197,
55242,
25,
262,
2643,
64883,
445,
19883,
4784,
4461,
197,
7568,
50856,
25,
2643,
64883,
445,
19883,
65310,
4461,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestInitializeShouldCleanupOnBadMountPoint(t *testing.T) {
if buildpipeline.IsRegularBuild() {
// this test only apply to "regular build" pipeline
const invalidMountPointSource = "@"
extraDirectories := []string{}
extraMountPoints := []*MountPoint{
NewMountPoint(invalidMountPointSource, "custom-mount", "", emptyFlags, emptyPath),
}
dir := filepath.Join(tmpDir, "TestInitializeShouldCleanupOnBadMountPoint")
chroot := NewChroot(dir, isExistingDir)
err := chroot.Initialize(emptyPath, extraDirectories, extraMountPoints)
assert.Error(t, err)
_, err = os.Stat(dir)
assert.True(t, os.IsNotExist(err))
}
} | explode_data.jsonl/38799 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 222
} | [
2830,
3393,
9928,
14996,
67335,
1925,
17082,
16284,
2609,
1155,
353,
8840,
836,
8,
341,
743,
1936,
51258,
4506,
30404,
11066,
368,
341,
197,
197,
322,
419,
1273,
1172,
3796,
311,
330,
22308,
1936,
1,
15301,
198,
197,
4777,
8318,
16284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_Mock_On_WithIntArgMatcher(t *testing.T) {
var mockedService TestExampleImplementation
mockedService.On("TheExampleMethod",
MatchedBy(func(a int) bool {
return a == 1
}), MatchedBy(func(b int) bool {
return b == 2
}), MatchedBy(func(c int) bool {
return c == 3
})).Return(0, nil)
assert.Panics(t, func() {
mockedService.TheExampleMethod(1, 2, 4)
})
assert.Panics(t, func() {
mockedService.TheExampleMethod(2, 2, 3)
})
assert.NotPanics(t, func() {
mockedService.TheExampleMethod(1, 2, 3)
})
} | explode_data.jsonl/8570 | {
"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,
1245,
1176,
35482,
62,
2354,
1072,
2735,
37554,
1155,
353,
8840,
836,
8,
972,
2405,
46149,
1860,
3393,
13314,
36850,
871,
2109,
67385,
1860,
8071,
445,
785,
13314,
3523,
4723,
197,
197,
8331,
97322,
18552,
2877,
526,
8,
1807... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExecutions(t *testing.T) {
n := 100
count := 499
client := v1.New(nil)
var ex []execution.Execution
var agg []execution.Execution
var lastid int
for i := 0; i < n; i++ {
exec, err := client.Executions(execution.New(types.FXBTCJPY).SetPagination(count, lastid, 0))
fmt.Printf("%+v\n", err)
assert.NoError(t, err)
// assert.Equal(t, count, len(*exec))
ex = append(ex, *exec...)
agg = append(agg, exec.Aggregate()...)
lastid = ex[len(ex)-1].ID
}
var (
eSize, aggSize float64
)
for i := range ex {
if 1 < ex[i].Size {
fmt.Printf("単約定: %s %.f %.4f\n", ex[i].Side, ex[i].Price, ex[i].Size)
}
eSize += ex[i].Size
}
for i := range agg {
if 1 < agg[i].Size {
fmt.Printf("分割約定: %s %.f %.4f\n", agg[i].Side, agg[i].Price, agg[i].Size)
}
aggSize += agg[i].Size
}
// 生データと集計データの約定枚数をチェック
assert.Equal(t, math.RoundToEven(eSize/types.SATOSHI)*types.SATOSHI, math.RoundToEven(aggSize/types.SATOSHI)*types.SATOSHI)
} | explode_data.jsonl/41197 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 482
} | [
2830,
3393,
10216,
3977,
1155,
353,
8840,
836,
8,
341,
9038,
1669,
220,
16,
15,
15,
198,
18032,
1669,
220,
19,
24,
24,
198,
25291,
1669,
348,
16,
7121,
27907,
340,
2405,
505,
3056,
52721,
68352,
198,
2405,
50020,
3056,
52721,
68352,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestImportCorrectMap(t *testing.T) {
wantgraph, wantmap := getGGraph()
test(t, wantgraph, wantmap, nil, "testdata/G.txt")
f := "testdata/L.txt"
test(t, Graph{
Verticies: []Vertex{Vertex{ID: 0}, Vertex{ID: 1}, Vertex{ID: 2}}},
map[string]int{
"A": 0, "B": 1, "C": 2,
}, nil, f)
} | explode_data.jsonl/81155 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 139
} | [
2830,
3393,
11511,
33092,
2227,
1155,
353,
8840,
836,
8,
341,
50780,
4439,
11,
1366,
2186,
1669,
633,
38,
11212,
741,
18185,
1155,
11,
1366,
4439,
11,
1366,
2186,
11,
2092,
11,
330,
92425,
15792,
3909,
1138,
1166,
1669,
330,
92425,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestChangesetApply(t *testing.T) {
conn, s := fillSession(t)
defer func() {
s.Delete()
if err := conn.Close(); err != nil {
t.Error(err)
}
}()
buf := new(bytes.Buffer)
if err := s.Changeset(buf); err != nil {
t.Fatal(err)
}
b := buf.Bytes()
invBuf := new(bytes.Buffer)
if err := sqlite.ChangesetInvert(invBuf, bytes.NewReader(b)); err != nil {
t.Fatal(err)
}
// Undo the entire session.
if err := conn.ChangesetApply(invBuf, nil, nil); err != nil {
t.Fatal(err)
}
// Table t should now be equivalent to the first two statements:
// INSERT INTO t (c1, c2, c3) VALUES ("1", "2", "3");
// INSERT INTO t (c1, c2, c3) VALUES ("4", "5", "6");
want := []string{"1,2,3", "4,5,6"}
var got []string
fn := func(stmt *sqlite.Stmt) error {
got = append(got, stmt.ColumnText(0)+","+stmt.ColumnText(1)+","+stmt.ColumnText(2))
return nil
}
if err := sqlitex.Exec(conn, "SELECT c1, c2, c3 FROM t ORDER BY c1;", fn); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, want) {
t.Errorf("got=%v, want=%v", got, want)
}
} | explode_data.jsonl/35695 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 468
} | [
2830,
3393,
11317,
295,
28497,
1155,
353,
8840,
836,
8,
341,
32917,
11,
274,
1669,
5155,
5283,
1155,
340,
16867,
2915,
368,
341,
197,
1903,
18872,
741,
197,
743,
1848,
1669,
4534,
10421,
2129,
1848,
961,
2092,
341,
298,
3244,
6141,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestDial(t *testing.T) {
defer func() func() {
temp := hsDialer
hsDialer = func(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
return &grpc.ClientConn{}, nil
}
return func() {
hsDialer = temp
}
}()
// Ensure that hsConn is nil at first.
hsConn = nil
// First call to Dial, it should create set hsConn.
conn1, err := Dial(testAddress)
if err != nil {
t.Fatalf("first call to Dial failed: %v", err)
}
if conn1 == nil {
t.Fatal("first call to Dial(_)=(nil, _), want not nil")
}
if got, want := hsConn, conn1; got != want {
t.Fatalf("hsConn=%v, want %v", got, want)
}
// Second call to Dial should return conn1 above.
conn2, err := Dial(testAddress)
if err != nil {
t.Fatalf("second call to Dial(_) failed: %v", err)
}
if got, want := conn2, conn1; got != want {
t.Fatalf("second call to Dial(_)=(%v, _), want (%v,. _)", got, want)
}
if got, want := hsConn, conn1; got != want {
t.Fatalf("hsConn=%v, want %v", got, want)
}
} | explode_data.jsonl/80624 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 404
} | [
2830,
3393,
35,
530,
1155,
353,
8840,
836,
8,
341,
16867,
2915,
368,
2915,
368,
341,
197,
16280,
1669,
32220,
35,
530,
261,
198,
197,
81692,
35,
530,
261,
284,
2915,
8637,
914,
11,
12185,
2503,
56585,
98462,
5341,
8,
4609,
56585,
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 TestRESTClientPodCPUEmptyMetricsForOnePod(t *testing.T) {
targetTimestamp := 1
window := 30 * time.Second
tc := restClientTestCase{
resourceName: v1.ResourceCPU,
desiredMetricValues: PodMetricsInfo{
"test-pod-0": {Value: 100, Timestamp: offsetTimestampBy(targetTimestamp), Window: window},
"test-pod-1": {Value: 700, Timestamp: offsetTimestampBy(targetTimestamp), Window: window},
},
targetTimestamp: targetTimestamp,
window: window,
reportedPodMetrics: []map[string]int64{{"test-1": 100}, {"test-1": 300, "test-2": 400}, {}},
}
tc.runTest(t)
} | explode_data.jsonl/64907 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 226
} | [
2830,
3393,
38307,
2959,
23527,
7123,
2230,
76,
1595,
27328,
2461,
3966,
23527,
1155,
353,
8840,
836,
8,
341,
28861,
20812,
1669,
220,
16,
198,
23545,
1669,
220,
18,
15,
353,
882,
32435,
198,
78255,
1669,
2732,
2959,
16458,
515,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestWalk(t *testing.T) {
cases := []struct {
Name string
Input interface{}
ExpectedCalls []string
}{
{
"Struct with one string field",
struct{ Name string }{"Chris"},
[]string{"Chris"},
},
{
"Struct with two string fields",
struct {
Name string
City string
}{"Chris", "London"},
[]string{"Chris", "London"},
},
{
"Struct with non string field",
struct {
Name string
Age int
}{"Chris", 33},
[]string{"Chris"},
},
{
"Nested fields",
Person{
"Chris",
Profile{33, "London"},
},
[]string{"Chris", "London"},
},
{
"Pointers to things",
&Person{
"Chris",
Profile{33, "London"},
},
[]string{"Chris", "London"},
},
{
"Slices",
[]Profile{
{33, "London"},
{34, "Reykjavík"},
},
[]string{"London", "Reykjavík"},
},
{
"Arrays",
[2]Profile{
{33, "London"},
{34, "Reykjavík"},
},
[]string{"London", "Reykjavík"},
},
}
for _, test := range cases {
t.Run(test.Name, func(t *testing.T) {
var got []string
walk(test.Input, func(input string) {
got = append(got, input)
})
if !reflect.DeepEqual(got, test.ExpectedCalls) {
t.Errorf("got %v, want %v", got, test.ExpectedCalls)
}
})
}
// map 顺序不一致,单独测试
t.Run("with maps", func(t *testing.T) {
aMap := map[string]string{
"Foo": "Bar",
"Baz": "Boz",
}
var got []string
walk(aMap, func(input string) {
got = append(got, input)
})
assertContains(t, got, "Bar")
assertContains(t, got, "Boz")
})
} | explode_data.jsonl/35088 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 778
} | [
2830,
3393,
48849,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
21297,
688,
914,
198,
197,
66588,
260,
3749,
16094,
197,
197,
18896,
55292,
3056,
917,
198,
197,
59403,
197,
197,
515,
298,
197,
1,
9422,
448,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOpenParentDiscarderFilter(t *testing.T) {
rule := &rules.RuleDefinition{
ID: "test_rule",
Expression: `open.filename =~ "/usr/bin" && open.flags & (O_CREAT | O_SYNC) > 0`,
}
test, err := newTestModule(nil, []*rules.RuleDefinition{rule}, testOpts{wantProbeEvents: true})
if err != nil {
t.Fatal(err)
}
defer test.Close()
fd1, testFile1, err := openTestFile(test, "test-obd-2", syscall.O_CREAT|syscall.O_SYNC)
if err != nil {
t.Fatal(err)
}
defer syscall.Close(fd1)
defer os.Remove(testFile1)
if _, err := waitForOpenDiscarder(test, testFile1); err != nil {
inode := getInode(t, testFile1)
parentInode := getInode(t, path.Dir(testFile1))
t.Fatalf("not able to get the expected event inode: %d, parent inode: %d", inode, parentInode)
}
fd2, testFile2, err := openTestFile(test, "test-obd-2", syscall.O_CREAT|syscall.O_SYNC)
if err != nil {
t.Fatal(err)
}
defer syscall.Close(fd2)
defer os.Remove(testFile2)
if event, err := waitForOpenProbeEvent(test, testFile2); err == nil {
t.Fatalf("shouldn't get an event: %+v", event)
}
} | explode_data.jsonl/61816 | {
"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,
5002,
8387,
23477,
567,
261,
5632,
1155,
353,
8840,
836,
8,
341,
7000,
1111,
1669,
609,
21977,
63961,
10398,
515,
197,
29580,
25,
260,
330,
1944,
21124,
756,
197,
197,
9595,
25,
1565,
2508,
30882,
20495,
3521,
7063,
8749,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGlobalHeadersSetInRequest(t *testing.T) {
ts := httptest.NewServer(
http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(r.URL.Path, "/v2") {
apiResourcesHandler(w, r)
} else {
if r.Header.Get("Authorization") != "Bearer testtoken" {
t.Errorf("Expected 'Bearer testtoken' as global header in 'Authorization', got '%s'", r.Header.Get("Authorization"))
}
if r.Header.Get("X-Custom-Header") != "customValue" {
t.Errorf("Expected 'customValue' as global header in 'X-Custom-Header', got '%s'", r.Header.Get("X-Custom-Header"))
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, `[{"id":"r2","type":"Room","pressure":{"type":"Integer","value":"720","metadata":{}},"temperature":{"type":"Float","value":34,"metadata":{}}},{"id":"r5","type":"Room","pressure":{"type":"Integer","value":"700","metadata":{}},"temperature":{"type":"Float","value":31,"metadata":{}}}
]`)
}
}))
defer ts.Close()
cli, err := client.NewNgsiV2Client(
client.SetUrl(ts.URL),
client.SetGlobalHeader("Authorization", "Bearer testtoken"),
client.SetGlobalHeader("X-Custom-Header", "customValue"),
)
if err != nil {
t.Fatalf("Unexpected error: '%v'", err)
}
if _, err := cli.ListEntities(
client.ListEntitiesSetType("Room")); err != nil {
t.Fatalf("Unexpected error: '%v'", err)
}
} | explode_data.jsonl/64675 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 564
} | [
2830,
3393,
11646,
10574,
1649,
641,
1900,
1155,
353,
8840,
836,
8,
341,
57441,
1669,
54320,
70334,
7121,
5475,
1006,
197,
28080,
89164,
1006,
298,
29244,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
571,
743,
9069,
16152,
40177... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBindUnmarshalTypeError(t *testing.T) {
body := bytes.NewBufferString(`{ "id": "text" }`)
e := New()
req := httptest.NewRequest(http.MethodPost, "/", body)
req.Header.Set(HeaderContentType, MIMEApplicationJSON)
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)
u := new(user)
err := c.Bind(u)
he := &HTTPError{Code: http.StatusBadRequest, Message: "Unmarshal type error: expected=int, got=string, field=id, offset=14", Internal: err.(*HTTPError).Internal}
assert.Equal(t, he, err)
} | explode_data.jsonl/72328 | {
"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,
9950,
1806,
27121,
80076,
1155,
353,
8840,
836,
8,
341,
35402,
1669,
5820,
7121,
4095,
703,
5809,
90,
330,
307,
788,
330,
1318,
1,
335,
24183,
7727,
1669,
1532,
741,
24395,
1669,
54320,
70334,
75274,
19886,
20798,
4133,
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 TestReconcile(t *testing.T) {
adapterCfg := &adapterConfig{
Image: "registry/image:tag",
obsConfig: &source.EmptyVarsGenerator{},
}
ctor := reconcilerCtor(adapterCfg)
trg := newTarget()
ab := adapterBuilder(adapterCfg)
TestReconcileAdapter(t, ctor, trg, ab)
} | explode_data.jsonl/50274 | {
"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,
693,
40446,
457,
1155,
353,
8840,
836,
8,
341,
197,
19731,
42467,
1669,
609,
19731,
2648,
515,
197,
53397,
25,
257,
330,
29172,
23349,
25,
4578,
756,
197,
197,
5481,
2648,
25,
609,
2427,
11180,
28305,
12561,
38837,
197,
63... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCPUInstrs(t *testing.T) {
roms := []struct {
until uint16
path string
}{
{0xC7D2, "./tests/cpu_instrs/individual/01-special.gb"},
{0xC7F4, "./tests/cpu_instrs/individual/02-interrupts.gb"},
{0xCB44, "./tests/cpu_instrs/individual/03-op sp,hl.gb"},
{0xCB35, "./tests/cpu_instrs/individual/04-op r,imm.gb"},
{0xCB31, "./tests/cpu_instrs/individual/05-op rp.gb"},
{0xCC5F, "./tests/cpu_instrs/individual/06-ld r,r.gb"},
{0xCBB0, "./tests/cpu_instrs/individual/07-jr,jp,call,ret,rst.gb"},
{0xCB91, "./tests/cpu_instrs/individual/08-misc instrs.gb"},
{0xCE67, "./tests/cpu_instrs/individual/09-op r,r.gb"},
{0xCF58, "./tests/cpu_instrs/individual/10-bit ops.gb"},
{0xCC62, "./tests/cpu_instrs/individual/11-op a,(hl).gb"},
}
var wg sync.WaitGroup
wg.Add(len(roms))
for _, v := range roms {
go func(path string, until uint16) {
runTest(t, path, until)
wg.Done()
}(v.path, v.until)
}
wg.Wait()
} | explode_data.jsonl/57733 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 469
} | [
2830,
3393,
31615,
74375,
82,
1155,
353,
8840,
836,
8,
341,
197,
441,
82,
1669,
3056,
1235,
341,
197,
20479,
1646,
2622,
16,
21,
198,
197,
26781,
220,
914,
198,
197,
59403,
197,
197,
90,
15,
12125,
22,
35,
17,
11,
5924,
23841,
773... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSign(t *testing.T) {
key, _ := HexToECDSA(testPrivHex)
addr := common.HexToAddress(testAddrHex)
msg := Keccak256([]byte("foo"))
sig, err := Sign(msg, key)
if err != nil {
t.Errorf("Sign error: %s", err)
}
recoveredPub, err := Ecrecover(msg, sig)
if err != nil {
t.Errorf("ECRecover error: %s", err)
}
pubKey, _ := UnmarshalPubkey(recoveredPub)
recoveredAddr := PubkeyToAddress(*pubKey)
if addr != recoveredAddr {
t.Errorf("Address mismatch: want: %x have: %x", addr, recoveredAddr)
}
// should be equal to SigToPub
recoveredPub2, err := SigToPub(msg, sig)
if err != nil {
t.Errorf("ECRecover error: %s", err)
}
recoveredAddr2 := PubkeyToAddress(*recoveredPub2)
if addr != recoveredAddr2 {
t.Errorf("Address mismatch: want: %x have: %x", addr, recoveredAddr2)
}
} | explode_data.jsonl/3758 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 327
} | [
2830,
3393,
7264,
1155,
353,
8840,
836,
8,
341,
23634,
11,
716,
1669,
27228,
1249,
7498,
72638,
8623,
32124,
20335,
340,
53183,
1669,
4185,
91538,
1249,
4286,
8623,
13986,
20335,
692,
21169,
1669,
6569,
84262,
17,
20,
21,
10556,
3782,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestTransactionService_GetTransaction_TransferTransaction(t *testing.T) {
mockServer.AddRouter(&mock.Router{
Path: fmt.Sprintf("/transaction/%s", transactionId),
RespBody: transactionJson,
})
cl := mockServer.getTestNetClientUnsafe()
tx, err := cl.Transaction.GetTransaction(context.Background(), transactionId)
assert.Nilf(t, err, "TransactionService.GetTransaction returned error: %v", err)
tests.ValidateStringers(t, transaction, tx)
} | explode_data.jsonl/69183 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 148
} | [
2830,
3393,
8070,
1860,
13614,
8070,
34932,
802,
8070,
1155,
353,
8840,
836,
8,
341,
77333,
5475,
1904,
9523,
2099,
16712,
31413,
515,
197,
69640,
25,
257,
8879,
17305,
4283,
13528,
12627,
82,
497,
7745,
764,
1326,
197,
197,
36555,
5444... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEventRecordsRaw_Decode_FailsFirstNotPhase(t *testing.T) {
e := EventRecordsRaw(MustHexDecodeString("0x0400020000000302d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48266d00000000000000000000000000000010a5d4e8000000000000000000000000")) //nolint:lll
events := struct {
Balances_Transfer []struct { //nolint:stylecheck,golint
P uint8
Other uint32
T []Hash
}
}{}
err := e.DecodeEventRecords(ExamplaryMetadataV8, &events)
assert.EqualError(t, err, "expected the first field of event #0 with EventID [3 2], field Balances_Transfer to be of type types.Phase, but got uint8") //nolint:lll
} | explode_data.jsonl/68329 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 283
} | [
2830,
3393,
1556,
25876,
20015,
78668,
534,
1400,
6209,
5338,
2623,
30733,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
3665,
25876,
20015,
3189,
590,
20335,
32564,
703,
445,
15,
87,
15,
19,
15,
15,
15,
17,
15,
15,
15,
15,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPostgreSQL_Initialize(t *testing.T) {
cleanup, connURL := preparePostgresTestContainer(t)
defer cleanup()
connectionDetails := map[string]interface{}{
"connection_url": connURL,
}
dbRaw, _ := New()
db := dbRaw.(*PostgreSQL)
connProducer := db.ConnectionProducer.(*connutil.SQLConnectionProducer)
err := db.Initialize(connectionDetails, true)
if err != nil {
t.Fatalf("err: %s", err)
}
if !connProducer.Initialized {
t.Fatal("Database should be initalized")
}
err = db.Close()
if err != nil {
t.Fatalf("err: %s", err)
}
} | explode_data.jsonl/45464 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 207
} | [
2830,
3393,
4133,
59796,
62,
9928,
1155,
353,
8840,
836,
8,
341,
1444,
60639,
11,
4534,
3144,
1669,
10549,
4133,
17818,
2271,
4502,
1155,
340,
16867,
21290,
2822,
54590,
7799,
1669,
2415,
14032,
31344,
67066,
197,
197,
1,
7742,
2903,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCancelOpenOrders(t *testing.T) {
t.Parallel()
if !areTestAPIKeysSet() || !canManipulateRealOrders {
t.Skip("skipping test, either api keys or manipulaterealorders isnt set correctly")
}
temp := []string{BTCAUD, LTCAUD}
_, err := b.CancelAllOpenOrdersByPairs(temp)
if err != nil {
t.Error(err)
}
temp = []string{BTCAUD, fakePair}
_, err = b.CancelAllOpenOrdersByPairs(temp)
if err == nil {
t.Error("expected an error due to invalid marketID")
}
} | explode_data.jsonl/33154 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 183
} | [
2830,
3393,
9269,
5002,
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,
11,
2987,
6330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCollectUnused(t *testing.T) {
t.Parallel()
inputs := []struct {
text string
names []string
}{
{
text: `
s0 {
f0 string
}
`,
names: []string{"s0"},
},
{
text: `
foo$0(a ptr[in, s0])
s0 {
f0 int8
f1 int16
}
`,
names: []string{},
},
{
text: `
s0 {
f0 int8
f1 int16
}
s1 {
f2 int32
}
foo$0(a ptr[in, s0])
`,
names: []string{"s1"},
},
}
for i, input := range inputs {
desc := ast.Parse([]byte(input.text), "input", nil)
if desc == nil {
t.Fatalf("Test %d: failed to parse", i)
}
nodes, err := CollectUnused(desc, targets.List[targets.TestOS][targets.TestArch64], nil)
if err != nil {
t.Fatalf("Test %d: CollectUnused failed: %v", i, err)
}
if len(input.names) != len(nodes) {
t.Errorf("Test %d: want %d nodes, got %d", i, len(input.names), len(nodes))
}
names := make([]string, len(nodes))
for i := range nodes {
_, _, names[i] = nodes[i].Info()
}
sort.Strings(names)
sort.Strings(input.names)
if !reflect.DeepEqual(names, input.names) {
t.Errorf("Test %d: Unused nodes differ. Want %v, Got %v", i, input.names, names)
}
}
} | explode_data.jsonl/53125 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 619
} | [
2830,
3393,
47504,
94033,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
22427,
82,
1669,
3056,
1235,
341,
197,
15425,
220,
914,
198,
197,
93940,
3056,
917,
198,
197,
59403,
197,
197,
515,
298,
15425,
25,
22074,
571,
1903,
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... | 7 |
func TestDSNParserInvalid(t *testing.T) {
var invalidDSNs = []string{
"@net(addr/", // no closing brace
"@tcp(/", // no closing brace
"tcp(/", // no closing brace
"(/", // no closing brace
"net(addr)//", // unescaped
"User:pass@tcp(1.2.3.4:3306)", // no trailing slash
//"/dbname?arg=/some/unescaped/path",
}
for i, tst := range invalidDSNs {
if _, err := ParseDSN(tst); err == nil {
t.Errorf("invalid DSN #%d. (%s) didn't error!", i, tst)
}
}
} | explode_data.jsonl/70842 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 326
} | [
2830,
3393,
5936,
45,
6570,
7928,
1155,
353,
8840,
836,
8,
972,
2405,
8318,
5936,
47360,
284,
3056,
917,
1666,
197,
197,
96270,
4711,
24497,
28105,
1698,
442,
902,
15316,
32864,
319,
197,
197,
96270,
27161,
9921,
497,
2549,
442,
902,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateFuncTypecheck(t *testing.T) {
tcs := []struct {
name string
code []byte
fnReturn wasm.ValueType
err error
}{
{
name: "voidfunc-i32",
fnReturn: noReturn,
code: []byte{
operators.I32Const, 0,
},
err: InvalidTypeError{noReturn, wasm.ValueTypeI32},
},
{
name: "i32func-void",
fnReturn: wasm.ValueTypeI32,
code: []byte{
operators.Nop,
},
err: ErrStackUnderflow,
},
{
name: "i32func-i32",
fnReturn: wasm.ValueTypeI32,
code: []byte{
operators.I32Const, 0,
},
},
{
name: "voidfunc-i64",
fnReturn: noReturn,
code: []byte{
operators.I64Const, 0,
},
err: InvalidTypeError{noReturn, wasm.ValueTypeI64},
},
{
name: "i64func-i64",
fnReturn: wasm.ValueTypeI64,
code: []byte{
operators.I64Const, 0,
},
},
{
name: "i64func-void",
fnReturn: wasm.ValueTypeI64,
code: []byte{
operators.Nop,
},
err: ErrStackUnderflow,
},
{
name: "voidfunc-f32",
fnReturn: noReturn,
code: []byte{
operators.F32Const, 0, 0, 0, 0,
},
err: InvalidTypeError{noReturn, wasm.ValueTypeF32},
},
{
name: "f32func-f32",
fnReturn: wasm.ValueTypeF32,
code: []byte{
operators.F32Const, 0, 0, 0, 0,
},
},
{
name: "f32func-void",
fnReturn: wasm.ValueTypeF32,
code: []byte{
operators.Nop,
},
err: ErrStackUnderflow,
},
{
name: "voidfunc-f32",
fnReturn: noReturn,
code: []byte{
operators.F32Const, 0, 0, 0, 0,
},
err: InvalidTypeError{noReturn, wasm.ValueTypeF32},
},
{
name: "f64func-f64",
fnReturn: wasm.ValueTypeF64,
code: []byte{
operators.F64Const, 0, 0, 0, 0, 0, 0, 0, 0,
},
},
{
name: "f64func-void",
fnReturn: wasm.ValueTypeF64,
code: []byte{
operators.Nop,
},
err: ErrStackUnderflow,
},
{
name: "resolve unreachable",
fnReturn: wasm.ValueTypeI64,
// (block (result i32) (select (unreachable) (unreachable) (unreachable)))
code: []byte{
operators.Block, byte(wasm.ValueTypeI32),
operators.Unreachable, operators.Unreachable, operators.Unreachable, operators.Select,
operators.End,
},
err: InvalidTypeError{wasm.ValueTypeI64, wasm.ValueTypeI32},
},
{
name: "return i32func-i64",
fnReturn: wasm.ValueTypeI32,
// (i64.const 0) (return) (i32.const 0)
code: []byte{
operators.I64Const, 0,
operators.Return,
operators.I32Const, 0,
},
err: InvalidTypeError{wasm.ValueTypeI32, wasm.ValueTypeI64},
},
{
name: "return i64func-i64",
fnReturn: wasm.ValueTypeI64,
// (i64.const 0) (return) (i64.const 0)
code: []byte{
operators.I64Const, 0,
operators.Return,
operators.I64Const, 0,
},
err: nil,
},
{
name: "local funci32-i32",
fnReturn: wasm.ValueTypeI32,
// (getLocal 0)
code: []byte{
operators.GetLocal, 0,
},
err: nil,
},
{
name: "local funci64-i32",
fnReturn: wasm.ValueTypeI64,
// (getLocal 0) (return) (i64.const 0) (drop)
code: []byte{
operators.GetLocal, 0,
operators.Return,
operators.I64Const, 0,
operators.Drop,
},
err: InvalidTypeError{wasm.ValueTypeI64, wasm.ValueTypeI32},
},
}
for i := range tcs {
tc := tcs[i]
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
mod := wasm.Module{}
sig := wasm.FunctionSig{Form: 0x60 /* Must always be 0x60 */, ReturnTypes: []wasm.ValueType{tc.fnReturn}}
fn := wasm.FunctionBody{
Module: &mod,
Code: tc.code,
Locals: []wasm.LocalEntry{
{Count: 1, Type: wasm.ValueTypeI32},
},
}
_, err := verifyBody(&sig, &fn, &mod)
if err != tc.err {
t.Fatalf("verify returned '%v', want '%v'", err, tc.err)
}
})
}
} | explode_data.jsonl/16564 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1947
} | [
2830,
3393,
17926,
9626,
929,
2028,
1155,
353,
8840,
836,
8,
341,
3244,
4837,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
43343,
257,
3056,
3782,
198,
197,
40095,
5598,
98263,
6167,
929,
198,
197,
9859,
414,
1465,
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 TestRateLimiter_ReachLimit_AllowedOtherUser(t *testing.T) {
// 10 requests per second limit
limiter := New(10, time.Second)
// a limit of 10 tokens should be allowed on a second
for i := 0; i < 10; i++ {
date := fmt.Sprintf("2000-01-01T00:00:00.%d00Z", i)
mockClock(limiter, date)
assert.True(t, limiter.Allow("pable"))
}
// the 11th token withing the same second, musn't be allowed.
mockClock(limiter, "2000-01-01T00:00:00.900Z")
// user is throttled
assert.False(t, limiter.Allow("pable"))
// since the rate limiting is user independent, 'pable' being throttled
// musn't affect user 'jon'
for i := 0; i < 10; i++ {
assert.True(t, limiter.Allow("jon"))
}
} | explode_data.jsonl/74378 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 264
} | [
2830,
3393,
11564,
43,
17700,
62,
48368,
16527,
53629,
12817,
11409,
1474,
1155,
353,
8840,
836,
8,
341,
197,
322,
220,
16,
15,
7388,
817,
2086,
3930,
198,
197,
4659,
2015,
1669,
1532,
7,
16,
15,
11,
882,
32435,
692,
197,
322,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFloat32_String(t *testing.T) {
testcases := []struct {
name string
s Float32
expect string
}{
{
name: "test Float32 String, s is empty",
s: Float32{},
expect: "[]",
},
{
name: "test Float32 String, s is not empty",
s: map[float32]struct{}{1: {}},
expect: "[1]",
},
}
for _, tc := range testcases {
t.Logf("running scenario: %s", tc.name)
actual := tc.s.String()
if actual != tc.expect {
t.Errorf("expect string: %s, but got: %s", tc.expect, actual)
}
}
} | explode_data.jsonl/60122 | {
"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,
5442,
18,
17,
31777,
1155,
353,
8840,
836,
8,
341,
18185,
23910,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
1903,
414,
13001,
18,
17,
198,
197,
24952,
914,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,
256,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEncodeInvalidPayload(t *testing.T) {
h := defaultHeader()
p := mockIDTokenPayload{"key": func() {}}
if s, err := encodeToken(&mockSigner{}, h, p); s != "" || err == nil {
t.Errorf("encodeToken() = (%v, %v); want = ('', error)", s, err)
}
} | explode_data.jsonl/42598 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 100
} | [
2830,
3393,
32535,
7928,
29683,
1155,
353,
8840,
836,
8,
341,
9598,
1669,
1638,
4047,
741,
3223,
1669,
7860,
915,
3323,
29683,
4913,
792,
788,
2915,
368,
4687,
532,
743,
274,
11,
1848,
1669,
16164,
3323,
2099,
16712,
7264,
261,
22655,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_urlHostAndPath(t *testing.T) {
type args struct {
urlString string
}
tests := []struct {
name string
args args
wantHost string
wantPath string
wantErr bool
}{
{name: "valid", args: args{urlString: "https://my.git.host/scm/group/project.git"},
wantHost: "my.git.host",
wantPath: "/scm/group/project.git",
wantErr: false},
{name: "empty_host_from_missing_protcol", args: args{urlString: "my.git.host/scm/group/project.git"},
wantHost: "",
wantPath: "",
wantErr: true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotHost, gotPath, err := UrlHostAndPath(tt.args.urlString)
if (err != nil) != tt.wantErr {
t.Errorf("UrlHostAndPath() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotHost != tt.wantHost {
t.Errorf("UrlHostAndPath() gotHost = %v, want %v", gotHost, tt.wantHost)
}
if gotPath != tt.wantPath {
t.Errorf("UrlHostAndPath() gotPath = %v, want %v", gotPath, tt.wantPath)
}
})
}
} | explode_data.jsonl/46405 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 462
} | [
2830,
3393,
2903,
9296,
3036,
1820,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
19320,
703,
914,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
31215,
257,
2827,
198,
197,
50780,
9296,
914,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestUpdateExifRationals(t *testing.T) {
r, err := os.Open("fixtures/walrus.jpg")
if err != nil {
t.Fatalf("Failed to open test image, %v", err)
}
defer r.Close()
wr := io.Discard
fnum, err := PrepareTag("FNumber", "11/1")
if err != nil {
t.Fatalf("Failed to prepare tag, %v", err)
}
xres, err := PrepareTag("XResolution", "72/1")
if err != nil {
t.Fatalf("Failed to prepare tag, %v", err)
}
props := map[string]interface{}{
"FNumber": fnum,
"XResolution": xres,
}
// update_test.go:52: Failed to update EXIF data, failed to set GPSLatitude tag: value not encodable: [float64] [37.61799]
err = UpdateExif(r, wr, props)
if err != nil {
t.Fatalf("Failed to update EXIF data, %v", err)
}
// TO DO: READ AND VALIDATE TAGS
} | explode_data.jsonl/18064 | {
"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,
4289,
840,
333,
49,
367,
1127,
1155,
353,
8840,
836,
8,
1476,
7000,
11,
1848,
1669,
2643,
12953,
445,
45247,
6324,
278,
20341,
4819,
5130,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
9408,
311,
1787,
1273,
2168,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestInitNodeValidatorFiles(t *testing.T) {
home, cleanup := testutil.NewTestCaseDir(t)
cfg, err := createDefaultTendermintConfig(home)
t.Cleanup(cleanup)
nodeID, valPubKey, err := genutil.InitializeNodeValidatorFiles(cfg)
require.Nil(t, err)
require.NotEqual(t, "", nodeID)
require.NotEqual(t, 0, len(valPubKey.Bytes()))
} | explode_data.jsonl/58650 | {
"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,
3803,
1955,
14256,
10809,
1155,
353,
8840,
836,
8,
341,
197,
5117,
11,
21290,
1669,
1273,
1314,
7121,
16458,
6184,
1155,
340,
50286,
11,
1848,
1669,
1855,
3675,
51,
1659,
67791,
2648,
63194,
340,
3244,
727,
60639,
1337,
6063... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseArguments(t *testing.T) {
var cmd Command
cmd = parseArguments(".")
expect.DeepEqual(t, cmd, Command{Directory: "."})
// cmd = parseArguments("--template=javascript", ".")
// expect.DeepEqual(t, cmd, Command{Template: "javascript", Directory: "."})
//
// cmd = parseArguments("--template=typescript", ".")
// expect.DeepEqual(t, cmd, Command{Template: "typescript", Directory: "."})
cmd = parseArguments("app-name")
expect.DeepEqual(t, cmd, Command{Directory: "app-name"})
// cmd = parseArguments("--template=javascript", "app-name")
// expect.DeepEqual(t, cmd, Command{Template: "javascript", Directory: "app-name"})
//
// cmd = parseArguments("--template=typescript", "app-name")
// expect.DeepEqual(t, cmd, Command{Template: "typescript", Directory: "app-name"})
} | explode_data.jsonl/63318 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 275
} | [
2830,
3393,
14463,
19139,
1155,
353,
8840,
836,
8,
341,
2405,
5439,
7348,
271,
25920,
284,
4715,
19139,
5680,
1138,
24952,
94750,
1155,
11,
5439,
11,
7348,
90,
9310,
25,
22760,
8824,
197,
322,
5439,
284,
4715,
19139,
21549,
4214,
28,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIncompatibleStorageForStreaming(t *testing.T) {
jaeger := &v1.Jaeger{
Spec: v1.JaegerSpec{
Strategy: v1.DeploymentStrategyStreaming,
Storage: v1.JaegerStorageSpec{
Type: "memory",
},
},
}
normalize(context.Background(), jaeger)
assert.Equal(t, v1.DeploymentStrategyAllInOne, jaeger.Spec.Strategy)
} | explode_data.jsonl/21849 | {
"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,
641,
34842,
5793,
2461,
76509,
1155,
353,
8840,
836,
8,
341,
197,
5580,
1878,
1669,
609,
85,
16,
3503,
64,
1878,
515,
197,
7568,
992,
25,
348,
16,
3503,
64,
1878,
8327,
515,
298,
197,
19816,
25,
348,
16,
34848,
39130,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFrameMarshalJSON(t *testing.T) {
var tests = []struct {
Frame
want string
}{{
initpc,
`^"github\.com/marmotedu/errors\.init(\.ializers)? .+/github\.com/marmotedu/errors/stack_test.go:\d+"$`,
}, {
0,
`^"unknown"$`,
}}
for i, tt := range tests {
got, err := json.Marshal(tt.Frame)
if err != nil {
t.Fatal(err)
}
if !regexp.MustCompile(tt.want).Match(got) {
t.Errorf("test %d: MarshalJSON:\n got %q\n want %q", i+1, string(got), tt.want)
}
}
} | explode_data.jsonl/19131 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 231
} | [
2830,
3393,
4369,
55438,
5370,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
1235,
341,
197,
197,
4369,
198,
197,
50780,
914,
198,
197,
15170,
515,
197,
28248,
3992,
345,
197,
197,
63,
61,
1,
5204,
18831,
874,
3183,
2178,
925... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseCreateTable(t *testing.T) {
sqlFile := filepath.Join(t.TempDir(), "tmp.sql")
err := ioutil.WriteFile(sqlFile, []byte("CREATE TABLE `test_user` (\n `id` bigint NOT NULL AUTO_INCREMENT,\n `mobile` varchar(255) COLLATE utf8mb4_bin NOT NULL comment '手\\t机 号',\n `class` bigint NOT NULL comment '班级',\n `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL comment '姓\n 名',\n `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP comment '创建\\r时间',\n `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n PRIMARY KEY (`id`),\n UNIQUE KEY `mobile_unique` (`mobile`),\n UNIQUE KEY `class_name_unique` (`class`,`name`),\n KEY `create_index` (`create_time`),\n KEY `name_index` (`name`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;"), 0o777)
assert.Nil(t, err)
tables, err := Parse(sqlFile, "go_zero")
assert.Equal(t, 1, len(tables))
table := tables[0]
assert.Nil(t, err)
assert.Equal(t, "test_user", table.Name.Source())
assert.Equal(t, "id", table.PrimaryKey.Name.Source())
assert.Equal(t, true, table.ContainsTime())
assert.Equal(t, 2, len(table.UniqueIndex))
assert.True(t, func() bool {
for _, e := range table.Fields {
if e.Comment != util.TrimNewLine(e.Comment) {
return false
}
}
return true
}())
} | explode_data.jsonl/25574 | {
"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,
14463,
4021,
2556,
1155,
353,
8840,
836,
8,
341,
30633,
1703,
1669,
26054,
22363,
1155,
65009,
6184,
1507,
330,
5173,
10045,
1138,
9859,
1669,
43144,
4073,
1703,
13148,
1703,
11,
3056,
3782,
445,
22599,
14363,
1565,
1944,
3317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMixed(t *testing.T) {
var args struct {
Foo string `arg:"-f"`
Bar int
Baz uint `arg:"positional"`
Ham bool
Spam float32
}
args.Bar = 3
err := parse("123 -spam=1.2 -ham -f xyz", &args)
require.NoError(t, err)
assert.Equal(t, "xyz", args.Foo)
assert.Equal(t, 3, args.Bar)
assert.Equal(t, uint(123), args.Baz)
assert.Equal(t, true, args.Ham)
assert.EqualValues(t, 1.2, args.Spam)
} | explode_data.jsonl/12992 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 197
} | [
2830,
3393,
86433,
1155,
353,
8840,
836,
8,
341,
2405,
2827,
2036,
341,
197,
12727,
2624,
220,
914,
1565,
858,
86789,
69,
8805,
197,
197,
3428,
220,
526,
198,
197,
12791,
1370,
220,
2622,
1565,
858,
2974,
966,
3005,
8805,
197,
13292,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestScenarios(t *testing.T) {
suite := NewSuite(t, WithFeaturesPath("features/example.feature"))
compiled := regexp.MustCompile(`I add (\d+) and (\d+)`)
suite.AddRegexStep(compiled, add)
compiled = regexp.MustCompile(`the result should equal (\d+)`)
suite.AddRegexStep(compiled, check)
suite.Run()
} | explode_data.jsonl/69364 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
3326,
60494,
1155,
353,
8840,
836,
8,
341,
96572,
1669,
1532,
28000,
1155,
11,
3085,
21336,
1820,
445,
20304,
65182,
29591,
5455,
197,
50845,
1669,
41877,
98626,
5809,
40,
912,
19788,
67,
36197,
323,
19788,
67,
36197,
24183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFailedSyncWithRetry(t *testing.T) {
Given(t).
Path("hook").
When().
PatchFile("hook.yaml", `[{"op": "replace", "path": "/metadata/annotations", "value": {"argocd.argoproj.io/hook": "PreSync"}}]`).
// make hook fail
PatchFile("hook.yaml", `[{"op": "replace", "path": "/spec/containers/0/command", "value": ["false"]}]`).
CreateApp().
IgnoreErrors().
Sync("--retry-limit=1", "--retry-backoff-duration=1s").
Then().
Expect(OperationPhaseIs(OperationFailed)).
Expect(OperationMessageContains("retried 1 times"))
} | explode_data.jsonl/35662 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 213
} | [
2830,
3393,
9408,
12154,
2354,
51560,
1155,
353,
8840,
836,
8,
341,
9600,
2071,
1155,
4292,
197,
69640,
445,
20873,
38609,
197,
197,
4498,
25829,
197,
10025,
754,
1703,
445,
20873,
33406,
497,
77644,
4913,
453,
788,
330,
8156,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_TeamLogin(t *testing.T) {
// error payload
w := httptest.NewRecorder()
jsonData, _ := json.Marshal(map[string]interface{}{
"Name": 123123,
"Password": "",
})
req, _ := http.NewRequest("POST", "/api/login", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", managerToken)
router.ServeHTTP(w, req)
assert.Equal(t, 400, w.Code)
// error password
w = httptest.NewRecorder()
jsonData, _ = json.Marshal(map[string]interface{}{
"Name": team[1].Name,
"Password": "aaa",
})
req, _ = http.NewRequest("POST", "/api/login", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", managerToken)
router.ServeHTTP(w, req)
assert.Equal(t, 403, w.Code)
// success Vidar
w = httptest.NewRecorder()
jsonData, _ = json.Marshal(map[string]interface{}{
"Name": team[0].Name,
"Password": team[0].Password,
})
req, _ = http.NewRequest("POST", "/api/login", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", managerToken)
router.ServeHTTP(w, req)
assert.Equal(t, 200, w.Code)
var backJSON = struct {
Error int `json:"error"`
Msg string `json:"msg"`
Data string `json:"data"`
}{}
err := json.Unmarshal(w.Body.Bytes(), &backJSON)
assert.Equal(t, nil, err)
team[0].Token = backJSON.Data
// success e99
w = httptest.NewRecorder()
jsonData, _ = json.Marshal(map[string]interface{}{
"Name": team[1].Name,
"Password": team[1].Password,
})
req, _ = http.NewRequest("POST", "/api/login", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", managerToken)
router.ServeHTTP(w, req)
assert.Equal(t, 200, w.Code)
backJSON = struct {
Error int `json:"error"`
Msg string `json:"msg"`
Data string `json:"data"`
}{}
err = json.Unmarshal(w.Body.Bytes(), &backJSON)
assert.Equal(t, nil, err)
team[1].Token = backJSON.Data
} | explode_data.jsonl/77162 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 740
} | [
2830,
3393,
1139,
14580,
6231,
1155,
353,
8840,
836,
8,
341,
197,
322,
1465,
7729,
198,
6692,
1669,
54320,
70334,
7121,
47023,
741,
30847,
1043,
11,
716,
1669,
2951,
37271,
9147,
14032,
31344,
67066,
197,
197,
1,
675,
788,
257,
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 TestMemoryPressureCondition(t *testing.T) {
now := time.Now()
before := now.Add(-time.Second)
nowFunc := func() time.Time { return now }
cases := []struct {
desc string
node *v1.Node
pressure bool
expectConditions []v1.NodeCondition
expectEvents []testEvent
}{
{
desc: "new, no pressure",
node: &v1.Node{},
pressure: false,
expectConditions: []v1.NodeCondition{*makeMemoryPressureCondition(false, now, now)},
expectEvents: []testEvent{
{
eventType: v1.EventTypeNormal,
event: "NodeHasSufficientMemory",
},
},
},
{
desc: "new, pressure",
node: &v1.Node{},
pressure: true,
expectConditions: []v1.NodeCondition{*makeMemoryPressureCondition(true, now, now)},
expectEvents: []testEvent{
{
eventType: v1.EventTypeNormal,
event: "NodeHasInsufficientMemory",
},
},
},
{
desc: "transition to pressure",
node: &v1.Node{
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{*makeMemoryPressureCondition(false, before, before)},
},
},
pressure: true,
expectConditions: []v1.NodeCondition{*makeMemoryPressureCondition(true, now, now)},
expectEvents: []testEvent{
{
eventType: v1.EventTypeNormal,
event: "NodeHasInsufficientMemory",
},
},
},
{
desc: "transition to no pressure",
node: &v1.Node{
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{*makeMemoryPressureCondition(true, before, before)},
},
},
pressure: false,
expectConditions: []v1.NodeCondition{*makeMemoryPressureCondition(false, now, now)},
expectEvents: []testEvent{
{
eventType: v1.EventTypeNormal,
event: "NodeHasSufficientMemory",
},
},
},
{
desc: "pressure, no transition",
node: &v1.Node{
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{*makeMemoryPressureCondition(true, before, before)},
},
},
pressure: true,
expectConditions: []v1.NodeCondition{*makeMemoryPressureCondition(true, before, now)},
expectEvents: []testEvent{},
},
{
desc: "no pressure, no transition",
node: &v1.Node{
Status: v1.NodeStatus{
Conditions: []v1.NodeCondition{*makeMemoryPressureCondition(false, before, before)},
},
},
pressure: false,
expectConditions: []v1.NodeCondition{*makeMemoryPressureCondition(false, before, now)},
expectEvents: []testEvent{},
},
}
for _, tc := range cases {
t.Run(tc.desc, func(t *testing.T) {
events := []testEvent{}
recordEventFunc := func(eventType, event string) {
events = append(events, testEvent{
eventType: eventType,
event: event,
})
}
pressureFunc := func() bool {
return tc.pressure
}
// construct setter
setter := MemoryPressureCondition(nowFunc, pressureFunc, recordEventFunc)
// call setter on node
if err := setter(tc.node); err != nil {
t.Fatalf("unexpected error: %v", err)
}
// check expected condition
assert.True(t, apiequality.Semantic.DeepEqual(tc.expectConditions, tc.node.Status.Conditions),
"Diff: %s", diff.ObjectDiff(tc.expectConditions, tc.node.Status.Conditions))
// check expected events
require.Equal(t, len(tc.expectEvents), len(events))
for i := range tc.expectEvents {
assert.Equal(t, tc.expectEvents[i], events[i])
}
})
}
} | explode_data.jsonl/31858 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1545
} | [
2830,
3393,
10642,
68269,
10547,
1155,
353,
8840,
836,
8,
341,
80922,
1669,
882,
13244,
741,
63234,
1669,
1431,
1904,
4080,
1678,
32435,
340,
80922,
9626,
1669,
2915,
368,
882,
16299,
314,
470,
1431,
555,
1444,
2264,
1669,
3056,
1235,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestExecutorDisconnect(t *testing.T) {
mockDriver := &MockExecutorDriver{}
executor := NewTestKubernetesExecutor()
executor.Init(mockDriver)
executor.Registered(mockDriver, nil, nil, nil)
executor.Disconnected(mockDriver)
assert.Equal(t, false, executor.isConnected(),
"executor should not be connected after Disconnected")
mockDriver.AssertExpectations(t)
} | explode_data.jsonl/59740 | {
"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,
25255,
60651,
1155,
353,
8840,
836,
8,
341,
77333,
11349,
1669,
609,
11571,
25255,
11349,
16094,
67328,
4831,
1669,
1532,
2271,
42,
29827,
25255,
2822,
67328,
4831,
26849,
30389,
11349,
340,
67328,
4831,
19983,
291,
30389,
11349... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseIPPortIPv6(t *testing.T) {
ip := net.ParseIP("dead:beef::1")
port := uint16(8080)
gotIP, gotPort, err := parseIPPort("DEADBEEF000000000000000000000001:1F90")
if err != nil {
t.Fatal(err)
}
if !(gotIP.Equal(ip) && port == gotPort) {
t.Errorf("want %s:%d, have %s:%d", ip, port, gotIP, gotPort)
}
} | explode_data.jsonl/52485 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 149
} | [
2830,
3393,
14463,
3298,
7084,
58056,
21,
1155,
353,
8840,
836,
8,
341,
46531,
1669,
4179,
8937,
3298,
445,
33754,
25,
1371,
823,
486,
16,
1138,
52257,
1669,
2622,
16,
21,
7,
23,
15,
23,
15,
692,
3174,
354,
3298,
11,
2684,
7084,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFlow_Apply(tt *testing.T) {
tests := []struct {
name string
flow Flow
s []byte
want []byte
}{
{
name: "base",
flow: NewFlow(NewChain(bytes.ToLower, bytes.Title)),
s: []byte("hEllO, WoRld\nI aM aWare"),
want: []byte("Hello, World\nI Am Aware"),
},
{
name: "shortcut flow",
flow: NewFlow(NewChain(bytes.ToLower, bytes.Title)),
s: []byte("hEllO, WoRld"),
want: []byte("Hello, World"),
},
}
for _, test := range tests {
tt.Run(test.name, func(tt *testing.T) {
t := wrapt.WrapT(tt)
got := test.flow.Apply(test.s)
t.R.Equal(string(test.want), string(got))
})
}
} | explode_data.jsonl/75648 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 298
} | [
2830,
3393,
18878,
36117,
398,
47152,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
1166,
10303,
22452,
198,
197,
1903,
262,
3056,
3782,
198,
197,
50780,
3056,
3782,
198,
197,
59403,
197,
197,
515,
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 TestStoreSetRangesMaxBytes(t *testing.T) {
defer leaktest.AfterTest(t)
store, _, stopper := createTestStore(t)
defer stopper.Stop()
testData := []struct {
rng *Replica
expMaxBytes int64
}{
{store.LookupReplica(roachpb.RKeyMin, nil),
config.DefaultZoneConfig.RangeMaxBytes},
{splitTestRange(store, roachpb.RKeyMin, keys.MakeTablePrefix(1000), t),
1 << 20},
{splitTestRange(store, keys.MakeTablePrefix(1000), keys.MakeTablePrefix(1001), t),
config.DefaultZoneConfig.RangeMaxBytes},
{splitTestRange(store, keys.MakeTablePrefix(1001), keys.MakeTablePrefix(1002), t),
2 << 20},
}
// Set zone configs.
config.TestingSetZoneConfig(1000, &config.ZoneConfig{RangeMaxBytes: 1 << 20})
config.TestingSetZoneConfig(1002, &config.ZoneConfig{RangeMaxBytes: 2 << 20})
// Despite faking the zone configs, we still need to have a gossip entry.
if err := store.Gossip().AddInfoProto(gossip.KeySystemConfig, &config.SystemConfig{}, 0); err != nil {
t.Fatal(err)
}
if err := util.IsTrueWithin(func() bool {
for _, test := range testData {
if test.rng.GetMaxBytes() != test.expMaxBytes {
return false
}
}
return true
}, 500*time.Millisecond); err != nil {
t.Errorf("range max bytes values did not change as expected: %s", err)
}
} | explode_data.jsonl/44476 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 483
} | [
2830,
3393,
6093,
1649,
74902,
5974,
7078,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
340,
57279,
11,
8358,
2936,
712,
1669,
1855,
2271,
6093,
1155,
340,
16867,
2936,
712,
30213,
2822,
18185,
1043,
1669,
3056,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestReflect_string(t *testing.T) {
var expected, actual string = "howdy", ""
b := make([]byte, 6)
lex.PutString(b, expected)
lex.Reflect(b, &actual)
assert.Equal(t, expected, actual)
} | explode_data.jsonl/50150 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 76
} | [
2830,
3393,
72789,
3904,
1155,
353,
8840,
836,
8,
341,
2405,
3601,
11,
5042,
914,
284,
330,
5158,
10258,
497,
35829,
2233,
1669,
1281,
10556,
3782,
11,
220,
21,
340,
197,
2571,
39825,
703,
1883,
11,
3601,
692,
197,
2571,
18369,
767,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInboxTlfFinalize(t *testing.T) {
_, inbox, _ := setupInboxTest(t, "basic")
// Create an inbox with a bunch of convos, merge it and read it back out
numConvs := 10
var convs []types.RemoteConversation
for i := numConvs - 1; i >= 0; i-- {
convs = append(convs, makeConvo(gregor1.Time(i), 1, 1))
}
conv := convs[5]
require.NoError(t, inbox.Merge(context.TODO(), 1, utils.PluckConvs(convs), nil, nil))
require.NoError(t, inbox.TlfFinalize(context.TODO(), 2, []chat1.ConversationID{conv.GetConvID()},
chat1.ConversationFinalizeInfo{ResetFull: "reset"}))
_, res, _, err := inbox.Read(context.TODO(), nil, nil)
require.NoError(t, err)
require.Equal(t, len(convs), len(res), "length")
require.Equal(t, conv.GetConvID(), res[5].GetConvID(), "id")
require.NotNil(t, res[5].Conv.Metadata.FinalizeInfo, "finalize info")
err = inbox.TlfFinalize(context.TODO(), 10, []chat1.ConversationID{conv.GetConvID()},
chat1.ConversationFinalizeInfo{ResetFull: "reset"})
require.IsType(t, VersionMismatchError{}, err)
} | explode_data.jsonl/16808 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 419
} | [
2830,
3393,
641,
2011,
51,
11008,
19357,
551,
1155,
353,
8840,
836,
8,
1476,
197,
6878,
22883,
11,
716,
1669,
6505,
641,
2011,
2271,
1155,
11,
330,
22342,
5130,
197,
322,
4230,
458,
22883,
448,
264,
15493,
315,
5686,
436,
11,
10880,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStartChildSpan(t *testing.T) {
tr := NewTracer()
sp1 := tr.StartSpan("parent", Recordable)
StartRecording(sp1, SingleNodeRecording)
sp2 := StartChildSpan("child", sp1, nil /* logTags */, false /*separateRecording*/)
sp2.Finish()
sp1.Finish()
if err := TestingCheckRecordedSpans(GetRecording(sp1), `
span parent:
span child:
`); err != nil {
t.Fatal(err)
}
sp1 = tr.StartSpan("parent", Recordable)
StartRecording(sp1, SingleNodeRecording)
sp2 = StartChildSpan("child", sp1, nil /* logTags */, true /*separateRecording*/)
sp2.Finish()
sp1.Finish()
if err := TestingCheckRecordedSpans(GetRecording(sp1), `
span parent:
`); err != nil {
t.Fatal(err)
}
if err := TestingCheckRecordedSpans(GetRecording(sp2), `
span child:
`); err != nil {
t.Fatal(err)
}
sp1 = tr.StartSpan("parent", Recordable)
StartRecording(sp1, SingleNodeRecording)
sp2 = StartChildSpan(
"child", sp1, logtags.SingleTagBuffer("key", "val"), false, /*separateRecording*/
)
sp2.Finish()
sp1.Finish()
if err := TestingCheckRecordedSpans(GetRecording(sp1), `
span parent:
span child:
tags: key=val
`); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/51598 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 468
} | [
2830,
3393,
3479,
3652,
12485,
1155,
353,
8840,
836,
8,
341,
25583,
1669,
1532,
1282,
9584,
741,
41378,
16,
1669,
489,
12101,
12485,
445,
3765,
497,
13583,
480,
340,
65999,
52856,
22580,
16,
11,
11327,
1955,
52856,
340,
41378,
17,
1669,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestHelperProcess(t *testing.T) {
if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" {
return
}
fmt.Fprintf(os.Stdout, "fake result")
os.Exit(0)
} | explode_data.jsonl/14805 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 73
} | [
2830,
3393,
5511,
7423,
1155,
353,
8840,
836,
8,
341,
743,
2643,
64883,
445,
15513,
2763,
2821,
85331,
36199,
899,
961,
330,
16,
1,
341,
197,
853,
198,
197,
532,
11009,
59559,
9638,
83225,
11,
330,
30570,
1102,
1138,
25078,
34358,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestAccKeycloakAttributeToRoleIdentityProviderMapper_basic(t *testing.T) {
t.Parallel()
mapperName := acctest.RandomWithPrefix("tf-acc")
alias := acctest.RandomWithPrefix("tf-acc")
role := acctest.RandomWithPrefix("tf-acc")
claimName := acctest.RandomWithPrefix("tf-acc")
claimValue := acctest.RandomWithPrefix("tf-acc")
resource.Test(t, resource.TestCase{
ProviderFactories: testAccProviderFactories,
PreCheck: func() { testAccPreCheck(t) },
CheckDestroy: testAccCheckKeycloakAttributeToRoleIdentityProviderMapperDestroy(),
Steps: []resource.TestStep{
{
Config: testKeycloakAttributeToRoleIdentityProviderMapper_basic(alias, mapperName, role, claimName, claimValue),
Check: testAccCheckKeycloakAttributeToRoleIdentityProviderMapperExists("keycloak_attribute_to_role_identity_provider_mapper.oidc"),
},
},
})
} | explode_data.jsonl/33575 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 313
} | [
2830,
3393,
14603,
1592,
88751,
3907,
1249,
9030,
18558,
5179,
10989,
34729,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2109,
3106,
675,
1669,
1613,
67880,
26709,
2354,
14335,
445,
8935,
12,
4475,
1138,
197,
14956,
1669,
1613,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNew(t *testing.T) {
tests := []struct {
name string
args []string
envVars map[string]string
expectedNamespace string
}{
{
name: "default",
args: nil,
envVars: nil,
expectedNamespace: defaultOSMNamespace,
},
{
name: "flag overrides default",
args: []string{"--osm-namespace=osm-ns"},
envVars: nil,
expectedNamespace: "osm-ns",
},
{
name: "env var overrides default",
args: nil,
envVars: map[string]string{
osmNamespaceEnvVar: "osm-env",
},
expectedNamespace: "osm-env",
},
{
name: "flag overrides env var",
args: []string{"--osm-namespace=osm-ns"},
envVars: map[string]string{
osmNamespaceEnvVar: "osm-env",
},
expectedNamespace: "osm-ns",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
assert := tassert.New(t)
flags := pflag.NewFlagSet("test-new", pflag.ContinueOnError)
for k, v := range test.envVars {
oldv, found := os.LookupEnv(k)
defer func(k string, oldv string, found bool) {
var err error
if found {
err = os.Setenv(k, oldv)
} else {
err = os.Unsetenv(k)
}
assert.Nil(err)
}(k, oldv, found)
err := os.Setenv(k, v)
assert.Nil(err)
}
settings := New()
settings.AddFlags(flags)
err := flags.Parse(test.args)
assert.Nil(err)
assert.Equal(settings.Namespace(), test.expectedNamespace)
})
}
} | explode_data.jsonl/48268 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 776
} | [
2830,
3393,
3564,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
1060,
914,
198,
197,
31215,
1060,
3056,
917,
198,
197,
57538,
28305,
1843,
2415,
14032,
30953,
198,
197,
42400,
22699,
914,
198,
197,
59403,
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 TestGetVerKey(t *testing.T) {
k := newKMS(t, mockstorage.NewMockStoreProvider())
ctx := &context{
kms: k,
keyType: kms.ED25519Type,
keyAgreementType: kms.X25519ECDHKWType,
mediaTypeProfiles: []string{transport.MediaTypeRFC0019EncryptedEnvelope},
}
_, encKey := newSigningAndEncryptionDIDKeys(t, ctx)
t.Run("returns verkey from explicit oob invitation", func(t *testing.T) {
expected := newServiceBlock([]string{encKey}, []string{encKey}, didCommServiceType)
invitation := newOOBInvite(expected)
ctx.connectionRecorder = connRecorder(t, testProvider())
err := ctx.connectionRecorder.SaveInvitation(invitation.ThreadID, invitation)
require.NoError(t, err)
result, err := ctx.getVerKey(invitation.ThreadID)
require.NoError(t, err)
require.Equal(t, expected.RecipientKeys[0], result)
expected = newServiceBlock([]string{encKey}, []string{encKey}, didCommV2ServiceType)
invitation = newOOBInvite(expected)
ctx.connectionRecorder = connRecorder(t, testProvider())
err = ctx.connectionRecorder.SaveInvitation(invitation.ThreadID, invitation)
require.NoError(t, err)
result, err = ctx.getVerKey(invitation.ThreadID)
require.NoError(t, err)
require.Equal(t, expected.RecipientKeys[0], result)
})
t.Run("returns verkey from implicit oob invitation", func(t *testing.T) {
publicDID := createDIDDoc(t, ctx)
invitation := newOOBInvite(publicDID.ID)
ctx.connectionRecorder = connRecorder(t, testProvider())
ctx.vdRegistry = &mockvdr.MockVDRegistry{
ResolveValue: publicDID,
}
err := ctx.connectionRecorder.SaveInvitation(invitation.ThreadID, invitation)
require.NoError(t, err)
result, err := ctx.getVerKey(invitation.ThreadID)
require.NoError(t, err)
require.Equal(t, publicDID.Service[0].RecipientKeys[0], result)
})
t.Run("returns verkey from implicit (interop) oob invitation", func(t *testing.T) {
publicDID, err := diddoc.ParseDocument([]byte(sovDoc))
require.NoError(t, err)
invitation := newOOBInvite(publicDID.ID)
ctx.connectionRecorder = connRecorder(t, testProvider())
ctx.vdRegistry = &mockvdr.MockVDRegistry{
ResolveValue: publicDID,
}
ctx.doACAPyInterop = true
err = ctx.connectionRecorder.SaveInvitation(invitation.ThreadID, invitation)
require.NoError(t, err)
result, err := ctx.getVerKey(invitation.ThreadID)
require.NoError(t, err)
require.Equal(t, publicDID.Service[0].RecipientKeys[0], result)
ctx.doACAPyInterop = false
})
t.Run("returns verkey from explicit didexchange invitation", func(t *testing.T) {
expected := newServiceBlock([]string{encKey}, []string{encKey}, didCommServiceType)
invitation := newDidExchangeInvite("", expected)
ctx.connectionRecorder = connRecorder(t, testProvider())
err := ctx.connectionRecorder.SaveInvitation(invitation.ID, invitation)
require.NoError(t, err)
result, err := ctx.getVerKey(invitation.ID)
require.NoError(t, err)
require.Equal(t, expected.RecipientKeys[0], result)
expected = newServiceBlock([]string{encKey}, []string{encKey}, didCommV2ServiceType)
invitation = newDidExchangeInvite("", expected)
ctx.connectionRecorder = connRecorder(t, testProvider())
err = ctx.connectionRecorder.SaveInvitation(invitation.ID, invitation)
require.NoError(t, err)
result, err = ctx.getVerKey(invitation.ID)
require.NoError(t, err)
require.Equal(t, expected.RecipientKeys[0], result)
})
t.Run("returns verkey from implicit didexchange invitation", func(t *testing.T) {
publicDID := createDIDDoc(t, ctx)
ctx.connectionRecorder = connRecorder(t, testProvider())
ctx.vdRegistry = &mockvdr.MockVDRegistry{
ResolveValue: publicDID,
}
svc, found := diddoc.LookupService(publicDID, "did-communication")
require.True(t, found)
result, err := ctx.getVerKey(publicDID.ID)
require.NoError(t, err)
require.Equal(t, svc.RecipientKeys[0], result)
})
t.Run("fails for oob invitation with no target", func(t *testing.T) {
invalid := newOOBInvite(nil)
ctx.connectionRecorder = connRecorder(t, testProvider())
err := ctx.connectionRecorder.SaveInvitation(invalid.ThreadID, invalid)
require.NoError(t, err)
_, err = ctx.getVerKey(invalid.ThreadID)
require.Error(t, err)
})
t.Run("wraps error from store", func(t *testing.T) {
expected := errors.New("test")
pr := testProvider()
pr.StoreProvider = &mockstorage.MockStoreProvider{
Store: &mockstorage.MockStore{
Store: make(map[string]mockstorage.DBEntry),
ErrGet: expected,
},
}
ctx.connectionRecorder = connRecorder(t, pr)
invitation := newOOBInvite(newServiceBlock([]string{encKey}, []string{encKey}, didCommServiceType))
err := ctx.connectionRecorder.SaveInvitation(invitation.ID, invitation)
require.NoError(t, err)
invitation = newOOBInvite(newServiceBlock([]string{encKey}, []string{encKey}, didCommV2ServiceType))
err = ctx.connectionRecorder.SaveInvitation(invitation.ID, invitation)
require.NoError(t, err)
_, err = ctx.getVerKey(invitation.ID)
require.Error(t, err)
})
t.Run("wraps error from vdr resolution", func(t *testing.T) {
expected := errors.New("test")
ctx.connectionRecorder = connRecorder(t, testProvider())
ctx.vdRegistry = &mockvdr.MockVDRegistry{
ResolveErr: expected,
}
_, err := ctx.getVerKey("did:example:123")
require.Error(t, err)
require.True(t, errors.Is(err, expected))
})
} | explode_data.jsonl/2111 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2036
} | [
2830,
3393,
1949,
10141,
1592,
1155,
353,
8840,
836,
8,
341,
16463,
1669,
501,
42,
4826,
1155,
11,
7860,
16172,
7121,
11571,
6093,
5179,
2398,
20985,
1669,
609,
2147,
515,
197,
16463,
1011,
25,
2290,
595,
345,
197,
23634,
929,
25,
184... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMigrateFromVersion7(t *testing.T) {
sourceStore := v7datas.NewDatabase(v7chunks.NewMemoryStore())
sinkStore := datas.NewDatabase(chunks.NewMemoryStore())
test := func(expected types.Value, source v7types.Value) {
actual, err := MigrateFromVersion7(source, sourceStore, sinkStore)
assert.NoError(t, err)
assert.True(t, actual.Equals(expected))
}
test(types.Bool(true), v7types.Bool(true))
test(types.Bool(false), v7types.Bool(false))
test(types.Number(-42), v7types.Number(-42))
test(types.Number(-1.23456789), v7types.Number(-1.23456789))
test(types.Number(0), v7types.Number(0))
test(types.Number(1.23456789), v7types.Number(1.23456789))
test(types.Number(42), v7types.Number(42))
test(types.String(""), v7types.String(""))
test(types.String("Hello World"), v7types.String("Hello World"))
test(types.String("💩"), v7types.String("💩"))
test(types.NewBlob(bytes.NewBuffer([]byte{})), v7types.NewBlob(bytes.NewBuffer([]byte{})))
test(types.NewBlob(bytes.NewBufferString("hello")), v7types.NewBlob(bytes.NewBufferString("hello")))
test(types.NewList(), v7types.NewList())
test(types.NewList(types.Bool(true)), v7types.NewList(v7types.Bool(true)))
test(types.NewList(types.Bool(true), types.String("hi")), v7types.NewList(v7types.Bool(true), v7types.String("hi")))
test(types.NewSet(), v7types.NewSet())
test(types.NewSet(types.Bool(true)), v7types.NewSet(v7types.Bool(true)))
test(types.NewSet(types.Bool(true), types.String("hi")), v7types.NewSet(v7types.Bool(true), v7types.String("hi")))
test(types.NewMap(), v7types.NewMap())
test(types.NewMap(types.Bool(true), types.String("hi")), v7types.NewMap(v7types.Bool(true), v7types.String("hi")))
test(types.NewStruct("", types.StructData{}), v7types.NewStruct("", v7types.StructData{}))
test(types.NewStruct("xyz", types.StructData{}), v7types.NewStruct("xyz", v7types.StructData{}))
test(types.NewStruct("T", types.StructData{}), v7types.NewStruct("T", v7types.StructData{}))
test(types.NewStruct("T", types.StructData{
"x": types.Number(42),
"s": types.String("hi"),
"b": types.Bool(false),
}), v7types.NewStruct("T", v7types.StructData{
"x": v7types.Number(42),
"s": v7types.String("hi"),
"b": v7types.Bool(false),
}))
test(
types.NewStructWithType(
types.MakeStructType("", []string{"a"}, []*types.Type{types.NumberType}),
[]types.Value{types.Number(42)},
),
v7types.NewStructWithType(
v7types.MakeStructType("", []string{"a"}, []*v7types.Type{v7types.NumberType}),
[]v7types.Value{v7types.Number(42)},
),
)
test(
types.NewStructWithType(
types.MakeStructType("",
[]string{"a"},
[]*types.Type{types.MakeListType(types.MakeCycleType(0))},
),
[]types.Value{types.NewList()},
),
v7types.NewStructWithType(
v7types.MakeStructType("",
[]string{"a"},
[]*v7types.Type{v7types.MakeListType(v7types.MakeCycleType(0))},
),
[]v7types.Value{v7types.NewList()},
),
)
r := sourceStore.WriteValue(v7types.Number(123))
test(types.NewRef(types.Number(123)), r)
v := sinkStore.ReadValue(types.Number(123).Hash())
assert.True(t, types.Number(123).Equals(v))
// Types
test(types.BoolType, v7types.BoolType)
test(types.NumberType, v7types.NumberType)
test(types.StringType, v7types.StringType)
test(types.BlobType, v7types.BlobType)
test(types.TypeType, v7types.TypeType)
test(types.ValueType, v7types.ValueType)
test(types.MakeListType(types.NumberType), v7types.MakeListType(types.NumberType))
test(types.MakeListType(types.NumberType).Type(), v7types.MakeListType(types.NumberType).Type())
test(types.MakeListType(types.NumberType), v7types.MakeListType(v7types.NumberType))
test(types.MakeSetType(types.NumberType), v7types.MakeSetType(v7types.NumberType))
test(types.MakeRefType(types.NumberType), v7types.MakeRefType(v7types.NumberType))
test(types.MakeMapType(types.NumberType, types.StringType), v7types.MakeMapType(v7types.NumberType, v7types.StringType))
test(types.MakeUnionType(), v7types.MakeUnionType())
test(types.MakeUnionType(types.StringType, types.BoolType), v7types.MakeUnionType(v7types.StringType, v7types.BoolType))
test(types.MakeCycleType(42), v7types.MakeCycleType(42))
commitFieldNames := []string{"parents", "value"}
commit := types.MakeStructType("Commit", commitFieldNames, []*types.Type{
types.MakeSetType(types.MakeRefType(types.MakeStructType("Commit", commitFieldNames, []*types.Type{
types.MakeSetType(types.MakeRefType(types.MakeCycleType(0))),
types.MakeUnionType(types.NumberType, types.StringType),
}))),
types.StringType,
})
commit7 := v7types.MakeStructType("Commit", commitFieldNames, []*v7types.Type{
v7types.MakeSetType(v7types.MakeRefType(v7types.MakeStructType("Commit", commitFieldNames, []*v7types.Type{
v7types.MakeSetType(v7types.MakeRefType(v7types.MakeCycleType(0))),
v7types.MakeUnionType(v7types.NumberType, v7types.StringType),
}))),
v7types.StringType,
})
test(commit, commit7)
} | explode_data.jsonl/73964 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1958
} | [
2830,
3393,
44,
34479,
3830,
5637,
22,
1155,
353,
8840,
836,
8,
341,
47418,
6093,
1669,
348,
22,
27240,
7121,
5988,
3747,
22,
84263,
7121,
10642,
6093,
2398,
1903,
766,
6093,
1669,
16879,
7121,
5988,
7520,
15296,
7121,
10642,
6093,
1236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMainAndExtPolicyCompilerReversed(t *testing.T) {
policyDecision := policyCompilerMainAndExtReversed("fraud-detection")
mainPMpolicies := tu.GetMainPMDecisions("fraud-detection")
extPMpolicies := tu.GetExtPMDecisions("fraud-detection")
tu.CheckPolicies(t, policyDecision, mainPMpolicies, extPMpolicies)
policyDecision2 := policyCompilerMainAndExtReversed("marketing")
mainPMpolicies2 := tu.GetMainPMDecisions("marketing")
extPMpolicies2 := tu.GetExtPMDecisions("marketing")
tu.CheckPolicies(t, policyDecision2, mainPMpolicies2, extPMpolicies2)
} | explode_data.jsonl/42362 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 204
} | [
2830,
3393,
6202,
3036,
6756,
13825,
38406,
693,
43776,
1155,
353,
8840,
836,
8,
341,
3223,
8018,
74846,
1669,
4842,
38406,
6202,
3036,
6756,
693,
43776,
445,
42289,
661,
1737,
22280,
1138,
36641,
8795,
79,
42038,
1669,
9765,
2234,
6202,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateChain(t *testing.T) {
fakeCARoots := NewPEMCertPool()
if !fakeCARoots.AppendCertsFromPEM([]byte(testonly.FakeCACertPEM)) {
t.Fatal("failed to load fake root")
}
if !fakeCARoots.AppendCertsFromPEM([]byte(testonly.FakeRootCACertPEM)) {
t.Fatal("failed to load fake root")
}
if !fakeCARoots.AppendCertsFromPEM([]byte(testonly.CACertPEM)) {
t.Fatal("failed to load CA root")
}
validateOpts := CertValidationOpts{
trustedRoots: fakeCARoots,
extKeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageAny},
}
var tests = []struct {
desc string
chain [][]byte
wantErr bool
wantPathLen int
modifyOpts func(v *CertValidationOpts)
}{
{
desc: "missing-intermediate-cert",
chain: pemsToDERChain(t, []string{testonly.LeafSignedByFakeIntermediateCertPEM}),
wantErr: true,
},
{
desc: "wrong-cert-order",
chain: pemsToDERChain(t, []string{testonly.FakeIntermediateCertPEM, testonly.LeafSignedByFakeIntermediateCertPEM}),
wantErr: true,
},
{
desc: "unrelated-cert-in-chain",
chain: pemsToDERChain(t, []string{testonly.FakeIntermediateCertPEM, testonly.TestCertPEM}),
wantErr: true,
},
{
desc: "unrelated-cert-after-chain",
chain: pemsToDERChain(t, []string{testonly.LeafSignedByFakeIntermediateCertPEM, testonly.FakeIntermediateCertPEM, testonly.TestCertPEM}),
wantErr: true,
},
{
desc: "valid-chain",
chain: pemsToDERChain(t, []string{testonly.LeafSignedByFakeIntermediateCertPEM, testonly.FakeIntermediateCertPEM}),
wantPathLen: 3,
},
{
desc: "valid-chain-with-policyconstraints",
chain: pemsToDERChain(t, []string{testonly.LeafCertPEM, testonly.FakeIntermediateWithPolicyConstraintsCertPEM}),
wantPathLen: 3,
},
{
desc: "valid-chain-with-policyconstraints-inc-root",
chain: pemsToDERChain(t, []string{testonly.LeafCertPEM, testonly.FakeIntermediateWithPolicyConstraintsCertPEM, testonly.FakeRootCACertPEM}),
wantPathLen: 3,
},
{
desc: "valid-chain-with-nameconstraints",
chain: pemsToDERChain(t, []string{testonly.LeafCertPEM, testonly.FakeIntermediateWithNameConstraintsCertPEM}),
wantPathLen: 3,
},
{
desc: "chain-with-invalid-nameconstraints",
chain: pemsToDERChain(t, []string{testonly.LeafCertPEM, testonly.FakeIntermediateWithInvalidNameConstraintsCertPEM}),
wantPathLen: 3,
},
{
desc: "chain-of-len-4",
chain: pemFileToDERChain(t, "../testdata/subleaf.chain"),
wantPathLen: 4,
},
{
desc: "misordered-chain-of-len-4",
chain: pemFileToDERChain(t, "../testdata/subleaf.misordered.chain"),
wantErr: true,
},
{
desc: "reject-non-existent-ext-id",
chain: pemsToDERChain(t, []string{testonly.LeafSignedByFakeIntermediateCertPEM, testonly.FakeIntermediateCertPEM}),
modifyOpts: func(v *CertValidationOpts) {
// reject SubjectKeyIdentifier extension
v.rejectExtIds = []asn1.ObjectIdentifier{[]int{99, 99, 99, 99}}
},
wantPathLen: 3,
},
{
desc: "reject-non-existent-ext-id-precert",
chain: pemsToDERChain(t, []string{testonly.PrecertPEMValid}),
modifyOpts: func(v *CertValidationOpts) {
// reject SubjectKeyIdentifier extension
v.rejectExtIds = []asn1.ObjectIdentifier{[]int{99, 99, 99, 99}}
},
wantPathLen: 2,
},
{
desc: "reject-ext-id",
chain: pemsToDERChain(t, []string{testonly.LeafSignedByFakeIntermediateCertPEM, testonly.FakeIntermediateCertPEM}),
wantErr: true,
modifyOpts: func(v *CertValidationOpts) {
// reject SubjectKeyIdentifier extension
v.rejectExtIds = []asn1.ObjectIdentifier{[]int{2, 5, 29, 14}}
},
},
{
desc: "reject-ext-id-precert",
chain: pemsToDERChain(t, []string{testonly.PrecertPEMValid}),
wantErr: true,
modifyOpts: func(v *CertValidationOpts) {
// reject SubjectKeyIdentifier extension
v.rejectExtIds = []asn1.ObjectIdentifier{[]int{2, 5, 29, 14}}
},
},
}
for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
validateOpts := validateOpts
if test.modifyOpts != nil {
test.modifyOpts(&validateOpts)
}
gotPath, err := ValidateChain(test.chain, validateOpts)
if err != nil {
if !test.wantErr {
t.Errorf("ValidateChain()=%v,%v; want _,nil", gotPath, err)
}
return
}
if test.wantErr {
t.Errorf("ValidateChain()=%v,%v; want _,non-nil", gotPath, err)
return
}
if len(gotPath) != test.wantPathLen {
t.Errorf("|ValidateChain()|=%d; want %d", len(gotPath), test.wantPathLen)
for _, c := range gotPath {
t.Logf("Subject: %s Issuer: %s", x509util.NameToString(c.Subject), x509util.NameToString(c.Issuer))
}
}
})
}
} | explode_data.jsonl/13639 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2145
} | [
2830,
3393,
17926,
18837,
1155,
353,
8840,
836,
8,
341,
1166,
726,
36390,
1905,
82,
1669,
1532,
1740,
11604,
529,
10551,
741,
743,
753,
30570,
36390,
1905,
82,
8982,
34,
15546,
3830,
1740,
44,
10556,
3782,
8623,
3243,
991,
726,
92832,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGenerateEtcdEncryptionKey(t *testing.T) {
key1 := generateEtcdEncryptionKey()
key2 := generateEtcdEncryptionKey()
if key1 == key2 {
t.Fatalf("generateEtcdEncryptionKey should return a unique key each time, instead returned identical %s and %s", key1, key2)
}
for _, val := range []string{key1, key2} {
_, err := base64.StdEncoding.DecodeString(val)
if err != nil {
t.Fatalf("generateEtcdEncryptionKey should return a base64 encoded key, instead returned %s", val)
}
}
} | explode_data.jsonl/33871 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 183
} | [
2830,
3393,
31115,
31860,
4385,
79239,
1592,
1155,
353,
8840,
836,
8,
341,
23634,
16,
1669,
6923,
31860,
4385,
79239,
1592,
741,
23634,
17,
1669,
6923,
31860,
4385,
79239,
1592,
741,
743,
1376,
16,
621,
1376,
17,
341,
197,
3244,
30762,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewCephDaemonResources(t *testing.T) {
cases := []struct {
name string
spec *api.StorageCluster
expected map[string]corev1.ResourceRequirements
}{
{
name: "When nothing is passed to StorageCluster.Spec.Resources (Defaults)",
spec: &api.StorageCluster{
Spec: api.StorageClusterSpec{
Resources: map[string]corev1.ResourceRequirements{},
},
},
expected: map[string]corev1.ResourceRequirements{
"mon": defaults.DaemonResources["mon"],
"mgr": defaults.DaemonResources["mgr"],
"mds": defaults.DaemonResources["mds"],
"rgw": defaults.DaemonResources["rgw"],
},
},
{
name: "Overriding defaults",
spec: &api.StorageCluster{
Spec: api.StorageClusterSpec{
Resources: map[string]corev1.ResourceRequirements{
"mds": {
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
},
},
},
},
expected: map[string]corev1.ResourceRequirements{
"mon": defaults.DaemonResources["mon"],
"mgr": defaults.DaemonResources["mgr"],
"mds": {
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
},
"rgw": defaults.DaemonResources["rgw"],
},
},
{
name: "Passing a new key",
spec: &api.StorageCluster{
Spec: api.StorageClusterSpec{
Resources: map[string]corev1.ResourceRequirements{
"crashcollector": {
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
},
},
},
},
expected: map[string]corev1.ResourceRequirements{
"mon": defaults.DaemonResources["mon"],
"mgr": defaults.DaemonResources["mgr"],
"mds": defaults.DaemonResources["mds"],
"rgw": defaults.DaemonResources["rgw"],
"crashcollector": {
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("6"),
corev1.ResourceMemory: resource.MustParse("16Gi"),
},
},
},
},
{
name: "When nothing is passed to StorageCluster.Spec.Resources (Defaults) and arbiter is enabled",
spec: &api.StorageCluster{
Spec: api.StorageClusterSpec{
Resources: map[string]corev1.ResourceRequirements{},
Arbiter: api.ArbiterSpec{
Enable: true,
},
},
},
expected: map[string]corev1.ResourceRequirements{
"mon": defaults.DaemonResources["mon"],
"mgr": defaults.DaemonResources["mgr"],
"mds": defaults.DaemonResources["mds"],
"rgw": defaults.DaemonResources["rgw"],
"mgr-sidecar": defaults.DaemonResources["mgr-sidecar"],
},
},
}
for _, c := range cases {
t.Logf("Case: %s\n", c.name)
got := newCephDaemonResources(c.spec)
assert.DeepEqual(t, c.expected, got)
}
} | explode_data.jsonl/16370 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1603
} | [
2830,
3393,
3564,
34,
23544,
89177,
11277,
1155,
353,
8840,
836,
8,
1476,
1444,
2264,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
98100,
257,
353,
2068,
43771,
28678,
198,
197,
42400,
2415,
14032,
60,
98645,
16,
20766,
59202,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDownloadMultiList(t *testing.T) {
var (
l = []string{
"https://raw.githubusercontent.com/NVIDIA/aistore/master/README.md",
"https://raw.githubusercontent.com/kubernetes/kubernetes/master/LICENSE?query=values",
}
expectedObjs = []string{"LICENSE", "README.md"}
proxyURL = tutils.RandomProxyURL(t)
baseParams = tutils.BaseAPIParams(proxyURL)
)
runProviderTests(t, func(t *testing.T, bck *cluster.Bck) {
m := ioContext{
t: t,
bck: bck.Bck,
}
m.initWithCleanup()
defer m.del()
clearDownloadList(t)
id, err := api.DownloadMulti(baseParams, generateDownloadDesc(), bck.Bck, l)
tassert.CheckFatal(t, err)
waitForDownload(t, id, 30*time.Second)
checkDownloadedObjects(t, id, bck.Bck, expectedObjs)
checkDownloadList(t)
})
} | explode_data.jsonl/70380 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 339
} | [
2830,
3393,
11377,
20358,
852,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
8810,
284,
3056,
917,
515,
298,
197,
57557,
1110,
1041,
50927,
905,
20290,
29352,
14186,
380,
460,
23303,
14,
54675,
21324,
756,
298,
197,
57557,
1110,
1041,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDB_e2e(t *testing.T) {
const (
numDatapoints = 1000
numRanges = 1000
timeInterval = int64(3)
)
// Create 8 series with 1000 data-points of different ranges and run queries.
lbls := [][]labels.Label{
{
{Name: "a", Value: "b"},
{Name: "instance", Value: "localhost:9090"},
{Name: "job", Value: "prometheus"},
},
{
{Name: "a", Value: "b"},
{Name: "instance", Value: "127.0.0.1:9090"},
{Name: "job", Value: "prometheus"},
},
{
{Name: "a", Value: "b"},
{Name: "instance", Value: "127.0.0.1:9090"},
{Name: "job", Value: "prom-k8s"},
},
{
{Name: "a", Value: "b"},
{Name: "instance", Value: "localhost:9090"},
{Name: "job", Value: "prom-k8s"},
},
{
{Name: "a", Value: "c"},
{Name: "instance", Value: "localhost:9090"},
{Name: "job", Value: "prometheus"},
},
{
{Name: "a", Value: "c"},
{Name: "instance", Value: "127.0.0.1:9090"},
{Name: "job", Value: "prometheus"},
},
{
{Name: "a", Value: "c"},
{Name: "instance", Value: "127.0.0.1:9090"},
{Name: "job", Value: "prom-k8s"},
},
{
{Name: "a", Value: "c"},
{Name: "instance", Value: "localhost:9090"},
{Name: "job", Value: "prom-k8s"},
},
}
seriesMap := map[string][]tsdbutil.Sample{}
for _, l := range lbls {
seriesMap[labels.New(l...).String()] = []tsdbutil.Sample{}
}
db, delete := openTestDB(t, nil)
defer func() {
testutil.Ok(t, db.Close())
delete()
}()
app := db.Appender()
for _, l := range lbls {
lset := labels.New(l...)
series := []tsdbutil.Sample{}
ts := rand.Int63n(300)
for i := 0; i < numDatapoints; i++ {
v := rand.Float64()
series = append(series, sample{ts, v})
_, err := app.Add(lset, ts, v)
testutil.Ok(t, err)
ts += rand.Int63n(timeInterval) + 1
}
seriesMap[lset.String()] = series
}
testutil.Ok(t, app.Commit())
// Query each selector on 1000 random time-ranges.
queries := []struct {
ms []labels.Matcher
}{
{
ms: []labels.Matcher{labels.NewEqualMatcher("a", "b")},
},
{
ms: []labels.Matcher{
labels.NewEqualMatcher("a", "b"),
labels.NewEqualMatcher("job", "prom-k8s"),
},
},
{
ms: []labels.Matcher{
labels.NewEqualMatcher("a", "c"),
labels.NewEqualMatcher("instance", "localhost:9090"),
labels.NewEqualMatcher("job", "prometheus"),
},
},
// TODO: Add Regexp Matchers.
}
for _, qry := range queries {
matched := labels.Slice{}
for _, ls := range lbls {
s := labels.Selector(qry.ms)
if s.Matches(ls) {
matched = append(matched, ls)
}
}
sort.Sort(matched)
for i := 0; i < numRanges; i++ {
mint := rand.Int63n(300)
maxt := mint + rand.Int63n(timeInterval*int64(numDatapoints))
expected := map[string][]tsdbutil.Sample{}
// Build the mockSeriesSet.
for _, m := range matched {
smpls := boundedSamples(seriesMap[m.String()], mint, maxt)
if len(smpls) > 0 {
expected[m.String()] = smpls
}
}
q, err := db.Querier(mint, maxt)
testutil.Ok(t, err)
ss, err := q.Select(qry.ms...)
testutil.Ok(t, err)
result := map[string][]tsdbutil.Sample{}
for ss.Next() {
x := ss.At()
smpls, err := expandSeriesIterator(x.Iterator())
testutil.Ok(t, err)
if len(smpls) > 0 {
result[x.Labels().String()] = smpls
}
}
testutil.Ok(t, ss.Err())
testutil.Equals(t, expected, result)
q.Close()
}
}
} | explode_data.jsonl/64372 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1617
} | [
2830,
3393,
3506,
2204,
17,
68,
1155,
353,
8840,
836,
8,
341,
4777,
2399,
197,
22431,
45696,
391,
14399,
284,
220,
16,
15,
15,
15,
198,
197,
22431,
74902,
257,
284,
220,
16,
15,
15,
15,
198,
197,
21957,
10256,
220,
284,
526,
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 TestJournal(t *testing.T) {
if testing.Short() {
t.Skip()
}
execStatements(t, []string{
"create table _vt.resharding_journal(id int, db_name varchar(128), val blob, primary key(id))",
})
defer execStatements(t, []string{
"drop table _vt.resharding_journal",
})
engine.se.Reload(context.Background())
journal1 := &binlogdatapb.Journal{
Id: 1,
MigrationType: binlogdatapb.MigrationType_SHARDS,
}
journal2 := &binlogdatapb.Journal{
Id: 2,
MigrationType: binlogdatapb.MigrationType_SHARDS,
}
testcases := []testcase{{
input: []string{
"begin",
fmt.Sprintf("insert into _vt.resharding_journal values(1, 'vttest', '%v')", journal1.String()),
fmt.Sprintf("insert into _vt.resharding_journal values(2, 'nosend', '%v')", journal2.String()),
"commit",
},
// External table events don't get sent.
output: [][]string{{
`begin`,
`type:JOURNAL journal:{id:1 migration_type:SHARDS}`,
`gtid`,
`commit`,
}},
}}
runCases(t, nil, testcases, "", nil)
} | explode_data.jsonl/10424 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 438
} | [
2830,
3393,
43494,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
741,
197,
630,
67328,
93122,
1155,
11,
3056,
917,
515,
197,
197,
1,
3182,
1965,
716,
9708,
13,
2488,
28410,
85075,
3724,
526,
11,
2927,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestKeylevelValidationPolicyRetrievalFailure(t *testing.T) {
t.Parallel()
// Scenario: we validate a transaction that updates
// the key-level validation parameters for a key.
// we simulate the case where we fail to retrieve
// the validation parameters from the ledger.
mr := &mockState{GetStateMetadataErr: fmt.Errorf("metadata retrieval failure")}
ms := &mockStateFetcher{FetchStateRv: mr}
pm := &KeyLevelValidationParameterManagerImpl{PolicyTranslator: &mockTranslator{}, StateFetcher: ms}
validator := NewKeyLevelValidator(NewV13Evaluator(&mockPolicyEvaluator{}, pm), pm)
rwsb := rwsetBytes(t, "cc")
prp := []byte("barf")
block := buildBlockWithTxs(buildTXWithRwset(rwsetUpdatingMetadataFor("cc", "key")), buildTXWithRwset(rwsetUpdatingMetadataFor("cc", "key")))
validator.PreValidate(1, block)
go func() {
validator.PostValidate("cc", 1, 0, fmt.Errorf(""))
}()
err := validator.Validate("cc", 1, 1, rwsb, prp, []byte("CCEP"), []*pb.Endorsement{})
assert.Error(t, err)
assert.IsType(t, &errors.VSCCExecutionFailureError{}, err)
} | explode_data.jsonl/80489 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 380
} | [
2830,
3393,
6608,
967,
889,
13799,
13825,
12020,
7231,
831,
17507,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
322,
58663,
25,
582,
9593,
264,
7745,
429,
8837,
198,
197,
322,
279,
1376,
11591,
10519,
5029,
369,
264,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestReadASN1(t *testing.T) {
for _, test := range readASN1TestData {
t.Run(test.name, func(t *testing.T) {
var in, out String = test.in, nil
ok := in.ReadASN1(&out, test.tag)
if ok != test.ok || ok && !bytes.Equal(out, test.out.([]byte)) {
t.Errorf("in.ReadASN1() = %v, want %v; out = %v, want %v", ok, test.ok, out, test.out)
}
})
}
} | explode_data.jsonl/16720 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 172
} | [
2830,
3393,
4418,
68134,
16,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
1349,
68134,
16,
83920,
341,
197,
3244,
16708,
8623,
2644,
11,
2915,
1155,
353,
8840,
836,
8,
341,
298,
2405,
304,
11,
700,
923,
284,
1273,
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... | 4 |
func TestListCDSVolume(t *testing.T) {
queryArgs := &ListCDSVolumeArgs{
MaxKeys: 100,
InstanceId: "InstanceId",
Marker: "VolumeId",
ZoneName: "zoneName",
}
if res, err := BBC_CLIENT.ListCDSVolume(queryArgs); err != nil {
fmt.Println("list volume failed: ", err)
} else {
fmt.Println("list volume success, result: ", res)
}
} | explode_data.jsonl/4093 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 144
} | [
2830,
3393,
852,
34,
5936,
18902,
1155,
353,
8840,
836,
8,
341,
27274,
4117,
1669,
609,
852,
34,
5936,
18902,
4117,
515,
197,
197,
5974,
8850,
25,
262,
220,
16,
15,
15,
345,
197,
197,
65918,
25,
330,
65918,
756,
197,
197,
20613,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestGetSetClearMapFields_ValueTypes(t *testing.T) {
fd, err := desc.LoadFileDescriptor("desc_test_field_types.proto")
testutil.Ok(t, err)
md := fd.FindSymbol("testprotos.MapValFields").(*desc.MessageDescriptor)
dm := NewMessage(md)
inputs := map[reflect.Kind]interface{}{
reflect.Bool: true,
reflect.Int32: int32(-12),
reflect.Int64: int64(-1234),
reflect.Uint32: uint32(45),
reflect.Uint64: uint64(4567),
reflect.Float32: float32(2.718),
reflect.Float64: float64(3.14159),
reflect.String: "foobar",
reflect.Slice: []byte("snafu"),
}
mapKinds := []func(interface{}) interface{}{
// index 0 will not work since it doesn't return a map
func(v interface{}) interface{} {
return v
},
func(v interface{}) interface{} {
// generic slice
return map[interface{}]interface{}{"foo": v, "bar": v, "baz": v}
},
func(v interface{}) interface{} {
// specific key and value types
mp := reflect.MakeMap(reflect.MapOf(typeOfString, reflect.TypeOf(v)))
val := reflect.ValueOf(v)
mp.SetMapIndex(reflect.ValueOf("foo"), val)
mp.SetMapIndex(reflect.ValueOf("bar"), val)
mp.SetMapIndex(reflect.ValueOf("baz"), val)
return mp.Interface()
},
}
cases := []struct {
kind reflect.Kind
tagNumber int
fieldName string
}{
{kind: reflect.Int32, tagNumber: 1, fieldName: "i"},
{kind: reflect.Int64, tagNumber: 2, fieldName: "j"},
{kind: reflect.Int32, tagNumber: 3, fieldName: "k"},
{kind: reflect.Int64, tagNumber: 4, fieldName: "l"},
{kind: reflect.Uint32, tagNumber: 5, fieldName: "m"},
{kind: reflect.Uint64, tagNumber: 6, fieldName: "n"},
{kind: reflect.Uint32, tagNumber: 7, fieldName: "o"},
{kind: reflect.Uint64, tagNumber: 8, fieldName: "p"},
{kind: reflect.Int32, tagNumber: 9, fieldName: "q"},
{kind: reflect.Int64, tagNumber: 10, fieldName: "r"},
{kind: reflect.Float32, tagNumber: 11, fieldName: "s"},
{kind: reflect.Float64, tagNumber: 12, fieldName: "t"},
{kind: reflect.Slice, tagNumber: 13, fieldName: "u"},
{kind: reflect.String, tagNumber: 14, fieldName: "v"},
{kind: reflect.Bool, tagNumber: 15, fieldName: "w"},
}
zero := reflect.Zero(typeOfGenericMap).Interface()
for idx, c := range cases {
for k, i := range inputs {
allowed := canAssign(c.kind, k)
for j, mk := range mapKinds {
// First run the case using Try* methods
v, err := dm.TryGetFieldByNumber(c.tagNumber)
testutil.Ok(t, err)
testutil.Eq(t, zero, v)
v, err = dm.TryGetFieldByName(c.fieldName)
testutil.Ok(t, err)
testutil.Eq(t, zero, v)
input := mk(i)
err = dm.TrySetFieldByNumber(c.tagNumber, input)
if shouldTestValue(t, err, j != 0 && allowed, k, c.kind, idx) {
// make sure value stuck
v, err = dm.TryGetFieldByNumber(c.tagNumber)
testutil.Ok(t, err)
testutil.Eq(t, typeOfGenericMap, reflect.TypeOf(v))
testutil.Eq(t, coerceMapVals(input, c.kind), v)
}
err = dm.TryClearFieldByNumber(c.tagNumber)
testutil.Ok(t, err)
v, err = dm.TryGetFieldByNumber(c.tagNumber)
testutil.Ok(t, err)
testutil.Eq(t, zero, v)
err = dm.TrySetFieldByName(c.fieldName, input)
if shouldTestValue(t, err, j != 0 && allowed, k, c.kind, idx) {
// make sure value stuck
v, err = dm.TryGetFieldByName(c.fieldName)
testutil.Ok(t, err)
testutil.Eq(t, typeOfGenericMap, reflect.TypeOf(v))
testutil.Eq(t, coerceMapVals(input, c.kind), v)
}
err = dm.TryClearFieldByName(c.fieldName)
testutil.Ok(t, err)
v, err = dm.TryGetFieldByName(c.fieldName)
testutil.Ok(t, err)
testutil.Eq(t, zero, v)
// Now we do it again using the non-Try* methods (e.g. the ones that panic)
v = dm.GetFieldByNumber(c.tagNumber)
testutil.Eq(t, zero, v)
v = dm.GetFieldByName(c.fieldName)
testutil.Eq(t, zero, v)
err = catchPanic(func() { dm.SetFieldByNumber(c.tagNumber, input) })
if shouldTestValue(t, err, j != 0 && allowed, k, c.kind, idx) {
// make sure value stuck
v = dm.GetFieldByNumber(c.tagNumber)
testutil.Eq(t, typeOfGenericMap, reflect.TypeOf(v))
testutil.Eq(t, coerceMapVals(input, c.kind), v)
}
dm.ClearFieldByNumber(c.tagNumber)
v = dm.GetFieldByNumber(c.tagNumber)
testutil.Eq(t, zero, v)
err = catchPanic(func() { dm.SetFieldByName(c.fieldName, input) })
if shouldTestValue(t, err, j != 0 && allowed, k, c.kind, idx) {
// make sure value stuck
v = dm.GetFieldByName(c.fieldName)
testutil.Eq(t, typeOfGenericMap, reflect.TypeOf(v))
testutil.Eq(t, coerceMapVals(input, c.kind), v)
}
dm.ClearFieldByName(c.fieldName)
v = dm.GetFieldByName(c.fieldName)
testutil.Eq(t, zero, v)
}
}
}
} | explode_data.jsonl/40955 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2091
} | [
2830,
3393,
1949,
1649,
14008,
2227,
8941,
27867,
4173,
1155,
353,
8840,
836,
8,
341,
61721,
11,
1848,
1669,
6560,
13969,
1703,
11709,
445,
8614,
4452,
5013,
9763,
57322,
1138,
18185,
1314,
54282,
1155,
11,
1848,
340,
84374,
1669,
12414,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDrawWhenArriveAtTheSameCell(t *testing.T) {
b := cleanBoard()
b.Grid[6][8] = P1Head
b.Grid[8][8] = P2Head
w, _ := b.Advance()
assert.Equal(t, w, (Winner)(Draw))
assert.Equal(t, b.Grid[7][8], (Cell)(Crash))
} | explode_data.jsonl/7803 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 104
} | [
2830,
3393,
8137,
4498,
8838,
533,
1655,
785,
19198,
3599,
1155,
353,
8840,
836,
8,
341,
2233,
1669,
4240,
11932,
741,
2233,
18578,
58,
21,
1457,
23,
60,
284,
393,
16,
12346,
198,
2233,
18578,
58,
23,
1457,
23,
60,
284,
393,
17,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSqlmapper(t *testing.T) {
t.Log("====>TestSqlmapper")
var db *sql.DB
// db = GetDB() // get db in your own way
if db == nil {
t.Log("db is nil.")
return
}
ctx := context.Background()
// test Query
row0, _ := QueryByKey(ctx, nil, db, "key001")
rowArr1, _ := QueryByFieldOne(ctx, nil, db, "one")
rowArrAll, _ := QueryAll(ctx, nil, db)
t.Log(rowArr1)
t.Log(rowArrAll)
// test Update
row0.FieldOne = "one123"
row0.FieldTwo = true
row0.FieldThr = 1234
row0.FieldFou = 123.45
_ = Update(ctx, nil, db, row0)
// test Insert
newRow0 := DemoRow{
FieldKey: "key002",
FieldOne: "one456",
FieldTwo: false,
FieldThr: 5678,
FieldFou: 0.01,
}
newRow1 := DemoRow{
FieldKey: "key003",
FieldOne: "one789",
FieldTwo: true,
FieldThr: 5678,
FieldFou: 0.02,
}
_ = Insert(ctx, nil, db, newRow0, newRow1)
// test Remove
_ = Remove(ctx, nil, db, "key001")
t.Log("====>End")
} | explode_data.jsonl/58907 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 417
} | [
2830,
3393,
8269,
38076,
1155,
353,
8840,
836,
8,
341,
3244,
5247,
445,
605,
29,
2271,
8269,
38076,
5130,
2405,
2927,
353,
3544,
22537,
198,
197,
322,
2927,
284,
2126,
3506,
368,
442,
633,
2927,
304,
697,
1828,
1616,
198,
743,
2927,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestScanWithNilArguments(t *testing.T) {
session := createSession(t)
defer session.Close()
if err := createTable(session, `CREATE TABLE gocql_test.scan_with_nil_arguments (
foo varchar,
bar int,
PRIMARY KEY (foo, bar)
)`); err != nil {
t.Fatal("create:", err)
}
for i := 1; i <= 20; i++ {
if err := session.Query("INSERT INTO scan_with_nil_arguments (foo, bar) VALUES (?, ?)",
"squares", i*i).Exec(); err != nil {
t.Fatal("insert:", err)
}
}
iter := session.Query("SELECT * FROM scan_with_nil_arguments WHERE foo = ?", "squares").Iter()
var n int
count := 0
for iter.Scan(nil, &n) {
count += n
}
if err := iter.Close(); err != nil {
t.Fatal("close:", err)
}
if count != 2870 {
t.Fatalf("expected %d, got %d", 2870, count)
}
} | explode_data.jsonl/11151 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 329
} | [
2830,
3393,
26570,
2354,
19064,
19139,
1155,
353,
8840,
836,
8,
341,
25054,
1669,
1855,
5283,
1155,
340,
16867,
3797,
10421,
2822,
743,
1848,
1669,
1855,
2556,
16264,
11,
1565,
22599,
14363,
342,
509,
1470,
4452,
47949,
6615,
36175,
43433... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStrOpsTextJustify_ParseString_06(t *testing.T) {
testStr := "left"
txtJustify,
err := TextJustify(0).XParseString(
testStr, false)
if err != nil {
t.Errorf("Error returned by TextJustify(0).ParseString(testStr, true).\n"+
"Error='%v'\n", err.Error())
return
}
if txtJustify != TxtJustify.Left() {
t.Errorf("Error: Expected return of object='TxtJustify.Left()'.\n"+
"Instead, object integer value = '%v'\n",
txtJustify.XValueInt())
}
} | explode_data.jsonl/29330 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 201
} | [
2830,
3393,
2580,
38904,
1178,
9952,
1437,
77337,
703,
62,
15,
21,
1155,
353,
8840,
836,
8,
1476,
18185,
2580,
1669,
330,
2359,
1837,
68272,
9952,
1437,
345,
197,
9859,
1669,
2918,
9952,
1437,
7,
15,
568,
55,
14463,
703,
1006,
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 TestFlushOrdered(t *testing.T) {
maxHeap := NewFloatHeap(true, 3)
maxHeap.Push(0.1, 0)
maxHeap.Push(1.1, 1)
maxHeap.Push(2.1, 2)
maxHeap.Push(3.1, 3)
actualMax := maxHeap.OrderedFlush()
assert.Equal(t, []ValueIndexPair{
{Val: 3.1, Index: 3},
{Val: 2.1, Index: 2},
{Val: 1.1, Index: 1},
}, actualMax)
assert.Equal(t, 0, maxHeap.Len())
minHeap := NewFloatHeap(false, 3)
minHeap.Push(0.1, 0)
minHeap.Push(1.1, 1)
minHeap.Push(2.1, 2)
minHeap.Push(3.1, 3)
actualMin := minHeap.OrderedFlush()
assert.Equal(t, []ValueIndexPair{
{Val: 0.1, Index: 0},
{Val: 1.1, Index: 1},
{Val: 2.1, Index: 2},
}, actualMin)
assert.Equal(t, 0, minHeap.Len())
} | explode_data.jsonl/68389 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 346
} | [
2830,
3393,
46874,
54384,
1155,
353,
8840,
836,
8,
341,
22543,
27909,
1669,
1532,
5442,
27909,
3715,
11,
220,
18,
692,
22543,
27909,
34981,
7,
15,
13,
16,
11,
220,
15,
340,
22543,
27909,
34981,
7,
16,
13,
16,
11,
220,
16,
340,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUseCustomConfigDir(t *testing.T) {
err := Listen(Options{
ConfigDir: os.TempDir(),
ShutdownCleanup: true,
})
if err != nil {
t.Fatal(err)
}
Close()
} | explode_data.jsonl/16613 | {
"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,
10253,
10268,
2648,
6184,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
32149,
7,
3798,
515,
197,
66156,
6184,
25,
981,
2643,
65009,
6184,
3148,
197,
197,
62004,
67335,
25,
830,
345,
197,
3518,
743,
1848,
961,
2092,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestMarshalUnmarshal(t *testing.T) {
assert := assert.New(t)
e := ce.Event{
Context: ce.EventContextV03{
Type: "type",
ID: "id",
Source: *types.ParseURLRef("source"),
}.AsV03(),
}
assert.NoError(e.SetData("foo"))
b, err := format.Marshal(format.JSON.MediaType(), e)
assert.NoError(err)
assert.Equal(`{"data":"foo","id":"id","source":"source","specversion":"0.3","type":"type"}`, string(b))
var e2 ce.Event
assert.NoError(format.Unmarshal(format.JSON.MediaType(), b, &e2))
assert.Equal(e, e2)
_, err = format.Marshal("nosuchformat", e)
assert.EqualError(err, "unknown event format media-type \"nosuchformat\"")
err = format.Unmarshal("nosuchformat", nil, &e)
assert.EqualError(err, "unknown event format media-type \"nosuchformat\"")
} | explode_data.jsonl/37864 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 309
} | [
2830,
3393,
55438,
1806,
27121,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
7727,
1669,
3761,
6904,
515,
197,
70871,
25,
3761,
6904,
1972,
53,
15,
18,
515,
298,
27725,
25,
256,
330,
1313,
756,
298,
29580,
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... | 1 |
func TestContext2Plan_invalidOutput(t *testing.T) {
m := testModuleInline(t, map[string]string{
"main.tf": `
data "aws_data_source" "name" {}
output "out" {
value = "${data.aws_data_source.name.missing}"
}`,
})
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Config: m,
ProviderResolver: providers.ResolverFixed(
map[string]providers.Factory{
"aws": testProviderFuncFixed(p),
},
),
})
_, diags := ctx.Plan()
if !diags.HasErrors() {
// Should get this error:
// Unsupported attribute: This object does not have an attribute named "missing"
t.Fatal("succeeded; want errors")
}
gotErrStr := diags.Err().Error()
wantErrStr := "Unsupported attribute"
if !strings.Contains(gotErrStr, wantErrStr) {
t.Fatalf("missing expected error\ngot: %s\n\nwant: error containing %q", gotErrStr, wantErrStr)
}
} | explode_data.jsonl/28726 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 333
} | [
2830,
3393,
1972,
17,
20485,
31433,
5097,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
1273,
3332,
25324,
1155,
11,
2415,
14032,
30953,
515,
197,
197,
1,
3817,
68994,
788,
22074,
691,
330,
8635,
1769,
10347,
1,
330,
606,
1,
10086,
3006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test_fetchAndImportIcon(t *testing.T) {
r := &models.RepoInternal{Name: "test", Namespace: "repo-namespace"}
t.Run("no icon", func(t *testing.T) {
m := &mock.Mock{}
c := models.Chart{ID: "test/acs-engine-autoscaler"}
manager := getMockManager(m)
fImporter := fileImporter{manager}
assert.NoErr(t, fImporter.fetchAndImportIcon(c, r))
})
index, _ := parseRepoIndex([]byte(validRepoIndexYAML))
charts := chartsFromIndex(index, &models.Repo{Name: "test", Namespace: "repo-namespace", URL: "http://testrepo.com"})
t.Run("failed download", func(t *testing.T) {
netClient = &badHTTPClient{}
c := charts[0]
m := &mock.Mock{}
manager := getMockManager(m)
fImporter := fileImporter{manager}
assert.Err(t, fmt.Errorf("500 %s", c.Icon), fImporter.fetchAndImportIcon(c, r))
})
t.Run("bad icon", func(t *testing.T) {
netClient = &badIconClient{}
c := charts[0]
m := &mock.Mock{}
manager := getMockManager(m)
fImporter := fileImporter{manager}
assert.Err(t, image.ErrFormat, fImporter.fetchAndImportIcon(c, r))
})
t.Run("valid icon", func(t *testing.T) {
netClient = &goodIconClient{}
c := charts[0]
m := &mock.Mock{}
m.On("Upsert", bson.M{"chart_id": c.ID, "repo.name": c.Repo.Name, "repo.namespace": c.Repo.Namespace}, bson.M{"$set": bson.M{"raw_icon": iconBytes(), "icon_content_type": "image/png"}}).Return(nil)
manager := getMockManager(m)
fImporter := fileImporter{manager}
assert.NoErr(t, fImporter.fetchAndImportIcon(c, r))
m.AssertExpectations(t)
})
t.Run("valid SVG icon", func(t *testing.T) {
netClient = &svgIconClient{}
c := models.Chart{
ID: "foo",
Icon: "https://foo/bar/logo.svg",
Repo: &models.Repo{Name: r.Name, Namespace: r.Namespace},
}
m := &mock.Mock{}
m.On("Upsert", bson.M{"chart_id": c.ID, "repo.name": c.Repo.Name, "repo.namespace": c.Repo.Namespace}, bson.M{"$set": bson.M{"raw_icon": []byte("foo"), "icon_content_type": "image/svg"}}).Return(nil)
manager := getMockManager(m)
fImporter := fileImporter{manager}
assert.NoErr(t, fImporter.fetchAndImportIcon(c, r))
m.AssertExpectations(t)
})
} | explode_data.jsonl/67809 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 926
} | [
2830,
3393,
11803,
3036,
11511,
4395,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
609,
6507,
2817,
5368,
11569,
63121,
25,
330,
1944,
497,
41962,
25,
330,
23476,
12,
2231,
16707,
3244,
16708,
445,
2152,
4603,
497,
2915,
1155,
353,
8840,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUserService_Delete(t *testing.T) {
client := newTestClient(t)
us := NewUserService(func(context.Context, string) (*ent.Client, error) { return client, nil })
ctx := authz.NewContext(context.Background(), authz.AdminPermissions())
u := client.User.Create().SetAuthID("YYY").SaveX(ctx)
require.Equal(t, user.StatusACTIVE, u.Status)
_, err := us.Delete(ctx, &UserInput{Tenant: "", Id: "YYY"})
require.IsType(t, codes.InvalidArgument, status.Code(err))
_, err = us.Delete(ctx, &UserInput{Tenant: "XXX", Id: ""})
require.IsType(t, codes.InvalidArgument, status.Code(err))
_, err = us.Delete(ctx, &UserInput{Tenant: "XXX", Id: "YYY"})
require.NoError(t, err)
newU, err := client.User.Get(ctx, u.ID)
require.NoError(t, err)
require.Equal(t, user.StatusDEACTIVATED, newU.Status)
} | explode_data.jsonl/70875 | {
"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,
60004,
57418,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
501,
2271,
2959,
1155,
340,
70175,
1669,
1532,
60004,
18552,
5378,
9328,
11,
914,
8,
4609,
306,
11716,
11,
1465,
8,
314,
470,
2943,
11,
2092,
2751,
20985,
1669,
4166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filterStoreItem_Found(t *testing.T) {
items := []v2.StoreFunction{
v2.StoreFunction{
Name: "figlet",
},
}
wantName := "figlet"
got, gotErr := filterStoreItem(items, wantName)
if gotErr != nil {
t.Errorf("got error %s", gotErr)
t.Fail()
}
if got.Name != wantName {
t.Errorf("name got: %s, but want: %s", got.Name, wantName)
t.Fail()
}
} | explode_data.jsonl/72184 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
8727,
6093,
1234,
1400,
795,
1155,
353,
8840,
836,
8,
1476,
46413,
1669,
3056,
85,
17,
38047,
5152,
515,
197,
5195,
17,
38047,
5152,
515,
298,
21297,
25,
330,
904,
1149,
756,
197,
197,
1583,
197,
532,
50780,
675,
1669,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestStoreHostPort(t *testing.T) {
opts := map[string]interface{}{}
StoreHostPort("istio-pilot", "15005", "foo", opts)
actual, ok := opts["foo"]
if !ok {
t.Fatalf("expected to have map entry foo populated")
}
expected := "{\"address\": \"istio-pilot\", \"port_value\": 15005}"
if actual != expected {
t.Errorf("expected value %q, got %q", expected, actual)
}
} | explode_data.jsonl/35254 | {
"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,
6093,
9296,
7084,
1155,
353,
8840,
836,
8,
341,
64734,
1669,
2415,
14032,
31344,
6257,
16094,
197,
6093,
9296,
7084,
445,
380,
815,
2268,
23958,
497,
330,
16,
20,
15,
15,
20,
497,
330,
7975,
497,
12185,
340,
88814,
11,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestInsertShardedOwned(t *testing.T) {
invschema := &vschemapb.SrvVSchema{
Keyspaces: map[string]*vschemapb.Keyspace{
"sharded": {
Sharded: true,
Vindexes: map[string]*vschemapb.Vindex{
"hash": {
Type: "hash",
},
"twocol": {
Type: "lookup",
Params: map[string]string{
"table": "lkp2",
"from": "from1,from2",
"to": "toc",
},
Owner: "t1",
},
"onecol": {
Type: "lookup",
Params: map[string]string{
"table": "lkp1",
"from": "from",
"to": "toc",
},
Owner: "t1",
},
},
Tables: map[string]*vschemapb.Table{
"t1": {
ColumnVindexes: []*vschemapb.ColumnVindex{{
Name: "hash",
Columns: []string{"id"},
}, {
Name: "twocol",
Columns: []string{"c1", "c2"},
}, {
Name: "onecol",
Columns: []string{"c3"},
}},
},
},
},
},
}
vs, err := vindexes.BuildVSchema(invschema)
if err != nil {
t.Fatal(err)
}
ks := vs.Keyspaces["sharded"]
ins := NewInsert(
InsertSharded,
ks.Keyspace,
[]sqltypes.PlanValue{{
// colVindex columns: id
Values: []sqltypes.PlanValue{{
// rows for id
Values: []sqltypes.PlanValue{{
Value: sqltypes.NewInt64(1),
}, {
Value: sqltypes.NewInt64(2),
}, {
Value: sqltypes.NewInt64(3),
}},
}},
}, {
// colVindex columns: c1, c2
Values: []sqltypes.PlanValue{{
// rows for c1
Values: []sqltypes.PlanValue{{
Value: sqltypes.NewInt64(4),
}, {
Value: sqltypes.NewInt64(5),
}, {
Value: sqltypes.NewInt64(6),
}},
}, {
// rows for c2
Values: []sqltypes.PlanValue{{
Value: sqltypes.NewInt64(7),
}, {
Value: sqltypes.NewInt64(8),
}, {
Value: sqltypes.NewInt64(9),
}},
}},
}, {
// colVindex columns: c3
Values: []sqltypes.PlanValue{{
// rows for c3
Values: []sqltypes.PlanValue{{
Value: sqltypes.NewInt64(10),
}, {
Value: sqltypes.NewInt64(11),
}, {
Value: sqltypes.NewInt64(12),
}},
}},
}},
ks.Tables["t1"],
"prefix",
[]string{" mid1", " mid2", " mid3"},
" suffix",
)
vc := &loggingVCursor{
shards: []string{"-20", "20-"},
shardForKsid: []string{"20-", "-20", "20-"},
}
_, err = ins.Execute(vc, map[string]*querypb.BindVariable{}, false)
if err != nil {
t.Fatal(err)
}
vc.ExpectLog(t, []string{
`Execute insert into lkp2(from1, from2, toc) values(:from10, :from20, :toc0), (:from11, :from21, :toc1), (:from12, :from22, :toc2) ` +
`from10: type:INT64 value:"4" from11: type:INT64 value:"5" from12: type:INT64 value:"6" ` +
`from20: type:INT64 value:"7" from21: type:INT64 value:"8" from22: type:INT64 value:"9" ` +
`toc0: type:VARBINARY value:"\026k@\264J\272K\326" toc1: type:VARBINARY value:"\006\347\352\"\316\222p\217" toc2: type:VARBINARY value:"N\261\220\311\242\372\026\234" true`,
`Execute insert into lkp1(from, toc) values(:from0, :toc0), (:from1, :toc1), (:from2, :toc2) ` +
`from0: type:INT64 value:"10" from1: type:INT64 value:"11" from2: type:INT64 value:"12" ` +
`toc0: type:VARBINARY value:"\026k@\264J\272K\326" toc1: type:VARBINARY value:"\006\347\352\"\316\222p\217" toc2: type:VARBINARY value:"N\261\220\311\242\372\026\234" true`,
// Based on shardForKsid, values returned will be 20-, -20, 20-.
`ResolveDestinations sharded [value:"0" value:"1" value:"2" ] Destinations:DestinationKeyspaceID(166b40b44aba4bd6),DestinationKeyspaceID(06e7ea22ce92708f),DestinationKeyspaceID(4eb190c9a2fa169c)`,
`ExecuteMultiShard ` +
`sharded.20-: prefix mid1, mid3 suffix /* vtgate:: keyspace_id:166b40b44aba4bd6,4eb190c9a2fa169c */ ` +
`{_c10: type:INT64 value:"4" _c11: type:INT64 value:"5" _c12: type:INT64 value:"6" ` +
`_c20: type:INT64 value:"7" _c21: type:INT64 value:"8" _c22: type:INT64 value:"9" ` +
`_c30: type:INT64 value:"10" _c31: type:INT64 value:"11" _c32: type:INT64 value:"12" ` +
`_id0: type:INT64 value:"1" _id1: type:INT64 value:"2" _id2: type:INT64 value:"3" } ` +
`sharded.-20: prefix mid2 suffix /* vtgate:: keyspace_id:06e7ea22ce92708f */ ` +
`{_c10: type:INT64 value:"4" _c11: type:INT64 value:"5" _c12: type:INT64 value:"6" ` +
`_c20: type:INT64 value:"7" _c21: type:INT64 value:"8" _c22: type:INT64 value:"9" ` +
`_c30: type:INT64 value:"10" _c31: type:INT64 value:"11" _c32: type:INT64 value:"12" ` +
`_id0: type:INT64 value:"1" _id1: type:INT64 value:"2" _id2: type:INT64 value:"3" } ` +
`true false`,
})
} | explode_data.jsonl/55989 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2293
} | [
2830,
3393,
13780,
2016,
20958,
57641,
1155,
353,
8840,
836,
8,
341,
17430,
11562,
3416,
1669,
609,
11562,
2407,
391,
65,
808,
10553,
53,
8632,
515,
197,
197,
8850,
27338,
25,
2415,
14032,
8465,
11562,
2407,
391,
65,
37863,
1306,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestFuncBackedValidator(t *testing.T) {
scheme := runtime.NewScheme()
install.Install(scheme)
log := klogr.New()
c := NewFuncBackedValidator(log, scheme, map[schema.GroupKind]Validator{
{Group: testgroup.GroupName, Kind: "TestType"}: ValidatorFunc(&v1.TestType{}, validation.ValidateTestType, validation.ValidateTestTypeUpdate),
})
testTypeGVK := metav1.GroupVersionKind{
Group: v1.SchemeGroupVersion.Group,
Version: v1.SchemeGroupVersion.Version,
Kind: "TestType",
}
tests := map[string]admissionTestT{
"should not allow invalid value for 'testField' field": {
inputRequest: admissionv1beta1.AdmissionRequest{
UID: types.UID("abc"),
Kind: testTypeGVK,
Object: runtime.RawExtension{
Raw: []byte(fmt.Sprintf(`
{
"apiVersion": "testgroup.testing.cert-manager.io/v1",
"kind": "TestType",
"metadata": {
"name": "testing",
"namespace": "abc",
"creationTimestamp": null
},
"testField": "%s"
}
`, v1.TestFieldValueNotAllowed)),
},
},
expectedResponse: admissionv1beta1.AdmissionResponse{
UID: types.UID("abc"),
Allowed: false,
Result: &metav1.Status{
Status: metav1.StatusFailure, Code: http.StatusNotAcceptable, Reason: metav1.StatusReasonNotAcceptable,
Message: "testField: Invalid value: \"not-allowed-value\": invalid value",
},
},
},
"should allow setting immutable field if it is not already set": {
inputRequest: admissionv1beta1.AdmissionRequest{
Kind: testTypeGVK,
OldObject: runtime.RawExtension{
Raw: []byte(fmt.Sprintf(`
{
"apiVersion": "testgroup.testing.cert-manager.io/v1",
"kind": "TestType",
"metadata": {
"name": "testing",
"namespace": "abc",
"creationTimestamp": null
}
}
`)),
},
Object: runtime.RawExtension{
Raw: []byte(fmt.Sprintf(`
{
"apiVersion": "testgroup.testing.cert-manager.io/v1",
"kind": "TestType",
"metadata": {
"name": "testing",
"namespace": "abc",
"creationTimestamp": null
},
"testFieldImmutable": "abc"
}
`)),
},
},
expectedResponse: admissionv1beta1.AdmissionResponse{
Allowed: true,
},
},
"should not allow setting immutable field if it is already set": {
inputRequest: admissionv1beta1.AdmissionRequest{
Kind: testTypeGVK,
OldObject: runtime.RawExtension{
Raw: []byte(fmt.Sprintf(`
{
"apiVersion": "testgroup.testing.cert-manager.io/v1",
"kind": "TestType",
"metadata": {
"name": "testing",
"namespace": "abc",
"creationTimestamp": null
},
"testFieldImmutable": "oldvalue"
}
`)),
},
Object: runtime.RawExtension{
Raw: []byte(fmt.Sprintf(`
{
"apiVersion": "testgroup.testing.cert-manager.io/v1",
"kind": "TestType",
"metadata": {
"name": "testing",
"namespace": "abc",
"creationTimestamp": null
},
"testFieldImmutable": "abc"
}
`)),
},
},
expectedResponse: admissionv1beta1.AdmissionResponse{
Allowed: false,
Result: &metav1.Status{
Status: metav1.StatusFailure, Code: http.StatusNotAcceptable, Reason: metav1.StatusReasonNotAcceptable,
Message: "testFieldImmutable: Forbidden: field is immutable once set",
},
},
},
}
for n, test := range tests {
t.Run(n, func(t *testing.T) {
runAdmissionTest(t, c.Validate, test)
})
}
} | explode_data.jsonl/9630 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1315
} | [
2830,
3393,
9626,
3707,
291,
14256,
1155,
353,
8840,
836,
8,
341,
1903,
8058,
1669,
15592,
7121,
28906,
741,
197,
12248,
71207,
541,
1141,
8058,
692,
6725,
1669,
595,
839,
81,
7121,
741,
1444,
1669,
1532,
9626,
3707,
291,
14256,
12531,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMultipleResultSets(t *testing.T) {
runTests(t, dsn, func(dbt *DBTest) {
// Create and seed table
dbt.mustExecContext(getContext(), "CREATE TABLE "+dbt.tableName+" (id BIGINT PRIMARY KEY, val VARCHAR) TRANSACTIONAL=false")
dbt.mustExecContext(getContext(), "UPSERT INTO "+dbt.tableName+" VALUES (1,'A')")
dbt.mustExecContext(getContext(), "UPSERT INTO "+dbt.tableName+" VALUES (2,'B')")
rows, err := dbt.db.QueryContext(getContext(), "SELECT * FROM "+dbt.tableName+" WHERE id = 1")
if err != nil {
t.Errorf("Unexpected error while executing query: %s", err)
}
defer rows.Close()
for rows.Next() {
var (
id int64
val string
)
if err := rows.Scan(&id, &val); err != nil {
t.Errorf("Error while scanning row into variables: %s", err)
}
if id != 1 {
t.Errorf("Expected id to be %d, got %d", 1, id)
}
if val != "A" {
t.Errorf("Expected value to be %s, got %s", "A", val)
}
}
if rows.NextResultSet() {
t.Error("There should be no more result sets, but got another result set")
}
})
} | explode_data.jsonl/20925 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 444
} | [
2830,
3393,
32089,
2077,
30175,
1155,
353,
8840,
836,
8,
1476,
56742,
18200,
1155,
11,
294,
9613,
11,
2915,
9791,
83,
353,
3506,
2271,
8,
341,
197,
197,
322,
4230,
323,
10320,
1965,
198,
197,
20939,
83,
69419,
10216,
1972,
40804,
1507... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestGetOupostIDError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
ec2MetadataClient := mock_ec2.NewMockEC2MetadataClient(ctrl)
agent := &ecsAgent{ec2MetadataClient: ec2MetadataClient}
ec2MetadataClient.EXPECT().OutpostARN().Return("", errors.New("error"))
assert.Equal(t, "", agent.getoutpostARN())
} | explode_data.jsonl/41593 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 129
} | [
2830,
3393,
1949,
46,
454,
535,
915,
1454,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
197,
757,
17,
14610,
2959,
1669,
7860,
36844,
17,
7121,
11571,
7498,
17,
1461... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBaseMetricListClose(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
opts := testOptions(ctrl)
l, err := newBaseMetricList(testShard, time.Second, nil, nil, nil, opts)
require.NoError(t, err)
l.RLock()
require.False(t, l.closed)
l.RUnlock()
l.Close()
require.True(t, l.closed)
// Close for a second time should have no impact.
l.Close()
require.True(t, l.closed)
} | explode_data.jsonl/43582 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
3978,
54310,
852,
7925,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
64734,
1669,
1273,
3798,
62100,
340,
8810,
11,
1848,
1669,
501,
3978,
54310,
852,
8623... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStoreScanInconsistentResolvesIntents(t *testing.T) {
defer leaktest.AfterTest(t)()
// This test relies on having a committed Txn record and open intents on
// the same Range. This only works with auto-gc turned off; alternatively
// the test could move to splitting its underlying Range.
defer setTxnAutoGC(false)()
var intercept atomic.Value
intercept.Store(true)
cfg := TestStoreConfig(nil)
cfg.TestingKnobs.EvalKnobs.TestingEvalFilter =
func(filterArgs kvserverbase.FilterArgs) *roachpb.Error {
_, ok := filterArgs.Req.(*roachpb.ResolveIntentRequest)
if ok && intercept.Load().(bool) {
return roachpb.NewErrorWithTxn(errors.Errorf("boom"), filterArgs.Hdr.Txn)
}
return nil
}
stopper := stop.NewStopper()
defer stopper.Stop(context.Background())
store := createTestStoreWithConfig(t, stopper, testStoreOpts{createSystemRanges: true}, &cfg)
// Lay down 10 intents to scan over.
txn := newTransaction("test", roachpb.Key("foo"), 1, store.cfg.Clock)
keys := []roachpb.Key{}
for j := 0; j < 10; j++ {
key := roachpb.Key(fmt.Sprintf("key%02d", j))
keys = append(keys, key)
args := putArgs(key, []byte(fmt.Sprintf("value%02d", j)))
assignSeqNumsForReqs(txn, &args)
if _, pErr := kv.SendWrappedWith(context.Background(), store.TestSender(), roachpb.Header{Txn: txn}, &args); pErr != nil {
t.Fatal(pErr)
}
}
// Now, commit txn without resolving intents. If we hadn't disabled auto-gc
// of Txn entries in this test, the Txn entry would be removed and later
// attempts to resolve the intents would fail.
etArgs, h := endTxnArgs(txn, true)
assignSeqNumsForReqs(txn, &etArgs)
if _, pErr := kv.SendWrappedWith(context.Background(), store.TestSender(), h, &etArgs); pErr != nil {
t.Fatal(pErr)
}
intercept.Store(false) // allow async intent resolution
// Scan the range repeatedly until we've verified count.
sArgs := scanArgs(keys[0], keys[9].Next())
testutils.SucceedsSoon(t, func() error {
if reply, pErr := kv.SendWrappedWith(context.Background(), store.TestSender(), roachpb.Header{
ReadConsistency: roachpb.INCONSISTENT,
}, sArgs); pErr != nil {
return pErr.GoError()
} else if sReply := reply.(*roachpb.ScanResponse); len(sReply.Rows) != 10 {
return errors.Errorf("could not read rows as expected")
}
return nil
})
} | explode_data.jsonl/107 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 860
} | [
2830,
3393,
6093,
26570,
641,
78399,
1061,
18186,
1072,
805,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
741,
197,
322,
1096,
1273,
33644,
389,
3432,
264,
11163,
39850,
77,
3255,
323,
1787,
93515,
389,
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 TestPeerDistanceHeap_ToAPI(t *testing.T) {
rng := rand.New(rand.NewSource(int64(0)))
target := id.NewPseudoRandom(rng)
cp := NewClosestPeers(target, 8)
addresses := cp.ToAPI()
assert.Equal(t, cp.Len(), len(addresses))
for _, a := range addresses {
assert.True(t, cp.In(id.FromBytes(a.PeerId)))
}
} | explode_data.jsonl/41122 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 134
} | [
2830,
3393,
30888,
14778,
27909,
38346,
7082,
1155,
353,
8840,
836,
8,
341,
7000,
968,
1669,
10382,
7121,
37595,
7121,
3608,
1548,
21,
19,
7,
15,
5929,
28861,
1669,
877,
7121,
47,
21952,
13999,
87597,
340,
52018,
1669,
1532,
7925,
267,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_LoginPassword(t *testing.T) {
checkCredentialsAndSkip(t)
client := NewClient(sfURL, DefaultClientID, DefaultAPIVersion, logger.New())
if client == nil {
t.Fatal()
}
// Use token
err := client.LoginPassword(sfUser, sfPass, sfToken)
if err != nil {
t.Fail()
} else {
log.Infof("%s sessionID: %s", logPrefix, client.sessionID)
}
err = client.LoginPassword("__INVALID_USER__", "__INVALID_PASS__", "__INVALID_TOKEN__")
if err == nil {
t.Fail()
}
} | explode_data.jsonl/27751 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 193
} | [
2830,
3393,
2959,
79232,
4876,
1155,
353,
8840,
836,
8,
341,
25157,
27025,
3036,
35134,
1155,
692,
25291,
1669,
1532,
2959,
33804,
3144,
11,
7899,
2959,
915,
11,
7899,
7082,
5637,
11,
5925,
7121,
2398,
743,
2943,
621,
2092,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_dict_String(t *testing.T) {
t.Parallel()
tests := []struct {
name string
d hclDict
want string
}{
{"nil", nil, ""},
{"Empty dict", hclDict{}, ""},
{"Map", dictFixture, `float=1.23 int=123 list=[1,"two"] listInt=[1,2,3] map{sub1=1 sub2="two"} mapInt{"1"=1 "2"="two"} string="Foo bar"`},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equal(t, tt.want, tt.d.String())
})
}
} | explode_data.jsonl/60151 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 209
} | [
2830,
3393,
5243,
31777,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
2698,
262,
305,
564,
13448,
198,
197,
50780,
914,
198,
197,
59403,
197,
197,
4913,
8385,
497,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStandaloneService(t *testing.T) {
go serveStandaloneDKV()
sleepInSecs(3)
dkvSvcAddr := fmt.Sprintf("%s:%d", dkvSvcHost, dkvSvcPort)
if client, err := ctl.NewInSecureDKVClient(dkvSvcAddr, ""); err != nil {
t.Fatalf("Unable to connect to DKV service at %s. Error: %v", dkvSvcAddr, err)
} else {
dkvCli = client
defer dkvCli.Close()
defer dkvSvc.Close()
defer grpcSrvr.Stop()
t.Run("testPutAndGet", testPutAndGet)
t.Run("testPutTTLAndGet", testPutTTLAndGet)
t.Run("testAtomicKeyCreation", testAtomicKeyCreation)
t.Run("testAtomicIncrDecr", testAtomicIncrDecr)
t.Run("testDelete", testDelete)
t.Run("testMultiGet", testMultiGet)
t.Run("testIteration", testIteration)
t.Run("testMissingGet", testMissingGet)
t.Run("testGetChanges", testGetChanges)
t.Run("testBackupRestore", testBackupRestore)
}
} | explode_data.jsonl/36842 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 364
} | [
2830,
3393,
623,
84112,
1860,
1155,
353,
8840,
836,
8,
341,
30680,
8683,
623,
84112,
18301,
53,
741,
52533,
641,
8430,
82,
7,
18,
340,
2698,
43408,
92766,
13986,
1669,
8879,
17305,
4430,
82,
7533,
67,
497,
40204,
85,
92766,
9296,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestLoadBalancedWebService_StackName(t *testing.T) {
testCases := map[string]struct {
inSvcName string
inEnvName string
inAppName string
wantedStackName string
}{
"valid stack name": {
inSvcName: "frontend",
inEnvName: "test",
inAppName: "phonetool",
wantedStackName: "phonetool-test-frontend",
},
"longer than 128 characters": {
inSvcName: "whatisthishorriblylongservicenamethatcantfitintocloudformationwhatarewesupposedtodoaboutthisaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
inEnvName: "test",
inAppName: "phonetool",
wantedStackName: "phonetool-test-whatisthishorriblylongservicenamethatcantfitintocloudformationwhatarewesupposedtodoaboutthisaaaaaaaaaaaaaaaaaaaaa",
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
// GIVEN
conf := &LoadBalancedWebService{
wkld: &wkld{
name: tc.inSvcName,
env: tc.inEnvName,
app: tc.inAppName,
},
}
// WHEN
n := conf.StackName()
// THEN
require.Equal(t, tc.wantedStackName, n, "expected stack names to be equal")
})
}
} | explode_data.jsonl/20401 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 460
} | [
2830,
3393,
5879,
37889,
4874,
94388,
62,
4336,
675,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
2415,
14032,
60,
1235,
341,
197,
17430,
92766,
675,
914,
198,
197,
17430,
14359,
675,
914,
198,
197,
17430,
87994,
914,
271,
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... | 1 |
func TestSpotInstanceActionCheck_NoInstanceActionYet(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
ec2MetadataClient := mock_ec2.NewMockEC2MetadataClient(ctrl)
ec2Client := mock_ec2.NewMockClient(ctrl)
ecsClient := mock_api.NewMockECSClient(ctrl)
myARN := "myARN"
agent := &ecsAgent{
ec2MetadataClient: ec2MetadataClient,
ec2Client: ec2Client,
containerInstanceARN: myARN,
}
ec2MetadataClient.EXPECT().SpotInstanceAction().Return("", fmt.Errorf("404"))
// Container state should NOT be updated because there is no termination time.
ecsClient.EXPECT().UpdateContainerInstancesState(gomock.Any(), gomock.Any()).Times(0)
assert.False(t, agent.spotInstanceDrainingPoller(ecsClient))
} | explode_data.jsonl/41612 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 272
} | [
2830,
3393,
47049,
2523,
2512,
3973,
36989,
2523,
2512,
28074,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
197,
757,
17,
14610,
2959,
1669,
7860,
36844,
17,
7121,
115... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_NewSessionId(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
id1 := NewSessionId()
id2 := NewSessionId()
t.AssertNE(id1, id2)
t.Assert(len(id1), 32)
})
} | explode_data.jsonl/44410 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 88
} | [
2830,
3393,
39582,
5283,
764,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
15710,
16,
1669,
1532,
5283,
764,
741,
197,
15710,
17,
1669,
1532,
5283,
764,
741,
197,
3244,
11711,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestPackableMultipartByteRanges(t *testing.T) {
m1, _ := testArtifacts()
m2 := m1.PackableMultipartByteRanges()
if len(m2) != 2 {
t.Errorf("expected %d got %d", 2, len(m2))
}
} | explode_data.jsonl/78453 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 84
} | [
2830,
3393,
30684,
480,
44,
18204,
7153,
74902,
1155,
353,
8840,
836,
8,
341,
2109,
16,
11,
716,
1669,
1273,
9286,
26401,
741,
2109,
17,
1669,
296,
16,
1069,
473,
480,
44,
18204,
7153,
74902,
741,
743,
2422,
1255,
17,
8,
961,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestConvertVLabsKubernetesConfigProfile(t *testing.T) {
tests := map[string]struct {
props *vlabs.KubernetesConfig
expect *KubernetesConfig
}{
"WindowsNodeBinariesURL": {
props: &vlabs.KubernetesConfig{
WindowsNodeBinariesURL: "http://test/test.tar.gz",
},
expect: &KubernetesConfig{
WindowsNodeBinariesURL: "http://test/test.tar.gz",
},
},
"WindowsContainerdURL": {
props: &vlabs.KubernetesConfig{
WindowsContainerdURL: "http://test/testcontainerd.tar.gz",
},
expect: &KubernetesConfig{
WindowsContainerdURL: "http://test/testcontainerd.tar.gz",
},
},
"WindowsSdnPluginURL": {
props: &vlabs.KubernetesConfig{
WindowsSdnPluginURL: "http://test/testsdnplugin.tar.gz",
},
expect: &KubernetesConfig{
WindowsSdnPluginURL: "http://test/testsdnplugin.tar.gz",
},
},
}
for name, test := range tests {
t.Logf("running scenario %q", name)
actual := &KubernetesConfig{}
convertVLabsKubernetesConfig(test.props, actual)
if !equality.Semantic.DeepEqual(test.expect, actual) {
t.Errorf(spew.Sprintf("Expected:\n%+v\nGot:\n%+v", test.expect, actual))
}
}
} | explode_data.jsonl/34631 | {
"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,
12012,
30698,
3435,
42,
29827,
2648,
8526,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
2415,
14032,
60,
1235,
341,
197,
77691,
220,
353,
14536,
3435,
11352,
29827,
2648,
198,
197,
24952,
353,
42,
29827,
2648,
198,
197,
59403,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test_underscore_arrays_4(t *testing.T) {
tt(t, func() {
test, _ := test_()
test(`
test("compact", function() {
equal(_.compact([0, 1, false, 2, false, 3]).length, 3, 'can trim out all falsy values');
var result = (function(){ return _.compact(arguments).length; })(0, 1, false, 2, false, 3);
equal(result, 3, 'works on an arguments object');
});
`)
})
} | explode_data.jsonl/68898 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 171
} | [
2830,
3393,
62,
53933,
68983,
62,
19,
1155,
353,
8840,
836,
8,
972,
3244,
83,
1155,
11,
2915,
368,
972,
197,
18185,
11,
716,
1669,
1273,
62,
18005,
197,
18185,
5809,
319,
220,
1273,
445,
39760,
497,
729,
368,
972,
262,
6144,
27191,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAvatarsURLCaching(t *testing.T) {
tc := libkb.SetupTest(t, "TestAvatarsURLCaching", 1)
defer tc.Cleanup()
clock := clockwork.NewFakeClock()
tc.G.SetClock(clock)
cb := make(chan struct{}, 5)
tc.G.API = newAvatarMockAPI(makeHandler("url", cb))
source := NewURLCachingSource(time.Hour, 10)
t.Logf("API server fetch")
m := libkb.NewMetaContextForTest(tc)
res, err := source.LoadUsers(m, []string{"mike"}, []keybase1.AvatarFormat{"square"})
require.NoError(t, err)
require.Equal(t, "url", res.Picmap["mike"]["square"].String())
select {
case <-cb:
case <-time.After(20 * time.Second):
require.Fail(t, "no API call")
}
t.Logf("cache fetch")
res, err = source.LoadUsers(m, []string{"mike"}, []keybase1.AvatarFormat{"square"})
require.NoError(t, err)
require.Equal(t, "url", res.Picmap["mike"]["square"].String())
select {
case <-cb:
require.Fail(t, "no API call")
default:
}
t.Logf("stale")
source.staleFetchCh = make(chan struct{}, 5)
clock.Advance(2 * time.Hour)
tc.G.API = newAvatarMockAPI(makeHandler("url2", cb))
res, err = source.LoadUsers(m, []string{"mike"}, []keybase1.AvatarFormat{"square"})
require.NoError(t, err)
require.Equal(t, "url", res.Picmap["mike"]["square"].String())
select {
case <-cb:
case <-time.After(20 * time.Second):
require.Fail(t, "no API call")
}
select {
case <-source.staleFetchCh:
case <-time.After(20 * time.Second):
require.Fail(t, "no stale fetch")
}
res, err = source.LoadUsers(m, []string{"mike"}, []keybase1.AvatarFormat{"square"})
require.NoError(t, err)
require.Equal(t, "url2", res.Picmap["mike"]["square"].String())
select {
case <-cb:
require.Fail(t, "no API call")
default:
}
} | explode_data.jsonl/61530 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 690
} | [
2830,
3393,
9865,
43858,
3144,
34,
11829,
1155,
353,
8840,
836,
8,
341,
78255,
1669,
3051,
21310,
39820,
2271,
1155,
11,
330,
2271,
9865,
43858,
3144,
34,
11829,
497,
220,
16,
340,
16867,
17130,
727,
60639,
2822,
84165,
1669,
8866,
1778... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStringReferring(t *testing.T) {
str := []byte(`{"A":"0","B":"1"}`)
sp := *(**byte)(unsafe.Pointer(&str))
println("malloc *byte ", sp)
runtime.SetFinalizer(sp, func(sp *byte){
referred = false
println("*byte ", sp, " got free")
})
runtime.GC()
println("first GC")
var obj struct{
A string
B string
}
dc := NewDecoder(rt.Mem2Str(str))
dc.CopyString()
referred = true
if err := dc.Decode(&obj); err != nil {
t.Fatal(err)
}
runtime.GC()
println("second GC")
if referred {
t.Fatal("*byte is being referred")
}
str2 := []byte(`{"A":"0","B":"1"}`)
sp2 := *(**byte)(unsafe.Pointer(&str2))
println("malloc *byte ", sp2)
runtime.SetFinalizer(sp2, func(sp *byte){
referred = false
println("*byte ", sp, " got free")
})
runtime.GC()
println("first GC")
var obj2 interface{}
dc2 := NewDecoder(rt.Mem2Str(str2))
dc2.UseNumber()
dc2.CopyString()
referred = true
if err := dc2.Decode(&obj2); err != nil {
t.Fatal(err)
}
runtime.GC()
println("second GC")
if referred {
t.Fatal("*byte is being referred")
}
runtime.KeepAlive(&obj)
runtime.KeepAlive(&obj2)
} | explode_data.jsonl/6202 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 594
} | [
2830,
3393,
85098,
14443,
1155,
353,
8840,
836,
8,
341,
262,
607,
1669,
3056,
3782,
5809,
4913,
32,
3252,
15,
2198,
33,
3252,
16,
1,
27085,
262,
978,
1669,
12861,
334,
3782,
2376,
38157,
41275,
2099,
495,
1171,
262,
13751,
445,
16166,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnitGetUserJson(t *testing.T) {
s := echo.New()
g := s.Group("/api")
req := httptest.NewRequest(echo.GET, "/api/users/"+e.testUser.ID, nil)
rec := httptest.NewRecorder()
userCtrl := &User{}
cc := &context.AppContext{
Config: e.config,
UserStore: &UserFakeStore{},
}
s.Use(middleware.AppContext(cc))
g.GET("/users/:id", userCtrl.GetUserJSON)
s.ServeHTTP(rec, req)
assert.Equal(t, http.StatusOK, rec.Code)
} | explode_data.jsonl/7156 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 187
} | [
2830,
3393,
4562,
1949,
1474,
5014,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1687,
7121,
741,
3174,
1669,
274,
5407,
4283,
2068,
5130,
24395,
1669,
54320,
70334,
75274,
2026,
958,
17410,
11,
3521,
2068,
19178,
33778,
68,
5958,
1474,
99... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDecodeSnappyHeader(t *testing.T) {
r := bytes.NewReader(sampleSnappyInform)
out, err := DecodeHeader(r)
assert.Nil(t, err, "successful decode should not return any errors")
assert.Equal(t, sampleSnappyInformHeader, out, "response should equal sample")
} | explode_data.jsonl/38401 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 88
} | [
2830,
3393,
32564,
20720,
11144,
4047,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
5820,
68587,
32968,
20720,
11144,
37891,
340,
13967,
11,
1848,
1669,
50194,
4047,
2601,
340,
6948,
59678,
1155,
11,
1848,
11,
330,
30950,
16895,
1265,
537,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mrCmd_noArgs(t *testing.T) {
repo := copyTestRepo(t)
cmd := exec.Command("../lab_bin", "mr")
cmd.Dir = repo
b, err := cmd.CombinedOutput()
if err != nil {
t.Log(string(b))
t.Fatal(err)
}
require.Contains(t, string(b), `Usage:
lab mr [flags]
lab mr [command]`)
} | explode_data.jsonl/44430 | {
"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,
92858,
15613,
6536,
4117,
1155,
353,
8840,
836,
8,
341,
17200,
5368,
1669,
2975,
2271,
25243,
1155,
340,
25920,
1669,
3883,
12714,
17409,
14380,
21816,
497,
330,
20946,
1138,
25920,
83757,
284,
15867,
271,
2233,
11,
1848,
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 TestGetLiferayHomeRelease7_1M1(t *testing.T) {
release := Release{Tag: "7.1-ce-m1-tomcat-hsql"}
assert := assert.New(t)
assert.Equal("/liferay", release.GetLiferayHome())
} | explode_data.jsonl/11701 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 77
} | [
2830,
3393,
1949,
43,
33204,
7623,
16077,
22,
62,
16,
44,
16,
1155,
353,
8840,
836,
8,
341,
17200,
1623,
1669,
17381,
90,
5668,
25,
330,
22,
13,
16,
53212,
1448,
16,
2385,
316,
4616,
2832,
3544,
63159,
6948,
1669,
2060,
7121,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.