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 TestSSHComand(t *testing.T) { parent := &Command{ Command: &cobra.Command{ Use: "compute", Short: "compute commands", Long: "compute commands are for controlling and managing infrastructure", }, } cmd := SSH(parent) assert.NotNil(t, cmd) assertCommandNames(t, cmd) }
explode_data.jsonl/6474
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 62419, 1092, 437, 1155, 353, 8840, 836, 8, 341, 24804, 1669, 609, 4062, 515, 197, 97493, 25, 609, 59410, 12714, 515, 298, 95023, 25, 256, 330, 27706, 756, 298, 197, 12472, 25, 330, 27706, 11293, 756, 298, 63726, 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
func TestUserDao_GetByIds(t *testing.T) { users, err := UserDao.GetByIds([]int64{1, 2, 3}) fmt.Printf("%+v\n %+v\n ", users, err) }
explode_data.jsonl/8544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 66 }
[ 2830, 3393, 1474, 12197, 13614, 2720, 82, 1155, 353, 8840, 836, 8, 341, 90896, 11, 1848, 1669, 97104, 82174, 82, 10556, 396, 21, 19, 90, 16, 11, 220, 17, 11, 220, 18, 3518, 11009, 19367, 4430, 10, 85, 1699, 68524, 85, 1699, 3670, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLogsExporter_WithShutdown_ReturnError(t *testing.T) { want := errors.New("my_error") shutdownErr := func(context.Context) error { return want } le, err := NewLogsExporter(&fakeLogsExporterConfig, componenttest.NewNopExporterCreateSettings(), newPushLogsData(nil), WithShutdown(shutdownErr)) assert.NotNil(t, le) assert.NoError(t, err) assert.Equal(t, le.Shutdown(context.Background()), want) }
explode_data.jsonl/59613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 51053, 88025, 62, 2354, 62004, 53316, 1454, 1155, 353, 8840, 836, 8, 341, 50780, 1669, 5975, 7121, 445, 2408, 4096, 1138, 36196, 18452, 7747, 1669, 2915, 5378, 9328, 8, 1465, 314, 470, 1366, 555, 197, 273, 11, 1848, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInstantiateInlineWorkflowTemplate(t *testing.T) { tc := testutil.SystemTest(t) region := "us-central1" buf := new(bytes.Buffer) if err := instantiateInlineWorkflowTemplate(buf, tc.ProjectID, region); err != nil { t.Fatalf("instantiateInlineWorkflowTemplate got err: %v", err) } got := buf.String() if want := fmt.Sprintf("successfully"); !strings.Contains(got, want) { t.Fatalf("instantiateInlineWorkflowTemplate got %q, want %q", got, want) } }
explode_data.jsonl/5388
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 80551, 25324, 62768, 7275, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 1273, 1314, 16620, 2271, 1155, 692, 197, 3943, 1669, 330, 355, 84081, 16, 1837, 26398, 1669, 501, 23158, 22622, 692, 743, 1848, 1669, 40902, 25324, 62768, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapConvertMockCopy(t *testing.T) { t.Parallel() f := func(gcTypes []string, memTypes map[string]string) bool { m := &datatype.MapConvertMock{ GCTypes: gcTypes, MemoryTypes: memTypes, } c := m.Copy() cc, ok := c.(*datatype.MapConvertMock) if !ok { t.Errorf("c.(*datatype.MapConvertMock): c = (%T); want (*datatype.MapConvertMock)", c) return false } if m == c { t.Error("m.Copy(): wasn't copied") return false } if !reflect.DeepEqual(cc, m) { t.Errorf("reflect.DeepEqual(cc, m): c = (%v); want (%v)", c, m) return false } return true } if err := quick.Check(f, nil); err != nil { t.Error(err) } }
explode_data.jsonl/57178
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 308 }
[ 2830, 3393, 2227, 12012, 11571, 12106, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1166, 1669, 2915, 78657, 4173, 3056, 917, 11, 1833, 4173, 2415, 14032, 30953, 8, 1807, 341, 197, 2109, 1669, 609, 62409, 10104, 12012, 11571, 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...
4
func TestCalculateSeek__BadWhence(t *testing.T) { _, err := CalculateSeek(11, 22, 99, 0) if err == nil { t.Fatalf("Expected failure for bad whence.") } else if err.Error() != "whence not valid: (99)" { log.Panic(err) } }
explode_data.jsonl/45050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 47866, 39350, 563, 17082, 1639, 763, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 20517, 39350, 7, 16, 16, 11, 220, 17, 17, 11, 220, 24, 24, 11, 220, 15, 340, 743, 1848, 621, 2092, 341, 197, 3244, 30762, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDiffRefTag(t *testing.T) { diff := &PostReceiveLine{OldCommitHash: "", NewCommitHash: "", Ref: "refs/tags/v0.100"} if diff.IsBranch() == true { t.Errorf("Expected Ref %s to be a tag (IsBranch() -> true)", diff.Ref) return } if diff.IsTag() != true { t.Errorf("Expected Ref %s to be a tag (IsTag() -> false)", diff.Ref) return } if diff.RefName() != "v0.100" { t.Errorf("Expected Ref Name to be v0.100, got: %s", diff.RefName()) return } }
explode_data.jsonl/12448
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 21751, 3945, 5668, 1155, 353, 8840, 836, 8, 341, 80564, 1669, 609, 4133, 14742, 2460, 90, 18284, 33441, 6370, 25, 7342, 1532, 33441, 6370, 25, 7342, 8550, 25, 330, 16149, 84460, 5457, 15, 13, 16, 15, 15, 63159, 743, 3638, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSaveTableSummary(t *testing.T) { s := objmock.NewStore() tbl := &objects.TableProfile{ RowsCount: 200, Columns: []*objects.ColumnProfile{ { Name: "a", NACount: 0, Min: floatPtr(0), Max: floatPtr(200), Mean: floatPtr(3.123), Median: floatPtr(5), StdDeviation: floatPtr(3.4), Percentiles: []float64{ 3, 7, 10, 14.69, 17, 21.69, 24, 28.69, 31, 34, 38, 41, 45, 48, 52.69, 55, 59.69, 62, 66.69, }, MinStrLen: 1, MaxStrLen: 5, AvgStrLen: 2, }, { Name: "def", NACount: 20, MinStrLen: 10, MaxStrLen: 10, AvgStrLen: 10, TopValues: objects.ValueCounts{ {testutils.BrokenRandomLowerAlphaString(10), 50}, {testutils.BrokenRandomLowerAlphaString(10), 30}, {testutils.BrokenRandomLowerAlphaString(10), 20}, {testutils.BrokenRandomLowerAlphaString(10), 10}, }, }, }, } w := bytes.NewBuffer(nil) _, err := tbl.WriteTo(w) require.NoError(t, err) sum := testutils.SecureRandomBytes(16) require.NoError(t, objects.SaveTableProfile(s, sum, w.Bytes())) ts, err := objects.GetTableProfile(s, sum) require.NoError(t, err) assert.Equal(t, tbl, ts) require.NoError(t, objects.DeleteTableProfile(s, sum)) _, err = objects.GetTableProfile(s, sum) assert.Equal(t, objects.ErrKeyNotFound, err) }
explode_data.jsonl/57830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 661 }
[ 2830, 3393, 8784, 2556, 19237, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 2839, 16712, 7121, 6093, 741, 3244, 2024, 1669, 609, 19210, 18257, 8526, 515, 197, 197, 9024, 2507, 25, 220, 17, 15, 15, 345, 197, 197, 13965, 25, 29838, 19210, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatKey(t *testing.T) { assert.Equal(t, "param", FormatKey([]string{"param"})) assert.Equal(t, "param[key]", FormatKey([]string{"param", "key"})) assert.Equal(t, "param[key][]", FormatKey([]string{"param", "key", ""})) assert.Equal(t, "param[key][0]", FormatKey([]string{"param", "key", "0"})) }
explode_data.jsonl/30325
{ "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, 4061, 1592, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 330, 903, 497, 15042, 1592, 10556, 917, 4913, 903, 9207, 1171, 6948, 12808, 1155, 11, 330, 903, 8157, 19076, 15042, 1592, 10556, 917, 4913, 903, 497, 330, 79...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestQuery(t *testing.T) { api := &mockSCIONDService{ replies: []*sciond.PathReply{ buildSCIONDReply(), buildSCIONDReply(pathXY1), buildSCIONDReply(pathXY1, pathXY2), }, } Convey("Create path manager (path set max age = 1 second)", t, func() { timers := &Timers{ NormalRefire: 5 * time.Second, ErrorRefire: 5 * time.Second, MaxAge: time.Second, } pm, err := New(api, timers, log.Root()) SoMsg("pm", pm, ShouldNotBeNil) SoMsg("err", err, ShouldBeNil) Convey("Query, receive 0 paths", func() { aps := pm.Query(iaX, iaY) SoMsg("aps", aps, ShouldResemble, AppPathSet{}) SoMsg("aps len", len(aps), ShouldEqual, 0) Convey("Query, we have 0 paths and SCIOND is asked again, receive 1 path", func() { aps := pm.Query(iaX, iaY) SoMsg("aps", aps, ShouldResemble, buildAPS(pathXY1)) SoMsg("aps len", len(aps), ShouldEqual, 1) Convey("Query immediately, same path is read from cache", func() { aps := pm.Query(iaX, iaY) SoMsg("aps", aps, ShouldResemble, buildAPS(pathXY1)) SoMsg("aps len", len(aps), ShouldEqual, 1) }) Convey("Wait 2 seconds for paths to expire, then query and get new paths", func() { <-time.After(2 * time.Second) aps := pm.Query(iaX, iaY) SoMsg("aps", aps, ShouldResemble, buildAPS(pathXY1, pathXY2)) SoMsg("aps len", len(aps), ShouldEqual, 2) }) }) }) }) }
explode_data.jsonl/25283
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 613 }
[ 2830, 3393, 2859, 1155, 353, 8840, 836, 8, 341, 54299, 1669, 609, 16712, 3540, 1271, 35, 1860, 515, 197, 17200, 7202, 25, 29838, 2388, 290, 67, 17474, 20841, 515, 298, 69371, 3540, 1271, 35, 20841, 3148, 298, 69371, 3540, 1271, 35, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInvalidCodeDeploy(t *testing.T) { scc := new(LifeCycleSysCC) stub := shim.NewMockStub("lscc", scc) if res := stub.MockInit("1", nil); res.Status != shim.OK { fmt.Println("Init failed", string(res.Message)) t.FailNow() } baddepspec := []byte("bad deploy spec") args := [][]byte{[]byte(DEPLOY), []byte("test"), baddepspec} res := stub.MockInvoke("1", args) if res.Status == shim.OK { t.Logf("Expected failure") t.FailNow() } }
explode_data.jsonl/9382
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 190 }
[ 2830, 3393, 7928, 2078, 69464, 1155, 353, 8840, 836, 8, 341, 1903, 638, 1669, 501, 4957, 1612, 44820, 32792, 3706, 340, 18388, 392, 1669, 62132, 7121, 11571, 33838, 445, 4730, 638, 497, 274, 638, 692, 743, 592, 1669, 13633, 24664, 3803,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientRoundTripper(t *testing.T) { c := NewWithClient(&http.Client{}) c.outputLogTo(ioutil.Discard) rt := &CustomRoundTripper{} c.SetTransport(rt) ct, err := c.transport() assertNotNil(t, err) assertNil(t, ct) assertEqual(t, "current transport is not an *http.Transport instance", err.Error()) c.SetTLSClientConfig(&tls.Config{}) c.SetProxy("http://localhost:9090") c.RemoveProxy() c.SetCertificates(tls.Certificate{}) c.SetRootCertificate(filepath.Join(getTestDataPath(), "sample-root.pem")) }
explode_data.jsonl/39354
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 2959, 27497, 21884, 6922, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 2354, 2959, 2099, 1254, 11716, 37790, 1444, 13413, 2201, 1249, 1956, 30158, 909, 47560, 692, 55060, 1669, 609, 10268, 27497, 21884, 6922, 16094, 1444, 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 TestNoAutoscalerImageCreatesNoAutoscalers(t *testing.T) { kubeClient, _, servingClient, cachingClient, _, controller, kubeInformer, _, servingInformer, cachingInformer, _, _ := newTestController(t) rev := getTestRevision() config := getTestConfiguration() rev.OwnerReferences = append( rev.OwnerReferences, *kmeta.NewControllerRef(config), ) // Update controller config with no autoscaler image controller.Reconciler.(*Reconciler).receiveControllerConfig( &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: "config-controller", Namespace: system.Namespace, }, Data: map[string]string{ "queueSidecarImage": testQueueImage, }, }) createRevision(t, kubeClient, kubeInformer, servingClient, servingInformer, cachingClient, cachingInformer, controller, rev) expectedAutoscalerName := fmt.Sprintf("%s-autoscaler", rev.Name) // Look for the autoscaler deployment. _, err := kubeClient.AppsV1().Deployments(system.Namespace).Get(expectedAutoscalerName, metav1.GetOptions{}) if !apierrs.IsNotFound(err) { t.Errorf("Expected autoscaler deployment %s to not exist.", expectedAutoscalerName) } // Look for the autoscaler service. _, err = kubeClient.CoreV1().Services(system.Namespace).Get(expectedAutoscalerName, metav1.GetOptions{}) if !apierrs.IsNotFound(err) { t.Errorf("Expected autoscaler service %s to not exist.", expectedAutoscalerName) } }
explode_data.jsonl/27421
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 496 }
[ 2830, 3393, 2753, 19602, 436, 63084, 1906, 54868, 2753, 19602, 436, 5416, 388, 1155, 353, 8840, 836, 8, 341, 16463, 3760, 2959, 11, 8358, 13480, 2959, 11, 47430, 2959, 11, 8358, 6461, 11, 80958, 641, 34527, 11, 8358, 13480, 641, 34527, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMinerHandshake(t *testing.T) { mock := gomock.NewController(t) defer mock.Finish() cfg := defaultMockCfg(mock) ovs := NewMockOverseer(mock) info := make(map[string]ContainerMetrics) info["id1"] = ContainerMetrics{mem: types.MemoryStats{Usage: 42, MaxUsage: 43}} ovs.EXPECT().Info(context.Background()).AnyTimes().Return(info, nil) collector := hardware.NewMockHardwareInfo(mock) collector.EXPECT().Info().AnyTimes().Return(&hardware.Hardware{ CPU: []cpu.InfoStat{{Cores: 2}}, Memory: &mem.VirtualMemoryStat{Total: 2048}, }, nil) builder := MinerBuilder{} builder.Config(cfg) builder.Overseer(ovs) builder.Hardware(collector) builder.UUID("deadbeef-cafe-dead-beef-cafedeadbeef") m, err := builder.Build() require.NotNil(t, m) require.Nil(t, err) reply, err := m.Handshake(context.Background(), &pb.MinerHandshakeRequest{Hub: "testHub"}) assert.NotNil(t, reply) assert.Nil(t, err) assert.Equal(t, reply.Miner, "deadbeef-cafe-dead-beef-cafedeadbeef") assert.Equal(t, int32(2), reply.Capabilities.Cpu[0].Cores) assert.Equal(t, uint64(2048), reply.Capabilities.Mem.Total) }
explode_data.jsonl/44508
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 443 }
[ 2830, 3393, 6217, 261, 2314, 29661, 1155, 353, 8840, 836, 8, 341, 77333, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 991, 18176, 2822, 50286, 1669, 1638, 11571, 42467, 30389, 692, 197, 859, 82, 1669, 1532, 11571, 1918, 325...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateProbe(t *testing.T) { handler := api.Handler{Exec: &api.ExecAction{Command: []string{"echo"}}} successCases := []*api.Probe{ nil, {TimeoutSeconds: 10, InitialDelaySeconds: 0, Handler: handler}, {TimeoutSeconds: 0, InitialDelaySeconds: 10, Handler: handler}, } for _, p := range successCases { if errs := validateProbe(p); len(errs) != 0 { t.Errorf("expected success: %v", errs) } } errorCases := []*api.Probe{ {TimeoutSeconds: 10, InitialDelaySeconds: 10}, {TimeoutSeconds: 10, InitialDelaySeconds: -10, Handler: handler}, {TimeoutSeconds: -10, InitialDelaySeconds: 10, Handler: handler}, {TimeoutSeconds: -10, InitialDelaySeconds: -10, Handler: handler}, } for _, p := range errorCases { if errs := validateProbe(p); len(errs) == 0 { t.Errorf("expected failure for %v", p) } } }
explode_data.jsonl/62790
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 17926, 81426, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 6330, 31010, 90, 10216, 25, 609, 2068, 30798, 2512, 90, 4062, 25, 3056, 917, 4913, 3047, 30975, 532, 30553, 37302, 1669, 29838, 2068, 7763, 1371, 515, 197, 84131, 345,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateOpenUnsupported(t *testing.T) { // Ensure creating a database with an unsupported type fails with the // expected error. dbType := "unsupported" _, err := database.CreateDB(dbType, "unsupportedcreatetest") if err != database.ErrDbUnknownType { t.Errorf("TestCreateOpenUnsupported: expected error not "+ "received - got: %v, want %v", err, database.ErrDbUnknownType) return } // Ensure opening a database with the new type fails with the expected // error. _, err = database.OpenDB(dbType, "unsupportedopentest") if err != database.ErrDbUnknownType { t.Errorf("TestCreateOpenUnsupported: expected error not "+ "received - got: %v, want %v", err, database.ErrDbUnknownType) return } }
explode_data.jsonl/4355
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 235 }
[ 2830, 3393, 4021, 5002, 41884, 1155, 353, 8840, 836, 8, 341, 197, 322, 29279, 6825, 264, 4625, 448, 458, 40409, 943, 14525, 448, 279, 198, 197, 322, 3601, 1465, 624, 20939, 929, 1669, 330, 81145, 698, 197, 6878, 1848, 1669, 4625, 7251...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLastMonthDay(t *testing.T) { loc, _ := time.LoadLocation("Local") now := time.Date(2019, 3, 1, 0, 0, 0, 0, loc) target := LastMonthDay(2, 29, now) expected := time.Date(2016, 2, 29, 0, 0, 0, 0, loc) assert.Equal(t, expected.Unix(), target.Unix()) now1 := time.Date(2021, 3, 1, 0, 0, 0, 0, loc) target1 := LastMonthDay(2, 28, now1) expected1 := time.Date(2021, 2, 28, 0, 0, 0, 0, loc) assert.Equal(t, expected1.Unix(), target1.Unix()) now2 := time.Date(2021, 3, 1, 0, 0, 0, 0, loc) target2 := LastMonthDay(4, 28, now2) expected2 := time.Date(2020, 4, 28, 0, 0, 0, 0, loc) assert.Equal(t, expected2.Unix(), target2.Unix()) }
explode_data.jsonl/47982
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 5842, 11318, 10159, 1155, 353, 8840, 836, 8, 341, 71128, 11, 716, 1669, 882, 13969, 4707, 445, 7319, 5130, 80922, 1669, 882, 8518, 7, 17, 15, 16, 24, 11, 220, 18, 11, 220, 16, 11, 220, 15, 11, 220, 15, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFloat32_Union(t *testing.T) { testcases := []struct { name string s Float32 t Float32 expect []float32 }{ { name: "test Float32 Union, s and s are empty", s: Float32{}, t: Float32{}, expect: []float32{}, }, { name: "test Float32 Union, s is empty", s: Float32{}, t: map[float32]struct{}{1: {}, 2: {}, 3.1: {}}, expect: []float32{1, 2, 3.1}, }, { name: "test Float32 Union, s is empty", s: map[float32]struct{}{1: {}, 2: {}, 3.1: {}}, t: Float32{}, expect: []float32{1, 2, 3.1}, }, { name: "test Float32 Union, s has same element to s", s: map[float32]struct{}{1: {}, 2: {}, 3.1: {}}, t: map[float32]struct{}{1: {}, 1.3: {}, 4.1: {}}, expect: []float32{1, 2, 3.1, 4.1, 1.3}, }, { name: "test Float32 Union, s does not have same element to s", s: map[float32]struct{}{1: {}, 2: {}, 3.1: {}}, t: map[float32]struct{}{2.1: {}, 1.3: {}, 4.1: {}}, expect: []float32{1, 2, 2.1, 3.1, 4.1, 1.3}, }, } for _, tc := range testcases { t.Logf("running scenario: %s", tc.name) actual := tc.s.Union(tc.t) validateFloat32(t, actual, tc.expect) } }
explode_data.jsonl/60114
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 643 }
[ 2830, 3393, 5442, 18, 17, 62, 32658, 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 TestFragCombos(t *testing.T) { uri0, err := NewURIFromAddress("host0") if err != nil { t.Fatal(err) } uri1, err := NewURIFromAddress("host1") if err != nil { t.Fatal(err) } node0 := &Node{ID: "node0", URI: *uri0} node1 := &Node{ID: "node1", URI: *uri1} c := newCluster() c.addNodeBasicSorted(node0) c.addNodeBasicSorted(node1) tests := []struct { idx string availableShards *roaring.Bitmap fieldViews viewsByField expected fragsByHost }{ { idx: "i", availableShards: roaring.NewBitmap(0, 1, 2), fieldViews: viewsByField{"f": []string{"v1", "v2"}}, expected: fragsByHost{ "node0": []frag{{"f", "v1", uint64(0)}, {"f", "v2", uint64(0)}}, "node1": []frag{{"f", "v1", uint64(1)}, {"f", "v2", uint64(1)}, {"f", "v1", uint64(2)}, {"f", "v2", uint64(2)}}, }, }, { idx: "foo", availableShards: roaring.NewBitmap(0, 1, 2, 3), fieldViews: viewsByField{"f": []string{"v0"}}, expected: fragsByHost{ "node0": []frag{{"f", "v0", uint64(1)}, {"f", "v0", uint64(2)}}, "node1": []frag{{"f", "v0", uint64(0)}, {"f", "v0", uint64(3)}}, }, }, } for _, test := range tests { actual := c.fragCombos(test.idx, test.availableShards, test.fieldViews) if !reflect.DeepEqual(actual, test.expected) { t.Errorf("expected: %v, but got: %v", test.expected, actual) } } }
explode_data.jsonl/59872
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 693 }
[ 2830, 3393, 37, 4101, 36192, 436, 1155, 353, 8840, 836, 8, 341, 197, 6070, 15, 11, 1848, 1669, 1532, 1511, 2773, 441, 4286, 445, 3790, 15, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 197, 6070, 16, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestPHPParserHWPHP(t *testing.T) { testStr := `<?php echo "hello world", "!";` p := NewParser() p.disableScoping = true a, _ := p.Parse("test.php", testStr) tree := ast.Echo( &ast.Literal{Type: ast.String, Value: `"hello world"`}, &ast.Literal{Type: ast.String, Value: `"!"`}, ) if !assertEquals(a.Nodes[0], tree) { t.Fatalf("Hello world did not correctly parse") } }
explode_data.jsonl/28429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 15158, 6570, 38252, 15158, 1155, 353, 8840, 836, 8, 341, 18185, 2580, 1669, 1565, 1316, 1208, 198, 262, 1687, 330, 14990, 1879, 497, 53074, 5123, 3989, 3223, 1669, 1532, 6570, 741, 3223, 42628, 3326, 33707, 284, 830, 198, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestChainProviderWithNoValidProviderWithVerboseEnabled(t *testing.T) { errs := []error{ awserr.New("FirstError", "first provider error", nil), awserr.New("SecondError", "second provider error", nil), } p := &ChainProvider{ VerboseErrors: true, Providers: []Provider{ &stubProvider{err: errs[0]}, &stubProvider{err: errs[1]}, }, } if !p.IsExpired() { t.Errorf("Expect expired with no providers") } _, err := p.Retrieve() expectErr := awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs) if e, a := expectErr, err; !reflect.DeepEqual(e, a) { t.Errorf("Expect no providers error returned, %v, got %v", e, a) } }
explode_data.jsonl/34840
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 18837, 5179, 2354, 2753, 4088, 5179, 2354, 63404, 5462, 1155, 353, 8840, 836, 8, 341, 9859, 82, 1669, 3056, 841, 515, 197, 197, 8635, 615, 7121, 445, 5338, 1454, 497, 330, 3896, 9109, 1465, 497, 2092, 1326, 197, 197, 8635,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetVestingCoinsPeriodicVestingAcc(t *testing.T) { now := osttime.Now() endTime := now.Add(24 * time.Hour) periods := types.Periods{ types.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}}, types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } _, _, addr := testdata.KeyTestPubAddr() origCoins := sdk.Coins{ sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} bacc := authtypes.NewBaseAccountWithAddress(addr) pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require all coins vesting at the beginning of the vesting schedule vestingCoins := pva.GetVestingCoins(now) require.Equal(t, origCoins, vestingCoins) // require no coins vesting at the end of the vesting schedule vestingCoins = pva.GetVestingCoins(endTime) require.Nil(t, vestingCoins) // require 50% of coins vesting vestingCoins = pva.GetVestingCoins(now.Add(12 * time.Hour)) require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestingCoins) // require 50% of coins vesting after period 1, but before period 2 completes. vestingCoins = pva.GetVestingCoins(now.Add(15 * time.Hour)) require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, vestingCoins) // require 25% of coins vesting after period 2 vestingCoins = pva.GetVestingCoins(now.Add(18 * time.Hour)) require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}, vestingCoins) // require 0% of coins vesting after vesting complete vestingCoins = pva.GetVestingCoins(now.Add(48 * time.Hour)) require.Nil(t, vestingCoins) }
explode_data.jsonl/31292
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 763 }
[ 2830, 3393, 1949, 53, 59855, 69602, 23750, 292, 53, 59855, 14603, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 36896, 1678, 13244, 741, 6246, 1462, 1669, 1431, 1904, 7, 17, 19, 353, 882, 73550, 340, 197, 19304, 82, 1669, 4494, 14834, 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...
1
func TestAssessMetricFailureInconclusiveOrError(t *testing.T) { metric := v1alpha1.Metric{} result := v1alpha1.MetricResult{ Failed: 1, Measurements: []v1alpha1.Measurement{{ Phase: v1alpha1.AnalysisPhaseFailed, }}, } phase, msg := assessMetricFailureInconclusiveOrError(metric, result) expectedMsg := fmt.Sprintf("failed (%d) > failureLimit (%d)", result.Failed, 0) assert.Equal(t, v1alpha1.AnalysisPhaseFailed, phase) assert.Equal(t, expectedMsg, msg) assert.Equal(t, phase, assessMetricStatus(metric, result, true)) result = v1alpha1.MetricResult{ Inconclusive: 1, Measurements: []v1alpha1.Measurement{{ Phase: v1alpha1.AnalysisPhaseInconclusive, }}, } phase, msg = assessMetricFailureInconclusiveOrError(metric, result) expectedMsg = fmt.Sprintf("inconclusive (%d) > inconclusiveLimit (%d)", result.Inconclusive, 0) assert.Equal(t, v1alpha1.AnalysisPhaseInconclusive, phase) assert.Equal(t, expectedMsg, msg) assert.Equal(t, phase, assessMetricStatus(metric, result, true)) result = v1alpha1.MetricResult{ ConsecutiveError: 5, //default ConsecutiveErrorLimit for Metrics is 4 Measurements: []v1alpha1.Measurement{{ Phase: v1alpha1.AnalysisPhaseError, }}, } phase, msg = assessMetricFailureInconclusiveOrError(metric, result) expectedMsg = fmt.Sprintf("consecutiveErrors (%d) > consecutiveErrorLimit (%d)", result.ConsecutiveError, defaults.DefaultConsecutiveErrorLimit) assert.Equal(t, v1alpha1.AnalysisPhaseError, phase) assert.Equal(t, expectedMsg, msg) assert.Equal(t, phase, assessMetricStatus(metric, result, true)) }
explode_data.jsonl/75841
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 567 }
[ 2830, 3393, 5615, 433, 54310, 17507, 641, 443, 8336, 2195, 1454, 1155, 353, 8840, 836, 8, 341, 2109, 16340, 1669, 348, 16, 7141, 16, 1321, 16340, 16094, 9559, 1669, 348, 16, 7141, 16, 1321, 16340, 2077, 515, 197, 197, 9408, 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
func TestErrorOnCyclicTypeRefsInputType(t *testing.T) { assert := assert.New(t) vs := newTestValueStore() defer vs.Close() type Node struct { Children map[string]Node } var n Node typ := marshal.MustMarshalType(vs, n) tc := NewTypeConverter() _, err := tc.NomsTypeToGraphQLInputType(typ) assert.Error(err) }
explode_data.jsonl/17733
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 1454, 1925, 34, 65304, 929, 82807, 2505, 929, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 5195, 82, 1669, 501, 2271, 1130, 6093, 741, 16867, 6165, 10421, 2822, 13158, 6018, 2036, 341, 197, 197, 11539, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChannelsService_Edit(t *testing.T) { setup() defer teardown() input := &ChannelRequest{ Name: "name", Description: "desc", Privacy: "anybody", } mux.HandleFunc("/channels/1", func(w http.ResponseWriter, r *http.Request) { v := &ChannelRequest{} json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "PATCH") if !reflect.DeepEqual(v, input) { t.Errorf("Channels.Edit body is %+v, want %+v", v, input) } fmt.Fprint(w, `{"name": "name"}`) }) channel, _, err := client.Channels.Edit("1", input) if err != nil { t.Errorf("Channels.Edit returned unexpected error: %v", err) } want := &Channel{Name: "name"} if !reflect.DeepEqual(channel, want) { t.Errorf("Channels.Edit returned %+v, want %+v", channel, want) } }
explode_data.jsonl/49784
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 325 }
[ 2830, 3393, 35925, 1860, 66158, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 22427, 1669, 609, 9629, 1900, 515, 197, 21297, 25, 286, 330, 606, 756, 197, 47414, 25, 330, 8614, 756, 197, 197, 47832, 25, 257, 330, 3767, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalDirect(t *testing.T) { r := RegexSerde{regexp.MustCompile(`(?i)^I approve\s*(?P<version>\S*)`)} b, err := r.MarshalJSON() if err != nil { t.Fatal("Unable to marshal regex serde", err) } s := string(b) if s != `"(?i)^I approve\\s*(?P<version>\\S*)"` { t.Error("marshal regex serde did not yield expected result", s) } }
explode_data.jsonl/56832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 55438, 16027, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 26146, 31745, 450, 90, 55796, 98626, 5809, 33294, 72, 29776, 40, 28151, 32407, 6599, 30, 47, 27, 4366, 8449, 50, 3764, 63, 10569, 2233, 11, 1848, 1669, 435, 37271, 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, 1, 1...
3
func TestAccPermissionsClusterPolicy(t *testing.T) { permissionsTestHelper(t, func(permissionsAPI PermissionsAPI, user, group string, ef func(string) PermissionsEntity) { policy := compute.ClusterPolicy{ Name: group, Definition: "{}", } ctx := context.Background() policiesAPI := compute.NewClusterPoliciesAPI(ctx, permissionsAPI.client) require.NoError(t, policiesAPI.Create(&policy)) defer func() { assert.NoError(t, policiesAPI.Delete(policy.PolicyID)) }() objectID := fmt.Sprintf("/cluster-policies/%s", policy.PolicyID) require.NoError(t, permissionsAPI.Update(objectID, AccessControlChangeList{ AccessControlList: []AccessControlChange{ { UserName: user, PermissionLevel: "CAN_USE", }, { GroupName: group, PermissionLevel: "CAN_USE", }, }, })) entity := ef(objectID) assert.Equal(t, "cluster-policy", entity.ObjectType) assert.Len(t, entity.AccessControlList, 2) require.NoError(t, permissionsAPI.Delete(objectID)) entity = ef(objectID) assert.Len(t, entity.AccessControlList, 0) }) }
explode_data.jsonl/50886
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 437 }
[ 2830, 3393, 14603, 23851, 28678, 13825, 1155, 353, 8840, 836, 8, 341, 197, 29900, 2271, 5511, 1155, 11, 2915, 7, 29900, 7082, 53357, 7082, 11, 1196, 11, 1874, 914, 345, 197, 197, 823, 2915, 3609, 8, 53357, 3030, 8, 341, 197, 3223, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAction_GetRepoPath(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) repo := AssertExistsAndLoadBean(t, &Repository{}).(*Repository) owner := AssertExistsAndLoadBean(t, &User{ID: repo.OwnerID}).(*User) action := &Action{RepoID: repo.ID} assert.Equal(t, path.Join(owner.Name, repo.Name), action.GetRepoPath()) }
explode_data.jsonl/74203
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 2512, 13614, 25243, 1820, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 31166, 2271, 5988, 2398, 17200, 5368, 1669, 5319, 15575, 3036, 5879, 10437, 1155, 11, 609, 4624, 6257, 568, 4071, 4624, 340, 197, 8118, 1669, 531...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLiveUpdateMultipleContainersFallsBackForFailure(t *testing.T) { f := newBDFixture(t, k8s.EnvDockerDesktop, container.RuntimeDocker) defer f.TearDown() f.docker.SetExecError(fmt.Errorf("egads")) m := NewSanchoLiveUpdateManifest(f) cIDs := []container.ID{"c1", "c2", "c3"} tCase := testCase{ manifest: m, runningContainersByTarget: map[model.TargetID][]container.ID{m.ImageTargetAt(0).ID(): cIDs}, changedFiles: []string{"a.txt"}, // attempted container update; called copy and exec before hitting error expectDockerCopyCount: 1, expectDockerExecCount: 1, // fell back to image build expectDockerBuildCount: 1, expectK8sDeploy: true, } runTestCase(t, f, tCase) }
explode_data.jsonl/35162
{ "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, 20324, 4289, 32089, 74632, 37, 5583, 3707, 2461, 17507, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 33, 5262, 12735, 1155, 11, 595, 23, 82, 81214, 35, 13659, 23597, 11, 5476, 16706, 35, 13659, 340, 16867, 282, 836, 682,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeposits(t *testing.T) { input := getMockApp(t, 2, GenesisState{}, nil) SortAddresses(input.addrs) header := abci.Header{Height: input.mApp.LastBlockHeight() + 1} input.mApp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx := input.mApp.BaseApp.NewContext(false, abci.Header{}) tp := testProposal() proposal, err := input.keeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.ProposalID fourStake := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromTendermintPower(4))) fiveStake := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromTendermintPower(5))) addr0Initial := input.keeper.ck.GetCoins(ctx, input.addrs[0]) addr1Initial := input.keeper.ck.GetCoins(ctx, input.addrs[1]) expTokens := sdk.TokensFromTendermintPower(42) require.Equal(t, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, expTokens)), addr0Initial) require.True(t, proposal.TotalDeposit.IsEqual(sdk.NewCoins())) // Check no deposits at beginning deposit, found := input.keeper.GetDeposit(ctx, proposalID, input.addrs[1]) require.False(t, found) proposal, ok := input.keeper.GetProposal(ctx, proposalID) require.True(t, ok) require.True(t, proposal.VotingStartTime.Equal(time.Time{})) // Check first deposit err, votingStarted := input.keeper.AddDeposit(ctx, proposalID, input.addrs[0], fourStake) require.Nil(t, err) require.False(t, votingStarted) deposit, found = input.keeper.GetDeposit(ctx, proposalID, input.addrs[0]) require.True(t, found) require.Equal(t, fourStake, deposit.Amount) require.Equal(t, input.addrs[0], deposit.Depositor) proposal, ok = input.keeper.GetProposal(ctx, proposalID) require.True(t, ok) require.Equal(t, fourStake, proposal.TotalDeposit) require.Equal(t, addr0Initial.Sub(fourStake), input.keeper.ck.GetCoins(ctx, input.addrs[0])) // Check a second deposit from same address err, votingStarted = input.keeper.AddDeposit(ctx, proposalID, input.addrs[0], fiveStake) require.Nil(t, err) require.False(t, votingStarted) deposit, found = input.keeper.GetDeposit(ctx, proposalID, input.addrs[0]) require.True(t, found) require.Equal(t, fourStake.Add(fiveStake), deposit.Amount) require.Equal(t, input.addrs[0], deposit.Depositor) proposal, ok = input.keeper.GetProposal(ctx, proposalID) require.True(t, ok) require.Equal(t, fourStake.Add(fiveStake), proposal.TotalDeposit) require.Equal(t, addr0Initial.Sub(fourStake).Sub(fiveStake), input.keeper.ck.GetCoins(ctx, input.addrs[0])) // Check third deposit from a new address err, votingStarted = input.keeper.AddDeposit(ctx, proposalID, input.addrs[1], fourStake) require.Nil(t, err) require.True(t, votingStarted) deposit, found = input.keeper.GetDeposit(ctx, proposalID, input.addrs[1]) require.True(t, found) require.Equal(t, input.addrs[1], deposit.Depositor) require.Equal(t, fourStake, deposit.Amount) proposal, ok = input.keeper.GetProposal(ctx, proposalID) require.True(t, ok) require.Equal(t, fourStake.Add(fiveStake).Add(fourStake), proposal.TotalDeposit) require.Equal(t, addr1Initial.Sub(fourStake), input.keeper.ck.GetCoins(ctx, input.addrs[1])) // Check that proposal moved to voting period proposal, ok = input.keeper.GetProposal(ctx, proposalID) require.True(t, ok) require.True(t, proposal.VotingStartTime.Equal(ctx.BlockHeader().Time)) // Test deposit iterator depositsIterator := input.keeper.GetDeposits(ctx, proposalID) require.True(t, depositsIterator.Valid()) input.keeper.cdc.MustUnmarshalBinaryLengthPrefixed(depositsIterator.Value(), &deposit) require.Equal(t, input.addrs[0], deposit.Depositor) require.Equal(t, fourStake.Add(fiveStake), deposit.Amount) depositsIterator.Next() input.keeper.cdc.MustUnmarshalBinaryLengthPrefixed(depositsIterator.Value(), &deposit) require.Equal(t, input.addrs[1], deposit.Depositor) require.Equal(t, fourStake, deposit.Amount) depositsIterator.Next() require.False(t, depositsIterator.Valid()) depositsIterator.Close() // Test Refund Deposits deposit, found = input.keeper.GetDeposit(ctx, proposalID, input.addrs[1]) require.True(t, found) require.Equal(t, fourStake, deposit.Amount) input.keeper.RefundDeposits(ctx, proposalID) deposit, found = input.keeper.GetDeposit(ctx, proposalID, input.addrs[1]) require.False(t, found) require.Equal(t, addr0Initial, input.keeper.ck.GetCoins(ctx, input.addrs[0])) require.Equal(t, addr1Initial, input.keeper.ck.GetCoins(ctx, input.addrs[1])) }
explode_data.jsonl/36930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1660 }
[ 2830, 3393, 7839, 436, 1199, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 633, 11571, 2164, 1155, 11, 220, 17, 11, 40788, 1397, 22655, 2092, 340, 7568, 371, 52290, 5384, 1364, 5428, 692, 20883, 1669, 668, 5855, 15753, 90, 3640, 25, 1946...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuilderResourceError(t *testing.T) { tests := []struct { name string fn func(*Builder) error }{ {"CNAMEResource", func(b *Builder) error { return b.CNAMEResource(ResourceHeader{}, CNAMEResource{}) }}, {"MXResource", func(b *Builder) error { return b.MXResource(ResourceHeader{}, MXResource{}) }}, {"NSResource", func(b *Builder) error { return b.NSResource(ResourceHeader{}, NSResource{}) }}, {"PTRResource", func(b *Builder) error { return b.PTRResource(ResourceHeader{}, PTRResource{}) }}, {"SOAResource", func(b *Builder) error { return b.SOAResource(ResourceHeader{}, SOAResource{}) }}, {"TXTResource", func(b *Builder) error { return b.TXTResource(ResourceHeader{}, TXTResource{}) }}, {"SRVResource", func(b *Builder) error { return b.SRVResource(ResourceHeader{}, SRVResource{}) }}, {"AResource", func(b *Builder) error { return b.AResource(ResourceHeader{}, AResource{}) }}, {"AAAAResource", func(b *Builder) error { return b.AAAAResource(ResourceHeader{}, AAAAResource{}) }}, } envs := []struct { name string fn func() *Builder want error }{ {"sectionNotStarted", func() *Builder { return &Builder{section: sectionNotStarted} }, ErrNotStarted}, {"sectionHeader", func() *Builder { return &Builder{section: sectionHeader} }, ErrNotStarted}, {"sectionQuestions", func() *Builder { return &Builder{section: sectionQuestions} }, ErrNotStarted}, {"sectionDone", func() *Builder { return &Builder{section: sectionDone} }, ErrSectionDone}, } for _, env := range envs { for _, test := range tests { if got := test.fn(env.fn()); got != env.want { t.Errorf("got Builder{%s}.%s = %v, want = %v", env.name, test.name, got, env.want) } } } }
explode_data.jsonl/60560
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 596 }
[ 2830, 3393, 3297, 4783, 1454, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 40095, 256, 2915, 4071, 3297, 8, 1465, 198, 197, 59403, 197, 197, 4913, 28668, 1402, 640, 288, 919, 497, 2915, 1883, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestData(t *testing.T) { compose.EnsureUp(t, "redis") ms := mbtest.NewReportingMetricSetV2(t, getConfig()) err := mbtest.WriteEventsReporterV2(ms, t, "") if err != nil { t.Fatal("write", err) } }
explode_data.jsonl/5187
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 93200, 1155, 353, 8840, 836, 8, 341, 32810, 2900, 22834, 19098, 2324, 1155, 11, 330, 21748, 5130, 47691, 1669, 10016, 1944, 7121, 70131, 54310, 1649, 53, 17, 1155, 11, 66763, 2398, 9859, 1669, 10016, 1944, 4073, 7900, 52766, 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, 1 ]
2
func TestPositionedErr(t *testing.T) { invalidSQL := []struct { input string output PositionedErr }{{ input: "select convert('abc' as date) from t", output: PositionedErr{"syntax error", 24, "as"}, }, { input: "select convert from t", output: PositionedErr{"syntax error", 20, "from"}, }, { input: "select cast('foo', decimal) from t", output: PositionedErr{"syntax error", 19, ""}, }, { input: "select convert('abc', datetime(4+9)) from t", output: PositionedErr{"syntax error", 34, ""}, }, { input: "select convert('abc', decimal(4+9)) from t", output: PositionedErr{"syntax error", 33, ""}, }, { input: "set transaction isolation level 12345", output: PositionedErr{"syntax error", 38, "12345"}, }, { input: "select * from a left join b", output: PositionedErr{"syntax error", 28, ""}, }, { input: "select a from (select * from tbl)", output: PositionedErr{"syntax error", 34, ""}, }} for _, tcase := range invalidSQL { tkn := NewStringTokenizer(tcase.input) _, err := ParseNext(tkn) if posErr, ok := err.(PositionedErr); !ok { t.Errorf("%s: %v expected PositionedErr, got (%T) %v", tcase.input, err, err, tcase.output) } else if posErr.Pos != tcase.output.Pos || posErr.Near != tcase.output.Near || err.Error() != tcase.output.Error() { t.Errorf("%s: %v, want: %v", tcase.input, err, tcase.output) } } }
explode_data.jsonl/27185
{ "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, 3812, 291, 7747, 1155, 353, 8840, 836, 8, 341, 197, 11808, 6688, 1669, 3056, 1235, 341, 197, 22427, 220, 914, 198, 197, 21170, 89981, 7747, 198, 197, 15170, 515, 197, 22427, 25, 220, 330, 1742, 5508, 492, 13683, 6, 438, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadAll(t *testing.T) { s := wire.NewSyncScanner(strings.NewReader( "DATA\006\000\000\000hello DATA\005\000\000\000worldDONE")) reader, err := newSyncFileReader(s) assert.NoError(t, err) buf := make([]byte, 20) _, err = io.ReadFull(reader, buf) assert.Equal(t, io.ErrUnexpectedEOF, err) assert.Equal(t, "hello world\000", string(buf[:12])) }
explode_data.jsonl/50769
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 4418, 2403, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 9067, 7121, 12154, 31002, 51442, 68587, 1006, 197, 197, 1, 17777, 59, 15, 15, 21, 59, 15, 15, 15, 59, 15, 15, 15, 59, 15, 15, 15, 14990, 14112, 59, 15, 15, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMean(t *testing.T) { g := NewGraph() x := NewMatrix(g, Float64, WithShape(3, 3)) m, err := Mean(x) if err != nil { t.Fatal(err) } if !m.IsScalar() { t.Error("Expected result to be scalar") } }
explode_data.jsonl/62431
{ "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, 18783, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 11212, 741, 10225, 1669, 1532, 6689, 3268, 11, 13001, 21, 19, 11, 3085, 12301, 7, 18, 11, 220, 18, 1171, 2109, 11, 1848, 1669, 16327, 2075, 340, 743, 1848, 961, 2092...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEtcdBackendWithPrefetch(t *testing.T) { client, err := clientv3.New(clientv3.Config{ Endpoints: []string{"localhost:2379"}, }) require.NoError(t, err) defer client.Close() prefix := "confita-tests" ctx := context.Background() defer client.KV.Delete(ctx, prefix, clientv3.WithPrefix()) b := NewBackend(client, WithPrefix(prefix), WithPrefetch()) t.Run("OK", func(t *testing.T) { _, err = client.KV.Put(ctx, prefix+"/key1", "value1") require.NoError(t, err) _, err = client.KV.Put(ctx, prefix+"/key2", "value2") require.NoError(t, err) _, err = client.KV.Put(ctx, prefix+"/key3", "value3") require.NoError(t, err) val, err := b.Get(ctx, "key1") require.NoError(t, err) // deleting the tree client.KV.Delete(ctx, prefix, clientv3.WithPrefix()) // WithPrefetch should have prefetched all the keys // they should be available even if the tree has been removed. val, err = b.Get(ctx, "key1") require.NoError(t, err) require.Equal(t, []byte("value1"), val) val, err = b.Get(ctx, "key2") require.NoError(t, err) require.Equal(t, []byte("value2"), val) val, err = b.Get(ctx, "key3") require.NoError(t, err) require.Equal(t, []byte("value3"), val) }) }
explode_data.jsonl/71166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 503 }
[ 2830, 3393, 31860, 4385, 29699, 2354, 29978, 2995, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 2943, 85, 18, 7121, 12805, 85, 18, 10753, 515, 197, 38407, 7706, 25, 3056, 917, 4913, 8301, 25, 17, 18, 22, 24, 7115, 197, 3518,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScannerDataType(t *testing.T) { scope := gorm.Scope{Value: &ScannerDataTypeTestStruct{}} if field, ok := scope.FieldByName("ScannerDataType"); ok { if DB.Dialect().DataTypeOf(field.StructField) != "json" { t.Errorf("data type for scanner is wrong") } } scope = gorm.Scope{Value: &ScannerDataTypeTestStruct2{}} if field, ok := scope.FieldByName("ScannerDataType"); ok { if DB.Dialect().DataTypeOf(field.StructField) != "varchar(24)" { t.Errorf("data type for scanner is wrong") } } }
explode_data.jsonl/70401
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 31002, 22653, 1155, 353, 8840, 836, 8, 341, 66836, 1669, 342, 493, 77940, 90, 1130, 25, 609, 31002, 22653, 2271, 9422, 6257, 532, 743, 2070, 11, 5394, 1669, 6891, 17087, 16898, 445, 31002, 22653, 5038, 5394, 341, 197, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestName(t *testing.T) { now := time.Now() datetime := DateTime(now) // json format res1, _ := json.Marshal(datetime) res2, _ := json.Marshal(now.Format("2006-01-02 15:04:05")) assert.Equal(t, string(res1), string(res2)) // call assert.Equal(t, now.Unix(), time.Time(datetime).Unix()) }
explode_data.jsonl/32602
{ "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, 675, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 882, 13244, 741, 2698, 27662, 1669, 6520, 32263, 692, 197, 322, 2951, 3561, 198, 10202, 16, 11, 716, 1669, 2951, 37271, 45244, 340, 10202, 17, 11, 716, 1669, 2951, 37271, 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...
1
func TestSubmission(t *testing.T) { train := data.GetSpamTrainData() valid := data.GetSpamValidData() preds := submission(train, valid) acc := accuracy(valid, preds) fmt.Println("Your current accuracy is: " + FloatToString(acc)) if acc < .75 { t.Error(acc) } }
explode_data.jsonl/10543
{ "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, 86621, 1155, 353, 8840, 836, 8, 341, 197, 10397, 1669, 821, 2234, 6406, 309, 34613, 1043, 741, 56322, 1669, 821, 2234, 6406, 309, 4088, 1043, 741, 3223, 53369, 1669, 20503, 20307, 11, 2697, 340, 197, 4475, 1669, 13403, 41529...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadWithManifestInData(t *testing.T) { files := [][2]string{ {"/.manifest", `{"revision": "quickbrownfaux"}`}, } buf := archive.MustWriteTarGz(files) bundle, err := NewReader(buf).IncludeManifestInData(true).Read() if err != nil { t.Fatal(err) } system := bundle.Data["system"].(map[string]interface{}) b := system["bundle"].(map[string]interface{}) m := b["manifest"].(map[string]interface{}) if m["revision"] != "quickbrownfaux" { t.Fatalf("Unexpected manifest.revision value: %v. Expected: %v", m["revision"], "quickbrownfaux") } }
explode_data.jsonl/55368
{ "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, 4418, 2354, 38495, 641, 1043, 1155, 353, 8840, 836, 8, 341, 74075, 1669, 508, 1457, 17, 30953, 515, 197, 197, 90, 3115, 13, 42315, 497, 1565, 4913, 28342, 788, 330, 27763, 64461, 3632, 2200, 1, 5541, 1583, 197, 532, 26398,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBigIntAssignOp2(t *testing.T) { gopClTest(t, ` x := 3r x *= 2 `, `package main import ( builtin "github.com/goplus/gop/builtin" big "math/big" ) func main() { x := builtin.Gop_bigint_Init__1(big.NewInt(3)) x.Gop_MulAssign(builtin.Gop_bigint_Init__0(2)) } `) }
explode_data.jsonl/73626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 87474, 28933, 7125, 17, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 87, 1669, 220, 18, 81, 198, 87, 11404, 220, 17, 198, 7808, 1565, 1722, 1887, 271, 474, 2399, 2233, 25628, 330, 5204, 905, 4846...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGraphQLHTTPRequestHandler_ServeHTTP(t *testing.T) { starwars.SetRelativePathToStarWarsPackage("../starwars") handler := NewGraphqlHTTPHandlerFunc(starwars.NewExecutionHandler(t), abstractlogger.NoopLogger, &ws.DefaultHTTPUpgrader) server := httptest.NewServer(handler) defer server.Close() addr := server.Listener.Addr().String() httpAddr := fmt.Sprintf("http://%s", addr) wsAddr := fmt.Sprintf("ws://%s", addr) t.Run("http", func(t *testing.T) { t.Run("should return 400 Bad Request when query does not fit to schema", func(t *testing.T) { requestBodyBytes := starwars.InvalidQueryRequestBody(t) req, err := http.NewRequest(http.MethodPost, httpAddr, bytes.NewBuffer(requestBodyBytes)) require.NoError(t, err) client := http.Client{} resp, err := client.Do(req) require.NoError(t, err) assert.Equal(t, http.StatusBadRequest, resp.StatusCode) }) t.Run("should successfully handle query and return 200 OK", func(t *testing.T) { starWarsCases := []starwars.TestCase{ { Name: "simple hero query", RequestBody: starwars.LoadQuery(t, starwars.FileSimpleHeroQuery, nil), }, { Name: "droid query with argument and variable", RequestBody: starwars.LoadQuery(t, starwars.FileDroidWithArgAndVarQuery, starwars.QueryVariables{"droidID": "2000"}), }, { Name: "hero with aliases query", RequestBody: starwars.LoadQuery(t, starwars.FileHeroWithAliasesQuery, nil), }, { Name: "fragments query", RequestBody: starwars.LoadQuery(t, starwars.FileFragmentsQuery, starwars.QueryVariables{"droidID": "2000"}), }, { Name: "hero with operation name query", RequestBody: starwars.LoadQuery(t, starwars.FileHeroWithOperationNameQuery, nil), }, { Name: "directives include query", RequestBody: starwars.LoadQuery(t, starwars.FileDirectivesIncludeQuery, starwars.QueryVariables{"withFriends": true}), }, { Name: "directives skip query", RequestBody: starwars.LoadQuery(t, starwars.FileDirectivesSkipQuery, starwars.QueryVariables{"skipFriends": true}), }, { Name: "create review mutation", RequestBody: starwars.LoadQuery(t, starwars.FileCreateReviewMutation, starwars.QueryVariables{"ep": "JEDI", "review": starwars.ReviewInput()}), }, { Name: "inline fragments query", RequestBody: starwars.LoadQuery(t, starwars.FileInlineFragmentsQuery, nil), }, { Name: "union query", RequestBody: starwars.LoadQuery(t, starwars.FileUnionQuery, starwars.QueryVariables{"name": "Han Solo"}), }, } for _, testCase := range starWarsCases { testCase := testCase t.Run(testCase.Name, func(t *testing.T) { requestBodyBytes := testCase.RequestBody req, err := http.NewRequest(http.MethodPost, httpAddr, bytes.NewBuffer(requestBodyBytes)) require.NoError(t, err) client := http.Client{} resp, err := client.Do(req) require.NoError(t, err) responseBodyBytes, err := ioutil.ReadAll(resp.Body) require.NoError(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) assert.Contains(t, resp.Header.Get(httpHeaderContentType), httpContentTypeApplicationJson) assert.Equal(t, `{"data":null}`, string(responseBodyBytes)) }) } }) }) t.Run("websockets", func(t *testing.T) { var clientConn net.Conn defer func() { err := clientConn.Close() require.NoError(t, err) }() ctx, cancelFunc := context.WithCancel(context.Background()) t.Run("should upgrade to websocket and establish connection successfully", func(t *testing.T) { var err error clientConn, _, _, err = ws.Dial(ctx, wsAddr) assert.NoError(t, err) initialClientMessage := subscription.Message{ Id: "", Type: subscription.MessageTypeConnectionInit, Payload: nil, } sendMessageToServer(t, clientConn, initialClientMessage) serverMessage := readMessageFromServer(t, clientConn) assert.Equal(t, `{"id":"","type":"connection_ack","payload":null}`, string(serverMessage)) }) t.Run("should successfully start a subscription", func(t *testing.T) { startSubscriptionMessage := subscription.Message{ Id: "1", Type: subscription.MessageTypeStart, Payload: starwars.LoadQuery(t, starwars.FileRemainingJedisSubscription, nil), } sendMessageToServer(t, clientConn, startSubscriptionMessage) serverMessage := readMessageFromServer(t, clientConn) assert.Equal(t, `{"id":"1","type":"data","payload":{"data":null}}`, string(serverMessage)) }) cancelFunc() }) }
explode_data.jsonl/75426
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1859 }
[ 2830, 3393, 88637, 63765, 3050, 1098, 5852, 9230, 1155, 353, 8840, 836, 8, 341, 197, 11870, 86, 1561, 4202, 28442, 1820, 1249, 12699, 98970, 13100, 17409, 11870, 86, 1561, 5130, 53326, 1669, 1532, 11212, 1470, 9230, 3050, 9626, 5895, 277,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewTraceExporter(t *testing.T) { me, err := NewTraceProcessor(testCfg, exportertest.NewNopTraceExporter(), newTestTProcessor(nil)) require.NoError(t, err) assert.NoError(t, me.Start(context.Background(), componenttest.NewNopHost())) assert.NoError(t, me.ConsumeTraces(context.Background(), testdata.GenerateTraceDataEmpty())) assert.NoError(t, me.Shutdown(context.Background())) }
explode_data.jsonl/4011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 3564, 6550, 88025, 1155, 353, 8840, 836, 8, 341, 49294, 11, 1848, 1669, 1532, 6550, 22946, 8623, 42467, 11, 7485, 83386, 7121, 45, 453, 6550, 88025, 1507, 501, 2271, 51, 22946, 27907, 1171, 17957, 35699, 1155, 11, 1848, 692,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGenerateSignature(t *testing.T) { signatures := SignaturesConfig{Signatures: []string{"some_token"}} bundle := Bundle{ Data: map[string]interface{}{ "foo": map[string]interface{}{ "bar": []interface{}{json.Number("1"), json.Number("2"), json.Number("3")}, "baz": true, "qux": "hello", }, }, Modules: []ModuleFile{ { URL: "/foo/corge/corge.rego", Path: "/foo/corge/corge.rego", Parsed: ast.MustParseModule(`package foo.corge`), Raw: []byte("package foo.corge\n"), }, }, Wasm: []byte("modules-compiled-as-wasm-binary"), Manifest: Manifest{ Revision: "quickbrownfaux", }, Signatures: signatures, } sc := NewSigningConfig("secret", "HS256", "") err := bundle.GenerateSignature(sc, "", false) if err != nil { t.Fatal("Unexpected error:", err) } if reflect.DeepEqual(signatures, bundle.Signatures) { t.Fatal("Expected signatures to be different") } current := bundle.Signatures err = bundle.GenerateSignature(sc, "", false) if err != nil { t.Fatal("Unexpected error:", err) } if !reflect.DeepEqual(current, bundle.Signatures) { t.Fatal("Expected signatures to be same") } }
explode_data.jsonl/55383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 482 }
[ 2830, 3393, 31115, 25088, 1155, 353, 8840, 836, 8, 341, 69054, 2789, 1669, 7075, 2789, 2648, 90, 7264, 2789, 25, 3056, 917, 4913, 14689, 6458, 9207, 630, 2233, 4206, 1669, 13182, 515, 197, 40927, 25, 2415, 14032, 31344, 67066, 298, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestValidateAS(t *testing.T) { testF := cppki.ValidateAS goldenCert := "cp-as.crt" if *update { out, err := updateCert(goldenCert) require.NoError(t, err, string(out)) t.Logf("git add ./testdata/%s", goldenCert) return } testCases := map[string]testCase{ "invalid keyUsage CertSign is set": { modify: func(c *x509.Certificate) *x509.Certificate { t := c.KeyUsage | x509.KeyUsageCertSign c.KeyUsage = t return c }, assertErr: assert.Error, }, "invalid keyUsage no digitalSignature": { modify: func(c *x509.Certificate) *x509.Certificate { t := c.KeyUsage &^ x509.KeyUsageDigitalSignature c.KeyUsage = t return c }, assertErr: assert.Error, }, "invalid ExtKeyUsage id-kp-timeStamping is not set": { modify: func(c *x509.Certificate) *x509.Certificate { m := []x509.ExtKeyUsage{} for _, v := range c.ExtKeyUsage { if v == x509.ExtKeyUsageTimeStamping { continue } m = append(m, v) } c.ExtKeyUsage = m return c }, assertErr: assert.Error, }, "invalid BasicConstraints is present": { modify: func(c *x509.Certificate) *x509.Certificate { c.BasicConstraintsValid = true c.IsCA = true add := pkix.Extension{Id: asn1.ObjectIdentifier{2, 5, 29, 19}} c.Extensions = append(c.Extensions, add) return c }, assertErr: assert.Error, }, "invalid no valid IA": { modify: func(c *x509.Certificate) *x509.Certificate { v := []pkix.AttributeTypeAndValue{ {Type: cppki.OIDNameIA}, } for _, name := range c.Issuer.Names { if name.Type.Equal(cppki.OIDNameIA) { continue } v = append(v, name) } c.Issuer.Names = v return c }, assertErr: assert.Error, }, "invalid AuthorityKeyId is no present": { modify: func(c *x509.Certificate) *x509.Certificate { c.AuthorityKeyId = []byte{} return c }, assertErr: assert.Error, }, } for k, v := range generalCases { testCases[k] = v } for name, tc := range testCases { name, tc := name, tc t.Run(name, func(t *testing.T) { t.Parallel() validCert, err := cppki.ReadPEMCerts(filepath.Join("./testdata", goldenCert)) require.NoError(t, err) input := tc.modify(validCert[0]) err = testF(input) tc.assertErr(t, err) }) } }
explode_data.jsonl/9851
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1072 }
[ 2830, 3393, 17926, 1911, 1155, 353, 8840, 836, 8, 341, 18185, 37, 1669, 46824, 6642, 47667, 1911, 198, 3174, 813, 268, 36934, 1669, 330, 4672, 32434, 93869, 1837, 743, 353, 2386, 341, 197, 13967, 11, 1848, 1669, 2647, 36934, 3268, 813, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFeedbackEncoding(t *testing.T) { t.Parallel() hist := NewHistogram(0, 0, 0, 0, types.NewFieldType(mysql.TypeLong), 0, 0) q := &QueryFeedback{Hist: hist, Tp: PkType} q.Feedback = append(q.Feedback, Feedback{encodeInt(0), encodeInt(3), 1, 0, 1}) q.Feedback = append(q.Feedback, Feedback{encodeInt(0), encodeInt(5), 1, 0, 1}) val, err := EncodeFeedback(q) require.NoError(t, err) rq := &QueryFeedback{} require.NoError(t, DecodeFeedback(val, rq, nil, nil, hist.Tp)) for _, fb := range rq.Feedback { fb.Lower.SetBytes(codec.EncodeInt(nil, fb.Lower.GetInt64())) fb.Upper.SetBytes(codec.EncodeInt(nil, fb.Upper.GetInt64())) } require.True(t, q.Equal(rq)) hist.Tp = types.NewFieldType(mysql.TypeBlob) q = &QueryFeedback{Hist: hist} q.Feedback = append(q.Feedback, Feedback{encodeInt(0), encodeInt(3), 1, 0, 1}) q.Feedback = append(q.Feedback, Feedback{encodeInt(0), encodeInt(1), 1, 0, 1}) val, err = EncodeFeedback(q) require.NoError(t, err) rq = &QueryFeedback{} cms := NewCMSketch(4, 4) require.NoError(t, DecodeFeedback(val, rq, cms, nil, hist.Tp)) require.Equal(t, uint64(1), cms.QueryBytes(codec.EncodeInt(nil, 0))) q.Feedback = q.Feedback[:1] require.True(t, q.Equal(rq)) }
explode_data.jsonl/22098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 537 }
[ 2830, 3393, 35348, 14690, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 9598, 380, 1669, 1532, 77210, 7, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 4494, 7121, 63733, 41546, 10184, 6583, 701, 220, 15, 11, 220, 15, 340,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStepInstructionNoGoroutine(t *testing.T) { protest.AllowRecording(t) withTestProcess("increment", t, func(p *proc.Target, fixture protest.Fixture) { // Call StepInstruction immediately after launching the program, it should // work even though no goroutine is selected. assertNoError(p.StepInstruction(), t, "StepInstruction") }) }
explode_data.jsonl/56290
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 8304, 16664, 2753, 38, 269, 14159, 1155, 353, 8840, 836, 8, 341, 197, 776, 1944, 29081, 52856, 1155, 340, 46948, 2271, 7423, 445, 35744, 497, 259, 11, 2915, 1295, 353, 15782, 35016, 11, 12507, 8665, 991, 12735, 8, 341, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetFlagBeforeParse(t *testing.T) { testCases := []struct { name string flag string args []string expectedResult string }{ { name: "Correct result for short form of the flag (no conflict with '-c' suffix of the argument value)", flag: "config", args: []string{"secret-c", "--profile", "testprofile", "-c", "some_config_value"}, expectedResult: "some_config_value", }, { name: "Correct result for the config flag in the beginning of the args", flag: "config", args: []string{"-c", "some_config_value", "another_arg"}, expectedResult: "some_config_value", }, { name: "Correct result for short form of the flag (no conflict with '-c' suffix of the argument " + "value). With '=' symbol.", flag: "config", args: []string{"secret-c", "--profile", "testprofile", "-c=some_config_value"}, expectedResult: "some_config_value", }, { name: "Correct result for the config flag in the beginning of the args. With '=' symbol.", flag: "config", args: []string{"-c=some_config_value", "another_arg"}, expectedResult: "some_config_value", }, // long form of the flag { name: "Long form of the flag. Correct result for short form of the flag (no conflict with '--config' suffix of the argument value)", flag: "config", args: []string{"secret--config", "--profile", "testprofile", "--config", "some_config_value"}, expectedResult: "some_config_value", }, { name: "Long form of the flag. Correct result for the config flag in the beginning of the args", flag: "config", args: []string{"--config", "some_config_value", "another_arg"}, expectedResult: "some_config_value", }, { name: "Long form of the flag. Correct result for short form of the flag (no conflict with '--config' " + "suffix of the argument value). With '=' symbol.", flag: "config", args: []string{"secret--config", "--profile", "testprofile", "--config=some_config_value"}, expectedResult: "some_config_value", }, { name: "Long form of the flag. Correct result for the config flag in the beginning of the args. " + "With '=' symbol.", flag: "config", args: []string{"--config=some_config_value", "another_arg"}, expectedResult: "some_config_value", }, } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { flagValue := GetFlagBeforeParse(testCase.flag, testCase.args) assert.Equal(t, testCase.expectedResult, flagValue) }) } }
explode_data.jsonl/5833
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1120 }
[ 2830, 3393, 1949, 12135, 10227, 14463, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 30589, 1843, 914, 198, 197, 31215, 1843, 3056, 917, 198, 197, 42400, 2077, 914, 198, 197, 92, 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 TestReportWriter_JSON(t *testing.T) { testCases := []struct { name string detectedVulns []types.DetectedVulnerability expectedJSON report.Results }{ { name: "happy path", detectedVulns: []types.DetectedVulnerability{ { VulnerabilityID: "123", PkgName: "foo", InstalledVersion: "1.2.3", FixedVersion: "3.4.5", Vulnerability: dbTypes.Vulnerability{ Title: "foobar", Description: "baz", Severity: "HIGH", }, }, }, expectedJSON: report.Results{ report.Result{ Target: "foojson", Vulnerabilities: []types.DetectedVulnerability{ { VulnerabilityID: "123", PkgName: "foo", InstalledVersion: "1.2.3", FixedVersion: "3.4.5", Vulnerability: dbTypes.Vulnerability{ Title: "foobar", Description: "baz", Severity: "HIGH", }, }, }, }, }, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { jw := report.JsonWriter{} jsonWritten := bytes.Buffer{} jw.Output = &jsonWritten inputResults := report.Results{ { Target: "foojson", Vulnerabilities: tc.detectedVulns, }, } assert.NoError(t, report.WriteResults("json", &jsonWritten, nil, inputResults, "", false), tc.name) writtenResults := report.Results{} errJson := json.Unmarshal([]byte(jsonWritten.String()), &writtenResults) assert.NoError(t, errJson, "invalid json written", tc.name) assert.Equal(t, tc.expectedJSON, writtenResults, tc.name) }) } }
explode_data.jsonl/5385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 782 }
[ 2830, 3393, 10361, 6492, 25356, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 2698, 295, 1569, 53, 360, 4412, 3056, 9242, 909, 295, 1569, 53, 58401, 2897, 198, 197, 42400, 5370, 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
func TestTCPPeer(t *testing.T) { var params = []testParam{ { numPeers: 20, numParticipants: 20, stopHeight: 5, expectedLatency: 100 * time.Millisecond, }, { numPeers: 20, numParticipants: 20, stopHeight: 5, expectedLatency: 200 * time.Millisecond, }, { numPeers: 20, numParticipants: 20, stopHeight: 5, expectedLatency: 300 * time.Millisecond, }, { numPeers: 20, numParticipants: 20, stopHeight: 5, expectedLatency: 500 * time.Millisecond, }, { numPeers: 20, numParticipants: 20, stopHeight: 5, expectedLatency: 1000 * time.Millisecond, }, } for i := 0; i < len(params); i++ { t.Logf("-=-=- TESTING CASE: [%v/%v] -=-=-", i+1, len(params)) testConsensus(t, &params[i]) } }
explode_data.jsonl/77740
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 418 }
[ 2830, 3393, 7749, 4406, 34756, 1155, 353, 8840, 836, 8, 341, 2405, 3628, 284, 3056, 1944, 2001, 515, 197, 197, 515, 298, 22431, 10197, 388, 25, 286, 220, 17, 15, 345, 298, 22431, 77546, 25, 220, 17, 15, 345, 298, 62644, 3640, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCheck(t *testing.T) { var resp *http.Response var err error if resp, err = HelperReq("do", testStr); err != nil { t.Fatal(err) } if resp, err = HelperReq("check", testStr); err != nil { t.Fatal(err) } var buf []byte if buf,err = ioutil.ReadAll(resp.Body); err != nil { t.Fatal(err) } if resp.StatusCode != http.StatusOK { t.Fatalf("status: %v, body: %s", resp.Status, buf) } if !reflect.DeepEqual([]byte(wantCheck), buf) { t.Fatalf("not matched,\n want: %v,\n have: %s\n",wantCheck, buf) } }
explode_data.jsonl/22915
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 3973, 1155, 353, 8840, 836, 8, 341, 2405, 9039, 353, 1254, 12574, 198, 2405, 1848, 1465, 271, 743, 9039, 11, 1848, 284, 12906, 27234, 445, 2982, 497, 1273, 2580, 1215, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestError(t *testing.T) { cases := []struct { name, hex, err string }{{ "empty", "", "read aarp header: EOF", }} for _, c := range cases { t.Run(c.name, func(t *testing.T) { assert := assert.New(t) p := Packet{} err := Unmarshal(unhex(c.hex), &p) if assert.Error(err) { assert.Equal(c.err, err.Error()) } }) } }
explode_data.jsonl/6230
{ "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, 1454, 1155, 353, 8840, 836, 8, 1476, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 11, 12371, 11, 1848, 914, 198, 197, 15170, 515, 197, 197, 1, 3194, 756, 197, 197, 39680, 197, 197, 1, 878, 264, 7876, 4247, 25, 29457, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmarshalValidatorKey(t *testing.T) { assert, require := assert.New(t), require.New(t) // create some fixed values privKey := ed25519.GenPrivKey() pubKey := privKey.PubKey() addr := pubKey.Address() pubBytes := pubKey.Bytes() privBytes := privKey.Bytes() pubB64 := base64.StdEncoding.EncodeToString(pubBytes) privB64 := base64.StdEncoding.EncodeToString(privBytes) serialized := fmt.Sprintf(`{ "address": "%s", "pub_key": { "type": "ostracon/PubKeyEd25519", "value": "%s" }, "priv_key": { "type": "ostracon/PrivKeyEd25519", "value": "%s" } }`, addr, pubB64, privB64) val := FilePVKey{} err := tmjson.Unmarshal([]byte(serialized), &val) require.Nil(err, "%+v", err) // make sure the values match assert.EqualValues(addr, val.Address) assert.EqualValues(pubKey, val.PubKey) assert.EqualValues(privKey, val.PrivKey) // export it and make sure it is the same out, err := tmjson.Marshal(val) require.Nil(err, "%+v", err) assert.JSONEq(serialized, string(out)) }
explode_data.jsonl/30346
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 1806, 27121, 14256, 1592, 1155, 353, 8840, 836, 8, 341, 6948, 11, 1373, 1669, 2060, 7121, 1155, 701, 1373, 7121, 1155, 692, 197, 322, 1855, 1045, 8356, 2750, 198, 71170, 1592, 1669, 1578, 17, 20, 20, 16, 24, 65384, 32124, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEntry_Submit(t *testing.T) { t.Run("Callback", func(t *testing.T) { var submission string entry := &widget.Entry{ OnSubmitted: func(s string) { submission = s }, } t.Run("SingleLine_Enter", func(t *testing.T) { entry.MultiLine = false entry.SetText("a") entry.TypedKey(&fyne.KeyEvent{Name: fyne.KeyEnter}) assert.Equal(t, "a", entry.Text) assert.Equal(t, "a", submission) }) t.Run("SingleLine_Return", func(t *testing.T) { entry.MultiLine = false entry.SetText("b") entry.TypedKey(&fyne.KeyEvent{Name: fyne.KeyReturn}) assert.Equal(t, "b", entry.Text) assert.Equal(t, "b", submission) }) t.Run("MultiLine_ShiftEnter", func(t *testing.T) { entry.MultiLine = true entry.SetText("c") typeKeys(entry, keyShiftLeftDown, fyne.KeyReturn, keyShiftLeftUp) assert.Equal(t, "c", entry.Text) assert.Equal(t, "c", submission) entry.SetText("d") typeKeys(entry, keyShiftRightDown, fyne.KeyReturn, keyShiftRightUp) assert.Equal(t, "d", entry.Text) assert.Equal(t, "d", submission) }) t.Run("MultiLine_ShiftReturn", func(t *testing.T) { entry.MultiLine = true entry.SetText("e") typeKeys(entry, keyShiftLeftDown, fyne.KeyReturn, keyShiftLeftUp) assert.Equal(t, "e", entry.Text) assert.Equal(t, "e", submission) entry.SetText("f") typeKeys(entry, keyShiftRightDown, fyne.KeyReturn, keyShiftRightUp) assert.Equal(t, "f", entry.Text) assert.Equal(t, "f", submission) }) }) t.Run("NoCallback", func(t *testing.T) { entry := &widget.Entry{} t.Run("SingleLine_Enter", func(t *testing.T) { entry.MultiLine = false entry.SetText("a") entry.TypedKey(&fyne.KeyEvent{Name: fyne.KeyEnter}) assert.Equal(t, "a", entry.Text) }) t.Run("SingleLine_Return", func(t *testing.T) { entry.MultiLine = false entry.SetText("b") entry.TypedKey(&fyne.KeyEvent{Name: fyne.KeyReturn}) assert.Equal(t, "b", entry.Text) }) t.Run("MultiLine_ShiftEnter", func(t *testing.T) { entry.MultiLine = true entry.SetText("c") typeKeys(entry, keyShiftLeftDown, fyne.KeyReturn, keyShiftLeftUp) assert.Equal(t, "\nc", entry.Text) entry.SetText("d") typeKeys(entry, keyShiftRightDown, fyne.KeyReturn, keyShiftRightUp) assert.Equal(t, "\nd", entry.Text) }) t.Run("MultiLine_ShiftReturn", func(t *testing.T) { entry.MultiLine = true entry.SetText("e") typeKeys(entry, keyShiftLeftDown, fyne.KeyReturn, keyShiftLeftUp) assert.Equal(t, "\ne", entry.Text) entry.SetText("f") typeKeys(entry, keyShiftRightDown, fyne.KeyReturn, keyShiftRightUp) assert.Equal(t, "\nf", entry.Text) }) }) }
explode_data.jsonl/12373
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1140 }
[ 2830, 3393, 5874, 36359, 1763, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 7494, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2405, 20503, 914, 198, 197, 48344, 1669, 609, 9797, 22330, 515, 298, 86391, 46541, 25, 2915, 1141, 914,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAccDataSourceImage_basic(t *testing.T) { imageName := "CentOS 7" config := testAccDataSourceImageConfig_basic(imageName) resourceName := "data.ecloud_image.test-image" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { Config: config, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", imageName), ), }, }, }) }
explode_data.jsonl/52683
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 14603, 17173, 1906, 34729, 1155, 353, 8840, 836, 8, 341, 31426, 675, 1669, 330, 22233, 3126, 220, 22, 698, 25873, 1669, 1273, 14603, 17173, 1906, 2648, 34729, 10075, 675, 340, 50346, 675, 1669, 330, 691, 1734, 12361, 4954, 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 TestUntarPathWithInvalidDest(t *testing.T) { tempFolder, err := os.MkdirTemp("", "docker-archive-test") assert.NilError(t, err) defer os.RemoveAll(tempFolder) invalidDestFolder := filepath.Join(tempFolder, "invalidDest") // Create a src file srcFile := filepath.Join(tempFolder, "src") tarFile := filepath.Join(tempFolder, "src.tar") os.Create(srcFile) os.Create(invalidDestFolder) // being a file (not dir) should cause an error // Translate back to Unix semantics as next exec.Command is run under sh srcFileU := srcFile tarFileU := tarFile if runtime.GOOS == "windows" { tarFileU = "/tmp/" + filepath.Base(filepath.Dir(tarFile)) + "/src.tar" srcFileU = "/tmp/" + filepath.Base(filepath.Dir(srcFile)) + "/src" } cmd := exec.Command("sh", "-c", "tar cf "+tarFileU+" "+srcFileU) _, err = cmd.CombinedOutput() assert.NilError(t, err) err = defaultUntarPath(tarFile, invalidDestFolder) if err == nil { t.Fatalf("UntarPath with invalid destination path should throw an error.") } }
explode_data.jsonl/79236
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 361 }
[ 2830, 3393, 20250, 277, 1820, 2354, 7928, 34830, 1155, 353, 8840, 836, 8, 341, 16280, 13682, 11, 1848, 1669, 2643, 1321, 12438, 12151, 19814, 330, 28648, 95100, 16839, 1138, 6948, 59678, 1454, 1155, 11, 1848, 340, 16867, 2643, 84427, 9758...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEth_EstimateGas(t *testing.T) { param := make([]map[string]string, 1) param[0] = make(map[string]string) param[0]["from"] = "0x" + fmt.Sprintf("%x", from) param[0]["to"] = "0x1122334455667788990011223344556677889900" param[0]["value"] = "0x1" param[0]["gas"] = "0x5209" rpcRes := call(t, "eth_estimateGas", param) require.NotNil(t, rpcRes) require.Equal(t, rpcRes.Result, "0x5208") var gas string err := json.Unmarshal(rpcRes.Result, &gas) require.NoError(t, err, string(rpcRes.Result)) require.Equal(t, "0xf552", gas) }
explode_data.jsonl/864
{ "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, 65390, 2089, 267, 3426, 58728, 1155, 353, 8840, 836, 8, 341, 36037, 1669, 1281, 10556, 2186, 14032, 30953, 11, 220, 16, 340, 36037, 58, 15, 60, 284, 1281, 9147, 14032, 30953, 340, 36037, 58, 15, 9868, 1499, 1341, 284, 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 TestUploadByteSlicePool(t *testing.T) { cases := map[string]struct { PartSize int64 FileSize int64 Concurrency int ExAllocations uint64 }{ "single part, single concurrency": { PartSize: sdkio.MebiByte * 5, FileSize: sdkio.MebiByte * 5, ExAllocations: 2, Concurrency: 1, }, "multi-part, single concurrency": { PartSize: sdkio.MebiByte * 5, FileSize: sdkio.MebiByte * 10, ExAllocations: 2, Concurrency: 1, }, "multi-part, multiple concurrency": { PartSize: sdkio.MebiByte * 5, FileSize: sdkio.MebiByte * 20, ExAllocations: 3, Concurrency: 2, }, } for name, tt := range cases { t.Run(name, func(t *testing.T) { var p *recordedPartPool unswap := swapByteSlicePool(func(sliceSize int64) byteSlicePool { p = newRecordedPartPool(sliceSize) return p }) defer unswap() client, _, _ := s3testing.NewUploadLoggingClient(nil) uploader := NewUploader(client, func(u *Uploader) { u.PartSize = tt.PartSize u.Concurrency = tt.Concurrency }) expected := s3testing.GetTestBytes(int(tt.FileSize)) _, err := uploader.Upload(context.Background(), &s3.PutObjectInput{ Bucket: aws.String("bucket"), Key: aws.String("key"), Body: &testReader{br: bytes.NewReader(expected)}, }) if err != nil { t.Errorf("expected no error, but got %v", err) } if v := atomic.LoadInt64(&p.recordedOutstanding); v != 0 { t.Fatalf("expected zero outsnatding pool parts, got %d", v) } gets, allocs := atomic.LoadUint64(&p.recordedGets), atomic.LoadUint64(&p.recordedAllocs) t.Logf("total gets %v, total allocations %v", gets, allocs) if e, a := tt.ExAllocations, allocs; a > e { t.Errorf("expected %v allocations, got %v", e, a) } }) } }
explode_data.jsonl/73208
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 817 }
[ 2830, 3393, 13844, 7153, 33236, 10551, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 2415, 14032, 60, 1235, 341, 197, 197, 5800, 1695, 414, 526, 21, 19, 198, 197, 24848, 1695, 414, 526, 21, 19, 198, 197, 197, 79611, 256, 526, 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 TestVideoAnalyzerIDFormatter(t *testing.T) { actual := NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "resGroup1", "analyzer1").ID() expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Media/videoAnalyzers/analyzer1" if actual != expected { t.Fatalf("Expected %q but got %q", expected, actual) } }
explode_data.jsonl/66127
{ "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, 10724, 54911, 915, 14183, 1155, 353, 8840, 836, 8, 341, 88814, 1669, 1532, 10724, 54911, 915, 445, 16, 17, 18, 19, 20, 21, 22, 23, 12, 16, 17, 18, 19, 12, 24, 23, 22, 21, 12, 19, 20, 21, 18, 12, 16, 17, 18, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIntegrationsListAwsCfg(t *testing.T) { var ( intgGUIDs = []string{intgguid.New(), intgguid.New(), intgguid.New()} fakeServer = lacework.MockServer() ) fakeServer.MockAPI("external/integrations/type/AWS_CFG", func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, "GET", r.Method, "ListAwsCfg should be a GET method") fmt.Fprintf(w, awsMultiIntegrationJsonResponse(intgGUIDs)) }, ) defer fakeServer.Close() c, err := api.NewClient("test", api.WithToken("TOKEN"), api.WithURL(fakeServer.URL()), ) assert.Nil(t, err) response, err := c.Integrations.ListAwsCfg() assert.Nil(t, err) assert.NotNil(t, response) assert.True(t, response.Ok) assert.Equal(t, len(intgGUIDs), len(response.Data)) for _, d := range response.Data { assert.Contains(t, intgGUIDs, d.IntgGuid) } }
explode_data.jsonl/81119
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 349 }
[ 2830, 3393, 1072, 14412, 804, 852, 47359, 42467, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 2084, 70, 41778, 82, 220, 284, 3056, 917, 90, 396, 14398, 2423, 7121, 1507, 526, 14398, 2423, 7121, 1507, 526, 14398, 2423, 7121, 23509, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSelector(t *testing.T) { srvs := []string{"127.0.0.1:9876", "127.0.0.1:9879", "12.24.123.243:10911", "12.24.123.243:10915"} namesrv, err := NewNamesrv(primitive.NewPassthroughResolver(srvs)) assert.Nil(t, err) assert.Equal(t, srvs[0], namesrv.getNameServerAddress()) assert.Equal(t, srvs[1], namesrv.getNameServerAddress()) assert.Equal(t, srvs[2], namesrv.getNameServerAddress()) assert.Equal(t, srvs[3], namesrv.getNameServerAddress()) assert.Equal(t, srvs[0], namesrv.getNameServerAddress()) assert.Equal(t, srvs[1], namesrv.getNameServerAddress()) assert.Equal(t, srvs[2], namesrv.getNameServerAddress()) assert.Equal(t, srvs[3], namesrv.getNameServerAddress()) assert.Equal(t, srvs[0], namesrv.getNameServerAddress()) }
explode_data.jsonl/49160
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 5877, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 82, 1669, 3056, 917, 4913, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 24, 23, 22, 21, 497, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 24, 23, 22, 24, 497, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAPI_UnixSocket(t *testing.T) { t.Parallel() if runtime.GOOS == "windows" { t.SkipNow() } tempDir := testutil.TempDir(t, "consul") defer os.RemoveAll(tempDir) socket := filepath.Join(tempDir, "test.sock") c, s := makeClientWithConfig(t, func(c *Config) { c.Address = "unix://" + socket }, func(c *testutil.TestServerConfig) { c.Addresses = &testutil.TestAddressConfig{ HTTP: "unix://" + socket, } }) defer s.Stop() agent := c.Agent() info, err := agent.Self() if err != nil { t.Fatalf("err: %s", err) } if info["Config"]["NodeName"].(string) == "" { t.Fatalf("bad: %v", info) } }
explode_data.jsonl/44944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 7082, 40687, 941, 10286, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 3244, 57776, 7039, 741, 197, 630, 16280, 6184, 1669, 1273, 1314, 65009, 6184, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAddIPCommand(t *testing.T) { config, c, app := testutil.BaseTestAuthSetup(t, false, commands) config.When("GetVirtualMachine").Return(defVM) vm := pathers.VirtualMachineName{VirtualMachine: "test-server", GroupName: pathers.GroupName{Group: "default", Account: "default-account"}} ipcr := brain.IPCreateRequest{ Addresses: 1, Family: "ipv4", Reason: "testing", Contiguous: false, } ip := net.ParseIP("10.10.10.10") ipcres := ipcr ipcres.IPs = []net.IP{ip} c.When("AddIP", vm, ipcr).Return(&ipcres, nil) err := app.Run(strings.Split("bytemark add ip --reason testing test-server", " ")) if err != nil { t.Error(err) } if ok, err := c.Verify(); !ok { t.Fatal(err) } }
explode_data.jsonl/26279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 290 }
[ 2830, 3393, 2212, 3298, 4062, 1155, 353, 8840, 836, 8, 341, 25873, 11, 272, 11, 906, 1669, 1273, 1314, 13018, 2271, 5087, 21821, 1155, 11, 895, 11, 11293, 692, 25873, 50761, 445, 1949, 33026, 21605, 1827, 5598, 21246, 11187, 692, 54879,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWholeChainSeek(t *testing.T) { m := newMockD() defer close(m.recvChan) ds := initializeDeliverHandler() go ds.Handle(m) m.recvChan <- makeSeek(systemChainID, &ab.SeekInfo{Start: seekOldest, Stop: seekNewest, Behavior: ab.SeekInfo_BLOCK_UNTIL_READY}) count := uint64(0) for { select { case deliverReply := <-m.sendChan: if deliverReply.GetBlock() == nil { if deliverReply.GetStatus() != cb.Status_SUCCESS { t.Fatalf("Received an error on the reply channel") } if count != ledgerSize { t.Fatalf("Expected %d blocks but got %d", ledgerSize, count) } return } if deliverReply.GetBlock().Header.Number != count { t.Fatalf("Expected block %d but got block %d", count, deliverReply.GetBlock().Header.Number) } case <-time.After(time.Second): t.Fatalf("Timed out waiting to get all blocks") } count++ } }
explode_data.jsonl/36257
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 355 }
[ 2830, 3393, 90582, 18837, 39350, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 501, 11571, 35, 741, 16867, 3265, 1255, 40433, 46019, 692, 83336, 1669, 9468, 16532, 1524, 3050, 741, 30680, 11472, 31421, 1255, 692, 2109, 40433, 46019, 9119, 128...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetChannelUnread(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client user := th.BasicUser channel := th.BasicChannel channelUnread, resp := Client.GetChannelUnread(channel.Id, user.Id) CheckNoError(t, resp) if channelUnread.TeamId != th.BasicTeam.Id { t.Fatal("wrong team id returned for a regular user call") } else if channelUnread.ChannelId != channel.Id { t.Fatal("wrong team id returned for a regular user call") } _, resp = Client.GetChannelUnread("junk", user.Id) CheckBadRequestStatus(t, resp) _, resp = Client.GetChannelUnread(channel.Id, "junk") CheckBadRequestStatus(t, resp) _, resp = Client.GetChannelUnread(channel.Id, model.NewId()) CheckForbiddenStatus(t, resp) _, resp = Client.GetChannelUnread(model.NewId(), user.Id) CheckForbiddenStatus(t, resp) newUser := th.CreateUser() Client.Login(newUser.Email, newUser.Password) _, resp = Client.GetChannelUnread(th.BasicChannel.Id, user.Id) CheckForbiddenStatus(t, resp) Client.Logout() _, resp = th.SystemAdminClient.GetChannelUnread(channel.Id, user.Id) CheckNoError(t, resp) _, resp = th.SystemAdminClient.GetChannelUnread(model.NewId(), user.Id) CheckForbiddenStatus(t, resp) _, resp = th.SystemAdminClient.GetChannelUnread(channel.Id, model.NewId()) CheckNotFoundStatus(t, resp) }
explode_data.jsonl/65662
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 473 }
[ 2830, 3393, 1949, 9629, 1806, 878, 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, 19060, 1669, 270, 48868, 1474, 198, 7155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExpBackoff(t *testing.T) { tests := []struct { last time.Duration max time.Duration next time.Duration }{ {1 * time.Second, 10 * time.Second, 2 * time.Second}, {8 * time.Second, 10 * time.Second, 10 * time.Second}, {10 * time.Second, 10 * time.Second, 10 * time.Second}, {20 * time.Second, 10 * time.Second, 10 * time.Second}, } for i, tt := range tests { next := ExpBackoff(tt.last, tt.max) if next != tt.next { t.Errorf("case %d: last=%v, max=%v, next=%v; got next=%v", i, tt.last, tt.max, tt.next, next) } } }
explode_data.jsonl/16997
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 8033, 3707, 1847, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 33096, 882, 33795, 198, 197, 22543, 220, 882, 33795, 198, 197, 28144, 882, 33795, 198, 197, 59403, 197, 197, 90, 16, 353, 882, 32435, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestUpdate_Run(t *testing.T) { ctrl := gomock.NewController(t) mockStore := mocks.NewMockProjectInvitationUpdater(ctrl) defer ctrl.Finish() expected := &atlas.Invitation{} updateOpts := &UpdateOpts{ roles: []string{"test"}, store: mockStore, GlobalOpts: cli.GlobalOpts{OrgID: "1"}, } mockStore. EXPECT(). UpdateProjectInvitation(updateOpts.ConfigProjectID(), updateOpts.invitationID, updateOpts.newInvitation()). Return(expected, nil). Times(1) if err := updateOpts.Run(); err != nil { t.Fatalf("Run() unexpected error: %v", err) } }
explode_data.jsonl/47887
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 4289, 84158, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 77333, 6093, 1669, 68909, 7121, 11571, 7849, 15174, 7556, 79854, 62100, 340, 16867, 23743, 991, 18176, 2822, 42400, 1669, 609, 266,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRingBuffer(t *testing.T) { buffer := queue.NewRingBuffer(10) wg := sync.WaitGroup{} wg.Add(1) go func() { _, e := buffer.Get() if e == nil { t.Error("dispose error.") } e.Error() wg.Done() }() buffer.Dispose() wg.Wait() buffer = queue.NewRingBuffer(10) buffer.Put(1) _, e := buffer.Get() if e != nil { t.Error("error for get logic.") } if buffer.Len() != 0 { t.Error("error len for buffer.", buffer.Len()) } buffer.Put(1) buffer.Put(2) if buffer.Len() != 2 { t.Error("error len for buffer.", buffer.Len()) } i, e := buffer.Get() if e != nil { t.Error("error for get logic.") } if i.(int) != 1 { t.Error("number should be 1.", i) } i, e = buffer.Get() if e != nil { t.Error("error for get logic.") } if i.(int) != 2 { t.Error("number should be 2.", i) } }
explode_data.jsonl/29297
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 43466, 4095, 1155, 353, 8840, 836, 8, 341, 31122, 1669, 7177, 7121, 43466, 4095, 7, 16, 15, 340, 72079, 1669, 12811, 28384, 2808, 16094, 72079, 1904, 7, 16, 340, 30680, 2915, 368, 341, 197, 197, 6878, 384, 1669, 4147, 2234...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWatchPods(t *testing.T) { fakeWatch := watch.NewFake() c := &fake.Clientset{} c.AddWatchReactor("*", core.DefaultWatchReactor(fakeWatch, nil)) manager := NewReplicationManager(c, controller.NoResyncPeriodFunc, BurstReplicas, 0) manager.podStoreSynced = alwaysReady // Put one rc and one pod into the controller's stores testControllerSpec := newReplicationController(1) manager.rcStore.Store.Add(testControllerSpec) received := make(chan string) // The pod update sent through the fakeWatcher should figure out the managing rc and // send it into the syncHandler. manager.syncHandler = func(key string) error { obj, exists, err := manager.rcStore.Store.GetByKey(key) if !exists || err != nil { t.Errorf("Expected to find controller under key %v", key) } controllerSpec := obj.(*api.ReplicationController) if !api.Semantic.DeepDerivative(controllerSpec, testControllerSpec) { t.Errorf("\nExpected %#v,\nbut got %#v", testControllerSpec, controllerSpec) } close(received) return nil } // Start only the pod watcher and the workqueue, send a watch event, // and make sure it hits the sync method for the right rc. stopCh := make(chan struct{}) defer close(stopCh) go manager.podController.Run(stopCh) go wait.Until(manager.worker, 10*time.Millisecond, stopCh) pods := newPodList(nil, 1, api.PodRunning, testControllerSpec, "pod") testPod := pods.Items[0] testPod.Status.Phase = api.PodFailed fakeWatch.Add(&testPod) select { case <-received: case <-time.After(wait.ForeverTestTimeout): t.Errorf("Expected 1 call but got 0") } }
explode_data.jsonl/37489
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 534 }
[ 2830, 3393, 14247, 23527, 82, 1155, 353, 8840, 836, 8, 341, 1166, 726, 14247, 1669, 3736, 7121, 52317, 741, 1444, 1669, 609, 30570, 11716, 746, 16094, 1444, 1904, 14247, 693, 5621, 29592, 497, 6200, 13275, 14247, 693, 5621, 74138, 14247, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteUser(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() th.LoginBasic() resp, err := th.Client.DeleteUser(th.SystemAdminUser.Id) require.Error(t, err) CheckForbiddenStatus(t, resp) th.Client.Logout() resp, err = th.Client.DeleteUser(th.BasicUser.Id) require.Error(t, err) CheckUnauthorizedStatus(t, resp) th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) { resp, err = c.DeleteUser(model.NewId()) require.Error(t, err) CheckNotFoundStatus(t, resp) resp, err = c.DeleteUser("junk") require.Error(t, err) CheckBadRequestStatus(t, resp) userToDelete := th.CreateUser() _, err = c.DeleteUser(userToDelete.Id) require.NoError(t, err) }) selfDeleteUser := th.CreateUser() th.LoginBasic() resp, err = th.Client.DeleteUser(selfDeleteUser.Id) require.Error(t, err) CheckForbiddenStatus(t, resp) th.Client.Login(selfDeleteUser.Email, selfDeleteUser.Password) th.App.UpdateConfig(func(c *model.Config) { *c.TeamSettings.EnableUserDeactivation = false }) resp, err = th.Client.DeleteUser(selfDeleteUser.Id) require.Error(t, err) CheckUnauthorizedStatus(t, resp) th.App.UpdateConfig(func(c *model.Config) { *c.TeamSettings.EnableUserDeactivation = true }) _, err = th.Client.DeleteUser(selfDeleteUser.Id) require.NoError(t, err) }
explode_data.jsonl/47509
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 510 }
[ 2830, 3393, 6435, 1474, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 70479, 32499, 15944, 741, 34653, 11, 1848, 1669, 270, 11716, 18872, 1474, 24365, 16620, 7210, 1474, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandleError(t *testing.T) { conf, reg := internal.NewFastRegistryWithMocks(t) public, admin := testhelpers.NewKratosServer(t, reg) router := httprouter.New() ts := httptest.NewServer(router) t.Cleanup(ts.Close) testhelpers.NewLoginUIFlowEchoServer(t, reg) testhelpers.NewErrorTestServer(t, reg) h := reg.LoginFlowErrorHandler() sdk := testhelpers.NewSDKClient(admin) var loginFlow *login.Flow var flowError error var ct identity.CredentialsType router.GET("/error", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { h.WriteFlowError(w, r, ct, loginFlow, flowError) }) reset := func() { loginFlow = nil flowError = nil ct = "" } newFlow := func(t *testing.T, ttl time.Duration, ft flow.Type) *login.Flow { req := &http.Request{URL: urlx.ParseOrPanic("/")} f := login.NewFlow(ttl, "csrf_token", req, ft) for _, s := range reg.LoginStrategies() { require.NoError(t, s.PopulateLoginMethod(req, f)) } require.NoError(t, reg.LoginFlowPersister().CreateLoginFlow(context.Background(), f)) return f } expectErrorUI := func(t *testing.T) (interface{}, *http.Response) { res, err := ts.Client().Get(ts.URL + "/error") require.NoError(t, err) defer res.Body.Close() require.Contains(t, res.Request.URL.String(), conf.SelfServiceFlowErrorURL().String()+"?error=") sse, err := sdk.Common.GetSelfServiceError(common.NewGetSelfServiceErrorParams(). WithError(res.Request.URL.Query().Get("error"))) require.NoError(t, err) return sse.Payload.Errors, nil } anHourAgo := time.Now().Add(-time.Hour) t.Run("case=error with nil flow defaults to error ui redirect", func(t *testing.T) { t.Cleanup(reset) flowError = herodot.ErrInternalServerError.WithReason("system error") ct = identity.CredentialsTypePassword sse, _ := expectErrorUI(t) assertx.EqualAsJSON(t, []interface{}{flowError}, sse) }) t.Run("case=error with nil flow detects application/json", func(t *testing.T) { t.Cleanup(reset) flowError = herodot.ErrInternalServerError.WithReason("system error") ct = identity.CredentialsTypePassword res, err := ts.Client().Do(testhelpers.NewHTTPGetJSONRequest(t, ts.URL+"/error")) require.NoError(t, err) defer res.Body.Close() assert.Contains(t, res.Header.Get("Content-Type"), "application/json") assert.NotContains(t, res.Request.URL.String(), conf.SelfServiceFlowErrorURL().String()+"?error=") body, err := ioutil.ReadAll(res.Body) require.NoError(t, err) assert.Contains(t, string(body), "system error") }) t.Run("flow=api", func(t *testing.T) { t.Run("case=expired error", func(t *testing.T) { t.Cleanup(reset) loginFlow = newFlow(t, time.Minute, flow.TypeAPI) flowError = login.NewFlowExpiredError(anHourAgo) ct = identity.CredentialsTypePassword res, err := ts.Client().Do(testhelpers.NewHTTPGetJSONRequest(t, ts.URL+"/error")) require.NoError(t, err) defer res.Body.Close() require.Contains(t, res.Request.URL.String(), public.URL+login.RouteGetFlow) require.Equal(t, http.StatusOK, res.StatusCode) body, err := ioutil.ReadAll(res.Body) require.NoError(t, err) assert.Equal(t, int(text.ErrorValidationLoginFlowExpired), int(gjson.GetBytes(body, "messages.0.id").Int())) assert.NotEqual(t, loginFlow.ID.String(), gjson.GetBytes(body, "id").String()) }) t.Run("case=validation error", func(t *testing.T) { t.Cleanup(reset) loginFlow = newFlow(t, time.Minute, flow.TypeAPI) flowError = schema.NewInvalidCredentialsError() ct = identity.CredentialsTypePassword res, err := ts.Client().Do(testhelpers.NewHTTPGetJSONRequest(t, ts.URL+"/error")) require.NoError(t, err) defer res.Body.Close() require.Equal(t, http.StatusBadRequest, res.StatusCode) body, err := ioutil.ReadAll(res.Body) require.NoError(t, err) assert.Equal(t, int(text.ErrorValidationInvalidCredentials), int(gjson.GetBytes(body, "methods.password.config.messages.0.id").Int()), "%s", body) assert.Equal(t, loginFlow.ID.String(), gjson.GetBytes(body, "id").String()) }) t.Run("case=generic error", func(t *testing.T) { t.Cleanup(reset) loginFlow = newFlow(t, time.Minute, flow.TypeAPI) flowError = herodot.ErrInternalServerError.WithReason("system error") ct = identity.CredentialsTypePassword res, err := ts.Client().Do(testhelpers.NewHTTPGetJSONRequest(t, ts.URL+"/error")) require.NoError(t, err) defer res.Body.Close() require.Equal(t, http.StatusInternalServerError, res.StatusCode) body, err := ioutil.ReadAll(res.Body) require.NoError(t, err) assert.JSONEq(t, x.MustEncodeJSON(t, flowError), gjson.GetBytes(body, "error").Raw) }) t.Run("case=method is unknown", func(t *testing.T) { t.Cleanup(reset) loginFlow = newFlow(t, time.Minute, flow.TypeAPI) flowError = herodot.ErrInternalServerError.WithReason("system error") ct = "invalid-method" res, err := ts.Client().Do(testhelpers.NewHTTPGetJSONRequest(t, ts.URL+"/error")) require.NoError(t, err) defer res.Body.Close() require.Equal(t, http.StatusInternalServerError, res.StatusCode) body, err := ioutil.ReadAll(res.Body) require.NoError(t, err) assert.Contains(t, gjson.GetBytes(body, "error.message").String(), "invalid-method", "%s", body) }) }) t.Run("flow=browser", func(t *testing.T) { expectLoginUI := func(t *testing.T) (*models.LoginFlow, *http.Response) { res, err := ts.Client().Get(ts.URL + "/error") require.NoError(t, err) defer res.Body.Close() assert.Contains(t, res.Request.URL.String(), conf.SelfServiceFlowLoginUI().String()+"?flow=") lf, err := sdk.Common.GetSelfServiceLoginFlow(common.NewGetSelfServiceLoginFlowParams(). WithID(res.Request.URL.Query().Get("flow"))) require.NoError(t, err) return lf.Payload, res } t.Run("case=expired error", func(t *testing.T) { t.Cleanup(reset) loginFlow = &login.Flow{Type: flow.TypeBrowser} flowError = login.NewFlowExpiredError(anHourAgo) ct = identity.CredentialsTypePassword lf, _ := expectLoginUI(t) require.Len(t, lf.Messages, 1) assert.Equal(t, int(text.ErrorValidationLoginFlowExpired), int(lf.Messages[0].ID)) }) t.Run("case=validation error", func(t *testing.T) { t.Cleanup(reset) loginFlow = newFlow(t, time.Minute, flow.TypeBrowser) flowError = schema.NewInvalidCredentialsError() ct = identity.CredentialsTypePassword lf, _ := expectLoginUI(t) require.NotEmpty(t, lf.Methods[string(ct)], x.MustEncodeJSON(t, lf)) require.Len(t, lf.Methods[string(ct)].Config.Messages, 1, x.MustEncodeJSON(t, lf)) assert.Equal(t, int(text.ErrorValidationInvalidCredentials), int(lf.Methods[string(ct)].Config.Messages[0].ID), x.MustEncodeJSON(t, lf)) }) t.Run("case=generic error", func(t *testing.T) { t.Cleanup(reset) loginFlow = newFlow(t, time.Minute, flow.TypeBrowser) flowError = herodot.ErrInternalServerError.WithReason("system error") ct = identity.CredentialsTypePassword sse, _ := expectErrorUI(t) assertx.EqualAsJSON(t, []interface{}{flowError}, sse) }) t.Run("case=method is unknown", func(t *testing.T) { t.Cleanup(reset) loginFlow = newFlow(t, time.Minute, flow.TypeBrowser) flowError = herodot.ErrInternalServerError.WithReason("system error") ct = "invalid-method" sse, _ := expectErrorUI(t) body := x.MustEncodeJSON(t, sse) assert.Contains(t, gjson.Get(body, "0.message").String(), "invalid-method", "%s", body) }) }) }
explode_data.jsonl/19391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2951 }
[ 2830, 3393, 6999, 1454, 1155, 353, 8840, 836, 8, 341, 67850, 11, 1217, 1669, 5306, 7121, 32174, 15603, 2354, 72577, 1155, 340, 1219, 11, 3986, 1669, 1273, 21723, 7121, 81165, 14030, 5475, 1155, 11, 1217, 692, 67009, 1669, 54320, 649, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDownloadOverrideObject(t *testing.T) { var ( proxyURL = tutils.RandomProxyURL(t) baseParams = tutils.BaseAPIParams(proxyURL) bck = cmn.Bck{ Name: cos.RandString(10), Provider: cmn.ProviderAIS, } p = cmn.DefaultBckProps(bck) objName = cos.RandString(10) link = "https://storage.googleapis.com/minikube/iso/minikube-v0.23.2.iso.sha256" expectedSize int64 = 65 ) clearDownloadList(t) // disallow updating downloaded objects aattrs := cmn.AccessAll &^ cmn.AceDisconnectedBackend props := &cmn.BucketPropsToUpdate{Access: api.AccessAttrs(aattrs)} tutils.CreateBucketWithCleanup(t, proxyURL, bck, props) downloadObject(t, bck, objName, link, false /*shouldBeSkipped*/) oldProps := verifyProps(t, bck, objName, expectedSize, "1") // Update the file r, _ := readers.NewRandReader(10, p.Cksum.Type) err := api.PutObject(api.PutObjectArgs{ BaseParams: baseParams, Bck: bck, Object: objName, Cksum: r.Cksum(), Reader: r, }) tassert.Fatalf(t, err != nil, "expected: err!=nil, got: nil") verifyProps(t, bck, objName, expectedSize, "1") downloadObject(t, bck, objName, link, true /*shouldBeSkipped*/) newProps := verifyProps(t, bck, objName, expectedSize, "1") tassert.Errorf( t, oldProps.Atime == newProps.Atime, "atime match (%v != %v)", oldProps.Atime, newProps.Atime, ) }
explode_data.jsonl/70390
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 591 }
[ 2830, 3393, 11377, 2177, 1190, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 197, 22803, 3144, 256, 284, 259, 6031, 26709, 16219, 3144, 1155, 340, 197, 24195, 4870, 284, 259, 6031, 13018, 7082, 4870, 65787, 3144, 340, 197, 2233, 377, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWithdrawInternationalBank(t *testing.T) { TestSetRealOrderDefaults(t) var withdrawFiatRequest = withdraw.Request{} _, err := o.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) } }
explode_data.jsonl/30207
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 92261, 33646, 25828, 1155, 353, 8840, 836, 8, 341, 73866, 1649, 12768, 4431, 16273, 1155, 340, 2405, 14798, 37, 10358, 1900, 284, 14798, 9659, 16094, 197, 6878, 1848, 1669, 297, 26124, 7633, 37, 10358, 37, 42950, 1249, 33646, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMenuNoLogOutExistingMenuWithSkipOption(t *testing.T) { // prepare internalLink := map[string]interface{}{ "label": "Some internal links", "items": []interface{}{ map[string]interface{}{ "label": "The internal link", "url": "http://example.com/internal", }, }, } uiOpts := map[string]interface{}{ "menu": []interface{}{internalLink}, } trueVar := true spec := &v1.JaegerSpec{ Ingress: v1.JaegerIngressSpec{ Security: v1.IngressSecurityOAuthProxy, Openshift: v1.JaegerIngressOpenShiftSpec{ SkipLogout: &trueVar, }, }, } // test enableLogOut(uiOpts, spec) // verify assert.Len(t, uiOpts["menu"], 1) expected := []interface{}{internalLink} assert.Equal(t, expected, uiOpts["menu"]) }
explode_data.jsonl/21867
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 306 }
[ 2830, 3393, 3514, 2753, 2201, 2662, 53067, 3514, 2354, 35134, 5341, 1155, 353, 8840, 836, 8, 341, 197, 322, 10549, 198, 33343, 3939, 1669, 2415, 14032, 31344, 67066, 197, 197, 92667, 788, 330, 8373, 5306, 7746, 756, 197, 197, 1, 3615, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewCmdCreate(t *testing.T) { tests := []struct { name string tty bool cli string wantsErr bool errMsg string wantsOpts CreateOptions }{ { name: "no args tty", tty: true, cli: "", wantsOpts: CreateOptions{Interactive: true}, }, { name: "no args no-tty", tty: false, cli: "", wantsErr: true, errMsg: "at least one argument required in non-interactive mode", }, { name: "new repo from remote", cli: "NEWREPO --public --clone", wantsOpts: CreateOptions{ Name: "NEWREPO", Public: true, Clone: true}, }, { name: "no visibility", tty: true, cli: "NEWREPO", wantsErr: true, errMsg: "`--public`, `--private`, or `--internal` required when not running interactively", }, { name: "multiple visibility", tty: true, cli: "NEWREPO --public --private", wantsErr: true, errMsg: "expected exactly one of `--public`, `--private`, or `--internal`", }, { name: "new remote from local", cli: "--source=/path/to/repo --private", wantsOpts: CreateOptions{ Private: true, Source: "/path/to/repo"}, }, { name: "new remote from local with remote", cli: "--source=/path/to/repo --public --remote upstream", wantsOpts: CreateOptions{ Public: true, Source: "/path/to/repo", Remote: "upstream", }, }, { name: "new remote from local with push", cli: "--source=/path/to/repo --push --public", wantsOpts: CreateOptions{ Public: true, Source: "/path/to/repo", Push: true, }, }, { name: "new remote from local without visibility", cli: "--source=/path/to/repo --push", wantsOpts: CreateOptions{ Source: "/path/to/repo", Push: true, }, wantsErr: true, errMsg: "`--public`, `--private`, or `--internal` required when not running interactively", }, { name: "source with template", cli: "--source=/path/to/repo --private --template mytemplate", wantsErr: true, errMsg: "the `--source` option is not supported with `--clone`, `--template`, `--license`, or `--gitignore`", }, { name: "include all branches without template", cli: "--source=/path/to/repo --private --include-all-branches", wantsErr: true, errMsg: "the `--include-all-branches` option is only supported when using `--template`", }, { name: "new remote from template with include all branches", cli: "template-repo --template https://github.com/OWNER/REPO --public --include-all-branches", wantsOpts: CreateOptions{ Name: "template-repo", Public: true, Template: "https://github.com/OWNER/REPO", IncludeAllBranches: true, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ios, _, _, _ := iostreams.Test() ios.SetStdinTTY(tt.tty) ios.SetStdoutTTY(tt.tty) f := &cmdutil.Factory{ IOStreams: ios, } var opts *CreateOptions cmd := NewCmdCreate(f, func(o *CreateOptions) error { opts = o return nil }) // TODO STUPID HACK // cobra aggressively adds help to all commands. since we're not running through the root command // (which manages help when running for real) and since create has a '-h' flag (for homepage), // cobra blows up when it tried to add a help flag and -h is already in use. This hack adds a // dummy help flag with a random shorthand to get around this. cmd.Flags().BoolP("help", "x", false, "") args, err := shlex.Split(tt.cli) require.NoError(t, err) cmd.SetArgs(args) cmd.SetIn(&bytes.Buffer{}) cmd.SetOut(&bytes.Buffer{}) cmd.SetErr(&bytes.Buffer{}) _, err = cmd.ExecuteC() if tt.wantsErr { assert.Error(t, err) assert.Equal(t, tt.errMsg, err.Error()) return } else { require.NoError(t, err) } assert.Equal(t, tt.wantsOpts.Interactive, opts.Interactive) assert.Equal(t, tt.wantsOpts.Source, opts.Source) assert.Equal(t, tt.wantsOpts.Name, opts.Name) assert.Equal(t, tt.wantsOpts.Public, opts.Public) assert.Equal(t, tt.wantsOpts.Internal, opts.Internal) assert.Equal(t, tt.wantsOpts.Private, opts.Private) assert.Equal(t, tt.wantsOpts.Clone, opts.Clone) }) } }
explode_data.jsonl/36194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1936 }
[ 2830, 3393, 3564, 15613, 4021, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 3244, 1881, 981, 1807, 198, 197, 86448, 981, 914, 198, 197, 6692, 1783, 7747, 220, 1807, 198, 197, 9859, 6611, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDistroDefaults(t *testing.T) { var tests = []struct { name string // test case name orchestratorProfile OrchestratorProfile // orchestrator to be tested masterProfileDistro Distro agentPoolProfileDistro Distro expectedAgentDistro Distro // expected agent result default disto to be used expectedMasterDistro Distro // expected master result default disto to be used isUpgrade bool isScale bool cloudName string }{ { "default_kubernetes", OrchestratorProfile{ OrchestratorType: Kubernetes, }, "", "", AKSUbuntu1604, AKSUbuntu1604, false, false, AzurePublicCloud, }, { "default_kubernetes_usgov", OrchestratorProfile{ OrchestratorType: Kubernetes, }, "", "", Ubuntu, Ubuntu, false, false, AzureUSGovernmentCloud, }, { "1804_upgrade_kubernetes", OrchestratorProfile{ OrchestratorType: Kubernetes, }, AKSUbuntu1804, AKSUbuntu1804, AKSUbuntu1804, AKSUbuntu1804, true, false, AzurePublicCloud, }, { "default_kubernetes_usgov", OrchestratorProfile{ OrchestratorType: Kubernetes, }, AKS1604Deprecated, AKS1604Deprecated, Ubuntu, Ubuntu, true, false, AzureGermanCloud, }, { "deprecated_distro_kubernetes", OrchestratorProfile{ OrchestratorType: Kubernetes, }, AKS1604Deprecated, AKS1604Deprecated, AKSUbuntu1604, AKSUbuntu1604, true, false, AzureChinaCloud, }, { "docker_engine_kubernetes", OrchestratorProfile{ OrchestratorType: Kubernetes, }, AKS1604Deprecated, AKSDockerEngine, AKSUbuntu1604, AKSUbuntu1604, false, true, AzurePublicCloud, }, { "default_swarm", OrchestratorProfile{ OrchestratorType: Swarm, }, "", "", Ubuntu, Ubuntu, false, false, AzurePublicCloud, }, { "default_swarmmode", OrchestratorProfile{ OrchestratorType: SwarmMode, }, "", "", Ubuntu, Ubuntu, false, false, AzurePublicCloud, }, { "default_dcos", OrchestratorProfile{ OrchestratorType: DCOS, }, "", "", Ubuntu, Ubuntu, false, false, AzurePublicCloud, }, } for _, test := range tests { mockAPI := getMockAPIProperties("1.0.0") mockAPI.OrchestratorProfile = &test.orchestratorProfile mockAPI.MasterProfile.Distro = test.masterProfileDistro for _, agent := range mockAPI.AgentPoolProfiles { agent.Distro = test.agentPoolProfileDistro } mockAPI.setMasterProfileDefaults(test.isUpgrade, test.isScale, test.cloudName) mockAPI.setAgentProfileDefaults(test.isUpgrade, test.isScale, test.cloudName) if mockAPI.MasterProfile.Distro != test.expectedMasterDistro { t.Fatalf("setMasterProfileDefaults() test case %v did not return right Distro configurations %v != %v", test.name, mockAPI.MasterProfile.Distro, test.expectedMasterDistro) } for _, agent := range mockAPI.AgentPoolProfiles { if agent.Distro != test.expectedAgentDistro { t.Fatalf("setAgentProfileDefaults() test case %v did not return right Distro configurations %v != %v", test.name, agent.Distro, test.expectedAgentDistro) } } } }
explode_data.jsonl/33878
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1506 }
[ 2830, 3393, 35, 15561, 16273, 1155, 353, 8840, 836, 8, 1476, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 4293, 914, 1060, 442, 1273, 1142, 829, 198, 197, 197, 21584, 15111, 850, 8526, 262, 54305, 15111, 850, 8526, 442, 65128, 850, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestTakeWithPriority(t *testing.T) { tests := []struct { fns []func() string expect string }{ { fns: []func() string{ func() string { return "first" }, func() string { return "second" }, func() string { return "third" }, }, expect: "first", }, { fns: []func() string{ func() string { return "" }, func() string { return "second" }, func() string { return "third" }, }, expect: "second", }, { fns: []func() string{ func() string { return "" }, func() string { return "" }, func() string { return "third" }, }, expect: "third", }, { fns: []func() string{ func() string { return "" }, func() string { return "" }, func() string { return "" }, }, expect: "", }, } for _, test := range tests { t.Run(grand.S(16), func(t *testing.T) { val := TakeWithPriority(test.fns...) assert.Equal(t, test.expect, val) }) } }
explode_data.jsonl/76726
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 547 }
[ 2830, 3393, 17814, 2354, 20555, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 1166, 4412, 262, 3056, 2830, 368, 914, 198, 197, 24952, 914, 198, 197, 59403, 197, 197, 515, 298, 1166, 4412, 25, 3056, 2830, 368, 914, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCStore_StoreKey(t *testing.T) { type args struct { key string } tests := []struct { name string args args want args }{ {"key_ok", args{"testKey"}, args{"testKey"}}, {"key_empty", args{"testKey"}, args{"testKey"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { cs := New() cs.StoreKey(tt.args.key) _, ok := cs.store[tt.want.key] if !ok { t.Errorf("failed to store key: %q", tt.args.key) } }) } }
explode_data.jsonl/59220
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 34, 6093, 92684, 1592, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 23634, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 2827, 198, 197, 59403, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIntuitiveMethodSet(t *testing.T) { const source = ` package P type A int func (A) f() func (*A) g() ` fset := token.NewFileSet() f, err := parser.ParseFile(fset, "hello.go", source, 0) if err != nil { t.Fatal(err) } var conf types.Config pkg, err := conf.Check("P", fset, []*ast.File{f}, nil) if err != nil { t.Fatal(err) } qual := types.RelativeTo(pkg) for _, test := range []struct { expr string // type expression want string // intuitive method set }{ {"A", "(A).f (*A).g"}, {"*A", "(*A).f (*A).g"}, {"error", "(error).Error"}, {"*error", ""}, {"struct{A}", "(struct{A}).f (*struct{A}).g"}, {"*struct{A}", "(*struct{A}).f (*struct{A}).g"}, } { tv, err := types.Eval(fset, pkg, 0, test.expr) if err != nil { t.Errorf("Eval(%s) failed: %v", test.expr, err) } var names []string for _, m := range typeutil.IntuitiveMethodSet(tv.Type, nil) { name := fmt.Sprintf("(%s).%s", types.TypeString(m.Recv(), qual), m.Obj().Name()) names = append(names, name) } got := strings.Join(names, " ") if got != test.want { t.Errorf("IntuitiveMethodSet(%s) = %q, want %q", test.expr, got, test.want) } } }
explode_data.jsonl/66098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 512 }
[ 2830, 3393, 1072, 34151, 3523, 1649, 1155, 353, 8840, 836, 8, 341, 4777, 2530, 284, 22074, 1722, 393, 198, 1313, 362, 526, 198, 2830, 320, 32, 8, 282, 741, 2830, 4609, 32, 8, 342, 741, 19324, 1166, 746, 1669, 3950, 7121, 1703, 1649,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRecreate_initialDeployment(t *testing.T) { var deployment *kapi.ReplicationController scaler := &cmdtest.FakeScaler{} strategy := &RecreateDeploymentStrategy{ out: &bytes.Buffer{}, errOut: &bytes.Buffer{}, decoder: kapi.Codecs.UniversalDecoder(), retryTimeout: 1 * time.Second, retryPeriod: 1 * time.Millisecond, getUpdateAcceptor: getUpdateAcceptor, scaler: scaler, eventClient: fake.NewSimpleClientset().Core(), } config := deploytest.OkDeploymentConfig(1) config.Spec.Strategy = recreateParams(30, "", "", "") deployment, _ = deployutil.MakeDeployment(config, kapi.Codecs.LegacyCodec(registered.GroupOrDie(kapi.GroupName).GroupVersions[0])) strategy.rcClient = &fakeControllerClient{deployment: deployment} err := strategy.Deploy(nil, deployment, 3) if err != nil { t.Fatalf("unexpected deploy error: %#v", err) } if e, a := 1, len(scaler.Events); e != a { t.Fatalf("expected %d scale calls, got %d", e, a) } if e, a := uint(3), scaler.Events[0].Size; e != a { t.Errorf("expected scale up to %d, got %d", e, a) } }
explode_data.jsonl/19089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 470 }
[ 2830, 3393, 693, 3182, 15809, 75286, 1155, 353, 8840, 836, 8, 341, 2405, 23172, 353, 74, 2068, 2817, 79, 1693, 2051, 198, 1903, 63084, 1669, 609, 8710, 1944, 991, 726, 59553, 16094, 11355, 10228, 1669, 609, 693, 3182, 75286, 19816, 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...
4
func Test_UrlToKubernetesContext(t *testing.T) { var tests = []struct { name string in string want string }{ {name: "is-url-with-protocol", in: "https://cloud.okteto.com", want: "cloud_okteto_com"}, {name: "is-k8scontext", in: "minikube", want: ""}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if result := UrlToKubernetesContext(tt.in); result != tt.want { t.Errorf("Test '%s' failed: %s", tt.name, result) } }) } }
explode_data.jsonl/53938
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 213 }
[ 2830, 3393, 62, 2864, 1249, 42, 29827, 1972, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 914, 198, 197, 17430, 256, 914, 198, 197, 50780, 914, 198, 197, 59403, 197, 197, 47006, 25, 330, 285, 25443, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileWithWhenExpressionsScopedToTaskWitResultRefs(t *testing.T) { names.TestingSeed() ps := []*v1beta1.Pipeline{{ ObjectMeta: baseObjectMeta("test-pipeline", "foo"), Spec: v1beta1.PipelineSpec{ Tasks: []v1beta1.PipelineTask{ // a-task is executed and produces a result aResult with value aResultValue { Name: "a-task", TaskRef: &v1beta1.TaskRef{Name: "a-task"}, }, // b-task is skipped because it has when expressions, with result reference to a-task, that evaluate to false { Name: "b-task", TaskRef: &v1beta1.TaskRef{Name: "b-task"}, WhenExpressions: []v1beta1.WhenExpression{{ Input: "$(tasks.a-task.results.aResult)", Operator: selection.In, Values: []string{"notResultValue"}, }}, }, // c-task is executed regardless of running after skipped b-task because when expressions are scoped to task { Name: "c-task", TaskRef: &v1beta1.TaskRef{Name: "c-task"}, RunAfter: []string{"b-task"}, }, }, }, }} prs := []*v1beta1.PipelineRun{{ ObjectMeta: baseObjectMeta("test-pipeline-run-different-service-accs", "foo"), Spec: v1beta1.PipelineRunSpec{ PipelineRef: &v1beta1.PipelineRef{Name: "test-pipeline"}, ServiceAccountName: "test-sa-0", }, }} ts := []*v1beta1.Task{ { ObjectMeta: baseObjectMeta("a-task", "foo"), Spec: v1beta1.TaskSpec{ Results: []v1beta1.TaskResult{{ Name: "aResult", Description: "a result", }}, }, }, {ObjectMeta: baseObjectMeta("b-task", "foo")}, {ObjectMeta: baseObjectMeta("c-task", "foo")}, } trs := []*v1beta1.TaskRun{{ ObjectMeta: taskRunObjectMeta("test-pipeline-run-different-service-accs-a-task-xxyyy", "foo", "test-pipeline-run-different-service-accs", "test-pipeline", "a-task", true), Spec: v1beta1.TaskRunSpec{ TaskRef: &v1beta1.TaskRef{Name: "hello-world"}, ServiceAccountName: "test-sa", Resources: &v1beta1.TaskRunResources{}, Timeout: &metav1.Duration{Duration: config.DefaultTimeoutMinutes * time.Minute}, }, Status: v1beta1.TaskRunStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, }, }, }, TaskRunStatusFields: v1beta1.TaskRunStatusFields{ TaskRunResults: []v1beta1.TaskRunResult{{ Name: "aResult", Value: "aResultValue", }}, }, }, }} // set the scope of when expressions to task -- execution of dependent tasks is unblocked cms := []*corev1.ConfigMap{ { ObjectMeta: metav1.ObjectMeta{Name: config.GetFeatureFlagsConfigName(), Namespace: system.Namespace()}, Data: map[string]string{ "scope-when-expressions-to-task": "true", }, }, } d := test.Data{ PipelineRuns: prs, Pipelines: ps, Tasks: ts, TaskRuns: trs, ConfigMaps: cms, } prt := newPipelineRunTest(d, t) defer prt.Cancel() wantEvents := []string{ "Normal Started", "Normal Running Tasks Completed: 1 \\(Failed: 0, Cancelled 0\\), Incomplete: 1, Skipped: 1", } pipelineRun, clients := prt.reconcileRun("foo", "test-pipeline-run-different-service-accs", wantEvents, false) actual, err := clients.Pipeline.TektonV1beta1().TaskRuns("foo").List(prt.TestAssets.Ctx, metav1.ListOptions{ LabelSelector: "tekton.dev/pipelineTask=c-task,tekton.dev/pipelineRun=test-pipeline-run-different-service-accs", Limit: 1, }) if err != nil { t.Fatalf("Failure to list TaskRuns %s", err) } if len(actual.Items) != 1 { t.Fatalf("Expected 1 TaskRun got %d", len(actual.Items)) } actualSkippedTasks := pipelineRun.Status.SkippedTasks expectedSkippedTasks := []v1beta1.SkippedTask{{ // its when expressions evaluate to false Name: "b-task", WhenExpressions: v1beta1.WhenExpressions{{ Input: "aResultValue", Operator: "in", Values: []string{"notResultValue"}, }}, }} if d := cmp.Diff(expectedSkippedTasks, actualSkippedTasks); d != "" { t.Errorf("expected to find Skipped Tasks %v. Diff %s", expectedSkippedTasks, diff.PrintWantGot(d)) } // confirm that there are no taskruns created for the skipped tasks skippedTasks := []string{"b-task"} for _, skippedTask := range skippedTasks { labelSelector := fmt.Sprintf("tekton.dev/pipelineTask=%s,tekton.dev/pipelineRun=test-pipeline-run-different-service-accs", skippedTask) actualSkippedTask, err := clients.Pipeline.TektonV1beta1().TaskRuns("foo").List(prt.TestAssets.Ctx, metav1.ListOptions{ LabelSelector: labelSelector, Limit: 1, }) if err != nil { t.Fatalf("Failure to list TaskRun's %s", err) } if len(actualSkippedTask.Items) != 0 { t.Fatalf("Expected 0 TaskRuns got %d", len(actualSkippedTask.Items)) } } }
explode_data.jsonl/68290
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2069 }
[ 2830, 3393, 693, 40446, 457, 2354, 4498, 40315, 39437, 1249, 6262, 54, 275, 2077, 82807, 1155, 353, 8840, 836, 8, 341, 93940, 8787, 287, 41471, 741, 35009, 1669, 29838, 85, 16, 19127, 16, 1069, 8790, 90, 515, 197, 23816, 12175, 25, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestIsRepoMissing(t *testing.T) { expectedArgs := []string{"repo", "list"} helm, runner := createHelm(t, nil, listRepoOutput) url := "http://chartmuseum.jenkins-x.io" missing, err := helm.IsRepoMissing(url) assert.NoError(t, err, "should search missing repos without any error") verifyArgs(t, helm, runner, expectedArgs...) assert.False(t, missing, "should find url '%s'", url) url = "https://test" missing, err = helm.IsRepoMissing(url) assert.NoError(t, err, "search missing repos should not return an error") assert.True(t, missing, "should not find url '%s'", url) }
explode_data.jsonl/4644
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 3872, 25243, 25080, 1155, 353, 8840, 836, 8, 341, 42400, 4117, 1669, 3056, 917, 4913, 23476, 497, 330, 1607, 16707, 9598, 23162, 11, 22259, 1669, 1855, 39, 23162, 1155, 11, 2092, 11, 1140, 25243, 5097, 692, 19320, 1669, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMergeWithEmptyWallet(t *testing.T) { w1 := wsFromJSON(t, []byte(`{}`)) w2 := wsFromFile(t, "./testdata/wallets.json") expected := WalletStore{ Wallets: []cash.GenesisAccount{ { Address: toWeaveAddress(t, "CE5D5A5CA8C7D545D7756D3677234D81622BA297"), Set: cash.Set{ Coins: []*coin.Coin{ { Ticker: "IOV", Whole: 123456789, Fractional: 5555555, }, }, }, }, { Address: toWeaveAddress(t, "D4821FD051696273D09E1FBAD0EBE5B5060787A7"), Set: cash.Set{ Coins: []*coin.Coin{ { Ticker: "IOV", Whole: 123456789, Fractional: 5555555, }, }, }, }, }, } actual := MergeWalletStore(w1, w2) assert.EqualValues(t, expected, actual, ToString(expected), ToString(actual)) }
explode_data.jsonl/11364
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 447 }
[ 2830, 3393, 52096, 2354, 3522, 38259, 1155, 353, 8840, 836, 8, 341, 6692, 16, 1669, 17624, 3830, 5370, 1155, 11, 3056, 3782, 5809, 90, 5541, 1171, 6692, 17, 1669, 17624, 43633, 1155, 11, 5924, 92425, 6324, 7464, 82, 4323, 5130, 42400, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMerge(t *testing.T) { for _, test := range []struct { name string uri redirectURI m model expected redirectURI }{ { name: "empty model", uri: redirectURI{ scheme: "http", host: "example1.com", port: "9000", path: "/test1", }, m: model{ scheme: "", port: "", path: "", }, expected: redirectURI{ scheme: "http", host: "example1.com", port: "9000", path: "/test1", }, }, { name: "full model", uri: redirectURI{ scheme: "http", host: "example1.com", port: "9000", path: "/test1", }, m: model{ scheme: "https", port: "8000", path: "/ello", }, expected: redirectURI{ scheme: "https", host: "example1.com", port: "8000", path: "/ello", }, }, { name: "only path", uri: redirectURI{ scheme: "http", host: "example1.com", port: "9000", path: "/test1", }, m: model{ scheme: "", port: "", path: "/newpath", }, expected: redirectURI{ scheme: "http", host: "example1.com", port: "9000", path: "/newpath", }, }, } { test.uri.merge(&test.m) if test.expected != test.uri { t.Errorf("%s: expected %#v, got %#v", test.name, test.expected, test.uri) } } }
explode_data.jsonl/54737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 725 }
[ 2830, 3393, 52096, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 197, 6070, 414, 6423, 10301, 198, 197, 2109, 286, 1614, 198, 197, 42400, 6423, 10301, 198, 197, 59403, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMergeDedupe(t *testing.T) { for _, c := range []struct { s1 []string s2 []string want []string }{ {[]string{"abc", "geoId/12"}, []string{"abc"}, []string{"abc", "geoId/12"}}, {[]string{"a", "bc"}, []string{"a", "bc", "d"}, []string{"a", "bc", "d"}}, {[]string{"abc"}, []string{"ef"}, []string{"abc", "ef"}}, } { got := MergeDedupe(c.s1, c.s2) if diff := cmp.Diff(got, c.want); diff != "" { t.Errorf("MergeDedupe got diff %+v", diff) } } }
explode_data.jsonl/80320
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 52096, 35, 55101, 375, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 272, 1669, 2088, 3056, 1235, 341, 197, 1903, 16, 256, 3056, 917, 198, 197, 1903, 17, 256, 3056, 917, 198, 197, 50780, 3056, 917, 198, 197, 59403, 197, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLabelsConfig_getAttributes(t *testing.T) { tests := []struct { name string labels LabelsConfig expectedMapping map[string]model.LabelName }{ { name: "with attributes without label mapping", labels: LabelsConfig{ Attributes: map[string]string{ "attribute_1": "", "attribute_2": "", }, }, expectedMapping: map[string]model.LabelName{ "attribute_1": model.LabelName("attribute_1"), "attribute_2": model.LabelName("attribute_2"), }, }, { name: "with attributes and label mapping", labels: LabelsConfig{ Attributes: map[string]string{ "attribute.1": "attribute_1", "attribute.2": "attribute_2", }, }, expectedMapping: map[string]model.LabelName{ "attribute.1": model.LabelName("attribute_1"), "attribute.2": model.LabelName("attribute_2"), }, }, { name: "with attributes and without label mapping", labels: LabelsConfig{ Attributes: map[string]string{ "attribute.1": "attribute_1", "attribute2": "", }, }, expectedMapping: map[string]model.LabelName{ "attribute.1": model.LabelName("attribute_1"), "attribute2": model.LabelName("attribute2"), }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { mapping := tt.labels.getAttributes(tt.labels.Attributes) assert.Equal(t, tt.expectedMapping, mapping) }) } }
explode_data.jsonl/73124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 594 }
[ 2830, 3393, 23674, 2648, 3062, 10516, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 95143, 688, 60996, 2648, 198, 197, 42400, 6807, 2415, 14032, 60, 2528, 4679, 675, 198, 197, 59403, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAppend(t *testing.T) { testUnalignedAndGeneric(t, func(impl string) { d := New224() for capacity := 2; capacity < 64; capacity += 64 { // The first time around the loop, Sum will have to reallocate. // The second time, it will not. buf := make([]byte, 2, capacity) d.Reset() d.Write([]byte{0xcc}) buf = d.Sum(buf) expected := "0000DF70ADC49B2E76EEE3A6931B93FA41841C3AF2CDF5B32A18B5478C39" if got := strings.ToUpper(hex.EncodeToString(buf)); got != expected { t.Errorf("got %s, want %s", got, expected) } } }) }
explode_data.jsonl/67464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 242 }
[ 2830, 3393, 23877, 1155, 353, 8840, 836, 8, 341, 18185, 1806, 47142, 3036, 19964, 1155, 11, 2915, 7, 6383, 914, 8, 341, 197, 2698, 1669, 1532, 17, 17, 19, 2822, 197, 2023, 8654, 1669, 220, 17, 26, 8654, 366, 220, 21, 19, 26, 8654,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsArchivePathDir(t *testing.T) { cmd := exec.Command("sh", "-c", "mkdir -p /tmp/archivedir") output, err := cmd.CombinedOutput() if err != nil { t.Fatalf("Fail to create an archive file for test : %s.", output) } if IsArchivePath(tmp + "archivedir") { t.Fatalf("Incorrectly recognised directory as an archive") } }
explode_data.jsonl/79217
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 3872, 42502, 1820, 6184, 1155, 353, 8840, 836, 8, 341, 25920, 1669, 3883, 12714, 445, 927, 497, 6523, 66, 497, 330, 26117, 481, 79, 608, 5173, 59973, 2221, 404, 1138, 21170, 11, 1848, 1669, 5439, 727, 2855, 1589, 5097, 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...
3
func TestRPC_QueryPocketParams(t *testing.T) { codec.UpgradeHeight = 7000 gBZ, _, _, _ := fiveValidatorsOneAppGenesis() _, _, cleanup := NewInMemoryTendermintNode(t, gBZ) _, stopCli, evtChan := subscribeTo(t, tmTypes.EventNewBlock) <-evtChan var params = HeightParams{ Height: 0, } q := newQueryRequest("pocketparams", newBody(params)) rec := httptest.NewRecorder() PocketParams(rec, q, httprouter.Params{}) resp := getJSONResponse(rec) assert.NotNil(t, resp) assert.NotEmpty(t, resp) assert.True(t, strings.Contains(rec.Body.String(), "chains")) <-evtChan params = HeightParams{ Height: 2, } q = newQueryRequest("pocketparams", newBody(params)) rec = httptest.NewRecorder() PocketParams(rec, q, httprouter.Params{}) resp = getJSONResponse(rec) assert.NotNil(t, resp) assert.NotEmpty(t, resp) assert.True(t, strings.Contains(rec.Body.String(), "chains")) cleanup() stopCli() }
explode_data.jsonl/44718
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 29528, 48042, 63374, 4870, 1155, 353, 8840, 836, 8, 341, 43343, 66, 13, 43861, 3640, 284, 220, 22, 15, 15, 15, 198, 3174, 33, 57, 11, 8358, 8358, 716, 1669, 4236, 31748, 3966, 2164, 84652, 741, 197, 6878, 8358, 21290, 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 TestTriggerResolver_DeleteTrigger(t *testing.T) { for testName, testData := range map[string]struct { trigger gqlschema.TriggerMetadataInput triggerMatcher types.GomegaMatcher errorMatcher types.GomegaMatcher //Mocks deleteTriggerError error }{ "Success": { trigger: gqlschema.TriggerMetadataInput{Name: "a", Namespace: "a"}, deleteTriggerError: nil, triggerMatcher: gomega.BeEquivalentTo(&gqlschema.TriggerMetadataInput{Name: "a", Namespace: "a"}), errorMatcher: gomega.BeNil(), }, "Error": { trigger: gqlschema.TriggerMetadataInput{}, deleteTriggerError: errors.New(""), triggerMatcher: gomega.BeNil(), errorMatcher: gomega.HaveOccurred(), }, } { t.Run(testName, func(t *testing.T) { //given g := gomega.NewWithT(t) ctx, cancel := context.WithTimeout(context.Background(), -24*time.Hour) cancel() service := &automock.Service{} converter := &automock.GQLConverter{} extractor := extractor.TriggerUnstructuredExtractor{} service.On( "Delete", testData.trigger, ).Return(testData.deleteTriggerError) //when res := newTriggerResolver(service, converter, extractor, name.Generate) trigger, err := res.DeleteTrigger(ctx, "a", testData.trigger) //then g.Expect(err).To(testData.errorMatcher) g.Expect(trigger).To(testData.triggerMatcher) }) } }
explode_data.jsonl/35528
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 584 }
[ 2830, 3393, 17939, 18190, 57418, 17939, 1155, 353, 8840, 836, 8, 341, 2023, 94396, 11, 67348, 1669, 2088, 2415, 14032, 60, 1235, 341, 197, 83228, 286, 53045, 17349, 8240, 4500, 14610, 2505, 198, 197, 83228, 37554, 4494, 1224, 32696, 37554...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLibrato_TimeToHeaderTimeout(t *testing.T) { handler := &SleepyHandler{ Amt: 2 * time.Second, ReqIncr: -600 * time.Millisecond, } server := httptest.NewServer(handler) defer server.Close() config := GetConfig() config.LibratoUrl, _ = url.Parse(server.URL) config.NetworkTimeout = 1 * time.Second config.LibratoUser = "user" config.LibratoToken = "token" measurements := make(chan Measurement, 10) librato := NewLibratoOutputter(measurements, config) if !librato.sendWithBackoff([]byte(`{}`)) { t.Errorf("Request should not have errored with a sleepy handler") } if handler.times != 3 { t.Error("Request should have been tried 3 times, instead it was tried: ", handler.times) } }
explode_data.jsonl/51434
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 263 }
[ 2830, 3393, 9194, 81, 4330, 39080, 1249, 4047, 7636, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 609, 41745, 88, 3050, 515, 197, 22985, 2501, 25, 257, 220, 17, 353, 882, 32435, 345, 197, 197, 27234, 641, 5082, 25, 481, 21, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNoneImplementsCredentials(t *testing.T) { if _, ok := interface{}(credentials.None).(credentials.Credentials); !ok { t.Errorf("credentials.None doesn't implement credentials.Credentials!") } }
explode_data.jsonl/48261
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 4064, 1427, 4674, 27025, 1155, 353, 8840, 836, 8, 341, 743, 8358, 5394, 1669, 3749, 6257, 7, 32353, 18475, 68615, 32353, 727, 15735, 1215, 753, 562, 341, 197, 3244, 13080, 445, 32353, 18475, 3171, 944, 4211, 16387, 727, 1573...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStrSlice2Any(t *testing.T) { Convey("Cast slice string to any", t, func() { foo := []string{"a", "b", "c", "d"} temp := SliceStr2Any(foo) slice2Str, err := SliceAny2Str(temp) So(err, ShouldBeNil) So(slice2Str, ShouldResemble, foo) v := SliceStr2Any(nil) So(v, ShouldBeNil) tmp := make([]interface{}, 3) tmp[0] = 1 tmp[0] = "1" tmp[0] = true slice2Str, err = SliceAny2Str(tmp) So(err, ShouldNotBeNil) So(slice2Str, ShouldBeEmpty) str, err := SliceAny2Str(nil) So(err, ShouldBeNil) So(str, ShouldBeEmpty) }) }
explode_data.jsonl/34306
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 2580, 33236, 17, 8610, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 18714, 15983, 914, 311, 894, 497, 259, 11, 2915, 368, 341, 197, 197, 7975, 1669, 3056, 917, 4913, 64, 497, 330, 65, 497, 330, 66, 497, 330, 67, 167...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapProxy_AddEntryListenerEvictAll(t *testing.T) { var wg *sync.WaitGroup = new(sync.WaitGroup) entryAdded := &AddEntry{wg: wg} registrationId, err := mp.AddEntryListener(entryAdded, true) AssertEqual(t, err, nil, nil) wg.Add(2) mp.Put("test", "key") mp.EvictAll() timeout := WaitTimeout(wg, Timeout) AssertEqualf(t, nil, false, timeout, "AddEntryListener entryEvictAll failed") mp.RemoveEntryListener(registrationId) mp.Clear() }
explode_data.jsonl/57031
{ "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, 2227, 16219, 21346, 5874, 2743, 34112, 849, 2403, 1155, 353, 8840, 836, 8, 1476, 2405, 63581, 353, 12996, 28384, 2808, 284, 501, 97233, 28384, 2808, 340, 48344, 19337, 1669, 609, 2212, 5874, 90, 45540, 25, 63581, 532, 197, 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 TestSum(t *testing.T) { runtime := wasm3.NewRuntime(&wasm3.Config{ Environment: wasm3.NewEnvironment(), StackSize: 64 * 1024, }) defer runtime.Destroy() _, err := runtime.Load(wasmBytes) if err != nil { t.Fatal(err) } fn, err := runtime.FindFunction(fnName) if err != nil { t.Fatal(err) } result, _ := fn(1, 1) if result != 2 { t.Fatal("Result doesn't match") } }
explode_data.jsonl/10740
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 9190, 1155, 353, 8840, 836, 8, 341, 7000, 4466, 1669, 98263, 18, 7121, 15123, 2099, 86, 10530, 18, 10753, 515, 197, 197, 12723, 25, 98263, 18, 7121, 12723, 3148, 197, 197, 74026, 25, 256, 220, 21, 19, 353, 220, 16, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestReadErrorPublicKey(t *testing.T) { br := new(BadReader) if _, err := NewPublicKey(br); err == nil { t.Errorf("KnownBadReader: unexpected success testing a broken reader for public key") } }
explode_data.jsonl/24855
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 4418, 1454, 61822, 1155, 353, 8840, 836, 8, 341, 80255, 1669, 501, 5349, 329, 5062, 340, 743, 8358, 1848, 1669, 1532, 61822, 41237, 1215, 1848, 621, 2092, 341, 197, 3244, 13080, 445, 48206, 17082, 5062, 25, 16500, 2393, 7497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoot(t *testing.T) { fmterr := fmt.Errorf("test error") type tcase struct { err error rerr error count int } fn := func(tc tcase) func(*testing.T) { return func(t *testing.T) { err, count := Root(tc.err) if err != tc.rerr { t.Errorf("root error, expected '%p' got '%p'", tc.rerr, err) } if count != tc.count { t.Errorf("root count, expected %v got %v", tc.count, count) } } } tests := map[string]tcase{ "nil": tcase{}, "direct": tcase{ err: ErrCanceled, rerr: ErrCanceled, count: 0, }, "error": tcase{ err: Wrap(fmterr, "wrap 1"), rerr: fmterr, count: 1, }, "one wrap": tcase{ err: Wrap(ErrCanceled, "wrap 1"), rerr: ErrCanceled, count: 1, }, "two wrap": tcase{ err: Wrap(Wrap(ErrCanceled, "wrap 1"), "wrap 2"), rerr: ErrCanceled, count: 2, }, } for name, tc := range tests { t.Run(name, fn(tc)) } }
explode_data.jsonl/33855
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 464 }
[ 2830, 3393, 8439, 1155, 353, 8840, 836, 8, 341, 1166, 76, 68669, 1669, 8879, 13080, 445, 1944, 1465, 1138, 13158, 259, 5638, 2036, 341, 197, 9859, 256, 1465, 198, 197, 7000, 615, 220, 1465, 198, 197, 18032, 526, 198, 197, 532, 40095, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShowVersion(t *testing.T) { buf := bytes.NewBuffer([]byte{}) cli := &CLI{OutStream: buf, quiet: true} ret := cli.Run([]string{"showVer", "-V"}) if ret != ExitOK { t.Errorf("ret is not ExitOK, ret=%d", ret) } if !strings.Contains(string(buf.Bytes()), "Ver:") { t.Errorf("not version string: %s", string(buf.Bytes())) } }
explode_data.jsonl/2296
{ "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, 7812, 5637, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 5820, 7121, 4095, 10556, 3782, 6257, 692, 86448, 1669, 609, 63959, 90, 2662, 3027, 25, 6607, 11, 11340, 25, 830, 630, 11262, 1669, 21348, 16708, 10556, 917, 4913, 3445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOrigin_Hash(t *testing.T) { assertHash(t, []hashAssert{ {newOrigin(), MustHexDecodeString( "0x0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8")}, }) }
explode_data.jsonl/3494
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 13298, 2039, 988, 1155, 353, 8840, 836, 8, 341, 6948, 6370, 1155, 11, 3056, 8296, 8534, 515, 197, 197, 90, 931, 13298, 1507, 15465, 20335, 32564, 703, 1006, 298, 197, 1, 15, 87, 15, 68, 20, 22, 20, 16, 66, 15, 17, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1