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 TestUpdateUserToRestrictedDomain(t *testing.T) { th := Setup(t) defer th.TearDown() user := th.CreateUser() defer th.App.PermanentDeleteUser(user) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictCreationToDomains = "foo.com" }) _, err := th.App.UpdateUser(user, false) assert.True(t, err == nil) user.Email = "asdf@ghjk.l" _, err = th.App.UpdateUser(user, false) assert.False(t, err == nil) }
explode_data.jsonl/31413
{ "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, 4289, 1474, 1249, 86405, 13636, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 340, 16867, 270, 836, 682, 4454, 2822, 19060, 1669, 270, 7251, 1474, 741, 16867, 270, 5105, 1069, 4753, 306, 6435, 1474, 4277, 692, 7047...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHelloWorldFromShell(t *testing.T) { //add test case specific name to its own logger logger := test.GetContextLogger("TestHelloWorldFromShell") imagePath := strings.Join([]string{test.Flags.DockerRepo, "helloworld"}, "/") logger.Infof("Creating manifest") // Create manifest file. newYaml, err := ioutil.TempFile("", "helloworld") if err != nil { t.Fatalf("Failed to create temporary manifest: %v", err) } newYamlFilename := newYaml.Name() defer cleanup(newYamlFilename, logger) test.CleanupOnInterrupt(func() { cleanup(newYamlFilename, logger) }, logger) // Populate manifets file with the real path to the container content, err := ioutil.ReadFile(appYaml) if err != nil { t.Fatalf("Failed to read file %s: %v", appYaml, err) } realContent := strings.Replace(string(content), yamlImagePlaceholder, imagePath, -1) if _, err = newYaml.WriteString(realContent); err != nil { t.Fatalf("Failed to write new manifest: %v", err) } if err = newYaml.Close(); err != nil { t.Fatalf("Failed to close new manifest file: %v", err) } logger.Infof("Manifest file is '%s'", newYamlFilename) logger.Info("Deploying using kubectl") // Deploy using kubectl if output, err := exec.Command("kubectl", "apply", "-f", newYamlFilename).CombinedOutput(); err != nil { t.Fatalf("Error running kubectl: %v", strings.TrimSpace(string(output))) } logger.Info("Waiting for ingress to come up") // Wait for ingress to come up serviceIP := "" serviceHost := "" timeout := ingressTimeout for (serviceIP == "" || serviceHost == "") && timeout >= 0 { serviceHost = noStderrShell("kubectl", "get", "route", "route-example", "-o", "jsonpath={.status.domain}") serviceIP = noStderrShell("kubectl", "get", "svc", "knative-ingressgateway", "-n", "istio-system", "-o", "jsonpath={.status.loadBalancer.ingress[*]['ip']}") time.Sleep(checkInterval) timeout = timeout - checkInterval } if serviceIP == "" || serviceHost == "" { // serviceHost or serviceIP might contain a useful error, dump them. t.Fatalf("Ingress not found (IP='%s', host='%s')", serviceIP, serviceHost) } logger.Infof("Ingress is at %s/%s", serviceIP, serviceHost) logger.Info("Accessing app using curl") outputString := "" timeout = servingTimeout for outputString != helloWorldExpectedOutput && timeout >= 0 { output, err := exec.Command("curl", "--header", "Host:"+serviceHost, "http://"+serviceIP).Output() errorString := "none" time.Sleep(checkInterval) timeout = timeout - checkInterval if err != nil { errorString = err.Error() } outputString = strings.TrimSpace(string(output)) logger.Infof("App replied with '%s' (error: %s)", outputString, errorString) } if outputString != helloWorldExpectedOutput { t.Fatalf("Timeout waiting for app to start serving") } logger.Info("App is serving") }
explode_data.jsonl/81796
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 987 }
[ 2830, 3393, 9707, 10134, 3830, 25287, 1155, 353, 8840, 836, 8, 341, 197, 322, 718, 1273, 1142, 3151, 829, 311, 1181, 1828, 5925, 198, 17060, 1669, 1273, 2234, 1972, 7395, 445, 2271, 9707, 10134, 3830, 25287, 5130, 31426, 1820, 1669, 906...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartCmdWithMissingTokenURLArg(t *testing.T) { startCmd := GetStartCmd(&mockServer{}) var args []string args = append(args, hostURLArg()...) args = append(args, endpointAuthURLArg()...) startCmd.SetArgs(args) err := startCmd.Execute() require.Contains(t, err.Error(), "Neither token-url (command line flag) nor OAUTH2_ENDPOINT_TOKEN_URL (environment variable) have been set.") }
explode_data.jsonl/23758
{ "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, 3479, 15613, 2354, 25080, 3323, 3144, 2735, 1155, 353, 8840, 836, 8, 341, 21375, 15613, 1669, 2126, 3479, 15613, 2099, 16712, 5475, 6257, 692, 2405, 2827, 3056, 917, 198, 31215, 284, 8737, 7356, 11, 3468, 3144, 2735, 368, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestContains(t *testing.T) { m := NewSimpleLongConcurrentHashMap() if m.Contains(1) == true { t.Error("map should not contain this key") } amy := Girl{"Amy"} m.Put(7, amy) if m.Contains(7) == false { t.Error("map should contain this key") } }
explode_data.jsonl/19660
{ "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, 23805, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1532, 16374, 6583, 1109, 3231, 18497, 2822, 743, 296, 11545, 7, 16, 8, 621, 830, 341, 197, 3244, 6141, 445, 2186, 1265, 537, 6644, 419, 1376, 1138, 197, 630, 197, 26228, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetArchivePathInjection(t *testing.T) { locator := config.NewLocator(config.Config) serverSocketPath, stop := runRepoServer(t, locator) defer stop() client, conn := newRepositoryClient(t, serverSocketPath) defer conn.Close() testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepoWithWorktree(t) defer cleanupFn() ctx, cancel := testhelper.Context() defer cancel() // Adding a temp directory representing the .ssh directory sshDirectory, cleanup := testhelper.TempDir(t) defer cleanup() // Adding an empty authorized_keys file authorizedKeysPath := filepath.Join(sshDirectory, "authorized_keys") authorizedKeysFile, err := os.Create(authorizedKeysPath) require.NoError(t, err) require.NoError(t, authorizedKeysFile.Close()) // Create the directory on the repository repoExploitPath := filepath.Join(testRepoPath, "--output=", authorizedKeysPath) require.NoError(t, os.MkdirAll(repoExploitPath, os.ModeDir|0755)) f, err := os.Create(filepath.Join(repoExploitPath, "id_12345.pub")) require.NoError(t, err) evilPubKeyFile := `# ssh-ed25519 my_super_evil_ssh_pubkey #` _, err = fmt.Fprint(f, evilPubKeyFile) require.NoError(t, err) require.NoError(t, f.Close()) // Add the directory to the repository testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "add", ".") testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "commit", "-m", "adding fake key file") commitID := strings.TrimRight(string(testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "rev-parse", "HEAD")), "\n") injectionPath := fmt.Sprintf("--output=%s", authorizedKeysPath) req := &gitalypb.GetArchiveRequest{ Repository: testRepo, CommitId: commitID, Prefix: "", Format: gitalypb.GetArchiveRequest_TAR, Path: []byte(injectionPath), } stream, err := client.GetArchive(ctx, req) require.NoError(t, err) _, err = consumeArchive(stream) require.NoError(t, err) authorizedKeysFile, err = os.Open(authorizedKeysPath) require.NoError(t, err) defer authorizedKeysFile.Close() authorizedKeysFileBytes, err := ioutil.ReadAll(authorizedKeysFile) require.NoError(t, err) authorizedKeysFileStat, err := authorizedKeysFile.Stat() require.NoError(t, err) require.NotContains(t, string(authorizedKeysFileBytes), evilPubKeyFile) // this should fail first in pre-fix failing test require.Zero(t, authorizedKeysFileStat.Size()) }
explode_data.jsonl/60645
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 851 }
[ 2830, 3393, 1949, 42502, 1820, 36653, 1155, 353, 8840, 836, 8, 341, 197, 68033, 1669, 2193, 7121, 33831, 8754, 10753, 340, 41057, 10286, 1820, 11, 2936, 1669, 1598, 25243, 5475, 1155, 11, 47117, 340, 16867, 2936, 2822, 25291, 11, 4534, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsCaseSensitiveFilesystem(t *testing.T) { isLinux := runtime.GOOS == "linux" isWindows := runtime.GOOS == "windows" isMacOS := runtime.GOOS == "darwin" if !isLinux && !isWindows && !isMacOS { t.Skip("Run this test on Windows, Linux and macOS only") } dir, err := ioutil.TempDir("", "TestCaseSensitivity") if err != nil { t.Fatal(err) } defer os.RemoveAll(dir) var want bool if isLinux { want = true } else { want = false } got, err := IsCaseSensitiveFilesystem(dir) if err != nil { t.Fatalf("unexpected error message: \n\t(GOT) %+v", err) } if want != got { t.Fatalf("unexpected value returned: \n\t(GOT) %t\n\t(WNT) %t", got, want) } }
explode_data.jsonl/72202
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 3872, 4207, 63316, 1703, 8948, 1155, 353, 8840, 836, 8, 972, 19907, 46324, 1669, 15592, 97574, 3126, 621, 330, 14210, 5031, 19907, 13164, 1669, 15592, 97574, 3126, 621, 330, 27077, 5031, 19907, 19552, 3126, 1669, 15592, 97574, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIfdBuilder_Replace(t *testing.T) { im := NewIfdMapping() err := LoadStandardIfds(im) log.PanicIf(err) ti := NewTagIndex() ib := NewIfdBuilder(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder) bt := &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0x11, value: NewIfdBuilderTagValueFromBytes([]byte("test string")), } err = ib.Add(bt) log.PanicIf(err) bt = &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0x22, value: NewIfdBuilderTagValueFromBytes([]byte("test string2")), } err = ib.Add(bt) log.PanicIf(err) bt = &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0x33, value: NewIfdBuilderTagValueFromBytes([]byte("test string3")), } err = ib.Add(bt) log.PanicIf(err) currentIds := make([]uint16, 3) for i, bt := range ib.Tags() { currentIds[i] = bt.tagId } if reflect.DeepEqual([]uint16{0x11, 0x22, 0x33}, currentIds) == false { t.Fatalf("Pre-replace tags are not correct.") } bt = &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0x99, value: NewIfdBuilderTagValueFromBytes([]byte("test string4")), } err = ib.Replace(0x22, bt) log.PanicIf(err) currentIds = make([]uint16, 3) for i, bt := range ib.Tags() { currentIds[i] = bt.tagId } if reflect.DeepEqual([]uint16{0x11, 0x99, 0x33}, currentIds) == false { t.Fatalf("Post-replace tags are not correct.") } }
explode_data.jsonl/36635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 710 }
[ 2830, 3393, 2679, 67, 3297, 62, 23107, 1155, 353, 8840, 836, 8, 341, 54892, 1669, 1532, 2679, 67, 6807, 2822, 9859, 1669, 8893, 19781, 2679, 5356, 25107, 340, 6725, 1069, 31270, 2679, 3964, 692, 72859, 1669, 1532, 5668, 1552, 741, 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 TestTimeRetention(t *testing.T) { db, delete := openTestDB(t, &Options{ BlockRanges: []int64{1000}, }) defer func() { testutil.Ok(t, db.Close()) delete() }() blocks := []*BlockMeta{ {MinTime: 500, MaxTime: 900}, // Oldest block {MinTime: 1000, MaxTime: 1500}, {MinTime: 1500, MaxTime: 2000}, // Newest Block } for _, m := range blocks { createBlock(t, db.Dir(), genSeries(10, 10, m.MinTime, m.MaxTime)) } testutil.Ok(t, db.reload()) // Reload the db to register the new blocks. testutil.Equals(t, len(blocks), len(db.Blocks())) // Ensure all blocks are registered. db.opts.RetentionDuration = uint64(blocks[2].MaxTime - blocks[1].MinTime) testutil.Ok(t, db.reload()) expBlocks := blocks[1:] actBlocks := db.Blocks() testutil.Equals(t, 1, int(prom_testutil.ToFloat64(db.metrics.timeRetentionCount)), "metric retention count mismatch") testutil.Equals(t, len(expBlocks), len(actBlocks)) testutil.Equals(t, expBlocks[0].MaxTime, actBlocks[0].meta.MaxTime) testutil.Equals(t, expBlocks[len(expBlocks)-1].MaxTime, actBlocks[len(actBlocks)-1].meta.MaxTime) }
explode_data.jsonl/64377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 440 }
[ 2830, 3393, 1462, 86329, 1155, 353, 8840, 836, 8, 341, 20939, 11, 3698, 1669, 1787, 2271, 3506, 1155, 11, 609, 3798, 515, 197, 94940, 74902, 25, 3056, 396, 21, 19, 90, 16, 15, 15, 15, 1583, 197, 3518, 16867, 2915, 368, 341, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPunctuationMark(t *testing.T) { const want = "jiendo" got, err := KanaToRomaji("ジ・エンド") assert.Equal(t, want, got) assert.Nil(t, err) }
explode_data.jsonl/11340
{ "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, 47, 72299, 8949, 1155, 353, 8840, 836, 8, 341, 4777, 1366, 284, 330, 7754, 8691, 698, 3174, 354, 11, 1848, 1669, 730, 3362, 1249, 44359, 41788, 445, 75328, 9274, 75639, 126973, 5130, 6948, 12808, 1155, 11, 1366, 11, 2684, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestService_Binding(t *testing.T) { Convey("test binding", t, WithService(func(s *Service) { logMid := int64(1) p := &bws.ParamBinding{ Bid: 1, Key: "", } err := s.Binding(context.Background(), logMid, p) So(err, ShouldBeNil) })) }
explode_data.jsonl/70581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 1860, 1668, 3961, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 1944, 10970, 497, 259, 11, 3085, 1860, 18552, 1141, 353, 1860, 8, 341, 197, 6725, 33648, 1669, 526, 21, 19, 7, 16, 340, 197, 3223, 1669, 609, 65, 8915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAsPathAs4Trans2(t *testing.T) { as1 := []uint16{65000, 4000} param1 := bgp.NewAsPathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, as1) as2 := []uint16{10, 20, 30} param2 := bgp.NewAsPathParam(bgp.BGP_ASPATH_ATTR_TYPE_SET, as2) as3 := []uint16{bgp.AS_TRANS, bgp.AS_TRANS, 40001} param3 := bgp.NewAsPathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, as3) params := []bgp.AsPathParamInterface{param1, param2, param3} aspath := bgp.NewPathAttributeAsPath(params) as4 := []uint32{400000, 300000, 40001} param4s := []*bgp.As4PathParam{bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, as4)} as4path := bgp.NewPathAttributeAs4Path(param4s) msg := bgp.NewBGPUpdateMessage(nil, []bgp.PathAttributeInterface{aspath, as4path}, nil).Body.(*bgp.BGPUpdate) UpdatePathAttrs4ByteAs(msg) assert.Equal(t, len(msg.PathAttributes), 1) assert.Equal(t, len(msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value), 3) assert.Equal(t, len(msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[0].(*bgp.As4PathParam).AS), 2) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[0].(*bgp.As4PathParam).AS[0], uint32(65000)) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[0].(*bgp.As4PathParam).AS[1], uint32(4000)) assert.Equal(t, len(msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[1].(*bgp.As4PathParam).AS), 3) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[1].(*bgp.As4PathParam).AS[0], uint32(10)) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[1].(*bgp.As4PathParam).AS[1], uint32(20)) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[1].(*bgp.As4PathParam).AS[2], uint32(30)) assert.Equal(t, len(msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[2].(*bgp.As4PathParam).AS), 3) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[2].(*bgp.As4PathParam).AS[0], uint32(400000)) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[2].(*bgp.As4PathParam).AS[1], uint32(300000)) assert.Equal(t, msg.PathAttributes[0].(*bgp.PathAttributeAsPath).Value[2].(*bgp.As4PathParam).AS[2], uint32(40001)) }
explode_data.jsonl/29050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 909 }
[ 2830, 3393, 2121, 1820, 2121, 19, 3167, 17, 1155, 353, 8840, 836, 8, 341, 60451, 16, 1669, 3056, 2496, 16, 21, 90, 21, 20, 15, 15, 15, 11, 220, 19, 15, 15, 15, 532, 36037, 16, 1669, 8951, 79, 7121, 2121, 93492, 1883, 21888, 1785...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_BeginAuth(t *testing.T) { t.Parallel() a := assert.New(t) p := deezerProvider() session, err := p.BeginAuth("test_state") s := session.(*deezer.Session) a.NoError(err) a.Contains(s.AuthURL, "https://connect.deezer.com/oauth/auth.php") }
explode_data.jsonl/82098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 93447, 5087, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 2060, 7121, 1155, 340, 3223, 1669, 44733, 7070, 5179, 741, 25054, 11, 1848, 1669, 281, 28467, 5087, 445, 1944, 4387, 1138, 1903, 1669, 3797, 413...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSortedArray_PopRight(t *testing.T) { gtest.C(t, func(t *gtest.T) { array1 := garray.NewSortedArrayFrom( []interface{}{"a", "d", "c", "b"}, gutil.ComparatorString, ) i1, ok := array1.PopRight() t.Assert(ok, true) t.Assert(gconv.String(i1), "d") t.Assert(array1.Len(), 3) t.Assert(array1, []interface{}{"a", "b", "c"}) }) gtest.C(t, func(t *gtest.T) { array := garray.NewSortedArrayFrom(g.Slice{1, 2, 3}, gutil.ComparatorInt) v, ok := array.PopRight() t.Assert(v, 3) t.Assert(ok, true) t.Assert(array.Len(), 2) v, ok = array.PopRight() t.Assert(v, 2) t.Assert(ok, true) t.Assert(array.Len(), 1) v, ok = array.PopRight() t.Assert(v, 1) t.Assert(ok, true) t.Assert(array.Len(), 0) }) }
explode_data.jsonl/67011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 51051, 1857, 1088, 453, 5979, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11923, 16, 1669, 342, 1653, 7121, 51051, 1857, 3830, 1006, 298, 197, 1294, 4970, 6257, 4913, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestScaledWindowConnect(t *testing.T) { // This test ensures that window scaling is used when the peer // does advertise it and connection is established with Connect(). c := context.New(t, defaultMTU) defer c.Cleanup() // Set the window size greater than the maximum non-scaled window. c.CreateConnectedWithRawOptions(context.TestInitialSequenceNumber, 30000, 65535*3, []byte{ header.TCPOptionWS, 3, 0, header.TCPOptionNOP, }) data := []byte{1, 2, 3} var r bytes.Reader r.Reset(data) if _, err := c.EP.Write(&r, tcpip.WriteOptions{}); err != nil { t.Fatalf("Write failed: %s", err) } // Check that data is received, and that advertised window is 0x5fff, // that is, that it is scaled. b := c.GetPacket() iss := seqnum.Value(context.TestInitialSequenceNumber).Add(1) checker.IPv4(t, b, checker.PayloadLen(len(data)+header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.TCPSeqNum(uint32(c.IRS)+1), checker.TCPAckNum(uint32(iss)), checker.TCPWindow(0x5fff), checker.TCPFlagsMatch(header.TCPFlagAck, ^header.TCPFlagPsh), ), ) }
explode_data.jsonl/75958
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 424 }
[ 2830, 3393, 94201, 4267, 14611, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 1273, 25351, 429, 3241, 26943, 374, 1483, 979, 279, 14397, 198, 197, 322, 1558, 50836, 432, 323, 3633, 374, 9555, 448, 13015, 25829, 1444, 1669, 2266, 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...
2
func TestIsRestrictedPrivilege(t *testing.T) { assert := assert.New(t) assert.True(IsRestrictedPrivilege("RESTRICTED_TABLES_ADMIN")) assert.True(IsRestrictedPrivilege("RESTRICTED_STATUS_VARIABLES_ADMIN")) assert.False(IsRestrictedPrivilege("CONNECTION_ADMIN")) assert.False(IsRestrictedPrivilege("BACKUP_ADMIN")) assert.False(IsRestrictedPrivilege("aa")) }
explode_data.jsonl/35836
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 3872, 86405, 32124, 42769, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 6948, 32443, 65473, 86405, 32124, 42769, 445, 38307, 39477, 1479, 16039, 50, 30460, 5455, 6948, 32443, 65473, 86405, 32124, 42769, 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...
1
func TestPostAllocate(t *testing.T) { response := new(pluginapi.AllocateResponse) cresp := new(pluginapi.ContainerAllocateResponse) response.ContainerResponses = append(response.ContainerResponses, cresp) testMap := map[string]string{ "QAT29": "03:04.1", "QAT13": "03:04.2", "QAT6": "03:04.3", "QAT21": "03:04.4", } response.ContainerResponses[0].Envs = testMap resultKey := []string{ "QAT0", "QAT1", "QAT2", "QAT3", } expectedValues := map[string]struct{}{ "03:04.1": {}, "03:04.2": {}, "03:04.3": {}, "03:04.4": {}, } dp := &DevicePlugin{} dp.PostAllocate(response) if len(response.ContainerResponses[0].Envs) != 4 { t.Fatal("Set wrong number of Environment Variables") } for k := range response.ContainerResponses[0].Envs { if !eleInSlice(k, resultKey) { t.Fatalf("Set wrong key: %s. The key should be in the range %v", k, resultKey) } } for _, key := range resultKey { if value, ok := response.ContainerResponses[0].Envs[key]; ok { if _, ok := expectedValues[value]; ok { delete(expectedValues, value) } else { t.Errorf("Unexpected value %s", value) } } } }
explode_data.jsonl/17453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 491 }
[ 2830, 3393, 4133, 75380, 1155, 353, 8840, 836, 8, 341, 21735, 1669, 501, 46801, 2068, 9636, 22401, 2582, 340, 1444, 18243, 1669, 501, 46801, 2068, 33672, 75380, 2582, 340, 21735, 33672, 70743, 284, 8737, 5684, 33672, 70743, 11, 272, 18243...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPlayer_ControlledBot(t *testing.T) { dave := &Player{ Name: "Dave", IsBot: true, } demoInfoProvider := &demoInfoProviderMock{ playersByHandle: map[int]*Player{ 12: dave, }, } pl := playerWithProperty("m_iControlledBotEntIndex", st.PropertyValue{IntVal: 0}) pl.demoInfoProvider = demoInfoProvider assert.Nil(t, pl.ControlledBot()) pl = playerWithProperty("m_iControlledBotEntIndex", st.PropertyValue{IntVal: 12}) pl.demoInfoProvider = demoInfoProvider assert.Same(t, dave, pl.ControlledBot()) }
explode_data.jsonl/12190
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 4476, 45376, 832, 23502, 1155, 353, 8840, 836, 8, 341, 2698, 523, 1669, 609, 4476, 515, 197, 21297, 25, 220, 330, 55730, 756, 197, 197, 3872, 23502, 25, 830, 345, 197, 532, 2698, 6726, 1731, 5179, 1669, 609, 25762, 1731, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCaptureGoneWhileMovingTable(t *testing.T) { t.Parallel() mockCaptureInfos := map[model.CaptureID]*model.CaptureInfo{ "capture-1": { ID: "capture-1", AdvertiseAddr: "fakeip:1", }, "capture-2": { ID: "capture-2", AdvertiseAddr: "fakeip:2", }, } ctx := cdcContext.NewBackendContext4Test(false) communicator := NewMockScheduleDispatcherCommunicator() dispatcher := NewBaseScheduleDispatcher("cf-1", communicator, 1000) dispatcher.captureStatus = map[model.CaptureID]*captureStatus{ "capture-1": { SyncStatus: captureSyncFinished, CheckpointTs: 1300, ResolvedTs: 1600, }, "capture-2": { SyncStatus: captureSyncFinished, CheckpointTs: 1500, ResolvedTs: 1550, }, } dispatcher.tables.AddTableRecord(&util.TableRecord{ TableID: 1, CaptureID: "capture-1", Status: util.RunningTable, }) dispatcher.tables.AddTableRecord(&util.TableRecord{ TableID: 2, CaptureID: "capture-2", Status: util.RunningTable, }) dispatcher.tables.AddTableRecord(&util.TableRecord{ TableID: 3, CaptureID: "capture-1", Status: util.RunningTable, }) dispatcher.MoveTable(1, "capture-2") communicator.On("DispatchTable", mock.Anything, "cf-1", model.TableID(1), "capture-1", true). Return(true, nil) checkpointTs, resolvedTs, err := dispatcher.Tick(ctx, 1300, []model.TableID{1, 2, 3}, mockCaptureInfos) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) delete(mockCaptureInfos, "capture-2") dispatcher.OnAgentFinishedTableOperation("capture-1", 1) communicator.Reset() communicator.On("DispatchTable", mock.Anything, "cf-1", model.TableID(1), mock.Anything, false). Return(true, nil) communicator.On("DispatchTable", mock.Anything, "cf-1", model.TableID(2), mock.Anything, false). Return(true, nil) checkpointTs, resolvedTs, err = dispatcher.Tick(ctx, 1300, []model.TableID{1, 2, 3}, mockCaptureInfos) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) }
explode_data.jsonl/28505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 889 }
[ 2830, 3393, 27429, 38, 603, 7983, 39732, 2556, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 77333, 27429, 38059, 1669, 2415, 79938, 727, 11850, 915, 8465, 2528, 727, 11850, 1731, 515, 197, 197, 1, 45070, 12, 16, 788, 341, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSortedArray_Sort(t *testing.T) { gtest.C(t, func(t *gtest.T) { a1 := []interface{}{"a", "f", "c"} func1 := func(v1, v2 interface{}) int { return strings.Compare(gconv.String(v1), gconv.String(v2)) } array1 := garray.NewSortedArrayFrom(a1, func1) array1.Sort() t.Assert(array1.Len(), 3) t.Assert(array1, []interface{}{"a", "c", "f"}) }) }
explode_data.jsonl/67007
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 51051, 1857, 1098, 371, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11323, 16, 1669, 3056, 4970, 6257, 4913, 64, 497, 330, 69, 497, 330, 66, 16707, 197, 29244, 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 TestCollectCustomErrorsPerServer(t *testing.T) { invalidType := &ingress.Ingress{} customErrors := collectCustomErrorsPerServer(invalidType) if customErrors != nil { t.Errorf("Expected %v but returned %v", nil, customErrors) } server := &ingress.Server{ Locations: []*ingress.Location{ {CustomHTTPErrors: []int{404, 405}}, {CustomHTTPErrors: []int{404, 500}}, }, } expected := []int{404, 405, 500} uniqueCodes := collectCustomErrorsPerServer(server) sort.Ints(uniqueCodes) if !reflect.DeepEqual(expected, uniqueCodes) { t.Errorf("Expected '%v' but got '%v'", expected, uniqueCodes) } }
explode_data.jsonl/80600
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 236 }
[ 2830, 3393, 47504, 10268, 13877, 3889, 5475, 1155, 353, 8840, 836, 8, 341, 197, 11808, 929, 1669, 609, 287, 673, 5337, 2483, 16094, 1444, 1450, 13877, 1669, 6530, 10268, 13877, 3889, 5475, 5900, 1891, 929, 340, 743, 2526, 13877, 961, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBackOffFlow(t *testing.T) { cl := clock.NewFakeClock(time.Now()) q := NewTestQueue(context.Background(), newDefaultQueueSort(), WithClock(cl)) steps := []struct { wantBackoff time.Duration }{ {wantBackoff: time.Second}, {wantBackoff: 2 * time.Second}, {wantBackoff: 4 * time.Second}, {wantBackoff: 8 * time.Second}, {wantBackoff: 10 * time.Second}, {wantBackoff: 10 * time.Second}, {wantBackoff: 10 * time.Second}, } pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "test-pod", Namespace: "test-ns", UID: "test-uid", }, } podID := types.NamespacedName{ Namespace: pod.Namespace, Name: pod.Name, } if err := q.Add(pod); err != nil { t.Fatal(err) } for i, step := range steps { t.Run(fmt.Sprintf("step %d", i), func(t *testing.T) { timestamp := cl.Now() // Simulate schedule attempt. podInfo, err := q.Pop() if err != nil { t.Fatal(err) } if podInfo.Attempts != i+1 { t.Errorf("got attempts %d, want %d", podInfo.Attempts, i+1) } if err := q.AddUnschedulableIfNotPresent(podInfo, int64(i)); err != nil { t.Fatal(err) } // An event happens. q.MoveAllToActiveOrBackoffQueue(UnschedulableTimeout, nil) if _, ok, _ := q.podBackoffQ.Get(podInfo); !ok { t.Errorf("pod %v is not in the backoff queue", podID) } // Check backoff duration. deadline := q.getBackoffTime(podInfo) backoff := deadline.Sub(timestamp) if backoff != step.wantBackoff { t.Errorf("got backoff %s, want %s", backoff, step.wantBackoff) } // Simulate routine that continuously flushes the backoff queue. cl.Step(time.Millisecond) q.flushBackoffQCompleted() // Still in backoff queue after an early flush. if _, ok, _ := q.podBackoffQ.Get(podInfo); !ok { t.Errorf("pod %v is not in the backoff queue", podID) } // Moved out of the backoff queue after timeout. cl.Step(backoff) q.flushBackoffQCompleted() if _, ok, _ := q.podBackoffQ.Get(podInfo); ok { t.Errorf("pod %v is still in the backoff queue", podID) } }) } }
explode_data.jsonl/68206
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 894 }
[ 2830, 3393, 3707, 4596, 18878, 1155, 353, 8840, 836, 8, 341, 39407, 1669, 8866, 7121, 52317, 26104, 9730, 13244, 2398, 18534, 1669, 1532, 2271, 7554, 5378, 19047, 1507, 501, 3675, 7554, 10231, 1507, 3085, 26104, 9849, 1171, 18388, 7124, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpenStackSuites(t *testing.T) { suite.Run(t, &CinderTestSuite{BaseOpenStackTestSuite: BaseOpenStackTestSuite{ServiceName: "volume"}}) suite.Run(t, &NovaTestSuite{BaseOpenStackTestSuite: BaseOpenStackTestSuite{ServiceName: "compute"}}) suite.Run(t, &NeutronTestSuite{BaseOpenStackTestSuite: BaseOpenStackTestSuite{ServiceName: "network"}}) suite.Run(t, &GlanceTestSuite{BaseOpenStackTestSuite: BaseOpenStackTestSuite{ServiceName: "image"}}) }
explode_data.jsonl/7559
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 5002, 4336, 62898, 288, 1155, 353, 8840, 836, 8, 341, 96572, 16708, 1155, 11, 609, 34, 5744, 2271, 28000, 90, 3978, 5002, 4336, 2271, 28000, 25, 5351, 5002, 4336, 2271, 28000, 90, 1860, 675, 25, 330, 25060, 30975, 340, 965...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_ListRealms(t *testing.T) { // given realm := getDummyRealm() handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { assert.Equal(t, RealmsCreatePath, req.URL.Path) assert.Equal(t, req.Method, http.MethodGet) var list []*v1alpha1.KeycloakRealm list = append(list, realm) json, err := jsoniter.Marshal(list) assert.NoError(t, err) size, err := w.Write(json) assert.NoError(t, err) assert.Equal(t, size, len(json)) w.WriteHeader(204) }) server := httptest.NewServer(handler) defer server.Close() client := Client{ requester: server.Client(), URL: server.URL, token: "dummy", } // when realms, err := client.ListRealms() // then // correct path expected on httptest server assert.NoError(t, err) // exactly one realms must be returned assert.Len(t, realms, 1) }
explode_data.jsonl/49877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 337 }
[ 2830, 3393, 2959, 27104, 12768, 1011, 1155, 353, 8840, 836, 8, 341, 197, 322, 2661, 198, 17200, 7673, 1669, 633, 43344, 64290, 2822, 53326, 1669, 1758, 89164, 18552, 3622, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, 6948, 12808...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_OCRContractTracker_LatestBlockHeight(t *testing.T) { t.Parallel() t.Run("on L2 chains, always returns 0", func(t *testing.T) { uni := newContractTrackerUni(t, evmtest.ChainOptimismMainnet(t)) l, err := uni.tracker.LatestBlockHeight(context.Background()) require.NoError(t, err) assert.Equal(t, uint64(0), l) }) t.Run("before first head incoming, looks up on-chain", func(t *testing.T) { uni := newContractTrackerUni(t) uni.ec.On("HeadByNumber", mock.AnythingOfType("*context.cancelCtx"), (*big.Int)(nil)).Return(&evmtypes.Head{Number: 42}, nil) l, err := uni.tracker.LatestBlockHeight(context.Background()) require.NoError(t, err) assert.Equal(t, uint64(42), l) }) t.Run("Before first head incoming, on client error returns error", func(t *testing.T) { uni := newContractTrackerUni(t) uni.ec.On("HeadByNumber", mock.AnythingOfType("*context.cancelCtx"), (*big.Int)(nil)).Return(nil, nil).Once() _, err := uni.tracker.LatestBlockHeight(context.Background()) assert.EqualError(t, err, "got nil head") uni.ec.On("HeadByNumber", mock.AnythingOfType("*context.cancelCtx"), (*big.Int)(nil)).Return(nil, errors.New("bar")).Once() _, err = uni.tracker.LatestBlockHeight(context.Background()) assert.EqualError(t, err, "bar") uni.ec.AssertExpectations(t) }) t.Run("after first head incoming, uses cached value", func(t *testing.T) { uni := newContractTrackerUni(t) uni.tracker.OnNewLongestChain(context.Background(), &evmtypes.Head{Number: 42}) l, err := uni.tracker.LatestBlockHeight(context.Background()) require.NoError(t, err) assert.Equal(t, uint64(42), l) }) t.Run("if headbroadcaster has it, uses the given value on start", func(t *testing.T) { uni := newContractTrackerUni(t) uni.hb.On("Subscribe", uni.tracker).Return(&evmtypes.Head{Number: 42}, func() {}) uni.db.On("LoadLatestRoundRequested").Return(offchainaggregator.OffchainAggregatorRoundRequested{}, nil) uni.lb.On("Register", uni.tracker, mock.Anything).Return(func() {}) require.NoError(t, uni.tracker.Start()) l, err := uni.tracker.LatestBlockHeight(context.Background()) require.NoError(t, err) assert.Equal(t, uint64(42), l) uni.hb.AssertExpectations(t) require.NoError(t, uni.tracker.Close()) }) }
explode_data.jsonl/31061
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 855 }
[ 2830, 3393, 2232, 8973, 14067, 31133, 2351, 13893, 4713, 3640, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 16708, 445, 263, 444, 17, 26179, 11, 2677, 4675, 220, 15, 497, 2915, 1155, 353, 8840, 836, 8, 341, 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...
1
func TestReconcile_FailedVGCreate(t *testing.T) { var ( fLVG = lvgCR1 e = &mocks.GoMockExecutor{} expectedErr = errors.New("vgcreate failed") ) fLVG.Finalizers = []string{lvgFinalizer} c := setup(t, node1ID, fLVG) req := ctrl.Request{NamespacedName: types.NamespacedName{Namespace: ns, Name: fLVG.Name}} c.lvmOps = lvm.NewLVM(e, testLogger) e.OnCommand(lsblkAllDevicesCmd).Return(mocks.LsblkTwoDevicesStr, "", nil) e.OnCommand("/sbin/lvm pvcreate --yes /dev/sda").Return("", "", nil) e.OnCommand("/sbin/lvm pvcreate --yes /dev/sdb").Return("", "", nil) e.OnCommand(fmt.Sprintf("/sbin/lvm vgcreate --yes %s /dev/sda /dev/sdb", req.Name)). Return("", "", expectedErr) res, err := c.Reconcile(req) assert.Nil(t, err) assert.Equal(t, res, ctrl.Result{}) lvgCR := &lvgcrd.LogicalVolumeGroup{} err = c.k8sClient.ReadCR(tCtx, lvgCR1.Name, "", lvgCR) assert.Equal(t, apiV1.Failed, lvgCR.Spec.Status) }
explode_data.jsonl/51723
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 436 }
[ 2830, 3393, 693, 40446, 457, 1400, 5687, 46641, 4021, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 1166, 40258, 38, 286, 284, 326, 7239, 8973, 16, 198, 197, 7727, 1843, 284, 609, 16712, 82, 67131, 11571, 25255, 16094, 197, 42400, 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...
1
func TestAny2String(t *testing.T) { Convey("Cast any to string", t, func() { var foo interface{} origin := "1" foo = origin any2String := MustAny2String(foo) So(any2String, ShouldEqual, origin) foo = 2 any2String, err := Any2String(foo) So(err, ShouldNotBeNil) So(any2String, ShouldBeEmpty) }) }
explode_data.jsonl/34304
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 8610, 17, 703, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 18714, 894, 311, 914, 497, 259, 11, 2915, 368, 341, 197, 2405, 15229, 3749, 16094, 197, 197, 8611, 1669, 330, 16, 698, 197, 197, 7975, 284, 6238, 271, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_ObjectTracker_Canceled_Expectations(t *testing.T) { g := gomega.NewWithT(t) ot := newObjTracker(schema.GroupVersionKind{}, nil) const count = 10 ct := makeCTSlice("ct-", count) for i := 0; i < len(ct); i++ { ot.Expect(ct[i]) } g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "should not be satisfied before ExpectationsDone") ot.ExpectationsDone() // Skip the first two for i := 2; i < len(ct); i++ { g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "should not be satisfied before observations are done") ot.Observe(ct[i]) } g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "two expectation remain") ot.CancelExpect(ct[0]) g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "one expectation remains") ot.CancelExpect(ct[1]) g.Expect(ot.Satisfied()).To(gomega.BeTrue(), "should be satisfied") }
explode_data.jsonl/52318
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 27839, 31133, 920, 38392, 62, 17536, 804, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 2354, 51, 1155, 340, 197, 354, 1669, 74259, 31133, 42735, 5407, 5637, 10629, 22655, 2092, 692, 4777, 1760, 284, 220, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestApp01maVendorHndlrRowDelete(t *testing.T) { var err error var td *TestData_App01maVendor var rcd App01maVendor.App01maVendor //expectedBody := "" t.Logf("TestRowDelete()...\n") td = &TestData_App01maVendor{} td.Setup(t) // Delete a record. rcd.TestData(1) // "B" keys := rcd.KeysToValue() t.Logf("\tSetting up to delete (%d)\"%s\" row...\n", len(keys), keys) urlStr := fmt.Sprintf("/Vendor/delete?%s", keys) td.GetReq(urlStr, "") // Now get the Response and check it. td.CheckStatus(http.StatusOK) t.Logf("\t actualHeader: %q\n", td.Resp.Header) actualBody := td.ResponseBody() t.Logf("\t actualBody: %s\n", string(actualBody)) //TODO: Update this (right now, output is too much.) //if expectedBody != string(actualBody) { //t.Errorf("Expected the message '%s'\n", expectedBody) //} rcd.TestData(1) // "B" err = td.db.RowFind(&rcd) if err == nil { t.Fatalf("Expected Not Found error from RowFind, got ok\n") } t.Logf("TestRowDelete() - End of Test\n\n\n") }
explode_data.jsonl/78273
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 530 }
[ 2830, 3393, 2164, 15, 16, 1728, 44691, 39, 303, 19018, 3102, 6435, 1155, 353, 8840, 836, 8, 341, 262, 762, 1848, 260, 1465, 198, 262, 762, 17941, 688, 353, 83920, 36117, 15, 16, 1728, 44691, 198, 262, 762, 435, 4385, 260, 1845, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNotePagination(t *testing.T) { integration.Skip(t) table := []struct { // name of test name string // total number of notifications to request total int // number of notifications per page to test pageSize uint64 }{ { name: "check total zero", total: 0, pageSize: 1, }, { name: "check page zero", total: 5, pageSize: 0, }, { name: "check ones", total: 1, pageSize: 1, }, { name: "check odds 1", total: 3, pageSize: 7, }, { name: "check odds 2", total: 7, pageSize: 3, }, { name: "check total > page size", total: 1000, pageSize: 5, }, { name: "check total < page size", total: 5, pageSize: 1000, }, { name: "check large", total: 5000, pageSize: 1000, }, } for _, tt := range table { t.Run(tt.name, func(t *testing.T) { t.Parallel() ctx := context.Background() ctx = zlog.Test(ctx, t) _, store, _, _ := TestStore(ctx, t) noteID := uuid.New() updateID := uuid.New() manifestHash := claircore.MustParseDigest("sha256:35c102085707f703de2d9eaad8752d6fe1b8f02b5d2149f1d8357c9cc7fb7d0a") notes := make([]notifier.Notification, 0, tt.total) for i := 0; i < tt.total; i++ { notes = append(notes, notifier.Notification{ Manifest: manifestHash, Reason: "added", }) } t.Logf("inserting %v notes", len(notes)) err := store.PutNotifications(ctx, notifier.PutOpts{ Updater: "test-updater", NotificationID: noteID, Notifications: notes, UpdateID: updateID, }) if err != nil { t.Fatalf("failed to insert notifications: %v", err) } var inPage = notifier.Page{ Size: tt.pageSize, } total := []notifier.Notification{} returned, outPage, err := store.Notifications(ctx, noteID, &inPage) total = append(total, returned...) for outPage.Next != nil { if err != nil { t.Fatalf("failed to retreive initial page: %v", err) } if outPage.Size != tt.pageSize { t.Fatalf("got: %v, want: %v", outPage.Size, tt.pageSize) } if uint64(len(returned)) > tt.pageSize { t.Fatalf("got: %v, want: %v", len(returned), tt.pageSize) } returned, outPage, err = store.Notifications(ctx, noteID, &outPage) total = append(total, returned...) } if len(total) != tt.total { t.Fatalf("got: %v, want: %v", len(total), tt.total) } }) } }
explode_data.jsonl/76739
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1188 }
[ 2830, 3393, 9112, 44265, 1155, 353, 8840, 836, 8, 341, 2084, 17376, 57776, 1155, 692, 26481, 1669, 3056, 1235, 341, 197, 197, 322, 829, 315, 1273, 198, 197, 11609, 914, 198, 197, 197, 322, 2790, 1372, 315, 21969, 311, 1681, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestParsingEmptyList(t *testing.T) { buf := bytes.NewBufferString("[]") p := &JSONEventParser{} evs, err := p.Parse(buf) assert.NoError(t, err) assert.Len(t, evs, 0) }
explode_data.jsonl/10879
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 68839, 3522, 852, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 5820, 7121, 4095, 703, 445, 1294, 5130, 3223, 1669, 609, 5370, 1556, 6570, 16094, 74837, 82, 11, 1848, 1669, 281, 8937, 10731, 340, 6948, 35699, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestMarshalingQuorumCertToProto(t *testing.T) { qc1 := data.CreateQuorumCert(&testBlock) pc1, _ := data.CreatePartialCert(0, &pk, &testBlock) qc1.AddPartial(pc1) pqc := QuorumCertToProto(qc1) qc2 := pqc.FromProto() if !bytes.Equal(qc1.BlockHash[:], qc2.BlockHash[:]) { t.Errorf("Hashes don't match! Got %v, want: %v\n", hex.EncodeToString(qc2.BlockHash[:]), hex.EncodeToString(qc1.BlockHash[:])) } if !data.VerifyQuorumCert(&simpleRc, qc2) { t.Errorf("Cert failed to verify!\n") } }
explode_data.jsonl/69358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 236 }
[ 2830, 3393, 79712, 6132, 2183, 33006, 36934, 1249, 31549, 1155, 353, 8840, 836, 8, 341, 18534, 66, 16, 1669, 821, 7251, 2183, 33006, 36934, 2099, 1944, 4713, 340, 82013, 16, 11, 716, 1669, 821, 7251, 37314, 36934, 7, 15, 11, 609, 2081...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewFunction(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() cons, _ := ctx.Eval(`(function(){ this.x = 1; })`, "") obj, err := cons.New() if err != nil { t.Fatal(err) } res, err := obj.Get("x") if err != nil { t.Fatal(err) } else if num := res.Int64(); num != 1 { t.Errorf("Expected 1, got %v (%v)", num, res) } }
explode_data.jsonl/81561
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 3564, 5152, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 741, 197, 6254, 11, 716, 1669, 5635, 5142, 831, 5809, 7, 1688, 11895, 419, 1993, 284, 220, 16, 26, 6413, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultipleAssignmentsGetAssignments(t *testing.T) { a := assert.New(t) var ( DefaultFleetAssignmentID1 = DefaultFleetAssignmentID + "-1" DefaultFleetAssignmentID2 = DefaultFleetAssignmentID + "-2" DefaultFleetAssignmentID3 = DefaultFleetAssignmentID + "-3" DefaultFleetEventID1 = DefaultFleetEventID + "-1" DefaultFleetEventID2 = DefaultFleetEventID + "-2" DefaultFleetEventID3 = DefaultFleetEventID + "-3" DefaultFleetVehicleID1 = DefaultFleetVehicleID + "-1" DefaultFleetVehicleID2 = DefaultFleetVehicleID + "-2" DefaultFleetVehicleID3 = DefaultFleetVehicleID + "-3" DefaultFleetMissionID1 = DefaultFleetMissionID + "-1" DefaultFleetMissionID2 = DefaultFleetMissionID + "-2" DefaultFleetMissionID3 = DefaultFleetMissionID + "-3" ) service := assignFleetServiceMock{} assignments := []assignmentMock{ { ID: DefaultFleetID, EventID: DefaultFleetEventID1, AssignmentID: DefaultFleetAssignmentID1, VehicleID: DefaultFleetVehicleID1, MissionID: DefaultFleetMissionID1, }, { ID: DefaultFleetID, EventID: DefaultFleetEventID2, AssignmentID: DefaultFleetAssignmentID2, VehicleID: DefaultFleetVehicleID2, MissionID: DefaultFleetMissionID2, }, { ID: DefaultFleetID, EventID: DefaultFleetEventID3, AssignmentID: DefaultFleetAssignmentID3, VehicleID: DefaultFleetVehicleID3, MissionID: DefaultFleetMissionID3, }, } service.On("GetAssignments", mock.Anything, mock.Anything).Return(assignments, nil) app := app.Application{ Services: app.Services{ AssignFleet: &service, }, } grpc := NewGrpcServer(app) request := &skysign_proto.GetAssignmentsRequest{ Id: DefaultFleetID, } response, err := grpc.GetAssignments( nil, request, ) expectResponse := &skysign_proto.GetAssignmentsResponse{ Id: DefaultFleetID, Assignments: []*skysign_proto.Assignment{ { Id: DefaultFleetEventID1, AssignmentId: DefaultFleetAssignmentID1, VehicleId: DefaultFleetVehicleID1, MissionId: DefaultFleetMissionID1, }, { Id: DefaultFleetEventID2, AssignmentId: DefaultFleetAssignmentID2, VehicleId: DefaultFleetVehicleID2, MissionId: DefaultFleetMissionID2, }, { Id: DefaultFleetEventID3, AssignmentId: DefaultFleetAssignmentID3, VehicleId: DefaultFleetVehicleID3, MissionId: DefaultFleetMissionID3, }, }, } a.Nil(err) a.Equal(response, expectResponse) }
explode_data.jsonl/58071
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1114 }
[ 2830, 3393, 32089, 28933, 1368, 1949, 28933, 1368, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 692, 2405, 2399, 197, 91084, 37, 18973, 41613, 915, 16, 284, 7899, 37, 18973, 41613, 915, 488, 6523, 16, 698, 197, 91084, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDestroy(t *testing.T) { t.Parallel() sessionManager := New() mux := http.NewServeMux() mux.HandleFunc("/put", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { sessionManager.Put(r.Context(), "foo", "bar") })) mux.HandleFunc("/destroy", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { err := sessionManager.Destroy(r.Context()) if err != nil { http.Error(w, err.Error(), 500) return } })) mux.HandleFunc("/get", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { v := sessionManager.Get(r.Context(), "foo") if v == nil { http.Error(w, "foo does not exist in session", 500) return } w.Write([]byte(v.(string))) })) ts := newTestServer(t, sessionManager.LoadAndSave(mux)) defer ts.Close() ts.execute(t, "/put") header, _ := ts.execute(t, "/destroy") cookie := header.Get("Set-Cookie") if strings.HasPrefix(cookie, fmt.Sprintf("%s=;", sessionManager.Cookie.Name)) == false { t.Fatalf("got %q: expected prefix %q", cookie, fmt.Sprintf("%s=;", sessionManager.Cookie.Name)) } if strings.Contains(cookie, "Expires=Thu, 01 Jan 1970 00:00:01 GMT") == false { t.Fatalf("got %q: expected to contain %q", cookie, "Expires=Thu, 01 Jan 1970 00:00:01 GMT") } if strings.Contains(cookie, "Max-Age=0") == false { t.Fatalf("got %q: expected to contain %q", cookie, "Max-Age=0") } _, body := ts.execute(t, "/get") if body != "foo does not exist in session\n" { t.Errorf("want %q; got %q", "foo does not exist in session\n", body) } }
explode_data.jsonl/454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 603 }
[ 2830, 3393, 14245, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 25054, 2043, 1669, 1532, 2822, 2109, 2200, 1669, 1758, 7121, 60421, 44, 2200, 741, 2109, 2200, 63623, 4283, 628, 497, 1758, 89164, 18552, 3622, 1758, 37508, 11, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWithdrawInternationalBank(t *testing.T) { p.SetDefaults() TestSetup(t) if areTestAPIKeysSet() && !canManipulateRealOrders { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } var withdrawFiatRequest = exchange.WithdrawRequest{} _, err := p.WithdrawFiatFundsToInternationalBank(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) } }
explode_data.jsonl/23577
{ "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, 92261, 33646, 25828, 1155, 353, 8840, 836, 8, 341, 3223, 4202, 16273, 741, 73866, 21821, 1155, 692, 743, 525, 2271, 7082, 8850, 1649, 368, 1009, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 7082, 6894, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestViperUnmarshal(t *testing.T) { var err error cfg := &lib.CAConfig{} vp := viper.New() vp.SetConfigFile("../testdata/testviperunmarshal.yaml") err = vp.ReadInConfig() if err != nil { t.Errorf("Failed to read config file: %s", err) } sliceFields := []string{ "db.tls", } err = ViperUnmarshal(cfg, sliceFields, vp) if err == nil { t.Error("Should have resulted in an error, as tls can't be casted to type string array") } sliceFields = []string{ "db.tls.certfiles", } err = ViperUnmarshal(cfg, sliceFields, vp) if err != nil { t.Error("Failed to correctly process valid path to be type string array: ", err) } }
explode_data.jsonl/75464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 53, 12858, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 271, 50286, 1669, 609, 2740, 727, 32, 2648, 16094, 5195, 79, 1669, 95132, 7121, 741, 5195, 79, 4202, 2648, 1703, 17409, 92425, 12697, 85, 12858, 359, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSearchArchive(t *testing.T) { if len(os.Getenv("API_KEY")) == 0 { t.Skip("API_KEY required") return } setup() parameter := map[string]string{ "api_key": os.Getenv("API_KEY"), "q": "Coffee", "location": "Portland"} client := NewGoogleSearch(parameter) rsp, err := client.GetJSON() if err != nil { t.Error("unexpected error", err) return } searchID := rsp.SearchMetadata.ID if len(searchID) == 0 { t.Error("search_metadata.id must be defined") } searchArchive, err := client.GetSearchArchive(searchID) if err != nil { t.Error(err) return } if searchArchive.SearchMetadata.ID != searchID { t.Error("search_metadata.id do not match", searchArchive.SearchMetadata.ID, searchID) } }
explode_data.jsonl/19469
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 5890, 42502, 1155, 353, 8840, 836, 8, 341, 743, 2422, 9638, 64883, 445, 7082, 6600, 2761, 621, 220, 15, 341, 197, 3244, 57776, 445, 7082, 6600, 2567, 1138, 197, 853, 198, 197, 630, 84571, 741, 197, 16181, 1669, 2415, 14032...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMakeSecrets(t *testing.T) { ctx := TestContextWithLogger(t) ctx = config.ToContext(ctx, &config.Config{ Istio: &config.Istio{ IngressGateways: []config.Gateway{{ GatewayName: "test-gateway", // The namespace of Istio gateway service is istio-system. ServiceURL: "istio-ingressgateway.istio-system.svc.cluster.local", }}, }, }) cases := []struct { name string originSecret *corev1.Secret expected []*corev1.Secret }{{ name: "target secret namespace (istio-system) is the same as the origin secret namespace (istio-system).", originSecret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "test-secret", Namespace: "istio-system", UID: "1234", }, Data: map[string][]byte{ "test-data": []byte("abcd"), }}, expected: []*corev1.Secret{}, }, { name: "target secret namespace (istio-system) is different from the origin secret namespace (knative-serving).", originSecret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "test-secret", Namespace: "knative-serving", UID: "1234", }, Data: map[string][]byte{ "test-data": []byte("abcd"), }}, expected: []*corev1.Secret{{ ObjectMeta: metav1.ObjectMeta{ // Name is generated by TargetSecret function. Name: "ingress-1234", // Expected secret should be in istio-system which is // the ns of Istio gateway service. Namespace: "istio-system", Labels: map[string]string{ networking.OriginSecretNameLabelKey: "test-secret", networking.OriginSecretNamespaceLabelKey: "knative-serving", }, OwnerReferences: []metav1.OwnerReference{*kmeta.NewControllerRef(&ci)}, }, Data: map[string][]byte{ "test-data": []byte("abcd"), }, }}, }} for _, c := range cases { t.Run(c.name, func(t *testing.T) { originSecrets := map[string]*corev1.Secret{ fmt.Sprintf("%s/%s", c.originSecret.Namespace, c.originSecret.Name): c.originSecret, } secrets := MakeSecrets(ctx, originSecrets, &ci) if diff := cmp.Diff(c.expected, secrets); diff != "" { t.Errorf("Unexpected secrets (-want, +got): %v", diff) } }) } }
explode_data.jsonl/18884
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 921 }
[ 2830, 3393, 8078, 19773, 82, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 3393, 1972, 2354, 7395, 1155, 340, 20985, 284, 2193, 3274, 1972, 7502, 11, 609, 1676, 10753, 515, 197, 24486, 267, 815, 25, 609, 1676, 2447, 267, 815, 515, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestClusterConfig_translateAddressAndPort_EmptyAddr(t *testing.T) { cfg := NewCluster() cfg.AddressTranslator = staticAddressTranslator(net.ParseIP("10.10.10.10"), 5432) newAddr, newPort := cfg.translateAddressPort(net.IP([]byte{}), 0) assertTrue(t, "translated address is still empty", len(newAddr) == 0) assertEqual(t, "translated port", 0, newPort) }
explode_data.jsonl/36656
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 28678, 2648, 66381, 4286, 3036, 7084, 76060, 1595, 13986, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 1532, 28678, 741, 50286, 26979, 51653, 284, 1099, 4286, 51653, 30723, 8937, 3298, 445, 16, 15, 13, 16, 15, 13, 16, 15, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDft01(tst *testing.T) { //verbose() chk.PrintTitle("Dft01. FFT") // forward dft x := []complex128{1 + 2i, 3 + 4i, 5 + 6i, 7 + 8i} X := make([]complex128, len(x)) copy(X, x) Dft1d(X, false) // check Xref := dft1dslow(x) chk.ArrayC(tst, "X = DFT[x] = Xref", 1e-14, X, Xref) // inverse dft Y := make([]complex128, len(x)) copy(Y, X) Dft1d(Y, true) // divide by N n := complex(float64(len(Y)), 0) for i := 0; i < len(Y); i++ { Y[i] /= n } // check chk.ArrayC(tst, "inverse: Y/N = x", 1e-14, Y, x) }
explode_data.jsonl/43537
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 277 }
[ 2830, 3393, 35, 723, 15, 16, 1155, 267, 353, 8840, 836, 8, 1476, 197, 322, 14883, 741, 23049, 74, 7918, 3851, 445, 35, 723, 15, 16, 13, 60036, 5130, 197, 322, 4637, 294, 723, 198, 10225, 1669, 3056, 23247, 16, 17, 23, 90, 16, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResourcesGetMatch(t *testing.T) { c := qt.New(t) spec := newTestResourceSpec(specDescriptor{c: c}) resources := resource.Resources{ spec.newGenericResource(nil, nil, nil, "/a/foo1.css", "foo1.css", media.CSSType), spec.newGenericResource(nil, nil, nil, "/a/logo1.png", "logo1.png", pngType), spec.newGenericResource(nil, nil, nil, "/b/Logo2.png", "Logo2.png", pngType), spec.newGenericResource(nil, nil, nil, "/b/foo2.css", "foo2.css", media.CSSType), spec.newGenericResource(nil, nil, nil, "/b/foo3.css", "foo3.css", media.CSSType), spec.newGenericResource(nil, nil, nil, "/b/c/foo4.css", "c/foo4.css", media.CSSType), spec.newGenericResource(nil, nil, nil, "/b/c/foo5.css", "c/foo5.css", media.CSSType), spec.newGenericResource(nil, nil, nil, "/b/c/d/foo6.css", "c/d/foo6.css", media.CSSType), } c.Assert(resources.GetMatch("logo*").RelPermalink(), qt.Equals, "/logo1.png") c.Assert(resources.GetMatch("loGo*").RelPermalink(), qt.Equals, "/logo1.png") c.Assert(resources.GetMatch("logo2*").RelPermalink(), qt.Equals, "/Logo2.png") c.Assert(resources.GetMatch("foo2*").RelPermalink(), qt.Equals, "/foo2.css") c.Assert(resources.GetMatch("foo1*").RelPermalink(), qt.Equals, "/foo1.css") c.Assert(resources.GetMatch("foo1*").RelPermalink(), qt.Equals, "/foo1.css") c.Assert(resources.GetMatch("*/foo*").RelPermalink(), qt.Equals, "/c/foo4.css") c.Assert(resources.GetMatch("asdfasdf"), qt.IsNil) c.Assert(len(resources.Match("Logo*")), qt.Equals, 2) c.Assert(len(resources.Match("logo2*")), qt.Equals, 1) c.Assert(len(resources.Match("c/*")), qt.Equals, 2) c.Assert(len(resources.Match("**.css")), qt.Equals, 6) c.Assert(len(resources.Match("**/*.css")), qt.Equals, 3) c.Assert(len(resources.Match("c/**/*.css")), qt.Equals, 1) // Matches only CSS files in c/ c.Assert(len(resources.Match("c/**.css")), qt.Equals, 3) // Matches all CSS files below c/ (including in c/d/) c.Assert(len(resources.Match("c/**.css")), qt.Equals, 3) // Patterns beginning with a slash will not match anything. // We could maybe consider trimming that slash, but let's be explicit about this. // (it is possible for users to do a rename) // This is analogous to standing in a directory and doing "ls *.*". c.Assert(len(resources.Match("/c/**.css")), qt.Equals, 0) }
explode_data.jsonl/75614
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 940 }
[ 2830, 3393, 11277, 1949, 8331, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 38949, 7121, 1155, 340, 98100, 1669, 501, 2271, 4783, 8327, 38209, 11709, 90, 66, 25, 272, 3518, 10202, 2360, 1669, 5101, 21703, 515, 197, 98100, 4618, 19964, 4783...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPropertyAsRawType(t *testing.T) { Convey("With value raw test PropertyAsRawType", t, func() { type testCase struct { v *sfxmodel.PropertyValue exp interface{} } cases := []testCase{ { v: nil, exp: nil, }, { v: &sfxmodel.PropertyValue{ BoolValue: proto.Bool(false), }, exp: false, }, { v: &sfxmodel.PropertyValue{ IntValue: proto.Int64(123), }, exp: 123, }, { v: &sfxmodel.PropertyValue{ DoubleValue: proto.Float64(2.0), }, exp: 2.0, }, { v: &sfxmodel.PropertyValue{ StrValue: proto.String("hello"), }, exp: "hello", }, { v: &sfxmodel.PropertyValue{}, exp: nil, }, } for _, c := range cases { So(PropertyAsRawType(c.v), ShouldEqual, c.exp) } }) }
explode_data.jsonl/81469
{ "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, 3052, 2121, 20015, 929, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 2354, 897, 7112, 1273, 8655, 2121, 20015, 929, 497, 259, 11, 2915, 368, 341, 197, 13158, 54452, 2036, 341, 298, 5195, 256, 353, 82, 8298, 2528, 15727,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMockStorage(t *testing.T) { store := newStorage(nil) store.put("key1", "val1") store.put("key2", "val2") store.put("key3", "val3") val, err := store.get("key1") if err != nil || *val != "val1" { t.Errorf("mock storage get return wrong value") } valMap, err := store.getPrefix("key", false) if err != nil || !reflect.DeepEqual(valMap, map[string]string{"key1": "val1", "key2": "val2", "key3": "val3"}) { t.Errorf("mock storage get prefix return wrong value %v %v", valMap, map[string]string{"key1": "val1", "key2": "val2", "key3": "val3"}) } }
explode_data.jsonl/82206
{ "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, 11571, 5793, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 501, 5793, 27907, 340, 57279, 3597, 445, 792, 16, 497, 330, 831, 16, 1138, 57279, 3597, 445, 792, 17, 497, 330, 831, 17, 1138, 57279, 3597, 445, 792, 18, 497, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestBeego(t *testing.T) { r, _ := http.NewRequest("GET", "/", nil) w := httptest.NewRecorder() beego.BeeApp.Handlers.ServeHTTP(w, r) beego.Trace("testing", "TestBeego", "Code[%d]\n%s", w.Code, w.Body.String()) Convey("Subject: Test Station Endpoint\n", t, func() { Convey("Status Code Should Be 200", func() { So(w.Code, ShouldEqual, 200) }) Convey("The Result Should Not Be Empty", func() { So(w.Body.Len(), ShouldBeGreaterThan, 0) }) }) }
explode_data.jsonl/16279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 3430, 13243, 1155, 353, 8840, 836, 8, 341, 7000, 11, 716, 1669, 1758, 75274, 445, 3806, 497, 64657, 2092, 340, 6692, 1669, 54320, 70334, 7121, 47023, 741, 73142, 13243, 1785, 2127, 2164, 35308, 9254, 83535, 9230, 3622, 11, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInitCmdFactoryFailures(t *testing.T) { defer resetFlags() assert := assert.New(t) cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore()) assert.Nil(err) // failure validating peer connection parameters resetFlags() peerAddresses = []string{"peer0", "peer1"} tlsRootCertFiles = []string{"cert0", "cert1"} cf, err := InitCmdFactory("query", true, false, cryptoProvider) assert.Error(err) assert.Contains(err.Error(), "error validating peer connection parameters: 'query' command can only be executed against one peer") assert.Nil(cf) // failure - no peers supplied and endorser client is needed resetFlags() peerAddresses = []string{} cf, err = InitCmdFactory("query", true, false, cryptoProvider) assert.Error(err) assert.Contains(err.Error(), "no endorser clients retrieved") assert.Nil(cf) // failure - orderer client is needed, ordering endpoint is empty and no // endorser client supplied resetFlags() peerAddresses = nil cf, err = InitCmdFactory("invoke", false, true, cryptoProvider) assert.Error(err) assert.Contains(err.Error(), "no ordering endpoint or endorser client supplied") assert.Nil(cf) }
explode_data.jsonl/46376
{ "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, 3803, 15613, 4153, 19524, 1413, 1155, 353, 8840, 836, 8, 341, 16867, 7585, 9195, 741, 6948, 1669, 2060, 7121, 1155, 692, 1444, 9444, 5179, 11, 1848, 1669, 2021, 7121, 3675, 15352, 4449, 2354, 6608, 63373, 58902, 7121, 43344, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestActionEnums(t *testing.T) { t.Parallel() for _, enum := range pluginEventValues() { enum := enum t.Run(enum.String()+" matches existing client messages", func(t *testing.T) { t.Parallel() _, err := client.ClientMessageTypeString(enum.String()) if err != nil { t.Errorf("action type of %v not found as client message type", enum) } }) } }
explode_data.jsonl/26486
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 2512, 71586, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2023, 8358, 7618, 1669, 2088, 9006, 1556, 6227, 368, 341, 197, 37777, 1669, 7618, 198, 197, 3244, 16708, 64545, 6431, 25589, 9071, 6350, 2943, 6605, 497, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCT_OMathParaPrMarshalUnmarshal(t *testing.T) { v := math.NewCT_OMathParaPr() buf, _ := xml.Marshal(v) v2 := math.NewCT_OMathParaPr() xml.Unmarshal(buf, v2) }
explode_data.jsonl/54222
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 1162, 83169, 587, 30205, 3533, 55438, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 6888, 7121, 1162, 83169, 587, 30205, 3533, 741, 26398, 11, 716, 1669, 8396, 37271, 3747, 340, 5195, 17, 1669, 6888, 7121, 1162, 831...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSpecArg(t *testing.T) { var s *string init := func(c *Cmd) { s = c.StringArg("ARG", "", "") } spec := "ARG" okCmd(t, spec, init, []string{"value"}) require.Equal(t, "value", *s) badCases := [][]string{ {}, {"-g"}, {"-f", "xxx"}, {"xxx", "-f"}, } for _, args := range badCases { failCmd(t, spec, init, args) } }
explode_data.jsonl/23923
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 8327, 2735, 1155, 353, 8840, 836, 8, 341, 2405, 274, 353, 917, 198, 28248, 1669, 2915, 1337, 353, 15613, 8, 341, 197, 1903, 284, 272, 6431, 2735, 445, 7581, 497, 7342, 14676, 197, 532, 98100, 1669, 330, 7581, 698, 59268, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIPolUpgrade(t *testing.T) { // default policy, this should succeed testIPolUpgrade(t, "", true) // policy involving an unknown ORG, this should fail testIPolUpgrade(t, "AND('ORG.admin')", false) }
explode_data.jsonl/9391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 3393, 3298, 337, 43861, 1155, 353, 8840, 836, 8, 341, 197, 322, 1638, 4842, 11, 419, 1265, 11996, 198, 18185, 3298, 337, 43861, 1155, 11, 7342, 830, 340, 197, 322, 4842, 15860, 458, 9788, 2726, 38, 11, 419, 1265, 3690, 198, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestMapProxy_ReplaceWithNilValue(t *testing.T) { _, err := mp.Replace("test", nil) AssertErrorNotNil(t, err, "replace did not return an error for nil value") mp.Clear() }
explode_data.jsonl/56999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 66 }
[ 2830, 3393, 2227, 16219, 62, 23107, 2354, 19064, 1130, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10490, 20858, 445, 1944, 497, 2092, 340, 18017, 1454, 96144, 1155, 11, 1848, 11, 330, 8156, 1521, 537, 470, 458, 1465, 369, 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
func TestWriteJSON(t *testing.T) { s := testStruct{ Field1: 123, Field2: "Hello World!", } expectWrite := []byte("{\"field_1\":123,\"field_2\":\"Hello World!\"}\n") rec := httptest.NewRecorder() WriteJSON(t, rec, s) data, err := ioutil.ReadAll(rec.Body) require.NoError(t, err) assert.Equal(t, expectWrite, data) assert.Equal(t, http.Header{ "Content-Type": {"application/json"}, }, rec.Header()) }
explode_data.jsonl/73731
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 7985, 5370, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1273, 9422, 515, 197, 94478, 16, 25, 220, 16, 17, 18, 345, 197, 94478, 17, 25, 330, 9707, 4337, 33436, 197, 630, 24952, 7985, 1669, 3056, 3782, 99141, 2566, 62, 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 TestMarshalRegexSerde(t *testing.T) { r := RegexSerde{regexp.MustCompile(`(?i)^I approve\s*(?P<version>\S*)`)} var buf bytes.Buffer e := json.NewEncoder(&buf) e.SetEscapeHTML(false) err := e.Encode(r) if err != nil { t.Fatal("Unable to marshal regex serde", err) } s := string(bytes.TrimSpace(buf.Bytes())) if s != `"(?i)^I approve\\s*(?P<version>\\S*)"` { t.Error("marshal regex serde did not yield expected result", s) } }
explode_data.jsonl/56833
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 55438, 32464, 31745, 450, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 26146, 31745, 450, 90, 55796, 98626, 5809, 33294, 72, 29776, 40, 28151, 32407, 6599, 30, 47, 27, 4366, 8449, 50, 3764, 63, 10569, 2405, 6607, 5820, 22622, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsScaleTargetInitialized(t *testing.T) { p := PodAutoscaler{} if got, want := p.Status.IsScaleTargetInitialized(), false; got != want { t.Errorf("before marking initially active: got: %v, want: %v", got, want) } p.Status.MarkScaleTargetInitialized() if got, want := p.Status.IsScaleTargetInitialized(), true; got != want { t.Errorf("after marking initially active: got: %v, want: %v", got, want) } }
explode_data.jsonl/27243
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 3872, 6947, 6397, 22495, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 16821, 19602, 436, 63084, 16094, 743, 2684, 11, 1366, 1669, 281, 10538, 4506, 6947, 6397, 22495, 1507, 895, 26, 2684, 961, 1366, 341, 197, 3244, 13080, 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 TestUnionComplexity(t *testing.T) { assert := assert.New(t) vs := newTestValueStore() numSets := 256 numElemsPerSet := 1000 logNumSets := int(math.Ceil(math.Log2(float64(numSets)))) totalElems := numSets * numElemsPerSet expectedMax := logNumSets*totalElems + numSets callCount1 := 0 itrs, err := createSetsWithDistinctNumbers(vs, numSets, numElemsPerSet) assert.NoError(err) iter, err := iterize(itrs, NewUnionTestIterator, &callCount1) assert.NoError(err) vals, err := iterToSlice(iter) assert.NoError(err) expected := generateNumbersAsValueSlice(numSets * numElemsPerSet) assert.True(expected.Equals(vals), "expected: %v != actual: %v", expected, vals) assert.True(expectedMax > callCount1, "callCount: %d exceeds expectedMax: %d", callCount1, expectedMax) callCount2 := 0 itrs, err = createSetsWithSameNumbers(vs, numSets, numElemsPerSet) assert.NoError(err) iter, err = iterize(itrs, NewUnionTestIterator, &callCount2) assert.NoError(err) vals, err = iterToSlice(iter) assert.NoError(err) expected = generateNumbersAsValueSlice(numElemsPerSet) assert.True(expected.Equals(vals), "expected: %v != actual: %v", expected, vals) assert.True(expectedMax > callCount2, "callCount: %d exceeds expectedMax: %d", callCount2, expectedMax) }
explode_data.jsonl/11001
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 463 }
[ 2830, 3393, 32658, 31137, 487, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 5195, 82, 1669, 501, 2271, 1130, 6093, 2822, 22431, 30175, 1669, 220, 17, 20, 21, 198, 22431, 36, 39616, 3889, 1649, 1669, 220, 16, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWalkTree(t *testing.T) { _, file, _, _ := runtime.Caller(0) ctx := context.Background() t.Run("CanceledContext", func(t *testing.T) { tctx, cancel := context.WithCancel(ctx) cancel() out, err := walkLocalTree(tctx, filepath.Dir(file)) assert.Error(t, err) assert.Nil(t, out) }) t.Run("MissingPath", func(t *testing.T) { out, err := walkLocalTree(ctx, "") assert.NoError(t, err) assert.Nil(t, out) }) t.Run("WorkingExample", func(t *testing.T) { out, err := walkLocalTree(ctx, filepath.Dir(file)) assert.NoError(t, err) assert.NotNil(t, out) }) }
explode_data.jsonl/6761
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 48849, 6533, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1034, 11, 8358, 716, 1669, 15592, 727, 13956, 7, 15, 340, 20985, 1669, 2266, 19047, 2822, 3244, 16708, 445, 63263, 1972, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetLiferayHomeRelease6_1Ga1(t *testing.T) { release := Release{Tag: "6.1-ce-ga1-tomcat-hsql"} assert := assert.New(t) assert.Equal("/usr/local/liferay-portal-6.1.0-ce-ga1", release.GetLiferayHome()) }
explode_data.jsonl/11708
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 1949, 43, 33204, 7623, 16077, 21, 62, 16, 80788, 16, 1155, 353, 8840, 836, 8, 341, 17200, 1623, 1669, 17381, 90, 5668, 25, 330, 21, 13, 16, 53212, 2371, 64, 16, 2385, 316, 4616, 2832, 3544, 63159, 6948, 1669, 2060, 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...
1
func TestEventWriting(t *testing.T) { kubelet, fakeEtcd, _ := makeTestKubelet(t) expectedEvent := api.Event{ Event: "test", Container: &api.Container{ Name: "foo", }, } err := kubelet.LogEvent(&expectedEvent) if err != nil { t.Errorf("unexpected error: %v", err) } if fakeEtcd.Ix != 1 { t.Errorf("Unexpected number of children added: %d, expected 1", fakeEtcd.Ix) } response, err := fakeEtcd.Get("/events/foo/1", false, false) if err != nil { t.Errorf("unexpected error: %v", err) } var event api.Event err = json.Unmarshal([]byte(response.Node.Value), &event) if err != nil { t.Errorf("unexpected error: %v", err) } if event.Event != expectedEvent.Event || event.Container.Name != expectedEvent.Container.Name { t.Errorf("Event's don't match. Expected: %#v Saw: %#v", expectedEvent, event) } }
explode_data.jsonl/2835
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 335 }
[ 2830, 3393, 1556, 39313, 1155, 353, 8840, 836, 8, 341, 16463, 3760, 1149, 11, 12418, 31860, 4385, 11, 716, 1669, 1281, 2271, 42, 3760, 1149, 1155, 340, 42400, 1556, 1669, 6330, 6904, 515, 197, 56055, 25, 330, 1944, 756, 197, 197, 4502...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigureRBDStats(t *testing.T) { var ( s = runtime.NewScheme() context = &clusterd.Context{} namespace = "rook-ceph" ) executor := &exectest.MockExecutor{ MockExecuteCommandWithTimeout: func(timeout time.Duration, command string, args ...string) (string, error) { logger.Infof("Command: %s %v", command, args) if args[0] == "config" && args[2] == "mgr." && args[3] == "mgr/prometheus/rbd_stats_pools" { if args[1] == "set" && args[4] != "" { return "", nil } if args[1] == "get" { return "", nil } if args[1] == "rm" { return "", nil } } return "", errors.Errorf("unexpected arguments %q", args) }, } context.Executor = executor context.Client = fake.NewClientBuilder().WithScheme(s).Build() clusterInfo := cephclient.AdminTestClusterInfo(namespace) // Case 1: CephBlockPoolList is not registered in scheme. // So, an error is expected as List() operation would fail. err := configureRBDStats(context, clusterInfo) assert.NotNil(t, err) s.AddKnownTypes(cephv1.SchemeGroupVersion, &cephv1.CephBlockPoolList{}) // Case 2: CephBlockPoolList is registered in schema. // So, no error is expected. err = configureRBDStats(context, clusterInfo) assert.Nil(t, err) s.AddKnownTypes(cephv1.SchemeGroupVersion, &cephv1.CephBlockPool{}) // A Pool resource with metadata and spec. poolWithRBDStatsDisabled := &cephv1.CephBlockPool{ ObjectMeta: metav1.ObjectMeta{ Name: "my-pool-without-rbd-stats", Namespace: namespace, }, Spec: cephv1.NamedBlockPoolSpec{ PoolSpec: cephv1.PoolSpec{ Replicated: cephv1.ReplicatedSpec{ Size: 3, }, }, }, } // Case 3: One CephBlockPool with EnableRBDStats:false (default). objects := []runtime.Object{ poolWithRBDStatsDisabled, } context.Client = fake.NewClientBuilder().WithScheme(s).WithRuntimeObjects(objects...).Build() err = configureRBDStats(context, clusterInfo) assert.Nil(t, err) // Case 4: Two CephBlockPools with EnableRBDStats:false & EnableRBDStats:true. poolWithRBDStatsEnabled := poolWithRBDStatsDisabled.DeepCopy() poolWithRBDStatsEnabled.Name = "my-pool-with-rbd-stats" poolWithRBDStatsEnabled.Spec.EnableRBDStats = true objects = append(objects, poolWithRBDStatsEnabled) context.Client = fake.NewClientBuilder().WithScheme(s).WithRuntimeObjects(objects...).Build() err = configureRBDStats(context, clusterInfo) assert.Nil(t, err) // Case 5: Two CephBlockPools with EnableRBDStats:false & EnableRBDStats:true. // SetConfig returns an error context.Executor = &exectest.MockExecutor{ MockExecuteCommandWithTimeout: func(timeout time.Duration, command string, args ...string) (string, error) { logger.Infof("Command: %s %v", command, args) return "", errors.New("mock error to simulate failure of mon store Set() function") }, } err = configureRBDStats(context, clusterInfo) assert.NotNil(t, err) }
explode_data.jsonl/62477
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1104 }
[ 2830, 3393, 28560, 49, 9548, 16635, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 1903, 260, 284, 15592, 7121, 28906, 741, 197, 28413, 256, 284, 609, 18855, 67, 9328, 16094, 197, 56623, 284, 330, 299, 562, 53212, 759, 698, 197, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestLs(t *testing.T) { assert := assert.New(t) ls := &subcmd.LsCmd{ Path: "foo/bar/", Page: 1, Recursive: true, } driver := NewMockDriver(t) printer := &MockPrinterImpl{} driver.MockListOrTagSearch = func(path string, postNum int, recursive bool) ([]*model.Post, bool, error) { assert.Equal("foo/bar/", path) assert.Equal(1, postNum) assert.True(recursive) return []*model.Post{ { Name: "zoo", Wip: true, Tags: []string{"tagA", "tagB"}, Category: "foo/bar", }, { Name: "baz", Wip: false, Tags: []string{"tagB"}, Category: "foo/bar", }, }, false, nil } err := ls.Run(&kasa.Context{ Driver: driver, Fmt: printer, }) assert.NoError(err) assert.Equal(`0001-01-01 12:00:00 WIP foo/bar/zoo [#tagA,#tagB] 0001-01-01 12:00:00 - foo/bar/baz [#tagB] `, printer.String()) }
explode_data.jsonl/28551
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 473 }
[ 2830, 3393, 43, 82, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 197, 4730, 1669, 609, 1966, 8710, 1214, 82, 15613, 515, 197, 69640, 25, 414, 330, 7975, 49513, 35075, 197, 65439, 25, 414, 220, 16, 345, 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...
1
func TestMongo_List(t *testing.T) { m, skip := prepMongo(t, true) // adds two comments if skip { return } // add one more for https://radio-t.com/2 comment := store.Comment{ ID: "12345", Text: `some text, <a href="http://radio-t.com">link</a>`, Timestamp: time.Date(2017, 12, 20, 15, 18, 22, 0, time.Local), Locator: store.Locator{URL: "https://radio-t.com/2", SiteID: "radio-t"}, User: store.User{ID: "user1", Name: "user name"}, } _, err := m.Create(comment) assert.Nil(t, err) ts := func(sec int) time.Time { return time.Date(2017, 12, 20, 15, 18, sec, 0, time.Local).In(time.UTC) } res, err := m.List("radio-t", 0, 0) assert.Nil(t, err) assert.Equal(t, []store.PostInfo{{URL: "https://radio-t.com/2", Count: 1, FirstTS: ts(22), LastTS: ts(22)}, {URL: "https://radio-t.com", Count: 2, FirstTS: ts(22), LastTS: ts(23)}}, res) res, err = m.List("radio-t", -1, -1) assert.Nil(t, err) assert.Equal(t, []store.PostInfo{{URL: "https://radio-t.com/2", Count: 1, FirstTS: ts(22), LastTS: ts(22)}, {URL: "https://radio-t.com", Count: 2, FirstTS: ts(22), LastTS: ts(23)}}, res) res, err = m.List("radio-t", 1, 0) assert.Nil(t, err) assert.Equal(t, []store.PostInfo{{URL: "https://radio-t.com/2", Count: 1, FirstTS: ts(22), LastTS: ts(22)}}, res) res, err = m.List("radio-t", 1, 1) assert.Nil(t, err) assert.Equal(t, []store.PostInfo{{URL: "https://radio-t.com", Count: 2, FirstTS: ts(22), LastTS: ts(23)}}, res) res, err = m.List("bad", 1, 1) assert.Nil(t, err) assert.Equal(t, []store.PostInfo{}, res) }
explode_data.jsonl/54199
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 702 }
[ 2830, 3393, 54998, 27104, 1155, 353, 8840, 836, 8, 341, 2109, 11, 10706, 1669, 21327, 54998, 1155, 11, 830, 8, 442, 11367, 1378, 6042, 198, 743, 10706, 341, 197, 853, 198, 197, 532, 197, 322, 912, 825, 803, 369, 3703, 1110, 12636, 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 Test_parseTypeMetaSkeleton(t *testing.T) { type args struct { object interface{} } tests := []struct { name string args args want interface{} wantErr bool }{ { name: "test valid but unknown object type", args: args{ object: corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "default"}}, }, want: nil, wantErr: false, }, { name: "test valid Pod type", args: args{ object: metav1.TypeMeta{Kind: "Pod"}, }, want: &corev1.Pod{}, wantErr: false, }, { name: "test valid Deployment type", args: args{ object: metav1.TypeMeta{Kind: "Deployment"}, }, want: &appsv1.Deployment{}, wantErr: false, }, { name: "test valid StatefulSet type", args: args{ object: metav1.TypeMeta{Kind: "StatefulSet"}, }, want: &appsv1.StatefulSet{}, wantErr: false, }, { name: "test valid List type", args: args{ object: metav1.TypeMeta{Kind: "List"}, }, want: &corev1.List{}, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { jb, err := json.Marshal(tt.args.object) if err != nil { t.Errorf("failed to marshal test argument to json: %v", tt.args.object) return } got, err := parseTypeMetaSkeleton(jb) if (err != nil) != tt.wantErr { t.Errorf("parseTypeMetaSkeleton() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("parseTypeMetaSkeleton() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/78920
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 736 }
[ 2830, 3393, 21039, 929, 12175, 77568, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 35798, 3749, 16094, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 50780, 262, 3749, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTableListProp_MakeValid(t *testing.T) { cases := []struct { name string tableListProp *props.TableList assert func(t *testing.T, m *props.TableList) }{ { "When HeaderProp/ContentProp is not defined", &props.TableList{ HeaderProp: props.TableListContent{}, ContentProp: props.TableListContent{}, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.HeaderProp.Size, 10.0) assert.Equal(t, m.HeaderProp.Family, consts.Arial) assert.Equal(t, m.HeaderProp.Style, consts.Bold) assert.Equal(t, len(m.HeaderProp.GridSizes), 3) assert.Equal(t, m.ContentProp.Size, 10.0) assert.Equal(t, m.ContentProp.Family, consts.Arial) assert.Equal(t, m.ContentProp.Style, consts.Normal) assert.Equal(t, len(m.ContentProp.GridSizes), 3) }, }, { "When HeaderProp.Size is 0.0", &props.TableList{ HeaderProp: props.TableListContent{ Size: 0.0, }, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.HeaderProp.Size, 10.0) }, }, { "When HeaderProp.Style is empty", &props.TableList{ HeaderProp: props.TableListContent{ Style: "", }, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.HeaderProp.Style, consts.Bold) }, }, { "When HeaderProp.Family is empty", &props.TableList{ HeaderProp: props.TableListContent{ Family: "", }, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.HeaderProp.Family, consts.Arial) }, }, { "When Align is empty", &props.TableList{ Align: "", }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.Align, consts.Left) }, }, { "When ContentProp.Size is 0.0", &props.TableList{ ContentProp: props.TableListContent{ Size: 0.0, }, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.ContentProp.Size, 10.0) }, }, { "When ContentProp.Style is empty", &props.TableList{ HeaderProp: props.TableListContent{ Style: "", }, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.ContentProp.Style, consts.Normal) }, }, { "When ContentProp.Family is empty", &props.TableList{ HeaderProp: props.TableListContent{ Family: "", }, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.ContentProp.Family, consts.Arial) }, }, { "When HeaderContentSpace is 0.0", &props.TableList{ HeaderContentSpace: 0.0, }, func(t *testing.T, m *props.TableList) { assert.Equal(t, m.HeaderContentSpace, 4.0) }, }, } for _, c := range cases { // Act c.tableListProp.MakeValid([]string{"a", "b", "c"}, [][]string{{"a", "b", "c"}}) // Assert c.assert(t, c.tableListProp) } }
explode_data.jsonl/68879
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1356 }
[ 2830, 3393, 2556, 852, 2008, 1245, 726, 4088, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 26481, 852, 2008, 353, 4761, 18257, 852, 198, 197, 6948, 286, 2915, 1155, 353, 8840, 836, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSpecIntsOpt(t *testing.T) { var f *[]int init := func(c *Cmd) { f = c.IntsOpt("f", nil, "") } spec := "-f..." cases := [][]string{ {"-f1"}, {"-f", "1"}, {"-f=1"}, } for _, args := range cases { okCmd(t, spec, init, args) require.Equal(t, []int{1}, *f) } cases = [][]string{ {"-f1", "-f", "2"}, {"-f", "1", "-f", "2"}, {"-f=1", "-f2"}, } for _, args := range cases { okCmd(t, spec, init, args) require.Equal(t, []int{1, 2}, *f) } badCases := [][]string{ {}, {"-f", "b"}, {"-f", "3", "-f", "c"}, {"-g"}, {"-f", "-g"}, {"-g", "-f"}, {"-f", "xxx"}, {"xxx", "-f"}, } for _, args := range badCases { failCmd(t, spec, init, args) } }
explode_data.jsonl/23921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 367 }
[ 2830, 3393, 8327, 1072, 82, 21367, 1155, 353, 8840, 836, 8, 341, 2405, 282, 353, 1294, 396, 198, 28248, 1669, 2915, 1337, 353, 15613, 8, 341, 197, 1166, 284, 272, 7371, 82, 21367, 445, 69, 497, 2092, 11, 14676, 197, 532, 98100, 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 Test_MailMergeFileds_GetDocumentFieldNames(t *testing.T) { config := ReadConfiguration(t) client, ctx := PrepareTest(t, config) remoteDataFolder := remoteBaseTestDataFolder + "/DocumentActions/MailMerge" remoteFileName := "TestGetDocumentFieldNames.docx" UploadNextFileToStorage(t, ctx, client, GetLocalFile("Common/test_multi_pages.docx"), remoteDataFolder + "/" + remoteFileName) options := map[string]interface{}{ "folder": remoteDataFolder, } request := &models.GetDocumentFieldNamesRequest{ Name: ToStringPointer(remoteFileName), Optionals: options, } actual, _, err := client.WordsApi.GetDocumentFieldNames(ctx, request) if err != nil { t.Error(err) } assert.NotNil(t, actual.FieldNames, "Validate GetDocumentFieldNames response."); assert.NotNil(t, actual.FieldNames.Names, "Validate GetDocumentFieldNames response."); assert.Equal(t, 0, len(actual.FieldNames.Names), "Validate GetDocumentFieldNames response."); }
explode_data.jsonl/64358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 1245, 604, 52096, 1703, 5356, 13614, 7524, 1877, 7980, 1155, 353, 8840, 836, 8, 341, 262, 2193, 1669, 4457, 7688, 1155, 340, 262, 2943, 11, 5635, 1669, 31166, 2271, 1155, 11, 2193, 340, 262, 8699, 1043, 13682, 1669, 8699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTable(t *testing.T) { for _, entry := range testData { t.Run(entry.Result, func(t *testing.T) { fs := afero.NewMemMapFs() for name, content := range entry.Files { afero.WriteFile(fs, name, []byte(content), 0644) } out, err := itpl.NewLoader().Fs(fs).Load("/entry") if err != nil { t.Errorf("got error %v", err) } else if out != entry.Result { t.Errorf("got %q, expected %q", out, entry.Result) } }) } }
explode_data.jsonl/73197
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 2556, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 4343, 1669, 2088, 67348, 341, 197, 3244, 16708, 18238, 18456, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 53584, 1669, 264, 802, 78, 7121, 18816, 2227, 48300, 741, 298, 2023...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExpandVars(t *testing.T) { const multilineWithComment = ` type ${0:Interface} interface { ${1:/* TODO: add methods */} }` const multilineWithCommentExpanded = ` type Foo interface { /* TODO: add methods */ }` for _, tt := range []struct { name string given string expected string vars stringList }{ {"two provided one default", "lala ${0} ${1} ${2:bar} bla", "lala foo fuzz bar bla", []string{"foo", "fuzz"}}, {"expanded both", "$0 - $1", "foo - bar", []string{"foo", "bar"}}, {"vars in curly brackets", "foo ${a} $b ${}", "foo ${a} $b ${}", []string{"foo", "bar"}}, {"different brackets does not break", "{} [] () ]({", "{} [] () ]({", []string{"foo", "bar"}}, {"multiline with comment", multilineWithComment, multilineWithCommentExpanded, []string{"Foo"}}, } { t.Run(tt.name, func(t *testing.T) { actual := expandVars(tt.given, tt.vars) assert.Equal(t, tt.expected, actual) }) } }
explode_data.jsonl/40129
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 397 }
[ 2830, 3393, 38946, 28305, 1155, 353, 8840, 836, 8, 341, 4777, 85218, 2354, 10677, 284, 22074, 13158, 3570, 15, 25, 5051, 92, 3749, 341, 260, 3570, 16, 25, 1057, 5343, 25, 912, 5413, 21654, 257, 335, 3989, 4777, 85218, 2354, 10677, 519...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_server_PingHandler(t *testing.T) { type fields struct { externalAlive chan bool isAlive bool isReady bool pingChannel chan bool pingInterval time.Duration updateReady chan bool server *http.Server } type args struct { method string path string } type want struct { statusCode int channel bool } tests := []struct { name string fields fields args args want want }{ { name: "PingHandler", fields: fields{pingChannel: make(chan bool)}, args: args{method: "GET", path: "/ping"}, want: want{statusCode: http.StatusOK, channel: true}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := &server{ externalAlive: tt.fields.externalAlive, isAlive: tt.fields.isAlive, isReady: tt.fields.isReady, pingChannel: tt.fields.pingChannel, pingInterval: tt.fields.pingInterval, updateReady: tt.fields.updateReady, server: tt.fields.server, } done := make(chan struct{}) go func() { defer close(done) if channel := <-s.pingChannel; channel != tt.want.channel { t.Errorf("ping channel returned wrong value: got %v want %v", channel, tt.want.channel) } }() req, err := http.NewRequest(tt.args.method, tt.args.path, nil) if err != nil { t.Fatal(err) } rr := httptest.NewRecorder() handler := http.HandlerFunc(s.PingHandler) handler.ServeHTTP(rr, req) if status := rr.Code; status != tt.want.statusCode { t.Errorf("handler returned wrong status code: got %v want %v", status, tt.want.statusCode) } <-done }) } }
explode_data.jsonl/58775
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 724 }
[ 2830, 3393, 12015, 1088, 287, 3050, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 197, 20921, 32637, 26023, 1807, 198, 197, 19907, 32637, 981, 1807, 198, 197, 19907, 19202, 981, 1807, 198, 197, 3223, 287, 9629, 256, 26023, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccDataSourceKeyValue_basicNoLabel(t *testing.T) { key := "myKey" value := "myValuesdfsdfds" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { preCheck(t) }, Providers: testProviders, Steps: []resource.TestStep{ { Config: buildTerraformConfigDataSourceKeyValue(key), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.akc_key_value.test", "id"), resource.TestCheckResourceAttrSet("data.akc_key_value.test", "endpoint"), resource.TestCheckResourceAttrSet("data.akc_key_value.test", "label"), resource.TestCheckResourceAttr("data.akc_key_value.test", "key", key), resource.TestCheckResourceAttr("data.akc_key_value.test", "value", value), ), }, }, }) }
explode_data.jsonl/9937
{ "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, 14603, 17173, 72082, 34729, 2753, 2476, 1155, 353, 8840, 836, 8, 341, 23634, 1669, 330, 2408, 1592, 698, 16309, 1669, 330, 2408, 6227, 34378, 2940, 5356, 1837, 50346, 41288, 7957, 2271, 1155, 11, 5101, 31363, 515, 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...
1
func TestReceiversBuilder_DataTypeError(t *testing.T) { factories, err := componenttest.ExampleComponents() assert.NoError(t, err) attrFactory := attributesprocessor.NewFactory() factories.Processors[attrFactory.Type()] = attrFactory cfg, err := configtest.LoadConfigFile(t, "testdata/pipelines_builder.yaml", factories) assert.NoError(t, err) // Make examplereceiver to "unsupport" trace data type. receiver := cfg.Receivers["examplereceiver"] receiver.(*componenttest.ExampleReceiver).FailTraceCreation = true // Build the pipeline allExporters, err := NewExportersBuilder(zap.NewNop(), componenttest.TestApplicationStartInfo(), cfg, factories.Exporters).Build() assert.NoError(t, err) pipelineProcessors, err := NewPipelinesBuilder(zap.NewNop(), componenttest.TestApplicationStartInfo(), cfg, allExporters, factories.Processors).Build() assert.NoError(t, err) receivers, err := NewReceiversBuilder(zap.NewNop(), componenttest.TestApplicationStartInfo(), cfg, pipelineProcessors, factories.Receivers).Build() // This should fail because "examplereceiver" is attached to "traces" pipeline // which is a configuration error. assert.NotNil(t, err) assert.Nil(t, receivers) }
explode_data.jsonl/50904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 378 }
[ 2830, 3393, 693, 346, 1945, 3297, 17817, 80076, 1155, 353, 8840, 836, 8, 341, 1166, 52893, 11, 1848, 1669, 3692, 1944, 5121, 1516, 10443, 741, 6948, 35699, 1155, 11, 1848, 692, 60943, 4153, 1669, 8201, 29474, 7121, 4153, 741, 1166, 5289...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntArray_PopRight(t *testing.T) { gtest.C(t, func(t *gtest.T) { array := garray.NewIntArrayFrom(g.SliceInt{1, 2, 3}) v, ok := array.PopRight() t.Assert(v, 3) t.Assert(ok, true) t.Assert(array.Len(), 2) v, ok = array.PopRight() t.Assert(v, 2) t.Assert(ok, true) t.Assert(array.Len(), 1) v, ok = array.PopRight() t.Assert(v, 1) t.Assert(ok, true) t.Assert(array.Len(), 0) }) }
explode_data.jsonl/47603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 95338, 1088, 453, 5979, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11923, 1669, 342, 1653, 7121, 95338, 3830, 3268, 95495, 1072, 90, 16, 11, 220, 17, 11, 220, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSlackReporterValidation(t *testing.T) { testCases := []struct { name string config func() Config successExpected bool }{ { name: "Valid config w/ slack_reporter - no error", config: func() Config { slack := &SlackReporter{ Channel: "my-channel", } return Config{ ProwConfig: ProwConfig{ SlackReporter: slack, }, } }, successExpected: true, }, { name: "Valid config w/ wildcard slack_reporter_configs - no error", config: func() Config { slackCfg := map[string]SlackReporter{ "*": { Channel: "my-channel", }, } return Config{ ProwConfig: ProwConfig{ SlackReporterConfigs: slackCfg, }, } }, successExpected: true, }, { name: "Valid config w/ org/repo slack_reporter_configs - no error", config: func() Config { slackCfg := map[string]SlackReporter{ "istio/proxy": { Channel: "my-channel", }, } return Config{ ProwConfig: ProwConfig{ SlackReporterConfigs: slackCfg, }, } }, successExpected: true, }, { name: "Valid config w/ repo slack_reporter_configs - no error", config: func() Config { slackCfg := map[string]SlackReporter{ "proxy": { Channel: "my-channel", }, } return Config{ ProwConfig: ProwConfig{ SlackReporterConfigs: slackCfg, }, } }, successExpected: true, }, { name: "Invalid config b/c both slack_reporter and slack_reporter_configs - error", config: func() Config { slack := &SlackReporter{ Channel: "my-channel", } slackCfg := map[string]SlackReporter{ "*": { Channel: "my-channel", }, } return Config{ ProwConfig: ProwConfig{ SlackReporter: slack, SlackReporterConfigs: slackCfg, }, } }, successExpected: false, }, { name: "No channel w/ slack_reporter - error", config: func() Config { slack := &SlackReporter{} return Config{ ProwConfig: ProwConfig{ SlackReporter: slack, }, } }, successExpected: false, }, { name: "No channel w/ slack_reporter_configs - error", config: func() Config { slackCfg := map[string]SlackReporter{ "*": { JobTypesToReport: []prowapi.ProwJobType{"presubmit"}, }, } return Config{ ProwConfig: ProwConfig{ SlackReporterConfigs: slackCfg, }, } }, successExpected: false, }, { name: "Empty config - no error", config: func() Config { slackCfg := map[string]SlackReporter{} return Config{ ProwConfig: ProwConfig{ SlackReporterConfigs: slackCfg, }, } }, successExpected: true, }, { name: "Invalid template - error", config: func() Config { slackCfg := map[string]SlackReporter{ "*": { Channel: "my-channel", ReportTemplate: "{{ if .Spec.Name}}", }, } return Config{ ProwConfig: ProwConfig{ SlackReporterConfigs: slackCfg, }, } }, successExpected: false, }, { name: "Template accessed invalid property - error", config: func() Config { slackCfg := map[string]SlackReporter{ "*": { Channel: "my-channel", ReportTemplate: "{{ .Undef}}", }, } return Config{ ProwConfig: ProwConfig{ SlackReporterConfigs: slackCfg, }, } }, successExpected: false, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { cfg := tc.config() if err := cfg.validateComponentConfig(); (err == nil) != tc.successExpected { t.Errorf("Expected success=%t but got err=%v", tc.successExpected, err) } if tc.successExpected { for _, config := range cfg.SlackReporterConfigs { if config.ReportTemplate == "" { t.Errorf("expected default ReportTemplate to be set") } if config.Channel == "" { t.Errorf("expected Channel to be required") } } } }) } }
explode_data.jsonl/8088
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1935 }
[ 2830, 3393, 7442, 473, 52766, 13799, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 25873, 688, 2915, 368, 5532, 198, 197, 30553, 18896, 1807, 198, 197, 59403, 197, 197, 515, 298, 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 TestRequestWithArguments(t *testing.T) { assert := assert.New(t) params := []string{"Khadgar"} options := map[string]string{"locale": "en_GB", "jsonp": "callback"} r := resource{Region: "eu", Endpoint: "wow/auction/data/", Params: params, Options: options} request, _ := r.buildRequest() expectedURL := "https://eu.api.battle.net/wow/auction/data/Khadgar?jsonp=callback&locale=en_GB" assert.Equal(expectedURL, request.URL.String()) }
explode_data.jsonl/20031
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 1900, 2354, 19139, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 25856, 1669, 3056, 917, 4913, 42, 31245, 12164, 16707, 35500, 1669, 2415, 14032, 30953, 4913, 14484, 788, 330, 268, 98631, 497, 330, 57045, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServerFwd(t *testing.T) { data := "this #@ THE_data" s := startTestServer(t) rch := make(chan readerDone) s.putFwd("abc.xyz", rch) done := make(chan struct{}) go func() { rd := <-rch b, err := ioutil.ReadAll(rd.r) close(rd.done) if err != nil { t.Errorf("error while reading body: %v", err) } if string(b) != data { t.Errorf("expected %q, got %q", data, b) } close(done) }() var client http.Client var url = fmt.Sprintf("http://localhost:%d/abc.xyz", s.port) req, err := http.NewRequest("PUT", url, bytes.NewBufferString(data)) if err != nil { t.Errorf("unexpected error building request: %v", err) } resp, err := client.Do(req) if err != nil { t.Errorf("unexpected error PUT-ing data: %v", err) } if resp.StatusCode != http.StatusOK { t.Errorf("unexpected status PUT-ing data: %v", resp.Status) } <-done s.rmFwd("abc.xyz") req, err = http.NewRequest("PUT", url, bytes.NewBufferString(data)) if err != nil { t.Errorf("unexpected error building request: %v", err) } resp, err = client.Do(req) if err != nil { t.Errorf("unexpected error PUT-ing data: %v", err) } if resp.StatusCode == http.StatusOK { t.Errorf("unexpected status PUT-ing data: %v", resp.Status) } s.s.Stop() }
explode_data.jsonl/19962
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 524 }
[ 2830, 3393, 5475, 37, 6377, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 330, 574, 91027, 3168, 1769, 698, 1903, 1669, 1191, 2271, 5475, 1155, 340, 7000, 331, 1669, 1281, 35190, 6604, 17453, 340, 1903, 3597, 37, 6377, 445, 13683, 55699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddSequencedLeavesUnordered(t *testing.T) { ctx := context.Background() const ( chunk = leavesToInsert count = chunk * 5 extraCount = 16 ) leaves := createTestLeaves(count, 0) aslt := initAddSequencedLeavesTest(t) mustSignAndStoreLogRoot(ctx, aslt.t, aslt.s, aslt.tree, 0) for _, idx := range []int{1, 0, 4, 2} { aslt.addSequencedLeaves(leaves[chunk*idx : chunk*(idx+1)]) } aslt.verifySequencedLeaves(0, count+extraCount, leaves[:chunk*3]) aslt.verifySequencedLeaves(chunk*4, chunk+extraCount, leaves[chunk*4:count]) aslt.addSequencedLeaves(leaves[chunk*3 : chunk*4]) aslt.verifySequencedLeaves(0, count+extraCount, leaves) }
explode_data.jsonl/30679
{ "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, 2212, 1514, 446, 5767, 2304, 4693, 1806, 10544, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 4777, 2399, 197, 23049, 3122, 414, 284, 10901, 1249, 13780, 198, 197, 18032, 414, 284, 11879, 353, 220, 20, 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...
2
func Test_verifyToken_InvalidToken(t *testing.T) { t.Parallel() rec, storer, _ := testSetup() storer.Users["a"] = authboss.Attributes{ StoreRecoverToken: testStdBase64Token, } ctx := rec.Authboss.NewContext() req, _ := http.NewRequest("GET", "/?token=asdf", nil) if _, err := verifyToken(ctx, req); err != authboss.ErrUserNotFound { t.Error("Unexpected error:", err) } }
explode_data.jsonl/61508
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 35638, 3323, 62, 7928, 3323, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 67904, 11, 357, 14827, 11, 716, 1669, 1273, 21821, 741, 18388, 14827, 36782, 1183, 64, 1341, 284, 4166, 33314, 31384, 515, 197, 197, 6093, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateSCMigrationSuccess(t *testing.T) { // given suite := NewBrokerSuiteTest(t) mockBTPOperatorClusterID() defer suite.TearDown() id := "InstanceID-SCMigration" resp := suite.CallAPI("PUT", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true&plan_id=7d55d31d-35ae-4438-bf13-6ffdfa107d9f&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281", id), ` { "service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", "plan_id": "7d55d31d-35ae-4438-bf13-6ffdfa107d9f", "context": { "sm_platform_credentials": { "url": "https://sm.url", "credentials": { "basic": { "username": "u-name", "password": "pass" } } }, "globalaccount_id": "g-account-id", "subaccount_id": "sub-id", "user_id": "john.smith@email.com" }, "parameters": { "name": "testing-cluster", "kymaVersion": "2.0" } }`) opID := suite.DecodeOperationID(resp) suite.processReconcilingByOperationID(opID) suite.WaitForOperationState(opID, domain.Succeeded) i, err := suite.db.Instances().GetByID(id) assert.NoError(t, err, "getting instance after provisioning, before update") rs, err := suite.db.RuntimeStates().GetLatestWithReconcilerInputByRuntimeID(i.RuntimeID) if rs.ClusterSetup == nil { t.Fatal("expected cluster setup post provisioning kyma 2.0 cluster") } if rs.ClusterSetup.KymaConfig.Version != "2.0" { t.Fatalf("expected cluster setup kyma config version to match 2.0, got %v", rs.ClusterSetup.KymaConfig.Version) } assert.Equal(t, opID, rs.OperationID, "runtime state provisioning operation ID") assert.NoError(t, err, "getting runtime state after provisioning, before update") assert.ElementsMatch(t, rs.KymaConfig.Components, []*gqlschema.ComponentConfigurationInput{}) assert.ElementsMatch(t, componentNames(rs.ClusterSetup.KymaConfig.Components), []string{"service-catalog-addons", "ory", "monitoring", "helm-broker", "service-manager-proxy", "service-catalog"}) // when resp = suite.CallAPI("PATCH", fmt.Sprintf("oauth/cf-eu10/v2/service_instances/%s?accepts_incomplete=true", id), ` { "service_id": "47c9dcbf-ff30-448e-ab36-d3bad66ba281", "context": { "globalaccount_id": "g-account-id", "user_id": "john.smith@email.com", "sm_operator_credentials": { "clientid": "testClientID", "clientsecret": "testClientSecret", "sm_url": "https://service-manager.kyma.com", "url": "https://test.auth.com", "xsappname": "testXsappname" }, "isMigration": true } }`) assert.Equal(t, http.StatusAccepted, resp.StatusCode) updateOperationID := suite.DecodeOperationID(resp) suite.FinishUpdatingOperationByProvisioner(updateOperationID) // check first call to reconciler installing BTP-Operator and sc-migration rsu1, err := suite.db.RuntimeStates().GetLatestWithReconcilerInputByRuntimeID(i.RuntimeID) assert.NoError(t, err, "getting runtime mid update") assert.Equal(t, updateOperationID, rsu1.OperationID, "runtime state update operation ID") assert.ElementsMatch(t, rsu1.KymaConfig.Components, []*gqlschema.ComponentConfigurationInput{}) assert.ElementsMatch(t, componentNames(rs.ClusterSetup.KymaConfig.Components), []string{"service-catalog-addons", "ory", "monitoring", "helm-broker", "service-manager-proxy", "service-catalog", "btp-operator", "sc-migration"}) // check second call to reconciler and see that sc-migration and svcat related components are gone suite.FinishUpdatingOperationByReconciler(updateOperationID) suite.AssertShootUpgrade(updateOperationID, gqlschema.UpgradeShootInput{ GardenerConfig: &gqlschema.GardenerUpgradeInput{ OidcConfig: &gqlschema.OIDCConfigInput{ ClientID: "clinet-id-oidc", GroupsClaim: "gropups", IssuerURL: "https://issuer.url", SigningAlgs: []string{"RSA256"}, UsernameClaim: "sub", UsernamePrefix: "-", }, }, Administrators: []string{"john.smith@email.com"}, }) i, err = suite.db.Instances().GetByID(id) assert.NoError(t, err, "getting instance after update") assert.True(t, i.InstanceDetails.SCMigrationTriggered, "instance SCMigrationTriggered after update") rsu2, err := suite.db.RuntimeStates().GetLatestWithReconcilerInputByRuntimeID(i.RuntimeID) assert.NoError(t, err, "getting runtime after update") assert.NotEqual(t, rsu1.ID, rsu2.ID, "runtime_state ID from first call should differ runtime_state ID from second call") assert.Equal(t, updateOperationID, rsu2.OperationID, "runtime state update operation ID") assert.ElementsMatch(t, rsu2.KymaConfig.Components, []*gqlschema.ComponentConfigurationInput{}) assert.ElementsMatch(t, componentNames(rsu2.ClusterSetup.KymaConfig.Components), []string{"ory", "monitoring", "btp-operator"}) for _, c := range rsu2.ClusterSetup.KymaConfig.Components { if c.Component == "btp-operator" { exp := reconciler.Component{ Component: "btp-operator", Namespace: "kyma-system", URL: "https://btp-operator", Configuration: []reconciler.Configuration{ {Key: "manager.secret.clientid", Value: "testClientID", Secret: true}, {Key: "manager.secret.clientsecret", Value: "testClientSecret", Secret: true}, {Key: "manager.secret.url", Value: "https://service-manager.kyma.com"}, {Key: "manager.secret.tokenurl", Value: "https://test.auth.com"}, {Key: "cluster.id", Value: "cluster_id"}, }, } assert.Equal(t, exp, c) } } // finalize second call to reconciler and wait for the operation to finish suite.FinishUpdatingOperationByReconciler(updateOperationID) suite.WaitForOperationState(updateOperationID, domain.Succeeded) }
explode_data.jsonl/8134
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2111 }
[ 2830, 3393, 4289, 3540, 20168, 7188, 1155, 353, 8840, 836, 8, 341, 197, 322, 2661, 198, 96572, 1669, 1532, 65545, 28000, 2271, 1155, 340, 77333, 17602, 2045, 76866, 28678, 915, 741, 16867, 16182, 836, 682, 4454, 741, 15710, 1669, 330, 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...
5
func TestValidateReCAPTCHA(t *testing.T) { g := initTestGoogleCaptcha(t) server := testproxyhelpers.FakeCaptchaService(t, testproxyhelpers.DefaultFakeCaptchaHost) server.Start() defer server.Close() tests := []struct { name string testFunc func() }{ { name: "test normal token", testFunc: func() { req, err := http.NewRequest(http.MethodPost, testproxyhelpers.DefaultFakeCaptchaURL+testproxyhelpers.DefaultFakeCaptchaEndpoint, nil) require.Nil(t, err) req.Form = url.Values{} req.Form["g-recaptcha-response"] = []string{testproxyhelpers.DefaultFakeGoodCaptcha} err = g.validateReCAPTCHA(req) require.Nil(t, err) }, }, { name: "test bad token", testFunc: func() { req, err := http.NewRequest(http.MethodPost, testproxyhelpers.DefaultFakeCaptchaURL+testproxyhelpers.DefaultFakeCaptchaEndpoint, nil) require.Nil(t, err) req.Form = url.Values{} req.Form["g-recaptcha-response"] = []string{testproxyhelpers.DefaultFakeBadCaptcha} err = g.validateReCAPTCHA(req) require.NotNil(t, err) }, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { tt.testFunc() }) } }
explode_data.jsonl/60459
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 499 }
[ 2830, 3393, 17926, 693, 31400, 70158, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 2930, 2271, 14444, 34, 25431, 1155, 340, 41057, 1669, 1273, 22803, 21723, 991, 726, 34, 25431, 1860, 1155, 11, 1273, 22803, 21723, 13275, 52317, 34, 25431, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNot(t *testing.T) { if !(Not{False{}}).Match(nil) { t.Error("Not False shouldn't be false ...") } if (Not{True{}}).Match(nil) { t.Error("Not True shouldn't be true ...") } }
explode_data.jsonl/33184
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 2623, 1155, 353, 8840, 836, 8, 341, 743, 18208, 2623, 90, 4049, 90, 3417, 568, 8331, 27907, 8, 341, 197, 3244, 6141, 445, 2623, 3557, 13133, 944, 387, 895, 2503, 1138, 197, 630, 743, 320, 2623, 90, 2514, 90, 3417, 568, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccountsSerialization(t *testing.T) { require := require.New(t) kind := KindNodeCompute // NOTE: These cases should be synced with tests in runtime/src/consensus/staking.rs. for _, tc := range []struct { rr Account expectedBase64 string }{ {Account{}, "oA=="}, {Account{General: GeneralAccount{ Balance: mustInitQuantity(t, 10), Nonce: 33, }}, "oWdnZW5lcmFsomVub25jZRghZ2JhbGFuY2VBCg=="}, {Account{ General: GeneralAccount{ Allowances: map[Address]quantity.Quantity{ CommonPoolAddress: mustInitQuantity(t, 100), GovernanceDepositsAddress: mustInitQuantity(t, 33), }, }, }, "oWdnZW5lcmFsoWphbGxvd2FuY2VzolUAdU/0RxQ6XsX0cbMPhna5TVaxV1BBIVUA98Te1iET4sKC6oZyI6VE7VXWum5BZA=="}, {Account{ Escrow: EscrowAccount{ Active: SharePool{ Balance: mustInitQuantity(t, 1100), TotalShares: mustInitQuantity(t, 11), }, Debonding: SharePool{}, CommissionSchedule: CommissionSchedule{ Bounds: []CommissionRateBoundStep{ { Start: 33, RateMin: mustInitQuantity(t, 10), RateMax: mustInitQuantity(t, 1000), }, }, }, StakeAccumulator: StakeAccumulator{map[StakeClaim][]StakeThreshold{ KindEntityName: { {Constant: mustInitQuantityP(t, 77)}, { Global: &kind, }, }, }}, }, }, "oWZlc2Nyb3ejZmFjdGl2ZaJnYmFsYW5jZUIETGx0b3RhbF9zaGFyZXNBC3FzdGFrZV9hY2N1bXVsYXRvcqFmY2xhaW1zoWZlbnRpdHmCoWVjb25zdEFNoWZnbG9iYWwCc2NvbW1pc3Npb25fc2NoZWR1bGWhZmJvdW5kc4GjZXN0YXJ0GCFocmF0ZV9tYXhCA+hocmF0ZV9taW5BCg=="}, } { enc := cbor.Marshal(tc.rr) require.Equal(tc.expectedBase64, base64.StdEncoding.EncodeToString(enc), "serialization should match") var dec Account err := cbor.Unmarshal(enc, &dec) require.NoError(err, "Unmarshal") require.EqualValues(tc.rr, dec, "Account serialization should round-trip") } }
explode_data.jsonl/36024
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 951 }
[ 2830, 3393, 41369, 35865, 1155, 353, 8840, 836, 8, 341, 17957, 1669, 1373, 7121, 1155, 692, 197, 15314, 1669, 16840, 1955, 46254, 198, 197, 322, 16743, 25, 4220, 5048, 1265, 387, 85028, 448, 7032, 304, 15592, 13437, 14, 6254, 13626, 142...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpen_ErrInvalid(t *testing.T) { path := tempfile() defer os.RemoveAll(path) f, err := os.Create(path) if err != nil { t.Fatal(err) } if _, err := fmt.Fprintln(f, "this is not a bolt database"); err != nil { t.Fatal(err) } if err := f.Close(); err != nil { t.Fatal(err) } if _, err := bolt.Open(path, 0666, nil); err != bolt.ErrInvalid { t.Fatalf("unexpected error: %s", err) } }
explode_data.jsonl/27460
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 5002, 93623, 7928, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 54819, 741, 16867, 2643, 84427, 5581, 692, 1166, 11, 1848, 1669, 2643, 7251, 5581, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 743, 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...
5
func TestMakeBuilderMap(t *testing.T) { wantBuilderMap1 := map[string]builder{ "/gFoo/": {matchers: []matcher{{key: "k1", names: []string{"n1"}}, {key: "k2", names: []string{"n1"}}}}, } wantBuilderMap2 := map[string]builder{ "/gFoo/": {matchers: []matcher{{key: "k1", names: []string{"n1"}}, {key: "k2", names: []string{"n1"}}}}, "/gBar/method1": {matchers: []matcher{{key: "k1", names: []string{"n1", "n2"}}}}, "/gFoobar/": {matchers: []matcher{{key: "k1", names: []string{"n1", "n2"}}}}, } tests := []struct { desc string cfg *rlspb.RouteLookupConfig wantBuilderMap BuilderMap }{ { desc: "One good GrpcKeyBuilder", cfg: &rlspb.RouteLookupConfig{ GrpcKeybuilders: []*rlspb.GrpcKeyBuilder{goodKeyBuilder1}, }, wantBuilderMap: wantBuilderMap1, }, { desc: "Two good GrpcKeyBuilders", cfg: &rlspb.RouteLookupConfig{ GrpcKeybuilders: []*rlspb.GrpcKeyBuilder{goodKeyBuilder1, goodKeyBuilder2}, }, wantBuilderMap: wantBuilderMap2, }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { builderMap, err := MakeBuilderMap(test.cfg) if err != nil || !builderMap.Equal(test.wantBuilderMap) { t.Errorf("MakeBuilderMap(%+v) returned {%v, %v}, want: {%v, nil}", test.cfg, builderMap, err, test.wantBuilderMap) } }) } }
explode_data.jsonl/81169
{ "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, 8078, 3297, 2227, 1155, 353, 8840, 836, 8, 341, 50780, 3297, 2227, 16, 1669, 2415, 14032, 60, 17850, 515, 197, 197, 3115, 70, 40923, 14, 788, 314, 6347, 388, 25, 3056, 70826, 2979, 792, 25, 330, 74, 16, 497, 5036, 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 TestErrorReasonCode(t *testing.T) { assert.Equal(t, reasoncode.ErrorUnclassified, ErrorReasonCode(errors.New("test"))) assert.Equal(t, reasoncode.ErrorUnclassified, ErrorReasonCode(provider.Error{})) }
explode_data.jsonl/17708
{ "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, 1454, 25139, 2078, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 2874, 1851, 6141, 63718, 447, 1870, 11, 4600, 25139, 2078, 38881, 7121, 445, 1944, 29836, 6948, 12808, 1155, 11, 2874, 1851, 6141, 63718, 447, 1870, 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
func TestDecrypt(t *testing.T){ fmt.Println("Test Decrypt ***") key := ReadFile("./keyfile") secret := Base64Decode(key) data := ReadFile("./encrypted.txt") result, err := Decrypt(string(data), secret) fmt.Println("decrypted result", result) fmt.Println("decryption err", err) fmt.Println("") }
explode_data.jsonl/37323
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 89660, 1155, 353, 8840, 836, 1264, 11009, 12419, 445, 2271, 89146, 17160, 1138, 23634, 1669, 4457, 1703, 13988, 792, 1192, 1138, 197, 20474, 1669, 5351, 21, 19, 32564, 4857, 692, 8924, 1669, 4457, 1703, 13988, 36444, 3909, 113...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBreakOutOfTry(t *testing.T) { const SCRIPT = ` function A() { var x = 1; B: { try { x = 2; } catch(e) { x = 3; } finally { break B; x = 4; } } return x; } A(); ` testScript1(SCRIPT, intToValue(2), t) }
explode_data.jsonl/75233
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 22524, 31731, 21453, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 7527, 362, 368, 341, 197, 2405, 856, 284, 220, 16, 280, 197, 12791, 25, 341, 298, 6799, 341, 571, 10225, 284, 220, 17, 280, 298, 197, 92, 2287, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEngine_WriteConflictingBatch(t *testing.T) { engine := NewDefaultEngine() defer engine.Close() engine.MustOpen() name := tsdb.EncodeNameString(engine.org, engine.bucket) err := engine.Engine.WritePoints(context.TODO(), []models.Point{ models.MustNewPoint( name, models.NewTags(map[string]string{models.FieldKeyTagKey: "value", models.MeasurementTagKey: "cpu", "host": "server"}), map[string]interface{}{"value": 1.0}, time.Unix(1, 2), ), models.MustNewPoint( name, models.NewTags(map[string]string{models.FieldKeyTagKey: "value", models.MeasurementTagKey: "cpu", "host": "server"}), map[string]interface{}{"value": 2}, time.Unix(1, 2), ), }) if _, ok := err.(tsdb.PartialWriteError); !ok { t.Fatal("expected partial write error. got:", err) } }
explode_data.jsonl/5992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 4571, 31825, 15578, 78208, 21074, 1155, 353, 8840, 836, 8, 341, 80118, 1669, 1532, 3675, 4571, 741, 16867, 4712, 10421, 741, 80118, 50463, 5002, 2822, 11609, 1669, 10591, 1999, 50217, 675, 703, 48974, 2659, 11, 4712, 71626, 69...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSkipList_Len(t *testing.T) { sl := newSkipList() if sl == nil { t.Fatalf("%v: got nil", t.Name()) } if got := sl.Len(); got != 0 { t.Fatalf("Len: got %d, want %d", got, 0) } for i := 0; i < 10000; i++ { sl.Set(i, i) } if got := sl.Len(); got != 10000 { t.Fatalf("Len: got %d, want %d", got, 10000) } }
explode_data.jsonl/54831
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 35134, 852, 2351, 268, 1155, 353, 8840, 836, 8, 341, 78626, 1669, 501, 35134, 852, 741, 743, 1739, 621, 2092, 341, 197, 3244, 30762, 4430, 85, 25, 2684, 2092, 497, 259, 2967, 2398, 197, 630, 743, 2684, 1669, 1739, 65819, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPositions(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip() } _, err := f.GetPositions(context.Background()) if err != nil { t.Error(err) } }
explode_data.jsonl/15165
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 1949, 45793, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 741, 197, 532, 197, 6878, 1848, 1669, 282, 2234, 45793, 5378, 19047, 2398, 743, 1848, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCollectorSecrets(t *testing.T) { jaeger := v1.NewJaeger(types.NamespacedName{Name: "my-instance"}) secret := "mysecret" jaeger.Spec.Storage.SecretName = secret collector := NewCollector(jaeger) dep := collector.Get() assert.Equal(t, "mysecret", dep.Spec.Template.Spec.Containers[0].EnvFrom[0].SecretRef.LocalObjectReference.Name) }
explode_data.jsonl/59523
{ "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, 53694, 19773, 82, 1155, 353, 8840, 836, 8, 341, 197, 5580, 1878, 1669, 348, 16, 7121, 52445, 1878, 52613, 98932, 68552, 675, 63121, 25, 330, 2408, 73655, 23625, 197, 20474, 1669, 330, 2408, 20474, 698, 197, 5580, 1878, 36473...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPropertyProfile(t *testing.T) { // GIVEN graphName := "mygraph" g := NewGraph(graphName) require.NotNil(t, g) v := NewVertexG(g) require.NotNil(t, v) p := NewPropertyV(v) require.NotNil(t, p) // WHEN qb := p.Profile() // THEN assert.NotNil(t, qb) assert.Equal(t, fmt.Sprintf("%s.executionProfile()", graphName), p.String()) }
explode_data.jsonl/38216
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 3052, 8526, 1155, 353, 8840, 836, 8, 1476, 197, 322, 89836, 198, 66616, 675, 1669, 330, 2408, 4439, 698, 3174, 1669, 1532, 11212, 24312, 675, 340, 17957, 93882, 1155, 11, 342, 340, 5195, 1669, 1532, 8320, 38, 3268, 340, 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 TestMempoolTxConcurrentWithCommit(t *testing.T) { state, privVals := randGenesisState(1, false, 10) blockDB := dbm.NewMemDB() stateStore := sm.NewStore(blockDB) cs := newStateWithConfigAndBlockStore(config, state, privVals[0], NewCounterApplication(), blockDB) err := stateStore.Save(state) require.NoError(t, err) newBlockHeaderCh := subscribe(cs.eventBus, types.EventQueryNewBlockHeader) const numTxs int64 = 3000 go deliverTxsRange(cs, 0, int(numTxs)) startTestRound(cs, cs.Height, cs.Round) for n := int64(0); n < numTxs; { select { case msg := <-newBlockHeaderCh: headerEvent := msg.Data().(types.EventDataNewBlockHeader) n += headerEvent.NumTxs case <-time.After(30 * time.Second): t.Fatal("Timed out waiting 30s to commit blocks with transactions") } } }
explode_data.jsonl/23671
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 290 }
[ 2830, 3393, 44, 3262, 1749, 31584, 1109, 3231, 2354, 33441, 1155, 353, 8840, 836, 8, 341, 24291, 11, 6095, 52452, 1669, 10382, 84652, 1397, 7, 16, 11, 895, 11, 220, 16, 15, 340, 47996, 3506, 1669, 2927, 76, 7121, 18816, 3506, 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...
4
func TestBoolConversion(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() testcases := []struct { js string expected bool isBool bool }{ // These are the only values that are KindBoolean. Everything else below is // implicitly converted. {`true`, true, true}, {`false`, false, true}, // Super confusing in JS: // !!(new Boolean(false)) == true // !!(new Boolean(true)) == true // That's because a non-undefined non-null Object in JS is 'true'. // Also, neither of these are actually Boolean kinds -- they are // BooleanObject, though. {`new Boolean(true)`, true, false}, {`new Boolean(false)`, true, false}, {`undefined`, false, false}, {`null`, false, false}, {`[]`, true, false}, {`[1]`, true, false}, {`7`, true, false}, {`"xyz"`, true, false}, {`(() => 3)`, true, false}, } for i, test := range testcases { res, err := ctx.Eval(test.js, "test.js") if err != nil { t.Errorf("%d %#q: Failed to run js: %v", i, test.js, err) } else if b := res.Bool(); b != test.expected { t.Errorf("%d %#q: Expected bool of %v, but got %v", i, test.js, test.expected, b) } else if res.IsKind(KindBoolean) != test.isBool { t.Errorf("%d %#q: Expected this to be a bool kind, but it's %v", i, test.js, res.kindMask) } } }
explode_data.jsonl/81538
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 524 }
[ 2830, 3393, 11233, 48237, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 2822, 18185, 23910, 1669, 3056, 1235, 341, 197, 95636, 981, 914, 198, 197, 42400, 1807, 198, 197, 19907, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetTag(t *testing.T) { s := TestStruct{} rt := reflect.TypeOf(s) for i := 0; i < rt.NumField(); i++ { f := rt.Field(i) fmt.Println(f.Tag.Get("json")) } }
explode_data.jsonl/81132
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 1949, 5668, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 3393, 9422, 16094, 55060, 1669, 8708, 73921, 1141, 340, 2023, 600, 1669, 220, 15, 26, 600, 366, 16677, 39847, 1877, 2129, 600, 1027, 341, 197, 1166, 1669, 16677, 17087, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSuccessfulDistributedTransaction(t *testing.T) { ctx := context.Background() var remoteState interface{} remote := NewTxManager(&fakeBroadcaster{}) remote.SetCommitFn(func(ctx context.Context, tx *Transaction) error { remoteState = tx.Payload return nil }) local := NewTxManager(&wrapTxManagerAsBroadcaster{remote}) payload := "my-payload" trType := TransactionType("my-type") tx, err := local.BeginTransaction(ctx, trType, payload) require.Nil(t, err) err = local.CommitTransaction(ctx, tx) require.Nil(t, err) assert.Equal(t, "my-payload", remoteState) }
explode_data.jsonl/5853
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 36374, 35, 25146, 8070, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 2405, 8699, 1397, 3749, 16094, 197, 18147, 1669, 1532, 31584, 2043, 2099, 30570, 68324, 32020, 37790, 197, 18147, 4202, 33441, 24911, 18552, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUintUint64(t *testing.T) { var expected uint64 = 123456789 ti := Uint{ ValidFlag: true, uint: expected, } if ti.Uint64() != expected { t.Errorf("actual:%d, expected:%d", ti.Uint64(), expected) } }
explode_data.jsonl/13399
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 21570, 21570, 21, 19, 1155, 353, 8840, 836, 8, 341, 2405, 3601, 2622, 21, 19, 284, 220, 16, 17, 18, 19, 20, 21, 22, 23, 24, 198, 72859, 1669, 27883, 515, 197, 197, 4088, 12135, 25, 830, 345, 197, 8254, 25, 414, 3601,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFeatureDerivation(t *testing.T) { a := assert.New(t) // Prepare feature derivation test table in MySQL. db, err := NewDB("mysql://root:root@tcp/?maxAllowedPacket=0") if err != nil { a.Fail("error connect to mysql: %v", err) } err = testdata.Popularize(db.DB, testdata.FeatureDerivationCaseSQL) if err != nil { a.Fail("error creating test data: %v", err) } parser := newExtendedSyntaxParser() normal := `select c1, c2, c3, c4, c5, c6, class from feature_derivation_case.train TO TRAIN DNNClassifier WITH model.n_classes=2 COLUMN EMBEDDING(c3, 128, sum), EMBEDDING(SPARSE(c5, 10000, COMMA), 128, sum) LABEL class INTO model_table;` r, e := parser.Parse(normal) a.NoError(e) trainIR, err := generateTrainIR(r, "mysql://root:root@tcp/?maxAllowedPacket=0") e = InferFeatureColumns(trainIR) a.NoError(e) fc1 := trainIR.Features["feature_columns"][0] nc, ok := fc1.(*codegen.NumericColumn) a.True(ok) a.Equal("c1", nc.FieldMeta.Name) a.Equal([]int{1}, nc.FieldMeta.Shape) a.Equal(codegen.Float, nc.FieldMeta.DType) a.False(nc.FieldMeta.IsSparse) fc2 := trainIR.Features["feature_columns"][1] nc2, ok := fc2.(*codegen.NumericColumn) a.True(ok) a.Equal("c2", nc2.FieldMeta.Name) fc3 := trainIR.Features["feature_columns"][2] emb, ok := fc3.(*codegen.EmbeddingColumn) a.True(ok) a.NotNil(emb.CategoryColumn) a.Equal(128, emb.Dimension) a.Equal("sum", emb.Combiner) a.Equal("c3", emb.Name) cat, ok := emb.CategoryColumn.(*codegen.CategoryIDColumn) a.True(ok) a.Equal("c3", cat.FieldMeta.Name) a.Equal([]int{4}, cat.FieldMeta.Shape) a.Equal(codegen.Int, cat.FieldMeta.DType) fc4 := trainIR.Features["feature_columns"][3] nc3, ok := fc4.(*codegen.NumericColumn) a.True(ok) a.Equal("c4", nc3.FieldMeta.Name) a.Equal([]int{4}, nc3.FieldMeta.Shape) a.Equal(codegen.Float, nc3.FieldMeta.DType) a.False(nc3.FieldMeta.IsSparse) fc5 := trainIR.Features["feature_columns"][4] emb2, ok := fc5.(*codegen.EmbeddingColumn) a.True(ok) a.NotNil(emb2.CategoryColumn) cat2, ok := emb2.CategoryColumn.(*codegen.CategoryIDColumn) a.True(ok) a.Equal(int64(10000), cat2.BucketSize) a.Equal("c5", cat2.FieldMeta.Name) a.Equal([]int{10000}, cat2.FieldMeta.Shape) a.Equal(codegen.Int, cat2.FieldMeta.DType) a.True(cat2.FieldMeta.IsSparse) fc6 := trainIR.Features["feature_columns"][5] cat3, ok := fc6.(*codegen.CategoryIDColumn) a.True(ok) a.Equal(3, len(cat3.FieldMeta.Vocabulary)) _, ok = cat3.FieldMeta.Vocabulary["MALE"] a.True(ok) a.Equal(int64(3), cat3.BucketSize) a.Equal(6, len(trainIR.Features["feature_columns"])) crossSQL := `select c1, c2, c3, class from feature_derivation_case.train TO TRAIN DNNClassifier WITH model.n_classes=2 COLUMN c1, c2, CROSS([c1, c2], 256) LABEL class INTO model_table;` parser = newExtendedSyntaxParser() r, e = parser.Parse(crossSQL) a.NoError(e) trainIR, err = generateTrainIR(r, "mysql://root:root@tcp/?maxAllowedPacket=0") e = InferFeatureColumns(trainIR) a.NoError(e) fc1 = trainIR.Features["feature_columns"][0] nc, ok = fc1.(*codegen.NumericColumn) a.True(ok) fc2 = trainIR.Features["feature_columns"][1] nc, ok = fc2.(*codegen.NumericColumn) a.True(ok) fc3 = trainIR.Features["feature_columns"][2] nc, ok = fc3.(*codegen.NumericColumn) a.True(ok) fc4 = trainIR.Features["feature_columns"][3] cc, ok := fc4.(*codegen.CrossColumn) a.True(ok) a.Equal(256, cc.HashBucketSize) nc4, ok := cc.Keys[0].(*codegen.NumericColumn) a.True(ok) a.Equal("c1", nc4.FieldMeta.Name) a.Equal(codegen.Float, nc4.FieldMeta.DType) nc5, ok := cc.Keys[1].(*codegen.NumericColumn) a.True(ok) a.Equal("c2", nc5.FieldMeta.Name) a.Equal(codegen.Float, nc5.FieldMeta.DType) a.Equal(4, len(trainIR.Features["feature_columns"])) }
explode_data.jsonl/24027
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1659 }
[ 2830, 3393, 13859, 22171, 39127, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 340, 197, 322, 31166, 4565, 95254, 1273, 1965, 304, 26339, 624, 20939, 11, 1848, 1669, 1532, 3506, 445, 12272, 1110, 2888, 25, 2888, 31, 27161...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsEnglish(t *testing.T) { { sample := `A perennial also-ran, Stallings won his seat when longtime lawmaker David Holmes died 11 days after the filing deadline. Suddenly, Stallings was a shoo-in, not the long shot. In short order, the Legislature attempted to pass a law allowing former U.S. Rep. Carolyn Cheeks Kilpatrick to file; Stallings challenged the law in court and won. Kilpatrick mounted a write-in campaign, but Stallings won.` result := utils.IsEnglish(sample) assert.True(t, result, "string in English should return true") } { sample := "γ“γ‚Œγ―ζ—₯本θͺžγ§γ™γ€‚ζ˜Žγ‚‰γ‹γ«ζ—₯本θͺžγ§γ™γ€‚" result := utils.IsEnglish(sample) assert.False(t, result, "string in Japanese should return false") } { sample := "γ“γ‚Œγ―ζ—₯本θͺžγ§γ™γ€‚\nしかし、英文 'This is a sample' γ‚‚ε…₯っています。\n\tOr like this one." result := utils.IsEnglish(sample) assert.False(t, result, "string in Japanese with english mixed should return false") } }
explode_data.jsonl/18661
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 3872, 22574, 1155, 353, 8840, 836, 8, 341, 197, 515, 197, 1903, 1516, 1669, 1565, 32, 73618, 1083, 3795, 276, 11, 71870, 819, 2765, 806, 10723, 979, 35404, 70376, 6798, 39301, 198, 197, 2698, 1122, 220, 16, 16, 2849, 1283,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUserFriendDeleteEXAMPLE1EXAMPLE2(t *testing.T) { resp, _ := sendDelete("http://localhost:8080/EXAMPLE2&q=undofriendship", UserFriendRequestEXAMPLE1, auth.Header.Get("Authorization")) response := responseToString(resp) compareResults(t, response, HyperText.CustomResponses["success-delete"]) }
explode_data.jsonl/59362
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 1474, 41637, 6435, 95875, 16, 95875, 17, 1155, 353, 8840, 836, 8, 341, 34653, 11, 716, 1669, 3624, 6435, 445, 1254, 1110, 8301, 25, 23, 15, 23, 15, 14, 95875, 17, 62735, 28, 1241, 1055, 5039, 5270, 497, 2657, 41637, 1900...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCalcFamilyTimeRange(t *testing.T) { t1, _ := ParseTimestamp("20190702 12:00:00", "20060102 15:04:05") calc := dayCalculator t2, _ := calc.ParseSegmentTime("20190702") assert.Equal(t, t1, calc.CalcFamilyStartTime(t2, 12)) t3, _ := ParseTimestamp("20190702 13:00:00", "20060102 15:04:05") assert.Equal(t, t3-1, calc.CalcFamilyEndTime(t1)) t1, _ = ParseTimestamp("20191231 00:00:00", "20060102 15:04:05") calc = monthCalculator t2, _ = calc.ParseSegmentTime("201912") assert.Equal(t, t1, calc.CalcFamilyStartTime(t2, 31)) t3, _ = ParseTimestamp("20200101 00:00:00", "20060102 15:04:05") assert.Equal(t, t3-1, calc.CalcFamilyEndTime(t1)) t1, _ = ParseTimestamp("20191201 00:00:00", "20060102 15:04:05") calc = yearCalculator t2, _ = calc.ParseSegmentTime("2019") assert.Equal(t, t1, calc.CalcFamilyStartTime(t2, 12)) t3, _ = ParseTimestamp("20200101 00:00:00", "20060102 15:04:05") assert.Equal(t, t3-1, calc.CalcFamilyEndTime(t1)) }
explode_data.jsonl/75708
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 434 }
[ 2830, 3393, 47168, 15192, 1462, 6046, 1155, 353, 8840, 836, 8, 341, 3244, 16, 11, 716, 1669, 14775, 20812, 445, 17, 15, 16, 24, 15, 22, 15, 17, 220, 16, 17, 25, 15, 15, 25, 15, 15, 497, 330, 17, 15, 15, 21, 15, 16, 15, 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 TestGetCurlCommand_specialCharsInBody(t *testing.T) { req, _ := http.NewRequest("POST", "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu", bytes.NewBufferString(`Hello $123 o'neill -"-`)) req.Header.Set("Content-Type", "application/json") libCommand, _ := http2curl.GetCurlCommand(req) command, _ := GetCurlCommand(req) if libCommand.String() != command.String() { t.Errorf("expected library command: %s and command: %s to match", libCommand, command) } // Output: // curl -X 'POST' -d 'Hello $123 o'\''neill -"-' -H 'Content-Type: application/json' 'http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu' }
explode_data.jsonl/61004
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 1949, 34, 1085, 4062, 41629, 32516, 641, 5444, 1155, 353, 8840, 836, 8, 341, 24395, 11, 716, 1669, 1758, 75274, 445, 2946, 497, 330, 1254, 1110, 2136, 7724, 905, 14, 13683, 14, 750, 13, 75076, 30, 73, 41748, 27221, 2152, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEnqueueWF(t *testing.T) { var err error var un *unstructured.Unstructured var ten int32 = 10 controller := newTTLController() // Veirfy we do not enqueue if not completed wf := test.LoadWorkflowFromBytes([]byte(completedWf)) un, err = util.ToUnstructured(wf) assert.NoError(t, err) controller.enqueueWF(un) assert.Equal(t, 0, controller.workqueue.Len()) // Veirfy we do not enqueue if workflow finished is not exceed the TTL wf.Spec.TTLSecondsAfterFinished = &ten wf.Status.FinishedAt = metav1.Time{Time: controller.clock.Now().Add(-5 * time.Second)} un, err = util.ToUnstructured(wf) assert.NoError(t, err) controller.enqueueWF(un) assert.Equal(t, 0, controller.workqueue.Len()) // Verify we enqueue when ttl is expired wf.Spec.TTLSecondsAfterFinished = &ten wf.Status.FinishedAt = metav1.Time{Time: controller.clock.Now().Add(-11 * time.Second)} un, err = util.ToUnstructured(wf) assert.NoError(t, err) controller.enqueueWF(un) assert.Equal(t, 1, controller.workqueue.Len()) }
explode_data.jsonl/48741
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 1702, 4584, 32131, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 2405, 650, 353, 359, 51143, 10616, 51143, 198, 2405, 5779, 526, 18, 17, 284, 220, 16, 15, 271, 61615, 1669, 501, 51, 13470, 2051, 2822, 197, 322, 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