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 TestListAllRules(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() HandleRuleListSuccessfully(t) allPages, err := l7policies.ListRules(fake.ServiceClient(), "8a1412f0-4c32-4257-8b07-af4770b604fd", l7policies.ListRulesOpts{}).AllPages() th.AssertNoErr(t, err) actual, err := l7policies.ExtractRules(allPages) th.AssertNoErr(t, err) th.CheckDeepEquals(t, RulePath, actual[0]) th.CheckDeepEquals(t, RuleHostName, actual[1]) }
explode_data.jsonl/79643
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 190 }
[ 2830, 3393, 852, 2403, 26008, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 741, 197, 6999, 11337, 852, 35959, 1155, 692, 50960, 17713, 11, 1848, 1669, 326, 22, 79, 42038, 5814, 26008, 74138, 138...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSpanLink_TraceState(t *testing.T) { ms := NewSpanLink() assert.EqualValues(t, TraceState(""), ms.TraceState()) testValTraceState := TraceState("congo=congos") ms.SetTraceState(testValTraceState) assert.EqualValues(t, testValTraceState, ms.TraceState()) }
explode_data.jsonl/63298
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 12485, 3939, 21038, 578, 1397, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 12485, 3939, 741, 6948, 12808, 6227, 1155, 11, 27163, 1397, 86076, 9829, 46920, 1397, 2398, 18185, 2208, 6550, 1397, 1669, 27163, 1397, 445, 443, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobWithoutPatch(t *testing.T) { c := NewCtx(t) defer c.Close() build := testBuild(1) c.client2.UploadBuild(build) crash := testCrash(build, 1) crash.ReproOpts = []byte("repro opts") crash.ReproSyz = []byte("repro syz") c.client2.ReportCrash(crash) c.expectOK(c.GET("/email_poll")) c.expectEQ(len(c.emailSink), 1) sender := (<-c.emailSink).Sender _, extBugID, err := email.RemoveAddrContext(sender) if err != nil { t.Fatal(err) } c.incomingEmail(sender, "#syz test: git://mygit.com/git.git 5e6a2eea\n", EmailOptMessageID(1)) pollResp, _ := c.client2.JobPoll([]string{build.Manager}) testBuild := testBuild(2) testBuild.KernelRepo = "git://mygit.com/git.git" testBuild.KernelBranch = "" testBuild.KernelCommit = "5e6a2eea5e6a2eea5e6a2eea5e6a2eea5e6a2eea" jobDoneReq := &dashapi.JobDoneReq{ ID: pollResp.ID, Build: *testBuild, } c.client2.JobDone(jobDoneReq) c.expectOK(c.GET("/email_poll")) c.expectEQ(len(c.emailSink), 1) { _, dbBuild := c.loadJob(pollResp.ID) kernelConfigLink := externalLink(c.ctx, textKernelConfig, dbBuild.KernelConfig) msg := <-c.emailSink c.expectEQ(len(msg.Attachments), 0) body := fmt.Sprintf(`Hello, syzbot has tested the proposed patch and the reproducer did not trigger crash: Reported-and-tested-by: syzbot+%v@testapp.appspotmail.com Tested on: commit: 5e6a2eea5e6a kernel_commit_title2 git tree: git://mygit.com/git.git kernel config: %[2]v compiler: compiler2 Note: testing is done by a robot and is best-effort only. `, extBugID, kernelConfigLink) if msg.Body != body { t.Fatalf("got email body:\n%s\n\nwant:\n%s", msg.Body, body) } c.checkURLContents(kernelConfigLink, testBuild.KernelConfig) } pollResp, _ = c.client2.JobPoll([]string{build.Manager}) c.expectEQ(pollResp.ID, "") }
explode_data.jsonl/54015
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 800 }
[ 2830, 3393, 12245, 26040, 43622, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 23684, 1155, 340, 16867, 272, 10421, 2822, 69371, 1669, 1273, 11066, 7, 16, 340, 1444, 6581, 17, 86597, 11066, 43333, 692, 91492, 988, 1669, 1273, 16001, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestString(t *testing.T) { t.Parallel() want := "ID{Address: localhost:12345, Id: [73 44 127 92 143 18 83 102 101 246 108 105 60 227 86 107 128 15 61 7 191 108 178 184 1 152 19 41 78 16 131 58]}" if id1.String() != want { t.Errorf("String() = %s, want %s", id1.String(), want) } }
explode_data.jsonl/7126
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 703, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 50780, 1669, 330, 915, 90, 4286, 25, 47422, 25, 16, 17, 18, 19, 20, 11, 5223, 25, 508, 22, 18, 220, 19, 19, 220, 16, 17, 22, 220, 24, 17, 220, 16, 19, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetMyTeamSanitization(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() var team *model.Team if res, err := th.BasicClient.CreateTeam(&model.Team{ DisplayName: t.Name() + "_1", Name: GenerateTestTeamName(), Email: th.GenerateTestEmail(), Type: model.TEAM_OPEN, AllowedDomains: "simulator.amazonses.com", }); err != nil { t.Fatal(err) } else { team = res.Data.(*model.Team) } t.Run("team user", func(t *testing.T) { th.LinkUserToTeam(th.BasicUser2, team) client := th.CreateClient() client.Must(client.Login(th.BasicUser2.Email, th.BasicUser2.Password)) client.SetTeamId(team.Id) if res, err := client.GetMyTeam(""); err != nil { t.Fatal(err) } else if rteam := res.Data.(*model.Team); rteam.Email != "" { t.Fatal("should've sanitized email") } else if rteam.AllowedDomains != "" { t.Fatal("should've sanitized allowed domains") } }) t.Run("team admin", func(t *testing.T) { th.BasicClient.SetTeamId(team.Id) if res, err := th.BasicClient.GetMyTeam(""); err != nil { t.Fatal(err) } else if rteam := res.Data.(*model.Team); rteam.Email == "" { t.Fatal("should not have sanitized email") } else if rteam.AllowedDomains == "" { t.Fatal("should not have sanitized allowed domains") } }) t.Run("system admin", func(t *testing.T) { th.SystemAdminClient.SetTeamId(team.Id) if res, err := th.SystemAdminClient.GetMyTeam(""); err != nil { t.Fatal(err) } else if rteam := res.Data.(*model.Team); rteam.Email == "" { t.Fatal("should not have sanitized email") } else if rteam.AllowedDomains == "" { t.Fatal("should not have sanitized allowed domains") } }) }
explode_data.jsonl/48514
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 700 }
[ 2830, 3393, 1949, 5050, 14597, 23729, 275, 2022, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 1005, 3803, 2320, 7210, 741, 16867, 270, 836, 682, 4454, 2822, 2405, 2083, 353, 2528, 65842, 198, 743, 592, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestSearchUserAccessToken(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client AdminClient := th.SystemAdminClient testDescription := "test token" th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true }) th.App.UpdateUserRoles(th.BasicUser.Id, model.SYSTEM_USER_ROLE_ID+" "+model.SYSTEM_USER_ACCESS_TOKEN_ROLE_ID, false) token, resp := Client.CreateUserAccessToken(th.BasicUser.Id, testDescription) CheckNoError(t, resp) _, resp = Client.SearchUserAccessTokens(&model.UserAccessTokenSearch{Term: token.Id}) CheckForbiddenStatus(t, resp) rtokens, resp := AdminClient.SearchUserAccessTokens(&model.UserAccessTokenSearch{Term: th.BasicUser.Id}) CheckNoError(t, resp) if len(rtokens) != 1 { t.Fatal("should have 1 tokens") } rtokens, resp = AdminClient.SearchUserAccessTokens(&model.UserAccessTokenSearch{Term: token.Id}) CheckNoError(t, resp) if len(rtokens) != 1 { t.Fatal("should have 1 tokens") } rtokens, resp = AdminClient.SearchUserAccessTokens(&model.UserAccessTokenSearch{Term: th.BasicUser.Username}) CheckNoError(t, resp) if len(rtokens) != 1 { t.Fatal("should have 1 tokens") } rtokens, resp = AdminClient.SearchUserAccessTokens(&model.UserAccessTokenSearch{Term: "not found"}) CheckNoError(t, resp) if len(rtokens) != 0 { t.Fatal("should have 0 tokens") } }
explode_data.jsonl/21560
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 494 }
[ 2830, 3393, 5890, 1474, 37649, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 1005, 3803, 2320, 7210, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 198, 197, 7210, 2959, 1669, 270, 16620, 7210, 295...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGameSetup(t *testing.T) { game := Game{gridSize: 4} preTileState := [][][]int{[][]int{[]int{0, 0, 3}, []int{0, 1, 2}}} gInfo := GameInfo{HighScore: 10, CurrentScore: 5, TileState: preTileState} game.setup(gInfo) if game.score != 5 { t.Errorf("score %v expected %v", game.score, 5) } if game.highScore != 10 { t.Errorf("high score %v expected %v", game.score, 5) } for x := 0; x < len(game.grid.cells); x++ { for y := 0; y < len(game.grid.cells[x]); y++ { if game.grid.cells[x][y].value != preTileState[x][y][2] { t.Errorf("the value of game cells in %v column %v row is wrong", game.score, 5) } } } }
explode_data.jsonl/59001
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 4868, 21821, 1155, 353, 8840, 836, 8, 341, 30677, 1669, 4050, 90, 4203, 1695, 25, 220, 19, 532, 40346, 15628, 1397, 1669, 3056, 16613, 396, 90, 16613, 396, 90, 1294, 396, 90, 15, 11, 220, 15, 11, 220, 18, 2137, 3056, 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...
6
func TestRemove(t *testing.T) { m := NewSharedMap() monkey := Animal{"monkey"} m.Store("monkey", monkey) m.Delete("monkey") count := 0 m.Range(func(key, value interface{}) bool { count++ return true }) if count != 0 { t.Error("Expecting count to be zero once item was removed.") } temp, ok := m.Load("monkey") if ok != false { t.Error("Expecting ok to be false for missing items.") } if temp != nil { t.Error("Expecting item to be nil after its removal.") } // Remove a none existing element. m.Delete("noone") }
explode_data.jsonl/77834
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 13021, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1532, 16997, 2227, 2822, 197, 96016, 1669, 21292, 4913, 96016, 16707, 2109, 38047, 445, 96016, 497, 38703, 692, 2109, 18872, 445, 96016, 5130, 18032, 1669, 220, 15, 198, 2109, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewWallet(t *testing.T) { chainID := ids.ID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} w, err := NewWallet(logging.NoLog{}, 12345, chainID, 0) if err != nil { t.Fatal(err) } if w == nil { t.Fatalf("failed to create the new wallet") } }
explode_data.jsonl/41617
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 3564, 38259, 1155, 353, 8840, 836, 8, 341, 197, 8819, 915, 1669, 14151, 9910, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, 23, 11, 220, 24, 11, 220, 16, 15, 532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHaveValidStructure(t *testing.T) { test := []string{`{P}|1|[2]^"a"`, `{P}|1|[:2]^"a"`, `{P}|0|[%2]#({W}|0|[:2]^"br")`, `{P}|0|[2]#({W}|0|[2:]$"brazil")`, `{B}|1|[@2]^"a"`, `{P}|1|[:2]9"a"`} want := []bool{true, true, true, true, false, false} for idx, item := range test { r := &Rules{} result := HaveValidStructure(item, r) if result != want[idx] { t.Errorf("Fail to valid rule (%s), expected (%t), received (%t)", item, want[idx], result) } } }
explode_data.jsonl/73979
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 12116, 4088, 22952, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 3056, 917, 90, 63, 90, 47, 52398, 16, 74723, 17, 90304, 1, 64, 1, 12892, 197, 197, 63, 90, 47, 52398, 16, 91, 3447, 17, 90304, 1, 64, 1, 12892, 197, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestServiceDetailFromSvcs(t *testing.T) { tags1 := []string{"tag1-a", "tag1-b"} meta1 := map[string]string{"a": "b", "c": "d"} tags2 := []string{"tag2-a", "tag2-b"} meta2 := map[string]string{"l": "m", "n": "o"} in := []*consulapi.CatalogService{ { Node: "n1", Address: "addr1", ServiceTags: tags1, ServicePort: 1234, NodeMeta: meta1, }, { Node: "n2", ServiceAddress: "addr2", ServiceTags: tags2, ServicePort: 1234, NodeMeta: meta2, }, } svcid := "svcsvcsvc" want := consulServiceDetail{ svcid, []consulServiceNode{ { id: "n1", address: "addr1", port: 1234, tags: tags1, nodeMeta: meta1, }, { id: "n2", address: "addr2", port: 1234, tags: tags2, nodeMeta: meta2, }, }, } assert.DeepEqual(t, serviceDetailFromSvcs(svcid, in), want) }
explode_data.jsonl/71897
{ "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, 1860, 10649, 3830, 50, 85, 4837, 1155, 353, 8840, 836, 8, 341, 3244, 2032, 16, 1669, 3056, 917, 4913, 4578, 16, 7409, 497, 330, 4578, 16, 1455, 16707, 84004, 16, 1669, 2415, 14032, 30953, 4913, 64, 788, 330, 65, 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_ComponentList_Remove(t *testing.T) { t.Run("Remove Prerequisite", func(t *testing.T) { compList := newCompList(t, "../test/data/componentlist.yaml") compList.Remove("prereqcomp1") require.Equal(t, 1, len(compList.Prerequisites), "Different amount of prerequisite components") require.Equal(t, 3, len(compList.Components), "Different amount of components") require.Equal(t, "prereqcomp2", compList.Prerequisites[0].Name) }) t.Run("Remove Component", func(t *testing.T) { compList := newCompList(t, "../test/data/componentlist.yaml") compList.Remove("comp2") require.Equal(t, 2, len(compList.Prerequisites), "Different amount of prerequisite components") require.Equal(t, 2, len(compList.Components), "Different amount of components") require.Equal(t, "comp1", compList.Components[0].Name) require.Equal(t, "comp3", compList.Components[1].Name) }) }
explode_data.jsonl/4586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 312 }
[ 2830, 3393, 80760, 852, 66843, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 13021, 2340, 90375, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 5689, 852, 1669, 501, 13552, 852, 1155, 11, 7005, 1944, 13167, 62958, 1607, 33406, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTimeAndBillingEntryProjectsEndpoint_GetPrimary(t *testing.T) { var want types.GUID n := &TimeAndBillingEntryProjects{ProjectId: &want} if got := n.GetPrimary(); !reflect.DeepEqual(*got, want) { t.Errorf("TimeAndBillingEntryProjectsEndpoint.GetPrimary() failed, got: %v, want: %v", *got, want) } }
explode_data.jsonl/36068
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 1462, 3036, 82007, 5874, 29958, 27380, 13614, 15972, 1155, 353, 8840, 836, 8, 341, 2405, 1366, 4494, 1224, 6463, 198, 9038, 1669, 609, 1462, 3036, 82007, 5874, 29958, 90, 7849, 764, 25, 609, 52657, 630, 743, 2684, 1669, 308,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigValidate(t *testing.T) { tests := []struct { cfg map[string]interface{} error bool }{ { cfg: map[string]interface{}{ "scope": "foo", }, error: true, }, { cfg: map[string]interface{}{ "scope": "cluster", }, error: false, }, { cfg: map[string]interface{}{}, error: false, }, } for _, test := range tests { cfg := common.MustNewConfigFrom(test.cfg) c := defaultKubernetesAnnotatorConfig() err := cfg.Unpack(&c) if test.error { require.NotNil(t, err) } else { require.Nil(t, err) } } }
explode_data.jsonl/29226
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 2648, 17926, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 50286, 256, 2415, 14032, 31344, 16094, 197, 18290, 1807, 198, 197, 59403, 197, 197, 515, 298, 50286, 25, 2415, 14032, 31344, 67066, 571, 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...
3
func TestTransfersController_TransferError(t *testing.T) { t.Parallel() config, _ := cltest.NewConfig(t) rpcClient, gethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t) defer assertMocksCalled() app, cleanup := cltest.NewApplicationWithConfigAndKey(t, config, eth.NewClientWith(rpcClient, gethClient), ) defer cleanup() client := app.NewHTTPClient() assert.NoError(t, app.StartAndConnect()) request := models.SendEtherRequest{ DestinationAddress: common.HexToAddress("0xFA01FA015C8A5332987319823728982379128371"), FromAddress: common.HexToAddress("0x0000000000000000000000000000000000000000"), Amount: *assets.NewEth(100), } body, err := json.Marshal(&request) assert.NoError(t, err) resp, cleanup := client.Post("/v2/transfers", bytes.NewBuffer(body)) defer cleanup() cltest.AssertServerResponse(t, resp, http.StatusBadRequest) }
explode_data.jsonl/41299
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 3167, 49793, 2051, 34932, 802, 1454, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 25873, 11, 716, 1669, 1185, 1944, 7121, 2648, 1155, 340, 7000, 3992, 2959, 11, 633, 71, 2959, 11, 8358, 2060, 72577, 20960, 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 TestNodeID_logdistEqual(t *testing.T) { x := common.Hash{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} if logdist(x, x) != 0 { t.Errorf("logdist(x, x) != 0") } }
explode_data.jsonl/49022
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 1955, 915, 5224, 12211, 2993, 1155, 353, 8840, 836, 8, 341, 10225, 1669, 4185, 15103, 90, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, 23, 11, 220, 24, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestZstdChunked(t *testing.T) { estargz.CompressionTestSuite(t, zstdControllerWithLevel(zstd.SpeedFastest), zstdControllerWithLevel(zstd.SpeedDefault), zstdControllerWithLevel(zstd.SpeedBetterCompression), // zstdControllerWithLevel(zstd.SpeedBestCompression), // consumes too much memory to pass on CI ) }
explode_data.jsonl/10603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 109 }
[ 2830, 3393, 57, 1834, 28304, 291, 1155, 353, 8840, 836, 8, 341, 197, 477, 858, 89, 2961, 4011, 2271, 28000, 1155, 345, 197, 20832, 1834, 2051, 2354, 4449, 13174, 1834, 84461, 32174, 477, 1326, 197, 20832, 1834, 2051, 2354, 4449, 13174, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalArrays(t *testing.T) { cases := []struct { Data interface{} Expected string }{ { Data: struct { XY [2]int }{ XY: [2]int{1, 2}, }, Expected: `XY = [1,2] `, }, { Data: struct { XY [1][2]int }{ XY: [1][2]int{{1, 2}}, }, Expected: `XY = [[1,2]] `, }, { Data: struct { XY [1][]int }{ XY: [1][]int{{1, 2}}, }, Expected: `XY = [[1,2]] `, }, { Data: struct { XY [][2]int }{ XY: [][2]int{{1, 2}}, }, Expected: `XY = [[1,2]] `, }, } for _, tc := range cases { t.Run("", func(t *testing.T) { result, err := Marshal(tc.Data) if err != nil { t.Fatal(err) } if !bytes.Equal(result, []byte(tc.Expected)) { t.Errorf("Bad marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", []byte(tc.Expected), result) } }) } }
explode_data.jsonl/46358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 485 }
[ 2830, 3393, 55438, 22182, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 40927, 257, 3749, 16094, 197, 197, 18896, 914, 198, 197, 59403, 197, 197, 515, 298, 40927, 25, 2036, 341, 571, 197, 16356, 508, 17, 63025,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_AWSSensitiveAttributes(t *testing.T) { var tests = []struct { name string source string mustIncludeResultCode string mustExcludeResultCode string }{ { name: "check sensitive attribute", source: ` resource "evil_corp" "virtual_machine" { root_password = "secret" }`, mustIncludeResultCode: rules.GenericSensitiveAttributes, }, { name: "check non-sensitive local", source: ` resource "evil_corp" "virtual_machine" { memory = 512 }`, mustExcludeResultCode: rules.GenericSensitiveAttributes, }, { name: "avoid false positive for aws_efs_file_system", source: ` resource "aws_efs_file_system" "myfs" { creation_token = "something" }`, mustExcludeResultCode: rules.GenericSensitiveAttributes, }, { name: "avoid false positive for google_secret_manager_secret", source: ` resource "google_secret_manager_secret" "secret" { secret_id = "secret" }`, mustExcludeResultCode: rules.GenericSensitiveAttributes, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { results := scanSource(test.source) assertCheckCode(t, test.mustIncludeResultCode, test.mustExcludeResultCode, results) }) } }
explode_data.jsonl/29931
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 465 }
[ 2830, 3393, 1566, 54, 1220, 18723, 10516, 1155, 353, 8840, 836, 8, 1476, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 1698, 914, 198, 197, 47418, 394, 914, 198, 197, 2109, 590, 22283, 2077, 2078, 914, 198, 197, 2109, 590, 95239, 2077...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLimitGroups(t *testing.T) { tests := map[string]struct { groups []string limits []string expected []string }{ "no-limit": {groups: []string{"a", "b", "c"}, limits: []string{}, expected: []string{"a", "b", "c"}}, "empty-limit": {groups: []string{"a", "b", "c"}, limits: []string{""}, expected: []string{}}, "match-all": {groups: []string{"a", "b", "c"}, limits: []string{".*"}, expected: []string{"a", "b", "c"}}, "match-explicit": {groups: []string{"a", "aa", "aba", "bab"}, limits: []string{"a"}, expected: []string{"a"}}, "match-pattern": {groups: []string{"a", "aa", "aba", "bab"}, limits: []string{".a."}, expected: []string{"bab"}}, "multi-match(all-match)": {groups: []string{"a", "aa", "aba", "bab"}, limits: []string{"a", "aba"}, expected: []string{"a", "aba"}}, "multi-match(some-match)": {groups: []string{"a", "aa", "aba", "bab"}, limits: []string{"a", ""}, expected: []string{"a"}}, } for name, tc := range tests { t.Run(name, func(t *testing.T) { gotGroups, err := LimitGroups(tc.groups, tc.limits) assert.NilError(t, err) wantGroups := tc.expected sort.Strings(gotGroups) sort.Strings(wantGroups) assert.DeepEqual(t, wantGroups, gotGroups) }) } }
explode_data.jsonl/56142
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 16527, 22173, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 44260, 82, 256, 3056, 917, 198, 197, 197, 41078, 256, 3056, 917, 198, 197, 42400, 3056, 917, 198, 197, 59403, 197, 197, 1, 2152, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestApp01maDatabaseCreate(t *testing.T) { var err error t.Logf("TestDatabaseCreate()...\n") //DockerRun(t) ioApp01ma = NewIoApp01ma() ioApp01ma.DefaultParms() err = ioApp01ma.DatabaseCreate("App01ma") if err != nil { t.Errorf("\tError - Database Create failed: %s\n", err.Error()) } err = ioApp01ma.Disconnect() if err != nil { t.Fatalf("Error: %s\n\n", err) } ioApp01ma = nil t.Logf("TestQueryRow() - End of Test\n\n\n") }
explode_data.jsonl/16190
{ "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, 2164, 15, 16, 1728, 5988, 4021, 1155, 353, 8840, 836, 8, 341, 262, 762, 1848, 260, 1465, 271, 3244, 98954, 445, 2271, 5988, 4021, 368, 30801, 77, 1138, 322, 35, 13659, 6727, 1155, 692, 53112, 2164, 15, 16, 1728, 284, 153...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImportFormsWithNoBundle(t *testing.T) { default_suite.expectBundled(t, bundled{ files: map[string]string{ "/entry.js": ` import 'foo' import {} from 'foo' import * as ns from 'foo' import {a, b as c} from 'foo' import def from 'foo' import def2, * as ns2 from 'foo' import def3, {a2, b as c3} from 'foo' const imp = [ import('foo'), function nested() { return import('foo') }, ] console.log(ns, a, c, def, def2, ns2, def3, a2, c3, imp) `, }, entryPaths: []string{"/entry.js"}, options: config.Options{ AbsOutputFile: "/out.js", }, }) }
explode_data.jsonl/38447
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 285 }
[ 2830, 3393, 11511, 1838, 16056, 2753, 8409, 1155, 353, 8840, 836, 8, 341, 11940, 57239, 25952, 33, 1241, 832, 1155, 11, 51450, 515, 197, 74075, 25, 2415, 14032, 30953, 515, 298, 197, 3115, 4085, 2857, 788, 22074, 571, 21918, 364, 7975, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMiddlewarePanicOnLateUse(t *testing.T) { handler := func(ctx context.Context, rc *fasthttp.RequestCtx) { rc.Write([]byte("hello\n")) } mw := func(next Handler) Handler { return HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { next.ServeHTTP(ctx, rc) }) } defer func() { if recover() == nil { t.Error("expected panic()") } }() r := NewRouter() r.Get("/", HandlerFunc(handler)) r.Use(mw) // Too late to apply middleware, we're expecting panic(). }
explode_data.jsonl/47957
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 24684, 47, 31270, 1925, 61457, 10253, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 2915, 7502, 2266, 9328, 11, 10192, 353, 9349, 1254, 9659, 23684, 8, 341, 197, 30295, 4073, 10556, 3782, 445, 14990, 1699, 5455, 197, 630, 2109,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequestCancellationV2(t *testing.T) { ctx := context.Background() for name, forwarded := range map[string]bool{ "forwarded": true, "standalone": false, } { t.Run(name, func(t *testing.T) { server := WaitableServer{ Started: make(chan struct{}), Completed: make(chan error), } env := new(TestEnv) defer env.Shutdown(t) l, _ := env.serve(ctx, t, staticServerBinder(server)) client := FakeClient{Logs: make(chan string, 10)} conn := env.dial(ctx, t, l.Dialer(), staticClientBinder(client), forwarded) sd := protocol.ServerDispatcherV2(conn) ctx, cancel := context.WithCancel(ctx) result := make(chan error) go func() { _, err := sd.Hover(ctx, &protocol.HoverParams{}) result <- err }() // Wait for the Hover request to start. <-server.Started cancel() if err := <-result; err == nil { t.Error("nil error for cancelled Hover(), want non-nil") } if err := <-server.Completed; err == nil || !strings.Contains(err.Error(), "cancelled hover") { t.Errorf("Hover(): unexpected server-side error %v", err) } }) } }
explode_data.jsonl/31791
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 451 }
[ 2830, 3393, 1900, 82298, 53, 17, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 2023, 829, 11, 52246, 1669, 2088, 2415, 14032, 96436, 515, 197, 197, 1, 13435, 291, 788, 220, 830, 345, 197, 197, 1, 2685, 31576, 788, 89...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCredentialsString(t *testing.T) { for _, test := range []struct { c Credentials s string }{ { nil, "", }, { NewAnonymousCredentials(""), "anonymousCredentials", }, { NewAnonymousCredentials("test"), "anonymousCredentials created from test", }, { NewAuthTokenCredentials("", ""), "AuthTokenCredentials", }, { NewAuthTokenCredentials("", "test"), "AuthTokenCredentials created from test", }, } { t.Run(test.s, func(t *testing.T) { if stringer, ok := test.c.(fmt.Stringer); ok { require.Equal(t, test.s, stringer.String()) } }) } }
explode_data.jsonl/66815
{ "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, 27025, 703, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 1444, 61260, 198, 197, 1903, 914, 198, 197, 59403, 197, 197, 515, 298, 84131, 345, 298, 197, 39680, 197, 197, 1583, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestContextDescriptionWithBaseShaRoundTripping(t *testing.T) { t.Parallel() testCases := []struct { name string shaIn string expectedSha string }{ { name: "Valid SHA is returned", shaIn: "8d287a3aeae90fd0aef4a70009c715712ff302cd", expectedSha: "8d287a3aeae90fd0aef4a70009c715712ff302cd", }, { name: "Invalid sha is not returned", shaIn: "abc", expectedSha: "", }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { for i := 0; i < 100; i++ { var humanReadable string fuzz.New().Fuzz(&humanReadable) contextDescription := ContextDescriptionWithBaseSha(humanReadable, tc.shaIn) if l := len(contextDescription); l > contextDescriptionMaxLen { t.Errorf("Context description %q generated from humanReadable %q and baseSHa %q is longer than %d (%d)", contextDescription, humanReadable, tc.shaIn, contextDescriptionMaxLen, l) } if expected, actual := tc.expectedSha, BaseSHAFromContextDescription(contextDescription); expected != actual { t.Errorf("expected to get sha %q back, got %q", expected, actual) } } }) } }
explode_data.jsonl/41052
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 1972, 5009, 2354, 3978, 62316, 27497, 21884, 10732, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 197, 15247, 641, 981, 914, 198, 197, 42400, 62316...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsReadable(t *testing.T) { writeDir := "privilege" + "/read" err := Mkdir(writeDir, 0755) if err != nil { panic(err) } t.Cleanup(func() { _ = RemoveWithRecur("privilege") }) if !IsReadable(writeDir) { t.Error("IsReadable test failed!") } }
explode_data.jsonl/34185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 3872, 57938, 1155, 353, 8840, 836, 8, 341, 24945, 6184, 1669, 330, 11887, 42769, 1, 488, 3521, 878, 698, 9859, 1669, 386, 12438, 55828, 6184, 11, 220, 15, 22, 20, 20, 340, 743, 1848, 961, 2092, 341, 197, 30764, 3964, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServerNewFailsWhenFailedCollectResources(t *testing.T) { mock := gomock.NewController(t) defer mock.Finish() cfg := defaultMockCfg(mock) collector := hardware.NewMockHardwareInfo(mock) collector.EXPECT().Info().Times(1).Return(nil, errors.New("")) builder := MinerBuilder{} builder.Hardware(collector) builder.Config(cfg) m, err := builder.Build() assert.Nil(t, m) assert.Error(t, err) }
explode_data.jsonl/44505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 5475, 3564, 37, 6209, 4498, 9408, 47504, 11277, 1155, 353, 8840, 836, 8, 341, 77333, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 991, 18176, 2822, 50286, 1669, 1638, 11571, 42467, 30389, 340, 1444, 24605, 269, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNopClient(t *testing.T) { l := log.New() c := fcm.NewNopClient(l) c.MustSend(context.Background(), &messaging.MulticastMessage{ Tokens: []string{"asd"}, Data: map[string]string{ "yolo": "nolo", }, }) }
explode_data.jsonl/74849
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 45, 453, 2959, 1155, 353, 8840, 836, 8, 341, 8810, 1669, 1487, 7121, 741, 1444, 1669, 282, 6226, 7121, 45, 453, 2959, 2333, 340, 1444, 50463, 11505, 5378, 19047, 1507, 609, 76, 32140, 53515, 35446, 2052, 515, 197, 10261, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPeer_Send_ImmediateAbort(t *testing.T) { t.Parallel() s := makeSetup(t) ctx, cancel := context.WithCancel(context.Background()) cancel() // This operation should abort immediately. assert.Error(t, s.alice.peer.Send(ctx, wire.NewPingMsg())) assert.True(t, s.alice.peer.IsClosed(), "peer must be closed after failed sending") }
explode_data.jsonl/51235
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 30888, 46267, 62, 52734, 85891, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1903, 1669, 1281, 21821, 1155, 692, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 84441, 2822, 197, 322, 1096, 5666, 1265, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReset(t *testing.T) { cpu := testCPU cpu.Reset() t.Logf("status = 0b%s", strconv.FormatInt(int64(cpu.status), 2)) assertEqualsB(t, ZeroB, cpu.x) assertEqualsB(t, ZeroB, cpu.y) assertEqualsB(t, ZeroB, cpu.a) assertEqualsB(t, byte(0xFD), cpu.stkp) assertFalse(t, cpu.StatusRegister(C)) assertFalse(t, cpu.StatusRegister(Z)) assertFalse(t, cpu.StatusRegister(I)) assertFalse(t, cpu.StatusRegister(D)) assertFalse(t, cpu.StatusRegister(B)) assertTrue(t, cpu.StatusRegister(U)) assertFalse(t, cpu.StatusRegister(V)) assertFalse(t, cpu.StatusRegister(N)) assertEqualsW(t, ZeroW, cpu.addressAbs) assertEqualsW(t, ZeroW, cpu.addressRel) assertEqualsW(t, ZeroW, cpu.pc) assertEqualsB(t, ZeroB, cpu.fetched) assertEqualsB(t, byte(8), cpu.cycles) }
explode_data.jsonl/73050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 320 }
[ 2830, 3393, 14828, 1155, 353, 8840, 836, 8, 341, 80335, 1669, 1273, 31615, 198, 80335, 36660, 741, 3244, 98954, 445, 2829, 284, 220, 15, 65, 12952, 497, 33317, 9978, 1072, 1548, 21, 19, 48814, 4299, 701, 220, 17, 4390, 21729, 33, 1155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDockerComposeStrategyForInvalidService(t *testing.T) { path := "./testresources/docker-compose-simple.yml" identifier := strings.ToLower(uuid.New().String()) compose := NewLocalDockerCompose([]string{path}, identifier, WithLogger(TestLogger(t))) destroyFn := func() { err := compose.Down() checkIfError(t, err) } defer destroyFn() err := compose. WithCommand([]string{"up", "-d"}). // Appending with _1 as given in the Java Test-Containers Example WithExposedService("mysql_1", 13306, wait.NewLogStrategy("started").WithStartupTimeout(10*time.Second).WithOccurrence(1)). Invoke() assert.NotEqual(t, err.Error, nil, "Expected error to be thrown because service with wait strategy is not running") assert.Equal(t, 1, len(compose.Services)) assert.Contains(t, compose.Services, "nginx") }
explode_data.jsonl/43626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 35, 13659, 70492, 19816, 2461, 7928, 1860, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 5924, 1944, 12745, 61764, 65070, 65957, 33936, 1837, 197, 15909, 1669, 9069, 29983, 41458, 7121, 1005, 703, 12367, 32810, 2900, 1669, 1532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShopSmPage(t *testing.T) { mSm := new(logics.SmLogic) r, err := mSm.ShopSmPage(context.Background(), 1, 0, 10, cards.STATUS_ON_SALE) logs.Info(err) rbyte, _ := json.Marshal(r) logs.Info(string(rbyte)) }
explode_data.jsonl/35929
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 19795, 10673, 2665, 1155, 353, 8840, 836, 8, 341, 2109, 10673, 1669, 501, 12531, 1211, 92445, 26751, 340, 7000, 11, 1848, 1669, 296, 10673, 10849, 453, 10673, 2665, 5378, 19047, 1507, 220, 16, 11, 220, 15, 11, 220, 16, 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 TestReadCsvWithEntryMissingName(t *testing.T) { var loader autoimport.Loader loader = csv.CsvLoader{make(storeType)} r := strings.NewReader(kMissingNameCsv) _, err := loader.Load(3, "", r, date_util.YMD(2015, 9, 3)) if err != nil { t.Error("Expected no error") } r = strings.NewReader(kMissingNameCsv) _, err = loader.Load(3, "", r, date_util.YMD(2015, 9, 2)) if err == nil { t.Error("Expected error reading entry with missing name") } }
explode_data.jsonl/33811
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 4418, 94826, 2354, 5874, 25080, 675, 1155, 353, 8840, 836, 8, 341, 2405, 16047, 3233, 474, 82987, 198, 197, 8355, 284, 13147, 727, 3492, 9181, 90, 6927, 31200, 929, 10569, 7000, 1669, 9069, 68587, 5969, 25080, 675, 94826, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestExpressions(t *testing.T) { tests := []struct { code string }{ {`bark()`}, {`bark(123)`}, {`bark(123, "abc")`}, } for _, test := range tests { t.Run(test.code, func(t *testing.T) { l := lexer.New(test.code) p := New(l) if expr := p.parseExpr(); expr.String() != test.code { t.Fatalf("parseBlock(%q) = %q, want %q", test.code, expr.String(), test.code) } }) } }
explode_data.jsonl/81339
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 40315, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 43343, 914, 198, 197, 59403, 197, 197, 90, 63, 65, 838, 54258, 1583, 197, 197, 90, 63, 65, 838, 7, 16, 17, 18, 46186, 1583, 197, 197, 90, 63, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStateInit(t *testing.T) { var ec2Is []*ec2.Instance for _, state := range []string{"terminated", "shutting-down", "running"} { i, _ := create("i-"+state, state, "", "") ec2Is = append(ec2Is, i) } dio := &ec2.DescribeInstancesOutput{Reservations: []*ec2.Reservation{{Instances: ec2Is}}} s := &state{c: &Cluster{EC2: &mockEC2Client{output: dio}}} s.Init() ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) if err := s.reconcile(ctx); err != nil { t.Errorf("reconcile: %v", err) } checkState(t, s, []string{"i-running"}, []string{"i-running"}) cancel() }
explode_data.jsonl/42281
{ "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, 1397, 3803, 1155, 353, 8840, 836, 8, 341, 2405, 11942, 17, 3872, 29838, 757, 17, 12688, 198, 2023, 8358, 1584, 1669, 2088, 3056, 917, 4913, 68659, 497, 330, 927, 73981, 14875, 497, 330, 27173, 9207, 341, 197, 8230, 11, 716...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNegotiationTiming(t *testing.T) { params := TransportParams{ ParticipantID: "id", ParticipantIdentity: "identity", Target: livekit.SignalTarget_SUBSCRIBER, Config: &WebRTCConfig{}, } transportA, err := NewPCTransport(params) require.NoError(t, err) _, err = transportA.pc.CreateDataChannel("test", nil) require.NoError(t, err) transportB, err := NewPCTransport(params) require.NoError(t, err) handleICEExchange(t, transportA, transportB) offer := atomic.Value{} transportA.OnOffer(func(sd webrtc.SessionDescription) { offer.Store(&sd) }) // initial offer require.NoError(t, transportA.CreateAndSendOffer(nil)) require.Equal(t, negotiationStateClient, transportA.negotiationState) // second try, should've flipped transport status to retry require.NoError(t, transportA.CreateAndSendOffer(nil)) require.Equal(t, negotiationRetry, transportA.negotiationState) // third try, should've stayed at retry require.NoError(t, transportA.CreateAndSendOffer(nil)) require.Equal(t, negotiationRetry, transportA.negotiationState) time.Sleep(5 * time.Millisecond) actualOffer, ok := offer.Load().(*webrtc.SessionDescription) require.True(t, ok) require.NoError(t, transportB.SetRemoteDescription(*actualOffer)) answer, err := transportB.pc.CreateAnswer(nil) require.NoError(t, err) require.NoError(t, transportB.pc.SetLocalDescription(answer)) require.NoError(t, transportA.SetRemoteDescription(answer)) time.Sleep(5 * time.Millisecond) // it should still be negotiating again require.Equal(t, negotiationStateClient, transportA.negotiationState) offer2, ok := offer.Load().(*webrtc.SessionDescription) require.True(t, ok) require.False(t, offer2 == actualOffer) }
explode_data.jsonl/29010
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 617 }
[ 2830, 3393, 47800, 354, 7101, 62805, 1155, 353, 8840, 836, 8, 341, 25856, 1669, 16742, 4870, 515, 197, 197, 67504, 915, 25, 981, 330, 307, 756, 197, 197, 67504, 18558, 25, 330, 16912, 756, 197, 197, 6397, 25, 1060, 3887, 8226, 75669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileAccountClaim(t *testing.T) { awsaccountapis.AddToScheme(scheme.Scheme) tests := []struct { name string localObjects []runtime.Object expectedAccountClaim awsv1alpha1.AccountClaim verifyAccountFunction func(client.Client, *awsv1alpha1.AccountClaim) bool }{ { name: "Placeholder", localObjects: []runtime.Object{ &awsv1alpha1.AccountClaim{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "claim-test", }, }, }, expectedAccountClaim: awsv1alpha1.AccountClaim{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "claim-test", }, }, verifyAccountFunction: verifyAccountClaim, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { // Arrange mocks := setupDefaultMocks(t, test.localObjects) // This is necessary for the mocks to report failures like methods not being called an expected number of times. // after mocks is defined defer mocks.mockCtrl.Finish() rap := &ReconcileAccountClaim{ client: mocks.fakeKubeClient, scheme: scheme.Scheme, } ap := awsv1alpha1.AccountPool{} err := mocks.fakeKubeClient.Get(context.TODO(), types.NamespacedName{Name: "test", Namespace: "test"}, &ap) _, err = rap.Reconcile(reconcile.Request{ NamespacedName: types.NamespacedName{ Name: "test", Namespace: "aws-account-operator", }, }) assert.NoError(t, err, "Unexpected Error") assert.True(t, test.verifyAccountFunction(mocks.fakeKubeClient, &test.expectedAccountClaim)) }) } }
explode_data.jsonl/56711
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 677 }
[ 2830, 3393, 693, 40446, 457, 7365, 45544, 1155, 353, 8840, 836, 8, 341, 197, 8635, 4608, 13725, 1904, 1249, 28906, 1141, 8058, 92719, 340, 78216, 1669, 3056, 1235, 341, 197, 11609, 1698, 914, 198, 197, 8854, 11543, 688, 3056, 22255, 834...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccUser_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, CheckDestroy: testAccCheckUserDestroy("artifactory_user.foobar"), Providers: testAccProviders, Steps: []resource.TestStep{ { Config: userBasic, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("artifactory_user.foobar", "name", "the.dude"), resource.TestCheckResourceAttr("artifactory_user.foobar", "email", "the.dude@domain.com"), resource.TestCheckNoResourceAttr("artifactory_user.foobar", "admin"), resource.TestCheckNoResourceAttr("artifactory_user.foobar", "profile_updatable"), ), }, }, }) }
explode_data.jsonl/68364
{ "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, 14603, 1474, 34729, 1155, 353, 8840, 836, 8, 341, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 257, 2915, 368, 314, 1273, 14603, 4703, 3973, 1155, 8, 1153, 197, 69472, 14245, 25, 1273, 14603, 3973, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestResolveTemplate(t *testing.T) { tests := []struct { name string uri string wantErr string }{ { name: "resolve-template", uri: "https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/get-started-with-templates/quickstart-template/azuredeploy.json", }, { name: "resolve-template-incorrect-uri", uri: "https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/get-started-with-templates/quickstart-template/deploy.json", wantErr: "bad response code: 404", }, { name: "resolve-template-empty-uri", uri: "", wantErr: "invalid source string: ", }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { _, err := ResolveLinkedTemplate(test.uri) if err != nil { assert.EqualError(t, err, test.wantErr) } }) } }
explode_data.jsonl/20145
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 56808, 7275, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 197, 6070, 257, 914, 198, 197, 50780, 7747, 914, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 17325, 33409, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunForEndpointsAndReturnFirst(t *testing.T) { tests := []struct { endpoints []string expectedEndpoint string }{ { endpoints: []string{"1", "2", "3"}, expectedEndpoint: "1", }, { endpoints: []string{"6", "5"}, expectedEndpoint: "5", }, { endpoints: []string{"10", "4"}, expectedEndpoint: "4", }, } for _, rt := range tests { returnKubeConfig := runForEndpointsAndReturnFirst(rt.endpoints, func(endpoint string) (*clientcmdapi.Config, error) { timeout, _ := strconv.Atoi(endpoint) time.Sleep(time.Second * time.Duration(timeout)) return kubeconfigutil.CreateBasic(endpoint, "foo", "foo", []byte{}), nil }) endpoint := returnKubeConfig.Clusters[returnKubeConfig.Contexts[returnKubeConfig.CurrentContext].Cluster].Server if endpoint != rt.expectedEndpoint { t.Errorf( "failed TestRunForEndpointsAndReturnFirst:\n\texpected: %s\n\t actual: %s", endpoint, rt.expectedEndpoint, ) } } }
explode_data.jsonl/52400
{ "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, 6727, 2461, 80786, 3036, 5598, 5338, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 6246, 7706, 286, 3056, 917, 198, 197, 42400, 27380, 914, 198, 197, 59403, 197, 197, 515, 298, 6246, 7706, 25, 286, 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...
1
func TestCount(t *testing.T) { tests := []struct { desc string it *Iter size int }{ {"empty", New(FromStrings([]string{})), 0}, {"non-empty", New(FromStrings([]string{"a"})), 1}, } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { got := tc.it.Count() if got != tc.size { t.Errorf("%s got count: %d but want: %d", tc.desc, got, tc.size) } }) } t.Run("multi", func(t *testing.T) { // Count is rewinds for an Interable that implements Rewinder. it := New(FromStrings([]string{"a"})) n := it.Count() m := it.Count() if n != m { t.Errorf("Count multiple times yield invalid value. First time: %d, second time: %d", n, m) } it = New(FromStrings([]string{"a", "b"})) newit := it.Filter(func(v interface{}) bool { return v.(string) == "a" }) c := newit.Count() if c != 1 { t.Errorf("Count after mutation function yields wrong value, got %d want 1", c) } }) }
explode_data.jsonl/56147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 395 }
[ 2830, 3393, 2507, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41653, 914, 198, 197, 23374, 256, 353, 8537, 198, 197, 13832, 526, 198, 197, 59403, 197, 197, 4913, 3194, 497, 1532, 7, 3830, 20859, 10556, 917, 6257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExemplarSlice_CopyTo(t *testing.T) { dest := NewExemplarSlice() // Test CopyTo to empty NewExemplarSlice().CopyTo(dest) assert.EqualValues(t, NewExemplarSlice(), dest) // Test CopyTo larger slice generateTestExemplarSlice().CopyTo(dest) assert.EqualValues(t, generateTestExemplarSlice(), dest) // Test CopyTo same size slice generateTestExemplarSlice().CopyTo(dest) assert.EqualValues(t, generateTestExemplarSlice(), dest) }
explode_data.jsonl/32763
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 840, 25892, 277, 33236, 77637, 1249, 1155, 353, 8840, 836, 8, 341, 49616, 1669, 1532, 840, 25892, 277, 33236, 741, 197, 322, 3393, 14540, 1249, 311, 4287, 198, 197, 3564, 840, 25892, 277, 33236, 1005, 12106, 1249, 27010, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClientSnifferCallback(t *testing.T) { var calls int cb := func(node *NodesInfoNode) bool { calls++ return false } _, err := NewClient( SetURL("http://127.0.0.1:19200", "http://127.0.0.1:9200"), SetSnifferCallback(cb)) if err == nil { t.Fatalf("expected cluster to fail with no nodes found") } if calls != 1 { t.Fatalf("expected 1 call to the sniffer callback, got %d", calls) } }
explode_data.jsonl/37997
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 2959, 20720, 14320, 7494, 1155, 353, 8840, 836, 8, 341, 2405, 6738, 526, 198, 63810, 1669, 2915, 6958, 353, 12288, 1731, 1955, 8, 1807, 341, 197, 1444, 5583, 22940, 197, 853, 895, 198, 197, 532, 197, 6878, 1848, 1669, 1532...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParsingTimeYaml(t *testing.T) { parseYamlTimeAndCheck(t, "02:03") _, err := parseYamlTime("02:62") assert.EqualError(t, err, `Yaml error parsing time "02:62": minute out of range`) }
explode_data.jsonl/24538
{ "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, 68839, 1462, 56, 9467, 1155, 353, 8840, 836, 8, 341, 75115, 56, 9467, 1462, 3036, 3973, 1155, 11, 330, 15, 17, 25, 15, 18, 1138, 197, 6878, 1848, 1669, 4715, 56, 9467, 1462, 445, 15, 17, 25, 21, 17, 1138, 6948, 12808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPowerSet(t *testing.T) { set := []int{1, 2, 3, 4} t.Run("Get all combinations", func(t *testing.T) { powerSet := GetPowerSet(set) assert.Equal(t, 16, len(powerSet)) }) }
explode_data.jsonl/28833
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 1949, 14986, 1649, 1155, 353, 8840, 836, 8, 341, 8196, 1669, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 630, 3244, 16708, 445, 1949, 678, 27459, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3223, 1202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewServiceEntryController(t *testing.T) { config, err := clientcmd.BuildConfigFromFlags("", "../../test/resources/admins@fake-cluster.k8s.local") if err != nil { t.Errorf("%v", err) } stop := make(chan struct{}) handler := test.MockServiceEntryHandler{} serviceEntryController, err := NewServiceEntryController(stop, &handler, config, time.Duration(1000)) if err != nil { t.Errorf("Unexpected err %v", err) } if serviceEntryController == nil { t.Errorf("ServiceEntry controller should never be nil without an error thrown") } serviceEntry := &v1alpha32.ServiceEntry{Spec: v1alpha3.ServiceEntry{}, ObjectMeta: v1.ObjectMeta{Name: "se1", Namespace: "namespace1"}} serviceEntryController.Added(serviceEntry) if !cmp.Equal(serviceEntry.Spec, handler.Obj.Spec) { t.Errorf("Handler should have the added obj") } updatedServiceEntry := &v1alpha32.ServiceEntry{Spec: v1alpha3.ServiceEntry{Hosts: []string{"hello.global"}}, ObjectMeta: v1.ObjectMeta{Name: "se1", Namespace: "namespace1"}} serviceEntryController.Updated(updatedServiceEntry, serviceEntry) if !cmp.Equal(updatedServiceEntry.Spec, handler.Obj.Spec) { t.Errorf("Handler should have the updated obj") } serviceEntryController.Deleted(serviceEntry) if handler.Obj != nil { t.Errorf("Handler should have no obj") } }
explode_data.jsonl/11889
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 434 }
[ 2830, 3393, 3564, 1860, 5874, 2051, 1155, 353, 8840, 836, 8, 341, 25873, 11, 1848, 1669, 2943, 8710, 25212, 2648, 3830, 9195, 19814, 10208, 1944, 38900, 17402, 82, 31, 30570, 93208, 5202, 23, 82, 11033, 1138, 743, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestWorkflowSetInitial(t *testing.T) { workflow := &Workflow{ TaskTemplates: []TaskTemplate{ TaskTemplate{ TaskName: "First", Initial: false, }, TaskTemplate{ TaskName: "Second", Initial: false, }, }, } workflow.SetInitial("First") assert.True(t, workflow.TaskTemplates[0].Initial) assert.False(t, workflow.TaskTemplates[1].Initial) workflow.SetInitial("Second") assert.False(t, workflow.TaskTemplates[0].Initial) assert.True(t, workflow.TaskTemplates[1].Initial) }
explode_data.jsonl/19597
{ "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, 62768, 1649, 6341, 1155, 353, 8840, 836, 8, 341, 197, 56249, 1669, 609, 62768, 515, 197, 81153, 51195, 25, 3056, 6262, 7275, 515, 298, 81153, 7275, 515, 571, 81153, 675, 25, 330, 5338, 756, 571, 197, 6341, 25, 220, 895, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_runAudit(t *testing.T) { type args struct { audit string output string } tests := []struct { name string args args errMsg string output string }{ { name: "run success", args: args{ audit: "echo 'hello world'", }, errMsg: "", output: "hello world\n", }, { name: "run multiple lines script", args: args{ audit: ` hello() { echo "hello world" } hello `, }, errMsg: "", output: "hello world\n", }, { name: "run failed", args: args{ audit: "unknown_command", }, errMsg: "failed to run: \"unknown_command\", output: \"/bin/sh: ", output: "not found\n", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var errMsg string output, err := runAudit(tt.args.audit) if err != nil { errMsg = err.Error() } if errMsg != "" && !strings.Contains(errMsg, tt.errMsg) { t.Errorf("name %s errMsg = %q, want %q", tt.name, errMsg, tt.errMsg) } if errMsg == "" && output != tt.output { t.Errorf("name %s output = %q, want %q", tt.name, output, tt.output) } if errMsg != "" && !strings.Contains(output, tt.output) { t.Errorf("name %s output = %q, want %q", tt.name, output, tt.output) } }) } }
explode_data.jsonl/69363
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 583 }
[ 2830, 3393, 14007, 74516, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 197, 48545, 220, 914, 198, 197, 21170, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 31215, 256, 2827, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestTypeMismatch(t *testing.T) { // Verifies that: // 1. Mismatches between the given type and data, i.e. `Person` and // the data item is a string, are properly caught: //{ // "name": "contents", // "type": "Person" //}, //{ // "contents": "Hello, Bob!" <-- string not "Person" //} // 2. Nonexistent types are properly caught: //{ // "name": "contents", // "type": "Blahonga" //} jsonTypedData := ` { "types": { "EIP712Domain": [ { "name": "name", "type": "string" }, { "name": "version", "type": "string" }, { "name": "chainId", "type": "uint256" }, { "name": "verifyingContract", "type": "address" } ], "Person": [ { "name": "name", "type": "string" }, { "name": "wallet", "type": "address" } ], "Mail": [ { "name": "from", "type": "Person" }, { "name": "to", "type": "Person" }, { "name": "contents", "type": "Person" } ] }, "primaryType": "Mail", "domain": { "name": "Ether Mail", "version": "1", "chainId": 1, "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" }, "message": { "from": { "name": "Cow", "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826" }, "to": { "name": "Bob", "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" }, "contents": "Hello, Bob!" } } ` var mismatchTypedData core.TypedData err := json.Unmarshal([]byte(jsonTypedData), &mismatchTypedData) if err != nil { t.Fatalf("unmarshalling failed '%v'", err) } _, err = mismatchTypedData.HashStruct(mismatchTypedData.PrimaryType, mismatchTypedData.Message) if err.Error() != "provided data 'Hello, Bob!' doesn't match type 'Person'" { t.Errorf("Expected `provided data 'Hello, Bob!' doesn't match type 'Person'`, got '%v'", err) } mismatchTypedData.Types["Mail"][2].Type = "Blahonga" _, err = mismatchTypedData.HashStruct(mismatchTypedData.PrimaryType, mismatchTypedData.Message) if err == nil || err.Error() != "reference type 'Blahonga' is undefined" { t.Fatalf("Expected `reference type 'Blahonga' is undefined`, got '%v'", err) } }
explode_data.jsonl/30003
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1378 }
[ 2830, 3393, 929, 82572, 1155, 353, 8840, 836, 8, 341, 197, 322, 6250, 9606, 429, 510, 197, 322, 220, 16, 13, 386, 2142, 9118, 1948, 279, 2661, 943, 323, 821, 11, 600, 1734, 13, 1565, 10680, 63, 323, 198, 197, 322, 7018, 32088, 821...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddTrailingSlash(t *testing.T) { lee := leego.New() req := standard.NewRequest(httptest.NewRequest(leego.GET, "/add-slash", nil)) rec := standard.NewResponse(httptest.NewRecorder()) c := lee.NewContext(req, rec) h := AddTrailingSlash()(func(c leego.Context) leego.LeeError { return nil }) h(c) assert.Equal(t, "/add-slash/", req.URL().Path()) assert.Equal(t, "/add-slash/", req.URI()) // With config req = standard.NewRequest(httptest.NewRequest(leego.GET, "/add-slash?key=value", nil)) rec = standard.NewResponse(httptest.NewRecorder()) c = lee.NewContext(req, rec) h = AddTrailingSlashWithConfig(TrailingSlashConfig{ RedirectCode: http.StatusMovedPermanently, })(func(c leego.Context) leego.LeeError { return nil }) h(c) assert.Equal(t, http.StatusMovedPermanently, rec.Status()) assert.Equal(t, "/add-slash/?key=value", rec.Header().Get(leego.HeaderLocation)) }
explode_data.jsonl/46921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 363 }
[ 2830, 3393, 2212, 1282, 14277, 88004, 1155, 353, 8840, 836, 8, 341, 197, 8501, 1669, 512, 13243, 7121, 2822, 24395, 1669, 5297, 75274, 73392, 83, 70334, 75274, 74824, 13243, 17410, 11, 3521, 718, 1331, 24686, 497, 2092, 1171, 67904, 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 TestWindowsUNCPathsAreRemoved(t *testing.T) { wf := wfv1.MustUnmarshalWorkflow(helloWindowsWf) uncVolume := apiv1.Volume{ Name: "unc", VolumeSource: apiv1.VolumeSource{ HostPath: &apiv1.HostPathVolumeSource{ Path: "\\\\.\\pipe\\test", }, }, } uncMount := apiv1.VolumeMount{ Name: "unc", MountPath: "\\\\.\\pipe\\test", } // Add artifacts so that initContainer volumeMount logic is run inp := wfv1.Artifact{ Name: "kubectl", Path: "C:\\kubectl", ArtifactLocation: wfv1.ArtifactLocation{HTTP: &wfv1.HTTPArtifact{ URL: "https://dl.k8s.io/release/v1.22.0/bin/windows/amd64/kubectl.exe"}, }, } wf.Spec.Volumes = append(wf.Spec.Volumes, uncVolume) wf.Spec.Templates[0].Container.VolumeMounts = append(wf.Spec.Templates[0].Container.VolumeMounts, uncMount) wf.Spec.Templates[0].Inputs.Artifacts = append(wf.Spec.Templates[0].Inputs.Artifacts, inp) woc := newWoc(*wf) ctx := context.Background() mainCtr := woc.execWf.Spec.Templates[0].Container pod, _ := woc.createWorkflowPod(ctx, wf.Name, []apiv1.Container{*mainCtr}, &wf.Spec.Templates[0], &createWorkflowPodOpts{}) waitCtrIdx, err := wfutil.FindWaitCtrIndex(pod) if err != nil { assert.Errorf(t, err, "could not find wait ctr index") } for _, mnt := range pod.Spec.Containers[waitCtrIdx].VolumeMounts { assert.NotEqual(t, mnt.Name, "unc") } for _, initCtr := range pod.Spec.InitContainers { if initCtr.Name == common.InitContainerName { for _, mnt := range initCtr.VolumeMounts { assert.NotEqual(t, mnt.Name, "unc") } } } }
explode_data.jsonl/75398
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 668 }
[ 2830, 3393, 13164, 12633, 26901, 11526, 42642, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 289, 27890, 16, 50463, 1806, 27121, 62768, 3203, 4791, 13164, 54, 69, 340, 197, 1347, 18902, 1669, 1443, 344, 16, 79106, 515, 197, 21297, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestGetAllPlugins(t *testing.T) { config.SetUpMockConfig(t) defer func() { err := common.TruncateDB(common.InMemory) if err != nil { t.Fatalf("error: %v", err) } err = common.TruncateDB(common.OnDisk) if err != nil { t.Fatalf("error: %v", err) } }() mockPlugins(t) plugins, err := GetAllPlugins() assert.Nil(t, err, "Error Should be nil") assert.Equal(t, 3, len(plugins), "should be only 3 plugins") }
explode_data.jsonl/49403
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 1949, 2403, 45378, 1155, 353, 8840, 836, 8, 341, 25873, 4202, 2324, 11571, 2648, 1155, 340, 16867, 2915, 368, 341, 197, 9859, 1669, 4185, 8240, 26900, 3506, 57802, 5337, 10642, 340, 197, 743, 1848, 961, 2092, 341, 298, 3244,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntegration_ExternalAdapter_RunLogInitiated(t *testing.T) { t.Parallel() rpcClient, gethClient, sub, assertMockCalls := cltest.NewEthMocks(t) defer assertMockCalls() app, cleanup := cltest.NewApplication(t, eth.NewClientWith(rpcClient, gethClient), ) defer cleanup() gethClient.On("ChainID", mock.Anything).Return(app.Config.ChainID(), nil) sub.On("Err").Return(nil) sub.On("Unsubscribe").Return(nil) newHeadsCh := make(chan chan<- *models.Head, 1) logsCh := cltest.MockSubscribeToLogsCh(gethClient, sub) rpcClient.On("CallContext", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) rpcClient.On("EthSubscribe", mock.Anything, mock.Anything, "newHeads"). Run(func(args mock.Arguments) { newHeadsCh <- args.Get(1).(chan<- *models.Head) }). Return(sub, nil) require.NoError(t, app.Start()) eaValue := "87698118359" eaExtra := "other values to be used by external adapters" eaResponse := fmt.Sprintf(`{"data":{"result": "%v", "extra": "%v"}}`, eaValue, eaExtra) mockServer, ensureRequest := cltest.NewHTTPMockServer(t, http.StatusOK, "POST", eaResponse) defer ensureRequest() bridgeJSON := fmt.Sprintf(`{"name":"randomNumber","url":"%v","confirmations":10}`, mockServer.URL) cltest.CreateBridgeTypeViaWeb(t, app, bridgeJSON) j := cltest.FixtureCreateJobViaWeb(t, app, "fixtures/web/log_initiated_bridge_type_job.json") logBlockNumber := 1 runlog := cltest.NewRunLog(t, j.ID, cltest.NewAddress(), cltest.NewAddress(), logBlockNumber, `{}`) logs := <-logsCh logs <- runlog jr := cltest.WaitForRuns(t, j, app.Store, 1)[0] cltest.WaitForJobRunToPendIncomingConfirmations(t, app.Store, jr) newHeads := <-newHeadsCh newHeads <- cltest.Head(logBlockNumber + 8) cltest.WaitForJobRunToPendIncomingConfirmations(t, app.Store, jr) confirmedReceipt := &types.Receipt{ TxHash: runlog.TxHash, BlockHash: runlog.BlockHash, BlockNumber: big.NewInt(int64(logBlockNumber)), } gethClient.On("TransactionReceipt", mock.Anything, mock.Anything). Return(confirmedReceipt, nil) newHeads <- cltest.Head(logBlockNumber + 9) jr = cltest.SendBlocksUntilComplete(t, app.Store, jr, newHeads, int64(logBlockNumber+9), gethClient) tr := jr.TaskRuns[0] assert.Equal(t, "randomnumber", tr.TaskSpec.Type.String()) value := cltest.MustResultString(t, tr.Result) assert.Equal(t, eaValue, value) res := tr.Result.Data.Get("extra") assert.Equal(t, eaExtra, res.String()) }
explode_data.jsonl/75894
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 942 }
[ 2830, 3393, 52464, 62, 25913, 5940, 84158, 2201, 3803, 10029, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 7000, 3992, 2959, 11, 633, 71, 2959, 11, 1186, 11, 2060, 11571, 55292, 1669, 1185, 1944, 7121, 65390, 72577, 1155, 340,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAgingPayablesListEndpoint_List_all(t *testing.T) { s, mux, _, teardown := setup() defer teardown() acceptHeaders := []string{"application/json"} opts1 := api.NewListOptions() opts1.Select.Add("*") u, e := s.client.ResolvePathWithDivision("/api/v1/{division}/read/financial/AgingPayablesList", 0) if e != nil { t.Errorf("s.client.ResolvePathWithDivision in AgingPayablesListEndpoint.List returned error: %v, with url /api/v1/{division}/read/financial/AgingPayablesList?$select=*", e) } api.AddListOptionsToURL(u, opts1) opts2 := api.NewListOptions() opts2.Select.Add("*") opts2.SkipToken.Set(types.NewGUID()) u2, e2 := s.client.ResolvePathWithDivision("/api/v1/{division}/read/financial/AgingPayablesList", 0) if e2 != nil { t.Errorf("s.client.ResolvePathWithDivision in AgingPayablesListEndpoint.List returned error: %v, with url /api/v1/{division}/read/financial/AgingPayablesList?$skiptoken=foo", e2) } api.AddListOptionsToURL(u2, opts2) g := AgingPayablesListPrimaryPropertySample() gs := AgingPayablesListStringJSONOfPrimaryProperty(g) mux.HandleFunc(u.Path, func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", ")) if r.URL.Query().Get("$skiptoken") != "" { fmt.Fprint(w, `{ "d": { "__next": "", "results": []}}`) } else { fmt.Fprint(w, `{ "d": { "__next": "`+u2.String()+`", "results": [{ "AccountId": `+gs+`}]}}`) } }) entities, err := s.AgingPayablesList.List(context.Background(), 0, true, opts1) if err != nil { t.Errorf("AgingPayablesListEndpoint.List returned error: %v", err) } want := []*AgingPayablesList{{AccountId: g}} if !reflect.DeepEqual(entities, want) { t.Errorf("AgingPayablesListEndpoint.List returned %+v, want %+v", entities, want) } }
explode_data.jsonl/28470
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 725 }
[ 2830, 3393, 32, 3173, 20595, 4788, 852, 27380, 27104, 5705, 1155, 353, 8840, 836, 8, 341, 1903, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 197, 10330, 10574, 1669, 3056, 917, 4913, 5132, 8931, 63159, 64734, 16, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestApplication_FindCepNotFoundSave(t *testing.T) { cr := new(CepRepositoryMock) s := "12345678" cr.On("GetCep", s).Return(nil, true) cr.On("SaveCep", s).Return(&model.Cep{}, false) app := GetInstance(cr) cep, err := app.FindCep(s) if err != nil { t.Error("error getting cep") } cr.AssertExpectations(t) assert.Equal(t, &model.Cep{}, cep) }
explode_data.jsonl/58367
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 4988, 95245, 34, 747, 10372, 8784, 1155, 353, 8840, 836, 8, 341, 91492, 1669, 501, 3025, 747, 4624, 11571, 340, 1903, 1669, 330, 16, 17, 18, 19, 20, 21, 22, 23, 698, 91492, 8071, 445, 1949, 34, 747, 497, 274, 568, 5598...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestExecute(t *testing.T) { t.Run("success", func(t *testing.T) { tests := []*struct { name string template string commands map[string]string vars map[string]string result string }{ { name: "raw string", template: `just ra\w string`, result: `just raw string`, }, { name: "variable", template: `a{var:b}c{var:dd}e`, result: `a<b_val>c<dd_val>e`, vars: map[string]string{ "b": "<b_val>", "dd": "<dd_val>", }, }, { name: "cmd", template: `a{cmd:cmd1}b{cmd:cmd2}c`, result: `a<cmd1_result>b<cmd2_result>c`, commands: map[string]string{ "cmd1": "<cmd1_result>", "cmd2": "<cmd2_result>", }, }, { name: "variable+cmd", template: `a{var:var1}b{cmd:cmd1}c`, result: `a<var1_val>b<cmd1_result>c`, vars: map[string]string{ "var1": "<var1_val>", }, commands: map[string]string{ "cmd1": "<cmd1_result>", }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { sections, err := Parse(test.template) require.NoError(t, err) result, err := Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { v, ok := test.vars[name] return v, ok }, ExecCmd: func(command string, dir string, env []string) (string, error) { if v, ok := test.commands[command]; ok { return v, nil } return "", fmt.Errorf("test command not found: %q", command) }, }) require.NoError(t, err) assert.Equal(t, test.result, result) }) } }) t.Run("command dir", func(t *testing.T) { sections, err := Parse("{cmd:my_command:my_dir}") require.NoError(t, err) numExecCalls := 0 result, err := Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { t.Fatal("unexpected LookupVar call") return "", false }, ExecCmd: func(command string, dir string, env []string) (string, error) { numExecCalls += 1 assert.Equal(t, command, "my_command") assert.Equal(t, dir, "my_dir") return "", nil }, }) require.NoError(t, err) assert.Equal(t, "", result) assert.Equal(t, 1, numExecCalls) }) t.Run("command env", func(t *testing.T) { sections, err := Parse("{cmd:my_command:my_dir:env1=val1:env2=val2}") require.NoError(t, err) numExecCalls := 0 result, err := Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { t.Fatal("unexpected LookupVar call") return "", false }, ExecCmd: func(command string, dir string, env []string) (string, error) { numExecCalls += 1 assert.Equal(t, command, "my_command") assert.Equal(t, dir, "my_dir") assert.Equal(t, env, []string{"env1=val1", "env2=val2"}) return "", nil }, }) require.NoError(t, err) assert.Equal(t, "", result) assert.Equal(t, 1, numExecCalls) }) t.Run("undefined variable", func(t *testing.T) { sections, err := Parse("{var:undefined}") require.NoError(t, err) _, err = Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { return "", false }, ExecCmd: func(command string, dir string, env []string) (string, error) { t.Fatal("unexpected ExecCmd call") return "", nil }, }) assert.EqualError(t, err, `template variable "{var:undefined}" isn't defined`) }) t.Run("command failure", func(t *testing.T) { sections, err := Parse("{cmd:my_command}") require.NoError(t, err) _, err = Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { t.Fatal("unexpected LookupVar call") return "", false }, ExecCmd: func(command string, dir string, env []string) (string, error) { return "", assert.AnError }, }) assert.EqualError(t, err, `error executing command "my_command": `+assert.AnError.Error()) }) t.Run("invalid instruction", func(t *testing.T) { sections, err := Parse("{invalid_instruction:instruction_param1:instruction_param2}") require.NoError(t, err) _, err = Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { t.Fatal("unexpected LookupVar call") return "", false }, ExecCmd: func(command string, dir string, env []string) (string, error) { t.Fatal("unexpected ExecCmd call") return "", nil }, }) assert.EqualError(t, err, `unknown template instruction: "invalid_instruction"`) }) t.Run("ignore invalid instruction", func(t *testing.T) { sections, err := Parse("{test-invalid-instruction:undefined}\\\\\\{\\}\\:") require.NoError(t, err) result, err := Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { t.Fatal("unexpected LookupVar call") return "", false }, ExecCmd: func(command string, dir string, env []string) (string, error) { t.Fatal("unexpected ExecCmd call") return "", nil }, IgnoreUnknownTemplateParams: true, }) require.NoError(t, err) assert.Equal(t, "{test-invalid-instruction:undefined}\\{}:", result) }) t.Run("escaped result", func(t *testing.T) { sections, err := Parse("{var:MY_VAR}\\\\\\{\\}\\:") require.NoError(t, err) result, err := Execute(&ExecuteInput{ Sections: sections, LookupVar: func(name string) (string, bool) { assert.Equal(t, "MY_VAR", name) return "{my:var:value}", true }, ExecCmd: func(command string, dir string, env []string) (string, error) { t.Fatal("unexpected ExecCmd call") return "", nil }, EscapedResult: true, }) require.NoError(t, err) assert.Equal(t, "\\{my\\:var\\:value\\}\\\\\\{\\}\\:", result) }) }
explode_data.jsonl/9577
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2562 }
[ 2830, 3393, 17174, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5630, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 78216, 1669, 29838, 1235, 341, 298, 11609, 257, 914, 198, 298, 22832, 914, 198, 298, 197, 24270, 2415, 14032, 30953...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMemberCancelInviteEmail(t *testing.T) { tc, _, name := memberSetup(t) defer tc.Cleanup() tc.G.SetServices(externals.GetServices()) address := "noone@keybase.io" if err := InviteEmailMember(context.TODO(), tc.G, name, address, keybase1.TeamRole_READER); err != nil { t.Fatal(err) } assertInvite(tc, name, address, "email", keybase1.TeamRole_READER) if err := CancelEmailInvite(context.TODO(), tc.G, name, address); err != nil { t.Fatal(err) } assertNoInvite(tc, name, address, "email") // check error type for an email address with no invite err := CancelEmailInvite(context.TODO(), tc.G, name, "nope@keybase.io") if err == nil { t.Fatal("expected error canceling email invite for unknown email address") } if _, ok := err.(libkb.NotFoundError); !ok { t.Errorf("expected libkb.NotFoundError, got %T", err) } // check error type for unknown team err = CancelEmailInvite(context.TODO(), tc.G, "notateam", address) if err == nil { t.Fatal("expected error canceling email invite for unknown team") } if _, ok := err.(TeamDoesNotExistError); !ok { t.Errorf("expected teams.TeamDoesNotExistError, got %T", err) } }
explode_data.jsonl/13536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 427 }
[ 2830, 3393, 9366, 9269, 93540, 4781, 1155, 353, 8840, 836, 8, 341, 78255, 11, 8358, 829, 1669, 4462, 21821, 1155, 340, 16867, 17130, 727, 60639, 2822, 78255, 1224, 4202, 11025, 7, 4301, 1127, 2234, 11025, 12367, 63202, 1669, 330, 2152, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpenKeeper(t *testing.T) { tests := []struct { URL string WantErr bool }{ {"stringkey://my-secret", false}, {"stringkey://my-secret?param=value", true}, {"base64key://bXktc2VjcmV0LWtleQ==", false}, {"base64key://bXktc2VjcmV0LWtleQ==?param=value", true}, {"base64key://not-valid-base64", true}, } ctx := context.Background() for _, test := range tests { _, err := secrets.OpenKeeper(ctx, test.URL) if (err != nil) != test.WantErr { t.Errorf("%s: got error %v, want error %v", test.URL, err, test.WantErr) } } }
explode_data.jsonl/7822
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 241 }
[ 2830, 3393, 5002, 77233, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 79055, 257, 914, 198, 197, 17300, 517, 7747, 1807, 198, 197, 59403, 197, 197, 4913, 917, 792, 1110, 2408, 68892, 497, 895, 1583, 197, 197, 4913,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestValidateHTTPHeaderName(t *testing.T) { testCases := []struct { name string valid bool }{ {name: "header1", valid: true}, {name: "X-Requested-With", valid: true}, {name: "", valid: false}, } for _, tc := range testCases { if got := ValidateHTTPHeaderName(tc.name); (got == nil) != tc.valid { t.Errorf("ValidateHTTPHeaderName(%q) => got valid=%v, want valid=%v", tc.name, got == nil, tc.valid) } } }
explode_data.jsonl/56909
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 17926, 98752, 675, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 56322, 1807, 198, 197, 59403, 197, 197, 47006, 25, 330, 2708, 16, 497, 2697, 25, 830, 1583, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestQueryFilter(t *testing.T) { api := &mockSCIONDService{ replies: []*sciond.PathReply{ buildSCIONDReply(pathXY1, pathXY2), }, } Convey("Create path manager", t, func() { pm, err := New(api, &Timers{}, log.Root()) SoMsg("pm", pm, ShouldNotBeNil) SoMsg("err", err, ShouldBeNil) Convey("Query with filter, only one path should remain", func() { pp, err := NewPathPredicate("0-0#211") SoMsg("err", err, ShouldBeNil) SoMsg("pp", pp, ShouldNotBeNil) aps := pm.QueryFilter(iaX, iaY, pp) SoMsg("aps", aps, ShouldResemble, buildAPS(pathXY1)) }) }) }
explode_data.jsonl/25284
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 2859, 5632, 1155, 353, 8840, 836, 8, 341, 54299, 1669, 609, 16712, 3540, 1271, 35, 1860, 515, 197, 17200, 7202, 25, 29838, 2388, 290, 67, 17474, 20841, 515, 298, 69371, 3540, 1271, 35, 20841, 5581, 16356, 16, 11, 1815, 163...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRevelWithFieldsOutput(t *testing.T) { l, b := newBufferedRevelLog() l.WithFields("test", true).Warn("This is a message.") expectedMatch := "WARN.*This is a message. test=true\n" actual := b.String() if ok, _ := regexp.Match(expectedMatch, []byte(actual)); !ok { t.Errorf("Log output mismatch %s (actual) != %s (expected)", actual, expectedMatch) } }
explode_data.jsonl/3454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 693, 889, 2354, 8941, 5097, 1155, 353, 8840, 836, 8, 341, 8810, 11, 293, 1669, 501, 4095, 291, 693, 889, 2201, 741, 8810, 26124, 8941, 445, 1944, 497, 830, 568, 38244, 445, 1986, 374, 264, 1943, 31225, 42400, 8331, 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 Test_SalesReports_Filter_SetType(t *testing.T) { filter := &SalesReportsFilter{} filter.TypeSales() assert.Equal(t, filter.ReportType, SalesReportTypeSales) filter.TypeNewsStand() assert.Equal(t, filter.ReportType, SalesReportTypeNewsStand) filter.TypePreOrder() assert.Equal(t, filter.ReportType, SalesReportTypePreorder) filter.TypeSubscriber() assert.Equal(t, filter.ReportType, SalesReportTypeSubscriber) filter.TypeSubscription() assert.Equal(t, filter.ReportType, SalesReportTypeSubscription) filter.TypeSubscriptionEvent() assert.Equal(t, filter.ReportType, SalesReportTypeSubscriptionEvent) }
explode_data.jsonl/60786
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 1098, 3831, 23748, 68935, 14812, 929, 1155, 353, 8840, 836, 8, 341, 50108, 1669, 609, 35418, 23748, 5632, 16094, 50108, 10184, 35418, 741, 6948, 12808, 1155, 11, 4051, 25702, 929, 11, 15829, 10361, 929, 35418, 340, 50108, 1018...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestJson2Struct_slice_bool(t *testing.T) { ret, err := Json2Struct("auto_name", `[true,false,false,false]`, GoStructType) fmt.Printf("ret:\n %s, %v\n", ret, err) }
explode_data.jsonl/72751
{ "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, 5014, 17, 9422, 26488, 22159, 1155, 353, 8840, 836, 8, 341, 11262, 11, 1848, 1669, 8308, 17, 9422, 445, 3902, 1269, 497, 77644, 1866, 23367, 23367, 23367, 60, 7808, 5994, 9422, 929, 340, 11009, 19367, 445, 2122, 7190, 77, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDriverDefaults(t *testing.T) { testAdaptor := newAioTestAdaptor() pin := "456" drivers := []DriverAndPinner{ NewGroveSoundSensorDriver(testAdaptor, pin), NewGroveLightSensorDriver(testAdaptor, pin), NewGrovePiezoVibrationSensorDriver(testAdaptor, pin), NewGroveRotaryDriver(testAdaptor, pin), } for _, driver := range drivers { gobottest.Assert(t, driver.Connection(), testAdaptor) gobottest.Assert(t, driver.Pin(), pin) } }
explode_data.jsonl/1450
{ "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, 11349, 16273, 1155, 353, 8840, 836, 8, 341, 18185, 2589, 32657, 1669, 501, 32, 815, 2271, 2589, 32657, 741, 3223, 258, 1669, 330, 19, 20, 21, 1837, 2698, 81, 1945, 1669, 3056, 11349, 3036, 47, 4382, 515, 197, 197, 3564, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResponseErrorHTML(t *testing.T) { raw := "HTTP/1.1 413 Request Entity Too Large\r\n" + "\r\n" + `<html> <head><title>413 Request Entity Too Large</title></head> <body bgcolor="white"> <center><h1>413 Request Entity Too Large</h1></center> <hr><center>nginx/1.6.2</center> </body> </html>` + "\r\n" r := bufio.NewReader(strings.NewReader(raw)) req, err := http.NewRequest("GET", "/", nil) if err != nil { t.Fatal(err) } resp, err := http.ReadResponse(r, nil) if err != nil { t.Fatal(err) } err = checkResponse(req, resp) if err == nil { t.Fatalf("expected error; got: %v", err) } // Check for correct error message expected := fmt.Sprintf("elastic: Error %d (%s)", http.StatusRequestEntityTooLarge, http.StatusText(http.StatusRequestEntityTooLarge)) got := err.Error() if got != expected { t.Fatalf("expected %q; got: %q", expected, got) } }
explode_data.jsonl/16552
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 2582, 1454, 5835, 1155, 353, 8840, 836, 8, 341, 76559, 1669, 330, 9230, 14, 16, 13, 16, 220, 19, 16, 18, 6145, 10390, 24599, 20286, 12016, 1699, 1, 3610, 197, 197, 11934, 81, 1699, 1, 3610, 197, 197, 63, 27, 1551, 397,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSpaceService_Update(t *testing.T) { testCases := []struct { name string spaceKey string payload *model.UpdateSpaceScheme mockFile string wantHTTPMethod string endpoint string context context.Context wantHTTPCodeReturn int wantErr bool }{ { name: "UpdateSpaceWhenTheParametersAreCorrect", spaceKey: "DUMMY", payload: &model.UpdateSpaceScheme{ Name: "DUMMY Space - Updated", Description: &model.CreateSpaceDescriptionScheme{ Plain: &model.CreateSpaceDescriptionPlainScheme{ Value: "Dummy Space - Description - Updated", Representation: "plain", }, }, Homepage: &model.UpdateSpaceHomepageScheme{ID: "65798145"}, }, mockFile: "./mocks/get-space.json", wantHTTPMethod: http.MethodPut, endpoint: "/wiki/rest/api/space/DUMMY", context: context.Background(), wantHTTPCodeReturn: http.StatusOK, wantErr: false, }, { name: "UpdateSpaceWhenTheSpaceKeyIsNotProvided", spaceKey: "", payload: &model.UpdateSpaceScheme{ Name: "DUMMY Space - Updated", Description: &model.CreateSpaceDescriptionScheme{ Plain: &model.CreateSpaceDescriptionPlainScheme{ Value: "Dummy Space - Description - Updated", Representation: "plain", }, }, Homepage: &model.UpdateSpaceHomepageScheme{ID: "65798145"}, }, mockFile: "./mocks/get-space.json", wantHTTPMethod: http.MethodPut, endpoint: "/wiki/rest/api/space/DUMMY", context: context.Background(), wantHTTPCodeReturn: http.StatusOK, wantErr: true, }, { name: "UpdateSpaceWhenThePayloadIsNotProvided", spaceKey: "DUMMY", payload: nil, mockFile: "./mocks/get-space.json", wantHTTPMethod: http.MethodPut, endpoint: "/wiki/rest/api/space/DUMMY", context: context.Background(), wantHTTPCodeReturn: http.StatusOK, wantErr: true, }, { name: "UpdateSpaceWhenTheContextIsNotProvided", spaceKey: "DUMMY", payload: &model.UpdateSpaceScheme{ Name: "DUMMY Space - Updated", Description: &model.CreateSpaceDescriptionScheme{ Plain: &model.CreateSpaceDescriptionPlainScheme{ Value: "Dummy Space - Description - Updated", Representation: "plain", }, }, Homepage: &model.UpdateSpaceHomepageScheme{ID: "65798145"}, }, mockFile: "./mocks/get-space.json", wantHTTPMethod: http.MethodPut, endpoint: "/wiki/rest/api/space/DUMMY", context: nil, wantHTTPCodeReturn: http.StatusOK, wantErr: true, }, { name: "UpdateSpaceWhenTheRequestMethodIsIncorrect", spaceKey: "DUMMY", payload: &model.UpdateSpaceScheme{ Name: "DUMMY Space - Updated", Description: &model.CreateSpaceDescriptionScheme{ Plain: &model.CreateSpaceDescriptionPlainScheme{ Value: "Dummy Space - Description - Updated", Representation: "plain", }, }, Homepage: &model.UpdateSpaceHomepageScheme{ID: "65798145"}, }, mockFile: "./mocks/get-space.json", wantHTTPMethod: http.MethodGet, endpoint: "/wiki/rest/api/space/DUMMY", context: context.Background(), wantHTTPCodeReturn: http.StatusOK, wantErr: true, }, { name: "UpdateSpaceWhenTheStatusCodeIsIncorrect", spaceKey: "DUMMY", payload: &model.UpdateSpaceScheme{ Name: "DUMMY Space - Updated", Description: &model.CreateSpaceDescriptionScheme{ Plain: &model.CreateSpaceDescriptionPlainScheme{ Value: "Dummy Space - Description - Updated", Representation: "plain", }, }, Homepage: &model.UpdateSpaceHomepageScheme{ID: "65798145"}, }, mockFile: "./mocks/get-space.json", wantHTTPMethod: http.MethodPut, endpoint: "/wiki/rest/api/space/DUMMY", context: context.Background(), wantHTTPCodeReturn: http.StatusBadRequest, wantErr: true, }, { name: "UpdateSpaceWhenTheResponseBodyIsEmpty", spaceKey: "DUMMY", payload: &model.UpdateSpaceScheme{ Name: "DUMMY Space - Updated", Description: &model.CreateSpaceDescriptionScheme{ Plain: &model.CreateSpaceDescriptionPlainScheme{ Value: "Dummy Space - Description - Updated", Representation: "plain", }, }, Homepage: &model.UpdateSpaceHomepageScheme{ID: "65798145"}, }, mockFile: "./mocks/empty-json.json", wantHTTPMethod: http.MethodPut, endpoint: "/wiki/rest/api/space/DUMMY", context: context.Background(), wantHTTPCodeReturn: http.StatusOK, wantErr: true, }, } for _, testCase := range testCases { testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() //Init a new HTTP mock server mockOptions := mockServerOptions{ Endpoint: testCase.endpoint, MockFilePath: testCase.mockFile, MethodAccepted: testCase.wantHTTPMethod, ResponseCodeWanted: testCase.wantHTTPCodeReturn, } mockServer, err := startMockServer(&mockOptions) if err != nil { t.Fatal(err) } defer mockServer.Close() //Init the library instance mockClient, err := startMockClient(mockServer.URL) if err != nil { t.Fatal(err) } service := &SpaceService{client: mockClient} gotResult, gotResponse, err := service.Update(testCase.context, testCase.spaceKey, testCase.payload) if testCase.wantErr { if err != nil { t.Logf("error returned: %v", err.Error()) } assert.Error(t, err) } else { assert.NoError(t, err) assert.NotEqual(t, gotResponse, nil) assert.NotEqual(t, gotResult, nil) apiEndpoint, err := url.Parse(gotResponse.Endpoint) if err != nil { t.Fatal(err) } var endpointToAssert string if apiEndpoint.Query().Encode() != "" { endpointToAssert = fmt.Sprintf("%v?%v", apiEndpoint.Path, apiEndpoint.Query().Encode()) } else { endpointToAssert = apiEndpoint.Path } t.Logf("HTTP Endpoint Wanted: %v, HTTP Endpoint Returned: %v", testCase.endpoint, endpointToAssert) assert.Equal(t, testCase.endpoint, endpointToAssert) } }) } }
explode_data.jsonl/39246
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3028 }
[ 2830, 3393, 9914, 1860, 47393, 1155, 353, 8840, 836, 8, 1476, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 2290, 914, 198, 197, 1903, 1306, 1592, 1843, 914, 198, 197, 76272, 310, 353, 2528, 16689, 9914, 28906, 198, 197, 77333, 1703,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_can_list_group_targets_for_the_group_administrator_role_given_to_a_group(t *testing.T) { ctx, client, err := tests.NewClient(context.TODO()) require.NoError(t, err) role := okta.AssignRoleRequest{ Type: "USER_ADMIN", } gp := &okta.GroupProfile{ Name: "SDK_TEST Assign Admin Role To Group", } g := &okta.Group{ Profile: gp, } group, _, err := client.Group.CreateGroup(ctx, *g) require.NoError(t, err, "Should not error when creating a group") addedRole, response, err := client.Group.AssignRoleToGroup(ctx, group.Id, role, nil) require.NoError(t, err, "adding role to user must not error") response, err = client.Group.AddGroupTargetToGroupAdministratorRoleForGroup(ctx, group.Id, addedRole.Id, group.Id) require.NoError(t, err, "list group assignments must not error") require.IsType(t, &okta.Response{}, response, "did not return `*okta.Response` type as second variable") assert.Equal(t, "PUT", response.Response.Request.Method, "did not make a get request") assert.Equal(t, "/api/v1/groups/"+group.Id+"/roles/"+addedRole.Id+"/targets/groups/"+group.Id, response.Response.Request.URL.Path, "path for request was incorrect") listRoles, response, err := client.Group.ListGroupTargetsForGroupRole(ctx, group.Id, addedRole.Id, nil) require.NoError(t, err, "list group assignments must not error") require.IsType(t, &okta.Response{}, response, "did not return `*okta.Response` type as second variable") require.IsType(t, []*okta.Group{}, listRoles, "did not return `[]*okta.Group` type as first variable") assert.Equal(t, "GET", response.Response.Request.Method, "did not make a get request") assert.Equal(t, "/api/v1/groups/"+group.Id+"/roles/"+addedRole.Id+"/targets/groups", response.Response.Request.URL.Path, "path for request was incorrect") assert.NotEmpty(t, listRoles[0].Id, "id should not be empty") assert.NotEmpty(t, listRoles[0].ObjectClass, "objectClass should not be empty") assert.NotEmpty(t, listRoles[0].Profile, "profile should not be empty") assert.IsType(t, &okta.GroupProfile{}, listRoles[0].Profile, "profile should be instance of *okta.GroupProfile") _, err = client.Group.DeleteGroup(ctx, group.Id) require.NoError(t, err, "Should not error when deleting a group") }
explode_data.jsonl/31234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 782 }
[ 2830, 3393, 27421, 2019, 6288, 41997, 5478, 16068, 6288, 12207, 18690, 19792, 57653, 2346, 4306, 6288, 1155, 353, 8840, 836, 8, 341, 20985, 11, 2943, 11, 1848, 1669, 7032, 7121, 2959, 5378, 90988, 2398, 17957, 35699, 1155, 11, 1848, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMatchAnyRegexps(t *testing.T) { matchers, err := InitMatchers("\\.gz$") assert.Nil(t, err) assert.Equal(t, MatchAny(matchers, "/var/log/log.gz"), true) }
explode_data.jsonl/36934
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 8331, 8610, 32464, 1690, 1155, 353, 8840, 836, 8, 341, 47706, 388, 11, 1848, 1669, 15690, 37862, 29710, 13, 46589, 87653, 6948, 59678, 1155, 11, 1848, 340, 6948, 12808, 1155, 11, 14152, 8610, 25401, 388, 11, 3521, 947, 19413...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRedisCache_Suite(t *testing.T) { t.Parallel() if testing.Short() { t.Skipf("Skipping integration test in short mode") return } suite.Run(t, new(RedisCacheTestSuite)) }
explode_data.jsonl/14341
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 48137, 8233, 1098, 9302, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 69, 445, 85945, 17590, 1273, 304, 2805, 3856, 1138, 197, 853, 198, 197, 630, 96572, 16708, 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 ]
2
func TestConstantTimeCompare(t *testing.T) { for i, test := range testConstantTimeCompareData { if r := ConstantTimeCompare(test.a, test.b); r != test.out { t.Errorf("#%d bad result (got %x, want %x)", i, r, test.out) } } }
explode_data.jsonl/79467
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 15472, 1462, 27374, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 1273, 1669, 2088, 1273, 15472, 1462, 27374, 1043, 341, 197, 743, 435, 1669, 19305, 1462, 27374, 8623, 5849, 11, 1273, 948, 1215, 435, 961, 1273, 2532, 341, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestOutput(t *testing.T) { wfCtx := mockContext(t) r := require.New(t) taskValue, err := value.NewValue(` output: score: 99 `, nil, "") r.NoError(err) err = Output(wfCtx, taskValue, v1beta1.WorkflowStep{ Properties: &runtime.RawExtension{ Raw: []byte("{\"name\":\"mystep\"}"), }, Outputs: common.StepOutputs{{ ValueFrom: "output.score", Name: "myscore", }}, }, common.WorkflowStepPhaseSucceeded) r.NoError(err) result, err := wfCtx.GetVar("myscore") r.NoError(err) s, err := result.String() r.NoError(err) r.Equal(s, `99 `) ready, err := wfCtx.GetVar(ReadyComponent, "mystep") r.NoError(err) s, err = ready.String() r.NoError(err) r.Equal(s, `true `) }
explode_data.jsonl/53514
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 5097, 1155, 353, 8840, 836, 8, 341, 6692, 69, 23684, 1669, 7860, 1972, 1155, 340, 7000, 1669, 1373, 7121, 1155, 340, 49115, 1130, 11, 1848, 1669, 897, 7121, 1130, 61528, 3006, 25, 5456, 25, 220, 24, 24, 715, 7808, 2092, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadTemplate(t *testing.T) { // Load template absPath, err := filepath.Abs("../../tests/files/") assert.NotNil(t, absPath) assert.Nil(t, err) templatePath := absPath + "/template.json" content, err := readTemplate(templatePath) assert.Nil(t, err) // Setup ES client := GetTestingElasticsearch() err = client.Connect(5 * time.Second) assert.Nil(t, err) templateName := "testbeat" // Load template err = client.LoadTemplate(templateName, content) assert.Nil(t, err) // Make sure template was loaded assert.True(t, client.CheckTemplate(templateName)) // Delete template again to clean up client.request("DELETE", "/_template/"+templateName, "", nil, nil) // Make sure it was removed assert.False(t, client.CheckTemplate(templateName)) }
explode_data.jsonl/40099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 259 }
[ 2830, 3393, 5879, 7275, 1155, 353, 8840, 836, 8, 1476, 197, 322, 8893, 3811, 198, 197, 3435, 1820, 11, 1848, 1669, 26054, 33255, 36800, 23841, 33220, 53006, 6948, 93882, 1155, 11, 3647, 1820, 340, 6948, 59678, 1155, 11, 1848, 692, 22832...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTx_InputCount(t *testing.T) { t.Run("get input count", func(t *testing.T) { tx := bt.NewTx() assert.NotNil(t, tx) err := tx.From( "07912972e42095fe58daaf09161c5a5da57be47c2054dc2aaa52b30fefa1940b", 0, "76a914af2590a45ae401651fdbdf59a76ad43d1862534088ac", 4000000) assert.NoError(t, err) assert.Equal(t, 1, tx.InputCount()) }) }
explode_data.jsonl/28742
{ "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, 31584, 48653, 2507, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 455, 1946, 1760, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 46237, 1669, 19592, 7121, 31584, 741, 197, 6948, 93882, 1155, 11, 9854, 340, 197, 9859, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetIntSlice(t *testing.T) { config := &Config{Object{"a": Array{Int(1), Int(2)}, "b": Array{String("c"), Int(1)}}} t.Run("get array as int slice", func(t *testing.T) { got := config.GetIntSlice("a") assertDeepEqual(t, got, []int{1, 2}) }) t.Run("return nil for a non-existing int slice", func(t *testing.T) { got := config.GetIntSlice("e") if got != nil { t.Errorf("expected: nil, got: %v", got) } }) t.Run("panic if there is a non-int element in the requested array", func(t *testing.T) { assertPanic(t, func() { config.GetIntSlice("b") }) }) }
explode_data.jsonl/4119
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 85097, 33236, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 609, 2648, 90, 1190, 4913, 64, 788, 2910, 90, 1072, 7, 16, 701, 1333, 7, 17, 42419, 330, 65, 788, 2910, 90, 703, 445, 66, 3975, 1333, 7, 16, 52731, 630, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRollingSimple(t *testing.T) { if topologyBackend != "elasticsearch" && flowBackend != "elasticsearch" { t.Skip("Elasticsearch is used neither for topology nor flows") } // del first in order to cleanup previews run delTestIndex("rolling") delTestIndex("not_rolling") indices := []es.Index{ { Name: "rolling", Type: "object", RollIndex: true, }, { Name: "not_rolling", Type: "object", }, } cfg := es.Config{ ElasticHost: "localhost:9200", EntriesLimit: 10, } client, err := getClient(t, indices, cfg) if err != nil { t.Fatal(err) } for i := 0; i != 9; i++ { id := fmt.Sprintf("before-entry_%d", i) client.Index(indices[0], id, map[string]string{"ID": id}) client.Index(indices[1], id, map[string]string{"ID": id}) } err = common.Retry(func() error { for _, index := range indices { result, err := client.Search("object", nil, filters.SearchQuery{}, index.Alias()) if err != nil { return err } if len(result.Hits.Hits) != 9 { return fmt.Errorf("Expected entries not found: %+v", result.Hits.Hits) } } return nil }, 5, time.Second) if err != nil { t.Fatal(err) } // add more entries to trigger the rolling index for i := 0; i != 2; i++ { id := fmt.Sprintf("after-entry-%d", i) client.Index(indices[0], id, map[string]string{"ID": id}) client.Index(indices[1], id, map[string]string{"ID": id}) } time.Sleep(es.RollingRate) err = common.Retry(func() error { // test that the index has been rotated result, err := client.Search("object", nil, filters.SearchQuery{}, indices[0].Alias()) if err != nil { return err } if len(result.Hits.Hits) != 0 { return fmt.Errorf("Expected 1 entry, found: %+v", result.Hits.Hits) } // test that using the wilcard we can get all the records result, err = client.Search("object", nil, filters.SearchQuery{}, indices[0].IndexWildcard()) if err != nil { return err } if len(result.Hits.Hits) != 11 { return fmt.Errorf("Expected 1 entry, found: %+v", result.Hits.Hits) } // test that the no rolling index has not been rotated result, err = client.Search("object", nil, filters.SearchQuery{}, indices[1].Alias()) if err != nil { return err } if len(result.Hits.Hits) != 11 { return fmt.Errorf("Expected 11 entries, found: %+v", result.Hits.Hits) } return nil }, 10, time.Second) if err != nil { t.Fatal(err) } }
explode_data.jsonl/6513
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 973 }
[ 2830, 3393, 32355, 287, 16374, 1155, 353, 8840, 836, 8, 341, 743, 44882, 29699, 961, 330, 301, 27791, 1, 1009, 6396, 29699, 961, 330, 301, 27791, 1, 341, 197, 3244, 57776, 445, 36, 51179, 1836, 374, 1483, 13866, 369, 44882, 6329, 2745...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRetrySleep(t *testing.T) { startTime := time.Now().UnixNano() sleepTime := 200 * time.Millisecond err := DoSleep(2, sleepTime, func(attempt int) (err error) { if attempt == 0 { err = errors.New("") } return err }) dt := (time.Now().UnixNano() - startTime - int64(sleepTime)) / (int64(time.Millisecond) / int64(time.Nanosecond)) maxErr := int64(50) if err != nil || (dt < -maxErr || dt > maxErr) { t.Fail() } }
explode_data.jsonl/72027
{ "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, 51560, 41745, 1155, 353, 8840, 836, 8, 341, 21375, 1462, 1669, 882, 13244, 1005, 55832, 83819, 741, 52533, 1462, 1669, 220, 17, 15, 15, 353, 882, 71482, 271, 9859, 1669, 3155, 41745, 7, 17, 11, 6084, 1462, 11, 2915, 19356,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPlayer_CrosshairCode(t *testing.T) { pl := playerWithResourceProperty("m_szCrosshairCodes", st.PropertyValue{StringVal: "CSGO-jvnbx-S3xFK-iEJXD-Y27Nd-AO6FP"}) assert.Equal(t, "CSGO-jvnbx-S3xFK-iEJXD-Y27Nd-AO6FP", pl.CrosshairCode()) }
explode_data.jsonl/12200
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 4476, 920, 2128, 50629, 2078, 1155, 353, 8840, 836, 8, 341, 72213, 1669, 2781, 2354, 4783, 3052, 445, 76, 33945, 28501, 50629, 20871, 497, 357, 15727, 1130, 90, 703, 2208, 25, 330, 6412, 15513, 13333, 85, 18080, 87, 6222, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTypeSystem_ListMustAcceptGraphQLTypes_RejectsANilTypeAsItemTypeOfList(t *testing.T) { result := graphql.NewList(nil) expectedError := `Can only create List of a Type but got: <nil>.` if result.Error() == nil || result.Error().Error() != expectedError { t.Fatalf("Expected error: %v, got %v", expectedError, result.Error()) } }
explode_data.jsonl/79189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 929, 2320, 27104, 31776, 16646, 88637, 4173, 50693, 583, 82, 1093, 321, 929, 2121, 74618, 2124, 852, 1155, 353, 8840, 836, 8, 341, 9559, 1669, 48865, 7121, 852, 27907, 340, 42400, 1454, 1669, 1565, 6713, 1172, 1855, 1759, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBlockGlobalUpdate(t *testing.T) { db := DB.New() db.Create(&Toy{Name: "Stuffed Animal", OwnerType: "Nobody"}) err := db.Model(&Toy{}).Update("OwnerType", "Human").Error if err != nil { t.Error("Unexpected error on global update") } err = db.Delete(&Toy{}).Error if err != nil { t.Error("Unexpected error on global delete") } db.BlockGlobalUpdate(true) db.Create(&Toy{Name: "Stuffed Animal", OwnerType: "Nobody"}) err = db.Model(&Toy{}).Update("OwnerType", "Human").Error if err == nil { t.Error("Expected error on global update") } err = db.Model(&Toy{}).Where(&Toy{OwnerType: "Martian"}).Update("OwnerType", "Astronaut").Error if err != nil { t.Error("Unxpected error on conditional update") } err = db.Delete(&Toy{}).Error if err == nil { t.Error("Expected error on global delete") } err = db.Where(&Toy{OwnerType: "Martian"}).Delete(&Toy{}).Error if err != nil { t.Error("Unexpected error on conditional delete") } }
explode_data.jsonl/28067
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 4713, 11646, 4289, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 5952, 7121, 741, 20939, 7251, 2099, 67970, 63121, 25, 330, 623, 40573, 21292, 497, 25833, 929, 25, 330, 56713, 1, 8824, 9859, 1669, 2927, 5659, 2099, 67970, 6257,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue27610(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec(`use test;`) tk.MustExec(`drop table if exists PK_TCOLLATION3966STROBJSTROBJ;`) tk.MustExec("CREATE TABLE `PK_TCOLLATION3966STROBJSTROBJ` (\n `COL1` enum('ll','aa','bb','cc','dd','ee') COLLATE utf8_general_ci NOT NULL,\n `COL2` varchar(20) COLLATE utf8_general_ci DEFAULT NULL,\n PRIMARY KEY (`COL1`) /*T![clustered_index] CLUSTERED */\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;") tk.MustExec(`insert into PK_TCOLLATION3966STROBJSTROBJ values("ee", "tttt");`) tk.MustQuery("SELECT col1, COL2 FROM PK_TCOLLATION3966STROBJSTROBJ WHERE COL1 IN ('notexist','6') and col2 not in (\"abcd\");"). Check(testkit.Rows()) }
explode_data.jsonl/65607
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 42006, 17, 22, 21, 16, 15, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValueBinder_BindUnmarshaler(t *testing.T) { exampleTime, _ := time.Parse(time.RFC3339, "2020-12-23T09:45:31+02:00") var testCases = []struct { name string givenFailFast bool givenBindErrors []error whenURL string whenMust bool expectValue Timestamp expectError string }{ { name: "ok, binds value", whenURL: "/search?param=2020-12-23T09:45:31%2B02:00&param=2000-01-02T09:45:31%2B00:00", expectValue: Timestamp(exampleTime), }, { name: "ok, params values empty, value is not changed", whenURL: "/search?nope=1", expectValue: Timestamp{}, }, { name: "nok, previous errors fail fast without binding value", givenFailFast: true, whenURL: "/search?param=1&param=100", expectValue: Timestamp{}, expectError: "previous error", }, { name: "nok, conversion fails, value is not changed", whenURL: "/search?param=nope&param=100", expectValue: Timestamp{}, expectError: "code=400, message=failed to bind field value to BindUnmarshaler interface, internal=parsing time \"nope\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"nope\" as \"2006\", field=param", }, { name: "ok (must), binds value", whenMust: true, whenURL: "/search?param=2020-12-23T09:45:31%2B02:00&param=2000-01-02T09:45:31%2B00:00", expectValue: Timestamp(exampleTime), }, { name: "ok (must), params values empty, returns error, value is not changed", whenMust: true, whenURL: "/search?nope=1", expectValue: Timestamp{}, expectError: "code=400, message=required field value is empty, field=param", }, { name: "nok (must), previous errors fail fast without binding value", givenFailFast: true, whenMust: true, whenURL: "/search?param=1&param=100", expectValue: Timestamp{}, expectError: "previous error", }, { name: "nok (must), conversion fails, value is not changed", whenMust: true, whenURL: "/search?param=nope&param=100", expectValue: Timestamp{}, expectError: "code=400, message=failed to bind field value to BindUnmarshaler interface, internal=parsing time \"nope\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"nope\" as \"2006\", field=param", }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { c := createTestContext(tc.whenURL, nil, nil) b := QueryParamsBinder(c).FailFast(tc.givenFailFast) if tc.givenFailFast { b.errors = []error{errors.New("previous error")} } var dest Timestamp var err error if tc.whenMust { err = b.MustBindUnmarshaler("param", &dest).BindError() } else { err = b.BindUnmarshaler("param", &dest).BindError() } assert.Equal(t, tc.expectValue, dest) if tc.expectError != "" { assert.EqualError(t, err, tc.expectError) } else { assert.NoError(t, err) } }) } }
explode_data.jsonl/82558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1313 }
[ 2830, 3393, 1130, 44055, 1668, 484, 1806, 27121, 261, 1155, 353, 8840, 836, 8, 341, 8122, 1516, 1462, 11, 716, 1669, 882, 8937, 9730, 2013, 6754, 18, 18, 18, 24, 11, 330, 17, 15, 17, 15, 12, 16, 17, 12, 17, 18, 51, 15, 24, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAttachRequest(t *testing.T) { if runtime.GOOS == "freebsd" { t.SkipNow() } if runtime.GOOS == "windows" { t.Skip("test skipped on windows, see https://delve.beta.teamcity.com/project/Delve_windows for details") } runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { // Start the program to attach to cmd := execFixture(t, fixture) runDebugSessionWithBPs(t, client, "attach", // Attach func() { client.AttachRequest(map[string]interface{}{ /*"mode": "local" by default*/ "processId": cmd.Process.Pid, "stopOnEntry": false}) }, // Set breakpoints fixture.Source, []int{8}, []onBreakpoint{{ // Stop at line 8 execute: func() { checkStop(t, client, 1, "main.loop", 8) client.VariablesRequest(1001) // Locals locals := client.ExpectVariablesResponse(t) checkChildren(t, locals, "Locals", 1) checkVarRegex(t, locals, 0, "i", "i", "[0-9]+", "int", noChildren) }, disconnect: true, }}) }) }
explode_data.jsonl/17352
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 30485, 1900, 1155, 353, 8840, 836, 8, 341, 743, 15592, 97574, 3126, 621, 330, 10593, 51835, 1, 341, 197, 3244, 57776, 7039, 741, 197, 532, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 3244, 57776, 445, 1944, 3515...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInit(t *testing.T) { graph, _ := tempGraph(t) defer nukeGraph(graph) // Root should exist if _, err := os.Stat(graph.root); err != nil { t.Fatal(err) } // Map() should be empty l := graph.Map() if len(l) != 0 { t.Fatalf("len(Map()) should return %d, not %d", 0, len(l)) } }
explode_data.jsonl/64320
{ "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, 1155, 353, 8840, 836, 8, 341, 66616, 11, 716, 1669, 2730, 11212, 1155, 340, 16867, 308, 10430, 11212, 24312, 340, 197, 322, 18854, 1265, 3000, 198, 743, 8358, 1848, 1669, 2643, 53419, 24312, 12576, 1215, 1848, 961, 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...
3
func TestFal03(t *testing.T) { var fal float64 fal = Fal03(0.80) if !CheckFloat(fal, 5.132369751108684150, 1e-12) { t.Errorf("fal != 5.132369751108684150 -> %v\n", fal) } }
explode_data.jsonl/45911
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 90258, 15, 18, 1155, 353, 8840, 836, 8, 341, 2405, 25484, 2224, 21, 19, 271, 1166, 278, 284, 22869, 15, 18, 7, 15, 13, 23, 15, 692, 743, 753, 3973, 5442, 955, 278, 11, 220, 20, 13, 16, 18, 17, 18, 21, 24, 22, 20,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCookieStore_Get_decode_base64_error(t *testing.T) { cipher := &fakeCipher{} opt := CookieOption{} cookieman := New(cipher, opt) w := httptest.NewRecorder() store := cookieman.NewCookieStore("n", nil) http.SetCookie(w, &http.Cookie{ Name: "n", Value: "zzz: non base64 encoding", }) req := GetRequestWithCookie(w) if _, err := store.Get(req); err == nil { t.Error("got nil, but want error") } }
explode_data.jsonl/48011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 20616, 6093, 13614, 15227, 7651, 21, 19, 4096, 1155, 353, 8840, 836, 8, 341, 1444, 10558, 1669, 609, 30570, 79460, 16094, 64838, 1669, 24356, 5341, 16094, 197, 1015, 38191, 15977, 1669, 1532, 1337, 10558, 11, 3387, 340, 6692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLinkFormat_Decode(t *testing.T) { format := linkFormat{} ctx := fake.NewContext() ctx = serde.WithFactory(ctx, types.AggregateKey{}, fake.SignatureFactory{}) ctx = serde.WithFactory(ctx, types.ChangeSetKey{}, fakeChangeSetFac{}) ctx = serde.WithFactory(ctx, types.BlockKey{}, types.BlockFactory{}) msg, err := format.Decode(ctx, []byte(`{"From":[1],"To":[2]}`)) require.NoError(t, err) require.Equal(t, makeLink(t), msg) msg, err = format.Decode(ctx, []byte(`{"From":[1],"Block":{}}`)) require.NoError(t, err) require.Equal(t, makeBlockLink(t), msg) _, err = format.Decode(fake.NewBadContext(), []byte(`{}`)) require.EqualError(t, err, fake.Err("failed to unmarshal")) badCtx := serde.WithFactory(ctx, types.AggregateKey{}, fake.NewBadSignatureFactory()) _, err = format.Decode(badCtx, []byte(`{}`)) require.EqualError(t, err, fake.Err("failed to decode prepare: factory failed")) badCtx = serde.WithFactory(ctx, types.AggregateKey{}, fake.NewBadSignatureFactoryWithDelay(1)) _, err = format.Decode(badCtx, []byte(`{}`)) require.EqualError(t, err, fake.Err("failed to decode commit: factory failed")) badCtx = serde.WithFactory(ctx, types.ChangeSetKey{}, fake.MessageFactory{}) _, err = format.Decode(badCtx, []byte(`{}`)) require.EqualError(t, err, "failed to decode change set: invalid factory 'fake.MessageFactory'") badCtx = serde.WithFactory(ctx, types.ChangeSetKey{}, fakeChangeSetFac{err: fake.GetError()}) _, err = format.Decode(badCtx, []byte(`{}`)) require.EqualError(t, err, fake.Err("failed to decode change set: factory failed")) badCtx = serde.WithFactory(ctx, types.BlockKey{}, nil) _, err = format.Decode(badCtx, []byte(`{"Block":{}}`)) require.EqualError(t, err, "missing block factory") badCtx = serde.WithFactory(ctx, types.BlockKey{}, fake.NewBadMessageFactory()) _, err = format.Decode(badCtx, []byte(`{"Block":{}}`)) require.EqualError(t, err, fake.Err("failed to decode block")) badCtx = serde.WithFactory(ctx, types.BlockKey{}, fake.MessageFactory{}) _, err = format.Decode(badCtx, []byte(`{"Block":{}}`)) require.EqualError(t, err, "invalid block 'fake.Message'") format.hashFac = fake.NewHashFactory(fake.NewBadHash()) _, err = format.Decode(ctx, []byte(`{}`)) require.Error(t, err) require.Contains(t, err.Error(), "creating forward link: failed to fingerprint: ") _, err = format.Decode(ctx, []byte(`{"Block":{}}`)) require.Error(t, err) require.Contains(t, err.Error(), "creating block link: creating forward link: failed to fingerprint: ") }
explode_data.jsonl/4474
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 940 }
[ 2830, 3393, 3939, 4061, 78668, 534, 1155, 353, 8840, 836, 8, 341, 59416, 1669, 2656, 4061, 31483, 20985, 1669, 12418, 7121, 1972, 741, 20985, 284, 61570, 26124, 4153, 7502, 11, 4494, 49850, 14240, 1592, 22655, 12418, 41152, 1568, 4153, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValues(t *testing.T) { data := []byte(`{"foo": "bar", "baz": {"bar": "cat"}}`) testData := []struct { path []string value string }{ { []string{"foo"}, "bar", }, { []string{"baz", "bar"}, "cat", }, } values, err := newValues(&source.ChangeSet{ Data: data, }) if err != nil { t.Fatal(err) } for _, test := range testData { if v := values.Get(test.path...).String(""); v != test.value { t.Fatalf("Expected %s got %s for path %v", test.value, v, test.path) } } }
explode_data.jsonl/612
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 235 }
[ 2830, 3393, 6227, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 3056, 3782, 5809, 4913, 7975, 788, 330, 2257, 497, 330, 42573, 788, 5212, 2257, 788, 330, 4616, 30975, 63, 692, 18185, 1043, 1669, 3056, 1235, 341, 197, 26781, 220, 3056, 917...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetSecret(t *testing.T) { t.Run("successfully retrieve secret", func(t *testing.T) { t.Run("without version id and version stage", func(t *testing.T) { s := smSecretStore{ client: &mockedSM{ GetSecretValueFn: func(input *secretsmanager.GetSecretValueInput) (*secretsmanager.GetSecretValueOutput, error) { assert.Nil(t, input.VersionId) assert.Nil(t, input.VersionStage) secret := secretValue return &secretsmanager.GetSecretValueOutput{ Name: input.SecretId, SecretString: &secret, }, nil }, }, } req := secretstores.GetSecretRequest{ Name: "/aws/secret/testing", Metadata: map[string]string{}, } output, e := s.GetSecret(req) assert.Nil(t, e) assert.Equal(t, "secret", output.Data[req.Name]) }) t.Run("with version id", func(t *testing.T) { s := smSecretStore{ client: &mockedSM{ GetSecretValueFn: func(input *secretsmanager.GetSecretValueInput) (*secretsmanager.GetSecretValueOutput, error) { assert.NotNil(t, input.VersionId) secret := secretValue return &secretsmanager.GetSecretValueOutput{ Name: input.SecretId, SecretString: &secret, }, nil }, }, } req := secretstores.GetSecretRequest{ Name: "/aws/secret/testing", Metadata: map[string]string{ VersionID: "1", }, } output, e := s.GetSecret(req) assert.Nil(t, e) assert.Equal(t, secretValue, output.Data[req.Name]) }) t.Run("with version stage", func(t *testing.T) { s := smSecretStore{ client: &mockedSM{ GetSecretValueFn: func(input *secretsmanager.GetSecretValueInput) (*secretsmanager.GetSecretValueOutput, error) { assert.NotNil(t, input.VersionStage) secret := secretValue return &secretsmanager.GetSecretValueOutput{ Name: input.SecretId, SecretString: &secret, }, nil }, }, } req := secretstores.GetSecretRequest{ Name: "/aws/secret/testing", Metadata: map[string]string{ VersionStage: "dev", }, } output, e := s.GetSecret(req) assert.Nil(t, e) assert.Equal(t, secretValue, output.Data[req.Name]) }) }) t.Run("unsuccessfully retrieve secret", func(t *testing.T) { s := smSecretStore{ client: &mockedSM{ GetSecretValueFn: func(input *secretsmanager.GetSecretValueInput) (*secretsmanager.GetSecretValueOutput, error) { return nil, fmt.Errorf("failed due to any reason") }, }, } req := secretstores.GetSecretRequest{ Name: "/aws/secret/testing", Metadata: map[string]string{}, } _, err := s.GetSecret(req) assert.NotNil(t, err) }) }
explode_data.jsonl/23986
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1166 }
[ 2830, 3393, 1949, 19773, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 60505, 17179, 6234, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 16708, 445, 28996, 2319, 877, 323, 2319, 6430, 497, 2915, 1155, 353, 8840, 836, 8, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_source(t *testing.T) { assert.Equal(t, dunno, source([][]byte{}, 0)) assert.Equal(t, dunno, source([][]byte{}, 1)) assert.Equal(t, []byte("test"), source([][]byte{[]byte("test")}, 1)) }
explode_data.jsonl/44807
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 10347, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 49016, 2152, 11, 2530, 10556, 1294, 3782, 22655, 220, 15, 1171, 6948, 12808, 1155, 11, 49016, 2152, 11, 2530, 10556, 1294, 3782, 22655, 220, 16, 1171, 6948, 12808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetVolumeID(t *testing.T) { b := &blockStore{} pv := &unstructured.Unstructured{ Object: map[string]interface{}{}, } // missing spec.gcePersistentDisk -> no error volumeID, err := b.GetVolumeID(pv) require.NoError(t, err) assert.Equal(t, "", volumeID) // missing spec.gcePersistentDisk.pdName -> error gce := map[string]interface{}{} pv.Object["spec"] = map[string]interface{}{ "gcePersistentDisk": gce, } volumeID, err = b.GetVolumeID(pv) assert.Error(t, err) assert.Equal(t, "", volumeID) // valid gce["pdName"] = "abc123" volumeID, err = b.GetVolumeID(pv) assert.NoError(t, err) assert.Equal(t, "abc123", volumeID) }
explode_data.jsonl/71437
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 1949, 18902, 915, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 609, 4574, 6093, 31483, 3223, 85, 1669, 609, 359, 51143, 10616, 51143, 515, 197, 23816, 25, 2415, 14032, 31344, 6257, 38837, 197, 630, 197, 322, 7402, 1398, 1302, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServer_EnqueueRepoUpdate(t *testing.T) { repo := repos.Repo{ Name: "github.com/foo/bar", ExternalRepo: api.ExternalRepoSpec{ ID: "bar", ServiceType: "github", ServiceID: "http://github.com", }, Metadata: new(github.Repository), Sources: map[string]*repos.SourceInfo{ "extsvc:123": { ID: "extsvc:123", CloneURL: "https://secret-token@github.com/foo/bar", }, }, } ctx := context.Background() type testCase struct { name string store repos.Store repo gitserver.Repo res *protocol.RepoUpdateResponse err string } var testCases []testCase testCases = append(testCases, func() testCase { err := errors.New("boom") return testCase{ name: "returns an error on store failure", store: &repos.FakeStore{ListReposError: err}, err: `store.list-repos: boom`, } }(), testCase{ name: "missing repo", store: new(repos.FakeStore), // empty store repo: gitserver.Repo{Name: "foo"}, err: `repo "foo" not found in store`, }, func() testCase { repo := repo.Clone() repo.Sources = nil store := new(repos.FakeStore) must(store.UpsertRepos(ctx, repo)) return testCase{ name: "missing clone URL", store: store, repo: gitserver.Repo{Name: api.RepoName(repo.Name)}, res: &protocol.RepoUpdateResponse{ ID: repo.ID, Name: repo.Name, }, } }(), func() testCase { store := new(repos.FakeStore) repo := repo.Clone() must(store.UpsertRepos(ctx, repo)) cloneURL := "https://user:password@github.com/foo/bar" return testCase{ name: "given clone URL is preferred", store: store, repo: gitserver.Repo{Name: api.RepoName(repo.Name), URL: cloneURL}, res: &protocol.RepoUpdateResponse{ ID: repo.ID, Name: repo.Name, URL: cloneURL, }, } }(), func() testCase { store := new(repos.FakeStore) repo := repo.Clone() must(store.UpsertRepos(ctx, repo)) return testCase{ name: "if missing, clone URL is set when stored", store: store, repo: gitserver.Repo{Name: api.RepoName(repo.Name)}, res: &protocol.RepoUpdateResponse{ ID: repo.ID, Name: repo.Name, URL: repo.CloneURLs()[0], }, } }(), ) for _, tc := range testCases { tc := tc ctx := context.Background() t.Run(tc.name, func(t *testing.T) { s := &Server{Store: tc.store, Scheduler: &fakeScheduler{}} srv := httptest.NewServer(s.Handler()) defer srv.Close() cli := repoupdater.Client{URL: srv.URL} if tc.err == "" { tc.err = "<nil>" } res, err := cli.EnqueueRepoUpdate(ctx, tc.repo) if have, want := fmt.Sprint(err), tc.err; have != want { t.Errorf("have err: %q, want: %q", have, want) } if have, want := res, tc.res; !reflect.DeepEqual(have, want) { t.Errorf("response: %s", cmp.Diff(have, want)) } }) } }
explode_data.jsonl/35192
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1340 }
[ 2830, 3393, 5475, 62, 1702, 4584, 25243, 4289, 1155, 353, 8840, 836, 8, 341, 17200, 5368, 1669, 45774, 2817, 5368, 515, 197, 21297, 25, 330, 5204, 905, 60555, 49513, 756, 197, 197, 25913, 25243, 25, 6330, 5121, 15342, 25243, 8327, 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...
1
func TestDeleteRun_RunNotExist(t *testing.T) { store := NewFakeClientManagerOrFatal(util.NewFakeTimeForEpoch()) defer store.Close() manager := NewResourceManager(store) err := manager.DeleteRun("1") assert.Equal(t, codes.NotFound, err.(*util.UserError).ExternalStatusCode()) assert.Contains(t, err.Error(), "not found") }
explode_data.jsonl/28364
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 6435, 6727, 84158, 45535, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 1532, 52317, 2959, 2043, 2195, 62396, 67811, 7121, 52317, 1462, 2461, 44338, 2398, 16867, 3553, 10421, 741, 92272, 1669, 1532, 32498, 31200, 340, 9859, 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 TestNewEmptyQueue(t *testing.T) { queue := NewQueue() if queue == nil { t.Fatal("Construct a new empty queue fail!") } if len(queueList) > 0 { t.Fatal("Initailize the queue list wrong!") } }
explode_data.jsonl/55225
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 3564, 3522, 7554, 1155, 353, 8840, 836, 8, 341, 46993, 1669, 1532, 7554, 741, 743, 7177, 621, 2092, 341, 197, 3244, 26133, 445, 28468, 264, 501, 4287, 7177, 3690, 22988, 197, 630, 743, 2422, 34010, 852, 8, 861, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
3
func TestInstanceExistsByProviderID(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() cloud := GetTestCloud(ctrl) testcases := []struct { name string vmList []string nodeName string providerID string expected bool expectedErrMsg error }{ { name: "InstanceExistsByProviderID should return true if node exists", vmList: []string{"vm2"}, nodeName: "vm2", providerID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm2", expected: true, }, { name: "InstanceExistsByProviderID should return true if node is unmanaged", providerID: "/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm1", expected: true, }, { name: "InstanceExistsByProviderID should return false if node doesn't exist", vmList: []string{"vm1"}, nodeName: "vm3", providerID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm3", expected: false, }, { name: "InstanceExistsByProviderID should report error if providerID is invalid", providerID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachine/vm3", expected: false, expectedErrMsg: fmt.Errorf("error splitting providerID"), }, { name: "InstanceExistsByProviderID should report error if providerID is null", expected: false, expectedErrMsg: fmt.Errorf("providerID is empty, the node is not initialized yet"), }, } for _, test := range testcases { vmListWithPowerState := make(map[string]string) for _, vm := range test.vmList { vmListWithPowerState[vm] = "" } expectedVMs := setTestVirtualMachines(cloud, vmListWithPowerState, false) mockVMsClient := cloud.VirtualMachinesClient.(*mockvmclient.MockInterface) for _, vm := range expectedVMs { mockVMsClient.EXPECT().Get(gomock.Any(), cloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes() } mockVMsClient.EXPECT().Get(gomock.Any(), cloud.ResourceGroup, "vm3", gomock.Any()).Return(compute.VirtualMachine{}, &retry.Error{HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound}).AnyTimes() mockVMsClient.EXPECT().Update(gomock.Any(), cloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() exist, err := cloud.InstanceExistsByProviderID(context.Background(), test.providerID) assert.Equal(t, test.expectedErrMsg, err, test.name) assert.Equal(t, test.expected, exist, test.name) } vmssTestCases := []struct { name string providerID string scaleSet string vmList []string expected bool rerr *retry.Error }{ { name: "InstanceExistsByProviderID should return true if VMSS and VM exist", providerID: "azure:///subscriptions/script/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/vmssee6c2/virtualMachines/0", scaleSet: "vmssee6c2", vmList: []string{"vmssee6c2000000"}, expected: true, }, { name: "InstanceExistsByProviderID should return false if VMSS exist but VM doesn't", providerID: "azure:///subscriptions/script/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/vmssee6c2/virtualMachines/0", scaleSet: "vmssee6c2", expected: false, }, { name: "InstanceExistsByProviderID should return false if VMSS doesn't exist", providerID: "azure:///subscriptions/script/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/missing-vmss/virtualMachines/0", rerr: &retry.Error{HTTPStatusCode: 404}, expected: false, }, } for _, test := range vmssTestCases { ss, err := NewTestScaleSet(ctrl) assert.NoError(t, err, test.name) cloud.VMSet = ss mockVMSSClient := mockvmssclient.NewMockInterface(ctrl) mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl) ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient expectedScaleSet := buildTestVMSS(test.scaleSet, test.scaleSet) mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, test.rerr).AnyTimes() expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, test.scaleSet, "", 0, test.vmList, "succeeded", false) mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, test.rerr).AnyTimes() mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface) mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes() exist, _ := cloud.InstanceExistsByProviderID(context.Background(), test.providerID) assert.Equal(t, test.expected, exist, test.name) } }
explode_data.jsonl/60298
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1895 }
[ 2830, 3393, 2523, 15575, 1359, 5179, 915, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 197, 12361, 1669, 2126, 2271, 16055, 62100, 692, 18185, 23910, 1669, 3056, 1235, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestRedelegationEqual(t *testing.T) { r1 := NewRedelegation(sdk.AccAddress(addr1), addr2, addr3, 0, time.Unix(0, 0), sdk.NewInt(0), sdk.NewDec(0)) r2 := NewRedelegation(sdk.AccAddress(addr1), addr2, addr3, 0, time.Unix(0, 0), sdk.NewInt(0), sdk.NewDec(0)) ok := r1.Equal(r2) require.True(t, ok) r2.Entries[0].SharesDst = sdk.NewDec(10) r2.Entries[0].CompletionTime = time.Unix(20*20*2, 0) ok = r1.Equal(r2) require.False(t, ok) }
explode_data.jsonl/58938
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 6033, 68, 87566, 2993, 1155, 353, 8840, 836, 8, 341, 7000, 16, 1669, 1532, 6033, 68, 87566, 1141, 7584, 77538, 4286, 24497, 16, 701, 10789, 17, 11, 10789, 18, 11, 220, 15, 345, 197, 21957, 10616, 941, 7, 15, 11, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAlgorithms(t *testing.T) { heuristics := []Heuristic{ UseFirst(Halving{}, DeltaLargest{}), UseFirst(Halving{}, Approximation{}), } for _, heuristic := range heuristics { suite := algtest.SequenceAlgorithmSuite{ Algorithm: NewAlgorithm(heuristic), AcceptsLargeInputs: true, } t.Run(suite.Algorithm.String(), suite.Tests()) } }
explode_data.jsonl/3505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 2101, 18980, 1155, 353, 8840, 836, 8, 341, 197, 383, 324, 5589, 1669, 3056, 1519, 34456, 515, 197, 95023, 5338, 10896, 278, 4405, 22655, 24957, 43, 32381, 6257, 1326, 197, 95023, 5338, 10896, 278, 4405, 22655, 43819, 5465, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDownloadTo_VerifyLater(t *testing.T) { defer ensure.HelmHome(t)() dest := ensure.TempDir(t) defer os.RemoveAll(dest) // Set up a fake repo srv, err := repotest.NewTempServerWithCleanup(t, "testdata/*.tgz*") if err != nil { t.Fatal(err) } defer srv.Stop() if err := srv.LinkIndices(); err != nil { t.Fatal(err) } c := ChartDownloader{ Out: os.Stderr, Verify: VerifyLater, RepositoryConfig: repoConfig, RepositoryCache: repoCache, Getters: getter.All(&cli.EnvSettings{ RepositoryConfig: repoConfig, RepositoryCache: repoCache, }), } cname := "/signtest-0.1.0.tgz" where, _, err := c.DownloadTo(srv.URL()+cname, "", dest) if err != nil { t.Fatal(err) } if expect := filepath.Join(dest, cname); where != expect { t.Errorf("Expected download to %s, got %s", expect, where) } if _, err := os.Stat(filepath.Join(dest, cname)); err != nil { t.Fatal(err) } if _, err := os.Stat(filepath.Join(dest, cname+".prov")); err != nil { t.Fatal(err) } }
explode_data.jsonl/1373
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 458 }
[ 2830, 3393, 11377, 1249, 2334, 261, 1437, 29982, 1155, 353, 8840, 836, 8, 341, 16867, 5978, 3839, 23162, 7623, 1155, 8, 2822, 49616, 1669, 5978, 65009, 6184, 1155, 340, 16867, 2643, 84427, 27010, 692, 197, 322, 2573, 705, 264, 12418, 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 TestGetResourceGroups(t *testing.T) { tests := []struct { name string nodeResourceGroups map[string]string expected sets.String informerSynced bool expectError bool }{ { name: "cloud provider configured RG should be returned by default", nodeResourceGroups: map[string]string{}, informerSynced: true, expected: sets.NewString("rg"), }, { name: "cloud provider configured RG and node RGs should be returned", nodeResourceGroups: map[string]string{"node1": "rg1", "node2": "rg2"}, informerSynced: true, expected: sets.NewString("rg", "rg1", "rg2"), }, { name: "error should be returned if informer hasn't synced yet", nodeResourceGroups: map[string]string{"node1": "rg1", "node2": "rg2"}, informerSynced: false, expectError: true, }, } az := getTestCloud() for _, test := range tests { az.nodeResourceGroups = test.nodeResourceGroups if test.informerSynced { az.nodeInformerSynced = func() bool { return true } } else { az.nodeInformerSynced = func() bool { return false } } actual, err := az.GetResourceGroups() if test.expectError { assert.NotNil(t, err, test.name) continue } assert.Nil(t, err, test.name) assert.Equal(t, test.expected, actual, test.name) } }
explode_data.jsonl/80295
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 600 }
[ 2830, 3393, 1949, 4783, 22173, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 2290, 914, 198, 197, 20831, 4783, 22173, 2415, 14032, 30953, 198, 197, 42400, 1843, 7289, 6431, 198, 197, 17430, 34527, 12154, 291, 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 TestEntityResponseWriter(t *testing.T) { t.Run("InvalidAccept", testEntityResponseWriterInvalidAccept) t.Run("Success", func(t *testing.T) { for _, defaultFormat := range wrp.AllFormats() { t.Run(defaultFormat.String(), func(t *testing.T) { testEntityResponseWriterSuccess(t, defaultFormat, defaultFormat, "") for _, accept := range wrp.AllFormats() { t.Run(accept.String(), func(t *testing.T) { testEntityResponseWriterSuccess(t, defaultFormat, accept, accept.ContentType()) }) } }) } }) }
explode_data.jsonl/14998
{ "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, 3030, 2582, 6492, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 7928, 16646, 497, 1273, 3030, 2582, 6492, 7928, 16646, 692, 3244, 16708, 445, 7188, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2023, 8358, 1638, 4061, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1