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 TestModels_Marshal_Unmarshal_Time(t *testing.T) { testModel1 := TestModel{} testModel1.Time1 = &Time{} testModel1.Time1.Time = time.Now() b, err := json.Marshal(testModel1) if err != nil { t.Errorf(err.Error()) } testModel2 := TestModel{} err = json.Unmarshal(b, &testModel2) if err != nil { t.Errorf(err.Error()) } if testModel1.Time1 != testModel1.Time1 { t.Errorf("Expected time: %v Actual time: %v", testModel1.Time1, testModel1.Time2) } if testModel1.Time1.Time != testModel1.Time1.Time { t.Errorf("Expected time: %v Actual time: %v", testModel1.Time1.Time, testModel1.Time2.Time) } }
explode_data.jsonl/38128
{ "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, 16969, 1245, 28423, 40687, 27121, 39080, 1155, 353, 8840, 836, 8, 341, 18185, 1712, 16, 1669, 3393, 1712, 16094, 18185, 1712, 16, 16299, 16, 284, 609, 1462, 16094, 18185, 1712, 16, 16299, 16, 16299, 284, 882, 13244, 741, 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...
5
func TestDifference(t *testing.T) { nums := []int{1, 3, 5, 6, 7, 9} reject := []int{9, 7, 5, 4} want := []int{1, 3, 6} assert.Equal(t, want, u.Difference(nums, reject)) }
explode_data.jsonl/49541
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 62707, 1155, 353, 8840, 836, 8, 341, 22431, 82, 1669, 3056, 396, 90, 16, 11, 220, 18, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, 24, 532, 17200, 583, 1669, 3056, 396, 90, 24, 11, 220, 22, 11, 220, 20, 11, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScriptCompressionErrors(t *testing.T) { t.Parallel() // A nil script must result in a decoded size of 0. if gotSize := decodeCompressedScriptSize(nil, 1); gotSize != 0 { t.Fatalf("decodeCompressedScriptSize with nil script did not "+ "return 0 - got %d", gotSize) } // A nil script must result in a nil decompressed script. if gotScript := decompressScript(nil, 1); gotScript != nil { t.Fatalf("decompressScript with nil script did not return nil "+ "decompressed script - got %x", gotScript) } // A compressed script for a pay-to-pubkey (uncompressed) that results // in an invalid pubkey must result in a nil decompressed script. compressedScript := hexToBytes("04012d74d0cb94344c9569c2e77901573d8d" + "7903c3ebec3a957724895dca52c6b4") if gotScript := decompressScript(compressedScript, 1); gotScript != nil { t.Fatalf("decompressScript with compressed pay-to-"+ "uncompressed-pubkey that is invalid did not return "+ "nil decompressed script - got %x", gotScript) } }
explode_data.jsonl/8789
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 347 }
[ 2830, 3393, 5910, 81411, 13877, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 362, 2092, 5316, 1969, 1102, 304, 264, 29213, 1379, 315, 220, 15, 624, 743, 2684, 1695, 1669, 16895, 1092, 14318, 5910, 1695, 27907, 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...
4
func TestFileWriter(t *testing.T) { fw := NewFileWriter(t.Name()+".log", time.Hour, 0) defer fw.Close() s := fmt.Sprintf("open file: %s", time.Now()) fw.Write([]byte(s)) }
explode_data.jsonl/74558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 1703, 6492, 1155, 353, 8840, 836, 8, 341, 1166, 86, 1669, 1532, 1703, 6492, 1155, 2967, 17140, 3263, 839, 497, 882, 73550, 11, 220, 15, 340, 16867, 33886, 10421, 741, 1903, 1669, 8879, 17305, 445, 2508, 1034, 25, 1018, 82,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestContainerNamesUniqueAndValid(t *testing.T) { // Container names have to be unique within a Pod. The number of containers // we deploy should be few enough that we can name them uniquely across all // pods. // - https://docs.k8s.io/reference/kubernetes-api/workload-resources/pod-v1/ names := sets.NewString() for _, name := range []string{ ContainerDatabase, ContainerNSSWrapperInit, ContainerPGAdmin, ContainerPGBackRestConfig, ContainerPGBouncer, ContainerPGBouncerConfig, ContainerPostgresStartup, ContainerPGMonitorExporter, } { assert.Assert(t, !names.Has(name), "%q defined already", name) assert.Assert(t, nil == validation.IsDNS1123Label(name)) names.Insert(name) } }
explode_data.jsonl/22344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 242 }
[ 2830, 3393, 4502, 7980, 22811, 3036, 4088, 1155, 353, 8840, 836, 8, 341, 197, 322, 9678, 5036, 614, 311, 387, 4911, 2878, 264, 16821, 13, 576, 1372, 315, 23853, 198, 197, 322, 582, 10517, 1265, 387, 2421, 3322, 429, 582, 646, 829, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildCmdEnvSeveralAppNames(t *testing.T) { appNameFirst := "test5" appNameSecond := "test6" appNames := []string{"test5", "test6"} err := secretStore.LoadSecrets(appNameFirst, scopes[0]) assert.NoError(t, err) err = secretStore.SetSecret(appNameFirst, "anything_5", "must_be_set", scopes[0]) assert.NoError(t, err) err = secretStore.SaveSecrets(appNameFirst, scopes[0]) assert.NoError(t, err) err = secretStore.LoadSecrets(appNameSecond, scopes[0]) assert.NoError(t, err) err = secretStore.SetSecret(appNameSecond, "anything_6", "must_be_set", scopes[0]) assert.NoError(t, err) err = secretStore.SaveSecrets(appNameSecond, scopes[0]) assert.NoError(t, err) env := []string{} assert.Equal(t, &Env{ Vars: []string{ "ANYTHING_5=must_be_set", "ANYTHING_6=must_be_set", }, Files: map[string]*File{}, }, BuildCmdEnv(appNames, secretStore, env, scopes)) }
explode_data.jsonl/8943
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 11066, 15613, 14359, 34762, 2164, 7980, 1155, 353, 8840, 836, 8, 341, 28236, 675, 5338, 1669, 330, 1944, 20, 698, 28236, 675, 15666, 1669, 330, 1944, 21, 698, 28236, 7980, 1669, 3056, 917, 4913, 1944, 20, 497, 330, 1944, 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 TestBufferDelete(t *testing.T) { tab := []struct { q0, q1 int tb RuneArray expected string }{ {0, 5, RuneArray([]rune("0123456789")), "56789"}, {0, 0, RuneArray([]rune("0123456789")), "0123456789"}, {0, 10, RuneArray([]rune("0123456789")), ""}, {1, 5, RuneArray([]rune("0123456789")), "056789"}, {8, 10, RuneArray([]rune("0123456789")), "01234567"}, } for _, test := range tab { tb := test.tb tb.Delete(test.q0, test.q1) if string(tb) != test.expected { t.Errorf("Delete Failed. Expected %v, got %v", test.expected, string(tb)) } } }
explode_data.jsonl/37930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 4095, 6435, 1155, 353, 8840, 836, 8, 341, 58149, 1669, 3056, 1235, 341, 197, 18534, 15, 11, 2804, 16, 256, 526, 198, 197, 62842, 981, 70778, 1857, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 90, 15, 11, 220, 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...
3
func TestSumDistanceGreaterThanZero(t *testing.T) { // Generate two sequences at random in parallel seqchan := make(chan dna.Sequence, 2) go func(seq chan dna.Sequence) { seq <- utils.RandSeq(rand.Intn(math.MaxInt16)) }(seqchan) go func(seq chan dna.Sequence) { seq <- utils.RandSeq(rand.Intn(math.MaxInt16)) }(seqchan) // Gather the sequences s := <-seqchan q := <-seqchan // Generate forward and reverse distance in parallel dist := SumDistance(q, s) // Check that s is not the same as q then if their distance is non-zero if !reflect.DeepEqual(s, q) { if dist == Distance(0) { t.Error() } } else { if dist != Distance(0) { t.Error() } } }
explode_data.jsonl/41094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 9190, 14778, 85720, 17999, 1155, 353, 8840, 836, 8, 341, 197, 322, 19813, 1378, 23700, 518, 4194, 304, 15279, 198, 78561, 5658, 1669, 1281, 35190, 75334, 63537, 11, 220, 17, 340, 30680, 2915, 34820, 26023, 75334, 63537, 8, 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 TestDeletedUnmount(t *testing.T) { ts := NewTestCase(t) defer ts.Cleanup() submnt := filepath.Join(ts.mnt, "mnt") pfs2 := pathfs.NewPathNodeFs(pathfs.NewLoopbackFileSystem(ts.orig), nil) code := ts.connector.Mount(ts.rootNode(), "mnt", pfs2.Root(), nil) if !code.Ok() { t.Fatal("Mount error", code) } f, err := os.Create(filepath.Join(submnt, "hello.txt")) if err != nil { t.Fatalf("Create failed: %v", err) } t.Log("Removing") err = os.Remove(filepath.Join(submnt, "hello.txt")) if err != nil { t.Fatalf("Remove failed: %v", err) } t.Log("Removing") _, err = f.Write([]byte("bla")) if err != nil { t.Fatalf("Write failed: %v", err) } code = ts.pathFs.Unmount("mnt") if code != fuse.EBUSY { t.Error("expect EBUSY for unmount with open files", code) } f.Close() time.Sleep((3 * testTtl) / 2) code = ts.pathFs.Unmount("mnt") if !code.Ok() { t.Error("should succeed", code) } }
explode_data.jsonl/9157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 405 }
[ 2830, 3393, 26039, 59539, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 1532, 16458, 1155, 340, 16867, 10591, 727, 60639, 2822, 28624, 40882, 1669, 26054, 22363, 35864, 744, 406, 11, 330, 40882, 1138, 3223, 3848, 17, 1669, 1815, 3848, 7121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLibraryVariableSetGetByName(t *testing.T) { libraryVariableSet := createTestLibraryVariableSet(t, getRandomName()) defer cleanLibraryVariableSet(t, libraryVariableSet.ID) foundLibraryVariableSet, err := client.LibraryVariableSet.GetByName(libraryVariableSet.Name) assert.Nil(t, err, "error when looking for libraryVariableSet when not expected") assert.Equal(t, libraryVariableSet.Name, foundLibraryVariableSet.Name, "libraryVariableSet not found when searching by its name") }
explode_data.jsonl/65969
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 16915, 7827, 1649, 1949, 16898, 1155, 353, 8840, 836, 8, 341, 197, 18065, 7827, 1649, 1669, 1855, 2271, 16915, 7827, 1649, 1155, 11, 52436, 675, 2398, 16867, 4240, 16915, 7827, 1649, 1155, 11, 6733, 7827, 1649, 9910, 692, 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 TestThreatCrowd(t *testing.T) { if *networkTest == false { return } result := testDNSRequest("ThreatCrowd") if result < expectedTest { t.Errorf("Found %d names, expected at least %d instead", result, expectedTest) } }
explode_data.jsonl/75806
{ "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, 1001, 1222, 93926, 67, 1155, 353, 8840, 836, 8, 341, 743, 353, 17511, 2271, 621, 895, 341, 197, 853, 198, 197, 630, 9559, 1669, 1273, 61088, 1900, 445, 1001, 1222, 93926, 67, 1138, 743, 1102, 366, 3601, 2271, 341, 197, 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 TestChaincodeStatusFromResponse(t *testing.T) { //For error response response := &pb.ProposalResponse{ Response: &pb.Response{Status: 500, Payload: []byte("Unknown function"), Message: "Chaincode error"}, } err := extractChaincodeErrorFromResponse(response) s, ok := status.FromError(err) assert.True(t, ok) assert.Equal(t, "Chaincode error", s.Message) assert.Equal(t, int32(500), s.Code) assert.Equal(t, status.ChaincodeStatus, s.Group) assert.Equal(t, []byte("Unknown function"), s.Details[1]) //For successful response 200 response = &pb.ProposalResponse{ Response: &pb.Response{Status: 200, Payload: []byte("TEST"), Message: "Success"}, } err = extractChaincodeErrorFromResponse(response) assert.True(t, ok) assert.Nil(t, err) //For successful response 201 response = &pb.ProposalResponse{ Response: &pb.Response{Status: 201, Payload: []byte("TEST"), Message: "Success"}, } err = extractChaincodeErrorFromResponse(response) assert.True(t, ok) assert.Nil(t, err) //For error response - chaincode name not found (v1) response = &pb.ProposalResponse{ Response: &pb.Response{Status: 500, Payload: []byte("Unknown Description"), Message: "make sure the chaincode uq7q9y7lu7 has been successfully instantiated and try again: getccdata mychannel/uq7q9y7lu7 responded with error: could not find chaincode with name 'uq7q9y7lu7'"}, } err = extractChaincodeErrorFromResponse(response) s, ok = status.FromError(err) assert.True(t, ok) assert.Equal(t, "make sure the chaincode uq7q9y7lu7 has been successfully instantiated and try again: getccdata mychannel/uq7q9y7lu7 responded with error: could not find chaincode with name 'uq7q9y7lu7'", s.Message) assert.Equal(t, int32(status.ChaincodeNameNotFound), s.Code) assert.Equal(t, status.EndorserClientStatus, s.Group) //For error response - chaincode name not found (v2) response = &pb.ProposalResponse{ Response: &pb.Response{Status: 500, Payload: []byte("Unknown Description"), Message: "make sure the chaincode exampleCC2 has been successfully defined on channel orgchannel and try again: chaincode exampleCC2 not found"}, } err = extractChaincodeErrorFromResponse(response) s, ok = status.FromError(err) assert.True(t, ok) assert.Equal(t, "make sure the chaincode exampleCC2 has been successfully defined on channel orgchannel and try again: chaincode exampleCC2 not found", s.Message) assert.Equal(t, int32(status.ChaincodeNameNotFound), s.Code) assert.Equal(t, status.EndorserClientStatus, s.Group) //For error response - chaincode package not found response = &pb.ProposalResponse{ Response: &pb.Response{Status: 500, Payload: []byte("Unknown Description"), Message: "cannot get package for chaincode (vl5knffa37:v0)"}, } err = extractChaincodeErrorFromResponse(response) s, ok = status.FromError(err) assert.True(t, ok) assert.Equal(t, "cannot get package for chaincode (vl5knffa37:v0)", s.Message) assert.Equal(t, int32(status.ChaincodeNameNotFound), s.Code) assert.Equal(t, status.EndorserClientStatus, s.Group) }
explode_data.jsonl/45095
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1009 }
[ 2830, 3393, 18837, 1851, 2522, 3830, 2582, 1155, 353, 8840, 836, 8, 341, 197, 322, 2461, 1465, 2033, 198, 21735, 1669, 609, 16650, 42483, 32556, 2582, 515, 197, 69604, 25, 609, 16650, 12574, 90, 2522, 25, 220, 20, 15, 15, 11, 52916, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCephUpgradeSuite(t *testing.T) { if installer.SkipTestSuite(installer.CephTestSuite) { t.Skip() } // Skip the suite if CSI is not supported kh, err := utils.CreateK8sHelper(func() *testing.T { return t }) require.NoError(t, err) checkSkipCSITest(t, kh) s := new(UpgradeSuite) defer func(s *UpgradeSuite) { HandlePanics(recover(), s.TearDownSuite, s.T) }(s) suite.Run(t, s) }
explode_data.jsonl/35454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 34, 23544, 43861, 28000, 1155, 353, 8840, 836, 8, 341, 743, 43052, 57776, 2271, 28000, 35687, 13956, 727, 23544, 2271, 28000, 8, 341, 197, 3244, 57776, 741, 197, 630, 197, 322, 25784, 279, 16182, 421, 87064, 374, 537, 7248, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCopyExecuteCmd(t *testing.T) { tempDir := setupTestTemp(t) cfg := &v1.Config{ Cmd: nil, Env: []string{}, WorkingDir: tempDir, } fileContext := util.FileContext{Root: tempDir} for _, test := range copyTests { t.Run(test.name, func(t *testing.T) { dirList := []string{} cmd := CopyCommand{ cmd: &instructions.CopyCommand{ SourcesAndDest: test.sourcesAndDest, }, fileContext: fileContext, } buildArgs := copySetUpBuildArgs() dest := cfg.WorkingDir + "/" + test.sourcesAndDest[len(test.sourcesAndDest)-1] err := cmd.ExecuteCommand(cfg, buildArgs) if err != nil { t.Error() } fi, err := os.Open(dest) if err != nil { t.Error() } defer fi.Close() fstat, err := fi.Stat() if err != nil { t.Error() } if fstat.IsDir() { files, err := ioutil.ReadDir(dest) if err != nil { t.Error() } for _, file := range files { logrus.Debugf("file: %v", file.Name()) dirList = append(dirList, file.Name()) } } else { dirList = append(dirList, filepath.Base(dest)) } testutil.CheckErrorAndDeepEqual(t, false, err, test.expectedDest, dirList) os.RemoveAll(dest) }) } }
explode_data.jsonl/68572
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 562 }
[ 2830, 3393, 12106, 17174, 15613, 1155, 353, 8840, 836, 8, 341, 16280, 6184, 1669, 6505, 2271, 12151, 1155, 692, 50286, 1669, 609, 85, 16, 10753, 515, 197, 6258, 2277, 25, 286, 2092, 345, 197, 197, 14359, 25, 286, 3056, 917, 38837, 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...
7
func TestHandlerSetErrorsPercentageConfigError(t *testing.T) { config := mockConfig{ doSetErrorsPercentage: func(value int) error { return errors.New("error") }, } response := doSetErrorsPercentageRequest(handlerForConfig(config), strings.NewReader("12")) checkStatusCode(t, response, http.StatusBadRequest) }
explode_data.jsonl/48343
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 3050, 1649, 13877, 36167, 2648, 1454, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 7860, 2648, 515, 197, 19935, 1649, 13877, 36167, 25, 2915, 3679, 526, 8, 1465, 341, 298, 853, 5975, 7121, 445, 841, 1138, 197, 197, 1583, 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 TestIndexReuse(t *testing.T) { queryBytes := make([]byte, 1+3*entrySize) queryLogger := ActiveQueryTracker{ mmapedFile: queryBytes, logger: nil, getNextIndex: make(chan int, 3), } queryLogger.generateIndices(3) queryLogger.Insert(context.Background(), "TestQuery1") queryLogger.Insert(context.Background(), "TestQuery2") queryLogger.Insert(context.Background(), "TestQuery3") queryLogger.Delete(1 + entrySize) queryLogger.Delete(1) newQuery2 := "ThisShouldBeInsertedAtIndex2" newQuery1 := "ThisShouldBeInsertedAtIndex1" queryLogger.Insert(context.Background(), newQuery2) queryLogger.Insert(context.Background(), newQuery1) want := []string{ `^{"query":"ThisShouldBeInsertedAtIndex1","timestamp_sec":\d+}\x00*,$`, `^{"query":"ThisShouldBeInsertedAtIndex2","timestamp_sec":\d+}\x00*,$`, `^{"query":"TestQuery3","timestamp_sec":\d+}\x00*,$`, } // Check all bytes and verify new query was inserted at index 2 for i := 0; i < 3; i++ { start := 1 + i*entrySize end := start + entrySize have := queryBytes[start:end] require.True(t, regexp.MustCompile(want[i]).Match(have), "Index not reused properly.") } }
explode_data.jsonl/81183
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 432 }
[ 2830, 3393, 1552, 38081, 1155, 353, 8840, 836, 8, 341, 27274, 7078, 1669, 1281, 10556, 3782, 11, 220, 16, 10, 18, 9, 4085, 1695, 340, 27274, 7395, 1669, 9905, 2859, 31133, 515, 197, 2109, 2186, 291, 1703, 25, 256, 3239, 7078, 345, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_parseGetPublicKey(t *testing.T) { assert := assert.New(t) type args struct { queryParams map[string]string } tests := []struct { name string args args wantRes *GetPublicKeyRequest wantErr bool }{ { "success", args{ map[string]string{ "address": "0x5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761", "network": "mainnet", "protocol": "ethereum", }, }, &GetPublicKeyRequest{ Address: "0x5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761", addressBytes: []byte{0x56, 0x2, 0xea, 0x95, 0x54, 0xb, 0xee, 0x46, 0xd0, 0x3b, 0xa3, 0x35, 0xee, 0xd6, 0xf4, 0x9d, 0x11, 0x7e, 0xab, 0x95, 0xc8, 0xab, 0x8b, 0x71, 0xba, 0xe2, 0xcd, 0xd1, 0xe5, 0x64, 0xa7, 0x61}, Network: "mainnet", Protocol: "ethereum", }, false, }, { "err_empty_address", args{ map[string]string{ "address": "", "network": "mainnet", "protocol": "ethereum", }, }, nil, true, }, { "err_address", args{ map[string]string{ "address": "0x560", "network": "mainnet", "protocol": "ethereum", }, }, nil, true, }, { "err_protocol", args{ map[string]string{ "address": "0x5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761", "network": "mainnet", "protocol": "", }, }, nil, true, }, { "err_network", args{ map[string]string{ "address": "0x5602ea95540bee46d03ba335eed6f49d117eab95c8ab8b71bae2cdd1e564a761", "network": "", "protocol": "ethereum", }, }, nil, true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { req, _ := http.NewRequest("GET", "/", nil) q := req.URL.Query() for k, v := range tt.args.queryParams { q.Add(k, v) } req.URL.RawQuery = q.Encode() gotRes, err := parseGetPublicKey(req) if (err != nil) != tt.wantErr { t.Errorf("parseGetPublicKey() error = %v, wantErr %v", err, tt.wantErr) return } if !assert.Equal(tt.wantRes, gotRes) { t.Errorf("parseGetPublicKey() gotRes = %v, want %v", gotRes, tt.wantRes) } }) } }
explode_data.jsonl/17092
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1205 }
[ 2830, 3393, 21039, 1949, 61822, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 13158, 2827, 2036, 341, 197, 27274, 4870, 2415, 14032, 30953, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestBackupRestoreChecksum(t *testing.T) { defer leaktest.AfterTest(t)() const numAccounts = 1000 _, _, sqlDB, dir, cleanupFn := BackupRestoreTestSetup(t, singleNode, numAccounts, InitNone) defer cleanupFn() dir = filepath.Join(dir, "foo") sqlDB.Exec(t, `BACKUP DATABASE data TO $1`, LocalFoo) var backupManifest BackupManifest { backupManifestBytes, err := ioutil.ReadFile(filepath.Join(dir, BackupManifestName)) if err != nil { t.Fatalf("%+v", err) } fileType := http.DetectContentType(backupManifestBytes) if fileType == ZipType { backupManifestBytes, err = DecompressData(backupManifestBytes) require.NoError(t, err) } if err := protoutil.Unmarshal(backupManifestBytes, &backupManifest); err != nil { t.Fatalf("%+v", err) } } // Corrupt one of the files in the backup. f, err := os.OpenFile(filepath.Join(dir, backupManifest.Files[1].Path), os.O_WRONLY, 0) if err != nil { t.Fatalf("%+v", err) } defer f.Close() // The last eight bytes of an SST file store a nonzero magic number. We can // blindly null out those bytes and guarantee that the checksum will change. if _, err := f.Seek(-8, io.SeekEnd); err != nil { t.Fatalf("%+v", err) } if _, err := f.Write(make([]byte, 8)); err != nil { t.Fatalf("%+v", err) } if err := f.Sync(); err != nil { t.Fatalf("%+v", err) } sqlDB.Exec(t, `DROP TABLE data.bank`) sqlDB.ExpectErr(t, "checksum mismatch", `RESTORE data.* FROM $1`, LocalFoo) }
explode_data.jsonl/57598
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 590 }
[ 2830, 3393, 56245, 56284, 73190, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 4777, 1629, 41369, 284, 220, 16, 15, 15, 15, 198, 197, 6878, 8358, 5704, 3506, 11, 5419, 11, 21290, 24911, 1669, 43438, 562...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWebSocketReverseProxyNonHijackerPanic(t *testing.T) { // Capture the expected panic defer func() { r := recover() if _, ok := r.(httpserver.NonHijackerError); !ok { t.Error("not get the expected panic") } }() var connCount int32 wsNop := httptest.NewServer(websocket.Handler(func(ws *websocket.Conn) { atomic.AddInt32(&connCount, 1) })) defer wsNop.Close() // Get proxy to use for the test p := newWebSocketTestProxy(wsNop.URL, false, 30*time.Second) // Create client request r := httptest.NewRequest("GET", "/", nil) r.Header = http.Header{ "Connection": {"Upgrade"}, "Upgrade": {"websocket"}, "Origin": {wsNop.URL}, "Sec-WebSocket-Key": {"x3JJHMbDL1EzLkh9GBhXDw=="}, "Sec-WebSocket-Version": {"13"}, } nonHijacker := httptest.NewRecorder() p.ServeHTTP(nonHijacker, r) }
explode_data.jsonl/64229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 372 }
[ 2830, 3393, 61238, 45695, 16219, 8121, 39, 3172, 9683, 47, 31270, 1155, 353, 8840, 836, 8, 341, 197, 322, 39885, 279, 3601, 21975, 198, 16867, 2915, 368, 341, 197, 7000, 1669, 11731, 741, 197, 743, 8358, 5394, 1669, 435, 12832, 1254, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewTransportConfig(t *testing.T) { type testCase struct { Description string UserInputValConfig userInputValidationConfig ExpectedTransportConfig transportConfig ShouldUnmarshalFail bool ExpectedErr error } tcs := []testCase{ { Description: "Unmarshal fails", ShouldUnmarshalFail: true, ExpectedErr: errTestUnmarshalFail, }, { Description: "Bad regex for bucket", ExpectedErr: errRegexCompilation, UserInputValConfig: userInputValidationConfig{ BucketFormatRegex: "??", OwnerFormatRegex: ".*", }, }, { Description: "Bad regex for owner", ExpectedErr: errRegexCompilation, UserInputValConfig: userInputValidationConfig{ OwnerFormatRegex: "??", BucketFormatRegex: ".*", }, }, { Description: "Default values", UserInputValConfig: userInputValidationConfig{}, ExpectedTransportConfig: getDefaultValuesExpectedConfig(), }, { Description: "Check values", UserInputValConfig: userInputValidationConfig{ ItemMaxTTL: 48 * time.Hour, BucketFormatRegex: ".+", OwnerFormatRegex: ".*", ItemDataMaxDepth: 5, }, ExpectedTransportConfig: getCheckValuesExpectedConfig(), }, } for _, tc := range tcs { t.Run(tc.Description, func(t *testing.T) { require := require.New(t) assert := assert.New(t) tu := testUnmarshaler{ userInputValConfig: tc.UserInputValConfig, assert: assert, require: require, shouldUnmarshalFail: tc.ShouldUnmarshalFail, } transportConfig, err := newTransportConfig(transportConfigIn{ AccessLevelAttributeKey: "attr-key", Unmarshaler: tu, }) if tc.ExpectedErr == nil { require.Nil(err) assert.Equal(tc.ExpectedTransportConfig, *transportConfig) } else { errors.Is(err, tc.ExpectedErr) } }) } }
explode_data.jsonl/70138
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 840 }
[ 2830, 3393, 3564, 27560, 2648, 1155, 353, 8840, 836, 8, 341, 13158, 54452, 2036, 341, 197, 47414, 1797, 914, 198, 197, 31672, 2505, 2208, 2648, 414, 64173, 13799, 2648, 198, 197, 197, 18896, 27560, 2648, 7557, 2648, 198, 197, 197, 14996...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateBucket(t *testing.T) { //@TODO(jb): implement them for sanity reasons ts := newTestServer(t) defer ts.Close() svc := ts.s3Client() ts.OKAll(svc.CreateBucket(&s3.CreateBucketInput{ Bucket: aws.String("testbucket"), })) ts.OKAll(svc.HeadBucket(&s3.HeadBucketInput{ Bucket: aws.String("testbucket"), })) ts.OKAll(svc.PutObject(&s3.PutObjectInput{ Bucket: aws.String("testbucket"), Key: aws.String("ObjectKey"), Body: bytes.NewReader([]byte(`{"test": "foo"}`)), Metadata: map[string]*string{ "Key": aws.String("MetadataValue"), }, })) ts.OKAll(svc.GetObject(&s3.GetObjectInput{ Bucket: aws.String("testbucket"), Key: aws.String("ObjectKey"), })) }
explode_data.jsonl/22248
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 309 }
[ 2830, 3393, 4021, 36018, 1155, 353, 8840, 836, 8, 341, 197, 36585, 14732, 3325, 65, 1648, 4211, 1105, 369, 46842, 7966, 271, 57441, 1669, 501, 2271, 5475, 1155, 340, 16867, 10591, 10421, 2822, 1903, 7362, 1669, 10591, 514, 18, 2959, 282...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCatchUpClient_PullBlocksRetry(t *testing.T) { dir, err := ioutil.TempDir("", "catchup") require.NoError(t, err) defer os.RemoveAll(dir) var retryCount int var wgRetry1 sync.WaitGroup wgRetry1.Add(1) var wgRetry2 sync.WaitGroup wgRetry2.Add(1) lg, err := logger.New( &logger.Config{ Level: "debug", //must be debug OutputPath: []string{"stdout", path.Join(dir, "test.log")}, ErrOutputPath: []string{"stderr"}, Encoding: "console", }, zap.Hooks(func(entry zapcore.Entry) error { if strings.Contains(entry.Message, "Retry interval max reached") { t.Logf("Retry is working! %s | %s", entry.Caller, entry.Message) if retryCount == 0 { wgRetry1.Done() } if retryCount == 1 { wgRetry2.Done() } retryCount++ } return nil }), ) require.NoError(t, err) mn := comm.RetryIntervalMin mx := comm.RetryIntervalMax comm.RetryIntervalMin = 100 * time.Microsecond comm.RetryIntervalMax = 1 * time.Millisecond defer func() { comm.RetryIntervalMin = mn comm.RetryIntervalMax = mx }() localConfigs, sharedConfig := newTestSetup(t, 3) tr1, err := startTransportWithLedger(t, lg, localConfigs, sharedConfig, 0, 50) require.NoError(t, err) defer tr1.Close() cc := comm.NewCatchUpClient(lg, nil) require.NotNil(t, cc) err = cc.UpdateMembers(sharedConfig.ConsensusConfig.Members) require.NoError(t, err) ledger4 := &memLedger{} var num uint64 var target uint64 = 150 var wgTarget sync.WaitGroup wgTarget.Add(1) pullBlocksLoop := func() { for num < target { blocks, err := cc.PullBlocks(context.Background(), num+1, target, 0) require.NoError(t, err) for _, block := range blocks { err = ledger4.Append(block) require.NoError(t, err) num = block.Header.BaseHeader.Number } } wgTarget.Done() } go pullBlocksLoop() wgRetry1.Wait() tr2, err := startTransportWithLedger(t, lg, localConfigs, sharedConfig, 1, 100) require.NoError(t, err) defer tr2.Close() wgRetry2.Wait() tr3, err := startTransportWithLedger(t, lg, localConfigs, sharedConfig, 2, 150) require.NoError(t, err) defer tr3.Close() wgTarget.Wait() h, err := ledger4.Height() require.NoError(t, err) require.Equal(t, target, h) }
explode_data.jsonl/70497
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 960 }
[ 2830, 3393, 57760, 2324, 2959, 1088, 617, 29804, 51560, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 7173, 454, 1138, 17957, 35699, 1155, 11, 1848, 340, 16867, 2643, 84427, 14161, 692, 2405, 22683, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_parseEndpointPortV1Beta1(t *testing.T) { type args struct { port slim_discovery_v1beta1.EndpointPort } tests := []struct { name string args args portName string l4Addr *loadbalancer.L4Addr }{ { name: "tcp-port", args: args{ port: slim_discovery_v1beta1.EndpointPort{ Name: func() *string { a := "http-test-svc"; return &a }(), Protocol: func() *slim_corev1.Protocol { a := slim_corev1.ProtocolTCP; return &a }(), Port: func() *int32 { a := int32(8080); return &a }(), }, }, portName: "http-test-svc", l4Addr: &loadbalancer.L4Addr{ Protocol: loadbalancer.TCP, Port: 8080, }, }, { name: "udp-port", args: args{ port: slim_discovery_v1beta1.EndpointPort{ Name: func() *string { a := "http-test-svc"; return &a }(), Protocol: func() *slim_corev1.Protocol { a := slim_corev1.ProtocolUDP; return &a }(), Port: func() *int32 { a := int32(8080); return &a }(), }, }, portName: "http-test-svc", l4Addr: &loadbalancer.L4Addr{ Protocol: loadbalancer.UDP, Port: 8080, }, }, { name: "unset-protocol-should-have-tcp-port", args: args{ port: slim_discovery_v1beta1.EndpointPort{ Name: func() *string { a := "http-test-svc"; return &a }(), Port: func() *int32 { a := int32(8080); return &a }(), }, }, portName: "http-test-svc", l4Addr: &loadbalancer.L4Addr{ Protocol: loadbalancer.TCP, Port: 8080, }, }, { name: "unset-port-number-should-fail", args: args{ port: slim_discovery_v1beta1.EndpointPort{ Name: func() *string { a := "http-test-svc"; return &a }(), }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotPortName, gotL4Addr := parseEndpointPortV1Beta1(tt.args.port) if gotPortName != tt.portName { t.Errorf("parseEndpointPortV1Beta1() got = %v, want %v", gotPortName, tt.portName) } if !reflect.DeepEqual(gotL4Addr, tt.l4Addr) { t.Errorf("parseEndpointPortV1Beta1() got1 = %v, want %v", gotL4Addr, tt.l4Addr) } }) } }
explode_data.jsonl/31606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1051 }
[ 2830, 3393, 21039, 27380, 7084, 53, 16, 64811, 16, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 52257, 29353, 9932, 7449, 2273, 16, 19127, 16, 90409, 7084, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 91...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQuotedStringArg(t *testing.T) { cl := client.NewURIClient(tcpAddr) // should NOT be unquoted val := "\"abc\"" got, err := echoViaHTTP(cl, val) require.Nil(t, err) assert.Equal(t, got, val) }
explode_data.jsonl/47836
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 2183, 9253, 703, 2735, 1155, 353, 8840, 836, 8, 341, 39407, 1669, 2943, 7121, 1511, 98900, 98203, 13986, 340, 197, 322, 1265, 4183, 387, 650, 63725, 198, 19302, 1669, 15898, 13683, 2105, 698, 3174, 354, 11, 1848, 1669, 1687,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSet(t *testing.T) { store, clean := realtikvtest.CreateMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("set @tmp = 0") tk.MustExec("set @tmp := @tmp + 1") tk.MustQuery("select @tmp").Check(testkit.Rows("1")) tk.MustQuery("select @tmp1 = 1, @tmp2 := 2").Check(testkit.Rows("<nil> 2")) tk.MustQuery("select @tmp1 := 11, @tmp2").Check(testkit.Rows("11 2")) tk.MustExec("drop table if exists t") tk.MustExec("create table t (c int);") tk.MustExec("insert into t values (1),(2);") tk.MustExec("update t set c = 3 WHERE c = @var:= 1") tk.MustQuery("select * from t").Check(testkit.Rows("3", "2")) tk.MustQuery("select @tmp := count(*) from t").Check(testkit.Rows("2")) tk.MustQuery("select @tmp := c-2 from t where c=3").Check(testkit.Rows("1")) }
explode_data.jsonl/5792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 1649, 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, 3244, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestThrowIfEmpty(t *testing.T) { NewTestSuite(t).Case( rx.Empty().Pipe( operators.ThrowIfEmpty(rx.ErrEmpty), ), rx.ErrEmpty, ).Case( rx.Throw(ErrTest).Pipe( operators.ThrowIfEmpty(rx.ErrEmpty), ), ErrTest, ).Case( rx.Just(1).Pipe( operators.ThrowIfEmpty(rx.ErrEmpty), ), 1, Completed, ).Case( rx.Just(1, 2).Pipe( operators.ThrowIfEmpty(rx.ErrEmpty), ), 1, 2, Completed, ).Case( rx.Concat( rx.Just(1), rx.Throw(ErrTest), ).Pipe( operators.ThrowIfEmpty(rx.ErrEmpty), ), 1, ErrTest, ).Case( rx.Concat( rx.Just(1, 2), rx.Throw(ErrTest), ).Pipe( operators.ThrowIfEmpty(rx.ErrEmpty), ), 1, 2, ErrTest, ).TestAll() }
explode_data.jsonl/45488
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 23079, 2679, 3522, 1155, 353, 8840, 836, 8, 341, 197, 3564, 2271, 28000, 1155, 568, 4207, 1006, 197, 7000, 87, 11180, 1005, 34077, 1006, 298, 197, 32838, 73372, 2679, 3522, 75279, 27862, 3522, 1326, 197, 197, 1326, 197, 7000...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetTraderFuturesAccountRatio(t *testing.T) { t.Parallel() _, err := b.GetTraderFuturesAccountRatio(context.Background(), "BTCUSD", "5m", 0, time.Time{}, time.Time{}) if err != nil { t.Error(err) } _, err = b.GetTraderFuturesAccountRatio(context.Background(), "BTCUSD", "5m", 0, time.Unix(1577836800, 0), time.Unix(1580515200, 0)) if err != nil { t.Error(err) } }
explode_data.jsonl/76613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 1949, 93172, 37, 74606, 7365, 22777, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 2234, 93172, 37, 74606, 7365, 22777, 5378, 19047, 1507, 330, 59118, 26749, 497, 330, 20, 76, 497, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_decodeImages(t *testing.T) { body := ` image: cn-app-integration:v1.0.0 image: registry.cn-shanghai.aliyuncs.com/cnip/cn-app-integration:v1.0.0 imagePullPolicy: Always image: cn-app-integration:v1.0.0 # image: cn-app-integration:v1.0.0 name: cn-app-demo` type args struct { body string } tests := []struct { name string args args want []string }{ { "test get iamges form yaml", args{body}, []string{"cn-app-integration:v1.0.0", "registry.cn-shanghai.aliyuncs.com/cnip/cn-app-integration:v1.0.0", "cn-app-integration:v1.0.0"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := DecodeImages(tt.args.body); !reflect.DeepEqual(got, tt.want) { t.Errorf("decodeImages() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 419 }
[ 2830, 3393, 15227, 14228, 1155, 353, 8840, 836, 8, 341, 35402, 1669, 22074, 688, 2168, 25, 13665, 20023, 20052, 17376, 52649, 16, 13, 15, 13, 15, 198, 688, 2168, 25, 19424, 22057, 7514, 30070, 72514, 88, 1347, 82, 905, 2899, 69773, 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...
2
func TestErrorTypeWrongKey(t *testing.T) { //defer afterTest(t) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "Hello, checkTypeWrongKey") })) defer ts.Close() _, _, err := New(). Get(ts.URL). Type("wrongtype"). End() if len(err) != 0 { if err[0].Error() != "Type func: incorrect type \"wrongtype\"" { t.Errorf("Wrong error message: " + err[0].Error()) } } else { t.Errorf("Should have error") } }
explode_data.jsonl/25477
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 1454, 929, 29185, 1592, 1155, 353, 8840, 836, 8, 341, 197, 322, 62095, 1283, 2271, 1155, 340, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 11009, 991, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultiContainerWait(t *testing.T) { containerIDs := []string{ testutil.UniqueContainerID(), testutil.UniqueContainerID(), } containerAnnotations := []map[string]string{ // The first container creates a sandbox. map[string]string{ specutils.ContainerdContainerTypeAnnotation: specutils.ContainerdContainerTypeSandbox, }, // The second container creates a container within the first // container's sandbox. map[string]string{ specutils.ContainerdContainerTypeAnnotation: specutils.ContainerdContainerTypeContainer, specutils.ContainerdSandboxIDAnnotation: containerIDs[0], }, } args := [][]string{ // The first container should run the entire duration of the // test. {"sleep", "100"}, // We'll wait on the second container, which is much shorter // lived. {"sleep", "1"}, } rootDir, err := testutil.SetupRootDir() if err != nil { t.Fatalf("error creating root dir: %v", err) } defer os.RemoveAll(rootDir) // Setup the containers. containers := make([]*container.Container, 0, len(containerIDs)) for i, annotations := range containerAnnotations { spec := testutil.NewSpecWithArgs(args[i][0], args[i][1]) spec.Annotations = annotations conf := testutil.TestConfig() bundleDir, err := testutil.SetupContainerInRoot(rootDir, spec, conf) if err != nil { t.Fatalf("error setting up container: %v", err) } defer os.RemoveAll(bundleDir) cont, err := container.Create(containerIDs[i], spec, conf, bundleDir, "", "") if err != nil { t.Fatalf("error creating container: %v", err) } defer cont.Destroy() if err := cont.Start(conf); err != nil { t.Fatalf("error starting container: %v", err) } containers = append(containers, cont) } expectedPL := []*control.Process{ { UID: 0, PID: 1, PPID: 0, C: 0, Cmd: "sleep", }, { UID: 0, PID: 2, PPID: 0, C: 0, Cmd: "sleep", }, } // Check via ps that multiple processes are running. if err := waitForProcessList(containers[0], expectedPL); err != nil { t.Errorf("failed to wait for sleep to start: %v", err) } // Wait on the short lived container from multiple goroutines. wg := sync.WaitGroup{} for i := 0; i < 3; i++ { wg.Add(1) go func() { defer wg.Done() if ws, err := containers[1].Wait(); err != nil { t.Errorf("failed to wait for process %q: %v", strings.Join(containers[1].Spec.Process.Args, " "), err) } else if es := ws.ExitStatus(); es != 0 { t.Errorf("process %q exited with non-zero status %d", strings.Join(containers[1].Spec.Process.Args, " "), es) } if _, err := containers[1].Wait(); err == nil { t.Errorf("wait for stopped process %q should fail", strings.Join(containers[1].Spec.Process.Args, " ")) } // After Wait returns, ensure that the root container is running and // the child has finished. if err := waitForProcessList(containers[0], expectedPL[:1]); err != nil { t.Errorf("failed to wait for %q to start: %v", strings.Join(containers[0].Spec.Process.Args, " "), err) } }() } // Also wait via PID. for i := 0; i < 3; i++ { wg.Add(1) go func() { defer wg.Done() const pid = 2 if ws, err := containers[0].WaitPID(pid); err != nil { t.Errorf("failed to wait for PID %d: %v", pid, err) } else if es := ws.ExitStatus(); es != 0 { t.Errorf("PID %d exited with non-zero status %d", pid, es) } if _, err := containers[0].WaitPID(pid); err == nil { t.Errorf("wait for stopped PID %d should fail", pid) } }() } wg.Wait() }
explode_data.jsonl/48931
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1366 }
[ 2830, 3393, 20358, 4502, 14190, 1155, 353, 8840, 836, 8, 341, 53290, 30466, 1669, 3056, 917, 515, 197, 18185, 1314, 87443, 4502, 915, 3148, 197, 18185, 1314, 87443, 4502, 915, 3148, 197, 532, 53290, 21418, 1669, 3056, 2186, 14032, 30953, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestVerifyBlock(t *testing.T) { aliceSigner := &mockscrypto.LocalSigner{Identity: []byte("Alice")} policyManagerGetter := &mocks.ChannelPolicyManagerGetterWithManager{ Managers: map[string]policies.Manager{ "A": &mocks.ChannelPolicyManager{ Policy: &mocks.Policy{Deserializer: &mocks.IdentityDeserializer{Identity: []byte("Bob"), Msg: []byte("msg2"), Mock: mock.Mock{}}}, }, "B": &mocks.ChannelPolicyManager{ Policy: &mocks.Policy{Deserializer: &mocks.IdentityDeserializer{Identity: []byte("Charlie"), Msg: []byte("msg3"), Mock: mock.Mock{}}}, }, "C": &mocks.ChannelPolicyManager{ Policy: &mocks.Policy{Deserializer: &mocks.IdentityDeserializer{Identity: []byte("Alice"), Msg: []byte("msg1"), Mock: mock.Mock{}}}, }, "D": &mocks.ChannelPolicyManager{ Policy: &mocks.Policy{Deserializer: &mocks.IdentityDeserializer{Identity: []byte("Alice"), Msg: []byte("msg1"), Mock: mock.Mock{}}}, }, }, } msgCryptoService := NewMCS( policyManagerGetter, aliceSigner, &mocks.DeserializersManager{ LocalDeserializer: &mocks.IdentityDeserializer{Identity: []byte("Alice"), Msg: []byte("msg1"), Mock: mock.Mock{}}, ChannelDeserializers: map[string]msp.IdentityDeserializer{ "A": &mocks.IdentityDeserializer{Identity: []byte("Bob"), Msg: []byte("msg2"), Mock: mock.Mock{}}, "B": &mocks.IdentityDeserializer{Identity: []byte("Charlie"), Msg: []byte("msg3"), Mock: mock.Mock{}}, }, }, ) // - Prepare testing valid block, Alice signs it. blockRaw, msg := mockBlock(t, "C", 42, aliceSigner, nil) policyManagerGetter.Managers["C"].(*mocks.ChannelPolicyManager).Policy.(*mocks.Policy).Deserializer.(*mocks.IdentityDeserializer).Msg = msg blockRaw2, msg2 := mockBlock(t, "D", 42, aliceSigner, nil) policyManagerGetter.Managers["D"].(*mocks.ChannelPolicyManager).Policy.(*mocks.Policy).Deserializer.(*mocks.IdentityDeserializer).Msg = msg2 // - Verify block assert.NoError(t, msgCryptoService.VerifyBlock([]byte("C"), 42, blockRaw)) // Wrong sequence number claimed err := msgCryptoService.VerifyBlock([]byte("C"), 43, blockRaw) assert.Error(t, err) assert.Contains(t, err.Error(), "but actual seqNum inside block is") delete(policyManagerGetter.Managers, "D") nilPolMgrErr := msgCryptoService.VerifyBlock([]byte("D"), 42, blockRaw2) assert.Contains(t, nilPolMgrErr.Error(), "Could not acquire policy manager") assert.Error(t, nilPolMgrErr) assert.Error(t, msgCryptoService.VerifyBlock([]byte("A"), 42, blockRaw)) assert.Error(t, msgCryptoService.VerifyBlock([]byte("B"), 42, blockRaw)) // - Prepare testing invalid block (wrong data has), Alice signs it. blockRaw, msg = mockBlock(t, "C", 42, aliceSigner, []byte{0}) policyManagerGetter.Managers["C"].(*mocks.ChannelPolicyManager).Policy.(*mocks.Policy).Deserializer.(*mocks.IdentityDeserializer).Msg = msg // - Verify block assert.Error(t, msgCryptoService.VerifyBlock([]byte("C"), 42, blockRaw)) // Check invalid args assert.Error(t, msgCryptoService.VerifyBlock([]byte("C"), 42, []byte{0, 1, 2, 3, 4})) assert.Error(t, msgCryptoService.VerifyBlock([]byte("C"), 42, nil)) }
explode_data.jsonl/26113
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1164 }
[ 2830, 3393, 32627, 4713, 1155, 353, 8840, 836, 8, 341, 197, 63195, 7264, 261, 1669, 609, 16712, 2388, 9444, 20856, 7264, 261, 90, 18558, 25, 3056, 3782, 445, 61686, 42132, 3223, 8018, 2043, 31485, 1669, 609, 16712, 82, 38716, 13825, 204...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPPD__createPPDBatch(t *testing.T) { depID, userID := base.ID(), id.User(base.ID()) keeper := secrets.TestStringKeeper(t) gateway := &model.Gateway{ ID: model.GatewayID(base.ID()), Origin: "987654320", OriginName: "My Bank", Destination: "123456780", DestinationName: "Their Bank", } receiverDep := &model.Depository{ ID: id.Depository(base.ID()), BankName: "foo bank", Holder: "jane doe", HolderType: model.Individual, Type: model.Checking, RoutingNumber: "121042882", Status: model.DepositoryVerified, Metadata: "jane doe checking", Keeper: keeper, } receiverDep.ReplaceAccountNumber("2") receiver := &model.Receiver{ ID: model.ReceiverID(base.ID()), Email: "jane.doe@example.com", DefaultDepository: receiverDep.ID, Status: model.ReceiverVerified, Metadata: "jane doe", } origDep := &model.Depository{ ID: id.Depository(base.ID()), BankName: "foo bank", Holder: "john doe", HolderType: model.Individual, Type: model.Savings, RoutingNumber: "231380104", Status: model.DepositoryVerified, Metadata: "john doe savings", Keeper: keeper, } origDep.ReplaceAccountNumber("2") orig := &model.Originator{ ID: model.OriginatorID(base.ID()), DefaultDepository: origDep.ID, Identification: "dddd", Metadata: "john doe", } amt, _ := model.NewAmount("USD", "100.00") transfer := &model.Transfer{ ID: id.Transfer(base.ID()), Type: model.PushTransfer, Amount: *amt, Originator: orig.ID, OriginatorDepository: origDep.ID, Receiver: receiver.ID, ReceiverDepository: receiverDep.ID, Description: "sending money", StandardEntryClassCode: "PPD", Status: model.TransferPending, UserID: userID.String(), PPDDetail: &model.PPDDetail{ PaymentInformation: "payment", }, } batch, err := createPPDBatch(depID, transfer, receiver, receiverDep, orig, origDep) if err != nil { t.Fatal(err) } if batch == nil { t.Error("nil PPD Batch") } file, err := ConstructFile(depID, "", gateway, transfer, receiver, receiverDep, orig, origDep) if err != nil { t.Fatal(err) } if file == nil { t.Error("nil PPD ach.File") } }
explode_data.jsonl/7634
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1201 }
[ 2830, 3393, 4406, 35, 563, 3182, 4406, 3506, 754, 1155, 353, 8840, 836, 8, 341, 197, 14891, 915, 11, 35204, 1669, 2331, 9910, 1507, 877, 7344, 12663, 9910, 2398, 197, 18861, 1669, 23594, 8787, 703, 77233, 1155, 692, 3174, 12043, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestPidPath(t *testing.T) { _, err := v1MountPoint() if err == ErrMountPointNotExist { t.Skip("skipping test that requires cgroup hierarchy") } else if err != nil { t.Fatal(err) } paths, err := parseCgroupFile("/proc/self/cgroup") if err != nil { t.Fatal(err) } dp := strings.TrimPrefix(paths["devices"], "/") path := PidPath(os.Getpid()) p, err := path("devices") if err != nil { t.Fatal(err) } if p != filepath.Join("/", dp) { t.Fatalf("expected self path of %q but received %q", filepath.Join("/", dp), p) } }
explode_data.jsonl/1198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 32339, 1820, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 348, 16, 16284, 2609, 741, 743, 1848, 621, 15495, 16284, 2609, 45535, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 429, 7460, 272, 4074, 28922, 1138, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestStatementErrorAfterClose(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) stmt, err := db.Prepare("SELECT|people|age|name=?") if err != nil { t.Fatalf("Prepare: %v", err) } err = stmt.Close() if err != nil { t.Fatalf("Close: %v", err) } var name string err = stmt.QueryRow("foo").Scan(&name) if err == nil { t.Errorf("expected error from QueryRow.Scan after Stmt.Close") } }
explode_data.jsonl/15964
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 8636, 1454, 6025, 7925, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 2271, 3506, 1155, 11, 330, 16069, 1138, 16867, 3265, 3506, 1155, 11, 2927, 340, 55822, 11, 1848, 1669, 2927, 28770, 3380, 445, 4858, 91, 16069, 91, 42...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_ServicePrincipalProfile_ValidateSecretOrKeyvaultSecretRef(t *testing.T) { t.Run("ServicePrincipalProfile with secret should pass", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) if err := cs.Validate(false); err != nil { t.Errorf("should not error %v", err) } }) t.Run("ServicePrincipalProfile with KeyvaultSecretRef (with version) should pass", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) cs.Properties.ServicePrincipalProfile.Secret = "" cs.Properties.ServicePrincipalProfile.KeyvaultSecretRef = &KeyvaultSecretRef{ VaultID: "/subscriptions/SUB-ID/resourceGroups/RG-NAME/providers/Microsoft.KeyVault/vaults/KV-NAME", SecretName: "secret-name", SecretVersion: "version", } if err := cs.Validate(false); err != nil { t.Errorf("should not error %v", err) } }) t.Run("ServicePrincipalProfile with KeyvaultSecretRef (without version) should pass", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) cs.Properties.ServicePrincipalProfile.Secret = "" cs.Properties.ServicePrincipalProfile.KeyvaultSecretRef = &KeyvaultSecretRef{ VaultID: "/subscriptions/SUB-ID/resourceGroups/RG-NAME/providers/Microsoft.KeyVault/vaults/KV-NAME", SecretName: "secret-name", } if err := cs.Validate(false); err != nil { t.Errorf("should not error %v", err) } }) t.Run("ServicePrincipalProfile with Secret and KeyvaultSecretRef should NOT pass", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) cs.Properties.ServicePrincipalProfile.Secret = "secret" cs.Properties.ServicePrincipalProfile.KeyvaultSecretRef = &KeyvaultSecretRef{ VaultID: "/subscriptions/SUB-ID/resourceGroups/RG-NAME/providers/Microsoft.KeyVault/vaults/KV-NAME", SecretName: "secret-name", } if err := cs.Validate(false); err == nil { t.Error("error should have occurred") } }) t.Run("ServicePrincipalProfile with incorrect KeyvaultSecretRef format should NOT pass", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) cs.Properties.ServicePrincipalProfile.Secret = "" cs.Properties.ServicePrincipalProfile.KeyvaultSecretRef = &KeyvaultSecretRef{ VaultID: "randomID", SecretName: "secret-name", } if err := cs.Validate(false); err == nil || err.Error() != "service principal client keyvault secret reference is of incorrect format" { t.Error("error should have occurred") } }) }
explode_data.jsonl/17870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 912 }
[ 2830, 3393, 52548, 31771, 8526, 62, 17926, 19773, 2195, 1592, 82983, 19773, 3945, 1155, 353, 8840, 836, 8, 1476, 3244, 16708, 445, 1860, 31771, 8526, 448, 6234, 1265, 1494, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 41288, 7957...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuleFromBody(t *testing.T) { testModule := `package a.b.c pi = 3.14159 p[x] { x = 1 } greeting = "hello" cores = [{0: 1}, {1: 2}] wrapper = cores[0][1] pi = [3, 1, 4, x, y, z] foo["bar"] = "buz" foo["9"] = "10" foo.buz = "bar" bar[1] bar[[{"foo":"baz"}]] bar.qux input = 1 data = 2 f(1) = 2 f(1) d1 := 1234 ` assertParseModule(t, "rules from bodies", testModule, &Module{ Package: MustParseStatement(`package a.b.c`).(*Package), Rules: []*Rule{ MustParseRule(`pi = 3.14159 { true }`), MustParseRule(`p[x] { x = 1 }`), MustParseRule(`greeting = "hello" { true }`), MustParseRule(`cores = [{0: 1}, {1: 2}] { true }`), MustParseRule(`wrapper = cores[0][1] { true }`), MustParseRule(`pi = [3, 1, 4, x, y, z] { true }`), MustParseRule(`foo["bar"] = "buz" { true }`), MustParseRule(`foo["9"] = "10" { true }`), MustParseRule(`foo["buz"] = "bar" { true }`), MustParseRule(`bar[1] { true }`), MustParseRule(`bar[[{"foo":"baz"}]] { true }`), MustParseRule(`bar["qux"] { true }`), MustParseRule(`input = 1 { true }`), MustParseRule(`data = 2 { true }`), MustParseRule(`f(1) = 2 { true }`), MustParseRule(`f(1) = true { true }`), MustParseRule("d1 := 1234 { true }"), }, }) // Verify the rule and rule and rule head col/loc values module, err := ParseModule("test.rego", testModule) if err != nil { t.Fatal(err) } for i := range module.Rules { col := module.Rules[i].Location.Col if col != 1 { t.Fatalf("expected rule %v column to be 1 but got %v", module.Rules[i].Head.Name, col) } row := module.Rules[i].Location.Row if row != 3+i { // 'pi' rule stats on row 3 t.Fatalf("expected rule %v row to be %v but got %v", module.Rules[i].Head.Name, 3+i, row) } col = module.Rules[i].Head.Location.Col if col != 1 { t.Fatalf("expected rule head %v column to be 1 but got %v", module.Rules[i].Head.Name, col) } row = module.Rules[i].Head.Location.Row if row != 3+i { // 'pi' rule stats on row 3 t.Fatalf("expected rule head %v row to be %v but got %v", module.Rules[i].Head.Name, 3+i, row) } } mockModule := `package ex input = {"foo": 1} data = {"bar": 2}` assertParseModule(t, "rule name: input/data", mockModule, &Module{ Package: MustParsePackage(`package ex`), Rules: []*Rule{ MustParseRule(`input = {"foo": 1} { true }`), MustParseRule(`data = {"bar": 2} { true }`), }, }) multipleExprs := ` package a.b.c pi = 3.14159; pi > 3 ` nonEquality := ` package a.b.c pi > 3 ` nonVarName := ` package a.b.c "pi" = 3 ` withExpr := ` package a.b.c foo = input with input as 1 ` badRefLen1 := ` package a.b.c p["x"].y = 1` badRefLen2 := ` package a.b.c p["x"].y` negated := ` package a.b.c not p = 1` nonRefTerm := ` package a.b.c p` zeroArgs := ` package a.b.c p()` assignToTerm := ` package a.b.c "foo" := 1` someDecl := ` package a some x` arrayTerm := ` package a [][0] ` callWithRuleKeyPartialSet := ` package a f(x)[x] { true }` callWithRuleKeyPartialObject := ` package a f(x)[x] = x { true }` assignNoOperands := ` package a assign()` assignOneOperand := ` package a assign(x)` eqNoOperands := ` package a eq()` eqOneOperand := ` package a eq(x)` assertParseModuleError(t, "multiple expressions", multipleExprs) assertParseModuleError(t, "non-equality", nonEquality) assertParseModuleError(t, "non-var name", nonVarName) assertParseModuleError(t, "with expr", withExpr) assertParseModuleError(t, "bad ref (too long)", badRefLen1) assertParseModuleError(t, "bad ref (too long)", badRefLen2) assertParseModuleError(t, "negated", negated) assertParseModuleError(t, "non ref term", nonRefTerm) assertParseModuleError(t, "zero args", zeroArgs) assertParseModuleError(t, "assign to term", assignToTerm) assertParseModuleError(t, "some decl", someDecl) assertParseModuleError(t, "array term", arrayTerm) assertParseModuleError(t, "call in ref partial set", "package test\nf().x {}") assertParseModuleError(t, "call in ref partial object", "package test\nf().x = y {}") assertParseModuleError(t, "number in ref", "package a\n12[3]()=4") assertParseModuleError(t, "rule with args and key", callWithRuleKeyPartialObject) assertParseModuleError(t, "rule with args and key", callWithRuleKeyPartialSet) assertParseModuleError(t, "assign without operands", assignNoOperands) assertParseModuleError(t, "assign with only one operand", assignOneOperand) assertParseModuleError(t, "eq without operands", eqNoOperands) assertParseModuleError(t, "eq with only one operand", eqOneOperand) if _, err := ParseRuleFromExpr(&Module{}, &Expr{ Terms: struct{}{}, }); err == nil { t.Fatal("expected error for unknown expression term type") } }
explode_data.jsonl/50494
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2007 }
[ 2830, 3393, 11337, 59692, 1155, 353, 8840, 836, 8, 341, 18185, 3332, 1669, 1565, 1722, 264, 948, 520, 271, 2493, 284, 220, 18, 13, 16, 19, 16, 20, 24, 198, 79, 8323, 60, 314, 856, 284, 220, 16, 456, 70, 43632, 284, 330, 14990, 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...
8
func TestHostParser(t *testing.T) { tests := []struct { host, expected string }{ {"https://localhost", "https://localhost"}, {"http://localhost:9191", "http://localhost:9191"}, {"localhost", "tcp://localhost"}, {"localhost:9191", "tcp://localhost:9191"}, {"tcp://localhost:9191", "tcp://localhost:9191"}, {"unix:///var/lib/uwsgi.sock", "unix:///var/lib/uwsgi.sock"}, } m := mbtest.NewTestModule(t, map[string]interface{}{}) for _, test := range tests { hi, err := HostParser(m, test.host) if err != nil { t.Error("failed on", test.host, err) continue } assert.Equal(t, test.expected, hi.URI) } }
explode_data.jsonl/69483
{ "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, 9296, 6570, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 63104, 11, 3601, 914, 198, 197, 59403, 197, 197, 4913, 2428, 1110, 8301, 497, 330, 2428, 1110, 8301, 7115, 197, 197, 4913, 1254, 1110, 8301, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestContextSetGetValues(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.Set("string", "this is a string") c.Set("int32", int32(-42)) c.Set("int64", int64(42424242424242)) c.Set("uint64", uint64(42)) c.Set("float32", float32(4.2)) c.Set("float64", 4.2) var a interface{} = 1 c.Set("intInterface", a) assert.Exactly(t, c.MustGet("string").(string), "this is a string") assert.Exactly(t, c.MustGet("int32").(int32), int32(-42)) assert.Exactly(t, c.MustGet("int64").(int64), int64(42424242424242)) assert.Exactly(t, c.MustGet("uint64").(uint64), uint64(42)) assert.Exactly(t, c.MustGet("float32").(float32), float32(4.2)) assert.Exactly(t, c.MustGet("float64").(float64), 4.2) assert.Exactly(t, c.MustGet("intInterface").(int), 1) }
explode_data.jsonl/26745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 1972, 1649, 1949, 6227, 1155, 353, 8840, 836, 8, 341, 1444, 11, 716, 1669, 4230, 2271, 1972, 73392, 83, 70334, 7121, 47023, 2398, 1444, 4202, 445, 917, 497, 330, 574, 374, 264, 914, 1138, 1444, 4202, 445, 396, 18, 17, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScratchCode(t *testing.T) { var cotp OTPConfig cotp.ScratchCodes = []int{11112222, 22223333} var scratchTests = []struct { code int result bool }{ {33334444, false}, {11112222, true}, {11112222, false}, {22223333, true}, {22223333, false}, {33334444, false}, } for _, s := range scratchTests { r := cotp.checkScratchCodes(s.code) if r != s.result { t.Errorf("scratchcode(%d) failed: got %t expected %t", s.code, r, s.result) } } }
explode_data.jsonl/75088
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 65508, 754, 2078, 1155, 353, 8840, 836, 8, 1476, 2405, 47581, 79, 80868, 2648, 271, 1444, 48708, 808, 86284, 20871, 284, 3056, 396, 90, 16, 16, 16, 16, 17, 17, 17, 17, 11, 220, 17, 17, 17, 17, 18, 18, 18, 18, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSwiftChunkStorage(t *testing.T) { s, err := e2e.NewScenario(networkName) require.NoError(t, err) defer s.Close() swift := e2edb.NewSwiftStorage() require.NoError(t, s.StartAndWaitReady(swift)) var ( cfg storage.Config storeConfig chunk.StoreConfig schemaConfig chunk.SchemaConfig defaults validation.Limits ) flagext.DefaultValues(&cfg, &storeConfig, &schemaConfig, &defaults) cfg.Swift = swiftConfig(swift) schemaConfig.Configs = []chunk.PeriodConfig{ { From: chunk.DayTime{Time: model.Time(0)}, IndexType: "inmemory", ObjectType: "swift", Schema: "v10", RowShards: 16, }, } // inject a memory store so we can create table without a table manager. inmemory := chunk.NewMockStorage() err = inmemory.CreateTable(context.Background(), chunk.TableDesc{}) require.NoError(t, err) storage.RegisterIndexStore("inmemory", func() (chunk.IndexClient, error) { return inmemory, nil }, func() (chunk.TableClient, error) { return inmemory, nil }) limits, err := validation.NewOverrides(defaults, nil) require.NoError(t, err) store, err := storage.NewStore(cfg, storeConfig, schemaConfig, limits, nil, nil, log.NewNopLogger()) require.NoError(t, err) defer store.Stop() ctx := user.InjectUserID(context.Background(), userID) lbls := labels.Labels{ {Name: labels.MetricName, Value: "foo"}, {Name: "bar", Value: "baz"}, {Name: "buzz", Value: "fuzz"}, } c1 := newChunk(model.Time(1), lbls, 10) c2 := newChunk(model.Time(2), lbls, 10) // Add two chunks. err = store.PutOne(ctx, c1.From, c1.Through, c1) require.NoError(t, err) err = store.PutOne(ctx, c2.From, c2.Through, c2) require.NoError(t, err) ctx = user.InjectOrgID(ctx, userID) // Get the first chunk. chunks, err := store.Get(ctx, userID, model.Time(1), model.Time(1), labels.MustNewMatcher(labels.MatchEqual, labels.MetricName, "foo")) require.NoError(t, err) require.Equal(t, 1, len(chunks)) // Get both chunk and verify their content. chunks, err = store.Get(ctx, userID, model.Time(1), model.Time(2), labels.MustNewMatcher(labels.MatchEqual, labels.MetricName, "foo")) require.NoError(t, err) require.Equal(t, 2, len(chunks)) sort.Slice(chunks, func(i, j int) bool { return chunks[i].From < chunks[j].From }) require.Equal(t, c1.Checksum, chunks[0].Checksum) require.Equal(t, c2.Checksum, chunks[1].Checksum) // Delete the first chunk err = store.DeleteChunk(ctx, c1.From, c1.Through, userID, c1.ExternalKey(), lbls, nil) require.NoError(t, err) // Verify we get now only the second chunk. chunks, err = store.Get(ctx, userID, model.Time(1), model.Time(2), labels.MustNewMatcher(labels.MatchEqual, labels.MetricName, "foo")) require.NoError(t, err) require.Equal(t, 1, len(chunks)) require.Equal(t, c2.Metric, chunks[0].Metric) }
explode_data.jsonl/5390
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1120 }
[ 2830, 3393, 55336, 28304, 5793, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 384, 17, 68, 7121, 54031, 46542, 675, 340, 17957, 35699, 1155, 11, 1848, 340, 16867, 274, 10421, 741, 77295, 2085, 1669, 384, 17, 93727, 7121, 55336, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBlockSigsGet(t *testing.T) { type hashSig struct { hash cipher.SHA256 sig cipher.Sig } type expect struct { exist bool sig cipher.Sig err error } hashSigs := []hashSig{} for i := 0; i < 5; i++ { _, s := cipher.GenerateKeyPair() h := testutil.RandSHA256(t) sig := cipher.SignHash(h, s) hashSigs = append(hashSigs, hashSig{ hash: h, sig: sig, }) } tt := []struct { name string init []hashSig hash cipher.SHA256 expect expect }{ { "ok", hashSigs[:], hashSigs[0].hash, expect{ true, hashSigs[0].sig, nil, }, }, { "not exist", hashSigs[1:], hashSigs[0].hash, expect{ false, cipher.Sig{}, nil, }, }, } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { db, closeDB := testutil.PrepareDB(t) defer closeDB() // init db db.Update(func(tx *bolt.Tx) error { bkt, err := tx.CreateBucketIfNotExists(blockSigsBkt) require.NoError(t, err) for _, hs := range tc.init { err = bkt.Put(hs.hash[:], encoder.Serialize(hs.sig)) require.NoError(t, err) } return nil }) sigs, err := newBlockSigs(db) require.NoError(t, err) sg, ok, err := sigs.Get(tc.hash) require.Equal(t, tc.expect.err, err) require.Equal(t, tc.expect.exist, ok) if ok { require.Equal(t, tc.expect.sig, sg) } }) } }
explode_data.jsonl/799
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 721 }
[ 2830, 3393, 4713, 50, 14462, 1949, 1155, 353, 8840, 836, 8, 341, 13158, 5175, 47246, 2036, 341, 197, 50333, 31088, 808, 17020, 17, 20, 21, 198, 197, 84841, 220, 31088, 808, 343, 198, 197, 630, 13158, 1720, 2036, 341, 197, 8122, 380, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommandsAtLeastOneArgument(t *testing.T) { commands := []commandWithFunction{ {"ENV", func(args []string) error { return env(nil, args, nil, "") }}, {"LABEL", func(args []string) error { return label(nil, args, nil, "") }}, {"ONBUILD", func(args []string) error { return onbuild(nil, args, nil, "") }}, {"HEALTHCHECK", func(args []string) error { return healthcheck(nil, args, nil, "") }}, {"EXPOSE", func(args []string) error { return expose(nil, args, nil, "") }}, {"VOLUME", func(args []string) error { return volume(nil, args, nil, "") }}} for _, command := range commands { err := command.function([]string{}) if err == nil { t.Fatalf("Error should be present for %s command", command.name) } expectedError := errAtLeastOneArgument(command.name) if err.Error() != expectedError.Error() { t.Fatalf("Wrong error message for %s. Got: %s. Should be: %s", command.name, err.Error(), expectedError) } } }
explode_data.jsonl/28269
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 338 }
[ 2830, 3393, 30479, 1655, 81816, 3966, 9171, 1155, 353, 8840, 836, 8, 341, 197, 24270, 1669, 3056, 5631, 2354, 5152, 515, 197, 197, 4913, 30360, 497, 2915, 7356, 3056, 917, 8, 1465, 314, 470, 6105, 27907, 11, 2827, 11, 2092, 11, 11700,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestZenkakuASCII2HankakuASCIISymbol(t *testing.T) { opt := NewOption() tp := newTextProcessor(opt) actual := tp.zenkaku2Hankaku(":;<=>?@[\]^_`{|}~!"#$%&'()*,-./a") expected := ":;<=>?@[\\]^_`{|}~!\"#$%&'()*,-./a" if actual != expected { t.Errorf("expected %v, but got %v", expected, actual) } }
explode_data.jsonl/25038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 218 }
[ 2830, 3393, 57, 78571, 23557, 56450, 17, 39, 1180, 23557, 1911, 11237, 1637, 4001, 1155, 353, 8840, 836, 8, 341, 64838, 1669, 1532, 5341, 741, 73423, 1669, 94653, 22946, 24539, 692, 88814, 1669, 18101, 3938, 78571, 23557, 17, 39, 1180, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetYAxisCount(t *testing.T) { tests := []struct { in string out int }{ {"TBB", 2}, {"TBTB", 1}, {"TTTB", 0}, {"TTBB", 0}, {"TTBBT", 0}, {"TBBBBT", 4}, {"TBBTBBTBB", 2}, } for _, test := range tests { c := getYAxisCount(test.in) if test.out != c { t.Errorf("Want %d got %d", test.out, c) } } }
explode_data.jsonl/49304
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 88300, 8143, 2507, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 17430, 220, 914, 198, 197, 13967, 526, 198, 197, 59403, 197, 197, 4913, 51, 10098, 497, 220, 17, 1583, 197, 197, 4913, 51, 17602, 33, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestForPhraseUDT3(t *testing.T) { gopClTest(t, ` type foo struct { } func (p *foo) Gop_Enum(c func(val string)) { } println([v for v <- new(foo)]) `, `package main import fmt "fmt" type foo struct { } func (p *foo) Gop_Enum(c func(val string)) { } func main() { fmt.Println(func() (_gop_ret []string) { new(foo).Gop_Enum(func(v string) { _gop_ret = append(_gop_ret, v) }) return }()) } `) }
explode_data.jsonl/73643
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 2461, 46806, 4656, 51, 18, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 1313, 15229, 2036, 341, 630, 2830, 320, 79, 353, 7975, 8, 479, 453, 62, 10766, 1337, 2915, 9098, 914, 593, 341, 630, 33655,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCloudTasksGetTaskError(t *testing.T) { errCode := codes.PermissionDenied mockCloudTasks.err = gstatus.Error(errCode, "test error") var formattedName string = fmt.Sprintf("projects/%s/locations/%s/queues/%s/tasks/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]", "[TASK]") var request = &taskspb.GetTaskRequest{ Name: formattedName, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } resp, err := c.GetTask(context.Background(), request) if st, ok := gstatus.FromError(err); !ok { t.Errorf("got error %v, expected grpc error", err) } else if c := st.Code(); c != errCode { t.Errorf("got error code %q, want %q", c, errCode) } _ = resp }
explode_data.jsonl/30864
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 16055, 25449, 1949, 6262, 1454, 1155, 353, 8840, 836, 8, 341, 9859, 2078, 1669, 13912, 73409, 54481, 198, 77333, 16055, 25449, 18441, 284, 342, 2829, 6141, 3964, 2078, 11, 330, 1944, 1465, 5130, 2405, 23126, 675, 914, 284, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestNewResponseFromRequest(t *testing.T) { prov := getProvider(t) store := mockstorage.NewMockStoreProvider() k := newKMS(t, store) t.Run("successful new response from request", func(t *testing.T) { ctx := getContext(t, &prov, kms.ED25519Type, kms.X25519ECDHKWType, transport.MediaTypeRFC0019EncryptedEnvelope) request, err := createRequest(t, ctx, false, ctx.mediaTypeProfiles[0]) require.NoError(t, err) _, connRec, err := ctx.handleInboundRequest(request, &options{}, &connection.Record{}) require.NoError(t, err) require.NotNil(t, connRec.MyDID) require.NotNil(t, connRec.TheirDID) }) t.Run("unsuccessful new response from request due to resolve DID error", func(t *testing.T) { ctx := getContext(t, &prov, kms.ED25519Type, kms.X25519ECDHKWType, transport.MediaTypeRFC0019EncryptedEnvelope) request, err := createRequest(t, ctx, false, transport.MediaTypeRFC0019EncryptedEnvelope) require.NoError(t, err) request.DID = "" _, connRec, err := ctx.handleInboundRequest(request, &options{}, &connection.Record{}) require.Error(t, err) require.Contains(t, err.Error(), "resolve did doc from exchange request") require.Nil(t, connRec) }) t.Run("unsuccessful new response from request due to create did error", func(t *testing.T) { didDoc := mockdiddoc.GetMockDIDDoc(t) ctx := &context{ vdRegistry: &mockvdr.MockVDRegistry{ CreateErr: fmt.Errorf("create DID error"), ResolveValue: mockdiddoc.GetMockDIDDoc(t), }, routeSvc: &mockroute.MockMediatorSvc{}, } request := &Request{ DID: didDoc.ID, DocAttach: signedDocAttach(t, didDoc), } _, connRec, err := ctx.handleInboundRequest(request, &options{}, &connection.Record{}) require.Error(t, err) require.Contains(t, err.Error(), "create DID error") require.Nil(t, connRec) }) t.Run("unsuccessful new response from request due to get did doc error", func(t *testing.T) { ctx := getContext(t, &prov, kms.ED25519Type, kms.X25519ECDHKWType, transport.MediaTypeRFC0019EncryptedEnvelope) ctx.connectionStore = &mockConnectionStore{saveDIDFromDocErr: fmt.Errorf("save did error")} request, err := createRequest(t, ctx, false, transport.MediaTypeRFC0019EncryptedEnvelope) require.NoError(t, err) _, connRec, err := ctx.handleInboundRequest(request, &options{}, &connection.Record{}) require.Error(t, err) require.Contains(t, err.Error(), "get response did doc and connection") require.Nil(t, connRec) }) t.Run("unsuccessful new response from request due to sign error", func(t *testing.T) { connRec, err := connection.NewRecorder(&prov) require.NoError(t, err) require.NotNil(t, connRec) didConnStore, err := didstore.NewConnectionStore(&prov) require.NoError(t, err) require.NotNil(t, didConnStore) ctx := &context{ vdRegistry: &mockvdr.MockVDRegistry{CreateValue: mockdiddoc.GetMockDIDDoc(t)}, crypto: &mockcrypto.Crypto{SignErr: errors.New("sign error")}, connectionRecorder: connRec, connectionStore: didConnStore, routeSvc: &mockroute.MockMediatorSvc{}, kms: prov.CustomKMS, keyType: kms.ED25519Type, keyAgreementType: kms.X25519ECDHKWType, doACAPyInterop: true, } request, err := createRequest(t, ctx, true, transport.MediaTypeRFC0019EncryptedEnvelope) require.NoError(t, err) _, connRecord, err := ctx.handleInboundRequest(request, &options{}, &connection.Record{}) require.Error(t, err) require.Contains(t, err.Error(), "sign error") require.Nil(t, connRecord) }) t.Run("unsuccessful new response from request due to resolve public did from request error", func(t *testing.T) { ctx := &context{vdRegistry: &mockvdr.MockVDRegistry{ResolveErr: errors.New("resolver error")}} request := &Request{DID: "did:sidetree:abc"} _, _, err := ctx.handleInboundRequest(request, &options{}, &connection.Record{}) require.Error(t, err) require.Contains(t, err.Error(), "resolver error") }) t.Run("unsuccessful new response from request due to invalid did for creating destination", func(t *testing.T) { mockDoc := newPeerDID(t, k) mockDoc.Service = nil ctx := getContext(t, &prov, kms.ED25519Type, kms.X25519ECDHKWType, transport.MediaTypeRFC0019EncryptedEnvelope) request, err := createRequest(t, ctx, false, transport.MediaTypeRFC0019EncryptedEnvelope) require.NoError(t, err) request.DID = mockDoc.ID request.DocAttach = unsignedDocAttach(t, mockDoc) _, _, err = ctx.handleInboundRequest(request, &options{}, &connection.Record{}) require.Error(t, err) require.Contains(t, err.Error(), "missing DID doc service") }) }
explode_data.jsonl/2101
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1801 }
[ 2830, 3393, 3564, 2582, 3830, 1900, 1155, 353, 8840, 836, 8, 341, 197, 42947, 1669, 633, 5179, 1155, 340, 57279, 1669, 7860, 16172, 7121, 11571, 6093, 5179, 741, 16463, 1669, 501, 42, 4826, 1155, 11, 3553, 692, 3244, 16708, 445, 30950, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccounts_GetBalances(t *testing.T) { mutableTree, _ := tree.NewMutableTree(0, db.NewMemDB(), 1024) b := bus.NewBus() b.SetChecker(checker.NewChecker(b)) busCoins, err := coins.NewCoins(b, mutableTree) if err != nil { t.Fatal(err) } b.SetCoins(coins.NewBus(busCoins)) accounts, err := NewAccounts(b, mutableTree) if err != nil { t.Fatal(err) } accounts.SetBalance([20]byte{4}, 0, big.NewInt(1000)) coinsState, err := coins.NewCoins(b, mutableTree) if err != nil { t.Fatal(err) } coinsState.Create(1, types.StrToCoinSymbol("AAA"), "AAACOIN", helpers.BipToPip(big.NewInt(10)), 10, helpers.BipToPip(big.NewInt(10000)), big.NewInt(0).Exp(big.NewInt(10), big.NewInt(10+18), nil), nil) err = coinsState.Commit() if err != nil { t.Fatal(err) } symbol := coinsState.GetCoinBySymbol(types.StrToCoinSymbol("AAA"), 0) if symbol == nil { t.Fatal("coin not found") } accounts.SetBalance([20]byte{4}, symbol.ID(), big.NewInt(1001)) balances := accounts.GetBalances([20]byte{4}) if len(balances) != 2 { t.Fatal("count of coin on balance not equal 2") } if balances[0].Value.String() != "1000" { t.Fatal("balance of coin ID '0' not equal 1000") } if balances[1].Value.String() != "1001" { t.Log(balances[1].Value.String()) t.Fatal("balance of coin 'AAA' not equal 1001") } }
explode_data.jsonl/23599
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 577 }
[ 2830, 3393, 41369, 13614, 37889, 3020, 1155, 353, 8840, 836, 8, 341, 2109, 5922, 6533, 11, 716, 1669, 4916, 7121, 11217, 6533, 7, 15, 11, 2927, 7121, 18816, 3506, 1507, 220, 16, 15, 17, 19, 340, 2233, 1669, 5828, 7121, 15073, 741, 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...
9
func TestSRVGetCluster(t *testing.T) { defer func() { lookupSRV = net.LookupSRV resolveTCPAddr = net.ResolveTCPAddr }() name := "dnsClusterTest" dns := map[string]string{ "1.example.com.:2480": "10.0.0.1:2480", "2.example.com.:2480": "10.0.0.2:2480", "3.example.com.:2480": "10.0.0.3:2480", "4.example.com.:2380": "10.0.0.3:2380", } srvAll := []*net.SRV{ {Target: "1.example.com.", Port: 2480}, {Target: "2.example.com.", Port: 2480}, {Target: "3.example.com.", Port: 2480}, } tests := []struct { withSSL []*net.SRV withoutSSL []*net.SRV urls []string expected string }{ { []*net.SRV{}, []*net.SRV{}, nil, "", }, { srvAll, []*net.SRV{}, nil, "0=https://1.example.com:2480,1=https://2.example.com:2480,2=https://3.example.com:2480", }, { srvAll, []*net.SRV{{Target: "4.example.com.", Port: 2380}}, nil, "0=https://1.example.com:2480,1=https://2.example.com:2480,2=https://3.example.com:2480,3=http://4.example.com:2380", }, { srvAll, []*net.SRV{{Target: "4.example.com.", Port: 2380}}, []string{"https://10.0.0.1:2480"}, "dnsClusterTest=https://1.example.com:2480,0=https://2.example.com:2480,1=https://3.example.com:2480,2=http://4.example.com:2380", }, // matching local member with resolved addr and return unresolved hostnames { srvAll, nil, []string{"https://10.0.0.1:2480"}, "dnsClusterTest=https://1.example.com:2480,0=https://2.example.com:2480,1=https://3.example.com:2480", }, // reject if apurls are TLS but SRV is only http { nil, srvAll, []string{"https://10.0.0.1:2480"}, "0=http://2.example.com:2480,1=http://3.example.com:2480", }, } resolveTCPAddr = func(network, addr string) (*net.TCPAddr, error) { if strings.Contains(addr, "10.0.0.") { // accept IP addresses when resolving apurls return net.ResolveTCPAddr(network, addr) } if dns[addr] == "" { return nil, errors.New("missing dns record") } return net.ResolveTCPAddr(network, dns[addr]) } for i, tt := range tests { lookupSRV = func(service string, proto string, domain string) (string, []*net.SRV, error) { if service == "etcd-server-ssl" { return "", tt.withSSL, nil } if service == "etcd-server" { return "", tt.withoutSSL, nil } return "", nil, errors.New("Unknown service in mock") } urls := testutil.MustNewURLs(t, tt.urls) str, err := GetCluster("etcd-server", name, "example.com", urls) if err != nil { t.Fatalf("%d: err: %#v", i, err) } if strings.Join(str, ",") != tt.expected { t.Errorf("#%d: cluster = %s, want %s", i, str, tt.expected) } } }
explode_data.jsonl/46793
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1266 }
[ 2830, 3393, 14557, 53, 1949, 28678, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 197, 21020, 14557, 53, 284, 4179, 79261, 14557, 53, 198, 197, 87778, 49896, 13986, 284, 4179, 57875, 49896, 13986, 198, 197, 66816, 11609, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetProvider(t *testing.T) { tests := []struct { name string input *v1beta1.Ingress expected string }{ { "should return default(ATS) provider for empty Ingress", &v1beta1.Ingress{}, ATS, }, { "should return ATS provider when annotation set to different provider", &v1beta1.Ingress{ ObjectMeta: v1.ObjectMeta{ Name: "test-ingress", Namespace: "test-namespace", Annotations: map[string]string{ string(IngressClass): "other", }, }, }, ATS, }, { "should return Istio provider when istio annotation is defined", &v1beta1.Ingress{ ObjectMeta: v1.ObjectMeta{ Name: "test-ingress", Namespace: "test-namespace", Annotations: map[string]string{ string(IngressClass): Istio, }, }, }, Istio, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { p := helper.GetProvider(test.input) if assert.NotNil(t, p, "provider is nil: "+test.name) { assert.Equal(t, p.Name(), test.expected, test.name) } }) } }
explode_data.jsonl/15640
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 496 }
[ 2830, 3393, 1949, 5179, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 22427, 262, 353, 85, 16, 19127, 16, 5337, 2483, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 515, 298, 197, 1, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDefaultPath(t *testing.T) { for path, want := range defaultPathTests { if got := defaultPath(path); got != want { t.Errorf("%q: got %q, want %q", path, got, want) } } }
explode_data.jsonl/14664
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 3675, 1820, 1155, 353, 8840, 836, 8, 341, 2023, 1815, 11, 1366, 1669, 2088, 1638, 1820, 18200, 341, 197, 743, 2684, 1669, 1638, 1820, 5581, 1215, 2684, 961, 1366, 341, 298, 3244, 13080, 4430, 80, 25, 2684, 1018, 80, 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 ]
3
func TestCompliantName(t *testing.T) { testcases := []struct { in, out string }{{ in: "aa", out: "aa", }, { in: "1a", out: "_a", }, { in: "a1", out: "a1", }, { in: "a.b", out: "a_b", }, { in: ".ab", out: "_ab", }} for _, tc := range testcases { out := NewColIdent(tc.in).CompliantName() if out != tc.out { t.Errorf("ColIdent(%s).CompliantNamt: %s, want %s", tc.in, out, tc.out) } out = NewTableIdent(tc.in).CompliantName() if out != tc.out { t.Errorf("TableIdent(%s).CompliantNamt: %s, want %s", tc.in, out, tc.out) } } }
explode_data.jsonl/3387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 1092, 59852, 675, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 17430, 11, 700, 914, 198, 197, 15170, 515, 197, 17430, 25, 220, 330, 5305, 756, 197, 13967, 25, 330, 5305, 756, 197, 2137, 341, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestTlfHistoryComplexRename(t *testing.T) { aliceName := "alice" aliceUID := keybase1.MakeTestUID(1) tlfID, err := tlf.MakeRandomID(tlf.Private) require.NoError(t, err) var aliceMessages []string nn := nextNotification{1, 0, tlfID, nil} // Alice creates "a", and adds a file to it. _ = nn.makeWithType( "/k/p/a/a", NotificationCreate, aliceUID, nil, time.Time{}, EntryTypeDir) aliceMessages = append(aliceMessages, nn.encode(t)) fooCreate := nn.make( "/k/p/a/a/foo", NotificationCreate, aliceUID, nil, time.Time{}) aliceMessages = append(aliceMessages, nn.encode(t)) // Alice renames "a" to "b". _ = nn.makeWithType( "/k/p/a/b", NotificationRename, aliceUID, &NotificationParams{ OldFilename: "/k/p/a/a", }, time.Time{}, EntryTypeDir) aliceMessages = append(aliceMessages, nn.encode(t)) // Alice makes new dir "c". _ = nn.makeWithType( "/k/p/a/c", NotificationCreate, aliceUID, nil, time.Time{}, EntryTypeDir) aliceMessages = append(aliceMessages, nn.encode(t)) // Alice renames "c" to "a". _ = nn.makeWithType( "/k/p/a/a", NotificationRename, aliceUID, &NotificationParams{ OldFilename: "/k/p/a/c", }, time.Time{}, EntryTypeDir) aliceMessages = append(aliceMessages, nn.encode(t)) // Alice renames "b" to "a/d". bRename := nn.makeWithType( "/k/p/a/a/d", NotificationRename, aliceUID, &NotificationParams{ OldFilename: "/k/p/a/b", }, time.Time{}, EntryTypeDir) aliceMessages = append(aliceMessages, nn.encode(t)) fooCreate.Filename = "/k/p/a/a/d/foo" expected := writersByRevision{ {aliceName, []NotificationMessage{fooCreate}, nil, }, } th := NewTlfHistory() rev, err := th.AddNotifications(aliceName, aliceMessages) require.NoError(t, err) require.Equal(t, bRename.Revision, rev) checkTlfHistory(t, th, expected, aliceName) }
explode_data.jsonl/34574
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 773 }
[ 2830, 3393, 51, 11008, 13424, 31137, 88757, 1155, 353, 8840, 836, 8, 341, 197, 63195, 675, 1669, 330, 63195, 698, 197, 63195, 6463, 1669, 1376, 3152, 16, 50133, 2271, 6463, 7, 16, 340, 3244, 11008, 915, 11, 1848, 1669, 259, 11008, 501...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasicUnmarshal(t *testing.T) { result := basicMarshalTestStruct{} err := Unmarshal(basicTestToml, &result) expected := basicTestData if err != nil { t.Fatal(err) } if !reflect.DeepEqual(result, expected) { t.Errorf("Bad unmarshal: expected %v, got %v", expected, result) } }
explode_data.jsonl/46305
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 15944, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 9559, 1669, 6770, 55438, 2271, 9422, 16094, 9859, 1669, 1230, 27121, 1883, 5971, 2271, 24732, 75, 11, 609, 1382, 340, 42400, 1669, 6770, 83920, 198, 743, 1848, 961, 2092, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEmbeddingGzipFilesIntoApp(t *testing.T) { app := newApp() e := httptest.New(t, app) if runtime.GOOS != "windows" { // remove the embedded static favicon for !windows, // it should be built for unix-specific in order to be work urls = urls[0 : len(urls)-1] } for i, u := range urls { url := u.String() rawContents := u.loadFromBase("./assets") response := e.GET(url).Expect() response.ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()) if expected, got := response.Raw().StatusCode, httptest.StatusOK; expected != got { t.Fatalf("[%d] of '%s': expected %d status code but got %d", i, url, expected, got) } rawBody := response.Body().Raw() func() { reader, err := gzip.NewReader(strings.NewReader(rawBody)) defer reader.Close() if err != nil { t.Fatalf("[%d] of '%s': %v", i, url, err) } buf := new(bytes.Buffer) reader.WriteTo(buf) if expected, got := rawContents, buf.String(); expected != got { // t.Fatalf("[%d] of '%s': expected body:\n%s but got:\n%s", i, url, expected, got) // let's reduce the output here... // they are big files, no need to check for length here. t.Fatalf("[%d] %s, expected body to look like: '%s...%s' but got '%s...%s'", i, url, expected[:40], expected[len(rawContents)-40:], got[:40], got[len(got)-40:]) } }() } }
explode_data.jsonl/37859
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 541 }
[ 2830, 3393, 25486, 6968, 38, 9964, 10809, 26591, 2164, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 501, 2164, 741, 7727, 1669, 54320, 70334, 7121, 1155, 11, 906, 692, 743, 15592, 97574, 3126, 961, 330, 27077, 1, 341, 197, 197, 322, 405...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultCfg(t *testing.T) { cmd := new(cobra.Command) o := newOptions() o.addFlags(cmd) require.Nil(t, cmd.ParseFlags([]string{})) err := o.complete(cmd) require.Nil(t, err) defaultCfg := config.GetDefaultServerConfig() require.Nil(t, defaultCfg.ValidateAndAdjust()) require.Equal(t, defaultCfg, o.serverConfig) require.Equal(t, "http://127.0.0.1:2379", o.serverPdAddr) }
explode_data.jsonl/41632
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 3675, 42467, 1155, 353, 8840, 836, 8, 341, 25920, 1669, 501, 1337, 28856, 12714, 340, 22229, 1669, 501, 3798, 741, 22229, 1364, 9195, 14160, 692, 17957, 59678, 1155, 11, 5439, 8937, 9195, 10556, 917, 6257, 1171, 9859, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMixedTxnBuffer(t *testing.T) { testtype.SkipUnlessTestType(t, testtype.UnitTestType) buffer := NewBuffer() txnByID, err := mapTestTxnByID() if err != nil { t.Fatal(err) } streams := make([][]db.Oplog, len(testCases)) for i, c := range testCases { streams[i] = c.ops } ops := testutil.MergeOplogStreams(streams) testBufferOps(t, buffer, ops, txnByID) }
explode_data.jsonl/34651
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 86433, 31584, 77, 4095, 1155, 353, 8840, 836, 8, 341, 18185, 1313, 57776, 35587, 2271, 929, 1155, 11, 1273, 1313, 25159, 2271, 929, 692, 31122, 1669, 1532, 4095, 741, 3244, 42967, 60572, 11, 1848, 1669, 2415, 2271, 31584, 77...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRenderDependency(t *testing.T) { deptpl := `{{define "myblock"}}World{{end}}` toptpl := `Hello {{template "myblock"}}` ch := &chart.Chart{ Metadata: &chart.Metadata{Name: "outerchart"}, Templates: []*chart.File{ {Name: "templates/outer", Data: []byte(toptpl)}, }, } ch.AddDependency(&chart.Chart{ Metadata: &chart.Metadata{Name: "innerchart"}, Templates: []*chart.File{ {Name: "templates/inner", Data: []byte(deptpl)}, }, }) out, err := Render(ch, map[string]interface{}{}) if err != nil { t.Fatalf("failed to render chart: %s", err) } if len(out) != 2 { t.Errorf("Expected 2, got %d", len(out)) } expect := "Hello World" if out["outerchart/templates/outer"] != expect { t.Errorf("Expected %q, got %q", expect, out["outer"]) } }
explode_data.jsonl/74705
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 325 }
[ 2830, 3393, 6750, 36387, 1155, 353, 8840, 836, 8, 341, 197, 40585, 500, 1669, 1565, 2979, 1289, 330, 2408, 4574, 30975, 10134, 2979, 408, 3417, 3989, 31709, 417, 500, 1669, 1565, 9707, 5867, 4214, 330, 2408, 4574, 30975, 3989, 23049, 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...
4
func TestEd25519SelfSigned(t *testing.T) { der, _ := pem.Decode([]byte(ed25519Certificate)) if der == nil { t.Fatalf("Failed to find PEM block") } cert, err := ParseCertificate(der.Bytes) if err != nil { t.Fatalf("Failed to parse: %s", err) } if cert.PublicKeyAlgorithm != Ed25519 { t.Fatalf("Parsed key algorithm was not Ed25519") } parsedKey, ok := cert.PublicKey.(ed25519.PublicKey) if !ok { t.Fatalf("Parsed key was not an Ed25519 key: %s", err) } if len(parsedKey) != ed25519.PublicKeySize { t.Fatalf("Invalid Ed25519 key") } if err = cert.CheckSignatureFrom(cert); err != nil { t.Fatalf("Signature check failed: %s", err) } }
explode_data.jsonl/81501
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 2715, 17, 20, 20, 16, 24, 12092, 49312, 1155, 353, 8840, 836, 8, 341, 197, 1107, 11, 716, 1669, 54184, 56372, 10556, 3782, 49810, 17, 20, 20, 16, 24, 33202, 1171, 743, 2694, 621, 2092, 341, 197, 3244, 30762, 445, 9408, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnitScheduleDeleteTransactionValidate(t *testing.T) { client := ClientForTestnet() client.SetAutoValidateChecksums(true) scheduleID, err := ScheduleIDFromString("0.0.123-rmkyk") assert.NoError(t, err) scheduleDelete := NewScheduleDeleteTransaction(). SetScheduleID(scheduleID) err = scheduleDelete._ValidateNetworkOnIDs(client) assert.NoError(t, err) }
explode_data.jsonl/19818
{ "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, 4562, 32210, 6435, 8070, 17926, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 8423, 2461, 2271, 4711, 741, 25291, 4202, 13253, 17926, 73190, 82, 3715, 340, 1903, 8796, 915, 11, 1848, 1669, 23512, 915, 44491, 445, 15, 13, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandlerReturnsCorrectValues(t *testing.T) { req := events.APIGatewayProxyRequest{ Path: "/test", HTTPMethod: http.MethodPost, } expectedResp := events.APIGatewayProxyResponse{ Body: "Test", } route := &Route{ func(_ events.APIGatewayProxyRequest) bool { return true }, func(_ events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { return expectedResp, nil }, } r := NewRouter() r.AddRoute("test", route) resp, err := r.Handle(req) assert.Nil(t, err) assert.Equal(t, expectedResp, resp) }
explode_data.jsonl/4495
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 3050, 16446, 33092, 6227, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 4357, 24922, 40709, 16219, 1900, 515, 197, 69640, 25, 981, 3521, 1944, 756, 197, 197, 9230, 3523, 25, 1758, 20798, 4133, 345, 197, 630, 42400, 36555, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestQuerySliceStringNoParam(t *testing.T) { assert.NoError(t, prepareEngine()) type GetVar6 struct { Id int64 `xorm:"autoincr pk"` Msg bool `xorm:"bit"` } assert.NoError(t, testEngine.Sync2(new(GetVar6))) var data = GetVar6{ Msg: false, } _, err := testEngine.Insert(data) assert.NoError(t, err) records, err := testEngine.Table("get_var6").Limit(1).QuerySliceString() assert.NoError(t, err) assert.EqualValues(t, 1, len(records)) assert.EqualValues(t, "1", records[0][0]) if testEngine.Dialect().DBType() == core.POSTGRES || testEngine.Dialect().DBType() == core.MSSQL { assert.EqualValues(t, "false", records[0][1]) } else { assert.EqualValues(t, "0", records[0][1]) } records, err = testEngine.Table("get_var6").Where(builder.Eq{"id": 1}).QuerySliceString() assert.NoError(t, err) assert.EqualValues(t, 1, len(records)) assert.EqualValues(t, "1", records[0][0]) if testEngine.Dialect().DBType() == core.POSTGRES || testEngine.Dialect().DBType() == core.MSSQL { assert.EqualValues(t, "false", records[0][1]) } else { assert.EqualValues(t, "0", records[0][1]) } }
explode_data.jsonl/70219
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 456 }
[ 2830, 3393, 2859, 33236, 703, 2753, 2001, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 10549, 4571, 12367, 13158, 2126, 3962, 21, 2036, 341, 197, 67211, 220, 526, 21, 19, 1565, 87, 493, 2974, 3902, 98428, 22458, 8805, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestWriteToFile(t *testing.T) { err := WriteToFile("/file-does-not-exist", []byte("test-data")) assert.NotNil(t, err) tmpFile, err := ioutil.TempFile("", "test_append_file") assert.Nil(t, err) filename := tmpFile.Name() defer os.Remove(filename) tmpFile.Close() testData := []byte("test-data") err = WriteToFile(filename, testData) assert.Nil(t, err) data, err := ioutil.ReadFile(filename) assert.Nil(t, err) assert.True(t, reflect.DeepEqual(testData, data)) }
explode_data.jsonl/8209
{ "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, 7985, 41550, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 9645, 41550, 4283, 1192, 1737, 7072, 29169, 10187, 380, 497, 3056, 3782, 445, 1944, 13945, 5455, 6948, 93882, 1155, 11, 1848, 692, 20082, 1703, 11, 1848, 1669, 43144, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLogFileTruncated(t *testing.T) { f := createTestLogFile() defer f.Close() defer os.Remove(f.Name()) reader, err := newFileReader(logp.L(), context.TODO(), f, readerConfig{}, closerConfig{}) if err != nil { t.Fatalf("error while creating logReader: %+v", err) } buf := make([]byte, 1024) _, err = reader.Read(buf) assert.Nil(t, err) err = f.Truncate(0) if err != nil { t.Fatalf("error while truncating file: %+v", err) } err = readUntilError(reader) assert.Equal(t, ErrFileTruncate, err) }
explode_data.jsonl/44848
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 98857, 1282, 38007, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 1855, 2271, 98857, 741, 16867, 282, 10421, 741, 16867, 2643, 13270, 955, 2967, 12367, 61477, 11, 1848, 1669, 501, 1703, 5062, 12531, 79, 1214, 1507, 2266, 90988, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlushManagerFlushTimeStart(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() inputs := []struct { ts time.Time expected time.Time }{ {time.Unix(86400*2, 0), time.Unix(0, 0)}, {time.Unix(86400*2+7200, 0), time.Unix(7200, 0)}, {time.Unix(86400*2+10800, 0), time.Unix(7200, 0)}, } fm, _, _, _ := newMultipleFlushManagerNeedsFlush(t, ctrl) for _, input := range inputs { start, _ := fm.flushRange(defaultTestRetentionOpts, input.ts) require.Equal(t, input.expected, start) } }
explode_data.jsonl/82129
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 46874, 2043, 46874, 1462, 3479, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 22427, 82, 1669, 3056, 1235, 341, 197, 57441, 981, 882, 16299, 198, 197, 42400...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRejectUnhealthyAdd(t *testing.T) { defer testutil.AfterTest(t) c := NewCluster(t, 3) for _, m := range c.Members { m.ServerConfig.StrictReconfigCheck = true } c.Launch(t) defer c.Terminate(t) // make cluster unhealthy and wait for downed peer c.Members[0].Stop(t) c.WaitLeader(t) // all attempts to add member should fail for i := 1; i < len(c.Members); i++ { err := c.addMemberByURL(t, c.URL(i), "unix://foo:12345") if err == nil { t.Fatalf("should have failed adding peer") } // TODO: client should return descriptive error codes for internal errors if !strings.Contains(err.Error(), "has no leader") { t.Errorf("unexpected error (%v)", err) } } // make cluster healthy c.Members[0].Restart(t) c.WaitLeader(t) time.Sleep(2 * etcdserver.HealthInterval) // add member should succeed now that it's healthy var err error for i := 1; i < len(c.Members); i++ { if err = c.addMemberByURL(t, c.URL(i), "unix://foo:12345"); err == nil { break } } if err != nil { t.Fatalf("should have added peer to healthy cluster (%v)", err) } }
explode_data.jsonl/16304
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 78413, 1806, 37028, 2212, 1155, 353, 8840, 836, 8, 341, 16867, 1273, 1314, 36892, 2271, 1155, 340, 1444, 1669, 1532, 28678, 1155, 11, 220, 18, 340, 2023, 8358, 296, 1669, 2088, 272, 91758, 341, 197, 2109, 22997, 2648, 77428,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJSONNil(t *testing.T) { const SCRIPT = ` JSON.stringify(i); ` vm := New() var i interface{} vm.Set("i", i) ret, err := vm.RunString(SCRIPT) if err != nil { t.Fatal(err) } if ret.String() != "null" { t.Fatalf("Expected 'null', got: %v", ret) } }
explode_data.jsonl/10488
{ "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, 5370, 19064, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 197, 5370, 10052, 1956, 317, 197, 19324, 54879, 1669, 1532, 741, 2405, 600, 3749, 16094, 54879, 4202, 445, 72, 497, 600, 340, 11262, 11, 1848, 1669, 10995, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApplySkipTrue(t *testing.T) { t.Parallel() rootPath := copyEnvironment(t, TEST_FIXTURE_SKIP) rootPath = util.JoinPath(rootPath, TEST_FIXTURE_SKIP, "skip-true") showStdout := bytes.Buffer{} showStderr := bytes.Buffer{} err := runTerragruntCommand(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-log-level info --terragrunt-non-interactive --terragrunt-working-dir %s --var person=Hobbs", rootPath), &showStdout, &showStderr) logBufferContentsLineByLine(t, showStdout, "show stdout") logBufferContentsLineByLine(t, showStderr, "show stderr") stdout := showStdout.String() stderr := showStderr.String() assert.Nil(t, err) assert.Regexp(t, regexp.MustCompile("Skipping terragrunt module .*fixture-skip/skip-true/terragrunt.hcl due to skip = true."), stderr) assert.NotContains(t, stdout, "hello, Hobbs") }
explode_data.jsonl/10119
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 28497, 35134, 2514, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 33698, 1820, 1669, 2975, 12723, 1155, 11, 13602, 42635, 41486, 67756, 340, 33698, 1820, 284, 4094, 22363, 1820, 9206, 1820, 11, 13602, 42635, 41486, 67...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseOperator(t *testing.T) { type testoperator struct { Operator string ExpectedOperator APIRequestFilteringOperator } operators := []testoperator{ testoperator{ Operator: "EQ", ExpectedOperator: EQOperator, }, testoperator{ Operator: "LK", ExpectedOperator: LKOperator, }, testoperator{ Operator: "GT", ExpectedOperator: GTOperator, }, testoperator{ Operator: "LT", ExpectedOperator: LTOperator, }, testoperator{ Operator: "IN", ExpectedOperator: INOperator, }, testoperator{ Operator: "NEQ", ExpectedOperator: NEQOperator, }, testoperator{ Operator: "NIN", ExpectedOperator: NINOperator, }, testoperator{ Operator: "NLK", ExpectedOperator: NLKOperator, }, } for _, operator := range operators { t.Run(fmt.Sprintf("%s_Exact_Parses", operator.Operator), func(t *testing.T) { parsedOperator, err := ParseOperator(operator.Operator) assert.Nil(t, err) assert.Equal(t, operator.ExpectedOperator, parsedOperator) }) } t.Run("MixedCase_Parses", func(t *testing.T) { operator, err := ParseOperator("gT") assert.Nil(t, err) assert.Equal(t, GTOperator, operator) }) t.Run("Invalid_Error", func(t *testing.T) { _, err := ParseOperator("invalidoperator") assert.NotNil(t, err) }) }
explode_data.jsonl/44627
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 634 }
[ 2830, 3393, 14463, 18461, 1155, 353, 8840, 836, 8, 341, 13158, 1273, 7884, 2036, 341, 197, 197, 18461, 260, 914, 198, 197, 197, 18896, 18461, 5333, 1900, 5632, 287, 18461, 198, 197, 532, 197, 32838, 1669, 3056, 1944, 7884, 515, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMsgWithdraw_ValidateBasic(t *testing.T) { tests := []struct { name string msg types.MsgWithdraw err error }{ { name: "invalid address", msg: types.MsgWithdraw{ Creator: "invalid_address", WithdrawAmount: sdk.NewInt(10), }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: types.MsgWithdraw{ Creator: sample.AccAddress(), WithdrawAmount: sdk.NewInt(10), }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() if tt.err != nil { require.ErrorIs(t, err, tt.err) return } require.NoError(t, err) }) } }
explode_data.jsonl/2049
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 319 }
[ 2830, 3393, 6611, 92261, 62, 17926, 15944, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 21169, 220, 4494, 30365, 92261, 198, 197, 9859, 220, 1465, 198, 197, 59403, 197, 197, 515, 298, 11609, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestVerifyBin(t *testing.T) { cases := []struct { proc string psOut string exp bool }{ {proc: "single", psOut: "single", exp: true}, {proc: "single", psOut: "", exp: false}, {proc: "two words", psOut: "two words", exp: true}, {proc: "two words", psOut: "", exp: false}, {proc: "cmd", psOut: "cmd param1 param2", exp: true}, {proc: "cmd param", psOut: "cmd param1 param2", exp: true}, {proc: "cmd param", psOut: "cmd", exp: false}, {proc: "cmd", psOut: "cmd x \ncmd y", exp: true}, {proc: "cmd y", psOut: "cmd x \ncmd y", exp: true}, {proc: "cmd", psOut: "/usr/bin/cmd", exp: true}, {proc: "cmd", psOut: "kube-cmd", exp: false}, {proc: "cmd", psOut: "/usr/bin/kube-cmd", exp: false}, } psFunc = fakeps for id, c := range cases { t.Run(strconv.Itoa(id), func(t *testing.T) { g = c.psOut v := verifyBin(c.proc) if v != c.exp { t.Fatalf("Expected %v got %v", c.exp, v) } }) } }
explode_data.jsonl/60194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 425 }
[ 2830, 3393, 32627, 28794, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 197, 15782, 220, 914, 198, 197, 35009, 2662, 914, 198, 197, 48558, 256, 1807, 198, 197, 59403, 197, 197, 90, 15782, 25, 330, 15338, 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...
2
func TestCollection_FindOne(t *testing.T) { mgoClient := Ins() findResult := mgoClient.C("test").FindOne(bson.M{"name": "henry"}) if findResult.Err() != nil { t.Errorf("FindOne error: %s", findResult.Err()) t.FailNow() } result := bson.D{} if err := findResult.Decode(&result); err != nil { t.Errorf("FindOne error: %s", err) t.FailNow() } t.Log("FindOne ok", result) }
explode_data.jsonl/30094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 6482, 95245, 3966, 1155, 353, 8840, 836, 8, 341, 2109, 3346, 2959, 1669, 9726, 741, 80603, 2077, 1669, 296, 3346, 2959, 727, 445, 1944, 1827, 9885, 3966, 1883, 930, 1321, 4913, 606, 788, 330, 12032, 884, 23625, 743, 1477, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBindError(t *testing.T) { db := openTestConn(t) defer db.Close() _, err := db.Exec("create temp table test (i integer)") if err != nil { t.Fatal(err) } _, err = db.Query("select * from test where i=$1", "hhh") if err == nil { t.Fatal("expected an error") } // Should not get error here r, err := db.Query("select * from test where i=$1", 1) if err != nil { t.Fatal(err) } defer r.Close() }
explode_data.jsonl/63433
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 9950, 1454, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 1787, 2271, 9701, 1155, 340, 16867, 2927, 10421, 2822, 197, 6878, 1848, 1669, 2927, 30798, 445, 3182, 2730, 1965, 1273, 320, 72, 7546, 19107, 743, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestClientReturnsCloseErrors(t *testing.T) { h := PickyHatmaker(1) s := httptest.NewServer(NewHaberdasherServer(h, nil)) defer s.Close() httpClient := &bodyCloseErrClient{base: http.DefaultClient} testcase := func(client Haberdasher) func(*testing.T) { return func(t *testing.T) { _, err := client.MakeHat(context.Background(), &Size{Inches: 1}) if err == nil { t.Error("expected an error when body fails to close, have nil") } else { if errors.Cause(err) != bodyCloseErr { t.Errorf("got wrong root cause for error, have=%v, want=%v", err, bodyCloseErr) } } } } t.Run("json client", testcase(NewHaberdasherJSONClient(s.URL, httpClient))) t.Run("protobuf client", testcase(NewHaberdasherProtobufClient(s.URL, httpClient))) }
explode_data.jsonl/621
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 2959, 16446, 7925, 13877, 1155, 353, 8840, 836, 8, 341, 9598, 1669, 393, 18964, 72287, 25766, 7, 16, 340, 1903, 1669, 54320, 70334, 7121, 5475, 35063, 39, 370, 14348, 33767, 5475, 3203, 11, 2092, 1171, 16867, 274, 10421, 282...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNilAddPayload(t *testing.T) { t.Parallel() mc := &mockCommitter{Mock: &mock.Mock{}} mc.On("LedgerHeight", mock.Anything).Return(uint64(1), nil) g := &mocks.GossipMock{} g.On("Accept", mock.Anything, false).Return(make(<-chan *proto.GossipMessage), nil) g.On("Accept", mock.Anything, true).Return(nil, make(chan proto.ReceivedMessage)) p := newPeerNodeWithGossip(0, mc, noopPeerIdentityAcceptor, g) defer p.shutdown() err := p.s.AddPayload(nil) assert.Error(t, err) assert.Contains(t, err.Error(), "nil") }
explode_data.jsonl/5634
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 19064, 2212, 29683, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 97662, 1669, 609, 16712, 1092, 16126, 90, 11571, 25, 609, 16712, 24664, 6257, 532, 97662, 8071, 445, 60850, 1389, 3640, 497, 7860, 13311, 1596, 568, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPKIidOfCert(t *testing.T) { deserializersManager := &mocks.DeserializersManager{ LocalDeserializer: &mocks.IdentityDeserializer{Identity: []byte("Alice"), Msg: []byte("msg1"), Mock: mock.Mock{}}, } signer := &mocks.SignerSerializer{} signer.SerializeReturns([]byte("Alice"), nil) cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore()) require.NoError(t, err) msgCryptoService := NewMCS( &mocks.ChannelPolicyManagerGetterWithManager{}, &mocks.Id2IdentitiesFetcherMock{}, signer, deserializersManager, cryptoProvider, ) peerIdentity := []byte("Alice") pkid := msgCryptoService.GetPKIidOfCert(peerIdentity) // Check pkid is not nil require.NotNil(t, pkid, "PKID must be different from nil") // Check that pkid is correctly computed id, err := deserializersManager.Deserialize(peerIdentity) require.NoError(t, err, "Failed getting validated identity from [% x]", []byte(peerIdentity)) idRaw := append([]byte(id.Mspid), id.IdBytes...) require.NoError(t, err, "Failed marshalling identity identifier [% x]: [%s]", peerIdentity, err) h := sha256.New() h.Write(idRaw) digest := h.Sum(nil) require.Equal(t, digest, []byte(pkid), "PKID must be the SHA2-256 of peerIdentity") // The PKI-ID is calculated by concatenating the MspId with IdBytes. // Ensure that additional fields haven't been introduced in the code v := reflect.Indirect(reflect.ValueOf(id)).Type() fieldsThatStartWithXXX := 0 for i := 0; i < v.NumField(); i++ { if strings.Index(v.Field(i).Name, "XXX_") == 0 { fieldsThatStartWithXXX++ } } require.Equal(t, 2+fieldsThatStartWithXXX, v.NumField()) }
explode_data.jsonl/20522
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 598 }
[ 2830, 3393, 22242, 40, 307, 2124, 36934, 1155, 353, 8840, 836, 8, 341, 52912, 2848, 12230, 2043, 1669, 609, 16712, 82, 23548, 2848, 12230, 2043, 515, 197, 82404, 80097, 25, 609, 16712, 82, 24423, 80097, 90, 18558, 25, 3056, 3782, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestImageExtractionTransform(t *testing.T) { var expectedManifests []transform.Manifest expectedImageCRYAML, err := ioutil.ReadFile("testdata/expected-CR-image.yaml") require.NoError(t, err) expectedManifests = append(expectedManifests, transform.Manifest{Name: "100_CPMA-cluster-config-image.yaml", CRD: expectedImageCRYAML}) expectedReport := reportoutput.ReportOutput{} jsonData, err := io.ReadFile("testdata/expected-report-image.json") require.NoError(t, err) err = json.Unmarshal(jsonData, &expectedReport) require.NoError(t, err) testCases := []struct { name string expectedManifests []transform.Manifest expectedReports reportoutput.ReportOutput }{ { name: "transform image extraction", expectedManifests: expectedManifests, expectedReports: expectedReport, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { actualManifestsChan := make(chan []transform.Manifest) actualReportsChan := make(chan reportoutput.ReportOutput) transform.FinalReportOutput = transform.Report{} // Override flush methods transform.ManifestOutputFlush = func(manifests []transform.Manifest) error { actualManifestsChan <- manifests return nil } transform.ReportOutputFlush = func(reports transform.Report) error { actualReportsChan <- reports.Report return nil } testExtraction, err := loadImageExtraction() require.NoError(t, err) go func() { env.Config().Set("Reporting", true) env.Config().Set("Manifests", true) transformOutput, err := testExtraction.Transform() if err != nil { t.Error(err) } for _, output := range transformOutput { output.Flush() } transform.FinalReportOutput.Flush() }() actualManifests := <-actualManifestsChan assert.Equal(t, actualManifests, tc.expectedManifests) actualReports := <-actualReportsChan assert.Equal(t, actualReports.ComponentReports, tc.expectedReports.ComponentReports) }) } }
explode_data.jsonl/5949
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 738 }
[ 2830, 3393, 1906, 840, 26425, 8963, 1155, 353, 8840, 836, 8, 341, 2405, 3601, 38495, 82, 3056, 4701, 72272, 271, 42400, 1906, 35462, 31102, 11, 1848, 1669, 43144, 78976, 445, 92425, 14, 7325, 7658, 49, 13746, 33406, 1138, 17957, 35699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccAWSS3BucketObject_acl(t *testing.T) { var obj1, obj2, obj3 s3.GetObjectOutput resourceName := "aws_s3_bucket_object.object" rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ { Config: testAccAWSS3BucketObjectConfig_acl(rInt, "some_bucket_content", "private"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSS3BucketObjectExists(resourceName, &obj1), testAccCheckAWSS3BucketObjectBody(&obj1, "some_bucket_content"), resource.TestCheckResourceAttr(resourceName, "acl", "private"), testAccCheckAWSS3BucketObjectAcl(resourceName, []string{"FULL_CONTROL"}), ), }, { Config: testAccAWSS3BucketObjectConfig_acl(rInt, "some_bucket_content", "public-read"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSS3BucketObjectExists(resourceName, &obj2), testAccCheckAWSS3BucketObjectVersionIdEquals(&obj2, &obj1), testAccCheckAWSS3BucketObjectBody(&obj2, "some_bucket_content"), resource.TestCheckResourceAttr(resourceName, "acl", "public-read"), testAccCheckAWSS3BucketObjectAcl(resourceName, []string{"FULL_CONTROL", "READ"}), ), }, { Config: testAccAWSS3BucketObjectConfig_acl(rInt, "changed_some_bucket_content", "private"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSS3BucketObjectExists(resourceName, &obj3), testAccCheckAWSS3BucketObjectVersionIdDiffers(&obj3, &obj2), testAccCheckAWSS3BucketObjectBody(&obj3, "changed_some_bucket_content"), resource.TestCheckResourceAttr(resourceName, "acl", "private"), testAccCheckAWSS3BucketObjectAcl(resourceName, []string{"FULL_CONTROL"}), ), }, }, }) }
explode_data.jsonl/64966
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 738 }
[ 2830, 3393, 14603, 14419, 1220, 18, 36018, 1190, 63692, 1155, 353, 8840, 836, 8, 341, 2405, 2839, 16, 11, 2839, 17, 11, 2839, 18, 274, 18, 25618, 5097, 198, 50346, 675, 1669, 330, 8635, 643, 18, 38749, 5314, 6035, 698, 7000, 1072, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_NewGenericDriver_driver_nil(t *testing.T) { db, _, _ := sqlmock.New() defer db.Close() assertPanic(t, func() { NewGenericDriver(db, nil) }) }
explode_data.jsonl/78089
{ "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, 39582, 19964, 11349, 20602, 36175, 1155, 353, 8840, 836, 8, 341, 20939, 11, 8358, 716, 1669, 5704, 16712, 7121, 2822, 16867, 2927, 10421, 2822, 6948, 47, 31270, 1155, 11, 2915, 368, 341, 197, 197, 3564, 19964, 11349, 9791, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransportDialCancelRace(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {})) defer ts.Close() tr := &Transport{} defer tr.CloseIdleConnections() req, err := NewRequest("GET", ts.URL, nil) if err != nil { t.Fatal(err) } SetEnterRoundTripHook(func() { tr.CancelRequest(req) }) defer SetEnterRoundTripHook(nil) res, err := tr.RoundTrip(req) if err != ExportErrRequestCanceled { t.Errorf("expected canceled request error; got %v", err) if err == nil { res.Body.Close() } } }
explode_data.jsonl/4924
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 27560, 35, 530, 9269, 55991, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 692, 57441, 1669, 54320, 70334, 7121, 5475, 7, 3050, 9626, 18552, 3622, 5949, 6492, 11, 435, 353, 1900, 8, 4687, 1171, 16867, 10591, 10421, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTuplePqLen(t *testing.T) { st := []struct { name string pq TuplePriorityQueue nodes [][3]int exp int }{ {"empty nodes", TuplePriorityQueue{}, nil, 0}, {"nodes' len eq 1", TuplePriorityQueue{}, [][3]int{[3]int{1, 2, 3}, [3]int{2, 2, 4}}, 2}, {"nodes' len eq 2", TuplePriorityQueue{}, [][3]int{[3]int{2, 2, 2}}, 1}, } for _, tt := range st { t.Run(tt.name, func(t *testing.T) { for _, node := range tt.nodes { tt.pq.Push(node) } out := tt.pq.Len() if out != tt.exp { t.Fatalf("priorityQueue: %v and nodes: %v wanted %d but got %d", tt.pq, tt.nodes, tt.exp, out) } t.Log("pass") }) } }
explode_data.jsonl/28730
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 28681, 47, 80, 11271, 1155, 353, 8840, 836, 8, 341, 18388, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 3223, 80, 262, 24622, 20555, 7554, 198, 197, 79756, 508, 1457, 18, 63025, 198, 197, 48558, 256, 526, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRecover_completeHandlerFunc_POST_VerificationFails(t *testing.T) { t.Parallel() rec, _, _ := testSetup() ctx, w, r, _ := testRequest(rec.Authboss, "POST", "token", testURLBase64Token, authboss.StorePassword, "abcd", "confirm_"+authboss.StorePassword, "abcd") if err := rec.completeHandlerFunc(ctx, w, r); err == nil { log.Println(w.Body.String()) t.Error("Expected error") } }
explode_data.jsonl/61505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 693, 3688, 27675, 3050, 9626, 20506, 2334, 261, 2404, 37, 6209, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 67904, 11, 8358, 716, 1669, 1273, 21821, 741, 20985, 11, 289, 11, 435, 11, 716, 1669, 1273, 1900, 20635...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClearAllSessionTimers(t *testing.T) { dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() s1.sessionTimersLock.Lock() s1.resetSessionTimerLocked("foo", 10*time.Millisecond) s1.resetSessionTimerLocked("bar", 10*time.Millisecond) s1.resetSessionTimerLocked("baz", 10*time.Millisecond) s1.sessionTimersLock.Unlock() err := s1.clearAllSessionTimers() if err != nil { t.Fatalf("err: %v", err) } if len(s1.sessionTimers) != 0 { t.Fatalf("timers should be gone") } }
explode_data.jsonl/35335
{ "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, 14008, 2403, 5283, 20217, 388, 1155, 353, 8840, 836, 8, 341, 48532, 16, 11, 274, 16, 1669, 1273, 5475, 1155, 340, 16867, 2643, 84427, 14161, 16, 340, 16867, 274, 16, 10849, 18452, 2822, 1903, 16, 10177, 20217, 388, 11989, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartOfMonth(t *testing.T) { res := StartOfMonth(testDate) str := Date(res, "Y-m-d H:i:s") require.Equal(t, "2020-03-01 00:00:00", str) }
explode_data.jsonl/45316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 3479, 59646, 1155, 353, 8840, 836, 8, 341, 10202, 1669, 5145, 59646, 8623, 1916, 340, 11355, 1669, 2631, 4590, 11, 330, 56, 1448, 1737, 472, 14665, 14495, 1138, 17957, 12808, 1155, 11, 330, 17, 15, 17, 15, 12, 15, 18, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGameServerApplyDefaults(t *testing.T) { t.Parallel() type expected struct { protocol corev1.Protocol state GameServerState policy PortPolicy health Health scheduling apis.SchedulingStrategy } data := map[string]struct { gameServer GameServer container string expected expected }{ "set basic defaults on a very simple gameserver": { gameServer: GameServer{ Spec: GameServerSpec{ Ports: []GameServerPort{{ContainerPort: 999}}, Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{Containers: []corev1.Container{ {Name: "testing", Image: "testing/image"}, }}}}, }, container: "testing", expected: expected{ protocol: "UDP", state: GameServerStatePortAllocation, policy: Dynamic, scheduling: apis.Packed, health: Health{ Disabled: false, FailureThreshold: 3, InitialDelaySeconds: 5, PeriodSeconds: 5, }, }, }, "defaults are already set": { gameServer: GameServer{ Spec: GameServerSpec{ Container: "testing2", Ports: []GameServerPort{{ Protocol: "TCP", PortPolicy: Static, }}, Health: Health{ Disabled: false, PeriodSeconds: 12, InitialDelaySeconds: 11, FailureThreshold: 10, }, Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{ Containers: []corev1.Container{ {Name: "testing", Image: "testing/image"}, {Name: "testing2", Image: "testing/image2"}}}, }, }, Status: GameServerStatus{State: "TestState"}}, container: "testing2", expected: expected{ protocol: "TCP", state: "TestState", policy: Static, scheduling: apis.Packed, health: Health{ Disabled: false, FailureThreshold: 10, InitialDelaySeconds: 11, PeriodSeconds: 12, }, }, }, "set basic defaults on static gameserver": { gameServer: GameServer{ Spec: GameServerSpec{ Ports: []GameServerPort{{PortPolicy: Static}}, Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{Containers: []corev1.Container{{Name: "testing", Image: "testing/image"}}}}}, }, container: "testing", expected: expected{ protocol: "UDP", state: GameServerStateCreating, policy: Static, scheduling: apis.Packed, health: Health{ Disabled: false, FailureThreshold: 3, InitialDelaySeconds: 5, PeriodSeconds: 5, }, }, }, "health is disabled": { gameServer: GameServer{ Spec: GameServerSpec{ Ports: []GameServerPort{{ContainerPort: 999}}, Health: Health{Disabled: true}, Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{Containers: []corev1.Container{{Name: "testing", Image: "testing/image"}}}}}, }, container: "testing", expected: expected{ protocol: "UDP", state: GameServerStatePortAllocation, policy: Dynamic, scheduling: apis.Packed, health: Health{ Disabled: true, }, }, }, "convert from legacy single port to multiple": { gameServer: GameServer{ Spec: GameServerSpec{ Ports: []GameServerPort{ { ContainerPort: 777, HostPort: 777, PortPolicy: Static, Protocol: corev1.ProtocolTCP, }, }, Health: Health{Disabled: true}, Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{Containers: []corev1.Container{{Name: "testing", Image: "testing/image"}}}}}, }, container: "testing", expected: expected{ protocol: corev1.ProtocolTCP, state: GameServerStateCreating, policy: Static, scheduling: apis.Packed, health: Health{Disabled: true}, }, }, } for name, test := range data { t.Run(name, func(t *testing.T) { test.gameServer.ApplyDefaults() spec := test.gameServer.Spec assert.Contains(t, test.gameServer.ObjectMeta.Finalizers, stable.GroupName) assert.Equal(t, test.container, spec.Container) assert.Equal(t, test.expected.protocol, spec.Ports[0].Protocol) assert.Equal(t, test.expected.state, test.gameServer.Status.State) assert.Equal(t, test.expected.health, test.gameServer.Spec.Health) assert.Equal(t, test.expected.scheduling, test.gameServer.Spec.Scheduling) }) } }
explode_data.jsonl/19630
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1988 }
[ 2830, 3393, 4868, 5475, 28497, 16273, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 13158, 3601, 2036, 341, 197, 197, 17014, 256, 6200, 85, 16, 54096, 198, 197, 24291, 414, 4050, 5475, 1397, 198, 197, 3223, 8018, 257, 5776, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewClient(t *testing.T) { c := NewClient(nil, "") expectedBaseURL := defaultBaseURL + apiVersionPath if c.BaseURL().String() != expectedBaseURL { t.Errorf("NewClient BaseURL is %s, want %s", c.BaseURL().String(), expectedBaseURL) } if c.UserAgent != userAgent { t.Errorf("NewClient UserAgent is %s, want %s", c.UserAgent, userAgent) } }
explode_data.jsonl/47239
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 3564, 2959, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 2959, 27907, 11, 14676, 42400, 3978, 3144, 1669, 1638, 3978, 3144, 488, 6330, 5637, 1820, 271, 743, 272, 13018, 3144, 1005, 703, 368, 961, 3601, 3978, 3144, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_validateConfig(t *testing.T) { config := &Config{} err := readConfigFile("test-fixtures/config.json", config) assert.EnsureNil(t, err, "readConfigFile() returned an unexpected error: %v", err) errs := validateConfig(config) assert.Empty(t, errs, "validateConfig() returned non-empty slice of errors: %v", errs) }
explode_data.jsonl/63314
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 42681, 2648, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 609, 2648, 16094, 9859, 1669, 1349, 2648, 1703, 445, 1944, 70913, 18513, 14730, 4323, 497, 2193, 340, 6948, 22834, 19098, 19064, 1155, 11, 1848, 11, 330, 878, 2648, 170...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_NewTeams(t *testing.T) { // error payload w := httptest.NewRecorder() jsonData, _ := json.Marshal(map[string]interface{}{ "Name": "vidar", "Logo": "", }) req, _ := http.NewRequest("POST", "/api/manager/teams", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 400, w.Code) // error payload w = httptest.NewRecorder() jsonData, _ = json.Marshal([]map[string]interface{}{{ "Logo": "", }}) req, _ = http.NewRequest("POST", "/api/manager/teams", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 400, w.Code) // repeat in form w = httptest.NewRecorder() jsonData, _ = json.Marshal([]map[string]interface{}{{ "Name": "vidar", "Logo": "", }, { "Name": "vidar", "Logo": "test", }}) req, _ = http.NewRequest("POST", "/api/manager/teams", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 400, w.Code) // success w = httptest.NewRecorder() jsonData, _ = json.Marshal([]map[string]interface{}{{ "Name": "vidar", "Logo": "", }, { "Name": "E99", "Logo": "test_image.png", }, { "Name": "John", "Logo": "test_image123.png", }, }) req, _ = http.NewRequest("POST", "/api/manager/teams", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 200, w.Code) // save the team password var password struct { Error int `json:"error"` Msg string `json:"msg"` Data []struct { Name string `json:"Name"` Password string `json:"Password"` } `json:"data"` } err := json.Unmarshal(w.Body.Bytes(), &password) assert.Equal(t, nil, err) // save two teams' password team = append(team, struct { Name string `json:"Name"` Password string `json:"Password"` Token string `json:"token"` AccessKey string `json:"access_key"` }{Name: password.Data[0].Name, Password: password.Data[0].Password, Token: ""}, struct { Name string `json:"Name"` Password string `json:"Password"` Token string `json:"token"` AccessKey string `json:"access_key"` }{Name: password.Data[1].Name, Password: password.Data[1].Password, Token: ""}, ) // repeat in database w = httptest.NewRecorder() jsonData, _ = json.Marshal([]map[string]interface{}{{ "Name": "vidar", "Logo": "", }, { "Name": "E99", "Logo": "test_image.png", }}) req, _ = http.NewRequest("POST", "/api/manager/teams", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 400, w.Code) }
explode_data.jsonl/77157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1095 }
[ 2830, 3393, 39582, 60669, 1155, 353, 8840, 836, 8, 341, 197, 322, 1465, 7729, 198, 6692, 1669, 54320, 70334, 7121, 47023, 741, 30847, 1043, 11, 716, 1669, 2951, 37271, 9147, 14032, 31344, 67066, 197, 197, 1, 675, 788, 330, 1301, 277, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestChainProviderWithNoProvider(t *testing.T) { p := &ChainProvider{ Providers: []Provider{}, } if !p.IsExpired() { t.Errorf("Expect expired with no providers") } _, err := p.Retrieve() if e, a := ErrNoValidProvidersFoundInChain, err; e != a { t.Errorf("Expect no providers error returned, %v, got %v", e, a) } }
explode_data.jsonl/34838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 18837, 5179, 2354, 2753, 5179, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 609, 18837, 5179, 515, 197, 197, 37351, 25, 3056, 5179, 38837, 197, 630, 743, 753, 79, 4506, 54349, 368, 341, 197, 3244, 13080, 445, 17536, 26391, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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) { t.Parallel() t.Run("noEvent", func(t *testing.T) { t.Parallel() engine := New(emptyReader) err := engine.AddScript("test.js", ` import {on, sleep} from 'mokapi' export default function() {} `) test.Ok(t, err) test.Assert(t, len(engine.scripts) == 1, "script length not 1") test.Assert(t, len(engine.scripts["test.js"].events["http"]) == 0, "event defined") }) t.Run("withoutSummary", func(t *testing.T) { t.Parallel() engine := New(emptyReader) err := engine.AddScript("test.js", ` import {on, sleep} from 'mokapi' export default function() { on('http', function() { return false }); } `) test.Ok(t, err) test.Assert(t, len(engine.scripts) == 1, "script length not 1") test.Assert(t, len(engine.scripts["test.js"].events["http"]) == 1, "event not defined") summaries := engine.Run("http") test.Assert(t, len(summaries) == 0, "summary length not 0") }) t.Run("simple", func(t *testing.T) { t.Parallel() engine := New(emptyReader) err := engine.AddScript("test.js", ` import {on, sleep} from 'mokapi' export default function() { on('http', function(request, response) { return true }); } `) test.Ok(t, err) test.Assert(t, len(engine.scripts) == 1, "script length not 1") test.Assert(t, len(engine.scripts["test.js"].events["http"]) == 1, "event not defined") summaries := engine.Run("http", &struct{}{}, &struct{}{}) test.Assert(t, len(summaries) == 1, "summary length not 1") summary := summaries[0] // tags test.Assert(t, summary.Tags["name"] == "test.js", "tag name not correct") test.Assert(t, summary.Tags["event"] == "http", "tag event not correct") }) t.Run("duration", func(t *testing.T) { t.Parallel() engine := New(emptyReader) err := engine.AddScript("test.js", ` import {on, sleep} from 'mokapi' export default function() { on('http', function() { sleep(1000); return true }); } `) test.Ok(t, err) summaries := engine.Run("http") test.Assert(t, len(summaries) == 1, "summary length not 1") summary := summaries[0] test.Assert(t, summary.Duration >= 1.0*time.Second, "sleep") }) t.Run("tag name", func(t *testing.T) { t.Parallel() engine := New(emptyReader) err := engine.AddScript("test.js", ` import {on} from 'mokapi' export default function() { on('http', function() {return true}, {tags: {'name': 'foobar'}}); } `) test.Ok(t, err) summaries := engine.Run("http") test.Assert(t, len(summaries) == 1, "summary length not 1") test.Assert(t, summaries[0].Tags["name"] == "foobar", "tag name not correct") }) t.Run("custom tag", func(t *testing.T) { t.Parallel() engine := New(emptyReader) err := engine.AddScript("test.js", ` import {on} from 'mokapi' export default function() { on('http', function() {return true}, {tags: {'foo': 'bar'}}); } `) test.Ok(t, err) summaries := engine.Run("http") test.Assert(t, len(summaries) == 1, "summary length not 1") test.Assert(t, summaries[0].Tags["foo"] == "bar", "tag name not correct") }) t.Run("parameter", func(t *testing.T) { t.Parallel() p := struct { Foo string `js:"foo"` }{ "bar", } var msg string logger := &testLogger{ info: func(args ...interface{}) { msg = fmt.Sprintf("%v", args[0]) }, } engine := New(emptyReader) engine.logger = logger err := engine.AddScript("test.js", ` import {on} from 'mokapi' export default function() { on( 'http', function(p) { console.log(p.foo); } ); } `) test.Ok(t, err) engine.Run("http", p) test.Equals(t, "bar", msg) }) }
explode_data.jsonl/32512
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1579 }
[ 2830, 3393, 30480, 1925, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3244, 16708, 445, 2152, 1556, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 41288, 7957, 741, 197, 80118, 1669, 1532, 24216, 5062, 340, 197, 9859, 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 TestCentroidDistanceSwap(t *testing.T) { dp1 := newBasicNodeWithLen(nil) dp2 := newBasicNodeWithLen([]int{1, 2, 3}) centroid := newBasicNodeWithLen(nil) data := []Node{dp1, dp2} cd := newCentroidDistance(centroid, data) cd.Swap(0, 1) if !Equal(cd.members[0], dp2) { t.Errorf("Expected dp1 and dp2 to swap.\n") } }
explode_data.jsonl/9172
{ "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, 22233, 1577, 14778, 46179, 1155, 353, 8840, 836, 8, 341, 55256, 16, 1669, 501, 15944, 1955, 2354, 11271, 27907, 340, 55256, 17, 1669, 501, 15944, 1955, 2354, 11271, 10556, 396, 90, 16, 11, 220, 17, 11, 220, 18, 8824, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestListRepositories(t *testing.T) { assert := assert.New(t) bb, _, teardown := bitbucketTestClient(stubRepositoriesResponse) defer teardown() resp, err := bb.Repositories.List("ACE") if !assert.NoError(err) { return } assert.NotNil(resp) assert.Len(resp.Values, 12) }
explode_data.jsonl/76093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 852, 44814, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 2233, 65, 11, 8358, 49304, 1669, 2699, 30410, 2271, 2959, 5895, 392, 44814, 2582, 340, 16867, 49304, 741, 34653, 11, 1848, 1669, 16520, 46658, 5814...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPoolBorrowReturn(ot *testing.T) { maxAge := 1 * time.Second birthdate := time.Now() succeedingConnect := func(s string, _ log.BoltLogger) (db.Connection, error) { return &testutil.ConnFake{Name: s, Alive: true, Birth: birthdate}, nil } failingError := errors.New("whatever") failingConnect := func(s string, _ log.BoltLogger) (db.Connection, error) { return nil, failingError } ot.Run("Single thread borrow+return", func(t *testing.T) { p := New(1, maxAge, succeedingConnect, logger, "poolid") p.now = func() time.Time { return birthdate } defer p.Close() serverNames := []string{"srv1"} conn, err := p.Borrow(context.Background(), serverNames, true, nil) assertConnection(t, conn, err) p.Return(conn) // Make sure that connection actually returned servers := p.getServers() if servers[serverNames[0]].numIdle() != 1 { t.Fatal("Should be one ready connection in server") } }) ot.Run("First thread borrows, second thread blocks on borrow", func(t *testing.T) { p := New(1, maxAge, succeedingConnect, logger, "poolid") p.now = func() time.Time { return birthdate } defer p.Close() serverNames := []string{"srv1"} wg := sync.WaitGroup{} wg.Add(1) // First thread borrows ctx1 := context.Background() c1, err1 := p.Borrow(ctx1, serverNames, true, nil) assertConnection(t, c1, err1) // Second thread tries to borrow the only allowed connection on the same server go func() { ctx2 := context.Background() // Will block here until first thread detects me in the queue and returns the // connection which will unblock here. c2, err2 := p.Borrow(ctx2, serverNames, true, nil) assertConnection(t, c2, err2) wg.Done() }() // Wait until entered queue for { if p.queueSize() > 0 { break } } // Give back the connection p.Return(c1) wg.Wait() }) ot.Run("First thread borrows, second thread should not block on borrow without wait", func(t *testing.T) { p := New(1, maxAge, succeedingConnect, logger, "poolid") p.now = func() time.Time { return birthdate } defer p.Close() serverNames := []string{"srv1"} // First thread borrows ctx1 := context.Background() c1, err1 := p.Borrow(ctx1, serverNames, true, nil) assertConnection(t, c1, err1) // Actually don't need a thread here since we shouldn't block ctx2 := context.Background() c2, err2 := p.Borrow(ctx2, serverNames, false, nil) assertNoConnection(t, c2, err2) // Error should be pool full _ = err2.(*PoolFull) }) ot.Run("Multiple threads borrows and returns randomly", func(t *testing.T) { maxConns := 2 p := New(maxConns, maxAge, succeedingConnect, logger, "poolid") p.now = func() time.Time { return birthdate } serverNames := []string{"srv1"} numWorkers := 5 wg := sync.WaitGroup{} wg.Add(numWorkers) worker := func() { for i := 0; i < 5; i++ { c, err := p.Borrow(context.Background(), serverNames, true, nil) assertConnection(t, c, err) time.Sleep(time.Duration((rand.Int() % 7)) * time.Millisecond) p.Return(c) } wg.Done() } for i := 0; i < numWorkers; i++ { go worker() } wg.Wait() // Everything should be freed up, it's ok if there isn't a server as well... servers := p.getServers() for _, v := range servers { if v.numIdle() != maxConns { t.Error("A connection is still in use in the server") } } }) ot.Run("Failing connect", func(t *testing.T) { p := New(2, maxAge, failingConnect, logger, "poolid") p.now = func() time.Time { return birthdate } serverNames := []string{"srv1"} c, err := p.Borrow(context.Background(), serverNames, true, nil) assertNoConnection(t, c, err) // Should get the connect error back if err != failingError { t.Errorf("Should get connect error back but got: %s", err) } }) ot.Run("Cancel Borrow", func(t *testing.T) { p := New(1, maxAge, succeedingConnect, logger, "poolid") p.now = func() time.Time { return birthdate } c1, _ := p.Borrow(context.Background(), []string{"A"}, true, nil) ctx, cancel := context.WithCancel(context.Background()) wg := sync.WaitGroup{} var err error wg.Add(1) go func() { _, err = p.Borrow(ctx, []string{"A"}, true, nil) wg.Done() }() // Wait until entered queue for { if p.queueSize() > 0 { break } } cancel() wg.Wait() p.Return(c1) if err == nil { t.Error("There should be an error due to cancelling") } // Should be a pool error with the cancellation error in it _ = err.(*PoolTimeout) }) }
explode_data.jsonl/49910
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1736 }
[ 2830, 3393, 10551, 33, 7768, 5598, 7, 354, 353, 8840, 836, 8, 341, 22543, 16749, 1669, 220, 16, 353, 882, 32435, 198, 2233, 4809, 1028, 1669, 882, 13244, 2822, 1903, 29264, 287, 14611, 1669, 2915, 1141, 914, 11, 716, 1487, 1785, 6181,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRenegotiateTwiceRejected(t *testing.T) { config := testConfig.Clone() config.Renegotiation = RenegotiateOnceAsClient test := &clientTest{ name: "RenegotiateTwiceRejected", args: []string{"-state"}, config: config, numRenegotiations: 2, renegotiationExpectedToFail: 2, checkRenegotiationError: func(renegotiationNum int, err error) error { if renegotiationNum == 1 { return err } if err == nil { return errors.New("expected error from renegotiation but got nil") } if !strings.Contains(err.Error(), "no renegotiation") { return fmt.Errorf("expected renegotiation to be rejected but got %q", err) } return nil }, } runClientTestTLS12(t, test) }
explode_data.jsonl/27724
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 34625, 65978, 6493, 22816, 558, 77693, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1273, 2648, 64463, 741, 25873, 2013, 268, 65978, 7101, 284, 13775, 65978, 6493, 12522, 2121, 2959, 271, 18185, 1669, 609, 2972, 2271, 515, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestVariables_ListsAndNullability_AllowsListsToContainNull(t *testing.T) { doc := ` query q($input: [String]) { list(input: $input) } ` params := map[string]interface{}{ "input": []interface{}{"A", nil, "B"}, } expected := &graphql.Result{ Data: map[string]interface{}{ "list": `["A",null,"B"]`, }, } ast := testutil.TestParse(t, doc) // execute ep := graphql.ExecuteParams{ Schema: variablesTestSchema, AST: ast, Args: params, } result := testutil.TestExecute(t, ep) if len(result.Errors) > 0 { t.Fatalf("wrong result, unexpected errors: %v", result.Errors) } if !reflect.DeepEqual(expected, result) { t.Fatalf("Unexpected result, Diff: %v", testutil.Diff(expected, result)) } }
explode_data.jsonl/6454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 317 }
[ 2830, 3393, 22678, 27104, 82, 3036, 3280, 2897, 53629, 4241, 37848, 1249, 46522, 3280, 1155, 353, 8840, 836, 8, 341, 59536, 1669, 22074, 286, 3239, 2804, 699, 1355, 25, 508, 703, 2467, 341, 688, 1140, 5384, 25, 400, 1355, 340, 286, 45...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewDispatcherHealthServer(t *testing.T) { // Create A Health Server health := NewDispatcherHealthServer(testHttpPort) // Validate The EventProxy assert.NotNil(t, health) assert.Equal(t, false, health.Alive()) assert.Equal(t, false, health.dispatcherReady) }
explode_data.jsonl/66549
{ "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, 21839, 14542, 5475, 1155, 353, 8840, 836, 8, 1476, 197, 322, 4230, 362, 6267, 8422, 198, 197, 12120, 1669, 1532, 21839, 14542, 5475, 8623, 2905, 7084, 692, 197, 322, 23282, 576, 3665, 16219, 198, 6948, 93882, 1155, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestApplyStripsFields(t *testing.T) { f := NewDefaultTestFieldManager(schema.FromAPIVersionAndKind("apps/v1", "Deployment")) newObj := &unstructured.Unstructured{ Object: map[string]interface{}{ "apiVersion": "apps/v1", "kind": "Deployment", }, } newObj.SetName("b") newObj.SetNamespace("b") newObj.SetUID("b") newObj.SetClusterName("b") newObj.SetGeneration(0) newObj.SetResourceVersion("b") newObj.SetCreationTimestamp(metav1.NewTime(time.Now())) newObj.SetManagedFields([]metav1.ManagedFieldsEntry{ { Manager: "update", Operation: metav1.ManagedFieldsOperationApply, APIVersion: "apps/v1", }, }) if err := f.Update(newObj, "fieldmanager_test"); err != nil { t.Fatalf("failed to apply object: %v", err) } if m := f.ManagedFields(); len(m) != 0 { t.Fatalf("fields did not get stripped: %v", m) } }
explode_data.jsonl/53742
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 28497, 2580, 3077, 8941, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 1532, 3675, 2271, 1877, 2043, 42735, 11439, 7082, 5637, 3036, 10629, 445, 27635, 5457, 16, 497, 330, 75286, 28075, 8638, 5261, 1669, 609, 359, 51143, 10616, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_CheckDown(t *testing.T) { // not begin timer.Get().Status = "wait" w := httptest.NewRecorder() jsonData, _ := json.Marshal(map[string]interface{}{ "GameBoxID": 4, }) req, _ := http.NewRequest("POST", "/api/manager/checkDown", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 403, w.Code) timer.Get().Status = "on" // payload error w = httptest.NewRecorder() jsonData, _ = json.Marshal(map[string]interface{}{ "GameBoxID": "4", }) req, _ = http.NewRequest("POST", "/api/manager/checkDown", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 400, w.Code) // gamebox not found w = httptest.NewRecorder() jsonData, _ = json.Marshal(map[string]interface{}{ "GameBoxID": 233, }) req, _ = http.NewRequest("POST", "/api/manager/checkDown", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 403, w.Code) // success w = httptest.NewRecorder() jsonData, _ = json.Marshal(map[string]interface{}{ "GameBoxID": 4, }) req, _ = http.NewRequest("POST", "/api/manager/checkDown", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 200, w.Code) fmt.Println("checkdown", w.Body.String()) // repeat w = httptest.NewRecorder() jsonData, _ = json.Marshal(map[string]interface{}{ "GameBoxID": 4, }) req, _ = http.NewRequest("POST", "/api/manager/checkDown", bytes.NewBuffer(jsonData)) req.Header.Set("Authorization", managerToken) router.ServeHTTP(w, req) assert.Equal(t, 403, w.Code) }
explode_data.jsonl/77172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 655 }
[ 2830, 3393, 28188, 4454, 1155, 353, 8840, 836, 8, 341, 197, 322, 537, 3161, 198, 51534, 2234, 1005, 2522, 284, 330, 11489, 698, 6692, 1669, 54320, 70334, 7121, 47023, 741, 30847, 1043, 11, 716, 1669, 2951, 37271, 9147, 14032, 31344, 670...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddEmailAddress(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) assert.NoError(t, AddEmailAddress(db.DefaultContext, &EmailAddress{ Email: "user1234567890@example.com", LowerEmail: "user1234567890@example.com", IsPrimary: true, IsActivated: true, })) // ErrEmailAlreadyUsed err := AddEmailAddress(db.DefaultContext, &EmailAddress{ Email: "user1234567890@example.com", LowerEmail: "user1234567890@example.com", }) assert.Error(t, err) assert.True(t, IsErrEmailAlreadyUsed(err)) }
explode_data.jsonl/67886
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 2212, 79986, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 19905, 28770, 3380, 2271, 5988, 12367, 6948, 35699, 1155, 11, 2691, 79986, 9791, 13275, 1972, 11, 609, 79986, 515, 197, 197, 4781, 25, 981, 330, 872, 16, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetNewUsersInTeam(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() Client := th.Client teamId := th.BasicTeam.Id rusers, resp := Client.GetNewUsersInTeam(teamId, 0, 60, "") CheckNoError(t, resp) lastCreateAt := model.GetMillis() for _, u := range rusers { if u.CreateAt > lastCreateAt { t.Fatal("bad sorting") } lastCreateAt = u.CreateAt CheckUserSanitization(t, u) } rusers, resp = Client.GetNewUsersInTeam(teamId, 1, 1, "") CheckNoError(t, resp) if len(rusers) != 1 { t.Fatal("should be 1 per page") } Client.Logout() _, resp = Client.GetNewUsersInTeam(teamId, 1, 1, "") CheckUnauthorizedStatus(t, resp) }
explode_data.jsonl/21536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 272 }
[ 2830, 3393, 1949, 3564, 7137, 641, 14597, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 198, 197, 9196, 764, 1669, 270, 48868, 14597, 6444, 271, 7000,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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