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 TestPartition(t *testing.T) { cases := []struct { ss []string k int exp Table }{{ ss: []string{"a", "b"}, k: 1, exp: Table{ {{"a", "b"}}, }, }, { ss: []string{"a", "b"}, k: 2, exp: Table{ {{"a"}, {"b"}}, }, }, { ss: []string{"a", "b", "c"}, k: 1, exp: Table{ {{"a", "b", "c"}}, }, }, { ss: []string{"a", "b", "c"}, k: 2, exp: Table{ {{"b", "a"}, {"c"}}, {{"b"}, {"c", "a"}}, {{"b", "c"}, {"a"}}, }, }, { ss: []string{"a", "b", "c"}, k: 3, exp: Table{ {{"a"}, {"b"}, {"c"}}, }, }} for _, c := range cases { t.Logf("Partition: %d\n", c.k) got := Partition(c.ss, c.k) test.Assert(t, "", c.exp, got) } }
explode_data.jsonl/58596
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 398 }
[ 2830, 3393, 49978, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 34472, 220, 3056, 917, 198, 197, 16463, 256, 526, 198, 197, 48558, 6633, 198, 197, 15170, 515, 197, 34472, 25, 3056, 917, 4913, 64, 497, 330, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAzureDevOpsProject_CreateProject_DoesNotSwallowErrorFromFailedCreateCall(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() coreClient := azdosdkmocks.NewMockCoreClient(ctrl) clients := &config.AggregatedClient{ CoreClient: coreClient, Ctx: context.Background(), } expectedProjectCreateArgs := core.QueueCreateProjectArgs{ProjectToCreate: &testProject} coreClient. EXPECT(). QueueCreateProject(clients.Ctx, expectedProjectCreateArgs). Return(nil, errors.New("QueueCreateProject() Failed")). Times(1) err := createProject(clients, &testProject, 5) require.Equal(t, "QueueCreateProject() Failed", err.Error()) }
explode_data.jsonl/3729
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 78107, 14592, 38904, 7849, 34325, 7849, 1557, 7072, 2623, 13218, 7183, 1454, 3830, 9408, 4021, 7220, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 71882, 2959...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestControllerWithDuplicatePodCIDR(t *testing.T) { c, closeFn := newController(t, &config.NetworkConfig{}) defer closeFn() defer c.queue.ShutDown() stopCh := make(chan struct{}) defer close(stopCh) c.informerFactory.Start(stopCh) // Must wait for cache sync, otherwise resource creation events will be missing if the resources are created // in-between list and watch call of an informer. This is because fake clientset doesn't support watching with // resourceVersion. A watcher of fake clientset only gets events that happen after the watcher is created. c.informerFactory.WaitForCacheSync(stopCh) node1 := &corev1.Node{ ObjectMeta: metav1.ObjectMeta{ Name: "node1", }, Spec: corev1.NodeSpec{ PodCIDR: podCIDR.String(), PodCIDRs: []string{podCIDR.String()}, }, Status: corev1.NodeStatus{ Addresses: []corev1.NodeAddress{ { Type: corev1.NodeInternalIP, Address: nodeIP1.String(), }, }, }, } node2 := &corev1.Node{ ObjectMeta: metav1.ObjectMeta{ Name: "node2", }, Spec: corev1.NodeSpec{ PodCIDR: podCIDR.String(), PodCIDRs: []string{podCIDR.String()}, }, Status: corev1.NodeStatus{ Addresses: []corev1.NodeAddress{ { Type: corev1.NodeInternalIP, Address: nodeIP2.String(), }, }, }, } finishCh := make(chan struct{}) go func() { defer close(finishCh) c.clientset.CoreV1().Nodes().Create(context.TODO(), node1, metav1.CreateOptions{}) c.ofClient.EXPECT().InstallNodeFlows("node1", gomock.Any(), &dsIPs1, uint32(0), nil).Times(1) c.routeClient.EXPECT().AddRoutes(podCIDR, "node1", nodeIP1, podCIDRGateway).Times(1) c.processNextWorkItem() // Since node1 is not deleted yet, routes and flows for node2 shouldn't be installed as its PodCIDR is duplicate. c.clientset.CoreV1().Nodes().Create(context.TODO(), node2, metav1.CreateOptions{}) c.processNextWorkItem() // node1 is deleted, its routes and flows should be deleted. c.clientset.CoreV1().Nodes().Delete(context.TODO(), node1.Name, metav1.DeleteOptions{}) c.ofClient.EXPECT().UninstallNodeFlows("node1").Times(1) c.routeClient.EXPECT().DeleteRoutes(podCIDR).Times(1) c.processNextWorkItem() // After node1 is deleted, routes and flows should be installed for node2 successfully. c.ofClient.EXPECT().InstallNodeFlows("node2", gomock.Any(), &dsIPs2, uint32(0), nil).Times(1) c.routeClient.EXPECT().AddRoutes(podCIDR, "node2", nodeIP2, podCIDRGateway).Times(1) c.processNextWorkItem() }() select { case <-time.After(5 * time.Second): t.Errorf("Test didn't finish in time") case <-finishCh: } }
explode_data.jsonl/44596
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1039 }
[ 2830, 3393, 2051, 2354, 53979, 23527, 54146, 49, 1155, 353, 8840, 836, 8, 341, 1444, 11, 3265, 24911, 1669, 501, 2051, 1155, 11, 609, 1676, 30149, 2648, 37790, 16867, 3265, 24911, 741, 16867, 272, 29598, 10849, 332, 4454, 2822, 62644, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPopulateCluster_Docker_Spec(t *testing.T) { c := buildMinimalCluster() c.Spec.Docker = &kopsapi.DockerConfig{ MTU: fi.Int32(5678), InsecureRegistry: fi.String("myregistry.com:1234"), InsecureRegistries: []string{"myregistry.com:1234", "myregistry2.com:1234"}, RegistryMirrors: []string{"https://registry.example.com"}, LogOpt: []string{"env=FOO"}, } cloud, err := BuildCloud(c) if err != nil { t.Fatalf("error from BuildCloud: %v", err) } err = PerformAssignments(c, cloud) if err != nil { t.Fatalf("error from PerformAssignments: %v", err) } full, err := mockedPopulateClusterSpec(c) if err != nil { t.Fatalf("Unexpected error from PopulateCluster: %v", err) } if fi.Int32Value(full.Spec.Docker.MTU) != 5678 { t.Fatalf("Unexpected Docker MTU: %v", full.Spec.Docker.MTU) } if fi.StringValue(full.Spec.Docker.InsecureRegistry) != "myregistry.com:1234" { t.Fatalf("Unexpected Docker InsecureRegistry: %v", full.Spec.Docker.InsecureRegistry) } if strings.Join(full.Spec.Docker.InsecureRegistries, "!") != "myregistry.com:1234!myregistry2.com:1234" { t.Fatalf("Unexpected Docker InsecureRegistries: %v", full.Spec.Docker.InsecureRegistries) } if strings.Join(full.Spec.Docker.RegistryMirrors, "!") != "https://registry.example.com" { t.Fatalf("Unexpected Docker RegistryMirrors: %v", full.Spec.Docker.RegistryMirrors) } if strings.Join(full.Spec.Docker.LogOpt, "!") != "env=FOO" { t.Fatalf("Unexpected Docker LogOpt: %v", full.Spec.Docker.LogOpt) } }
explode_data.jsonl/75031
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 635 }
[ 2830, 3393, 11598, 6334, 28678, 1557, 13659, 1098, 992, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1936, 88328, 28678, 741, 1444, 36473, 909, 13659, 284, 609, 74, 3721, 2068, 909, 13659, 2648, 515, 197, 197, 8505, 52, 25, 394, 9136, 73...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestLeaderIncreaseNext(t *testing.T) { previousEnts := []pb.Entry{{Term: 1, Index: 1}, {Term: 1, Index: 2}, {Term: 1, Index: 3}} tests := []struct { // progress match uint64 next uint64 wnext uint64 }{ // match is not zero, optimistically increase next // previous entries + noop entry + propose + 1 {1, 2, uint64(len(previousEnts) + 1 + 1 + 1)}, // match is zero, not optimistically increase next {0, 2, 2}, } for i, tt := range tests { sm := newRaft(1, []uint64{1, 2}, 10, 1, NewMemoryStorage(), 0) sm.raftLog.append(previousEnts...) sm.becomeCandidate() sm.becomeLeader() sm.prs[2].Match, sm.prs[2].Next = tt.match, tt.next sm.Step(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{Data: []byte("somedata")}}}) p := sm.prs[2] if p.Next != tt.wnext { t.Errorf("#%d next = %d, want %d", i, p.Next, tt.wnext) } } }
explode_data.jsonl/67358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 383 }
[ 2830, 3393, 52621, 69556, 5847, 1155, 353, 8840, 836, 8, 341, 197, 19702, 2250, 82, 1669, 3056, 16650, 22330, 2979, 17249, 25, 220, 16, 11, 8008, 25, 220, 16, 2137, 314, 17249, 25, 220, 16, 11, 8008, 25, 220, 17, 2137, 314, 17249, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInjectableEndpointDispatch(t *testing.T) { endpoint, sock, dstIP := makeTestInjectableEndpoint(t) hdr := buffer.NewPrependable(1) hdr.Prepend(1)[0] = 0xFA packetRoute := stack.Route{RemoteAddress: dstIP} endpoint.WritePacket(&packetRoute, nil /* gso */, hdr, buffer.NewViewFromBytes([]byte{0xFB}).ToVectorisedView(), ipv4.ProtocolNumber) buf := make([]byte, 6500) bytesRead, err := sock.Read(buf) if err != nil { t.Fatalf("Unable to read from socketpair: %v", err) } if got, want := buf[:bytesRead], []byte{0xFA, 0xFB}; !bytes.Equal(got, want) { t.Fatalf("Read %v from the socketpair, wanted %v", got, want) } }
explode_data.jsonl/74608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 13738, 480, 27380, 11283, 1155, 353, 8840, 836, 8, 341, 6246, 2768, 11, 11087, 11, 10648, 3298, 1669, 1281, 2271, 13738, 480, 27380, 1155, 692, 9598, 3612, 1669, 4147, 7121, 4703, 3740, 480, 7, 16, 340, 9598, 3612, 28770, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDaemonKillFailedPods(t *testing.T) { tests := []struct { numFailedPods, numNormalPods, expectedCreates, expectedDeletes, expectedEvents int test string }{ {numFailedPods: 0, numNormalPods: 1, expectedCreates: 0, expectedDeletes: 0, expectedEvents: 0, test: "normal (do nothing)"}, {numFailedPods: 0, numNormalPods: 0, expectedCreates: 1, expectedDeletes: 0, expectedEvents: 0, test: "no pods (create 1)"}, {numFailedPods: 1, numNormalPods: 0, expectedCreates: 0, expectedDeletes: 1, expectedEvents: 1, test: "1 failed pod (kill 1), 0 normal pod (create 0; will create in the next sync)"}, {numFailedPods: 1, numNormalPods: 3, expectedCreates: 0, expectedDeletes: 3, expectedEvents: 1, test: "1 failed pod (kill 1), 3 normal pods (kill 2)"}, {numFailedPods: 2, numNormalPods: 1, expectedCreates: 0, expectedDeletes: 2, expectedEvents: 2, test: "2 failed pods (kill 2), 1 normal pod"}, } for _, test := range tests { t.Logf("test case: %s\n", test.test) for _, strategy := range updateStrategies() { ds := newDaemonSet("foo") ds.Spec.UpdateStrategy = *strategy manager, podControl, _, err := newTestController(ds) if err != nil { t.Fatalf("error creating DaemonSets controller: %v", err) } manager.dsStore.Add(ds) addNodes(manager.nodeStore, 0, 1, nil) addFailedPods(manager.podStore, "node-0", simpleDaemonSetLabel, ds, test.numFailedPods) addPods(manager.podStore, "node-0", simpleDaemonSetLabel, ds, test.numNormalPods) syncAndValidateDaemonSets(t, manager, ds, podControl, test.expectedCreates, test.expectedDeletes, test.expectedEvents) } } }
explode_data.jsonl/50335
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 671 }
[ 2830, 3393, 89177, 53734, 9408, 23527, 82, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22431, 9408, 23527, 82, 11, 1629, 12206, 23527, 82, 11, 3601, 54868, 11, 3601, 61317, 11, 3601, 7900, 526, 198, 197, 18185, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConsumerGroupHandler_error_nextConsumer(t *testing.T) { nextConsumer := new(consumertest.TracesSink) consumerError := fmt.Errorf("failed to consumer") nextConsumer.SetConsumeError(consumerError) c := consumerGroupHandler{ unmarshaller: &otlpProtoUnmarshaller{}, logger: zap.NewNop(), ready: make(chan bool), nextConsumer: nextConsumer, } wg := sync.WaitGroup{} wg.Add(1) groupClaim := &testConsumerGroupClaim{ messageChan: make(chan *sarama.ConsumerMessage), } go func() { e := c.ConsumeClaim(testConsumerGroupSession{}, groupClaim) assert.EqualError(t, e, consumerError.Error()) wg.Done() }() td := pdata.NewTraces() td.ResourceSpans().Resize(1) td.ResourceSpans().At(0).InitEmpty() request := &otlptrace.ExportTraceServiceRequest{ ResourceSpans: pdata.TracesToOtlp(td), } bts, err := request.Marshal() require.NoError(t, err) groupClaim.messageChan <- &sarama.ConsumerMessage{Value: bts} close(groupClaim.messageChan) wg.Wait() }
explode_data.jsonl/2063
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 386 }
[ 2830, 3393, 29968, 2808, 3050, 4096, 11257, 29968, 1155, 353, 8840, 836, 8, 341, 28144, 29968, 1669, 501, 17868, 1242, 83386, 8240, 2434, 45094, 340, 37203, 11761, 1454, 1669, 8879, 13080, 445, 16091, 311, 11502, 1138, 28144, 29968, 4202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsLocationAllowed(t *testing.T) { invalidType := &ingress.Ingress{} expected := false actual := isLocationAllowed(invalidType) if expected != actual { t.Errorf("Expected '%v' but returned '%v'", expected, actual) } loc := ingress.Location{ Denied: nil, } isAllowed := isLocationAllowed(&loc) if !isAllowed { t.Errorf("Expected '%v' but returned '%v'", true, isAllowed) } }
explode_data.jsonl/80586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 3872, 4707, 35382, 1155, 353, 8840, 836, 8, 341, 197, 11808, 929, 1669, 609, 287, 673, 5337, 2483, 16094, 42400, 1669, 895, 198, 88814, 1669, 374, 4707, 35382, 5900, 1891, 929, 692, 743, 3601, 961, 5042, 341, 197, 3244, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAccSnapshot_encryption(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_snapshot", "test") r := SnapshotResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.encryption(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("source_uri"), }) }
explode_data.jsonl/78017
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 14603, 15009, 13781, 15597, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 25505, 25212, 83920, 1155, 11, 330, 1370, 324, 4195, 53265, 497, 330, 1944, 1138, 7000, 1669, 68697, 4783, 31483, 8924, 20766, 2271, 1155, 11, 435, 11, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalAppend(t *testing.T) { for _, tc := range marshalingTestCases { t.Run(tc.name, func(t *testing.T) { if tc.reg != nil { t.Skip() // test requires custom registry } dst := make([]byte, 0, 1024) got, err := MarshalAppend(dst, tc.val) noerr(t, err) if !bytes.Equal(got, tc.want) { t.Errorf("Bytes are not equal. got %v; want %v", got, tc.want) t.Errorf("Bytes:\n%v\n%v", got, tc.want) } }) } }
explode_data.jsonl/12827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 55438, 23877, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 31996, 6132, 2271, 37302, 341, 197, 3244, 16708, 44415, 2644, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 743, 17130, 7031, 961, 2092, 341, 571, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestActivityService_ListRepositoryNotification(t *testing.T) { setup() defer teardown() mux.HandleFunc("/repos/o/r/notifications", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") fmt.Fprint(w, `[{"id":"1"}]`) }) notifications, _, err := client.Activity.ListRepositoryNotifications("o", "r", nil) if err != nil { t.Errorf("Activity.ListRepositoryNotifications returned error: %v", err) } want := []Notification{{ID: String("1")}} if !reflect.DeepEqual(notifications, want) { t.Errorf("Activity.ListRepositoryNotifications returned %+v, want %+v", notifications, want) } }
explode_data.jsonl/6716
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 4052, 1860, 27104, 4624, 11196, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 68354, 20271, 7382, 14, 38188, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 18185...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoute_SetDomains(t *testing.T) { testCases := []struct { param []string errWanted bool }{ {[]string{"example.io", "example.com"}, false}, {nil, true}, {[]string{}, true}, } for _, tc := range testCases { route := Route{} errGot := route.SetDomains(tc.param) if tc.errWanted != (errGot != nil) { t.Errorf("SetDomains(%s) = %v; errWanted = %t", route.domains, errGot, tc.errWanted) } if errGot == nil && !utils.CompareUnorderedArray(tc.param, route.domains) { t.Errorf("SetDomains(%s) != want %s", route.domains, tc.param) } } }
explode_data.jsonl/67792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 4899, 14812, 74713, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 36037, 257, 3056, 917, 198, 197, 9859, 54, 7566, 1807, 198, 197, 59403, 197, 197, 90, 1294, 917, 4913, 8687, 4245, 497, 330, 8687,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuleAlterCharset(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) sqls := [][]string{ { `alter table tbl default character set 'utf8';`, `alter table tbl default character set='utf8';`, `ALTER TABLE t1 CHANGE a b BIGINT NOT NULL, default character set utf8`, `ALTER TABLE t1 CHANGE a b BIGINT NOT NULL,default character set utf8`, `ALTER TABLE tbl_name CHARACTER SET charset_name;`, `ALTER TABLE t1 CHANGE a b BIGINT NOT NULL, character set utf8`, `ALTER TABLE t1 CHANGE a b BIGINT NOT NULL,character set utf8`, `alter table t1 convert to character set utf8 collate utf8_unicode_ci;`, `alter table t1 default collate = utf8_unicode_ci;`, }, { // 反面的例子 `ALTER TABLE t MODIFY latin1_text_col TEXT CHARACTER SET utf8`, `ALTER TABLE t1 CHANGE c1 c1 TEXT CHARACTER SET utf8;`, }, } for _, sql := range sqls[0] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleAlterCharset() if rule.Item != "ALT.001" { t.Error(sql, " Rule not match:", rule.Item, "Expect : ALT.001") } } else { t.Error("sqlparser.Parse Error:", err) } } for _, sql := range sqls[1] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleAlterCharset() if rule.Item != "OK" { t.Error(sql, " Rule not match:", rule.Item, "Expect : OK") } } else { t.Error("sqlparser.Parse Error:", err) } } common.Log.Debug("Exiting function: %s", common.GetFunctionName()) }
explode_data.jsonl/76824
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 629 }
[ 2830, 3393, 11337, 74290, 78172, 1155, 353, 8840, 836, 8, 341, 83825, 5247, 20345, 445, 82867, 729, 25, 1018, 82, 497, 4185, 2234, 5152, 675, 2398, 30633, 82, 1669, 52931, 917, 515, 197, 197, 515, 298, 197, 63, 37277, 1965, 21173, 163...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestMutualAuth(t *testing.T) { t.Parallel() var tests = []struct { name string servers []testServer trustedClients []*tls.Config unTrustedClients []*tls.Config }{ { name: "ClientAuthRequiredWithSingleOrg", servers: testOrgs[0].testServers(9060, [][]byte{}), trustedClients: testOrgs[0].trustedClients([][]byte{}), unTrustedClients: testOrgs[1].trustedClients([][]byte{testOrgs[0].rootCA}), }, { name: "ClientAuthRequiredWithChildClientOrg", servers: testOrgs[0].testServers(9070, [][]byte{testOrgs[0].childOrgs[0].rootCA}), trustedClients: testOrgs[0].childOrgs[0].trustedClients([][]byte{testOrgs[0].rootCA}), unTrustedClients: testOrgs[0].childOrgs[1].trustedClients([][]byte{testOrgs[0].rootCA}), }, { name: "ClientAuthRequiredWithMultipleChildClientOrgs", servers: testOrgs[0].testServers(9080, append([][]byte{}, testOrgs[0].childOrgs[0].rootCA, testOrgs[0].childOrgs[1].rootCA)), trustedClients: append(append([]*tls.Config{}, testOrgs[0].childOrgs[0].trustedClients([][]byte{testOrgs[0].rootCA})...), testOrgs[0].childOrgs[1].trustedClients([][]byte{testOrgs[0].rootCA})...), unTrustedClients: testOrgs[1].trustedClients([][]byte{testOrgs[0].rootCA}), }, { name: "ClientAuthRequiredWithDifferentServerAndClientOrgs", servers: testOrgs[0].testServers(9090, [][]byte{testOrgs[1].rootCA}), trustedClients: testOrgs[1].trustedClients([][]byte{testOrgs[0].rootCA}), unTrustedClients: testOrgs[0].childOrgs[1].trustedClients([][]byte{testOrgs[0].rootCA}), }, { name: "ClientAuthRequiredWithDifferentServerAndChildClientOrgs", servers: testOrgs[1].testServers(9100, [][]byte{testOrgs[0].childOrgs[0].rootCA}), trustedClients: testOrgs[0].childOrgs[0].trustedClients([][]byte{testOrgs[1].rootCA}), unTrustedClients: testOrgs[1].childOrgs[0].trustedClients([][]byte{testOrgs[1].rootCA}), }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { t.Parallel() t.Logf("Running test %s ...", test.name) testErr := runMutualAuth(t, test.servers, test.trustedClients, test.unTrustedClients) if testErr != nil { t.Fatalf("%s failed with error: %s", test.name, testErr.Error()) } }) } }
explode_data.jsonl/2127
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1100 }
[ 2830, 3393, 51440, 928, 5087, 1155, 353, 8840, 836, 8, 1476, 3244, 41288, 7957, 741, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 1797, 914, 198, 197, 1903, 18729, 688, 3056, 1944, 5475, 198, 197, 25583, 27145, 47174, 256, 29838, 34488...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyslog(t *testing.T) { if logger, err := log.NewSyslogLogger("test", log.DEBUG); err == nil { logger.Debug("Now: %v", time.Now()) } else { t.Errorf("error on syslog: %v", err) } }
explode_data.jsonl/77823
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 32792, 839, 1155, 353, 8840, 836, 8, 341, 743, 5925, 11, 1848, 1669, 1487, 7121, 32792, 839, 7395, 445, 1944, 497, 1487, 38136, 1215, 1848, 621, 2092, 341, 197, 17060, 20345, 445, 7039, 25, 1018, 85, 497, 882, 13244, 2398,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestUnboxing(t *testing.T) { a := StructWithJsField1{Object: js.Global.Get("Object").New()} b := &StructWithJsField2{object: js.Global.Get("Object").New()} if !dummys.Call("isEqual", a, a.Object).Bool() || !dummys.Call("isEqual", b, b.object).Bool() { t.Fail() } wa := Wrapper1{StructWithJsField1: a} wb := Wrapper2{innerStruct: b} if !dummys.Call("isEqual", wa, a.Object).Bool() || !dummys.Call("isEqual", wb, b.object).Bool() { t.Fail() } }
explode_data.jsonl/56785
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 1806, 89174, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 16139, 2354, 30480, 1877, 16, 90, 1190, 25, 6994, 27381, 2234, 445, 1190, 1827, 3564, 23509, 2233, 1669, 609, 9422, 2354, 30480, 1877, 17, 90, 1700, 25, 6994, 27381, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddressVHost(t *testing.T) { for i, test := range []struct { addr Address expected string }{ {Address{Original: "host:1234"}, "host:1234"}, {Address{Original: "host:1234/foo"}, "host:1234/foo"}, {Address{Original: "host/foo"}, "host/foo"}, {Address{Original: "http://host/foo"}, "host/foo"}, {Address{Original: "https://host/foo"}, "host/foo"}, } { actual := test.addr.VHost() if actual != test.expected { t.Errorf("Test %d: expected '%s' but got '%s'", i, test.expected, actual) } } }
explode_data.jsonl/26458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 4286, 53, 9296, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 1273, 1669, 2088, 3056, 1235, 341, 197, 53183, 257, 9177, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 90, 4286, 90, 18395, 25, 330, 3790, 25, 16, 17, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestQueryReceipt(t *testing.T) { ctx, _, _, _, k, _ := createTestInput(t, false) appPrivateKey := getRandomPrivateKey() appPubKey := appPrivateKey.PublicKey().RawString() npk := getRandomPubKey() ethereum, err := types.NonNativeChain{ Ticker: "eth", Netid: "4", Version: "v1.9.9", Client: "geth", Inter: "", }.HashString() if err != nil { t.Fatalf(err.Error()) } // create a session header validHeader := types.SessionHeader{ ApplicationPubKey: appPubKey, Chain: ethereum, SessionBlockHeight: 976, } receipt := types.Receipt{ SessionHeader: validHeader, ServicerAddress: npk.Address().String(), Total: 2000, EvidenceType: types.RelayEvidence, } addr := sdk.Address(sdk.Address(npk.Address())) mockCtx := new(Ctx) mockCtx.On("KVStore", k.storeKey).Return(ctx.KVStore(k.storeKey)) mockCtx.On("PrevCtx", validHeader.SessionBlockHeight).Return(ctx, nil) mockCtx.On("Logger").Return(ctx.Logger()) er := k.SetReceipt(mockCtx, addr, receipt) if er != nil { t.Fatal(er) } bz, er := types.ModuleCdc.MarshalJSON(types.QueryReceiptParams{ Address: sdk.Address(npk.Address()), Header: validHeader, Type: "relay", }) assert.Nil(t, er) request := abci.RequestQuery{ Data: bz, Path: types.QueryReceipt, Height: ctx.BlockHeight(), } resbz, err := queryReceipt(ctx, request, k) assert.Nil(t, err) var stored types.Receipt er = types.ModuleCdc.UnmarshalJSON(resbz, &stored) assert.Nil(t, er) assert.Equal(t, stored, receipt) // receipts query var stored2 []types.Receipt bz2, er2 := types.ModuleCdc.MarshalJSON(types.QueryReceiptsParams{ Address: sdk.Address(npk.Address()), }) assert.Nil(t, er2) request2 := abci.RequestQuery{ Data: bz2, Path: types.QueryReceipt, Height: ctx.BlockHeight(), Prove: false, XXX_NoUnkeyedLiteral: struct{}{}, XXX_unrecognized: nil, XXX_sizecache: 0, } resbz2, err := queryReceipts(ctx, request2, k) assert.Nil(t, err) er = types.ModuleCdc.UnmarshalJSON(resbz2, &stored2) assert.Nil(t, er) assert.Equal(t, stored2, []types.Receipt{receipt}) }
explode_data.jsonl/79628
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1000 }
[ 2830, 3393, 2859, 67461, 1155, 353, 8840, 836, 8, 341, 20985, 11, 8358, 8358, 8358, 595, 11, 716, 1669, 1855, 2271, 2505, 1155, 11, 895, 340, 28236, 75981, 1669, 52436, 75981, 741, 28236, 29162, 1592, 1669, 906, 75981, 49139, 1592, 1005...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJSON(t *testing.T) { var SampleJSON = `{"id":1,"age":42,"favoriteColor": "Blue","name": "Bob","city": "Madison" } {"id":2,"age":17,"favoriteColor": "Yellow","name": "Steve O","city": "New York" } {"id":3,"age":18,"favoriteColor": "Blue","name": "James","city": "New York" } {"id":4,"age":22,"favoriteColor": "Purple","name": "Alice","city": "Boston" }` type Base struct { Age int `json:"age"` } type Person struct { Base ID int `json:"id"` Name string `json:"name"` HasPet bool } Convey("JSON", t, func() { stage := ingest.NewStage() parser := JSON(Person{}) FocusConvey("works with encoding/json", func() { reader := bytes.NewBufferString(SampleJSON) go func() { stage.In <- reader close(stage.In) }() var err error go func() { err = parser.Run(stage) close(stage.Out) }() results := []Person{} for res := range stage.Out { results = append(results, res.(Person)) } So(err, ShouldBeNil) So(results, ShouldHaveLength, 4) So(results, ShouldContainSomethingLike, Person{ ID: 3, Base: Base{Age: 18}, Name: "James", }) }) Convey("navigating to a selection", func() { sampleJSON := `{"id":1,"nested":{"deeply":[1, 2, 3, 4]}}` Convey("works when selecting an entire array", func() { parser := JSON([]int{}, JSONOpts{Selector: "nested.deeply"}) rc := ioutil.NopCloser(bytes.NewBufferString(sampleJSON)) go parser.handleIO(rc) select { case err := <-parser.workerErr: So(err, ShouldBeNil) case rec := <-parser.workerOut: So(rec, ShouldResemble, []int{1, 2, 3, 4}) } }) Convey("works when iterating an array", func() { var result int parser := JSON(result, JSONOpts{Selector: "nested.deeply.*"}) rc := ioutil.NopCloser(bytes.NewBufferString(sampleJSON)) go parser.handleIO(rc) select { case err := <-parser.workerErr: So(err, ShouldBeNil) case rec := <-parser.workerOut: So(rec, ShouldEqual, 1) } }) }) }) }
explode_data.jsonl/43696
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 854 }
[ 2830, 3393, 5370, 1155, 353, 8840, 836, 8, 341, 2405, 19143, 5370, 284, 1565, 4913, 307, 788, 16, 1335, 424, 788, 19, 17, 1335, 38490, 1636, 788, 330, 10331, 2198, 606, 788, 330, 32388, 2198, 8926, 788, 330, 37036, 3335, 1, 456, 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 TestSQLReindexJobQueue_Integration_PopulateJobs(t *testing.T) { dbName := "state___reindex_queue___populate_jobs" queue := initSQLTest(t, dbName) ch := make(chan interface{}) defer close(ch) wg := sync.WaitGroup{} // tx0 -- will be held up by the test hook, eventually fail to commit testHookPopulateStart = func() { ch <- nil ch <- nil } wg.Add(1) go func() { populated, err := queue.PopulateJobs() assert.NoError(t, err) assert.False(t, populated) wg.Done() }() select { // tx0 has begun case <-ch: // Prevent test hanging case <-time.After(15 * time.Second): t.Fatal("PopulateJobs failed to start transaction") return } // tx1 -- will begin after tx0 has begun, but tx1 will move first and commit its update testHookPopulateStart = func() {} populated, err := queue.PopulateJobs() assert.NoError(t, err) assert.True(t, populated) <-ch // tx0 can continue, will fail wg.Wait() // All jobs are available statuses, err := GetAllStatuses(queue) assert.NoError(t, err) for _, st := range statuses { assert.Equal(t, StatusAvailable, st) } }
explode_data.jsonl/25315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 409 }
[ 2830, 3393, 6688, 693, 1252, 12245, 7554, 32054, 17376, 1088, 453, 6334, 40667, 1155, 353, 8840, 836, 8, 341, 20939, 675, 1669, 330, 2454, 5973, 265, 1252, 10841, 5973, 47721, 37247, 698, 46993, 1669, 2930, 6688, 2271, 1155, 11, 75564, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseFileSizeStr(t *testing.T) { for _, v := range []string{"1k", "3.86mb", "4.001Gb", "32"} { size, err := converter.ParseFileSizeStr(v) if err != nil { t.Fatalf("%s\n", err) } fmt.Println(v, size) } }
explode_data.jsonl/71382
{ "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, 14463, 67649, 2580, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 348, 1669, 2088, 3056, 917, 4913, 16, 74, 497, 330, 18, 13, 23, 21, 3096, 497, 330, 19, 13, 15, 15, 16, 84097, 497, 330, 18, 17, 9207, 341, 197, 13832, 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 TestVPMEM(t *testing.T) { testutilities.RequiresBuild(t, osversion.RS5) alpineLayers := testutilities.LayerFolders(t, "alpine") id := "TestVPMEM" u := testutilities.CreateLCOWUVM(t, id) defer u.Terminate() var iterations uint32 = uvm.MaxVPMEM // Use layer.vhd from the alpine image as something to add tempDir := testutilities.CreateTempDir(t) if err := copyfile.CopyFile(filepath.Join(alpineLayers[0], "layer.vhd"), filepath.Join(tempDir, "layer.vhd"), true); err != nil { t.Fatal(err) } defer os.RemoveAll(tempDir) if err := wclayer.GrantVmAccess(id, filepath.Join(tempDir, "layer.vhd")); err != nil { t.Fatal(err) } for i := 0; i < int(iterations); i++ { deviceNumber, uvmPath, err := u.AddVPMEM(filepath.Join(tempDir, "layer.vhd"), true) if err != nil { t.Fatalf("AddVPMEM failed: %s", err) } logrus.Debugf("exposed as %s on %d", uvmPath, deviceNumber) } // Remove them all for i := 0; i < int(iterations); i++ { if err := u.RemoveVPMEM(filepath.Join(tempDir, "layer.vhd")); err != nil { t.Fatalf("RemoveVPMEM failed: %s", err) } } }
explode_data.jsonl/35547
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 453 }
[ 2830, 3393, 53, 8795, 2716, 1155, 353, 8840, 836, 8, 341, 18185, 61134, 85012, 11066, 1155, 11, 2643, 4366, 2013, 50, 20, 340, 69571, 38038, 40235, 1669, 1273, 61134, 66074, 92779, 1155, 11, 330, 278, 38038, 5130, 15710, 1669, 330, 2271...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBot_LeaveChat(t *testing.T) { type fields struct { apiClient apiClient } tests := []struct { name string fields fields wantResult bool wantErr bool }{ { name: "test1", fields: fields{ apiClient: &mockAPIClient{ method: "leaveChat", interfaceMethod: func() interface{} { return true }, bytesMethod: func() []byte { return []byte("true") }, }, }, wantResult: true, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { b := &Bot{ apiClient: tt.fields.apiClient, } gotResult, err := b.LeaveChat(axon.O{}) if (err != nil) != tt.wantErr { t.Errorf("Bot.LeaveChat() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(gotResult, tt.wantResult) { t.Errorf("Bot.LeaveChat() = %v, want %v", gotResult, tt.wantResult) } }) } }
explode_data.jsonl/46099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 23502, 62, 21833, 15672, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 54299, 2959, 6330, 2959, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 55276, 257, 5043, 198, 197, 50780, 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 TestContainsExpressionNilCol(t *testing.T) { ctx := test.NewTestContext(t) e := NewContainsExpression(newTestExpression(nil), NewNumberLiteralInt(11), false) res, err := e.Evaluate(ctx, nil, nil) assert.NoError(t, err, "no error expected") if assert.Implements(t, (*hipathsys.BooleanAccessor)(nil), res) { assert.Equal(t, false, res.(hipathsys.BooleanAccessor).Bool()) } }
explode_data.jsonl/54557
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 23805, 9595, 19064, 6127, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 1273, 7121, 2271, 1972, 1155, 692, 7727, 1669, 1532, 23805, 9595, 1755, 2271, 9595, 27907, 701, 1532, 2833, 17350, 1072, 7, 16, 16, 701, 895, 340, 10202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChildSpanFromGlobalTracer(t *testing.T) { otelglobal.SetTraceProvider(&mocktrace.Provider{}) handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) _, ok := span.(*mocktrace.Span) assert.True(t, ok) spanTracer := span.Tracer() mockTracer, ok := spanTracer.(*mocktrace.Tracer) require.True(t, ok) assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful", mockTracer.Name) resp.WriteHeader(http.StatusOK) } ws := &restful.WebService{} ws.Route(ws.GET("/user/{id}").To(handlerFunc). Returns(200, "OK", nil). Returns(404, "Not Found", nil)) container := restful.NewContainer() container.Filter(restfultrace.OTelFilter("my-service")) container.Add(ws) r := httptest.NewRequest("GET", "/user/123", nil) w := httptest.NewRecorder() container.ServeHTTP(w, r) }
explode_data.jsonl/50850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 356 }
[ 2830, 3393, 3652, 12485, 3830, 11646, 1282, 9584, 1155, 353, 8840, 836, 8, 341, 197, 40785, 9752, 4202, 6550, 5179, 2099, 16712, 15067, 36208, 6257, 692, 53326, 9626, 1669, 2915, 6881, 353, 3927, 1262, 9659, 11, 9039, 353, 3927, 1262, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDimensionsReturnsConflict(t *testing.T) { t.Parallel() Convey("Get dimensions returns conflict", t, func() { r, err := createRequestWithToken("GET", "http://localhost:21800/instances/123/dimensions", nil) r.Header.Set("If-Match", "wrong") So(err, ShouldBeNil) w := httptest.NewRecorder() mockedDataStore, isLocked := storeMockWithLock(false) mockedDataStore.GetInstanceFunc = func(ctx context.Context, ID string, eTagSelector string) (*models.Instance, error) { So(*isLocked, ShouldBeTrue) return nil, errs.ErrInstanceConflict } datasetAPI := getAPIWithCMDMocks(testContext, mockedDataStore, &mocks.DownloadsGeneratorMock{}) datasetAPI.Router.ServeHTTP(w, r) So(w.Code, ShouldEqual, http.StatusConflict) So(w.Body.String(), ShouldContainSubstring, errs.ErrInstanceConflict.Error()) So(mockedDataStore.GetInstanceCalls(), ShouldHaveLength, 1) So(mockedDataStore.GetInstanceCalls()[0].ID, ShouldEqual, "123") So(mockedDataStore.GetInstanceCalls()[0].ETagSelector, ShouldEqual, "wrong") validateLock(mockedDataStore, "123") So(*isLocked, ShouldBeFalse) }) }
explode_data.jsonl/20841
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 413 }
[ 2830, 3393, 1949, 21351, 16446, 57974, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 93070, 5617, 445, 1949, 15336, 4675, 12055, 497, 259, 11, 2915, 368, 341, 197, 7000, 11, 1848, 1669, 1855, 1900, 2354, 3323, 445, 3806, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDownloaderFetchIsolated(t *testing.T) { t.Parallel() ctx := context.Background() string1 := "hello world!" data1 := []byte(string1) string2 := "wat" data2 := []byte(string2) server := isolatedfake.New() data1hash := server.Inject(data1) data2hash := server.Inject(data2) onePath := filepath.Join("foo", "one.txt") twoPath := filepath.Join("foo", "two.txt") isolated1 := isolated.New() isolated1.Files = map[string]isolated.File{ onePath: isolated.BasicFile(data1hash, 0664, int64(len(data1))), twoPath: isolated.BasicFile(data2hash, 0664, int64(len(data2))), } isolated1bytes, _ := json.Marshal(&isolated1) isolated1hash := server.Inject(isolated1bytes) lolPath := filepath.Join("bar", "lol.txt") oloPath := filepath.Join("foo", "boz", "olo.txt") isolated2 := isolated.New() isolated2.Files = map[string]isolated.File{ lolPath: isolated.BasicFile(data1hash, 0664, int64(len(data1))), oloPath: isolated.BasicFile(data2hash, 0664, int64(len(data2))), } isolatedFiles := stringset.NewFromSlice([]string{ onePath, twoPath, lolPath, oloPath, }...) blahPath := "blah.txt" // Symlinks not supported on Windows. if runtime.GOOS != "windows" { isolated2.Files[blahPath] = isolated.SymLink(oloPath) isolatedFiles.Add(blahPath) } isolated2.Includes = isolated.HexDigests{isolated1hash} isolated2bytes, _ := json.Marshal(&isolated2) isolated2hash := server.Inject(isolated2bytes) ts := httptest.NewServer(server) defer ts.Close() client := isolatedclient.New(nil, nil, ts.URL, isolatedclient.DefaultNamespace, nil, nil) Convey(`A downloader should be able to download the isolated.`, t, func() { tmpDir, err := ioutil.TempDir("", "isolated") So(err, ShouldBeNil) d := New(ctx, client, 8) files, err := d.FetchIsolated(isolated2hash, tmpDir) So(err, ShouldBeNil) So(stringset.NewFromSlice(files...), ShouldResemble, isolatedFiles) oneBytes, err := ioutil.ReadFile(filepath.Join(tmpDir, onePath)) So(err, ShouldBeNil) So(oneBytes, ShouldResemble, data1) twoBytes, err := ioutil.ReadFile(filepath.Join(tmpDir, twoPath)) So(err, ShouldBeNil) So(twoBytes, ShouldResemble, data2) lolBytes, err := ioutil.ReadFile(filepath.Join(tmpDir, lolPath)) So(err, ShouldBeNil) So(lolBytes, ShouldResemble, data1) oloBytes, err := ioutil.ReadFile(filepath.Join(tmpDir, oloPath)) So(err, ShouldBeNil) So(oloBytes, ShouldResemble, data2) if runtime.GOOS != "windows" { l, err := os.Readlink(filepath.Join(tmpDir, blahPath)) So(err, ShouldBeNil) So(l, ShouldResemble, filepath.Join(tmpDir, oloPath)) } }) }
explode_data.jsonl/24893
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1030 }
[ 2830, 3393, 92698, 20714, 3872, 80519, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 19047, 2822, 11357, 16, 1669, 330, 14990, 1879, 24734, 8924, 16, 1669, 3056, 3782, 3609, 16, 692, 11357, 17, 1669, 330, 5804...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDaoUpdateTag(t *testing.T) { var ( c = context.TODO() tag = &model.Tag{} ) convey.Convey("UpdateTag", t, func(ctx convey.C) { affect, err := d.UpdateTag(c, tag) ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) { ctx.So(err, convey.ShouldBeNil) ctx.So(affect, convey.ShouldNotBeNil) }) }) }
explode_data.jsonl/36691
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 12197, 4289, 5668, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 1444, 256, 284, 2266, 90988, 741, 197, 60439, 284, 609, 2528, 23676, 16094, 197, 340, 37203, 5617, 4801, 5617, 445, 4289, 5668, 497, 259, 11, 2915, 7502, 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 TestCreditNoteListPreviewLines(t *testing.T) { params := &stripe.CreditNoteLineItemListPreviewParams{ Invoice: stripe.String("in_123"), Lines: []*stripe.CreditNoteLineParams{ { Type: stripe.String(string(stripe.CreditNoteLineItemTypeInvoiceLineItem)), Amount: stripe.Int64(100), InvoiceLineItem: stripe.String("ili_123"), TaxRates: stripe.StringSlice([]string{ "txr_123", }), }, }, } i := ListPreviewLines(params) // Verify that we can get at least one invoice assert.True(t, i.Next()) assert.Nil(t, i.Err()) assert.NotNil(t, i.CreditNoteLineItem()) }
explode_data.jsonl/29990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 264 }
[ 2830, 3393, 33493, 9112, 852, 24625, 16794, 1155, 353, 8840, 836, 8, 341, 25856, 1669, 609, 61233, 727, 10827, 9112, 2460, 82874, 24625, 4870, 515, 197, 197, 34674, 25, 45542, 6431, 445, 258, 62, 16, 17, 18, 4461, 197, 15070, 1543, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWatchNoDir(t *testing.T) { t.Parallel() // Create ks but not the directory that it watches. rand.Seed(time.Now().UnixNano()) dir := filepath.Join(os.TempDir(), fmt.Sprintf("eth-keystore-watch-test-%d-%d", os.Getpid(), rand.Int())) ks := NewKeyStore(dir, LightScryptN, LightScryptP) list := ks.Accounts() if len(list) > 0 { t.Error("initial account list not empty:", list) } time.Sleep(100 * time.Millisecond) // Create the directory and copy a key file into it. os.MkdirAll(dir, 0700) defer os.RemoveAll(dir) file := filepath.Join(dir, "aaa") if err := cp.CopyFile(file, cachetestAccounts[0].URL.Path); err != nil { t.Fatal(err) } // ks should see the account. wantAccounts := []accounts.Account{cachetestAccounts[0]} wantAccounts[0].URL = accounts.URL{Scheme: KeyStoreScheme, Path: file} for d := 200 * time.Millisecond; d < 8*time.Second; d *= 2 { list = ks.Accounts() if reflect.DeepEqual(list, wantAccounts) { // ks should have also received change notifications select { case <-ks.changes: default: t.Fatalf("wasn't notified of new accounts") } return } time.Sleep(d) } t.Errorf("\ngot %v\nwant %v", list, wantAccounts) }
explode_data.jsonl/36028
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 477 }
[ 2830, 3393, 14247, 2753, 6184, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 4230, 41282, 714, 537, 279, 6220, 429, 432, 31760, 624, 7000, 437, 5732, 291, 9730, 13244, 1005, 55832, 83819, 2398, 48532, 1669, 26054, 223...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestDirect_NoListeners(t *testing.T) { g := NewGomegaWithT(t) xforms := GetProviders(basicmeta.MustGet()).Create(processing.ProcessorOptions{}) g.Expect(xforms).To(HaveLen(1)) src := &fixtures.Source{} xform := xforms[0] src.Dispatch(xform) xform.Start() defer xform.Stop() src.Handlers.Handle(event.FullSyncFor(basicmeta.K8SCollection1)) src.Handlers.Handle(event.Event{Kind: event.Reset}) src.Handlers.Handle(event.AddFor(basicmeta.K8SCollection1, data.EntryN1I1V1)) // No crash }
explode_data.jsonl/37559
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 16027, 36989, 31570, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 692, 10225, 9807, 1669, 2126, 37351, 1883, 5971, 5490, 50463, 1949, 6011, 4021, 7, 20660, 29012, 269, 3798, 37790, 3174, 81893, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitViper(t *testing.T) { lvl := zap.NewAtomicLevelAt(zapcore.DebugLevel) core, logs := observer.New(lvl) defer log.SetLogger(zap.New(core)).Restore() err := InitViper("") assert.NotNil(t, err) assert.Nil(t, InitViper("foo")) assert.Equal(t, 1, logs.Len()) }
explode_data.jsonl/19189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 3803, 53, 12858, 1155, 353, 8840, 836, 8, 341, 8810, 14536, 1669, 32978, 7121, 65857, 4449, 1655, 13174, 391, 2153, 20345, 4449, 340, 71882, 11, 18422, 1669, 22067, 7121, 2333, 14536, 340, 16867, 1487, 4202, 7395, 13174, 391, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMissingDestinationColumns(t *testing.T) { type MissingColumns struct { ID int `db:"id"` } var row MissingColumns err := testDB.SQL(`SELECT * FROM posts LIMIT 1`).QueryStruct(&row) assert.Error(t, err, "Result had more columns than destination struct. Should have returned error") // sqlx will error when the result of a query has columns which are // not present in destination struct. This becomes problematic // when queries use SELECT *. err = testDB.Loose().SQL(`SELECT * FROM posts LIMIT 1`).QueryStruct(&row) assert.NoError(t, err, "In non-strict mode, having more result columns than destination should not error") var rows []*MissingColumns err = testDB.Loose().SQL(`SELECT * FROM posts LIMIT 2`).QueryStructs(&rows) assert.NoError(t, err, "In non-strict mode, having more result columns than destination should not error") }
explode_data.jsonl/36569
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 25080, 33605, 13965, 1155, 353, 8840, 836, 8, 1476, 13158, 35264, 13965, 2036, 341, 197, 29580, 526, 1565, 1999, 2974, 307, 8805, 197, 532, 2405, 2802, 35264, 13965, 198, 9859, 1669, 1273, 3506, 25095, 5809, 4858, 353, 4295, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPostSetup(t *testing.T) { t.Parallel() h := testSetup() r, w, _ := h.newHTTP("GET") user := &mocks.User{Email: "test@test.com"} h.putUserInCtx(user, &r) var err error if err = h.totp.PostSetup(w, r); err != nil { t.Error(err) } // Flush ClientState w.WriteHeader(http.StatusOK) opts := h.redirector.Options if opts.Code != http.StatusTemporaryRedirect { t.Error("status wrong:", opts.Code) } if opts.RedirectPath != "/auth/2fa/totp/confirm" { t.Error("redir path wrong:", opts.RedirectPath) } if len(h.session.ClientValues[SessionTOTPSecret]) == 0 { t.Error("no secret in the session") } }
explode_data.jsonl/63397
{ "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, 4133, 21821, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 9598, 1669, 1273, 21821, 2822, 7000, 11, 289, 11, 716, 1669, 305, 4618, 9230, 445, 3806, 1138, 19060, 1669, 609, 16712, 82, 7344, 90, 4781, 25, 330, 1944, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadConfig_MinimalConfig(t *testing.T) { // Arrange testConfig := ` { "ServiceDescription" : { "DisplayName" : "My Service", "Description" : "My Service Desc" }, "Services" : [ { "Path" : "test/path/1" } ] }` tmpFile := writeTestConfig(t, testConfig) defer os.Remove(tmpFile) vars := config.ReplacementVars{ ServiceName: "MyServiceName", ServiceRoot: `C:\ProgramFiles\MyService`, } // Act c, err := config.LoadConfig(tmpFile, vars) // Assert if err != nil { t.Errorf("Error loading config: %v", err) } if c.Services[0].Path != "test/path/1" { t.Error("Problem extracting path") } if len(c.EnvironmentVars) != 0 { t.Error("Expected no environment") } }
explode_data.jsonl/53030
{ "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, 5879, 2648, 62122, 2861, 2648, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 18185, 2648, 1669, 22074, 262, 341, 286, 330, 1860, 5009, 1, 549, 341, 310, 330, 26456, 1, 549, 330, 5050, 5362, 756, 310, 330, 5009, 1, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDaoTxInsertTag(t *testing.T) { var tag = &model.Tag{ Name: "12345678", } convey.Convey("TxInsertTag", t, func(ctx convey.C) { tx, err := d.BeginTran(context.TODO()) if err != nil { return } id, err := d.TxInsertTag(tx, tag) ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) { ctx.So(err, convey.ShouldBeNil) ctx.So(id, convey.ShouldBeGreaterThanOrEqualTo, 0) }) tx.Rollback() }) }
explode_data.jsonl/36689
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 12197, 31584, 13780, 5668, 1155, 353, 8840, 836, 8, 341, 2405, 4772, 284, 609, 2528, 23676, 515, 197, 21297, 25, 330, 16, 17, 18, 19, 20, 21, 22, 23, 756, 197, 532, 37203, 5617, 4801, 5617, 445, 31584, 13780, 5668, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFlattenDataSourcePodAffinityTermInto(t *testing.T) { _default := map[string]interface{}{ "label_selector": nil, "namespaces": func() []interface{} { return nil }(), "topology_key": "", "namespace_selector": nil, } type args struct { in core.PodAffinityTerm } tests := []struct { name string args args want map[string]interface{} }{ { name: "default", args: args{ in: core.PodAffinityTerm{}, }, want: _default, }, { name: "LabelSelector - default", args: args{ in: func() core.PodAffinityTerm { subject := core.PodAffinityTerm{} subject.LabelSelector = nil return subject }(), }, want: _default, }, { name: "Namespaces - default", args: args{ in: func() core.PodAffinityTerm { subject := core.PodAffinityTerm{} subject.Namespaces = nil return subject }(), }, want: _default, }, { name: "TopologyKey - default", args: args{ in: func() core.PodAffinityTerm { subject := core.PodAffinityTerm{} subject.TopologyKey = "" return subject }(), }, want: _default, }, { name: "NamespaceSelector - default", args: args{ in: func() core.PodAffinityTerm { subject := core.PodAffinityTerm{} subject.NamespaceSelector = nil return subject }(), }, want: _default, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := map[string]interface{}{} FlattenDataSourcePodAffinityTermInto(tt.args.in, got) if diff := cmp.Diff(tt.want, got); diff != "" { t.Errorf("FlattenDataSourcePodAffinityTerm() mismatch (-want +got):\n%s", diff) } }) } }
explode_data.jsonl/53683
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 760 }
[ 2830, 3393, 3882, 14456, 17173, 23527, 25841, 13489, 17249, 26591, 1155, 353, 8840, 836, 8, 341, 197, 9993, 1669, 2415, 14032, 31344, 67066, 197, 197, 92667, 28890, 788, 257, 2092, 345, 197, 197, 1, 11400, 27338, 788, 260, 2915, 368, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListLeveragedTokens(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip() } _, err := f.ListLeveragedTokens(context.Background()) if err != nil { t.Error(err) } }
explode_data.jsonl/15198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 852, 43, 2054, 3279, 29300, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 741, 197, 532, 197, 6878, 1848, 1669, 282, 5814, 43, 2054, 3279, 29300, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClassification(t *testing.T) { var tests = []struct { name string classification ciphersuites.Classification expected string }{ { name: "returns recommended", classification: ciphersuites.Recommended, expected: "recommended", }, { name: "returns secure", classification: ciphersuites.Secure, expected: "secure", }, { name: "returns weak", classification: ciphersuites.Weak, expected: "weak", }, { name: "returns insecure", classification: ciphersuites.Insecure, expected: "insecure", }, { name: "returns unknown", classification: ciphersuites.Unknown, expected: "unknown", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { classification := tt.classification.String() if classification != tt.expected { t.Errorf("expected %s, got %s", tt.expected, classification) } }) } }
explode_data.jsonl/61232
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 448 }
[ 2830, 3393, 85040, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 15487, 2404, 272, 82077, 3083, 288, 19331, 2404, 198, 197, 42400, 981, 914, 198, 197, 59403, 197, 197, 515, 298, 11609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestServerStateUpdates(t *testing.T) { t.Parallel() for _, test := range stateUpdateTests { t.Run(test.name, func(t *testing.T) { testServerStateUpdates(t, test) }) } }
explode_data.jsonl/36163
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 5475, 1397, 37091, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2023, 8358, 1273, 1669, 2088, 1584, 4289, 18200, 341, 197, 3244, 16708, 8623, 2644, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 18185, 5475, 1397, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnvFlags(t *testing.T) { type testCase struct { inCLIConf CLIConf envMap map[string]string outCLIConf CLIConf } testEnvFlag := func(tc testCase) func(t *testing.T) { return func(t *testing.T) { setEnvFlags(&tc.inCLIConf, func(envName string) string { return tc.envMap[envName] }) require.Equal(t, tc.outCLIConf, tc.inCLIConf) } } t.Run("cluster env", func(t *testing.T) { t.Run("nothing set", testEnvFlag(testCase{ outCLIConf: CLIConf{ SiteName: "", }, })) t.Run("CLI flag is set", testEnvFlag(testCase{ inCLIConf: CLIConf{ SiteName: "a.example.com", }, outCLIConf: CLIConf{ SiteName: "a.example.com", }, })) t.Run("TELEPORT_SITE set", testEnvFlag(testCase{ envMap: map[string]string{ siteEnvVar: "a.example.com", }, outCLIConf: CLIConf{ SiteName: "a.example.com", }, })) t.Run("TELEPORT_CLUSTER set", testEnvFlag(testCase{ envMap: map[string]string{ clusterEnvVar: "b.example.com", }, outCLIConf: CLIConf{ SiteName: "b.example.com", }, })) t.Run("TELEPORT_SITE and TELEPORT_CLUSTER set, prefer TELEPORT_CLUSTER", testEnvFlag(testCase{ envMap: map[string]string{ clusterEnvVar: "d.example.com", siteEnvVar: "c.example.com", }, outCLIConf: CLIConf{ SiteName: "d.example.com", }, })) t.Run("TELEPORT_SITE and TELEPORT_CLUSTER and CLI flag is set, prefer CLI", testEnvFlag(testCase{ inCLIConf: CLIConf{ SiteName: "e.example.com", }, envMap: map[string]string{ clusterEnvVar: "g.example.com", siteEnvVar: "f.example.com", }, outCLIConf: CLIConf{ SiteName: "e.example.com", }, })) }) t.Run("kube cluster env", func(t *testing.T) { t.Run("nothing set", testEnvFlag(testCase{ outCLIConf: CLIConf{ KubernetesCluster: "", }, })) t.Run("CLI flag is set", testEnvFlag(testCase{ inCLIConf: CLIConf{ KubernetesCluster: "a.example.com", }, outCLIConf: CLIConf{ KubernetesCluster: "a.example.com", }, })) t.Run("TELEPORT_KUBE_CLUSTER set", testEnvFlag(testCase{ envMap: map[string]string{ kubeClusterEnvVar: "a.example.com", }, outCLIConf: CLIConf{ KubernetesCluster: "a.example.com", }, })) t.Run("TELEPORT_KUBE_CLUSTER and CLI flag is set, prefer CLI", testEnvFlag(testCase{ inCLIConf: CLIConf{ KubernetesCluster: "e.example.com", }, envMap: map[string]string{ kubeClusterEnvVar: "g.example.com", }, outCLIConf: CLIConf{ KubernetesCluster: "e.example.com", }, })) }) t.Run("teleport home env", func(t *testing.T) { t.Run("nothing set", testEnvFlag(testCase{ outCLIConf: CLIConf{}, })) t.Run("CLI flag is set", testEnvFlag(testCase{ inCLIConf: CLIConf{ HomePath: "teleport-data", }, outCLIConf: CLIConf{ HomePath: "teleport-data", }, })) t.Run("TELEPORT_HOME set", testEnvFlag(testCase{ envMap: map[string]string{ homeEnvVar: "teleport-data/", }, outCLIConf: CLIConf{ HomePath: "teleport-data", }, })) t.Run("TELEPORT_HOME and CLI flag is set, prefer env", testEnvFlag(testCase{ inCLIConf: CLIConf{ HomePath: "teleport-data", }, envMap: map[string]string{ homeEnvVar: "teleport-data/", }, outCLIConf: CLIConf{ HomePath: "teleport-data", }, })) }) }
explode_data.jsonl/21932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1690 }
[ 2830, 3393, 14359, 9195, 1155, 353, 8840, 836, 8, 341, 13158, 54452, 2036, 341, 197, 17430, 63959, 15578, 220, 39277, 15578, 198, 197, 57538, 2227, 257, 2415, 14032, 30953, 198, 197, 13967, 63959, 15578, 39277, 15578, 198, 197, 630, 18185...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExtensionUncompressed(t *testing.T) { compression := Uncompressed output := compression.Extension() if output != "tar" { t.Fatalf("The extension of an uncompressed archive should be 'tar'.") } }
explode_data.jsonl/79228
{ "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, 12049, 1806, 45703, 1155, 353, 8840, 836, 8, 341, 32810, 4011, 1669, 1230, 45703, 198, 21170, 1669, 25111, 59715, 741, 743, 2550, 961, 330, 26737, 1, 341, 197, 3244, 30762, 445, 785, 8894, 315, 458, 92382, 18132, 1265, 387, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMergeJoinerMultiBatch(t *testing.T) { defer leaktest.AfterTest(t)() ctx := context.Background() for _, numInputBatches := range []int{1, 2, 16} { for _, outBatchSize := range []uint16{1, 16, coldata.BatchSize()} { t.Run(fmt.Sprintf("numInputBatches=%d", numInputBatches), func(t *testing.T) { nTuples := int(coldata.BatchSize()) * numInputBatches typs := []coltypes.T{coltypes.Int64} cols := []coldata.Vec{testAllocator.NewMemColumn(typs[0], nTuples)} groups := cols[0].Int64() for i := range groups { groups[i] = int64(i) } leftSource := newChunkingBatchSource(typs, cols, uint64(nTuples)) rightSource := newChunkingBatchSource(typs, cols, uint64(nTuples)) a, err := NewMergeJoinOp( testAllocator, sqlbase.InnerJoin, leftSource, rightSource, []uint32{0}, []uint32{0}, typs, typs, []execinfrapb.Ordering_Column{{ColIdx: 0, Direction: execinfrapb.Ordering_Column_ASC}}, []execinfrapb.Ordering_Column{{ColIdx: 0, Direction: execinfrapb.Ordering_Column_ASC}}, nil, /* filterConstructor */ false, /* filterOnlyOnLeft */ ) if err != nil { t.Fatal("error in merge join op constructor", err) } a.(*mergeJoinInnerOp).initWithOutputBatchSize(outBatchSize) i := 0 count := 0 // Keep track of the last comparison value. expVal := int64(0) for b := a.Next(ctx); b.Length() != 0; b = a.Next(ctx) { count += int(b.Length()) outCol := b.ColVec(0).Int64() for j := int64(0); j < int64(b.Length()); j++ { outVal := outCol[j] if outVal != expVal { t.Fatalf("found val %d, expected %d, idx %d of batch %d", outVal, expVal, j, i) } expVal++ } i++ } if count != nTuples { t.Fatalf("found count %d, expected count %d", count, nTuples) } }) } } }
explode_data.jsonl/64491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 942 }
[ 2830, 3393, 52096, 12292, 261, 20358, 21074, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 20985, 1669, 2266, 19047, 741, 2023, 8358, 1629, 2505, 33, 9118, 1669, 2088, 3056, 396, 90, 16, 11, 220, 17, 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...
7
func TestEvent_AgentRemovedVerboseEqual(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedEvent_AgentRemoved(popr, false) data, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { panic(err) } msg := &Event_AgentRemoved{} if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil { panic(err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err) } }
explode_data.jsonl/42040
{ "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, 1556, 1566, 15772, 42642, 63404, 2993, 1155, 353, 8840, 836, 8, 341, 3223, 46288, 1669, 6888, 33864, 7121, 37270, 33864, 7121, 3608, 9730, 13244, 1005, 55832, 83819, 12145, 3223, 1669, 1532, 11598, 7757, 1556, 1566, 15772, 42642...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreatePoolFailure(t *testing.T) { clientFunc := func(client RookRestClient) (interface{}, error) { return client.CreatePool(model.Pool{Name: "pool1"}) } verifyFunc := getStringVerifyFunc(t) ClientFailureHelperWithVerification(t, clientFunc, verifyFunc) }
explode_data.jsonl/27853
{ "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, 4021, 10551, 17507, 1155, 353, 8840, 836, 8, 341, 25291, 9626, 1669, 2915, 12805, 431, 1941, 12416, 2959, 8, 320, 4970, 22655, 1465, 8, 341, 197, 853, 2943, 7251, 10551, 7635, 89701, 63121, 25, 330, 10285, 16, 23625, 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 TestHost(t *testing.T) { type tcase struct { input string expect string } cases := []tcase{ {"#Host: site.ru", ""}, {"Host: site.ru", "site.ru"}, {"Host: яндекс.рф", "яндекс.рф"}, } for _, c := range cases { t.Run(c.input, func(t *testing.T) { r, err := FromString(c.input) require.NoError(t, err) assert.Equal(t, c.expect, r.Host) }) } }
explode_data.jsonl/51680
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 189 }
[ 2830, 3393, 9296, 1155, 353, 8840, 836, 8, 341, 13158, 259, 5638, 2036, 341, 197, 22427, 220, 914, 198, 197, 24952, 914, 198, 197, 532, 1444, 2264, 1669, 3056, 83, 5638, 515, 197, 197, 4913, 2, 9296, 25, 2747, 23581, 497, 77496, 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 Test_Mock_AssertExpectations_Placeholder(t *testing.T) { var mockedService = new(TestExampleImplementation) mockedService.On("Test_Mock_AssertExpectations_Placeholder", 1, 2, 3).Return(5, 6, 7).Once() mockedService.On("Test_Mock_AssertExpectations_Placeholder", 3, 2, 1).Return(7, 6, 5) tt := new(testing.T) assert.False(t, mockedService.AssertExpectations(tt)) // make the call now mockedService.Called(1, 2, 3) // now assert expectations assert.False(t, mockedService.AssertExpectations(tt)) // make call to the second expectation mockedService.Called(3, 2, 1) // now assert expectations again assert.True(t, mockedService.AssertExpectations(tt)) }
explode_data.jsonl/8601
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 1245, 1176, 62222, 529, 17536, 804, 1088, 26536, 4251, 1155, 353, 8840, 836, 8, 8022, 2405, 46149, 1860, 284, 501, 31159, 13314, 36850, 7229, 2109, 67385, 1860, 8071, 445, 2271, 1245, 1176, 62222, 529, 17536, 804, 1088, 26536,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStreamAdd(t *testing.T) { s, err := Run() ok(t, err) defer s.Close() c, err := redis.Dial("tcp", s.Addr()) ok(t, err) defer c.Close() t.Run("XADD", func(t *testing.T) { res, err := redis.String(c.Do("XADD", "s", "123456", "one", "11", "two", "22")) ok(t, err) equals(t, "123456-0", res) res, err = redis.String(c.Do("XADD", "s", "*", "one", "1", "two", "2")) ok(t, err) exp := `\d+-0` matched, err := regexp.MatchString(exp, res) ok(t, err) assert(t, matched, "expected: %#v got: %#v", exp, res) k := fmt.Sprintf("%d-0", uint64(math.MaxUint64-100)) res, err = redis.String(c.Do("XADD", "s", k, "one", "11", "two", "22")) ok(t, err) equals(t, k, res) res, err = redis.String(c.Do("XADD", "s", "*", "one", "111", "two", "222")) ok(t, err) equals(t, fmt.Sprintf("%d-1", uint64(math.MaxUint64-100)), res) }) t.Run("XADD SetTime", func(t *testing.T) { now := time.Date(2001, 1, 1, 4, 4, 5, 4000000, time.UTC) s.SetTime(now) id, err := redis.String(c.Do("XADD", "now", "*", "one", "1")) ok(t, err) equals(t, "978321845004-0", id) id, err = redis.String(c.Do("XADD", "now", "*", "two", "2")) ok(t, err) equals(t, "978321845004-1", id) }) t.Run("XADD MAXLEN", func(t *testing.T) { now := time.Date(2001, 1, 1, 4, 4, 5, 4000000, time.UTC) s.SetTime(now) for i := 0; i < 100; i++ { _, err := redis.String(c.Do("XADD", "nowy", "MAXLEN", "10", "*", "one", "1")) ok(t, err) nowy, _ := s.Stream("nowy") assert(t, len(nowy) <= 10, "deleted entries") } nowy, _ := s.Stream("nowy") equals(t, 10, len(nowy)) for i := 0; i < 100; i++ { _, err := redis.String(c.Do("XADD", "nowz", "MAXLEN", "~", "10", "*", "one", "1")) ok(t, err) nowz, _ := s.Stream("nowz") assert(t, len(nowz) <= 10, "deleted entries") } nowz, _ := s.Stream("nowz") equals(t, 10, len(nowz)) }) t.Run("error cases", func(t *testing.T) { // Wrong type of key _, err := redis.String(c.Do("SET", "str", "value")) ok(t, err) _, err = s.XAdd("str", "*", []string{"hi", "1"}) mustFail(t, err, msgWrongType) _, err = redis.String(c.Do("XADD", "str", "*", "hi", "1")) mustFail(t, err, msgWrongType) _, err = redis.String(c.Do("XADD")) assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s")) assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", "*")) assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", "*", "key")) // odd assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", "MAXLEN", "!!!", "1000", "*", "key")) assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", "MAXLEN", "~", "thousand", "*", "key")) assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", "a-b", "one", "111", "two", "222")) // invalid id format assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", "0-0", "one", "111", "two", "222")) // invalid id format assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", "1234567-89", "one", "111", "two", "222")) // invalid id value assert(t, err != nil, "XADD error") _, err = redis.String(c.Do("XADD", "s", fmt.Sprintf("%d-0", uint64(math.MaxUint64-100)), "one", "111", "two", "222")) // invalid id value assert(t, err != nil, "XADD error") }) }
explode_data.jsonl/31879
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1621 }
[ 2830, 3393, 3027, 2212, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 6452, 741, 59268, 1155, 11, 1848, 340, 16867, 274, 10421, 741, 1444, 11, 1848, 1669, 20870, 98462, 445, 27161, 497, 274, 93626, 2398, 59268, 1155, 11, 1848, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBindingError_ErrorJSON(t *testing.T) { err := NewBindingError("id", []string{"1", "nope"}, "bind failed", errors.New("internal error")) resp, _ := json.Marshal(err) assert.Equal(t, `{"field":"id","message":"bind failed"}`, string(resp)) }
explode_data.jsonl/82528
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 15059, 1454, 28651, 5370, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 1532, 15059, 1454, 445, 307, 497, 3056, 917, 4913, 16, 497, 330, 2152, 375, 14345, 330, 7666, 4641, 497, 5975, 7121, 445, 10481, 1465, 28075, 34653, 11, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEvents_SendFromDevice(t *testing.T) { m := NewClient(os.Getenv("MNUBO_CLIENT_ID"), os.Getenv("MNUBO_CLIENT_SECRET"), os.Getenv("MNUBO_HOST")) var results [1][]SendEventsReport cases := []struct { Error error ExpectedLength int }{ { Error: m.Events.SendFromDevice(uuid.New().String(), []SimpleEvent{ { XEventType: "event_type1", }, }, SendEventsOptions{ ReportResults: true, }, &results[0]), ExpectedLength: 1, }, } for i, c := range cases { if c.Error != nil { t.Errorf("%d, client called failed: %+v", i, c.Error) } if len(results[i]) != c.ExpectedLength { t.Errorf("%d, expecting length: %d, got %d", i, c.ExpectedLength, len(results[i])) } } }
explode_data.jsonl/81378
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 7900, 46267, 3830, 6985, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1532, 2959, 9638, 64883, 445, 44, 3926, 4677, 22521, 3450, 3975, 2643, 64883, 445, 44, 3926, 4677, 22521, 31408, 3975, 2643, 64883, 445, 44, 3926, 4677, 1721...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSHA2Warning(t *testing.T) { // create a CA signer and signs a new intermediate with SHA-2 caSigner := makeCASignerFromFile(testCAFile, testCAKeyFile, x509.SHA256WithRSA, t) sha2InterBytes := signCSRFile(caSigner, interL1CSR, t) // read CA cert bytes caCertBytes, err := ioutil.ReadFile(testCAFile) if err != nil { t.Fatal(err) } // create a bundler with the test root CA and no intermediates b, err := NewBundlerFromPEM(caCertBytes, nil) if err != nil { t.Fatal(err) } optimalBundle, err := b.BundleFromPEMorDER(sha2InterBytes, nil, Optimal, "") if err != nil { t.Fatal("Optimal bundle failed:", err) } checkSHA2WarningAndCode(t, optimalBundle, true) // Ubiquitous bundle will include a 2nd intermediate CA. ubiquitousBundle, err := b.BundleFromPEMorDER(sha2InterBytes, nil, Ubiquitous, "") if err != nil { t.Fatal("Ubiquitous bundle failed") } checkSHA2WarningAndCode(t, ubiquitousBundle, true) }
explode_data.jsonl/36890
{ "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, 33145, 17, 12087, 1155, 353, 8840, 836, 8, 341, 197, 322, 1855, 264, 9183, 70039, 323, 11929, 264, 501, 28439, 448, 21721, 12, 17, 198, 197, 924, 7264, 261, 1669, 1281, 87516, 77656, 43633, 8623, 5049, 1703, 11, 1273, 5049...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMemberAddNoPUK(t *testing.T) { tc, _, name := memberSetup(t) defer tc.Cleanup() inviteNoPUK := func(username string, uid keybase1.UID, role keybase1.TeamRole) { res, err := AddMember(context.TODO(), tc.G, name, username, role) if err != nil { t.Fatal(err) } if !res.Invited { t.Fatal("res.Invited should be set") } if res.User.Username != username { t.Errorf("AddMember result username %q does not match arg username %q", res.User.Username, username) } fqUID := string(uid) + "%1" assertInvite(tc, name, fqUID, "keybase", role) // second AddMember should return err if _, err := AddMember(context.TODO(), tc.G, name, username, keybase1.TeamRole_WRITER); err == nil { t.Errorf("second AddMember succeeded, should have failed since user already invited") } // existing invite should be untouched assertInvite(tc, name, fqUID, "keybase", role) } inviteNoPUK("t_alice", keybase1.UID("295a7eea607af32040647123732bc819"), keybase1.TeamRole_READER) // Disabled until we back out CORE-6170 // inviteNoPUK("t_bob", keybase1.UID("afb5eda3154bc13c1df0189ce93ba119"), keybase1.TeamRole_OWNER) }
explode_data.jsonl/13522
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 449 }
[ 2830, 3393, 9366, 2212, 2753, 6325, 42, 1155, 353, 8840, 836, 8, 341, 78255, 11, 8358, 829, 1669, 4462, 21821, 1155, 340, 16867, 17130, 727, 60639, 2822, 197, 56279, 2753, 6325, 42, 1669, 2915, 17084, 914, 11, 14617, 1376, 3152, 16, 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...
5
func TestInsertTestData(t *testing.T) { var users []*User profile := NewProfile() profile.Age = 28 profile.Money = 1234.12 id, err := dORM.Insert(profile) throwFail(t, err) throwFail(t, AssertIs(id, 2)) user := NewUser() user.UserName = "slene" user.Email = "vslene@gmail.com" user.Password = "pass" user.Status = 1 user.IsStaff = false user.IsActive = true user.Profile = profile users = append(users, user) id, err = dORM.Insert(user) throwFail(t, err) throwFail(t, AssertIs(id, 2)) profile = NewProfile() profile.Age = 30 profile.Money = 4321.09 id, err = dORM.Insert(profile) throwFail(t, err) throwFail(t, AssertIs(id, 3)) user = NewUser() user.UserName = "astaxie" user.Email = "astaxie@gmail.com" user.Password = "password" user.Status = 2 user.IsStaff = true user.IsActive = false user.Profile = profile users = append(users, user) id, err = dORM.Insert(user) throwFail(t, err) throwFail(t, AssertIs(id, 3)) user = NewUser() user.UserName = "nobody" user.Email = "nobody@gmail.com" user.Password = "nobody" user.Status = 3 user.IsStaff = false user.IsActive = false users = append(users, user) id, err = dORM.Insert(user) throwFail(t, err) throwFail(t, AssertIs(id, 4)) tags := []*Tag{ {Name: "golang", BestPost: &Post{ID: 2}}, {Name: "example"}, {Name: "format"}, {Name: "c++"}, } posts := []*Post{ {User: users[0], Tags: []*Tag{tags[0]}, Title: "Introduction", Content: `Go is a new language. Although it borrows ideas from existing languages, it has unusual properties that make effective Go programs different in character from programs written in its relatives. A straightforward translation of a C++ or Java program into Go is unlikely to produce a satisfactory result—Java programs are written in Java, not Go. On the other hand, thinking about the problem from a Go perspective could produce a successful but quite different program. In other words, to write Go well, it's important to understand its properties and idioms. It's also important to know the established conventions for programming in Go, such as naming, formatting, program construction, and so on, so that programs you write will be easy for other Go programmers to understand. This document gives tips for writing clear, idiomatic Go code. It augments the language specification, the Tour of Go, and How to Write Go Code, all of which you should read first.`}, {User: users[1], Tags: []*Tag{tags[0], tags[1]}, Title: "Examples", Content: `The Go package sources are intended to serve not only as the core library but also as examples of how to use the language. Moreover, many of the packages contain working, self-contained executable examples you can run directly from the golang.org web site, such as this one (click on the word "Example" to open it up). If you have a question about how to approach a problem or how something might be implemented, the documentation, code and examples in the library can provide answers, ideas and background.`}, {User: users[1], Tags: []*Tag{tags[0], tags[2]}, Title: "Formatting", Content: `Formatting issues are the most contentious but the least consequential. People can adapt to different formatting styles but it's better if they don't have to, and less time is devoted to the topic if everyone adheres to the same style. The problem is how to approach this Utopia without a long prescriptive style guide. With Go we take an unusual approach and let the machine take care of most formatting issues. The gofmt program (also available as go fmt, which operates at the package level rather than source file level) reads a Go program and emits the source in a standard style of indentation and vertical alignment, retaining and if necessary reformatting comments. If you want to know how to handle some new layout situation, run gofmt; if the answer doesn't seem right, rearrange your program (or file a bug about gofmt), don't work around it.`}, {User: users[2], Tags: []*Tag{tags[3]}, Title: "Commentary", Content: `Go provides C-style /* */ block comments and C++-style // line comments. Line comments are the norm; block comments appear mostly as package comments, but are useful within an expression or to disable large swaths of code. The program—and web server—godoc processes Go source files to extract documentation about the contents of the package. Comments that appear before top-level declarations, with no intervening newlines, are extracted along with the declaration to serve as explanatory text for the item. The nature and style of these comments determines the quality of the documentation godoc produces.`}, } comments := []*Comment{ {Post: posts[0], Content: "a comment"}, {Post: posts[1], Content: "yes"}, {Post: posts[1]}, {Post: posts[1]}, {Post: posts[2]}, {Post: posts[2]}, } for _, tag := range tags { id, err := dORM.Insert(tag) throwFail(t, err) throwFail(t, AssertIs(id > 0, true)) } for _, post := range posts { id, err := dORM.Insert(post) throwFail(t, err) throwFail(t, AssertIs(id > 0, true)) num := len(post.Tags) if num > 0 { nums, err := dORM.QueryM2M(post, "tags").Add(post.Tags) throwFailNow(t, err) throwFailNow(t, AssertIs(nums, num)) } } for _, comment := range comments { id, err := dORM.Insert(comment) throwFail(t, err) throwFail(t, AssertIs(id > 0, true)) } permissions := []*Permission{ {Name: "writePosts"}, {Name: "readComments"}, {Name: "readPosts"}, } groups := []*Group{ { Name: "admins", Permissions: []*Permission{permissions[0], permissions[1], permissions[2]}, }, { Name: "users", Permissions: []*Permission{permissions[1], permissions[2]}, }, } for _, permission := range permissions { id, err := dORM.Insert(permission) throwFail(t, err) throwFail(t, AssertIs(id > 0, true)) } for _, group := range groups { _, err := dORM.Insert(group) throwFail(t, err) throwFail(t, AssertIs(id > 0, true)) num := len(group.Permissions) if num > 0 { nums, err := dORM.QueryM2M(group, "permissions").Add(group.Permissions) throwFailNow(t, err) throwFailNow(t, AssertIs(nums, num)) } } }
explode_data.jsonl/18125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1986 }
[ 2830, 3393, 13780, 83920, 1155, 353, 8840, 836, 8, 341, 2405, 3847, 29838, 1474, 271, 197, 5365, 1669, 1532, 8526, 741, 197, 5365, 92675, 284, 220, 17, 23, 198, 197, 5365, 1321, 2534, 284, 220, 16, 17, 18, 19, 13, 16, 17, 271, 157...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileStatus(t *testing.T) { testCases := []struct { testCase string mhc *mapiv1beta1.MachineHealthCheck totalTargets int currentHealthy int remediationsAllowed int32 }{ { testCase: "status gets new values", mhc: &mapiv1beta1.MachineHealthCheck{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: namespace, }, TypeMeta: metav1.TypeMeta{ Kind: "MachineHealthCheck", }, Spec: mapiv1beta1.MachineHealthCheckSpec{ Selector: metav1.LabelSelector{}, }, Status: mapiv1beta1.MachineHealthCheckStatus{}, }, totalTargets: 10, currentHealthy: 5, remediationsAllowed: 5, }, { testCase: "when the unhealthy machines exceed maxUnhealthy", mhc: &mapiv1beta1.MachineHealthCheck{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: namespace, }, TypeMeta: metav1.TypeMeta{ Kind: "MachineHealthCheck", }, Spec: mapiv1beta1.MachineHealthCheckSpec{ Selector: metav1.LabelSelector{}, MaxUnhealthy: &intstr.IntOrString{Type: intstr.String, StrVal: "40%"}, }, Status: mapiv1beta1.MachineHealthCheckStatus{}, }, totalTargets: 10, currentHealthy: 5, remediationsAllowed: 0, }, { testCase: "when the unhealthy machines does not exceed maxUnhealthy", mhc: &mapiv1beta1.MachineHealthCheck{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: namespace, }, TypeMeta: metav1.TypeMeta{ Kind: "MachineHealthCheck", }, Spec: mapiv1beta1.MachineHealthCheckSpec{ Selector: metav1.LabelSelector{}, MaxUnhealthy: &intstr.IntOrString{Type: intstr.String, StrVal: "40%"}, }, Status: mapiv1beta1.MachineHealthCheckStatus{}, }, totalTargets: 10, currentHealthy: 7, remediationsAllowed: 1, }, } for _, tc := range testCases { t.Run(tc.testCase, func(t *testing.T) { var objects []runtime.Object objects = append(objects, runtime.Object(tc.mhc)) r := newFakeReconciler(objects...) mergeBase := client.MergeFrom(tc.mhc.DeepCopy()) tc.mhc.Status.ExpectedMachines = &tc.totalTargets tc.mhc.Status.CurrentHealthy = &tc.currentHealthy if err := r.reconcileStatus(mergeBase, tc.mhc); err != nil { t.Fatalf("Unexpected error: %v", err) } mhc := &mapiv1beta1.MachineHealthCheck{} if err := r.client.Get(context.TODO(), namespacedName(tc.mhc), mhc); err != nil { t.Fatalf("Unexpected error: %v", err) } if *mhc.Status.ExpectedMachines != tc.totalTargets { t.Errorf("Case: %v. Got: %v, expected: %v", tc.testCase, mhc.Status.ExpectedMachines, tc.totalTargets) } if *mhc.Status.CurrentHealthy != tc.currentHealthy { t.Errorf("Case: %v. Got: %v, expected: %v", tc.testCase, mhc.Status.CurrentHealthy, tc.currentHealthy) } if mhc.Status.RemediationsAllowed != tc.remediationsAllowed { t.Errorf("Case: %v. Got: %v, expected: %v", tc.testCase, mhc.Status.RemediationsAllowed, tc.remediationsAllowed) } }) } }
explode_data.jsonl/31008
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1417 }
[ 2830, 3393, 693, 40446, 457, 2522, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 18185, 4207, 310, 914, 198, 197, 2109, 38052, 338, 353, 2186, 344, 16, 19127, 16, 1321, 3814, 14542, 3973, 198, 197, 34493, 490...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClick(t *testing.T) { t.Parallel() tests := []struct { sel string by QueryOption }{ {`//*[@id="form"]/input[4]`, BySearch}, {`#form > input[type="submit"]:nth-child(11)`, ByQuery}, {`#form > input[type="submit"]:nth-child(11)`, ByQueryAll}, {`#btn2`, ByID}, {`document.querySelector('#btn2')`, ByJSPath}, } for i, test := range tests { test := test t.Run(fmt.Sprintf("%02d", i), func(t *testing.T) { t.Parallel() ctx, cancel := testAllocate(t, "form.html") defer cancel() var title string if err := Run(ctx, Click(test.sel, test.by), WaitVisible("#icon-brankas", ByID), Title(&title), ); err != nil { t.Fatalf("got error: %v", err) } if title != "this is title" { t.Errorf("expected title to be 'chromedp - Google Search', got: %q", title) } }) } }
explode_data.jsonl/59481
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 2612, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 1903, 301, 914, 198, 197, 197, 1694, 220, 11361, 5341, 198, 197, 59403, 197, 197, 90, 63, 37318, 307, 428, 627, 45058, 1355, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDataCorrupted(t *testing.T) { tf.UnitTest(t) fs, addr := requireSignerAddr(t) data := []byte("THESE BYTES ARE SIGNED") sig, err := fs.SignBytes(context.Background(), data, addr) require.NoError(t, err) corruptData := []byte("THESE BYTEZ ARE SIGNED") assert.Error(t, crypto.Verify(sig, addr, corruptData)) }
explode_data.jsonl/15400
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 93200, 10580, 85954, 1155, 353, 8840, 836, 8, 341, 3244, 69, 25159, 2271, 1155, 692, 53584, 11, 10789, 1669, 1373, 7264, 261, 13986, 1155, 692, 8924, 1669, 3056, 3782, 445, 17229, 925, 7710, 28484, 15824, 328, 25015, 1138, 84841, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestELEMENTreduce(t *testing.T) { q := Element{ 4891460686036598785, 2896914383306846353, 13281191951274694749, 3486998266802970665, } var testData []Element { a := q a[3]-- testData = append(testData, a) } { a := q a[0]-- testData = append(testData, a) } { a := q a[3]++ testData = append(testData, a) } { a := q a[0]++ testData = append(testData, a) } { a := q testData = append(testData, a) } for _, s := range testData { expected := s reduce(&s) expected.testReduce() if !s.Equal(&expected) { t.Fatal("reduce failed") } } }
explode_data.jsonl/70337
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 307 }
[ 2830, 3393, 91754, 26273, 1155, 353, 8840, 836, 8, 341, 18534, 1669, 8543, 515, 197, 197, 19, 23, 24, 16, 19, 21, 15, 21, 23, 21, 15, 18, 21, 20, 24, 23, 22, 23, 20, 345, 197, 197, 17, 23, 24, 21, 24, 16, 19, 18, 23, 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...
3
func TestNoneAssignmentsUpdateAssignments(t *testing.T) { a := assert.New(t) service := assignFleetServiceMock{} service.On("UpdateAssignment", mock.Anything, mock.Anything).Return(nil) app := app.Application{ Services: app.Services{ AssignFleet: &service, }, } grpc := NewGrpcServer(app) request := &skysign_proto.UpdateAssignmentsRequest{ Id: DefaultFleetID, Assignments: []*skysign_proto.Assignment{}, } response, err := grpc.UpdateAssignments( nil, request, ) expectResponse := &skysign_proto.UpdateAssignmentsResponse{ Id: DefaultFleetID, } a.Nil(err) a.Equal(response, expectResponse) }
explode_data.jsonl/58075
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 4064, 28933, 1368, 4289, 28933, 1368, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 692, 52934, 1669, 9793, 37, 18973, 1860, 11571, 31483, 52934, 8071, 445, 4289, 41613, 497, 7860, 13311, 1596, 11, 7860, 13311, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPingCrossProtocol(t *testing.T) { nonce, err := wire.RandomUint64() if err != nil { t.Errorf("RandomUint64: Error generating nonce: %v", err) } msg := wire.NewMsgPing(nonce) if msg.Nonce != nonce { t.Errorf("NewMsgPing: wrong nonce - got %v, want %v", msg.Nonce, nonce) } // Encode with latest protocol version. var buf bytes.Buffer err = msg.BtcEncode(&buf, wire.ProtocolVersion) if err != nil { t.Errorf("encode of MsgPing failed %v err <%v>", msg, err) } // Decode with old protocol version. readmsg := wire.NewMsgPing(0) err = readmsg.BtcDecode(&buf, wire.BIP0031Version) if err != nil { t.Errorf("decode of MsgPing failed [%v] err <%v>", buf, err) } // Since one of the protocol versions doesn't support the nonce, make // sure it didn't get encoded and decoded back out. if msg.Nonce == readmsg.Nonce { t.Error("Should not get same nonce for cross protocol") } }
explode_data.jsonl/1145
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 348 }
[ 2830, 3393, 69883, 28501, 20689, 1155, 353, 8840, 836, 8, 341, 197, 39593, 11, 1848, 1669, 9067, 26709, 21570, 21, 19, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 13999, 21570, 21, 19, 25, 4600, 23163, 39676, 25, 1018, 85, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReserveExecute_WithoutTx(t *testing.T) { db, tsv := setupTabletServerTest(t, "") defer tsv.StopService() defer db.Close() target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY} _, reservedID, _, err := tsv.ReserveExecute(ctx, &target, []string{"select 43"}, "select 42", nil, 0, &querypb.ExecuteOptions{}) require.NoError(t, err) assert.NotEqual(t, int64(0), reservedID, "reservedID should not be zero") expected := []string{ "select 43", "select 42 from dual where 1 != 1", "select 42 from dual limit 10001", } splitOutput := strings.Split(db.QueryLog(), ";") for _, exp := range expected { assert.Contains(t, splitOutput, exp, "expected queries to run") } err = tsv.Release(ctx, &target, 0, reservedID) require.NoError(t, err) }
explode_data.jsonl/80025
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 1061, 5852, 17174, 62, 26040, 31584, 1155, 353, 8840, 836, 8, 341, 20939, 11, 259, 3492, 1669, 6505, 2556, 83, 5475, 2271, 1155, 11, 14676, 16867, 259, 3492, 30213, 1860, 741, 16867, 2927, 10421, 2822, 28861, 1669, 3239, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestVariateRoute(t *testing.T) { w := httptest.NewRecorder() db, err := sqlx.Open("sqlite3", ":memory:") if err != nil { log.Fatal(err) } r, _ := http.NewRequest("GET", "/variates/1", nil) Router(db).ServeHTTP(w, r) assert.Equal(t, w.Code, http.StatusOK) }
explode_data.jsonl/10752
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 53, 49659, 4899, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 20939, 11, 1848, 1669, 5704, 87, 12953, 445, 37042, 18, 497, 13022, 17269, 34403, 743, 1848, 961, 2092, 341, 197, 6725, 26133, 3964, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEnvPrefix(t *testing.T) { initJSON() SetEnvPrefix("foo") // will be uppercased automatically BindEnv("id") BindEnv("f", "FOOD") // not using prefix testutil.Setenv(t, "FOO_ID", "13") testutil.Setenv(t, "FOOD", "apple") testutil.Setenv(t, "FOO_NAME", "crunk") assert.Equal(t, "13", Get("id")) assert.Equal(t, "apple", Get("f")) assert.Equal(t, "Cake", Get("name")) AutomaticEnv() assert.Equal(t, "crunk", Get("name")) }
explode_data.jsonl/9881
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 191 }
[ 2830, 3393, 14359, 14335, 1155, 353, 8840, 836, 8, 341, 28248, 5370, 2822, 22212, 14359, 14335, 445, 7975, 899, 442, 686, 387, 8416, 91126, 9463, 198, 197, 9950, 14359, 445, 307, 1138, 197, 9950, 14359, 445, 69, 497, 330, 3788, 2069, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetObject(t *testing.T) { config := &Config{Object{"a": Object{"b": String("c")}, "d": Array{}}} t.Run("get object", func(t *testing.T) { got := config.GetObject("a") assertDeepEqual(t, got, Object{"b": String("c")}) }) t.Run("return nil for a non-existing object", func(t *testing.T) { got := config.GetObject("e") if got != nil { t.Errorf("expected: nil, got: %v", got) } }) t.Run("panic if non-object type is requested as Object", func(t *testing.T) { assertPanic(t, func() { config.GetObject("d") }) }) }
explode_data.jsonl/4115
{ "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, 84540, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 609, 2648, 90, 1190, 4913, 64, 788, 3002, 4913, 65, 788, 923, 445, 66, 899, 2137, 330, 67, 788, 2910, 90, 3417, 630, 3244, 16708, 445, 455, 1633, 497, 2915, 1155, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSNMPReader_getProperty_getsInsteadOfWalk(t *testing.T) { var oidReader MockOIDReader var indexOIDReader MockOIDReader ctx := network.NewContextWithSNMPGetsInsteadOfWalk(context.Background(), true) oidReader. On("readOID", ctx, mock.MatchedBy(func(input []value.Value) bool { return utility.SameValueSlice(input, []value.Value{ value.New(1), value.New(2), value.New(3), }) }), true). Return(map[int]interface{}{ 1: map[string]interface{}{ "ifIndex": value.New(1), "ifDescr": value.New("Port 1"), }, 2: map[string]interface{}{ "ifIndex": value.New(2), "ifDescr": value.New("Port 2"), }, 3: map[string]interface{}{ "ifIndex": value.New(3), "ifDescr": value.New("Port 3"), }, }, nil) indexOIDReader. On("readOID", ctx, []value.Value(nil), false). Return(map[int]interface{}{ 1: map[string]interface{}{ "ifIndex": value.New(1), }, 2: map[string]interface{}{ "ifIndex": value.New(2), }, 3: map[string]interface{}{ "ifIndex": value.New(3), }, }, nil) sut := snmpReader{ oids: &oidReader, index: &indexOIDReader, } expectedPropertyGroups := PropertyGroups{ propertyGroup{ "ifIndex": value.New(1), "ifDescr": value.New("Port 1"), }, propertyGroup{ "ifIndex": value.New(2), "ifDescr": value.New("Port 2"), }, propertyGroup{ "ifIndex": value.New(3), "ifDescr": value.New("Port 3"), }, } expectedIndices := []value.Value{ value.New(1), value.New(2), value.New(3), } res, indices, err := sut.getProperty(ctx) if assert.NoError(t, err) { assert.Equal(t, expectedPropertyGroups, res) assert.Equal(t, expectedIndices, indices) } }
explode_data.jsonl/68088
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 752 }
[ 2830, 3393, 18966, 5781, 5062, 3062, 3052, 3062, 82, 30787, 2124, 48849, 1155, 353, 8840, 836, 8, 341, 2405, 48766, 5062, 14563, 29805, 5062, 198, 2405, 1922, 29805, 5062, 14563, 29805, 5062, 198, 20985, 1669, 3922, 7121, 1972, 2354, 1896...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSignatureValidationCreatorVerifyError(t *testing.T) { verifyErr := status.New(status.EndorserClientStatus, status.SignatureVerificationFailed.ToInt32(), "", nil) // Sample request request := Request{ChaincodeID: "testCC", Fcn: "invoke", Args: [][]byte{[]byte("query"), []byte("b")}} requestContext := prepareRequestContext(request, Opts{}, t) handler := NewQueryHandler() mockPeer1 := &fcmocks.MockPeer{MockName: "Peer1", MockURL: "http://peer1.com", MockRoles: []string{}, MockCert: nil, MockMSP: "Org1MSP", Status: 200, Payload: []byte("value")} clientContext := setupContextForSignatureValidation(verifyErr, nil, []fab.Peer{mockPeer1}, t) handler.Handle(requestContext, clientContext) verifyExpectedError(requestContext, verifyErr.Error(), t) }
explode_data.jsonl/5374
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 25088, 13799, 31865, 32627, 1454, 1155, 353, 8840, 836, 8, 341, 93587, 7747, 1669, 2639, 7121, 13838, 18569, 269, 799, 2959, 2522, 11, 2639, 41152, 1568, 62339, 9408, 15071, 18, 17, 1507, 7342, 2092, 692, 197, 322, 19143, 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 Test_removeUnspecifiedValueWhenContainsOnlyOneUnknown(t *testing.T) { var values = make([]*gendoc.EnumValue, 0) values = append(values, &gendoc.EnumValue{ Name: "TEST_UNKNOWN", }) var fixture = gendoc.Enum{ Values: values, } removeUnspecifiedValue(&fixture) require.Len(t, fixture.Values, 0, "size should be 0") }
explode_data.jsonl/2458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 18193, 1806, 53434, 1130, 4498, 23805, 7308, 3966, 13790, 1155, 353, 8840, 836, 8, 341, 2405, 2750, 284, 1281, 85288, 57064, 509, 43225, 1130, 11, 220, 15, 692, 45939, 284, 8737, 20103, 11, 609, 57064, 509, 43225, 1130, 515,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFetchWithErrorFromServer(t *testing.T) { logger, err := logging.NewLogger() if err != nil { t.Errorf("Error building logger: %v", err) } metricsCounter = 1 ticker := time.NewTicker(time.Duration(2) * time.Second) client := NewTestClient(func(req *http.Request) *http.Response { return &http.Response{ StatusCode: 500, Header: make(http.Header), } }) publisher := &Publisher{ Ticker: ticker, Logger: logger, SpServerUrl: "http://example.com", HttpClient: client, Persister: &MockPersister{}, } err = publisher.execute() expectedErr := "failed to publish the metrics : received a bad response code from the server, received response code : 500" if err == nil { t.Errorf("An error was not thrown, but expected : %s", expectedErr) return } if err.Error() != expectedErr { t.Errorf("Expected error was not thrown, received error : %v", err) } }
explode_data.jsonl/47139
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 337 }
[ 2830, 3393, 20714, 66102, 3830, 5475, 1155, 353, 8840, 836, 8, 341, 17060, 11, 1848, 1669, 8392, 7121, 7395, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 1454, 4752, 5925, 25, 1018, 85, 497, 1848, 340, 197, 532, 2109, 13468,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConditionalImport(t *testing.T) { default_suite.expectBundled(t, bundled{ files: map[string]string{ "/a.js": ` import(x ? 'a' : y ? './import' : 'c') `, "/b.js": ` import(x ? y ? 'a' : './import' : c) `, "/import.js": ` exports.foo = 213 `, }, entryPaths: []string{"/a.js", "/b.js"}, options: config.Options{ Mode: config.ModeBundle, AbsOutputDir: "/out", ExternalModules: config.ExternalModules{ NodeModules: map[string]bool{ "a": true, "c": true, }, }, }, }) }
explode_data.jsonl/38475
{ "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, 79233, 11511, 1155, 353, 8840, 836, 8, 341, 11940, 57239, 25952, 33, 1241, 832, 1155, 11, 51450, 515, 197, 74075, 25, 2415, 14032, 30953, 515, 298, 197, 3115, 64, 2857, 788, 22074, 571, 21918, 2075, 937, 364, 64, 6, 549, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartCmdValidArgs(t *testing.T) { t.Run("IPFS configured and CAS type is local", func(t *testing.T) { t.Run("Database type is mem", func(t *testing.T) { startCmd := GetStartCmd() startCmd.SetArgs(getTestArgs("localhost:8081", "local", "false", databaseTypeMemOption, "")) go func() { err := startCmd.Execute() require.Nil(t, err) require.Equal(t, log.ERROR, log.GetLevel("")) }() time.Sleep(50 * time.Millisecond) require.NoError(t, syscall.Kill(syscall.Getpid(), syscall.SIGINT)) }) t.Run("Database type is MongoDB", func(t *testing.T) { t.Run("Fail to create MongoDB client", func(t *testing.T) { startCmd := GetStartCmd() startCmd.SetArgs(getTestArgs("localhost:8081", "local", "false", databaseTypeMongoDBOption, "")) err := startCmd.Execute() require.EqualError(t, err, "create MongoDB storage provider: failed to create a new MongoDB client: "+ `error parsing uri: scheme must be "mongodb" or "mongodb+srv"`) }) }) }) t.Run("IPFS configured, CAS type is local, but IPFS node is ipfs.io and replication "+ "is enabled. Replication is forced off since ipfs.io doesn't support writes", func(t *testing.T) { startCmd := GetStartCmd() startCmd.SetArgs(getTestArgs("https://ipfs.io", "local", "true", databaseTypeMemOption, "")) go func() { err := startCmd.Execute() require.Nil(t, err) require.Equal(t, log.ERROR, log.GetLevel("")) }() time.Sleep(50 * time.Millisecond) require.NoError(t, syscall.Kill(syscall.Getpid(), syscall.SIGINT)) }) }
explode_data.jsonl/31128
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 625 }
[ 2830, 3393, 3479, 15613, 4088, 4117, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 3298, 8485, 19755, 323, 41790, 943, 374, 2205, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 16708, 445, 5988, 943, 374, 1833, 497, 2915, 1155,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFieldText(t *testing.T) { store, clean := realtikvtest.CreateMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("create table t (a int)") tests := []struct { sql string field string }{ {"select distinct(a) from t", "a"}, {"select (1)", "1"}, {"select (1+1)", "(1+1)"}, {"select a from t", "a"}, {"select ((a+1)) from t", "((a+1))"}, {"select 1 /*!32301 +1 */;", "1 +1 "}, {"select /*!32301 1 +1 */;", "1 +1 "}, {"/*!32301 select 1 +1 */;", "1 +1 "}, {"select 1 + /*!32301 1 +1 */;", "1 + 1 +1 "}, {"select 1 /*!32301 + 1, 1 */;", "1 + 1"}, {"select /*!32301 1, 1 +1 */;", "1"}, {"select /*!32301 1 + 1, */ +1;", "1 + 1"}, } for _, tt := range tests { result, err := tk.Exec(tt.sql) require.NoError(t, err) require.Equal(t, tt.field, result.Fields()[0].ColumnAsName.O) result.Close() } }
explode_data.jsonl/5778
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 429 }
[ 2830, 3393, 1877, 1178, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1931, 83, 1579, 85, 1944, 7251, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_marshal_map_of_list(t *testing.T) { should := require.New(t) for _, c := range test.MarshalCombinations { output, err := c.Marshal(map[int64][]int64{ 1: {1}, }) should.NoError(err) var val general.Map should.NoError(c.Unmarshal(output, &val)) should.Equal(general.List{ int64(1), }, val[int64(1)]) } }
explode_data.jsonl/29860
{ "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, 717, 28423, 5376, 3575, 2019, 1155, 353, 8840, 836, 8, 341, 197, 5445, 1669, 1373, 7121, 1155, 340, 2023, 8358, 272, 1669, 2088, 1273, 37271, 1092, 73629, 341, 197, 21170, 11, 1848, 1669, 272, 37271, 9147, 18640, 21, 19, 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...
2
func TestQuicksort(t *testing.T) { var a0 = goutil.RandIntArray(10, 1000000) // fmt.Println(a0) Quicksort(a0) // fmt.Println(a0) }
explode_data.jsonl/20293
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 65 }
[ 2830, 3393, 2183, 5788, 371, 1155, 353, 8840, 836, 8, 341, 2405, 264, 15, 284, 342, 30158, 2013, 437, 95338, 7, 16, 15, 11, 220, 16, 15, 15, 15, 15, 15, 15, 692, 197, 322, 8879, 12419, 2877, 15, 340, 197, 2183, 5788, 371, 2877, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveWithRecur(t *testing.T) { err := Mkdir(recursiveDirName, 0755) if err != nil { panic(err) } if !Exists(recursiveDirName) { t.Error("Multi Remove test failed!") } err = RemoveWithRecur(recursiveDirRoot) if err != nil { panic(err) } if Exists(recursiveDirName) { t.Error("Multi Remove test failed!") } }
explode_data.jsonl/34166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 13021, 2354, 693, 2352, 1155, 353, 8840, 836, 8, 1476, 9859, 1669, 386, 12438, 20635, 16514, 6184, 675, 11, 220, 15, 22, 20, 20, 340, 743, 1848, 961, 2092, 341, 197, 30764, 3964, 340, 197, 532, 743, 753, 15575, 20635, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestParseMetaGoImports(t *testing.T) { for i, tt := range parseMetaGoImportsTests { out, err := parseMetaGoImports(strings.NewReader(tt.in)) if err != nil { t.Errorf("test#%d: %v", i, err) continue } if !reflect.DeepEqual(out, tt.out) { t.Errorf("test#%d:\n\thave %q\n\twant %q", i, out, tt.out) } } }
explode_data.jsonl/47402
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 14463, 12175, 10850, 31250, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 17853, 1669, 2088, 4715, 12175, 10850, 31250, 18200, 341, 197, 13967, 11, 1848, 1669, 4715, 12175, 10850, 31250, 51442, 68587, 47152, 1858, 1171, 197, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetLatestSpotPrice(t *testing.T) { t.Parallel() _, err := h.GetLatestSpotPrice("hptusdt") if err != nil { t.Errorf("Test failed - Huobi GetLatestSpotPrice: %s", err) } }
explode_data.jsonl/24329
{ "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, 1949, 31992, 47049, 6972, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 305, 2234, 31992, 47049, 6972, 445, 71, 417, 355, 8047, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 2271, 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 ]
2
func TestDepartment(t *testing.T) { tsEngine, _ := xorm.NewEngine("mysql", "root:root@tcp(127.0.0.1:3306)/radius?charset=utf8") tsEngine.ShowSQL(true) var departments []model.Department count, _ := tsEngine.Cols("sd.*, d.name").Table("sys_department").Alias("sd"). Join("LEFT", []string{"sys_department", "d"}, "sd.parent_id = d.id"). Where("sd.status = 1"). Limit(10, 0). FindAndCount(&departments) fmt.Printf("%d, %#v", count, departments) }
explode_data.jsonl/28482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 26627, 1155, 353, 8840, 836, 8, 341, 57441, 4571, 11, 716, 1669, 856, 493, 7121, 4571, 445, 12272, 756, 197, 197, 1, 2888, 25, 2888, 31, 27161, 7, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 18, 18, 15, 21, 5620, 26715...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecInOomScoreAdj(t *testing.T) { if testing.Short() { return } rootfs, err := newRootfs() ok(t, err) defer remove(rootfs) config := newTemplateConfig(rootfs) config.OomScoreAdj = 200 container, err := newContainer(config) ok(t, err) defer container.Destroy() stdinR, stdinW, err := os.Pipe() ok(t, err) process := &libcontainer.Process{ Cwd: "/", Args: []string{"cat"}, Env: standardEnvironment, Stdin: stdinR, } err = container.Run(process) stdinR.Close() defer stdinW.Close() ok(t, err) buffers := newStdBuffers() ps := &libcontainer.Process{ Cwd: "/", Args: []string{"/bin/sh", "-c", "cat /proc/self/oom_score_adj"}, Env: standardEnvironment, Stdin: buffers.Stdin, Stdout: buffers.Stdout, Stderr: buffers.Stderr, } err = container.Run(ps) ok(t, err) waitProcess(ps, t) stdinW.Close() waitProcess(process, t) out := buffers.Stdout.String() if oomScoreAdj := strings.TrimSpace(out); oomScoreAdj != strconv.Itoa(config.OomScoreAdj) { t.Fatalf("expected oomScoreAdj to be %d, got %s", config.OomScoreAdj, oomScoreAdj) } }
explode_data.jsonl/2993
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 477 }
[ 2830, 3393, 10216, 641, 46, 316, 10570, 54866, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 853, 198, 197, 532, 33698, 3848, 11, 1848, 1669, 501, 8439, 3848, 741, 59268, 1155, 11, 1848, 340, 16867, 4057, 9206, 3848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReplyDocument(t *testing.T) { message := mockMessage() go message.ReplyDocument("server.go") reply := <-message.Replies if reply.Data == "" { t.Error("Reply should contain document url") } }
explode_data.jsonl/25064
{ "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, 20841, 7524, 1155, 353, 8840, 836, 8, 341, 24753, 1669, 7860, 2052, 741, 30680, 1943, 2817, 2541, 7524, 445, 4030, 18002, 1138, 86149, 1669, 9119, 1994, 2817, 7202, 198, 743, 9851, 3336, 621, 1591, 341, 197, 3244, 6141, 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 ]
2
func TestManagerFire(t *testing.T) { manager := Manager{} benchlist := benchlist.NewNoBenchlist() err := manager.Initialize( &timer.AdaptiveTimeoutConfig{ InitialTimeout: time.Millisecond, MinimumTimeout: time.Millisecond, MaximumTimeout: 10 * time.Second, TimeoutCoefficient: 1.25, TimeoutHalflife: 5 * time.Minute, }, benchlist, "", prometheus.NewRegistry(), ) if err != nil { t.Fatal(err) } go manager.Dispatch() wg := sync.WaitGroup{} wg.Add(1) manager.RegisterRequest(ids.ShortID{}, ids.ID{}, message.PullQuery, ids.GenerateTestID(), wg.Done) wg.Wait() }
explode_data.jsonl/43231
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 2043, 16697, 1155, 353, 8840, 836, 8, 341, 92272, 1669, 10567, 16094, 2233, 19762, 1607, 1669, 13425, 1607, 7121, 2753, 33, 19762, 1607, 741, 9859, 1669, 6645, 45829, 1006, 197, 197, 5, 19278, 17865, 27781, 7636, 2648, 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...
2
func TestSimple(t *testing.T) { args := []string{"dummy", "bla", "ble", "bli"} if concatenatingConcat(args) != "bla ble bli" { t.Error("concatenatingConcat failed!") } if joiningConcat(args) != "bla ble bli" { t.Error("joiningConcat failed!") } }
explode_data.jsonl/30883
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 107 }
[ 2830, 3393, 16374, 1155, 353, 8840, 836, 8, 341, 31215, 1669, 3056, 917, 4913, 31390, 497, 330, 64726, 497, 330, 891, 497, 330, 65, 742, 63159, 743, 39972, 1095, 78440, 7356, 8, 961, 330, 64726, 12422, 59289, 1, 341, 197, 3244, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAffinity(t *testing.T) { woc := newWoc() woc.execWf.Spec.Affinity = &apiv1.Affinity{ NodeAffinity: &apiv1.NodeAffinity{ RequiredDuringSchedulingIgnoredDuringExecution: &apiv1.NodeSelector{ NodeSelectorTerms: []apiv1.NodeSelectorTerm{ { MatchExpressions: []apiv1.NodeSelectorRequirement{ { Key: "kubernetes.io/e2e-az-name", Operator: apiv1.NodeSelectorOpIn, Values: []string{ "e2e-az1", "e2e-az2", }, }, }, }, }, }, }, } tmplCtx, err := woc.createTemplateContext(wfv1.ResourceScopeLocal, "") assert.NoError(t, err) ctx := context.Background() _, err = woc.executeContainer(ctx, woc.execWf.Spec.Entrypoint, tmplCtx.GetTemplateScope(), &woc.execWf.Spec.Templates[0], &wfv1.WorkflowStep{}, &executeTemplateOpts{}) assert.NoError(t, err) pods, err := listPods(woc) assert.NoError(t, err) assert.Len(t, pods.Items, 1) pod := pods.Items[0] assert.NotNil(t, pod.Spec.Affinity) }
explode_data.jsonl/75372
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 492 }
[ 2830, 3393, 25841, 13489, 1155, 353, 8840, 836, 8, 341, 6692, 509, 1669, 501, 54, 509, 741, 6692, 509, 15776, 54, 69, 36473, 875, 542, 13489, 284, 609, 391, 344, 16, 875, 542, 13489, 515, 197, 30217, 25841, 13489, 25, 609, 391, 344,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestActorIsDeactivated(t *testing.T) { testActorsRuntime := newTestActorsRuntime() idleTimeout := time.Second * 2 actorType, actorID := getTestActorTypeAndID() actorKey := testActorsRuntime.constructCompositeKey(actorType, actorID) deactivateActorWithDuration(testActorsRuntime, actorKey, idleTimeout) time.Sleep(time.Second * 3) _, exists := testActorsRuntime.actorsTable.Load(actorKey) assert.False(t, exists) }
explode_data.jsonl/12871
{ "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, 18870, 3872, 1912, 30162, 1155, 353, 8840, 836, 8, 341, 18185, 2414, 1087, 15123, 1669, 501, 2271, 2414, 1087, 15123, 741, 15710, 273, 7636, 1669, 882, 32435, 353, 220, 17, 198, 93410, 929, 11, 12089, 915, 1669, 633, 2271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQueryEquipmentTypes(t *testing.T) { r := newTestResolver(t) defer r.drv.Close() ctx := viewertest.NewContext(r.client) mr, qr := r.Mutation(), r.Query() for _, suffix := range []string{"a", "b"} { _, err := mr.AddEquipmentType(ctx, models.AddEquipmentTypeInput{ Name: "example_type_" + suffix, Category: pointer.ToString("example_type"), }) require.NoError(t, err) } types, _ := qr.EquipmentTypes(ctx, nil, nil, nil, nil) require.Len(t, types.Edges, 2) var ( names = make([]string, len(types.Edges)) categories = make([]*ent.EquipmentCategory, len(types.Edges)) ) for i, v := range types.Edges { names[i] = v.Node.Name category, err := v.Node.QueryCategory().Only(ctx) require.NoError(t, err) categories[i] = category require.Equal(t, "example_type", category.Name) } require.Len(t, categories, 2) assert.Equal(t, categories[0].ID, categories[1].ID) sort.Strings(names) assert.Equal(t, names, []string{"example_type_a", "example_type_b"}) }
explode_data.jsonl/430
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 412 }
[ 2830, 3393, 2859, 58276, 4173, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 2271, 18190, 1155, 340, 16867, 435, 950, 10553, 10421, 741, 20985, 1669, 1651, 83386, 7121, 1972, 2601, 6581, 692, 2109, 81, 11, 49290, 1669, 435, 1321, 22705...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFactoryVerifySelf(t *testing.T) { factoryAddress := common.HexToAddress("0xabcd") factory := chequebook.NewFactory( backendmock.New( backendmock.WithCodeAtFunc(func(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) { if contract != factoryAddress { t.Fatalf("called with wrong address. wanted %x, got %x", factoryAddress, contract) } if blockNumber != nil { t.Fatal("not called for latest block") } return common.FromHex(simpleswapfactory.SimpleSwapFactoryDeployedCode), nil }), ), transactionmock.New(), factoryAddress, ) err := factory.VerifyBytecode(context.Background()) if err != nil { t.Fatal(err) } }
explode_data.jsonl/50288
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 270 }
[ 2830, 3393, 4153, 32627, 12092, 1155, 353, 8840, 836, 8, 341, 1166, 2919, 4286, 1669, 4185, 91538, 1249, 4286, 445, 15, 52616, 4385, 1138, 1166, 2919, 1669, 77010, 2190, 7121, 4153, 1006, 197, 197, 20942, 16712, 7121, 1006, 298, 197, 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...
3
func TestTreapConc(t *testing.T) { runtime.GOMAXPROCS(runtime.NumCPU()) treap := NewTreap() for i := 9; i >= 0; i-- { v := s(fmt.Sprint(i)) treap.Put(v, v) } assertTreapSlice(t, treap, []Comparable{s("0"), s("1"), s("2"), s("3"), s("4"), s("5"), s("6"), s("7"), s("8"), s("9")}, []Thing{s("0"), s("1"), s("2"), s("3"), s("4"), s("5"), s("6"), s("7"), s("8"), s("9")}) do := make(chan bool) done := make(chan bool) for i := 0; i < runtime.NumCPU(); i++ { go fiddleTreap(t, treap, fmt.Sprint("fiddler-", i, "-"), do, done) } close(do) for i := 0; i < runtime.NumCPU(); i++ { <-done } assertTreapSlice(t, treap, []Comparable{s("0"), s("1"), s("2"), s("3"), s("4"), s("5"), s("6"), s("7"), s("8"), s("9")}, []Thing{s("0"), s("1"), s("2"), s("3"), s("4"), s("5"), s("6"), s("7"), s("8"), s("9")}) }
explode_data.jsonl/51547
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 392 }
[ 2830, 3393, 65775, 391, 1109, 66, 1155, 353, 8840, 836, 8, 341, 7000, 4466, 1224, 1898, 2954, 9117, 6412, 89467, 39847, 31615, 2398, 3244, 265, 391, 1669, 1532, 65775, 391, 741, 2023, 600, 1669, 220, 24, 26, 600, 2604, 220, 15, 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...
4
func TestServiceTopologyWithSlots(t *testing.T) { r := newTestResolver(t) defer r.Close() ctx := viewertest.NewContext(context.Background(), r.client) mr := r.Mutation() locType, _ := mr.AddLocationType(ctx, models.AddLocationTypeInput{ Name: "Room", }) router, _ := mr.AddEquipmentType(ctx, models.AddEquipmentTypeInput{ Name: "Router", Positions: []*models.EquipmentPositionInput{ {Name: "slot1"}, }, }) card, _ := mr.AddEquipmentType(ctx, models.AddEquipmentTypeInput{ Name: "Card", Ports: []*models.EquipmentPortInput{ {Name: "port1"}, }, }) loc, _ := mr.AddLocation(ctx, models.AddLocationInput{ Name: "Room2", Type: locType.ID, }) posDefs := router.QueryPositionDefinitions().AllX(ctx) router1, _ := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: "Router1", Type: router.ID, Location: &loc.ID, }) card1, _ := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: "Card1", Type: card.ID, Parent: &router1.ID, PositionDefinition: &posDefs[0].ID, }) router2, _ := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: "Router2", Type: router.ID, Location: &loc.ID, }) card2, _ := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: "Card2", Type: card.ID, Parent: &router2.ID, PositionDefinition: &posDefs[0].ID, }) portDefs := card.QueryPortDefinitions().AllX(ctx) l, _ := mr.AddLink(ctx, models.AddLinkInput{ Sides: []*models.LinkSide{ {Equipment: card1.ID, Port: portDefs[0].ID}, {Equipment: card2.ID, Port: portDefs[0].ID}, }, }) ep1 := card1.QueryPorts().Where(equipmentport.HasDefinitionWith(equipmentportdefinition.ID(portDefs[0].ID))).OnlyX(ctx) st, _ := mr.AddServiceType(ctx, models.ServiceTypeCreateData{ Name: "Internet Access", HasCustomer: false, Endpoints: []*models.ServiceEndpointDefinitionInput{ { Name: "endpoint type1", Role: pointer.ToString("CONSUMER"), Index: 0, EquipmentTypeID: card.ID, }, }, }) s, err := mr.AddService(ctx, models.ServiceCreateData{ Name: "Internet Access Room 2", ServiceTypeID: st.ID, Status: pointerToServiceStatus(models.ServiceStatusPending), }) require.NoError(t, err) _, err = mr.AddServiceLink(ctx, s.ID, l.ID) require.NoError(t, err) ept := st.QueryEndpointDefinitions().OnlyX(ctx) _, err = mr.AddServiceEndpoint(ctx, models.AddServiceEndpointInput{ ID: s.ID, EquipmentID: card1.ID, PortID: pointer.ToInt(ep1.ID), Definition: ept.ID, }) require.NoError(t, err) res, err := r.Service().Topology(ctx, s) require.NoError(t, err) require.Len(t, res.Nodes, 2) require.Len(t, res.Links, 1) source, err := res.Links[0].Source.Node(ctx) require.NoError(t, err) require.Contains(t, []int{router1.ID, router2.ID}, source.ID) target, err := res.Links[0].Target.Node(ctx) require.NoError(t, err) require.Contains(t, []int{router1.ID, router2.ID}, target.ID) }
explode_data.jsonl/7206
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1361 }
[ 2830, 3393, 1860, 60954, 2354, 51647, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 2271, 18190, 1155, 340, 16867, 435, 10421, 741, 20985, 1669, 1651, 83386, 7121, 1972, 5378, 19047, 1507, 435, 6581, 692, 2109, 81, 1669, 435, 1321, 227...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSubscribeStreamNoSuchStream(t *testing.T) { defer cleanupStorage(t) // Use a central NATS server. ns := natsdTest.RunDefaultServer() defer ns.Shutdown() // Configure server. s1Config := getTestConfig("a", true, 5050) s1 := runServerWithConfig(t, s1Config) defer s1.Stop() getMetadataLeader(t, 10*time.Second, s1) conn, err := grpc.Dial("localhost:5050", grpc.WithInsecure()) require.NoError(t, err) defer conn.Close() apiClient := proto.NewAPIClient(conn) stream, err := apiClient.Subscribe(context.Background(), &proto.SubscribeRequest{Stream: "foo"}) require.NoError(t, err) _, err = stream.Recv() require.Error(t, err) require.Contains(t, err.Error(), "No such partition") }
explode_data.jsonl/34464
{ "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, 28573, 3027, 65531, 3027, 1155, 353, 8840, 836, 8, 341, 16867, 21290, 5793, 1155, 692, 197, 322, 5443, 264, 8622, 18248, 50, 3538, 624, 84041, 1669, 308, 1862, 67, 2271, 16708, 3675, 5475, 741, 16867, 12268, 10849, 18452, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStringifyClass(t *testing.T) { t.Parallel() tests := []struct { name string class ScriptClass stringed string }{ { name: "nonstandardty", class: NonStandardTy, stringed: "nonstandard", }, { name: "pubkey", class: PubKeyTy, stringed: "pubkey", }, { name: "pubkeyhash", class: PubKeyHashTy, stringed: "pubkeyhash", }, { name: "scripthash", class: ScriptHashTy, stringed: "scripthash", }, { name: "multisigty", class: MultiSigTy, stringed: "multisig", }, { name: "nulldataty", class: NullDataTy, stringed: "nulldata", }, { name: "treasuryadd", class: TreasuryAddTy, stringed: "treasuryadd", }, { name: "treasurygen", class: TreasuryGenTy, stringed: "treasurygen", }, { name: "broken", class: ScriptClass(255), stringed: "Invalid", }, } for _, test := range tests { typeString := test.class.String() if typeString != test.stringed { t.Errorf("%s: got %#q, want %#q", test.name, typeString, test.stringed) } } }
explode_data.jsonl/29687
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 570 }
[ 2830, 3393, 703, 1437, 1957, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 15487, 262, 13710, 1957, 198, 197, 11357, 291, 914, 198, 197, 59403, 197, 197, 515, 298,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestKazaamTransformDelete(t *testing.T) { spec := `[{ "operation": "delete", "spec": {"paths": ["doc.uid", "doc.guidObjects[1]"]} }]` jsonIn := `{"doc":{"uid":12345,"guid":["guid0","guid2","guid4"],"guidObjects":[{"id":"guid0"},{"id":"guid2"},{"id":"guid4"}]}}` jsonOut := `{"doc":{"guid":["guid0","guid2","guid4"],"guidObjects":[{"id":"guid0"},{"id":"guid4"}]}}` kazaamTransform, _ := kazaam.NewKazaam(spec) kazaamOut, _ := kazaamTransform.TransformJSONStringToString(jsonIn) areEqual, _ := checkJSONStringsEqual(kazaamOut, jsonOut) if !areEqual { t.Error("Transformed data does not match expectation.") t.Log("Expected: ", jsonOut) t.Log("Actual: ", kazaamOut) t.FailNow() } }
explode_data.jsonl/11867
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 42, 12707, 309, 8963, 6435, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 77644, 515, 197, 197, 1, 9262, 788, 330, 4542, 756, 197, 197, 1, 9535, 788, 5212, 21623, 788, 4383, 5236, 24874, 497, 330, 5236, 62894, 11543, 58, 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...
2
func TestNew(t *testing.T) { store := New() // At the point of writing the test, New() can only fail if it's // not initialized propertly. Either the RWMutex is created wrongly // or the map is not initialized - in either case, the below should // result in a panic. store.Store("testKey", "testValue") }
explode_data.jsonl/59216
{ "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, 3564, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 1532, 2822, 197, 322, 2411, 279, 1459, 315, 4378, 279, 1273, 11, 1532, 368, 646, 1172, 3690, 421, 432, 594, 198, 197, 322, 537, 17271, 2004, 529, 398, 13, 20988, 279, 431,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParse(t *testing.T) { goparsify.EnableLogging(os.Stdout) result, err := parse(`<body>hello <p color="blue">world</p></body>`) require.NoError(t, err) require.Equal(t, htmlTag{Name: "body", Attributes: map[string]string{}, Body: []interface{}{ "hello ", htmlTag{Name: "p", Attributes: map[string]string{"color": "blue"}, Body: []interface{}{"world"}}, }}, result) }
explode_data.jsonl/61600
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 14463, 1155, 353, 8840, 836, 8, 341, 3174, 453, 1561, 1437, 32287, 34575, 9638, 83225, 340, 9559, 11, 1848, 1669, 4715, 85994, 2599, 29, 14990, 366, 79, 1894, 428, 12203, 755, 14615, 522, 79, 1472, 2599, 29, 24183, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGenerateConnectionString(t *testing.T) { logger := log.New("tsdb.postgres") testCases := []struct { desc string host string user string password string database string sslMode string expConnStr string expErr string }{ { desc: "Unix socket host", host: "/var/run/postgresql", user: "user", password: "password", database: "database", expConnStr: "user='user' password='password' host='/var/run/postgresql' dbname='database' sslmode='verify-full'", }, { desc: "TCP host", host: "host", user: "user", password: "password", database: "database", expConnStr: "user='user' password='password' host='host' dbname='database' sslmode='verify-full'", }, { desc: "TCP/port host", host: "host:1234", user: "user", password: "password", database: "database", expConnStr: "user='user' password='password' host='host' dbname='database' sslmode='verify-full' port=1234", }, { desc: "Invalid port", host: "host:invalid", user: "user", database: "database", expErr: "invalid port in host specifier", }, { desc: "Password with single quote and backslash", host: "host", user: "user", password: `p'\assword`, database: "database", expConnStr: `user='user' password='p\'\\assword' host='host' dbname='database' sslmode='verify-full'`, }, { desc: "Custom SSL mode", host: "host", user: "user", password: "password", database: "database", sslMode: "disable", expConnStr: "user='user' password='password' host='host' dbname='database' sslmode='disable'", }, } for _, tt := range testCases { t.Run(tt.desc, func(t *testing.T) { data := map[string]interface{}{} if tt.sslMode != "" { data["sslmode"] = tt.sslMode } ds := &models.DataSource{ Url: tt.host, User: tt.user, Password: tt.password, Database: tt.database, JsonData: simplejson.NewFromAny(data), } connStr, err := generateConnectionString(ds, logger) if tt.expErr == "" { require.NoError(t, err, tt.desc) assert.Equal(t, tt.expConnStr, connStr, tt.desc) } else { require.Error(t, err, tt.desc) assert.True(t, strings.HasPrefix(err.Error(), tt.expErr), fmt.Sprintf("%s: %q doesn't start with %q", tt.desc, err, tt.expErr)) } }) } }
explode_data.jsonl/81418
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1162 }
[ 2830, 3393, 31115, 40431, 1155, 353, 8840, 836, 8, 341, 17060, 1669, 1487, 7121, 445, 2576, 1999, 6542, 17818, 5130, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 981, 914, 198, 197, 63104, 981, 914, 198, 197, 19060, 981, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAddUntimed_ResendEnabledMigrationRace(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() e, _, _ := testEntry(ctrl, testEntryOptions{}) metadatas := metadata.StagedMetadatas{ { Metadata: metadata.Metadata{ Pipelines: []metadata.PipelineMetadata{ { AggregationID: aggregation.MustCompressTypes(aggregation.Sum), ResendEnabled: false, StoragePolicies: policy.StoragePolicies{ testStoragePolicy, }, }, }, }, }, } resolution := testStoragePolicy.Resolution().Window mu := testGauge // add value with resendEnable=false require.NoError(t, e.addUntimed(mu, metadatas)) require.Len(t, e.aggregations, 1) require.False(t, e.aggregations[0].resendEnabled) elem := e.aggregations[0].elem.Value.(*GaugeElem) vals := elem.values require.Len(t, vals, 1) t1 := xtime.ToUnixNano(e.nowFn().Truncate(resolution)) _, ok := vals[t1] require.True(t, ok) // consume the aggregation so it's closed t2 := t1.Add(resolution) require.False(t, consume(elem, t2)) require.True(t, vals[t1].lockedAgg.closed) // add value with resendEnabled=true that targets the closed aggregation. it will automatically roll forward. metadatas[0].Metadata.Pipelines[0].ResendEnabled = true mu.ClientTimeNanos = t1 require.NoError(t, e.addUntimed(mu, metadatas)) require.Len(t, vals, 2) _, ok = vals[t2] require.True(t, ok) }
explode_data.jsonl/24227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 576 }
[ 2830, 3393, 2212, 20250, 75485, 92815, 408, 5462, 20168, 55991, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 7727, 11, 8358, 716, 1669, 1273, 5874, 62100, 11, 1273, 58...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransformNestedEnums(t *testing.T) { schema := []byte(` syntax = "proto3"; package test; message Person { string firstName = 1; string lastName = 2; enum Gender { UNKNOWN = 0; MALE = 1; FEMALE = 2; } } `) input := new(bytes.Buffer) input.Write(schema) output := new(bytes.Buffer) transformer := proto2gql.NewTransformer(output) if err := transformer.Transform(input); err != nil { t.Fatal(err) } expected := ` type TestPerson { firstName: String lastName: String } enum TestPersonGender { UNKNOWN MALE FEMALE } ` expected = strings.TrimSpace(expected) actual := strings.TrimSpace(output.String()) if expected != actual { t.Fatalf("Expected %s to equal to %s", expected, actual) } }
explode_data.jsonl/2070
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 8963, 71986, 71586, 1155, 353, 8840, 836, 8, 341, 1903, 3416, 1669, 3056, 3782, 61528, 197, 1903, 13662, 284, 330, 15110, 18, 876, 197, 197, 1722, 1273, 401, 197, 24753, 7357, 341, 298, 11357, 21046, 284, 220, 16, 280, 298...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEthereumBytes32Formatting(t *testing.T) { tests := []struct { value null.String expected string }{ {null.StringFrom("16800.00"), "31363830302e3030000000000000000000000000000000000000000000000000"}, {null.StringFrom(""), "0000000000000000000000000000000000000000000000000000000000000000"}, {null.StringFrom("Hello World!"), "48656c6c6f20576f726c64210000000000000000000000000000000000000000"}, {null.StringFromPtr(nil),"0000000000000000000000000000000000000000000000000000000000000000", }, } for _, test := range tests { past := models.RunResult{ Output: models.Output{"value": test.value}, } adapter := adapters.EthBytes32{} result := adapter.Perform(past,nil) assert.Equal(t, test.expected, result.Value()) assert.Nil(t, result.GetError()) } }
explode_data.jsonl/30383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 36, 18532, 372, 7078, 18, 17, 82135, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 16309, 262, 845, 6431, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 90, 2921, 6431, 3830, 445, 16, 21, 23, 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...
2
func TestConn_ReadOnClose(t *testing.T) { requireVCAN0(t) t.Run("close then read", func(t *testing.T) { conn, err := Dial("can", "vcan0") assert.NilError(t, err) // When I close the connection and then read from it assert.NilError(t, conn.Close()) rec := NewReceiver(conn) assert.Assert(t, !rec.Receive()) assert.Assert(t, is.ErrorContains(rec.Err(), "")) }) t.Run("read then close", func(t *testing.T) { conn, err := Dial("can", "vcan0") assert.NilError(t, err) // And when I read from a connection var g errgroup.Group var receiveErr error g.Go(func() error { rec := NewReceiver(conn) if rec.Receive() { return fmt.Errorf("receive") } receiveErr = rec.Err() return nil }) runtime.Gosched() // And then close it assert.NilError(t, conn.Close()) // Then the read operation should fail assert.NilError(t, g.Wait()) assert.Assert(t, is.ErrorContains(receiveErr, "")) }) }
explode_data.jsonl/35860
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 392 }
[ 2830, 3393, 9701, 38381, 1925, 7925, 1155, 353, 8840, 836, 8, 341, 17957, 11287, 1093, 15, 1155, 340, 3244, 16708, 445, 5552, 1221, 1349, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 32917, 11, 1848, 1669, 66155, 445, 4814, 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 TestPEXReactorRequestMessageAbuse(t *testing.T) { r, book := createReactor(&PEXReactorConfig{}) defer teardownReactor(book) sw := createSwitchAndAddReactors(r) sw.SetAddrBook(book) peer := newMockPeer() p2p.AddPeerToSwitch(sw, peer) assert.True(t, sw.Peers().Has(peer.ID())) id := string(peer.ID()) msg := cdc.MustMarshalBinary(&pexRequestMessage{}) // first time creates the entry r.Receive(PexChannel, peer, msg) assert.True(t, r.lastReceivedRequests.Has(id)) assert.True(t, sw.Peers().Has(peer.ID())) // next time sets the last time value r.Receive(PexChannel, peer, msg) assert.True(t, r.lastReceivedRequests.Has(id)) assert.True(t, sw.Peers().Has(peer.ID())) // third time is too many too soon - peer is removed r.Receive(PexChannel, peer, msg) assert.False(t, r.lastReceivedRequests.Has(id)) assert.False(t, sw.Peers().Has(peer.ID())) }
explode_data.jsonl/6127
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 1740, 55, 693, 5621, 1900, 2052, 5830, 810, 1155, 353, 8840, 836, 8, 341, 7000, 11, 2311, 1669, 1855, 693, 5621, 2099, 1740, 55, 693, 5621, 2648, 37790, 16867, 49304, 693, 5621, 33130, 692, 77295, 1669, 1855, 16837, 3036, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMetricsRedact(t *testing.T) { const expected = ` __level_____count____size___score______in__ingest(sz_cnt)____move(sz_cnt)___write(sz_cnt)____read___r-amp___w-amp WAL 0 0 B - 0 B - - - - 0 B - - - 0.0 0 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 1 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 2 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 3 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 4 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 5 0 0 B 0.00 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 6 0 0 B - 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 total 0 0 B - 0 B 0 B 0 0 B 0 0 B 0 0 B 0 0.0 flush 0 compact 0 0 B 0 B (size == estimated-debt, in = in-progress-bytes) memtbl 0 0 B zmemtbl 0 0 B ztbl 0 0 B bcache 0 0 B 0.0% (score == hit-rate) tcache 0 0 B 0.0% (score == hit-rate) titers 0 filter - - 0.0% (score == utility) ` got := redact.Sprintf("%s", &Metrics{}).Redact() if s := "\n" + got; expected != s { t.Fatalf("expected%s\nbut found%s", expected, s) } }
explode_data.jsonl/61843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1203 }
[ 2830, 3393, 27328, 6033, 531, 1155, 353, 8840, 836, 8, 341, 4777, 3601, 284, 22074, 563, 3294, 80517, 1830, 2130, 2141, 5973, 12338, 2130, 563, 258, 563, 287, 477, 40571, 15982, 8, 2130, 3397, 40571, 15982, 8, 5973, 4934, 40571, 15982, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTextToWord(t *testing.T) { test := "gaap é o melhor software em GoLang!" want := []string{"gaap", "é", "o", "melhor", "software", "em", "GoLang!"} result := TextToWord(test) if len(result) != len(want) { t.Errorf("Length bytes results '%d', '%d' received", len(result), len(want)) } for idx, text := range want { if text != result[idx] { t.Errorf("Position '%d' resturns ('%s'), expected ('%s')", idx, result[idx], text) } } }
explode_data.jsonl/1952
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 1178, 1249, 10879, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 330, 6743, 391, 3958, 297, 45682, 262, 3162, 976, 262, 5994, 26223, 17199, 50780, 1669, 3056, 917, 4913, 6743, 391, 497, 330, 963, 497, 330, 78, 497, 330, 27127...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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