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 Test_defaultModelBuildTask_buildImplementationSpecificPathPatterns(t *testing.T) { type args struct { path string } tests := []struct { name string args args want []string wantErr error }{ { name: "/ with implementationSpecific pathType", args: args{ path: "/", }, want: []string{"/"}, }, { name: "/abc with implementationSpecific pathType", args: args{ path: "/abc", }, want: []string{"/abc"}, }, { name: "/abc/ with implementationSpecific pathType", args: args{ path: "/abc/", }, want: []string{"/abc/"}, }, { name: "/abc/def with implementationSpecific pathType", args: args{ path: "/abc/def", }, want: []string{"/abc/def"}, }, { name: "/abc/def/ with implementationSpecific pathType", args: args{ path: "/abc/def/", }, want: []string{"/abc/def/"}, }, { name: "/* with implementationSpecific pathType", args: args{ path: "/*", }, want: []string{"/*"}, }, { name: "/? with implementationSpecific pathType", args: args{ path: "/?", }, want: []string{"/?"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { task := &defaultModelBuildTask{} got, err := task.buildPathPatternsForImplementationSpecificPathType(tt.args.path) if tt.wantErr != nil { assert.EqualError(t, err, tt.wantErr.Error()) } else { assert.NoError(t, err) assert.Equal(t, got, tt.want) } }) } }
explode_data.jsonl/63630
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 657 }
[ 2830, 3393, 9993, 1712, 11066, 6262, 20801, 36850, 47514, 1820, 57656, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 26781, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNodeParseRandom(t *testing.T) { assert := assert.New(t) userJson := `{"title":"Buy cheese and bread for breakfast."}` reader := strings.NewReader(userJson) req, err := http.NewRequest("GET", "/health-check", reader) if err != nil { t.Fatal(err) } var object model.Node err = ParseJsonRequest(req, &object) assert.NoError(err) assert.Equal("Buy cheese and bread for breakfast.", object.Properties["title"].String(), "parsed property") }
explode_data.jsonl/32030
{ "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, 1955, 14463, 13999, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 19060, 5014, 1669, 1565, 4913, 2102, 3252, 17482, 17163, 323, 16002, 369, 17496, 1189, 31257, 61477, 1669, 9069, 68587, 4277, 5014, 340, 2439...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHTMLOutputTmpl(t *testing.T) { p := new(data) p.V = page for i := 0; i < 5; i++ { if got := hTMLOutputTmpl(p); got.String() != linkValue { t.Fatalf("want %s, got %s\n", linkValue, got) } } }
explode_data.jsonl/52781
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 2545, 44, 1593, 332, 628, 51, 54010, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 501, 2592, 340, 3223, 5058, 284, 2150, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 20, 26, 600, 1027, 341, 197, 743, 2684, 1669, 305,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKymaAzureEventhubsNamespacesCleanupJobPeriodics(t *testing.T) { // WHEN jobConfig, err := tester.ReadJobConfig("./../../../../prow/jobs/kyma/kyma-azure-event-hubs-namespaces-cleanup.yaml") // THEN require.NoError(t, err) periodics := jobConfig.AllPeriodics() assert.Len(t, periodics, 1) jobName := "kyma-azure-event-hubs-namespaces-cleanup" job := tester.FindPeriodicJobByName(periodics, jobName) require.NotNil(t, job) assert.Equal(t, jobName, job.Name) assert.True(t, job.Decorate) assert.Equal(t, "30 * * * *", job.Cron) assert.Equal(t, job.DecorationConfig.Timeout.Get(), 30*time.Minute) assert.Equal(t, job.DecorationConfig.GracePeriod.Get(), 10*time.Minute) tester.AssertThatHasExtraRepoRefCustom(t, job.JobBase.UtilityConfig, []string{"test-infra"}, []string{"main"}) assert.Equal(t, tester.ImageKymaIntegrationLatest, job.Spec.Containers[0].Image) assert.Equal(t, "true", job.JobBase.Labels["preset-az-kyma-prow-credentials"]) assert.Equal(t, "/home/prow/go/src/github.com/kyma-project/test-infra/prow/scripts/cluster-integration/helpers/cleanup-azure-event-hubs-namespaces.sh", job.Spec.Containers[0].Command[0]) tester.AssertThatContainerHasEnv(t, job.Spec.Containers[0], "AZURE_SUBSCRIPTION_NAME", "sap-se-cx-kyma-prow-dev") tester.AssertThatContainerHasEnv(t, job.Spec.Containers[0], "TTL_HOURS", "6") tester.AssertThatSpecifiesResourceRequests(t, job.JobBase) }
explode_data.jsonl/69279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 569 }
[ 2830, 3393, 42, 1600, 64, 78107, 1556, 71, 15738, 7980, 27338, 67335, 12245, 23750, 1211, 1155, 353, 8840, 836, 8, 341, 197, 322, 33633, 198, 68577, 2648, 11, 1848, 1669, 37111, 6503, 12245, 2648, 13988, 84257, 79, 651, 4437, 5481, 1410...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDiffHelpers(t *testing.T) { curr := []PartitionAssignment{ // Invert order to test sorting { ID: 2, Replicas: []int{1, 2, 3}, }, { ID: 1, Replicas: []int{1, 2, 3}, }, { ID: 3, Replicas: []int{4, 5, 6}, }, { ID: 4, Replicas: []int{6, 7, 8}, }, } desired := []PartitionAssignment{ { ID: 1, Replicas: []int{1, 2, 3}, }, { ID: 2, Replicas: []int{1, 2, 4}, }, { ID: 3, Replicas: []int{5, 4, 6}, }, { ID: 4, Replicas: []int{8, 7, 2}, }, { ID: 5, Replicas: []int{1, 3, 4}, }, } assert.Equal( t, []AssignmentDiff{ { PartitionID: 1, Old: curr[1], New: desired[0], }, { PartitionID: 2, Old: curr[0], New: desired[1], }, { PartitionID: 3, Old: curr[2], New: desired[2], }, { PartitionID: 4, Old: curr[3], New: desired[3], }, { PartitionID: 5, Old: PartitionAssignment{}, New: desired[4], }, }, AssignmentDiffs(curr, desired), ) assert.Equal( t, []PartitionAssignment{ { ID: 2, Replicas: []int{1, 2, 4}, }, { ID: 3, Replicas: []int{5, 4, 6}, }, { ID: 4, Replicas: []int{8, 7, 2}, }, { ID: 5, Replicas: []int{1, 3, 4}, }, }, AssignmentsToUpdate(curr, desired), ) assert.Equal( t, []int{3, 4}, NewLeaderPartitions(curr, desired), ) }
explode_data.jsonl/70035
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 984 }
[ 2830, 3393, 21751, 28430, 1155, 353, 8840, 836, 8, 341, 54966, 1669, 3056, 49978, 41613, 515, 197, 197, 322, 758, 1621, 1973, 311, 1273, 28273, 198, 197, 197, 515, 298, 29580, 25, 981, 220, 17, 345, 298, 197, 18327, 52210, 25, 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 Test_UpdateSecrets_ReplacesPreviousSecretMountWithNewMount(t *testing.T) { request := requests.CreateFunctionRequest{ Service: "testfunc", Secrets: []string{"pullsecret", "testsecret"}, } existingSecrets := map[string]*apiv1.Secret{ "pullsecret": {Type: apiv1.SecretTypeDockercfg}, "testsecret": {Type: apiv1.SecretTypeOpaque, Data: map[string][]byte{"filename": []byte("contents")}}, } deployment := &appsv1.Deployment{ Spec: appsv1.DeploymentSpec{ Template: apiv1.PodTemplateSpec{ Spec: apiv1.PodSpec{ Containers: []apiv1.Container{ {Name: "testfunc", Image: "alpine:latest"}, }, }, }, }, } err := UpdateSecrets(request, deployment, existingSecrets) if err != nil { t.Errorf("unexpected error %s", err.Error()) } // mimic the deployment already existing and deployed with the same secrets by running // UpdateSecrets twice, the first run represents the original deployment, the second run represents // retrieving the deployment from the k8s api and applying the update to it err = UpdateSecrets(request, deployment, existingSecrets) if err != nil { t.Errorf("unexpected error %s", err.Error()) } validateNewSecretVolumesAndMounts(t, deployment) }
explode_data.jsonl/57944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 47393, 19773, 82, 50693, 26078, 21291, 19773, 16284, 2354, 3564, 16284, 1155, 353, 8840, 836, 8, 341, 23555, 1669, 7388, 7251, 5152, 1900, 515, 197, 91619, 25, 330, 1944, 2830, 756, 197, 7568, 50856, 82, 25, 3056, 917, 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 TestExactly16Bytes(t *testing.T) { var tests = []string{ "", "a", "日本語", "1234567890123456", "12345678901234567890", "1234567890123本語4567890", "12345678901234日本語567890", "123456789012345日本語67890", "1234567890123456日本語7890", "1234567890123456日本語7日本語890", } for _, str := range tests { got := exactly16Bytes(str) if len(got) != 16 { t.Errorf("exactly16Bytes(%q) is %q, length %d", str, got, len(got)) } // Make sure it is full runes. for _, c := range got { if c == utf8.RuneError { t.Errorf("exactly16Bytes(%q) is %q, has partial rune", str, got) } } } }
explode_data.jsonl/67501
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 65357, 16, 21, 7078, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 917, 515, 197, 197, 39680, 197, 197, 56693, 756, 197, 197, 1, 101059, 102819, 756, 197, 197, 1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 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...
5
func TestUnicodeConcat(t *testing.T) { const SCRIPT = ` var s = "тест"; var s1 = "test"; var s2 = "абвгд"; s.concat(s1) === "тестtest" && s.concat(s1, s2) === "тестtestабвгд" && s1.concat(s, s2) === "testтестабвгд" && s.concat(s2) === "тестабвгд"; ` testScript1(SCRIPT, valueTrue, t) }
explode_data.jsonl/10449
{ "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, 33920, 78440, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 1565, 271, 2405, 274, 284, 330, 1792, 36177, 876, 2405, 274, 16, 284, 330, 1944, 876, 2405, 274, 17, 284, 330, 37622, 5474, 15390, 6949, 3302, 1903, 15256, 1141...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWAL_JournalOnly(t *testing.T) { ctx := context.Background() msgs := []string{ "Message 1", "Message 2", "Message 3", "Message 4", "Message 5", } dir, cleanup := mustTempDir(t) defer cleanup() // Create a new journal inside a function (so we can defer closing it). if err := func() error { // Create a WAL (journals only, in this case) in the brand new dir. // We don't specify a loader or adder because we just created an empty // directory. See below for how to load things. // // We also force frequent rotation by severely limiting max counts. w, err := Open(ctx, dir, WithMaxJournalIndices(2), WithAllowWrite(true)) if err != nil { return fmt.Errorf("create empty WAL: %w", err) } defer w.Close() for _, msg := range msgs { if err := w.Append([]byte(msg)); err != nil { return fmt.Errorf("create, append initial: %w", err) } } return nil }(); err != nil { t.Fatalf("Error creating WAL: %v", err) } // Check that we have expected names. expectNames := []string{ "0000000000000001-journal-final", "0000000000000003-journal-final", "0000000000000005-journal", } var gotNames []string ds, err := os.ReadDir(dir) if err != nil { t.Fatalf("Read dir: %v", err) } for _, de := range ds { gotNames = append(gotNames, de.Name()) } if diff := cmp.Diff(expectNames, gotNames); diff != "" { t.Fatalf("Unexpected diff in dir names (-want +got):\n%v", diff) } additionalMsgs := []string{ "Message 6", "Message 7", } // Open the WAL and read it, write a couple more records. var readMsgs []string if err := func() error { w, err := Open(ctx, dir, WithMaxJournalIndices(2), WithAllowWrite(true), WithJournalPlayerFunc(func(_ context.Context, b []byte) error { readMsgs = append(readMsgs, string(b)) return nil }), ) if err != nil { return fmt.Errorf("read WAL: %w", err) } defer w.Close() for _, msg := range additionalMsgs { if err := w.Append([]byte(msg)); err != nil { return fmt.Errorf("append to WAL: %w", err) } } return nil }(); err != nil { t.Fatalf("Error reading/appending WAL: %v", err) } // Check that we read back the right things. if diff := cmp.Diff(msgs, readMsgs); diff != "" { t.Fatalf("Unexpected diff in written messages and read messages (-want +got):\n%v", diff) } // Check that a new file was added due to rotation. allNames := []string{ "0000000000000001-journal-final", "0000000000000003-journal-final", "0000000000000005-journal-final", "0000000000000007-journal", } gotNames = nil ds, err = os.ReadDir(dir) for _, de := range ds { gotNames = append(gotNames, de.Name()) } if diff := cmp.Diff(allNames, gotNames); diff != "" { t.Fatalf("Unexpected diff in dir names after append (-want +got):\n%v", diff) } // Try reading everything back, check that it has every entry. finalExpected := append(msgs, additionalMsgs...) var finalMsgs []string if err := func() error { w, err := Open(ctx, dir, WithJournalPlayerFunc(func(_ context.Context, b []byte) error { finalMsgs = append(finalMsgs, string(b)) return nil }), ) if err != nil { return fmt.Errorf("read final WAL: %w", err) } return w.Close() }(); err != nil { t.Fatalf("Error reading final journal: %v", err) } // Check that we got all messages back. if diff := cmp.Diff(finalExpected, finalMsgs); diff != "" { t.Fatalf("Unexpected diff in final messages (-want +got):\n%v", diff) } }
explode_data.jsonl/70889
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1316 }
[ 2830, 3393, 54, 969, 10598, 4931, 7308, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 21169, 82, 1669, 3056, 917, 515, 197, 197, 1, 2052, 220, 16, 756, 197, 197, 1, 2052, 220, 17, 756, 197, 197, 1, 2052, 220, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetCaller(t *testing.T) { results := [4]string{ "loghook/caller.go", "loghook/caller_test.go", "testing/testing.go", "runtime/asm_amd64.s", } for i, v := range results { p, f, l := getCaller(i) _, _, _ = p, f, l if f != v { t.Errorf("The response for getCaller(%d) should be %q but returns %q", i, v, p) } } }
explode_data.jsonl/43275
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 1949, 58735, 1155, 353, 8840, 836, 8, 1476, 55497, 1669, 508, 19, 30953, 515, 197, 197, 47012, 20873, 2899, 13956, 18002, 756, 197, 197, 47012, 20873, 2899, 13956, 4452, 18002, 756, 197, 197, 42097, 28801, 18002, 756, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDeleteGroup(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() group := th.CreateGroup() g, err := th.App.DeleteGroup(group.Id) require.Nil(t, err) require.NotNil(t, g) g, err = th.App.DeleteGroup(group.Id) require.NotNil(t, err) require.Nil(t, g) }
explode_data.jsonl/37038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 6435, 2808, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 44260, 1669, 270, 7251, 2808, 2822, 3174, 11, 1848, 1669, 270, 5105, 18872, 2808, 17690, 6444, 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 TestHello(t *testing.T) { assertCorrectMessage := func(t testing.TB, got, want string) { t.Helper() if got != want { t.Errorf("got %q want %q", got, want) } } t.Run("to a person", func(t *testing.T) { got := Hello("Chris", "") want := "Hello, Chris" assertCorrectMessage(t, got, want) }) t.Run("empty string", func(t *testing.T) { got := Hello("", "") want := "Hello, World" assertCorrectMessage(t, got, want) }) t.Run("in Spanish", func(t *testing.T) { got := Hello("Elodie", spanish) want := "Hola, Elodie" assertCorrectMessage(t, got, want) }) t.Run("in French", func(t *testing.T) { got := Hello("Lauren", french) want := "Bonjour, Lauren" assertCorrectMessage(t, got, want) }) }
explode_data.jsonl/35755
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 304 }
[ 2830, 3393, 9707, 1155, 353, 8840, 836, 8, 1476, 6948, 33092, 2052, 1669, 2915, 1155, 7497, 836, 33, 11, 2684, 11, 1366, 914, 8, 341, 197, 3244, 69282, 741, 197, 743, 2684, 961, 1366, 341, 298, 3244, 13080, 445, 22390, 1018, 80, 136...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMuxEmptyRoutes(t *testing.T) { mux := NewRouter() apiRouter := NewRouter() // oops, we forgot to declare any route handlers mux.Handle("/api*", apiRouter) if _, body := testHandler(t, mux, "GET", "/", nil); body != "404 page not found\n" { t.Fatalf(body) } if _, body := testHandler(t, apiRouter, "GET", "/", nil); body != "404 page not found\n" { t.Fatalf(body) } }
explode_data.jsonl/42866
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 44, 2200, 3522, 26653, 1155, 353, 8840, 836, 8, 341, 2109, 2200, 1669, 1532, 9523, 2822, 54299, 9523, 1669, 1532, 9523, 741, 197, 322, 297, 3721, 11, 582, 28595, 311, 15913, 894, 6021, 24083, 271, 2109, 2200, 31421, 4283, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestServer_GetChainHead(t *testing.T) { db, _ := dbTest.SetupDB(t) genBlock := testutil.NewBeaconBlock() genBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'G'}, 32) require.NoError(t, db.SaveBlock(context.Background(), genBlock)) gRoot, err := genBlock.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveGenesisBlockRoot(context.Background(), gRoot)) finalizedBlock := testutil.NewBeaconBlock() finalizedBlock.Block.Slot = 1 finalizedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'A'}, 32) require.NoError(t, db.SaveBlock(context.Background(), finalizedBlock)) fRoot, err := finalizedBlock.Block.HashTreeRoot() require.NoError(t, err) justifiedBlock := testutil.NewBeaconBlock() justifiedBlock.Block.Slot = 2 justifiedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'B'}, 32) require.NoError(t, db.SaveBlock(context.Background(), justifiedBlock)) jRoot, err := justifiedBlock.Block.HashTreeRoot() require.NoError(t, err) prevJustifiedBlock := testutil.NewBeaconBlock() prevJustifiedBlock.Block.Slot = 3 prevJustifiedBlock.Block.ParentRoot = bytesutil.PadTo([]byte{'C'}, 32) require.NoError(t, db.SaveBlock(context.Background(), prevJustifiedBlock)) pjRoot, err := prevJustifiedBlock.Block.HashTreeRoot() require.NoError(t, err) s, err := stateTrie.InitializeFromProto(&pbp2p.BeaconState{ Slot: 1, PreviousJustifiedCheckpoint: &ethpb.Checkpoint{Epoch: 3, Root: pjRoot[:]}, CurrentJustifiedCheckpoint: &ethpb.Checkpoint{Epoch: 2, Root: jRoot[:]}, FinalizedCheckpoint: &ethpb.Checkpoint{Epoch: 1, Root: fRoot[:]}, }) require.NoError(t, err) b := testutil.NewBeaconBlock() b.Block.Slot, err = helpers.StartSlot(s.PreviousJustifiedCheckpoint().Epoch) require.NoError(t, err) b.Block.Slot++ bs := &Server{ BeaconDB: db, HeadFetcher: &chainMock.ChainService{Block: b, State: s}, FinalizationFetcher: &chainMock.ChainService{ FinalizedCheckPoint: s.FinalizedCheckpoint(), CurrentJustifiedCheckPoint: s.CurrentJustifiedCheckpoint(), PreviousJustifiedCheckPoint: s.PreviousJustifiedCheckpoint()}, } head, err := bs.GetChainHead(context.Background(), nil) require.NoError(t, err) assert.Equal(t, uint64(3), head.PreviousJustifiedEpoch, "Unexpected PreviousJustifiedEpoch") assert.Equal(t, uint64(2), head.JustifiedEpoch, "Unexpected JustifiedEpoch") assert.Equal(t, uint64(1), head.FinalizedEpoch, "Unexpected FinalizedEpoch") assert.Equal(t, uint64(24), head.PreviousJustifiedSlot, "Unexpected PreviousJustifiedSlot") assert.Equal(t, uint64(16), head.JustifiedSlot, "Unexpected JustifiedSlot") assert.Equal(t, uint64(8), head.FinalizedSlot, "Unexpected FinalizedSlot") assert.DeepEqual(t, pjRoot[:], head.PreviousJustifiedBlockRoot, "Unexpected PreviousJustifiedBlockRoot") assert.DeepEqual(t, jRoot[:], head.JustifiedBlockRoot, "Unexpected JustifiedBlockRoot") assert.DeepEqual(t, fRoot[:], head.FinalizedBlockRoot, "Unexpected FinalizedBlockRoot") }
explode_data.jsonl/36479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1085 }
[ 2830, 3393, 5475, 13614, 18837, 12346, 1155, 353, 8840, 836, 8, 341, 20939, 11, 716, 1669, 2927, 2271, 39820, 3506, 1155, 692, 82281, 4713, 1669, 1273, 1314, 7121, 3430, 22379, 4713, 741, 82281, 4713, 28477, 28985, 8439, 284, 5820, 1314, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTerragruntGenerateBlockNestedInherit(t *testing.T) { t.Parallel() generateTestCase := filepath.Join(TEST_FIXTURE_CODEGEN_PATH, "generate-block", "nested", "child_inherit") cleanupTerraformFolder(t, generateTestCase) cleanupTerragruntFolder(t, generateTestCase) runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", generateTestCase)) // If the state file was written as foo.tfstate, that means it inherited the config assert.True(t, fileIsInFolder(t, "foo.tfstate", generateTestCase)) assert.False(t, fileIsInFolder(t, "bar.tfstate", generateTestCase)) // Also check to make sure the child config generate block was included assert.True(t, fileIsInFolder(t, "random_file.txt", generateTestCase)) }
explode_data.jsonl/10162
{ "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, 51402, 68305, 3850, 31115, 4713, 71986, 641, 9263, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3174, 13220, 16458, 1669, 26054, 22363, 50320, 42635, 41486, 10020, 11085, 7944, 11, 330, 19366, 9425, 497, 330, 59271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMailBoxEncoding(t *testing.T) { mailbox := MailBox{ Address: "info@example.org", SpamCheckerStrength: SpamCheckStrengthAverage, MaxDiskUsage: 100, HasVacationReply: true, VacationReplySubject: "out of office", VacationReplyMessage: "I'm out of office, ktnxbye", } fixtArgs := `<mailbox xsi:type="ns1:MailBox"> <address xsi:type="xsd:string">info@example.org</address> <spamCheckerStrength xsi:type="xsd:string">AVERAGE</spamCheckerStrength> <maxDiskUsage xsi:type="xsd:int">100</maxDiskUsage> <hasVacationReply xsi:type="xsd:boolean">true</hasVacationReply> <vacationReplySubject xsi:type="xsd:string">out of office</vacationReplySubject> <vacationReplyMessage xsi:type="xsd:string">I'm out of office, ktnxbye</vacationReplyMessage> </mailbox>` assert.Equal(t, fixtArgs, mailbox.EncodeArgs("mailbox")) prm := gotransip.TestParamsContainer{} mailbox.EncodeParams(&prm, "") assert.Equal(t, "00[address]=info@example.org&280[spamCheckerStrength]=AVERAGE&610[maxDiskUsage]=100&830[hasVacationReply]=1&1070[vacationReplySubject]=out of office&1480[vacationReplyMessage]=I'm out of office, ktnxbye", prm.Prm) }
explode_data.jsonl/35226
{ "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, 16702, 1611, 14690, 1155, 353, 8840, 836, 8, 341, 2109, 604, 2011, 1669, 14874, 1611, 515, 197, 98090, 25, 1060, 330, 2733, 35487, 2659, 756, 197, 197, 6406, 309, 35188, 52857, 25, 220, 81667, 3973, 52857, 26292, 345, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestVacuum(t *testing.T) { db, err := EmptyInMemory() if err != nil { t.Fatal(err) } // Insert vacuum startedAt := time.Now() id, err := db.InsertVacuum(startedAt) assert.NoError(t, err) // Get vacuum vac, err := db.GetVacuum(id) assert.NoError(t, err) assert.Equal(t, startedAt.UnixNano(), vac.StartedAt) assert.Equal(t, VacuumRunning, vac.Status) assert.Equal(t, id, vac.ID) assert.Zero(t, vac.CompletedAt) // Update vacuum status completedAt := time.Now().Add(10 * time.Second) err = db.UpdateVacuum(id, completedAt, VacuumOK) assert.NoError(t, err) // CompletedAt should be set after update vac2, err := db.GetVacuum(id) assert.NoError(t, err) assert.Equal(t, Vacuum{ID: id, Status: VacuumOK, StartedAt: startedAt.UnixNano(), CompletedAt: completedAt.UnixNano()}, vac2, ) // Error from GetVacuum if id does not exist _, err = db.GetVacuum("") assert.Equal(t, ErrNotFound, err) // No Error from UpdateVacuum if id does not exist err = db.UpdateVacuum("", completedAt, VacuumOK) assert.NoError(t, err) }
explode_data.jsonl/24262
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 423 }
[ 2830, 3393, 81789, 20434, 1155, 353, 8840, 836, 8, 341, 20939, 11, 1848, 1669, 22228, 641, 10642, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 197, 322, 17101, 28202, 198, 21375, 291, 1655, 1669, 882, 13244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProtocolTests(t *testing.T) { for _, ct := range protocolTests { hint, ok := ValidateProtocol(ct.client, ct.protocol) assert.Equal(t, ct.result, ok, ct.message) assert.Contains(t, hint, ct.hint, ct.message) } }
explode_data.jsonl/20783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 20689, 18200, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 20251, 1669, 2088, 11507, 18200, 341, 197, 9598, 396, 11, 5394, 1669, 23282, 20689, 40583, 6581, 11, 20251, 29851, 340, 197, 6948, 12808, 1155, 11, 20251, 12071, 11, 53...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImageLinear(t *testing.T) { src, _ := NewImage(32, 32, FilterDefault) dst, _ := NewImage(64, 64, FilterDefault) src.Fill(color.RGBA{0, 0xff, 0, 0xff}) ebitenutil.DrawRect(src, 8, 8, 16, 16, color.RGBA{0xff, 0, 0, 0xff}) op := &DrawImageOptions{} op.GeoM.Translate(8, 8) op.GeoM.Scale(2, 2) r := image.Rect(8, 8, 24, 24) op.SourceRect = &r op.Filter = FilterLinear dst.DrawImage(src, op) for j := 0; j < 64; j++ { for i := 0; i < 64; i++ { c := dst.At(i, j).(color.RGBA) got := c.G want := uint8(0) if abs(int(c.G)-int(want)) > 1 { t.Errorf("dst At(%d, %d).G: got %#v, want: %#v", i, j, got, want) } } } }
explode_data.jsonl/10900
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 331 }
[ 2830, 3393, 1906, 31898, 1155, 353, 8840, 836, 8, 341, 41144, 11, 716, 1669, 1532, 1906, 7, 18, 17, 11, 220, 18, 17, 11, 12339, 3675, 340, 52051, 11, 716, 1669, 1532, 1906, 7, 21, 19, 11, 220, 21, 19, 11, 12339, 3675, 340, 41144...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLargestArea(t *testing.T) { con := &contactPair{} con.v0, con.v1, con.v2 = lin.NewV3(), lin.NewV3(), lin.NewV3() // Existing points: essentially 14,0,+-1, 16,0,+-1 manifold := newManifold() manifold[0].sp.localA.SetS(13.993946, 25.000000, -0.999210) // 14,0,-1 manifold[1].sp.localA.SetS(14.006243, 25.000000, 0.979937) // 14,0,1 manifold[2].sp.localA.SetS(15.989870, 25.000000, 0.996212) // 16,0,1 manifold[3].sp.localA.SetS(15.993749, 25.000000, -0.999743) // 16,0,-1 // new point A should replace existing point 0. ptA := newPoc() ptA.sp.localA.SetS(14.024626, 25.000000, -1.020002) // 14,0,-1 if index := con.largestArea(manifold, ptA); index != 0 { t.Errorf("Wrong replacement ptA for best contact area %d", index) } // new point A should replace existing point 1. ptB := newPoc() ptB.sp.localA.SetS(14.008444, 25.000000, 0.979925) // 14,0,1 if index := con.largestArea(manifold, ptB); index != 1 { t.Errorf("Wrong replacement ptB for best contact area %d", index) } }
explode_data.jsonl/4956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 453 }
[ 2830, 3393, 43, 32381, 8726, 1155, 353, 8840, 836, 8, 341, 37203, 1669, 609, 6287, 12443, 16094, 37203, 3133, 15, 11, 390, 3133, 16, 11, 390, 3133, 17, 284, 9805, 7121, 53, 18, 1507, 9805, 7121, 53, 18, 1507, 9805, 7121, 53, 18, 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 TestAuthorityAddr(t *testing.T) { tests := []struct { scheme, authority string want string }{ {"http", "foo.com", "foo.com:80"}, {"https", "foo.com", "foo.com:443"}, {"https", "foo.com:1234", "foo.com:1234"}, {"https", "1.2.3.4:1234", "1.2.3.4:1234"}, {"https", "1.2.3.4", "1.2.3.4:443"}, {"https", "[::1]:1234", "[::1]:1234"}, {"https", "[::1]", "[::1]:443"}, } for _, tt := range tests { got := authorityAddr(tt.scheme, tt.authority) if got != tt.want { t.Errorf("authorityAddr(%q, %q) = %q; want %q", tt.scheme, tt.authority, got, tt.want) } } }
explode_data.jsonl/16142
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 45532, 13986, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 1903, 8058, 11, 11198, 914, 198, 197, 50780, 1060, 914, 198, 197, 59403, 197, 197, 4913, 1254, 497, 330, 7975, 905, 497, 330, 7975, 905, 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...
3
func TestSecondaryRegistry(t *testing.T) { Reset() // Mock command line arguments os.Args = append(os.Args, customConfig) type customConfiguration struct { Key string } type SecondaryRegistry struct { Custom customConfiguration } r2 := new(SecondaryRegistry) // This relies on default.dusk.toml if err := Load("custom", r2, nil); err != nil { t.Errorf("Failed parse: %v", err) } if Get().General.Network != "testnet" { t.Errorf("Invalid Network value: %s", Get().General.Network) } if r2.Custom.Key != "value" { t.Errorf("Invalid Custom Key value: %s", r2.Custom.Key) } if Get().Profile[0].Name != "heap" { t.Errorf("Invalid Profile [0]: %s", Get().Profile[0].Name) } if Get().Profile[1].Name != "cpu" { t.Errorf("Invalid Profile [1]: %s", Get().Profile[1].Name) } }
explode_data.jsonl/43172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 301 }
[ 2830, 3393, 48963, 15603, 1155, 353, 8840, 836, 8, 341, 197, 14828, 2822, 197, 322, 14563, 3210, 1555, 5977, 198, 25078, 51015, 284, 8737, 9638, 51015, 11, 2526, 2648, 692, 13158, 2526, 7688, 2036, 341, 197, 55242, 914, 198, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlushPlanCache(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() orgEnable := core.PreparedPlanCacheEnabled() defer core.SetPreparedPlanCache(orgEnable) core.SetPreparedPlanCache(true) se, err := session.CreateSession4TestWithOpt(store, &session.Opt{ PreparedPlanCache: kvcache.NewSimpleLRUCache(100, 0.1, math.MaxUint64), }) require.NoError(t, err) tk := testkit.NewTestKitWithSession(t, store, se) tk2 := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t1") tk.MustExec("drop table if exists t2") tk.MustExec("create table t1(id int, a int, b int, key(a))") tk.MustExec("create table t2(id int, a int, b int, key(a))") tk.MustExec("prepare stmt1 from 'SELECT * from t1,t2 where t1.id = t2.id';") tk.MustExec("execute stmt1;") tk.MustExec("execute stmt1;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec("prepare stmt2 from 'SELECT * from t1';") tk.MustExec("execute stmt2;") tk.MustExec("execute stmt2;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec("prepare stmt3 from 'SELECT * from t1 where id = 1';") tk.MustExec("execute stmt3;") tk.MustExec("execute stmt3;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk2.MustExec("use test") tk2.MustExec("drop table if exists t1") tk2.MustExec("drop table if exists t2") tk2.MustExec("create table t1(id int, a int, b int, key(a))") tk2.MustExec("create table t2(id int, a int, b int, key(a))") tk2.MustExec("prepare stmt1 from 'SELECT * from t1,t2 where t1.id = t2.id';") tk2.MustExec("execute stmt1;") tk2.MustExec("execute stmt1;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk2.MustExec("prepare stmt2 from 'SELECT * from t1';") tk2.MustExec("execute stmt2;") tk2.MustExec("execute stmt2;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk2.MustExec("prepare stmt3 from 'SELECT * from t1 where id = 1';") tk2.MustExec("execute stmt3;") tk2.MustExec("execute stmt3;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec("admin flush session plan_cache;") tk.MustExec("execute stmt1;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustExec("execute stmt2;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustExec("execute stmt3;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk2.MustExec("execute stmt1;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk2.MustExec("execute stmt2;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk2.MustExec("execute stmt3;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec("execute stmt1;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec("execute stmt2;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec("execute stmt3;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk2.MustExec("admin flush instance plan_cache;") tk2.MustExec("execute stmt1;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk2.MustExec("execute stmt2;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk2.MustExec("execute stmt3;") tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustExec("execute stmt1;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustExec("execute stmt2;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustExec("execute stmt3;") tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) err = tk.ExecToErr("admin flush global plan_cache;") require.EqualError(t, err, "Do not support the 'admin flush global scope.'") }
explode_data.jsonl/5493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1542 }
[ 2830, 3393, 46874, 20485, 8233, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 741, 87625, 11084, 1669, 6200, 28770, 7212, 20485, 8233, 5462, 741, 16867, 6200, 4202, 4703, 7212,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOffset(t *testing.T) { defer leaktest.AfterTest(t)() tcs := []struct { offset int tuples []tuple expected []tuple }{ { offset: 0, tuples: tuples{{1}, {2}, {3}, {4}}, expected: tuples{{1}, {2}, {3}, {4}}, }, { offset: 1, tuples: tuples{{1}, {2}, {3}, {4}}, expected: tuples{{2}, {3}, {4}}, }, { offset: 2, tuples: tuples{{1}, {2}, {3}, {4}}, expected: tuples{{3}, {4}}, }, { offset: 4, tuples: tuples{{1}, {2}, {3}, {4}}, expected: tuples{}, }, { offset: 100000, tuples: tuples{{1}, {2}, {3}, {4}}, expected: tuples{}, }, } for _, tc := range tcs { // The tuples consisting of all nulls still count as separate rows, so if // we replace all values with nulls, we should get the same output. runTestsWithoutAllNullsInjection(t, []tuples{tc.tuples}, nil /* typs */, tc.expected, unorderedVerifier, func(input []colexecbase.Operator) (colexecbase.Operator, error) { return NewOffsetOp(input[0], tc.offset), nil }) } }
explode_data.jsonl/45635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 487 }
[ 2830, 3393, 6446, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 3244, 4837, 1669, 3056, 1235, 341, 197, 40668, 256, 526, 198, 197, 3244, 28323, 256, 3056, 24590, 198, 197, 42400, 3056, 24590, 198, 197, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBasicUserJWTAuth(t *testing.T) { if server.VERSION[0] == '1' { t.Skip() } ts := runTrustServer() defer ts.Shutdown() url := fmt.Sprintf("nats://127.0.0.1:%d", TEST_PORT) _, err := Connect(url) if err == nil { t.Fatalf("Expecting an error on connect") } jwtCB := func() (string, error) { return uJWT, nil } sigCB := func(nonce []byte) ([]byte, error) { kp, _ := nkeys.FromSeed(uSeed) sig, _ := kp.Sign(nonce) return sig, nil } // Try with user jwt but no sig _, err = Connect(url, UserJWT(jwtCB, nil)) if err == nil { t.Fatalf("Expecting an error on connect") } // Try with user callback _, err = Connect(url, UserJWT(nil, sigCB)) if err == nil { t.Fatalf("Expecting an error on connect") } nc, err := Connect(url, UserJWT(jwtCB, sigCB)) if err != nil { t.Fatalf("Expected to connect, got %v", err) } nc.Close() }
explode_data.jsonl/44924
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 375 }
[ 2830, 3393, 15944, 1474, 55172, 5087, 1155, 353, 8840, 836, 8, 341, 743, 3538, 31372, 58, 15, 60, 621, 364, 16, 6, 341, 197, 3244, 57776, 741, 197, 532, 57441, 1669, 1598, 45548, 5475, 741, 16867, 10591, 10849, 18452, 2822, 19320, 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 TestApiTest_AddsQueryParamsToRequest(t *testing.T) { handler := http.NewServeMux() handler.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { if "b" != r.URL.Query().Get("a") { w.WriteHeader(http.StatusBadRequest) return } w.WriteHeader(http.StatusOK) }) apitest.New(). Handler(handler). Get("/hello"). QueryParams(map[string]string{"a": "b"}). Expect(t). Status(http.StatusOK). End() }
explode_data.jsonl/54787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 6563, 2271, 21346, 82, 2859, 4870, 1249, 1900, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1758, 7121, 60421, 44, 2200, 741, 53326, 63623, 4283, 14990, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDeviceTokenReturns(t *testing.T) { sender := mocks.NewSender() body := mocks.NewBody(MockDeviceTokenResponse) sender.AppendResponse(mocks.NewResponseWithBodyAndStatus(body, http.StatusOK, "OK")) _, err := WaitForUserCompletion(sender, deviceCode()) if err != nil { t.Fatalf("adal: got error unexpectedly") } if body.IsOpen() { t.Fatalf("response body was left open!") } }
explode_data.jsonl/27501
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 6985, 3323, 16446, 1155, 353, 8840, 836, 8, 341, 1903, 1659, 1669, 68909, 7121, 20381, 741, 35402, 1669, 68909, 7121, 5444, 66436, 6985, 3323, 2582, 340, 1903, 1659, 8982, 2582, 1255, 25183, 7121, 2582, 2354, 5444, 3036, 2522,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBoundCaseSensitivity(t *testing.T) { assert.Equal(t, "brown", Get("eyes")) BindEnv("eYEs", "TURTLE_EYES") os.Setenv("TURTLE_EYES", "blue") assert.Equal(t, "blue", Get("eyes")) var testString = "green" var testValue = newStringValue(testString, &testString) flag := &pflag.Flag{ Name: "eyeballs", Value: testValue, Changed: true, } BindPFlag("eYEs", flag) assert.Equal(t, "green", Get("eyes")) }
explode_data.jsonl/5573
{ "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, 19568, 4207, 50, 47837, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 330, 64461, 497, 2126, 445, 57231, 28075, 197, 9950, 14359, 445, 68, 56, 17360, 497, 330, 51, 87096, 867, 2089, 14004, 1138, 25078, 4202, 3160, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnknownInodeId(t *testing.T) { runTest(t, func(test *testHelper) { workspace := test.NewWorkspace() filename := workspace + "/file" // We need to create enough files that we can read // some from the directory without reading the entire // directory. Then we can cause a directory snapshot // to be taken, delete the file filename and then // continue reading. This will result in the inodeId // for the filename being returned to the kernel after // that ID is no longer valid. This entry will be // cached in the kernel and the subsequent open call // will cause an inode number entirely unknown to // QuantumFS to be used in QuantumFs.Open(). for i := 0; i < 300; i++ { file := fmt.Sprintf("%s/filler-%d", workspace, i) test.AssertNoErr(testutils.PrintToFile(file, "contents")) } test.AssertNoErr(testutils.PrintToFile(filename, "contents")) inodeNum := test.getInodeNum(filename) dir, err := os.Open(workspace) test.AssertNoErr(err) defer dir.Close() _, err = dir.Readdir(10) test.AssertNoErr(err) test.AssertNoErr(syscall.Unlink(filename)) test.SyncAllWorkspaces() test.qfs.Forget(uint64(inodeNum), 1) _, err = dir.Readdir(0) test.AssertNoErr(err) _, err = os.Open(filename) test.AssertErr(err) test.Assert(os.IsNotExist(err), "Expected ENOENT, got %s", err.Error()) }) }
explode_data.jsonl/1823
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 501 }
[ 2830, 3393, 13790, 641, 534, 764, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 1155, 11, 2915, 8623, 353, 1944, 5511, 8, 341, 197, 197, 42909, 1669, 1273, 7121, 45981, 741, 197, 66434, 1669, 27514, 488, 3521, 1192, 1837, 197, 197, 322, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFloat32_Difference(t *testing.T) { testcases := []struct { name string s Float32 t Float32 expect []float32 }{ { name: "test Float32 Difference, s is empty", s: Float32{}, t: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, expect: []float32{}, }, { name: "test Float32 Difference, s is empty", s: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, t: Float32{}, expect: []float32{2, 1.3, 4.1}, }, { name: "test Float32 Difference, s ⊂ s", s: map[float32]struct{}{2: {}, 1.3: {}}, t: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, expect: []float32{}, }, { name: "test Float32 Difference, s ⊃ s", s: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, t: map[float32]struct{}{2: {}}, expect: []float32{1.3, 4.1}, }, { name: "test Float32 Difference, s = s", s: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, t: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, expect: []float32{}, }, { name: "test Float32 Difference, s ∩ s = Ø", s: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, t: map[float32]struct{}{1: {}, 6.0: {}}, expect: []float32{2, 1.3, 4.1}, }, { name: "test Float32 Difference, s ∩ s ≠ Ø", s: map[float32]struct{}{2: {}, 1.3: {}, 4.1: {}}, t: map[float32]struct{}{2: {}, 1.3: {}, 4.2: {}}, expect: []float32{4.1}, }, } for _, tc := range testcases { t.Logf("running scenario: %s", tc.name) actual := tc.s.Difference(tc.t) validateFloat32(t, actual, tc.expect) } }
explode_data.jsonl/60115
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 866 }
[ 2830, 3393, 5442, 18, 17, 1557, 18192, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 1903, 414, 13001, 18, 17, 198, 197, 3244, 414, 13001, 18, 17, 198, 197, 24952, 3056, 3649, 18,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestChainConfigValidate(t *testing.T) { testCases := []struct { name string config ChainConfig expError bool }{ {"default", DefaultChainConfig(), false}, { "valid", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.OneInt(), ConstantinopleBlock: sdk.OneInt(), PetersburgBlock: sdk.OneInt(), IstanbulBlock: sdk.OneInt(), MuirGlacierBlock: sdk.OneInt(), YoloV2Block: sdk.OneInt(), EWASMBlock: sdk.OneInt(), }, false, }, { "empty", ChainConfig{}, true, }, { "invalid HomesteadBlock", ChainConfig{ HomesteadBlock: sdk.Int{}, }, true, }, { "invalid DAOForkBlock", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.Int{}, }, true, }, { "invalid EIP150Block", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.Int{}, }, true, }, { "invalid EIP150Hash", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: " ", }, true, }, { "invalid EIP155Block", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.Int{}, }, true, }, { "invalid EIP158Block", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.Int{}, }, true, }, { "invalid ByzantiumBlock", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.Int{}, }, true, }, { "invalid ConstantinopleBlock", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.OneInt(), ConstantinopleBlock: sdk.Int{}, }, true, }, { "invalid PetersburgBlock", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.OneInt(), ConstantinopleBlock: sdk.OneInt(), PetersburgBlock: sdk.Int{}, }, true, }, { "invalid IstanbulBlock", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.OneInt(), ConstantinopleBlock: sdk.OneInt(), PetersburgBlock: sdk.OneInt(), IstanbulBlock: sdk.Int{}, }, true, }, { "invalid MuirGlacierBlock", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.OneInt(), ConstantinopleBlock: sdk.OneInt(), PetersburgBlock: sdk.OneInt(), IstanbulBlock: sdk.OneInt(), MuirGlacierBlock: sdk.Int{}, }, true, }, { "invalid YoloV2Block", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.OneInt(), ConstantinopleBlock: sdk.OneInt(), PetersburgBlock: sdk.OneInt(), IstanbulBlock: sdk.OneInt(), MuirGlacierBlock: sdk.OneInt(), YoloV2Block: sdk.Int{}, }, true, }, { "invalid EWASMBlock", ChainConfig{ HomesteadBlock: sdk.OneInt(), DAOForkBlock: sdk.OneInt(), EIP150Block: sdk.OneInt(), EIP150Hash: defaultEIP150Hash, EIP155Block: sdk.OneInt(), EIP158Block: sdk.OneInt(), ByzantiumBlock: sdk.OneInt(), ConstantinopleBlock: sdk.OneInt(), PetersburgBlock: sdk.OneInt(), IstanbulBlock: sdk.OneInt(), MuirGlacierBlock: sdk.OneInt(), YoloV2Block: sdk.OneInt(), EWASMBlock: sdk.Int{}, }, true, }, } for _, tc := range testCases { err := tc.config.Validate() if tc.expError { require.Error(t, err, tc.name) } else { require.NoError(t, err, tc.name) } } }
explode_data.jsonl/17736
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2881 }
[ 2830, 3393, 18837, 2648, 17926, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 25873, 256, 28525, 2648, 198, 197, 48558, 1454, 1807, 198, 197, 59403, 197, 197, 4913, 2258, 497, 7899, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMigratingFileLeaveExistingFileAlone(t *testing.T) { sourceFile, _ := ioutil.TempFile("", "") defer os.Remove(sourceFile.Name()) destinationFile, _ := ioutil.TempFile("", "") defer os.Remove(destinationFile.Name()) WriteToFile(testConfigAlfa, sourceFile.Name()) loadingRules := ClientConfigLoadingRules{ MigrationRules: map[string]string{destinationFile.Name(): sourceFile.Name()}, } if _, err := loadingRules.Load(); err != nil { t.Errorf("unexpected error %v", err) } destinationContent, err := ioutil.ReadFile(destinationFile.Name()) if err != nil { t.Errorf("unexpected error %v", err) } if len(destinationContent) > 0 { t.Errorf("destination should not have been touched") } }
explode_data.jsonl/67858
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 252 }
[ 2830, 3393, 44, 5233, 1095, 1703, 21833, 53067, 1703, 2101, 603, 1155, 353, 8840, 836, 8, 341, 47418, 1703, 11, 716, 1669, 43144, 65009, 1703, 19814, 14676, 16867, 2643, 13270, 12437, 1703, 2967, 2398, 197, 17997, 1703, 11, 716, 1669, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetRegexForMethod(t *testing.T) { testCases := []struct { name string input string expected string }{ { name: "wildcard HTTP method correctly translates to a match all regex", input: "*", expected: constants.RegexMatchAll, }, { name: "non wildcard HTTP method correctly translates to its corresponding regex", input: "GET", expected: "GET", }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { assert := tassert.New(t) actual := getRegexForMethod(tc.input) assert.Equal(tc.expected, actual) }) } }
explode_data.jsonl/75519
{ "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, 1949, 32464, 2461, 3523, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 22427, 262, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 257, 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 TestRepo(t *testing.T) { r := NewRepo("https://github.com/gojet/layout-api.git") if err := r.Clone(context.Background()); err != nil { t.Fatal(err) } if err := r.CopyTo(context.Background(), "/tmp/test_gojet_repo", "github.com/gojet/layout-api", nil); err != nil { t.Fatal(err) } }
explode_data.jsonl/9648
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 25243, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 25243, 445, 2428, 1110, 5204, 905, 25525, 15407, 40010, 23904, 32799, 1138, 743, 1848, 1669, 435, 64463, 5378, 19047, 13426, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInfoServerNameDefaultsToPK(t *testing.T) { opts := DefaultOptions() opts.Port = 4222 opts.ClientAdvertise = "nats.example.com" s := New(opts) defer s.Shutdown() if s.info.Name != s.info.ID { t.Fatalf("server info hostname is incorrect, got: '%v' expected: '%v'", s.info.Name, s.info.ID) } }
explode_data.jsonl/3602
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 1731, 5475, 675, 16273, 1249, 22242, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 7899, 3798, 741, 64734, 43013, 284, 220, 19, 17, 17, 17, 198, 64734, 11716, 2589, 67787, 284, 330, 77, 1862, 7724, 905, 698, 1903, 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...
2
func TestMaybeMarkReplicaInitialized(t *testing.T) { defer leaktest.AfterTest(t)() stopper := stop.NewStopper() defer stopper.Stop(context.Background()) store, _ := createTestStore(t, testStoreOpts{ // This test was written before test stores could start with more than one // range and was not adapted. createSystemRanges: false, }, stopper) // Clobber the existing range so we can test overlaps that aren't KeyMin or KeyMax. repl1, err := store.GetReplica(1) if err != nil { t.Error(err) } if err := store.RemoveReplica(context.Background(), repl1, repl1.Desc().NextReplicaID, RemoveOptions{ DestroyData: true, }); err != nil { t.Error(err) } repl := createReplica(store, roachpb.RangeID(2), roachpb.RKey("a"), roachpb.RKey("c")) if err := store.AddReplica(repl); err != nil { t.Fatal(err) } newRangeID := roachpb.RangeID(3) desc := &roachpb.RangeDescriptor{ RangeID: newRangeID, } r, err := newReplica(context.Background(), desc, store, 1) if err != nil { t.Fatal(err) } store.mu.Lock() defer store.mu.Unlock() expectedResult := "attempted to process uninitialized range.*" ctx := r.AnnotateCtx(context.Background()) if err := store.maybeMarkReplicaInitializedLocked(ctx, r); !testutils.IsError(err, expectedResult) { t.Errorf("expected maybeMarkReplicaInitializedLocked with uninitialized replica to fail, got %v", err) } // Initialize the range with start and end keys. desc = protoutil.Clone(desc).(*roachpb.RangeDescriptor) desc.StartKey = roachpb.RKey("b") desc.EndKey = roachpb.RKey("d") desc.InternalReplicas = []roachpb.ReplicaDescriptor{{ NodeID: 1, StoreID: 1, ReplicaID: 1, }} desc.NextReplicaID = 2 r.setDescRaftMuLocked(ctx, desc) if err := store.maybeMarkReplicaInitializedLocked(ctx, r); err != nil { t.Errorf("expected maybeMarkReplicaInitializedLocked on a replica that's not in the uninit map to silently succeed, got %v", err) } store.mu.uninitReplicas[newRangeID] = r expectedResult = ".*cannot initialize replica.*" if err := store.maybeMarkReplicaInitializedLocked(ctx, r); !testutils.IsError(err, expectedResult) { t.Errorf("expected maybeMarkReplicaInitializedLocked with overlapping keys to fail, got %v", err) } }
explode_data.jsonl/87
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 806 }
[ 2830, 3393, 21390, 8949, 18327, 15317, 22495, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 62644, 712, 1669, 2936, 7121, 10674, 712, 741, 16867, 2936, 712, 30213, 5378, 19047, 2398, 57279, 11, 716, 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...
8
func TestNoRetryTemporaryFalse(t *testing.T) { listener := &testutils.MockListener{ AcceptFunc: func(i int) (net.Conn, error) { return nil, testutils.ErrTemporaryFalse }, } server := &RetryServer{ Listener: listener, } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() start := time.Now() if err := server.Serve(ctx); errors.Cause(err) != testutils.ErrTemporaryFalse { t.Errorf("want %v, got %v", testutils.ErrTemporaryFalse, err) } // error was a Temporary, but it returned false, so there should // be no delay got := time.Since(start) want := time.Duration(0) if got < want || got > (want+(10*time.Millisecond)) { t.Errorf("want duration of %v, got %v", want, got) } }
explode_data.jsonl/71924
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 273 }
[ 2830, 3393, 2753, 51560, 59362, 4049, 1155, 353, 8840, 836, 8, 341, 14440, 798, 1669, 609, 1944, 6031, 24664, 2743, 515, 197, 197, 16646, 9626, 25, 2915, 1956, 526, 8, 320, 4711, 50422, 11, 1465, 8, 341, 298, 853, 2092, 11, 1273, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIfdBuilder_AddTagsFromExisting(t *testing.T) { defer func() { if state := recover(); state != nil { err := log.Wrap(state.(error)) log.PrintError(err) t.Fatalf("Test failure.") } }() exifData := getExifSimpleTestIbBytes() im := NewIfdMapping() err := LoadStandardIfds(im) log.PanicIf(err) ti := NewTagIndex() _, index, err := Collect(im, ti, exifData) log.PanicIf(err) ib := NewIfdBuilder(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder) err = ib.AddTagsFromExisting(index.RootIfd, nil, nil) log.PanicIf(err) expected := []uint16{ 0x000b, 0x00ff, 0x0100, 0x013e, } if len(ib.tags) != len(expected) { t.Fatalf("Tag count not correct: (%d) != (%d)", len(ib.tags), len(expected)) } for i, tag := range ib.tags { if tag.tagId != expected[i] { t.Fatalf("Tag (%d) not correct: (0x%04x) != (0x%04x)", i, tag.tagId, expected[i]) } } }
explode_data.jsonl/36624
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 399 }
[ 2830, 3393, 2679, 67, 3297, 21346, 15930, 3830, 53067, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 743, 1584, 1669, 11731, 2129, 1584, 961, 2092, 341, 298, 9859, 1669, 1487, 38968, 8390, 12832, 841, 1171, 298, 6725, 7918, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseMirBSDKorn(t *testing.T) { t.Parallel() p := NewParser(Variant(LangMirBSDKorn)) for i, c := range append(fileTests, fileTestsNoPrint...) { want := c.MirBSDKorn if want == nil { continue } for j, in := range c.Strs { t.Run(fmt.Sprintf("%03d-%d", i, j), singleParse(p, in, want)) } } }
explode_data.jsonl/31429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 14463, 58461, 30029, 42, 1512, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3223, 1669, 1532, 6570, 12410, 15341, 4957, 524, 58461, 30029, 42, 1512, 1171, 2023, 600, 11, 272, 1669, 2088, 8737, 4866, 18200, 11, 1034,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBigStruct(t *testing.T) { b := big{1, 2, 3, 4, 5} v := ValueOf(b) b1 := v.Interface().(big) if b1.a != b.a || b1.b != b.b || b1.c != b.c || b1.d != b.d || b1.e != b.e { t.Errorf("ValueOf(%v).Interface().(big) = %v", b, b1) } }
explode_data.jsonl/29536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 15636, 9422, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 2409, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 532, 5195, 1669, 5162, 2124, 1883, 340, 2233, 16, 1669, 348, 41065, 1005, 7, 16154, 340, 743, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestMakeCommandInteger(t *testing.T) { t.Run("min count", func(t *testing.T) { cmd, err := geometry.MakeCommandInteger(geometry.LineTo, 0) require.NoError(t, err) require.Equal(t, geometry.CommandInteger(geometry.LineTo), geometry.CommandInteger(cmd)) require.Equal(t, geometry.LineTo, cmd.ID()) require.Equal(t, 0, int(cmd.Count())) }) t.Run("max count", func(t *testing.T) { count := uint32(math.Pow(2, 29) - 1) cmd, err := geometry.MakeCommandInteger(geometry.LineTo, count) require.NoError(t, err) require.Equal(t, geometry.LineTo, cmd.ID()) require.Equal(t, int(count), int(cmd.Count())) }) t.Run("max count exceeded", func(t *testing.T) { count := uint32(math.Pow(2, 29)) _, err := geometry.MakeCommandInteger(geometry.LineTo, count) require.Error(t, err) }) }
explode_data.jsonl/39454
{ "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, 8078, 4062, 3486, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1065, 1760, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 25920, 11, 1848, 1669, 17047, 50133, 4062, 3486, 86828, 16420, 1249, 11, 220, 15, 340, 197, 17957,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRpcSignatureComposer_buildRpcStringToSign(t *testing.T) { request := requests.NewCommonRequest() request.TransToAcsRequest() stringToSign := buildRpcStringToSign(request) assert.Equal(t, "GET&%2F&", stringToSign) request.FormParams["key"] = "value" stringToSign = buildRpcStringToSign(request) assert.Equal(t, "GET&%2F&key%3Dvalue", stringToSign) request.QueryParams["q"] = "value" stringToSign = buildRpcStringToSign(request) assert.Equal(t, "GET&%2F&key%3Dvalue%26q%3Dvalue", stringToSign) request.QueryParams["q"] = "http://domain/?q=value&q2=value2" stringToSign = buildRpcStringToSign(request) assert.Equal(t, "GET&%2F&key%3Dvalue%26q%3Dhttp%253A%252F%252Fdomain%252F%253Fq%253Dvalue%2526q2%253Dvalue2", stringToSign) }
explode_data.jsonl/42654
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 304 }
[ 2830, 3393, 60248, 25088, 90067, 20801, 60248, 703, 1249, 7264, 1155, 353, 8840, 836, 8, 341, 23555, 1669, 7388, 7121, 10839, 1900, 741, 23555, 11815, 1249, 32, 4837, 1900, 741, 11357, 1249, 7264, 1669, 1936, 60248, 703, 1249, 7264, 4875,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProductService_Get(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() product := mock_application.NewMockProductInterface(ctrl) persistence := mock_application.NewMockProductPersistenceInterface(ctrl) persistence.EXPECT().Get(gomock.Any()).Return(product, nil).AnyTimes() service := application.ProductService{ Persistence: persistence, } result, err := service.Get("any_id") require.Nil(t, err) require.Equal(t, product, result) }
explode_data.jsonl/73774
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 4816, 1860, 13614, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 69288, 1669, 7860, 38721, 7121, 11571, 4816, 5051, 62100, 340, 3223, 8026, 1669, 7860, 38721,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPlugin(t *testing.T) { tmpDir, err := utiltesting.MkTmpdir("rbd_test") if err != nil { t.Fatalf("error creating temp dir: %v", err) } defer os.RemoveAll(tmpDir) tmpDir, err = filepath.EvalSymlinks(tmpDir) if err != nil { t.Fatal(err) } podUID := uuid.NewUUID() var cases []*testcase cases = append(cases, &testcase{ spec: volume.NewSpecFromVolume(&v1.Volume{ Name: "vol1", VolumeSource: v1.VolumeSource{ RBD: &v1.RBDVolumeSource{ CephMonitors: []string{"a", "b"}, RBDPool: "pool1", RBDImage: "image1", FSType: "ext4", ReadOnly: true, }, }, }), root: tmpDir, pod: &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "testpod", Namespace: "testns", UID: podUID, }, }, expectedDevicePath: "/dev/rbd1", expectedDeviceMountPath: fmt.Sprintf("%s/plugins/kubernetes.io/rbd/mounts/pool1-image-image1", tmpDir), expectedPodMountPath: fmt.Sprintf("%s/pods/%s/volumes/kubernetes.io~rbd/vol1", tmpDir, podUID), }) cases = append(cases, &testcase{ spec: volume.NewSpecFromPersistentVolume(&v1.PersistentVolume{ ObjectMeta: metav1.ObjectMeta{ Name: "vol2", }, Spec: v1.PersistentVolumeSpec{ PersistentVolumeSource: v1.PersistentVolumeSource{ RBD: &v1.RBDPersistentVolumeSource{ CephMonitors: []string{"a", "b"}, RBDPool: "pool2", RBDImage: "image2", FSType: "ext4", }, }, AccessModes: []v1.PersistentVolumeAccessMode{v1.ReadOnlyMany}, }, }, false), root: tmpDir, pod: &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "testpod", Namespace: "testns", UID: podUID, }, }, expectedDevicePath: "/dev/rbd1", expectedDeviceMountPath: fmt.Sprintf("%s/plugins/kubernetes.io/rbd/mounts/pool2-image-image2", tmpDir), expectedPodMountPath: fmt.Sprintf("%s/pods/%s/volumes/kubernetes.io~rbd/vol2", tmpDir, podUID), }) for i := 0; i < len(cases); i++ { doTestPlugin(t, cases[i]) } }
explode_data.jsonl/57647
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 980 }
[ 2830, 3393, 11546, 1155, 353, 8840, 836, 8, 341, 20082, 6184, 11, 1848, 1669, 4094, 8840, 1321, 74, 35986, 3741, 445, 81, 8940, 4452, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 841, 6825, 2730, 5419, 25, 1018, 85, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestRequestStream(t *testing.T) { testCases := []struct { Request *Request Err bool ErrFn func(error) bool }{ { Request: &Request{err: errors.New("bail")}, Err: true, }, { Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"}, Err: true, }, { Request: &Request{ client: clientFunc(func(req *http.Request) (*http.Response, error) { return nil, errors.New("err") }), baseURL: &url.URL{}, }, Err: true, }, { Request: &Request{ client: clientFunc(func(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusUnauthorized, Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ Status: metav1.StatusFailure, Reason: metav1.StatusReasonUnauthorized, })))), }, nil }), content: defaultContentConfig(), serializers: defaultSerializers(t), baseURL: &url.URL{}, }, Err: true, }, { Request: &Request{ client: clientFunc(func(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]","reason":"BadRequest","code":400}`))), }, nil }), content: defaultContentConfig(), serializers: defaultSerializers(t), baseURL: &url.URL{}, }, Err: true, ErrFn: func(err error) bool { if err.Error() == "a container name must be specified for pod kube-dns-v20-mz5cv, choose one of: [kubedns dnsmasq healthz]" { return true } return false }, }, } for i, testCase := range testCases { testCase.Request.backoffMgr = &NoBackoff{} body, err := testCase.Request.Stream() hasErr := err != nil if hasErr != testCase.Err { t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err) } if hasErr && body != nil { t.Errorf("%d: body should be nil when error is returned", i) } if hasErr { if testCase.ErrFn != nil && !testCase.ErrFn(err) { t.Errorf("unexpected error: %v", err) } } } }
explode_data.jsonl/13268
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1058 }
[ 2830, 3393, 1900, 3027, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 73806, 353, 1900, 198, 197, 197, 7747, 257, 1807, 198, 197, 197, 7747, 24911, 256, 2915, 6390, 8, 1807, 198, 197, 59403, 197, 197, 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 TestCreateNetwork(t *testing.T) { type args struct { ctx context.Context req *service.CreateNetworkRequest } tests := []struct { name string args args wantVpcRes service.CreateNetworkResponse wantErr bool }{ { name: "测试一键创建", args: args{ ctx: nil, req: &service.CreateNetworkRequest{ Provider: "AlibabaCloud", RegionId: "cn-qingdao", VpcName: "测试一键创建", ZoneId: "cn-qingdao-b", SwitchCidrBlock: "172.16.0.0/24", SwitchName: "一键创建的switch", SecurityGroupName: "一键创建的安全组", SecurityGroupType: "normal", AK: "LTAI5t7qCv6L8ZFh3hzSYpSv", }, }, wantVpcRes: service.CreateNetworkResponse{}, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotVpcRes, err := service.CreateNetwork(tt.args.ctx, tt.args.req) if (err != nil) != tt.wantErr { t.Errorf("CreateNetwork() error = %v, wantErr %v", err, tt.wantErr) return } if reflect.DeepEqual(gotVpcRes, tt.wantVpcRes) { t.Errorf("CreateNetwork() gotVpcRes = %v, want %v", gotVpcRes, tt.wantVpcRes) } }) } }
explode_data.jsonl/72643
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 649 }
[ 2830, 3393, 4021, 12320, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 20985, 2266, 9328, 198, 197, 24395, 353, 7936, 7251, 12320, 1900, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 31215, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSecureCookie(t *testing.T) { mainServer.Config.CookieSecret = "7C19QRmwf3mHZ9CPAaPQ0hsWeufKd" resp1 := getTestResponse("POST", "/securecookie/set/a/1", "", nil, nil) sval, ok := resp1.cookies["a"] if !ok { t.Fatalf("Failed to get cookie ") } cookies := makeCookie(map[string]string{"a": sval}) resp2 := getTestResponse("GET", "/securecookie/get/a", "", nil, cookies) if resp2.body != "1" { t.Fatalf("SecureCookie test failed") } }
explode_data.jsonl/40626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 49813, 20616, 1155, 353, 8840, 836, 8, 341, 262, 1887, 5475, 10753, 82918, 19773, 284, 330, 22, 34, 16, 24, 30465, 76, 43083, 18, 76, 61759, 24, 7123, 32, 64, 47, 48, 15, 4997, 1654, 1704, 42, 67, 698, 262, 9039, 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...
3
func TestRunJoinNodeChecks(t *testing.T) { var tests = []struct { cfg *kubeadmapi.JoinConfiguration expected bool }{ { cfg: &kubeadmapi.JoinConfiguration{}, expected: false, }, { cfg: &kubeadmapi.JoinConfiguration{ Discovery: kubeadmapi.Discovery{ BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{ APIServerEndpoint: "192.168.1.15", }, }, }, expected: false, }, { cfg: &kubeadmapi.JoinConfiguration{ Discovery: kubeadmapi.Discovery{ BootstrapToken: &kubeadmapi.BootstrapTokenDiscovery{ APIServerEndpoint: "2001:1234::1:15", }, }, }, expected: false, }, } for _, rt := range tests { actual := RunJoinNodeChecks(exec.New(), rt.cfg, sets.NewString()) if (actual == nil) != rt.expected { t.Errorf( "failed RunJoinNodeChecks:\n\texpected: %t\n\t actual: %t", rt.expected, (actual != nil), ) } } }
explode_data.jsonl/56063
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 438 }
[ 2830, 3393, 6727, 12292, 1955, 49820, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 50286, 414, 353, 74, 392, 3149, 76, 2068, 22363, 7688, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 515, 298, 50286, 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...
3
func TestConnectionMissingLog(t *testing.T) { irccon := IRC("go-eventirc", "go-eventirc") irccon.Log = nil err := irccon.Connect("chat.freenode.net:6667") if err == nil { t.Fatal("missing 'Log' not detected") } }
explode_data.jsonl/63347
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 4526, 25080, 2201, 1155, 353, 8840, 836, 8, 341, 197, 2437, 443, 1669, 59328, 445, 3346, 39687, 2437, 497, 330, 3346, 39687, 2437, 1138, 197, 2437, 443, 5247, 284, 2092, 198, 9859, 1669, 79923, 443, 43851, 445, 9686, 833, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestErrorListFlattensOtherErrorList(t *testing.T) { const ( kind1 errors.Kind = "kind1" kind2 errors.Kind = "kind2" kind3 errors.Kind = "kind3" ) error1 := errors.E(kind1) error2 := errors.E(kind2) error3 := errors.E(kind3) errs := errors.L(error1) errs.Append(errors.L(error2, error3)) wantErrs := []error{error1, error2, error3} gotErrs := errs.Errors() if diff := cmp.Diff(gotErrs, wantErrs); diff != "" { t.Fatalf("-(got) +(want):\n%s", diff) } }
explode_data.jsonl/82012
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 1454, 852, 3882, 1587, 724, 11409, 1454, 852, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 197, 15314, 16, 5975, 54199, 284, 330, 15314, 16, 698, 197, 197, 15314, 17, 5975, 54199, 284, 330, 15314, 17, 698, 197, 197, 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...
2
func TestRejectTrafficProvidedWithoutCanary(t *testing.T) { g := gomega.NewGomegaWithT(t) isvc := makeTestInferenceService() isvc.Spec.CanaryTrafficPercent = GetIntReference(1) g.Expect(isvc.validate(c)).Should(gomega.MatchError(TrafficProvidedWithoutCanaryError)) }
explode_data.jsonl/1492
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 78413, 87229, 35819, 291, 26040, 6713, 658, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 340, 19907, 7362, 1669, 1281, 2271, 641, 2202, 1860, 741, 19907, 7362, 36473, 53280, 658, 872...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreate(t *testing.T) { handler := utiltesting.FakeHandler{ StatusCode: 500, ResponseBody: "", T: t, } server := httptest.NewServer(&handler) defer server.Close() client := clientset.NewForConfigOrDie(&restclient.Config{Host: server.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &api.Registry.GroupOrDie(v1.GroupName).GroupVersion}}) informerFactory := informers.NewSharedInformerFactory(client, 0) factory := NewConfigFactory( v1.DefaultSchedulerName, client, informerFactory.Core().V1().Nodes(), informerFactory.Core().V1().Pods(), informerFactory.Core().V1().PersistentVolumes(), informerFactory.Core().V1().PersistentVolumeClaims(), informerFactory.Core().V1().ReplicationControllers(), informerFactory.Extensions().V1beta1().ReplicaSets(), informerFactory.Apps().V1beta1().StatefulSets(), informerFactory.Core().V1().Services(), v1.DefaultHardPodAffinitySymmetricWeight, enableEquivalenceCache, ) factory.Create() }
explode_data.jsonl/13319
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 356 }
[ 2830, 3393, 4021, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 4094, 8840, 991, 726, 3050, 515, 197, 197, 15872, 25, 256, 220, 20, 15, 15, 345, 197, 197, 29637, 25, 8324, 197, 10261, 25, 310, 259, 345, 197, 532, 41057, 1669, 54320, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAlternateBackendNoPathInNodePort(t *testing.T) { g := gomega.NewGomegaWithT(t) integrationtest.SetNodePortMode() defer integrationtest.SetClusterIPMode() nodeIP := "10.1.1.2" integrationtest.CreateNode(t, "testNodeNP", nodeIP) defer integrationtest.DeleteNode(t, "testNodeNP") SetUpTestForRouteInNodePort(t, DefaultModelName) integrationtest.CreateSVC(t, "default", "absvc2", corev1.ServiceTypeNodePort, false) routeExample := FakeRoute{}.ABRoute() _, err := OshiftClient.RouteV1().Routes(DefaultNamespace).Create(routeExample) if err != nil { t.Fatalf("error in adding route: %v", err) } aviModel := ValidateModelCommon(t, g) g.Eventually(func() int { pools := aviModel.(*avinodes.AviObjectGraph).GetAviVS()[0].PoolRefs return len(pools) }, 60*time.Second).Should(gomega.Equal(2)) pools := aviModel.(*avinodes.AviObjectGraph).GetAviVS()[0].PoolRefs for _, pool := range pools { if pool.Name == "cluster--foo.com-default-foo-avisvc" || pool.Name == "cluster--foo.com-default-foo-absvc2" { g.Expect(len(pool.Servers)).To(gomega.Equal(1)) } else { t.Fatalf("unexpected pool: %s", pool.Name) } } poolgroups := aviModel.(*avinodes.AviObjectGraph).GetAviVS()[0].PoolGroupRefs for _, pgmember := range poolgroups[0].Members { if *pgmember.PoolRef == "/api/pool?name=cluster--foo.com-default-foo-avisvc" { g.Expect(*pgmember.PriorityLabel).To(gomega.Equal("foo.com")) g.Expect(*pgmember.Ratio).To(gomega.Equal(int32(100))) } else if *pgmember.PoolRef == "/api/pool?name=cluster--foo.com-default-foo-absvc2" { g.Expect(*pgmember.PriorityLabel).To(gomega.Equal("foo.com")) g.Expect(*pgmember.Ratio).To(gomega.Equal(int32(200))) } else { t.Fatalf("unexpected pgmember: %s", *pgmember.PoolRef) } } VerifyRouteDeletion(t, g, aviModel, 0) TearDownTestForRouteInNodePort(t, DefaultModelName) integrationtest.DelSVC(t, "default", "absvc2") }
explode_data.jsonl/46181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 779 }
[ 2830, 3393, 83042, 29699, 2753, 1820, 641, 1955, 7084, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 692, 2084, 17376, 1944, 4202, 1955, 7084, 3636, 741, 16867, 17590, 1944, 4202, 28678, 3298, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUploadOrderMultiDifferentPartSize(t *testing.T) { s, ops, args := loggingSvc(emptyList) mgr := s3manager.NewUploaderWithClient(s, func(u *s3manager.Uploader) { u.PartSize = 1024 * 1024 * 7 u.Concurrency = 1 }) _, err := mgr.Upload(&s3manager.UploadInput{ Bucket: aws.String("Bucket"), Key: aws.String("Key"), Body: bytes.NewReader(buf12MB), }) if err != nil { t.Errorf("Expected no error but received %v", err) } vals := []string{"CreateMultipartUpload", "UploadPart", "UploadPart", "CompleteMultipartUpload"} if !reflect.DeepEqual(vals, *ops) { t.Errorf("Expected %v, but received %v", vals, *ops) } // Part lengths if len := buflen(val((*args)[1], "Body")); 1024*1024*7 != len { t.Errorf("Expected %d, but received %d", 1024*1024*7, len) } if len := buflen(val((*args)[2], "Body")); 1024*1024*5 != len { t.Errorf("Expected %d, but received %d", 1024*1024*5, len) } }
explode_data.jsonl/55632
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 372 }
[ 2830, 3393, 13844, 4431, 20358, 69123, 5800, 1695, 1155, 353, 8840, 836, 8, 341, 1903, 11, 27132, 11, 2827, 1669, 8392, 92766, 24216, 852, 340, 2109, 901, 1669, 274, 18, 13297, 7121, 67574, 2354, 2959, 1141, 11, 2915, 8154, 353, 82, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_SessionFromJSON(t *testing.T) { t.Parallel() a := assert.New(t) p := provider() session, err := p.UnmarshalSession(`{"AuthURL":"https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize","AccessToken":"1234567890"}`) a.NoError(err) s := session.(*paypal.Session) a.Equal(s.AuthURL, "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize") a.Equal(s.AccessToken, "1234567890") }
explode_data.jsonl/33912
{ "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, 84664, 3830, 5370, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 2060, 7121, 1155, 692, 3223, 1669, 9109, 741, 25054, 11, 1848, 1669, 281, 38097, 5283, 5809, 4913, 5087, 3144, 3252, 2428, 1110, 2136, 373...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrincipalCombinedBad(t *testing.T) { msp1, err := setup("testdata/idemix/MSP1OU1", "MSP1OU1") assert.NoError(t, err) id1, err := getDefaultSigner(msp1) assert.NoError(t, err) // create combined principal requiring membership of OU1 in MSP1 and requiring admin role ou := &msp.OrganizationUnit{ OrganizationalUnitIdentifier: id1.GetOrganizationalUnits()[0].OrganizationalUnitIdentifier, MspIdentifier: id1.GetMSPIdentifier(), CertifiersIdentifier: nil, } principalBytes, err := proto.Marshal(ou) assert.NoError(t, err) principalOU := &msp.MSPPrincipal{ PrincipalClassification: msp.MSPPrincipal_ORGANIZATION_UNIT, Principal: principalBytes} principalBytes, err = proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_ADMIN, MspIdentifier: id1.GetMSPIdentifier()}) assert.NoError(t, err) principalRole := &msp.MSPPrincipal{ PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes} principals := []*msp.MSPPrincipal{principalOU, principalRole} combinedPrincipal := &msp.CombinedPrincipal{Principals: principals} combinedPrincipalBytes, err := proto.Marshal(combinedPrincipal) assert.NoError(t, err) principalsCombined := &msp.MSPPrincipal{PrincipalClassification: msp.MSPPrincipal_COMBINED, Principal: combinedPrincipalBytes} err = id1.SatisfiesPrincipal(principalsCombined) assert.Error(t, err, "non-admin member of OU1 in MSP1 should not satisfy principal admin and OU1 in MSP1") assert.Contains(t, err.Error(), "user is not an admin") }
explode_data.jsonl/46054
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 598 }
[ 2830, 3393, 31771, 94268, 17082, 1155, 353, 8840, 836, 8, 341, 47691, 79, 16, 11, 1848, 1669, 6505, 445, 92425, 38146, 336, 941, 10270, 4592, 16, 11922, 16, 497, 330, 44, 4592, 16, 11922, 16, 1138, 6948, 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 Test_skipMessage(t *testing.T) { tests := []struct { event string message string title string want bool }{ { event: "push", message: "update readme", want: false, }, // skip when message contains [CI SKIP] { event: "push", message: "update readme [CI SKIP]", want: true, }, { event: "pull_request", message: "update readme [CI SKIP]", want: true, }, // skip when title contains [CI SKIP] { event: "push", title: "update readme [CI SKIP]", want: true, }, { event: "pull_request", title: "update readme [CI SKIP]", want: true, }, // ignore [CI SKIP] when event is tag { event: "tag", message: "update readme [CI SKIP]", want: false, }, { event: "tag", title: "update readme [CI SKIP]", want: false, }, { event: "cron", title: "update readme [CI SKIP]", want: false, }, { event: "cron", title: "update readme [CI SKIP]", want: false, }, { event: "custom", title: "update readme [CI SKIP]", want: false, }, { event: "custom", title: "update readme [CI SKIP]", want: false, }, } for _, test := range tests { hook := &core.Hook{ Message: test.message, Title: test.title, Event: test.event, } got, want := skipMessage(hook), test.want if got != want { t.Errorf("Want { event: %q, message: %q, title: %q } to return %v", test.event, test.message, test.title, want) } } }
explode_data.jsonl/14348
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 715 }
[ 2830, 3393, 44830, 2052, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 28302, 256, 914, 198, 197, 24753, 914, 198, 197, 24751, 256, 914, 198, 197, 50780, 262, 1807, 198, 197, 59403, 197, 197, 515, 298, 28302, 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...
3
func TestTransportCloseResponseBody(t *testing.T) { defer afterTest(t) writeErr := make(chan error, 1) msg := []byte("young\n") ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { for { _, err := w.Write(msg) if err != nil { writeErr <- err return } w.(Flusher).Flush() } })) defer ts.Close() tr := &Transport{} defer tr.CloseIdleConnections() c := &Client{Transport: tr} req, _ := NewRequest("GET", ts.URL, nil) defer tr.CancelRequest(req) res, err := c.Do(req) if err != nil { t.Fatal(err) } const repeats = 3 buf := make([]byte, len(msg)*repeats) want := bytes.Repeat(msg, repeats) _, err = io.ReadFull(res.Body, buf) if err != nil { t.Fatal(err) } if !bytes.Equal(buf, want) { t.Fatalf("read %q; want %q", buf, want) } didClose := make(chan error, 1) go func() { didClose <- res.Body.Close() }() select { case err := <-didClose: if err != nil { t.Errorf("Close = %v", err) } case <-time.After(10 * time.Second): t.Fatal("too long waiting for close") } select { case err := <-writeErr: if err == nil { t.Errorf("expected non-nil write error") } case <-time.After(10 * time.Second): t.Fatal("too long waiting for write error") } }
explode_data.jsonl/4905
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 535 }
[ 2830, 3393, 27560, 7925, 29637, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 340, 24945, 7747, 1669, 1281, 35190, 1465, 11, 220, 16, 340, 21169, 1669, 3056, 3782, 445, 81179, 1699, 1138, 57441, 1669, 54320, 70334, 7121, 5475, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateUserWithInviteId(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client AdminClient := th.SystemAdminClient t.Run("CreateWithInviteIdHappyPath", func(t *testing.T) { user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID} inviteId := th.BasicTeam.InviteId ruser, resp := Client.CreateUserWithInviteId(&user, inviteId) CheckNoError(t, resp) CheckCreatedStatus(t, resp) Client.Login(user.Email, user.Password) if ruser.Nickname != user.Nickname { t.Fatal("nickname didn't match") } if ruser.Roles != model.SYSTEM_USER_ROLE_ID { t.Log(ruser.Roles) t.Fatal("did not clear roles") } CheckUserSanitization(t, ruser) }) t.Run("WrongInviteId", func(t *testing.T) { user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID} inviteId := model.NewId() _, resp := Client.CreateUserWithInviteId(&user, inviteId) CheckNotFoundStatus(t, resp) CheckErrorMessage(t, resp, "store.sql_team.get_by_invite_id.finding.app_error") }) t.Run("NoInviteId", func(t *testing.T) { user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID} _, resp := Client.CreateUserWithInviteId(&user, "") CheckBadRequestStatus(t, resp) CheckErrorMessage(t, resp, "api.user.create_user.missing_invite_id.app_error") }) t.Run("ExpiredInviteId", func(t *testing.T) { user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID} inviteId := th.BasicTeam.InviteId th.BasicTeam.InviteId = model.NewId() _, resp := AdminClient.UpdateTeam(th.BasicTeam) CheckNoError(t, resp) _, resp = Client.CreateUserWithInviteId(&user, inviteId) CheckNotFoundStatus(t, resp) CheckErrorMessage(t, resp, "store.sql_team.get_by_invite_id.finding.app_error") }) t.Run("EnableUserCreationDisable", func(t *testing.T) { user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID} enableUserCreation := th.App.Config().TeamSettings.EnableUserCreation defer func() { th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = enableUserCreation }) }() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false }) inviteId := th.BasicTeam.InviteId _, resp := Client.CreateUserWithInviteId(&user, inviteId) CheckNotImplementedStatus(t, resp) CheckErrorMessage(t, resp, "api.user.create_user.signup_email_disabled.app_error") }) t.Run("EnableOpenServerDisable", func(t *testing.T) { user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID} enableOpenServer := th.App.Config().TeamSettings.EnableOpenServer defer func() { th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableOpenServer = enableOpenServer }) }() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableOpenServer = false }) inviteId := th.BasicTeam.InviteId ruser, resp := Client.CreateUserWithInviteId(&user, inviteId) CheckNoError(t, resp) CheckCreatedStatus(t, resp) Client.Login(user.Email, user.Password) if ruser.Nickname != user.Nickname { t.Fatal("nickname didn't match") } if ruser.Roles != model.SYSTEM_USER_ROLE_ID { t.Log(ruser.Roles) t.Fatal("did not clear roles") } CheckUserSanitization(t, ruser) }) }
explode_data.jsonl/21518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1541 }
[ 2830, 3393, 4021, 1474, 2354, 93540, 764, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVaultLoadConfig(t *testing.T) { fileName := path.Join("testdata", "config.yaml") v, err := config.NewParserFromFile(fileName) require.NoError(t, err) factories := map[config.Type]configprovider.Factory{ typeStr: NewFactory(), } actualSettings, err := configprovider.Load(context.Background(), v, factories) require.NoError(t, err) devToken := "dev_token" otherToken := "other_token" expectedSettings := map[string]configprovider.ConfigSettings{ "vault": &Config{ Settings: &configprovider.Settings{ TypeVal: "vault", NameVal: "vault", }, Endpoint: "http://localhost:8200", Path: "secret/kv", PollInterval: 1 * time.Minute, Authentication: &Authentication{ Token: &devToken, }, }, "vault/poll_interval": &Config{ Settings: &configprovider.Settings{ TypeVal: "vault", NameVal: "vault/poll_interval", }, Endpoint: "https://localhost:8200", Path: "other/path/kv", PollInterval: 10 * time.Second, Authentication: &Authentication{ Token: &otherToken, }, }, } require.Equal(t, expectedSettings, actualSettings) params := configprovider.CreateParams{ Logger: zap.NewNop(), } _, err = configprovider.Build(context.Background(), actualSettings, params, factories) require.NoError(t, err) }
explode_data.jsonl/74366
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 523 }
[ 2830, 3393, 79177, 5879, 2648, 1155, 353, 8840, 836, 8, 341, 17661, 675, 1669, 1815, 22363, 445, 92425, 497, 330, 1676, 33406, 1138, 5195, 11, 1848, 1669, 2193, 7121, 6570, 43633, 23014, 340, 17957, 35699, 1155, 11, 1848, 692, 1166, 528...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDirect_Input_Output(t *testing.T) { g := NewGomegaWithT(t) xform, _, _ := setup(g) fixtures.ExpectEqual(t, xform.Inputs(), collection.NewSchemasBuilder().MustAdd(basicmeta.K8SCollection1).Build()) fixtures.ExpectEqual(t, xform.Outputs(), collection.NewSchemasBuilder().MustAdd(basicmeta.Collection2).Build()) }
explode_data.jsonl/37553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 16027, 48653, 65062, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 692, 10225, 627, 11, 8358, 716, 1669, 6505, 3268, 692, 1166, 941, 18513, 81893, 2993, 1155, 11, 856, 627, 16130, 82, 1507, 442...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildMessage(t *testing.T) { exporter := Exporter{validConfig} timeseries := []*prompb.TimeSeries{} // buildMessage returns the error that proto.Marshal() returns. Since the proto // package has its own tests, buildMessage should work as expected as long as there // are no errors. _, err := exporter.buildMessage(timeseries) require.NoError(t, err) }
explode_data.jsonl/8041
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 11066, 2052, 1155, 353, 8840, 836, 8, 341, 59440, 261, 1669, 22191, 261, 90, 1891, 2648, 532, 3244, 1733, 4699, 1669, 29838, 24468, 16650, 16299, 25544, 31483, 197, 322, 1936, 2052, 4675, 279, 1465, 429, 18433, 37271, 368, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMessageDao_Add(t *testing.T) { message := model.Message{ AppId: 2, ObjectType: 1, ObjectId: 1, SenderType: 2, SenderId: 2, SenderDeviceId: 2, ReceiverType: 2, ReceiverId: 2, ToUserIds: "2", Type: 1, Content: "", Seq: 2, SendTime: time.Now(), } fmt.Println(MessageDao.Add("message", message)) }
explode_data.jsonl/25904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 2052, 12197, 21346, 1155, 353, 8840, 836, 8, 341, 24753, 1669, 1614, 8472, 515, 197, 59557, 764, 25, 688, 220, 17, 345, 197, 23816, 929, 25, 257, 220, 16, 345, 197, 23816, 764, 25, 981, 220, 16, 345, 197, 7568, 1659, 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 TestEllipsize(t *testing.T) { for _, test := range ellipsizeTests { out, err := elipsize(test.in, test.maxLength) if test.shouldError { if err == nil { t.Errorf("ellipsize(%q, %d) should fail with Error", test.in, test.maxLength) } } else { if err != nil { t.Errorf("ellipsize(%q, %d) should not fail with Error: %s", test.in, test.maxLength, err) } } if out != test.out { t.Errorf("ellipsize(%q, %d) => %q, expected %q", test.in, test.maxLength, out, test.out) } } }
explode_data.jsonl/30723
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 42710, 573, 2141, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 25607, 573, 2141, 18200, 341, 197, 13967, 11, 1848, 1669, 655, 573, 2141, 8623, 1858, 11, 1273, 95717, 340, 197, 743, 1273, 15507, 1454, 341, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStringEncode(t *testing.T) { inp := "Hello, world!" exp := "data:,Hello%2C%20world!" enc := getEncodedContent(inp) if exp != enc { t.Errorf("string encode failed. exp: %s, got: %s", exp, enc) } }
explode_data.jsonl/32572
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 703, 32535, 1155, 353, 8840, 836, 8, 341, 17430, 79, 1669, 330, 9707, 11, 1879, 24734, 48558, 1669, 330, 691, 41239, 9707, 4, 17, 34, 4, 17, 15, 14615, 24734, 197, 954, 1669, 633, 46795, 2762, 59603, 340, 743, 1343, 961,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNil(t *testing.T) { type S struct{ X int } var s *S if !dummys.Call("isEqual", s, nil).Bool() { t.Fail() } type T struct{ Field *S } if dummys.Call("testField", T{}) != nil { t.Fail() } }
explode_data.jsonl/56801
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 19064, 1155, 353, 8840, 836, 8, 341, 13158, 328, 2036, 90, 1599, 526, 456, 2405, 274, 353, 50, 198, 743, 753, 67, 372, 8209, 27017, 445, 97886, 497, 274, 11, 2092, 568, 11233, 368, 341, 197, 3244, 57243, 741, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTailBadLine(t *testing.T) { tmpfile, err := ioutil.TempFile("", "") require.NoError(t, err) defer os.Remove(tmpfile.Name()) tt := NewTail() tt.FromBeginning = true tt.Files = []string{tmpfile.Name()} tt.SetParserFunc(parsers.NewInfluxParser) defer tt.Stop() defer tmpfile.Close() acc := testutil.Accumulator{} require.NoError(t, tt.Start(&acc)) require.NoError(t, acc.GatherError(tt.Gather)) _, err = tmpfile.WriteString("cpu mytag= foo usage_idle= 100\n") require.NoError(t, err) acc.WaitError(1) assert.Contains(t, acc.Errors[0].Error(), "E! Malformed log line") }
explode_data.jsonl/42344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 44795, 17082, 2460, 1155, 353, 8840, 836, 8, 341, 20082, 1192, 11, 1848, 1669, 43144, 65009, 1703, 19814, 14676, 17957, 35699, 1155, 11, 1848, 340, 16867, 2643, 13270, 10368, 1192, 2967, 12367, 3244, 83, 1669, 1532, 44795, 741...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExtensionXz(t *testing.T) { compression := Xz output := compression.Extension() if output != "tar.xz" { t.Fatalf("The extension of a xz archive should be 'tar.xz'") } }
explode_data.jsonl/79231
{ "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, 12049, 55, 89, 1155, 353, 8840, 836, 8, 341, 32810, 4011, 1669, 1599, 89, 198, 21170, 1669, 25111, 59715, 741, 743, 2550, 961, 330, 26737, 1993, 89, 1, 341, 197, 3244, 30762, 445, 785, 8894, 315, 264, 856, 89, 18132, 126...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSliceDelete(t *testing.T) { tests := []struct { name string input1 []int input2 int input3 int want []int }{ { name: "case", input1: []int{1, 2, 3}, input2: 1, input3: 2, want: []int{1, 3}, }, { name: "case", input1: []int{1, 2, 3}, input2: 0, input3: 1, want: []int{2, 3}, }, { name: "empty", input1: []int{}, input2: 0, input3: 1, want: []int{}, }, { name: "nil", input1: []int{}, input2: 0, input3: 1, want: []int{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := NewSlice(tt.input1).Delete(tt.input2, tt.input3).ToSlice() assert.Equal(t, tt.want, got) }) } }
explode_data.jsonl/55750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 406 }
[ 2830, 3393, 33236, 6435, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 22427, 16, 3056, 396, 198, 197, 22427, 17, 526, 198, 197, 22427, 18, 526, 198, 197, 50780, 256, 3056, 396, 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...
1
func TestUpdateUserAuth(t *testing.T) { th := Setup().InitSystemAdmin().InitBasic() defer th.TearDown() Client := th.SystemAdminClient team := th.CreateTeamWithClient(Client) user := th.CreateUser() th.LinkUserToTeam(user, team) store.Must(th.App.Srv.Store.User().VerifyEmail(user.Id)) userAuth := &model.UserAuth{} userAuth.AuthData = user.AuthData userAuth.AuthService = user.AuthService userAuth.Password = user.Password // Regular user can not use endpoint if _, err := th.Client.UpdateUserAuth(user.Id, userAuth); err == nil { t.Fatal("Shouldn't have permissions. Only Admins") } userAuth.AuthData = model.NewString("test@test.com") userAuth.AuthService = model.USER_AUTH_SERVICE_SAML userAuth.Password = "newpassword" ruser, resp := Client.UpdateUserAuth(user.Id, userAuth) CheckNoError(t, resp) // AuthData and AuthService are set, password is set to empty if *ruser.AuthData != *userAuth.AuthData { t.Fatal("Should have set the correct AuthData") } if ruser.AuthService != model.USER_AUTH_SERVICE_SAML { t.Fatal("Should have set the correct AuthService") } if ruser.Password != "" { t.Fatal("Password should be empty") } // When AuthData or AuthService are empty, password must be valid userAuth.AuthData = user.AuthData userAuth.AuthService = "" userAuth.Password = "1" if _, err := th.Client.UpdateUserAuth(user.Id, userAuth); err == nil { t.Fatal("Should have errored - user password not valid") } // Regular user can not use endpoint user2 := th.CreateUser() th.LinkUserToTeam(user2, team) store.Must(th.App.Srv.Store.User().VerifyEmail(user2.Id)) Client.Login(user2.Email, "passwd1") userAuth.AuthData = user.AuthData userAuth.AuthService = user.AuthService userAuth.Password = user.Password if _, err := Client.UpdateUserAuth(user.Id, userAuth); err == nil { t.Fatal("Should have errored") } }
explode_data.jsonl/21531
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 653 }
[ 2830, 3393, 4289, 1474, 5087, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 2320, 7210, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 71724, 1669, 270, 16620, 7210, 2959, 198, 197, 9196, 1669, 270, 7251, 1459...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewAuthenticatedGW2Api(t *testing.T) { var apikey string if apikey = os.Getenv("APIKEY"); len(apikey) < 1 { t.Skip("Cannot test without APIKEY") } var api *GW2Api var err error if api, err = NewAuthenticatedGW2Api(apikey); err != nil { t.Error(err) } if !api.HasPermission(PermAccount) { t.Error("Failed to obtain basic permission") } }
explode_data.jsonl/53582
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 3564, 26712, 62565, 17, 6563, 1155, 353, 8840, 836, 8, 341, 2405, 6330, 792, 914, 198, 743, 6330, 792, 284, 2643, 64883, 445, 7082, 4784, 5038, 2422, 24827, 792, 8, 366, 220, 16, 341, 197, 3244, 57776, 445, 17444, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCCFramework(t *testing.T) { //register 2 channels chainID := "mockchainid" chainID2 := "secondchain" chaincodeSupport, err := initMockPeer(chainID, chainID2) if err != nil { t.Fatalf("%s", err) } defer finitMockPeer(chainID, chainID2) //create a chaincode ccname := "shimTestCC" //starts and registers the CC _, ccSide := startCC(t, chainID, ccname, chaincodeSupport) if ccSide == nil { t.Fatalf("start up failed") } defer ccSide.Quit() //call's init and does some PUT (after doing some negative testing) initializeCC(t, chainID, ccname, ccSide, chaincodeSupport) //chaincode support should not allow dups handler := &Handler{chaincodeID: &pb.ChaincodeID{Name: ccname + ":0"}, SystemCCProvider: chaincodeSupport.SystemCCProvider} if err := chaincodeSupport.HandlerRegistry.Register(handler); err == nil { t.Fatalf("expected re-register to fail") } //call's init and does some PUT (after doing some negative testing) initializeCC(t, chainID2, ccname, ccSide, chaincodeSupport) //call's invoke and do some GET invokeCC(t, chainID, ccname, ccSide, chaincodeSupport) // The following private data invoke is disabled because // this requires private data channel capability ON and hence should be present // in a dedicated test. One such test is present in file - executetransaction_pvtdata_test.go // call's invoke and do some GET/PUT/DEL on private data // invokePrivateDataGetPutDelCC(t, chainID, ccname, ccSide) //call's query state range getQueryStateByRange(t, "", chainID, ccname, ccSide, chaincodeSupport) //call's cc2cc on the same chaincode only call to chainID2 should succeed cc2SameCC(t, chainID, chainID2, ccname, ccSide, chaincodeSupport) //call's cc2cc (variation with syscc calls) cc2cc(t, chainID, chainID2, ccname, ccSide, chaincodeSupport) //call's query result getQueryResult(t, "", chainID, ccname, ccSide, chaincodeSupport) //call's history result getHistory(t, chainID, ccname, ccSide, chaincodeSupport) //just use the previous certGenerator for generating TLS key/pair cr := chaincodeSupport.Runtime.(*ContainerRuntime) getLaunchConfigs(t, cr) ccSide.Quit() }
explode_data.jsonl/74179
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 705 }
[ 2830, 3393, 3706, 14837, 1155, 353, 8840, 836, 8, 341, 197, 322, 6343, 220, 17, 11744, 198, 197, 8819, 915, 1669, 330, 16712, 8819, 307, 698, 197, 8819, 915, 17, 1669, 330, 5569, 8819, 698, 197, 8819, 1851, 7916, 11, 1848, 1669, 293...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEncodeMap(t *testing.T) { if SQLEncodeMap[DontEscape] != DontEscape { t.Errorf("SQLEncodeMap[DontEscape] = %v, want %v", SQLEncodeMap[DontEscape], DontEscape) } if SQLDecodeMap[DontEscape] != DontEscape { t.Errorf("SQLDecodeMap[DontEscape] = %v, want %v", SQLEncodeMap[DontEscape], DontEscape) } }
explode_data.jsonl/30814
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 32535, 2227, 1155, 353, 8840, 836, 8, 341, 743, 51618, 867, 1016, 534, 2227, 64920, 544, 48124, 60, 961, 61484, 48124, 341, 197, 3244, 13080, 445, 64308, 867, 1016, 534, 2227, 64920, 544, 48124, 60, 284, 1018, 85, 11, 1366...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAsyncPostRequest(t *testing.T) { t.Log("Sending POST async request... (expected http code: 200)") req := NewRequest() ch := make(chan *AsyncResponse) for i := 0; i <= 100; i++ { req.AsyncPost("http://httpbin.org/post", ch) } for i := 0; i <= 100; i++ { aRes := <-ch if aRes.Err != nil { t.Error(aRes.Err) } if aRes.Resp.GetStatusCode() != 200 { t.Error( "For", "POST http://httpbin.org/post", "expected", 200, "got", aRes.Resp.GetStatusCode(), ) } } }
explode_data.jsonl/74146
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 6525, 4133, 1900, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 445, 49282, 12869, 3312, 1681, 1112, 320, 7325, 1758, 2038, 25, 220, 17, 15, 15, 95377, 24395, 1669, 1532, 1900, 741, 23049, 1669, 1281, 35190, 353, 6525, 2582, 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...
5
func TestCDPSessionOn(t *testing.T) { BeforeEach(t) defer AfterEach(t) cdpSession, err := page.Context().NewCDPSession(page) if isChromium { require.NoError(t, err) _, err = cdpSession.Send("Console.enable", nil) require.NoError(t, err) cdpSession.On("Console.messageAdded", func(params map[string]interface{}) { require.NotNil(t, params) }) _, err = page.Evaluate(`console.log("hello")`) require.NoError(t, err) require.NoError(t, cdpSession.Detach()) } else { require.Error(t, err) } }
explode_data.jsonl/76232
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 6484, 5012, 1338, 1925, 1155, 353, 8840, 836, 8, 341, 197, 87275, 1155, 340, 16867, 4636, 4854, 1155, 340, 1444, 9796, 5283, 11, 1848, 1669, 2150, 9328, 1005, 3564, 6484, 5012, 1338, 12024, 340, 743, 374, 1143, 77859, 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_snippetCreate(t *testing.T) { t.Parallel() repo := copyTestRepo(t) cmd := exec.Command(labBinaryPath, "snippet", "create", "-p", "lab-testing", "-m", "snippet title", "-m", "snippet description") cmd.Dir = repo rc, err := cmd.StdinPipe() if err != nil { t.Fatal(err) } _, err = rc.Write([]byte("snippet contents")) if err != nil { t.Fatal(err) } err = rc.Close() if err != nil { t.Fatal(err) } b, err := cmd.CombinedOutput() if err != nil { t.Log(string(b)) t.Fatal(err) } require.Contains(t, string(b), "https://gitlab.com/lab-testing/test/snippets/") }
explode_data.jsonl/35609
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 270 }
[ 2830, 3393, 28022, 21581, 4021, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 17200, 5368, 1669, 2975, 2271, 25243, 1155, 340, 25920, 1669, 3883, 12714, 2333, 370, 21338, 1820, 11, 330, 57615, 497, 330, 3182, 497, 6523, 79, 497,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestShape(t *testing.T) { var ts *Tensor vv22 := []interface{}{[]int{1, 2, 3, 3}, []float64{4.0, 5.5, 6, 9}, []string{"a", "b", "c", "c"}} ts = NewTensor(vv22) _d, _l := ts.Shape() t.Logf("%d, %v", _d, _l) vv01 := 0 ts = NewTensor(vv01) _d, _l = ts.Shape() t.Logf("%d, %v", _d, _l) vv11 := []int{2, 4, 0, 4, 5, 8} ts = NewTensor(vv11) _d, _l = ts.Shape() t.Logf("%d, %v", _d, _l) }
explode_data.jsonl/20817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 12301, 1155, 353, 8840, 836, 8, 341, 2405, 10591, 353, 25336, 198, 5195, 85, 17, 17, 1669, 3056, 4970, 6257, 90, 1294, 396, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 18, 2137, 3056, 3649, 21, 19, 90, 19, 13, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStateTxBehavior(t *testing.T) { stateTestWrapper, state := createFreshDBAndConstructState(t) if state.txInProgress() { t.Fatalf("No tx should be reported to be in progress") } // set state in a successful tx state.TxBegin("txUuid") state.Set("chaincode1", "key1", []byte("value1")) state.Set("chaincode2", "key2", []byte("value2")) testutil.AssertEquals(t, stateTestWrapper.get("chaincode1", "key1", false), []byte("value1")) state.TxFinish("txUuid", true) testutil.AssertEquals(t, stateTestWrapper.get("chaincode1", "key1", false), []byte("value1")) // set state in a failed tx state.TxBegin("txUuid1") state.Set("chaincode1", "key1", []byte("value1_new")) state.Set("chaincode2", "key2", []byte("value2_new")) testutil.AssertEquals(t, stateTestWrapper.get("chaincode1", "key1", false), []byte("value1_new")) state.TxFinish("txUuid1", false) //older state should be available testutil.AssertEquals(t, stateTestWrapper.get("chaincode1", "key1", false), []byte("value1")) // delete state in a successful tx state.TxBegin("txUuid2") state.Delete("chaincode1", "key1") testutil.AssertNil(t, stateTestWrapper.get("chaincode1", "key1", false)) state.TxFinish("txUuid2", true) testutil.AssertNil(t, stateTestWrapper.get("chaincode1", "key1", false)) // // delete state in a failed tx state.TxBegin("txUuid2") state.Delete("chaincode2", "key2") testutil.AssertNil(t, stateTestWrapper.get("chaincode2", "key2", false)) state.TxFinish("txUuid2", false) testutil.AssertEquals(t, stateTestWrapper.get("chaincode2", "key2", false), []byte("value2")) }
explode_data.jsonl/69015
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 588 }
[ 2830, 3393, 1397, 31584, 22753, 1155, 353, 8840, 836, 8, 341, 24291, 2271, 11542, 11, 1584, 1669, 1855, 55653, 3506, 3036, 28468, 1397, 1155, 340, 743, 1584, 33807, 88711, 368, 341, 197, 3244, 30762, 445, 2753, 9854, 1265, 387, 4961, 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...
2
func TestArraySplit(t *testing.T) { ctx := context.Background() writer := &testWriter{} config := statsd.Config{ Writer: writer, MaxPacketSize: 1024, } adapter := newWithTagsAdapter() exp, err := statsd.NewExporter(config, adapter) if err != nil { t.Fatal("New error: ", err) } checkpointSet := test.NewCheckpointSet(testResource) desc := metric.NewDescriptor("measure", metric.ValueRecorderKind, metric.Int64NumberKind) for i := 0; i < 1024; i++ { checkpointSet.AddValueRecorder(&desc, 100) } err = exp.Export(ctx, checkpointSet) require.Nil(t, err) require.Greater(t, len(writer.vec), 1) for _, result := range writer.vec { require.LessOrEqual(t, len(result), config.MaxPacketSize) } }
explode_data.jsonl/57804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 1857, 20193, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 38959, 1669, 609, 1944, 6492, 16094, 25873, 1669, 10472, 67, 10753, 515, 197, 197, 6492, 25, 286, 6916, 345, 197, 197, 5974, 16679, 1695, 25, 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...
4
func TestIncident_List(t *testing.T) { setup() defer teardown() mux.HandleFunc("/incidents", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") _, _ = w.Write([]byte(`{"incidents": [{"id": "1"}]}`)) }) listObj := APIListObject{Limit: 0, Offset: 0, More: false, Total: 0} var opts ListIncidentsOptions client := defaultTestClient(server.URL, "foo") res, err := client.ListIncidents(opts) want := &ListIncidentsResponse{ APIListObject: listObj, Incidents: []Incident{ { Id: "1", }, }, } if err != nil { t.Fatal(err) } testEqual(t, want, res) }
explode_data.jsonl/76385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 39245, 1713, 27104, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 2840, 6880, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 18185, 3523, 1155, 11, 435, 11, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_createGraph(t *testing.T) { type args struct { m *Map } tests := []struct { name string args args want [][]int want1 []byte want2 []int }{ { name: "createGraph - print map 1", args: args{ m: makeMockMap(Map1), }, want: nil, want1: nil, want2: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { m := tt.args.m start := time.Now() G, T, O := createGraph(m) //printGraph(G) n := m.Width * m.Height P := createMatrix(n) floyd(G, P) fmt.Printf("%v\n", time.Since(start)) printMap(m, T, O, m.Width, m.Height) printPath(G, P, 0, 0) printPath(G, P, 360, 360) printPath(G, P, 0, 360) printPath(G, P, 60, 86) printPath(G, P, 0, 4) printPath(G, P, 0, 385) printPath(G, P, 14, 246) printPath(G, P, 250, 150) // if !reflect.DeepEqual(G, tt.want) { // t.Errorf("createGraph() G = %v, want %v", G, tt.want) // } // if !reflect.DeepEqual(T, tt.want1) { // t.Errorf("createGraph() T = %v, want %v", T, tt.want1) // } // if !reflect.DeepEqual(O, tt.want2) { // t.Errorf("createGraph() O = %v, want %v", O, tt.want2) // } }) } }
explode_data.jsonl/5452
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 615 }
[ 2830, 3393, 8657, 11212, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 2109, 353, 2227, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 31215, 220, 2827, 198, 197, 50780, 220, 52931, 396, 198,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTokenDeleteCommand_noTabs(t *testing.T) { t.Parallel() if strings.ContainsRune(New(cli.NewMockUi()).Help(), '\t') { t.Fatal("help has tabs") } }
explode_data.jsonl/21999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 3323, 6435, 4062, 6536, 36985, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 743, 9069, 11545, 49, 2886, 35063, 70249, 7121, 11571, 23710, 6011, 12689, 1507, 5196, 83, 863, 341, 197, 3244, 26133, 445, 8653, 702, 223...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidIP4ToReturnFalseOnInvalidAddress(t *testing.T) { result := ipparser.ValidIP4("abcd") if result == true { t.Fatalf("Expected ValidIP(abcd) to be false but got true") } }
explode_data.jsonl/70072
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 4088, 3298, 19, 1249, 5598, 4049, 1925, 7928, 4286, 1155, 353, 8840, 836, 8, 341, 9559, 1669, 5997, 9657, 47156, 3298, 19, 445, 68644, 5130, 743, 1102, 621, 830, 341, 197, 3244, 30762, 445, 18896, 7818, 3298, 56085, 4385, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPossibleOverflow(t *testing.T) { delShares := sdk.NewDec(391432570689183511).Quo(sdk.NewDec(40113011844664)) validator := mkValidator(2159, delShares) newValidator, _ := validator.AddTokensFromDel(sdk.NewInt(71)) require.False(t, newValidator.DelegatorShares.IsNegative()) require.False(t, newValidator.Tokens.IsNegative()) }
explode_data.jsonl/2334
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 65222, 42124, 1155, 353, 8840, 836, 8, 341, 69509, 73015, 1669, 45402, 7121, 4900, 7, 18, 24, 16, 19, 18, 17, 20, 22, 15, 21, 23, 24, 16, 23, 18, 20, 16, 16, 568, 2183, 78, 1141, 7584, 7121, 4900, 7, 19, 15, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUsageCannotMarshalToString(t *testing.T) { var args struct { Name *MyEnum } v := MyEnum(42) args.Name = &v _, err := NewParser(Config{Program: "example"}, &args) assert.EqualError(t, err, `args.Name: error marshaling default value to string: There was a problem`) }
explode_data.jsonl/20490
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 14783, 17444, 55438, 5870, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 21297, 353, 5050, 10766, 198, 197, 532, 5195, 1669, 3017, 10766, 7, 19, 17, 340, 31215, 2967, 284, 609, 85, 198, 197, 6878, 1848, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestProperExecution(t *testing.T) { input := CreateTestInput(t) var newContractAddress sdk.AccAddress t.Run("deploy a contract with regular code", func(t *testing.T) { code, err := hex.DecodeString(BasicTestsBytecodeString) require.Nil(t, err) result, err2 := input.CvmKeeper.Call(input.Ctx, Addrs[0], nil, 0, code, []*payload.ContractMeta{}, false, false, false) require.Nil(t, err2) require.NotNil(t, result) newContractAddress = sdk.AccAddress(result) }) fmt.Println("") t.Run("deploy second contract", func(t *testing.T) { code, err2 := hex.DecodeString(Hello55BytecodeString) require.Nil(t, err2) acc := input.AccountKeeper.GetAccount(input.Ctx, Addrs[0]) _ = acc.SetSequence(acc.GetSequence() + 1) input.AccountKeeper.SetAccount(input.Ctx, acc) result, err := input.CvmKeeper.Call(input.Ctx, Addrs[0], nil, 0, code, []*payload.ContractMeta{}, false, false, false) require.Nil(t, err) require.NotNil(t, result) }) t.Run("call a function that takes parameters and ensure it works properly", func(t *testing.T) { addSevenAndEightCall, _, err := abi.EncodeFunctionCall( BasicTestsAbiJsonString, "addTwoNumbers", WrapLogger(input.Ctx.Logger()), 7, 8, ) require.Nil(t, err) result, err2 := input.CvmKeeper.Call(input.Ctx, Addrs[0], newContractAddress, 0, addSevenAndEightCall, []*payload.ContractMeta{}, false, false, false) require.Nil(t, err2) require.Equal(t, new(big.Int).SetBytes(result).Int64(), int64(15)) }) t.Run("call a function that should revert and ensure that it reverts", func(t *testing.T) { failureFunctionCall, _, err := abi.EncodeFunctionCall( BasicTestsAbiJsonString, "failureFunction", WrapLogger(input.Ctx.Logger()), ) require.Nil(t, err) _, err2 := input.CvmKeeper.Call(input.Ctx, Addrs[0], newContractAddress, 0, failureFunctionCall, []*payload.ContractMeta{}, false, false, false) require.NotNil(t, err2) require.Equal(t, types.ErrCodedError(errors.Codes.ExecutionReverted), err2) }) t.Run("call a contract with junk callcode and ensure it reverts", func(t *testing.T) { _, err := input.CvmKeeper.Call(input.Ctx, Addrs[0], newContractAddress, 0, []byte("Kanye West"), []*payload.ContractMeta{}, false, false, false) require.NotNil(t, err) require.Equal(t, types.ErrCodedError(errors.Codes.ExecutionReverted), err) }) t.Run("write to state and ensure it is reflected in updated state", func(t *testing.T) { setMyFavoriteNumberCall, _, err2 := abi.EncodeFunctionCall( BasicTestsAbiJsonString, "setMyFavoriteNumber", WrapLogger(input.Ctx.Logger()), 777, ) require.Nil(t, err2) result, err := input.CvmKeeper.Call(input.Ctx, Addrs[0], newContractAddress, 0, setMyFavoriteNumberCall, []*payload.ContractMeta{}, false, false, false) require.Nil(t, err) result, err2 = input.CvmKeeper.GetStorage(input.Ctx, crypto.MustAddressFromBytes(newContractAddress), binary.Int64ToWord256(0)) require.Equal(t, new(big.Int).SetBytes(result).Int64(), int64(777)) }) }
explode_data.jsonl/14830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1183 }
[ 2830, 3393, 1336, 712, 20294, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 4230, 2271, 2505, 1155, 692, 2405, 501, 14067, 4286, 45402, 77538, 4286, 198, 3244, 16708, 445, 35794, 264, 5116, 448, 5792, 2038, 497, 2915, 1155, 353, 8840, 836,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSourceRowGenerator(t *testing.T) { // we do this test lots to ensure source row generation is determinstic for i := 0; i < 100; i++ { if err := testSourceRowGenerator(); err != nil { t.Errorf("error on test iteration: %d: %s", i, err.Error()) return } } }
explode_data.jsonl/35136
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 3608, 3102, 12561, 1155, 353, 8840, 836, 8, 341, 197, 322, 582, 653, 419, 1273, 10077, 311, 5978, 2530, 2802, 9471, 374, 6315, 267, 292, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 15, 26, 600, 1027, 341,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNodes_ToHexStrings(t *testing.T) { nodes := byteArrSliceToNodes(hashStringSlice(sha256.New(), "a", "b", "c")...) expHex := []string{ "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb", "3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d", "2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6", } actHex := nodes.ToHexStrings() for i, exp := range expHex { if actHex[i] != exp { t.Errorf("expected hex at %d to be %s, got %s", i, exp, actHex) } } }
explode_data.jsonl/57991
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 12288, 38346, 20335, 20859, 1155, 353, 8840, 836, 8, 341, 79756, 1669, 4922, 8838, 33236, 1249, 12288, 27580, 703, 33236, 7, 15247, 17, 20, 21, 7121, 1507, 330, 64, 497, 330, 65, 497, 330, 66, 899, 31218, 48558, 20335, 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...
3
func TestRunSimpleJS(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() res, err := ctx.Eval(` var a = 10; var b = 20; var c = a+b; c; `, "test.js") if err != nil { t.Fatalf("Error evaluating javascript, err: %v", err) } if num := res.Int64(); num != 30 { t.Errorf("Expected 30, got %v", res) } }
explode_data.jsonl/81537
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 6727, 16374, 12545, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 741, 10202, 11, 1848, 1669, 5635, 5142, 831, 61528, 197, 2405, 264, 284, 220, 16, 15, 280, 197, 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...
3
func TestUpdateTaskRunStateWithConditionChecks(t *testing.T) { // TestUpdateTaskRunsState runs "getTaskRunsStatus" and verifies how it updates a PipelineRun status // from several different TaskRun with Conditions associated to the PipelineRun taskrunName := "task-run" successConditionCheckName := "success-condition" failingConditionCheckName := "fail-condition" successCondition := &v1alpha1.Condition{ ObjectMeta: metav1.ObjectMeta{ Name: "cond-1", Namespace: "foo", }, } failingCondition := &v1alpha1.Condition{ ObjectMeta: metav1.ObjectMeta{ Name: "cond-2", Namespace: "foo", }, } pipelineTask := v1beta1.PipelineTask{ TaskRef: &v1beta1.TaskRef{Name: "unit-test-task"}, Conditions: []v1beta1.PipelineTaskCondition{{ ConditionRef: successCondition.Name, }, { ConditionRef: failingCondition.Name, }}, } successConditionCheck := conditionCheckFromTaskRun(&v1beta1.TaskRun{ ObjectMeta: baseObjectMeta(successConditionCheckName, "foo"), Status: v1beta1.TaskRunStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, }, }, }, TaskRunStatusFields: v1beta1.TaskRunStatusFields{ Steps: []v1beta1.StepState{{ ContainerState: corev1.ContainerState{ Terminated: &corev1.ContainerStateTerminated{ExitCode: int32(0)}, }, }}, }, }, }) failingConditionCheck := conditionCheckFromTaskRun(&v1beta1.TaskRun{ ObjectMeta: baseObjectMeta(failingConditionCheckName, "foo"), Status: v1beta1.TaskRunStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse, }, }, }, TaskRunStatusFields: v1beta1.TaskRunStatusFields{ Steps: []v1beta1.StepState{{ ContainerState: corev1.ContainerState{ Terminated: &corev1.ContainerStateTerminated{ExitCode: int32(127)}, }, }}, }, }, }) successrcc := resources.ResolvedConditionCheck{ ConditionRegisterName: successCondition.Name + "-0", ConditionCheckName: successConditionCheckName, Condition: successCondition, ConditionCheck: successConditionCheck, } failingrcc := resources.ResolvedConditionCheck{ ConditionRegisterName: failingCondition.Name + "-0", ConditionCheckName: failingConditionCheckName, Condition: failingCondition, ConditionCheck: failingConditionCheck, } successConditionCheckStatus := &v1beta1.PipelineRunConditionCheckStatus{ ConditionName: successrcc.ConditionRegisterName, Status: &v1beta1.ConditionCheckStatus{ ConditionCheckStatusFields: v1beta1.ConditionCheckStatusFields{ Check: corev1.ContainerState{ Terminated: &corev1.ContainerStateTerminated{ExitCode: 0}, }, }, Status: duckv1beta1.Status{ Conditions: []apis.Condition{{Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue}}, }, }, } failingConditionCheckStatus := &v1beta1.PipelineRunConditionCheckStatus{ ConditionName: failingrcc.ConditionRegisterName, Status: &v1beta1.ConditionCheckStatus{ ConditionCheckStatusFields: v1beta1.ConditionCheckStatusFields{ Check: corev1.ContainerState{ Terminated: &corev1.ContainerStateTerminated{ExitCode: 127}, }, }, Status: duckv1beta1.Status{ Conditions: []apis.Condition{{Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse}}, }, }, } failedTaskRunStatus := v1beta1.TaskRunStatus{ Status: duckv1beta1.Status{ Conditions: []apis.Condition{{ Type: apis.ConditionSucceeded, Status: corev1.ConditionFalse, Reason: resources.ReasonConditionCheckFailed, Message: fmt.Sprintf("ConditionChecks failed for Task %s in PipelineRun %s", taskrunName, "test-pipeline-run"), }}, }, } tcs := []struct { name string rcc resources.TaskConditionCheckState expectedStatus v1beta1.PipelineRunTaskRunStatus }{{ name: "success-condition-checks", rcc: resources.TaskConditionCheckState{&successrcc}, expectedStatus: v1beta1.PipelineRunTaskRunStatus{ ConditionChecks: map[string]*v1beta1.PipelineRunConditionCheckStatus{ successrcc.ConditionCheck.Name: successConditionCheckStatus, }, }, }, { name: "failing-condition-checks", rcc: resources.TaskConditionCheckState{&failingrcc}, expectedStatus: v1beta1.PipelineRunTaskRunStatus{ Status: &failedTaskRunStatus, ConditionChecks: map[string]*v1beta1.PipelineRunConditionCheckStatus{ failingrcc.ConditionCheck.Name: failingConditionCheckStatus, }, }, }, { name: "multiple-condition-checks", rcc: resources.TaskConditionCheckState{&successrcc, &failingrcc}, expectedStatus: v1beta1.PipelineRunTaskRunStatus{ Status: &failedTaskRunStatus, ConditionChecks: map[string]*v1beta1.PipelineRunConditionCheckStatus{ successrcc.ConditionCheck.Name: successConditionCheckStatus, failingrcc.ConditionCheck.Name: failingConditionCheckStatus, }, }, }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { pr := &v1beta1.PipelineRun{ ObjectMeta: baseObjectMeta("test-pipeline-run", "foo"), Spec: v1beta1.PipelineRunSpec{ PipelineRef: &v1beta1.PipelineRef{Name: "test-pipeline"}, }, } state := resources.PipelineRunState{{ PipelineTask: &pipelineTask, TaskRunName: taskrunName, ResolvedConditionChecks: tc.rcc, }} pr.Status.InitializeConditions() status := state.GetTaskRunsStatus(pr) expected := map[string]*v1beta1.PipelineRunTaskRunStatus{ taskrunName: &tc.expectedStatus, } if d := cmp.Diff(status, expected, ignoreLastTransitionTime); d != "" { t.Fatalf("Did not get expected status for %s %s", tc.name, diff.PrintWantGot(d)) } }) } }
explode_data.jsonl/68255
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2307 }
[ 2830, 3393, 4289, 6262, 6727, 1397, 2354, 10547, 49820, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 4289, 6262, 73920, 1397, 8473, 330, 455, 6262, 73920, 2522, 1, 323, 87856, 1246, 432, 8837, 264, 40907, 6727, 2639, 198, 197, 322, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidRerunAuthConfig(t *testing.T) { var testCases = []struct { name string prowConfig string expectError bool }{ { name: "valid rerun auth config", prowConfig: ` deck: rerun_auth_config: allow_anyone: false github_users: - someperson - someotherperson `, expectError: false, }, { name: "allow anyone and whitelist specified", prowConfig: ` deck: rerun_auth_config: allow_anyone: true github_users: - someperson - anotherperson `, expectError: true, }, { name: "empty config", prowConfig: ` deck: rerun_auth_config: `, expectError: false, }, { name: "allow anyone with empty whitelist", prowConfig: ` deck: rerun_auth_config: allow_anyone: true github_users: `, expectError: false, }, } for _, tc := range testCases { // save the config prowConfigDir, err := ioutil.TempDir("", "prowConfig") if err != nil { t.Fatalf("fail to make tempdir: %v", err) } defer os.RemoveAll(prowConfigDir) prowConfig := filepath.Join(prowConfigDir, "config.yaml") if err := ioutil.WriteFile(prowConfig, []byte(tc.prowConfig), 0666); err != nil { t.Fatalf("fail to write prow config: %v", err) } _, err = Load(prowConfig, "") if tc.expectError && err == nil { t.Errorf("tc %s: Expect error, but got nil", tc.name) } else if !tc.expectError && err != nil { t.Errorf("tc %s: Expect no error, but got error %v", tc.name, err) } } }
explode_data.jsonl/8083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 634 }
[ 2830, 3393, 4088, 49, 261, 359, 5087, 2648, 1155, 353, 8840, 836, 8, 341, 2405, 1273, 37302, 284, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 3223, 651, 2648, 220, 914, 198, 197, 24952, 1454, 1807, 198, 197, 59403, 197, 197, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConsume(t *testing.T) { t.Run("don't fetch new messages when all workers are busy", func(t *testing.T) { q, _ := memq.NewQueue("default") data := []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} q.Publish(data...) c, err := q.Consumer(&queue.ConsumerOption{ MaxNumWorker: 1, PrefetchCount: 1, Handler: queue.H(func(m queue.Message) { time.Sleep(400 * time.Millisecond) m.Ack() }), }) assert.Nil(t, err) c.Start(context.Background()) time.Sleep(300 * time.Millisecond) assert.Equal(t, len(data)-1, q.Size()) }) }
explode_data.jsonl/62408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 249 }
[ 2830, 3393, 1109, 31323, 1155, 353, 8840, 836, 8, 1476, 3244, 16708, 445, 15007, 944, 7807, 501, 6605, 979, 678, 7337, 525, 13028, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 18534, 11, 716, 1669, 1833, 80, 7121, 7554, 445, 2258, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestForPhraseUDT2(t *testing.T) { gopClTest(t, ` type fooIter struct { } func (p fooIter) Next() (key string, val int, ok bool) { return } type foo struct { } func (p *foo) Gop_Enum() fooIter { } for k, v <- new(foo) { println(k, v) } `, `package main import fmt "fmt" type fooIter struct { } func (p fooIter) Next() (key string, val int, ok bool) { return } type foo struct { } func (p *foo) Gop_Enum() fooIter { } func main() { for _gop_it := new(foo).Gop_Enum(); ; { var _gop_ok bool k, v, _gop_ok := _gop_it.Next() if !_gop_ok { break } fmt.Println(k, v) } } `) }
explode_data.jsonl/73642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 2461, 46806, 4656, 51, 17, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 1313, 15229, 8537, 2036, 341, 630, 2830, 320, 79, 15229, 8537, 8, 9295, 368, 320, 792, 914, 11, 1044, 526, 11, 5394, 1807, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnmapDatabaseId(t *testing.T) { e := Engine{prefix: []byte("e-prefix.")} id, err := e.unmapDatabaseID(nil) require.ErrorIs(t, err, ErrIllegalMappedKey) require.Zero(t, id) id, err = e.unmapDatabaseID([]byte{}) require.ErrorIs(t, err, ErrIllegalMappedKey) require.Zero(t, id) id, err = e.unmapDatabaseID([]byte("pref")) require.ErrorIs(t, err, ErrIllegalMappedKey) require.Zero(t, id) id, err = e.unmapDatabaseID([]byte("e-prefix.a")) require.ErrorIs(t, err, ErrIllegalMappedKey) require.Zero(t, id) id, err = e.unmapDatabaseID([]byte( "e-prefix.CTL.DATABASE.a", )) require.ErrorIs(t, err, ErrCorruptedData) require.Zero(t, id) id, err = e.unmapDatabaseID(append( []byte("e-prefix.CTL.DATABASE."), 1, 2, 3, 4, )) require.NoError(t, err) require.EqualValues(t, 0x01020304, id) }
explode_data.jsonl/64092
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 357 }
[ 2830, 3393, 1806, 2186, 5988, 764, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 8200, 90, 11849, 25, 3056, 3782, 445, 68, 67181, 38739, 630, 15710, 11, 1848, 1669, 384, 6307, 2186, 5988, 915, 27907, 340, 17957, 6141, 3872, 1155, 11, 1848...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Monitor_Html(t *testing.T) { t.Parallel() app := fiber.New() app.Get("/", New()) resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", nil)) utils.AssertEqual(t, nil, err) utils.AssertEqual(t, 200, resp.StatusCode) utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8, resp.Header.Get(fiber.HeaderContentType)) b, err := ioutil.ReadAll(resp.Body) utils.AssertEqual(t, nil, err) utils.AssertEqual(t, true, bytes.Contains(b, []byte("<title>Fiber Monitor</title>"))) }
explode_data.jsonl/23611
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 1245, 30314, 2039, 3864, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 1669, 23788, 7121, 2822, 28236, 2234, 35460, 1532, 12367, 34653, 11, 1848, 1669, 906, 8787, 73392, 83, 70334, 75274, 955, 8629, 20798, 1949...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNodesUpdate(t *testing.T) { clients.RequireLong(t) client, err := clients.NewBareMetalV1NoAuthClient() th.AssertNoErr(t, err) client.Microversion = "1.50" node, err := v1.CreateNode(t, client) th.AssertNoErr(t, err) defer v1.DeleteNode(t, client, node) updated, err := nodes.Update(client, node.UUID, nodes.UpdateOpts{ nodes.UpdateOperation{ Op: nodes.ReplaceOp, Path: "/maintenance", Value: "true", }, }).Extract() th.AssertNoErr(t, err) th.AssertEquals(t, updated.Maintenance, true) }
explode_data.jsonl/55611
{ "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, 12288, 4289, 1155, 353, 8840, 836, 8, 341, 197, 31869, 81288, 6583, 1155, 692, 25291, 11, 1848, 1669, 8239, 7121, 33, 546, 65661, 53, 16, 2753, 5087, 2959, 741, 70479, 11711, 2753, 7747, 1155, 11, 1848, 340, 25291, 1321, 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 TestReaderSuccessReturnsJsonContent(t *testing.T) { m := metrics.MetricOptions{} c := &testServiceApiClient{ serviceListServices: []swarm.Service{}, serviceListError: nil, } handler := handlers.MakeFunctionReader(m, c) w := httptest.NewRecorder() r := &http.Request{} handler.ServeHTTP(w, r) expected := "application/json" if contentType := w.Header().Get("Content-Type"); contentType != expected { t.Errorf("content type header does not match: got %v want %v", contentType, expected) } }
explode_data.jsonl/63778
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 181 }
[ 2830, 3393, 5062, 7188, 16446, 5014, 2762, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 16734, 1321, 16340, 3798, 16094, 1444, 1669, 609, 1944, 1860, 56584, 515, 197, 52934, 852, 11025, 25, 3056, 2280, 2178, 13860, 38837, 197, 52934, 852, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCastAsTime(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 t;`) tk.MustExec(`create table t (col1 bigint, col2 double, col3 decimal, col4 varchar(20), col5 json);`) tk.MustExec(`insert into t values (1, 1, 1, "1", "1");`) tk.MustExec(`insert into t values (null, null, null, null, null);`) tk.MustQuery(`select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 = 1;`).Check(testkit.Rows( `00:00:01 00:00:01 00:00:01 00:00:01 00:00:01`, )) tk.MustQuery(`select cast(col1 as time), cast(col2 as time), cast(col3 as time), cast(col4 as time), cast(col5 as time) from t where col1 is null;`).Check(testkit.Rows( `<nil> <nil> <nil> <nil> <nil>`, )) err := tk.ExecToErr(`select cast(col1 as time(31)) from t where col1 is null;`) require.Error(t, err, "[expression:1426]Too big precision 31 specified for column 'CAST'. Maximum is 6.") err = tk.ExecToErr(`select cast(col2 as time(31)) from t where col1 is null;`) require.Error(t, err, "[expression:1426]Too big precision 31 specified for column 'CAST'. Maximum is 6.") err = tk.ExecToErr(`select cast(col3 as time(31)) from t where col1 is null;`) require.Error(t, err, "[expression:1426]Too big precision 31 specified for column 'CAST'. Maximum is 6.") err = tk.ExecToErr(`select cast(col4 as time(31)) from t where col1 is null;`) require.Error(t, err, "[expression:1426]Too big precision 31 specified for column 'CAST'. Maximum is 6.") err = tk.ExecToErr(`select cast(col5 as time(31)) from t where col1 is null;`) require.Error(t, err, "[expression:1426]Too big precision 31 specified for column 'CAST'. Maximum is 6.") }
explode_data.jsonl/65474
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 667 }
[ 2830, 3393, 18714, 2121, 1462, 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, 50463, 10216, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSortInstances(t *testing.T) { instances := []*ec2.Instance{ { LaunchTime: aws.Time(time.Now()), }, { LaunchTime: nil, }, { LaunchTime: nil, }, { LaunchTime: aws.Time(time.Now()), }, } sortInstances(instances) }
explode_data.jsonl/18757
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 10231, 42725, 1155, 353, 8840, 836, 8, 341, 197, 47825, 1669, 29838, 757, 17, 12688, 515, 197, 197, 515, 298, 197, 32067, 1462, 25, 31521, 16299, 9730, 13244, 14702, 197, 197, 1583, 197, 197, 515, 298, 197, 32067, 1462, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBlobberGRPCService_GetFileMetaData_Success(t *testing.T) { req := &blobbergrpc.GetFileMetaDataRequest{ Context: &blobbergrpc.RequestContext{ Client: "client", ClientKey: "", Allocation: "", }, Path: "path", PathHash: "path_hash", AuthToken: "testval", Allocation: "something", } mockStorageHandler := &storageHandlerI{} mockReferencePackage := &mocks.PackageHandler{} mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ ID: "allocationId", Tx: req.Allocation, }, nil) mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ Name: "test", Type: reference.FILE, }, nil) mockReferencePackage.On("GetCommitMetaTxns", mock.Anything, mock.Anything).Return(nil, nil) mockReferencePackage.On("GetCollaborators", mock.Anything, mock.Anything).Return([]reference.Collaborator{ reference.Collaborator{ RefID: 1, ClientID: "test", }, }, nil) mockReferencePackage.On("IsACollaborator", mock.Anything, mock.Anything, mock.Anything).Return(true) mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) resp, err := svc.GetFileMetaData(context.Background(), req) if err != nil { t.Fatal("unexpected error") } assert.Equal(t, resp.MetaData.FileMetaData.Name, "test") }
explode_data.jsonl/66826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 545 }
[ 2830, 3393, 37985, 652, 8626, 4872, 1860, 13614, 1703, 37307, 87161, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 609, 35112, 652, 56585, 2234, 1703, 37307, 1900, 515, 197, 70871, 25, 609, 35112, 652, 56585, 9659, 1972, 515, 298, 71724, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2