text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
func Test_isFullHouse(t *testing.T) { type args struct { hand deck.Hand } tests := []struct { name string args args want bool }{ { name: "Should be a full house", args: args{deck.Hand{ deck.Card{IsRoyal: true, RoyalType: deck.Royal("king")}, deck.Card{IsRoyal: true, RoyalType: deck.Royal("king")}, deck.Card{IsRoyal: true, RoyalType: deck.Royal("king")}, deck.Card{Value: 2}, deck.Card{Value: 2}, }}, want: true, }, { name: "Should be a full house 2", args: args{deck.Hand{ deck.Card{Value: 3}, deck.Card{Value: 3}, deck.Card{Value: 2}, deck.Card{Value: 2}, deck.Card{Value: 2}, }}, want: true, }, { name: "Should not be a full house", args: args{deck.Hand{ deck.Card{Value: 8}, deck.Card{Value: 9}, deck.Card{Value: 10}, deck.Card{IsRoyal: true, RoyalType: deck.Royal("jack")}, deck.Card{IsRoyal: true, RoyalType: deck.Royal("queen")}, }}, want: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := isFullHouse(tt.args.hand); got != tt.want { t.Errorf("isFullHouse() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/7188
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 6892, 9432, 28607, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 9598, 437, 9530, 35308, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 1807, 198, 197, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSnapshotCache(t *testing.T) { c := cache.NewSnapshotCache(true, group{}, logger{t: t}) if _, err := c.GetSnapshot(key); err == nil { t.Errorf("unexpected snapshot found for key %q", key) } if err := c.SetSnapshot(key, snapshot); err != nil { t.Fatal(err) } snap, err := c.GetSnapshot(key) if err != nil { t.Fatal(err) } if !reflect.DeepEqual(snap, snapshot) { t.Errorf("expect snapshot: %v, got: %v", snapshot, snap) } // try to get endpoints with incorrect list of names // should not receive response value, _ := c.CreateWatch(discovery.DiscoveryRequest{TypeUrl: rsrc.EndpointType, ResourceNames: []string{"none"}}) select { case out := <-value: t.Errorf("watch for endpoints and mismatched names => got %v, want none", out) case <-time.After(time.Second / 4): } for _, typ := range testTypes { t.Run(typ, func(t *testing.T) { value, _ := c.CreateWatch(discovery.DiscoveryRequest{TypeUrl: typ, ResourceNames: names[typ]}) select { case out := <-value: if out.Version != version { t.Errorf("got version %q, want %q", out.Version, version) } if !reflect.DeepEqual(cache.IndexResourcesByName(out.Resources), snapshot.GetResources(typ)) { t.Errorf("get resources %v, want %v", out.Resources, snapshot.GetResources(typ)) } case <-time.After(time.Second): t.Fatal("failed to receive snapshot response") } }) } }
explode_data.jsonl/6680
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 532 }
[ 2830, 3393, 15009, 8233, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 6500, 7121, 15009, 8233, 3715, 11, 1874, 22655, 5925, 90, 83, 25, 259, 8824, 743, 8358, 1848, 1669, 272, 2234, 15009, 4857, 1215, 1848, 621, 2092, 341, 197, 3244, 1308...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_Auto_HTML_Create_Redirect(t *testing.T) { r := require.New(t) app := buffalo.New(buffalo.Options{}) app.POST("/cars", func(c buffalo.Context) error { return c.Render(201, render.Auto(c, Car{ ID: 1, Name: "Honda", })) }) w := willie.New(app) res := w.HTML("/cars").Post(nil) r.Equal("/cars/1", res.Location()) r.Equal(302, res.Code) }
explode_data.jsonl/2626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 1566, 1535, 56726, 34325, 92940, 1226, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1373, 7121, 1155, 692, 28236, 1669, 81355, 7121, 39729, 12529, 22179, 37790, 28236, 14721, 4283, 50708, 497, 2915, 1337, 81355, 9328, 8, 1465, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVarStringOverflowErrors(t *testing.T) { pver := ProtocolVersion tests := []struct { buf []byte // Wire encoding pver uint32 // Protocol version for wire encoding err error // Expected error }{ {[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, pver, &MessageError{}}, {[]byte{0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, pver, &MessageError{}}, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { // Decode from wire format. rbuf := bytes.NewReader(test.buf) _, err := ReadVarString(rbuf, test.pver) if reflect.TypeOf(err) != reflect.TypeOf(test.err) { t.Errorf("ReadVarString #%d wrong error got: %v, "+ "want: %v", i, err, reflect.TypeOf(test.err)) continue } } }
explode_data.jsonl/15302
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 3962, 703, 42124, 13877, 1155, 353, 8840, 836, 8, 341, 3223, 423, 1669, 24572, 5637, 271, 78216, 1669, 3056, 1235, 341, 197, 26398, 220, 3056, 3782, 442, 19378, 11170, 198, 197, 3223, 423, 2622, 18, 17, 442, 24572, 2319, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTo_bash(t *testing.T) { tables := []struct { input interface{} expect string }{ {"pipo", "'pipo'"}, {"i''i", "'i'\\'''\\''i'"}, {123, "123"}, {nil, ""}, {"", "''"}, {[]string{"pipo", "molo"}, "('pipo' 'molo')"}, {true, "true"}, } for _, table := range tables { res := To_bash(table.input) if res != table.expect { t.Errorf("To_bash for '%s', got: %v, want: %v.", table.input, res, table.expect) } } }
explode_data.jsonl/35249
{ "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, 1249, 880, 988, 1155, 353, 8840, 836, 8, 341, 262, 12632, 1669, 3056, 1235, 341, 286, 1946, 3749, 16094, 286, 1720, 914, 198, 262, 335, 515, 286, 5212, 79, 6943, 497, 7178, 79, 6943, 6, 7115, 286, 5212, 72, 4605, 72, 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...
3
func TestExtrinsicPayload_Sign(t *testing.T) { sig, err := examplaryExtrinsicPayload.Sign(signature.TestKeyringPairAlice) assert.NoError(t, err) // verify sig b, err := EncodeToBytes(examplaryExtrinsicPayload) assert.NoError(t, err) ok, err := signature.Verify(b, sig[:], HexEncodeToString(signature.TestKeyringPairAlice.PublicKey)) assert.NoError(t, err) assert.True(t, ok) }
explode_data.jsonl/65318
{ "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, 840, 45002, 29683, 1098, 622, 1155, 353, 8840, 836, 8, 341, 84841, 11, 1848, 1669, 7006, 500, 658, 840, 45002, 29683, 41152, 92650, 8787, 1592, 12640, 12443, 61686, 340, 6948, 35699, 1155, 11, 1848, 692, 197, 322, 10146, 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 TestFakeMapEntryProto(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFakeMapEntry(popr, false) dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } msg := &FakeMapEntry{} if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } littlefuzz := make([]byte, len(dAtA)) copy(littlefuzz, dAtA) for i := range dAtA { dAtA[i] = byte(popr.Intn(256)) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } if len(littlefuzz) > 0 { fuzzamount := 100 for i := 0; i < fuzzamount; i++ { littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) littlefuzz = append(littlefuzz, byte(popr.Intn(256))) } // shouldn't panic _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) } }
explode_data.jsonl/14885
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 495 }
[ 2830, 3393, 52317, 2227, 5874, 31549, 1155, 353, 8840, 836, 8, 341, 197, 22602, 1669, 882, 13244, 1005, 55832, 83819, 741, 3223, 46288, 1669, 6888, 33864, 7121, 37270, 33864, 7121, 3608, 44163, 1171, 3223, 1669, 1532, 11598, 7757, 52317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadInvalidMap(t *testing.T) { testutils.TestFiles(t, "testdata/invalid_map-*.elf", func(t *testing.T, file string) { _, err := LoadCollectionSpec(file) t.Log(err) if err == nil { t.Fatal("Loading an invalid map should fail") } }) }
explode_data.jsonl/27740
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 5879, 7928, 2227, 1155, 353, 8840, 836, 8, 341, 18185, 6031, 8787, 10809, 1155, 11, 330, 92425, 14, 11808, 5376, 12, 19922, 490, 497, 2915, 1155, 353, 8840, 836, 11, 1034, 914, 8, 341, 197, 197, 6878, 1848, 1669, 8893, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestU128_Hex(t *testing.T) { assertEncodeToHex(t, []encodeToHexAssert{ {NewU128(*big.NewInt(29)), "0x1d000000000000000000000000000000"}, }) }
explode_data.jsonl/18420
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 52, 16, 17, 23, 2039, 327, 1155, 353, 8840, 836, 8, 341, 6948, 32535, 1249, 20335, 1155, 11, 3056, 6180, 1249, 20335, 8534, 515, 197, 197, 90, 3564, 52, 16, 17, 23, 4071, 16154, 7121, 1072, 7, 17, 24, 5731, 330, 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 TestValidateProxyAddress(t *testing.T) { addresses := map[string]bool{ "istio-pilot:80": true, "istio-pilot": false, "isti..:80": false, "10.0.0.100:9090": true, "10.0.0.100": false, "istio-pilot:port": false, "istio-pilot:100000": false, "[2001:db8::100]:80": true, "[2001:db8::10::20]:80": false, "[2001:db8::100]": false, "[2001:db8::100]:port": false, "2001:db8::100:80": false, } for addr, valid := range addresses { if got := ValidateProxyAddress(addr); (got == nil) != valid { t.Errorf("Failed: got valid=%t but wanted valid=%t: %v for %s", got == nil, valid, got, addr) } } }
explode_data.jsonl/56894
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 351 }
[ 2830, 3393, 17926, 16219, 4286, 1155, 353, 8840, 836, 8, 341, 197, 53789, 1669, 2415, 14032, 96436, 515, 197, 197, 1, 380, 815, 2268, 23958, 25, 23, 15, 788, 286, 830, 345, 197, 197, 1, 380, 815, 2268, 23958, 788, 1843, 895, 345, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDatabase_UserFromLibrary(t *testing.T) { // setup types u := new(library.User) u.SetID(1) u.SetName("octocat") u.SetToken("superSecretToken") u.SetHash("superSecretHash") u.SetFavorites([]string{"github/octocat"}) u.SetActive(true) u.SetAdmin(false) want := testUser() // run test got := UserFromLibrary(u) if !reflect.DeepEqual(got, want) { t.Errorf("UserFromLibrary is %v, want %v", got, want) } }
explode_data.jsonl/9475
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 5988, 31339, 3830, 16915, 1155, 353, 8840, 836, 8, 341, 197, 322, 6505, 4494, 198, 10676, 1669, 501, 93299, 7344, 692, 10676, 4202, 915, 7, 16, 340, 10676, 4202, 675, 445, 41692, 509, 266, 1138, 10676, 4202, 3323, 445, 952...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCanvasSet(t *testing.T) { c := NewCanvas() c.Set(0, 0) c.Set(0, 1) c.Set(0, 2) c.Set(0, 3) c.Set(1, 3) c.Set(2, 3) c.Set(3, 3) c.Set(4, 3) c.Set(5, 3) spew.Dump(c) }
explode_data.jsonl/8633
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 18226, 1649, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 18226, 741, 1444, 4202, 7, 15, 11, 220, 15, 340, 1444, 4202, 7, 15, 11, 220, 16, 340, 1444, 4202, 7, 15, 11, 220, 17, 340, 1444, 4202, 7, 15, 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 TestLoadBalancerExternalServiceModeSelection(t *testing.T) { testLoadBalancerServiceDefaultModeSelection(t, false) testLoadBalancerServiceAutoModeSelection(t, false) testLoadBalancerServicesSpecifiedSelection(t, false) testLoadBalancerMaxRulesServices(t, false) testLoadBalancerServiceAutoModeDeleteSelection(t, false) }
explode_data.jsonl/50385
{ "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, 5879, 93825, 25913, 1860, 3636, 11177, 1155, 353, 8840, 836, 8, 341, 18185, 5879, 93825, 1860, 3675, 3636, 11177, 1155, 11, 895, 340, 18185, 5879, 93825, 1860, 13253, 3636, 11177, 1155, 11, 895, 340, 18185, 5879, 93825, 11025,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetSubscriptionAttributesHandler_POST_Success(t *testing.T) { // Create a request to pass to our handler. We don't have any query parameters for now, so we'll // pass 'nil' as the third parameter. req, err := http.NewRequest("POST", "/", nil) if err != nil { t.Fatal(err) } topicName := "testing" topicArn := "arn:aws:sns:" + app.CurrentEnvironment.Region + ":000000000000:" + topicName subArn, _ := common.NewUUID() subArn = topicArn + ":" + subArn app.SyncTopics.Topics[topicName] = &app.Topic{Name: topicName, Arn: topicArn, Subscriptions: []*app.Subscription{ { SubscriptionArn: subArn, FilterPolicy: &app.FilterPolicy{ "foo": {"bar"}, }, }, }} form := url.Values{} form.Add("SubscriptionArn", subArn) req.PostForm = form // We create a ResponseRecorder (which satisfies http.ResponseWriter) to record the response. rr := httptest.NewRecorder() handler := http.HandlerFunc(GetSubscriptionAttributes) // Our handlers satisfy http.Handler, so we can call their ServeHTTP method // directly and pass in our Request and ResponseRecorder. handler.ServeHTTP(rr, req) // Check the status code is what we expect. if status := rr.Code; status != http.StatusOK { t.Errorf("handler returned wrong status code: got %v want %v", status, http.StatusOK) } // Check the response body is what we expect. expected := "</GetSubscriptionAttributesResult>" if !strings.Contains(rr.Body.String(), expected) { t.Errorf("handler returned unexpected body: got %v want %v", rr.Body.String(), expected) } // Check the response body is what we expect. expected = "{&#34;foo&#34;:[&#34;bar&#34;]}" if !strings.Contains(rr.Body.String(), expected) { t.Errorf("handler returned unexpected body: got %v want %v", rr.Body.String(), expected) } }
explode_data.jsonl/76508
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 613 }
[ 2830, 3393, 1949, 33402, 10516, 3050, 20506, 87161, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 264, 1681, 311, 1494, 311, 1039, 7013, 13, 1205, 1513, 944, 614, 894, 3239, 5029, 369, 1431, 11, 773, 582, 3278, 198, 197, 322, 1494, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFleetGateway(t *testing.T) { agentInfo := &testAgentInfo{} settings := &fleetGatewaySettings{ Duration: 5 * time.Second, Backoff: backoffSettings{Init: 1 * time.Second, Max: 5 * time.Second}, } t.Run("send no event and receive no action", withGateway(agentInfo, settings, func( t *testing.T, gateway FleetGateway, client *testingClient, dispatcher *testingDispatcher, scheduler *scheduler.Stepper, rep repo.Backend, ) { waitFn := ackSeq( client.Answer(func(headers http.Header, body io.Reader) (*http.Response, error) { resp := wrapStrToResp(http.StatusOK, `{ "actions": [] }`) return resp, nil }), dispatcher.Answer(func(actions ...action) error { require.Equal(t, 0, len(actions)) return nil }), ) gateway.Start() // Synchronize scheduler and acking of calls from the worker go routine. scheduler.Next() waitFn() })) t.Run("Successfully connects and receives a series of actions", withGateway(agentInfo, settings, func( t *testing.T, gateway FleetGateway, client *testingClient, dispatcher *testingDispatcher, scheduler *scheduler.Stepper, rep repo.Backend, ) { waitFn := ackSeq( client.Answer(func(headers http.Header, body io.Reader) (*http.Response, error) { // TODO: assert no events resp := wrapStrToResp(http.StatusOK, ` { "actions": [ { "type": "POLICY_CHANGE", "id": "id1", "data": { "policy": { "id": "policy-id" } } }, { "type": "ANOTHER_ACTION", "id": "id2" } ] } `) return resp, nil }), dispatcher.Answer(func(actions ...action) error { require.Equal(t, 2, len(actions)) return nil }), ) gateway.Start() scheduler.Next() waitFn() })) // Test the normal time based execution. t.Run("Periodically communicates with Fleet", func(t *testing.T) { scheduler := scheduler.NewPeriodic(150 * time.Millisecond) client := newTestingClient() dispatcher := newTestingDispatcher() ctx, cancel := context.WithCancel(context.Background()) defer cancel() log, _ := logger.New("tst") stateStore, err := store.NewStateStore(log, storage.NewDiskStore(paths.AgentStateStoreFile())) require.NoError(t, err) gateway, err := newFleetGatewayWithScheduler( ctx, log, settings, agentInfo, client, dispatcher, scheduler, getReporter(agentInfo, log, t), newNoopAcker(), &noopController{}, stateStore, ) require.NoError(t, err) waitFn := ackSeq( client.Answer(func(headers http.Header, body io.Reader) (*http.Response, error) { resp := wrapStrToResp(http.StatusOK, `{ "actions": [] }`) return resp, nil }), dispatcher.Answer(func(actions ...action) error { require.Equal(t, 0, len(actions)) return nil }), ) gateway.Start() var count int for { waitFn() count++ if count == 4 { return } } }) t.Run("send event and receive no action", withGateway(agentInfo, settings, func( t *testing.T, gateway FleetGateway, client *testingClient, dispatcher *testingDispatcher, scheduler *scheduler.Stepper, rep repo.Backend, ) { rep.Report(context.Background(), &testStateEvent{}) waitFn := ackSeq( client.Answer(func(headers http.Header, body io.Reader) (*http.Response, error) { cr := &request{} content, err := ioutil.ReadAll(body) if err != nil { t.Fatal(err) } err = json.Unmarshal(content, &cr) if err != nil { t.Fatal(err) } require.Equal(t, 1, len(cr.Events)) resp := wrapStrToResp(http.StatusOK, `{ "actions": [] }`) return resp, nil }), dispatcher.Answer(func(actions ...action) error { require.Equal(t, 0, len(actions)) return nil }), ) gateway.Start() // Synchronize scheduler and acking of calls from the worker go routine. scheduler.Next() waitFn() })) t.Run("Test the wait loop is interruptible", func(t *testing.T) { // 20mins is the double of the base timeout values for golang test suites. // If we cannot interrupt we will timeout. d := 20 * time.Minute scheduler := scheduler.NewPeriodic(d) client := newTestingClient() dispatcher := newTestingDispatcher() ctx, cancel := context.WithCancel(context.Background()) log, _ := logger.New("tst") stateStore, err := store.NewStateStore(log, storage.NewDiskStore(paths.AgentStateStoreFile())) require.NoError(t, err) gateway, err := newFleetGatewayWithScheduler( ctx, log, &fleetGatewaySettings{ Duration: d, Backoff: backoffSettings{Init: 1 * time.Second, Max: 30 * time.Second}, }, agentInfo, client, dispatcher, scheduler, getReporter(agentInfo, log, t), newNoopAcker(), &noopController{}, stateStore, ) require.NoError(t, err) ch1 := dispatcher.Answer(func(actions ...action) error { return nil }) ch2 := client.Answer(func(headers http.Header, body io.Reader) (*http.Response, error) { resp := wrapStrToResp(http.StatusOK, `{ "actions": [] }`) return resp, nil }) gateway.Start() // Silently dispatch action. go func() { for range ch1 { } }() // Make sure that all API calls to the checkin API are successfull, the following will happen: // block on the first call. <-ch2 go func() { // drain the channel for range ch2 { } }() // 1. Gateway will check the API on boot. // 2. WaitTick() will block for 20 minutes. // 3. Stop will should unblock the wait. cancel() }) }
explode_data.jsonl/80447
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2248 }
[ 2830, 3393, 37, 18973, 40709, 1155, 353, 8840, 836, 8, 341, 197, 8092, 1731, 1669, 609, 1944, 16810, 1731, 16094, 62930, 1669, 609, 72698, 40709, 6086, 515, 197, 10957, 2017, 25, 220, 20, 353, 882, 32435, 345, 197, 197, 3707, 1847, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOptimisticConflicts(t *testing.T) { store, clean := createMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk2 := testkit.NewTestKit(t, store) tk.MustExec("use test") tk2.MustExec("use test") tk.MustExec("drop table if exists conflict") tk.MustExec("create table conflict (id int primary key, c int)") tk.MustExec("insert conflict values (1, 1)") tk.MustExec("begin pessimistic") tk.MustQuery("select * from conflict where id = 1 for update") syncCh := make(chan struct{}) go func() { tk2.MustExec("update conflict set c = 3 where id = 1") <-syncCh }() time.Sleep(time.Millisecond * 10) tk.MustExec("update conflict set c = 2 where id = 1") tk.MustExec("commit") syncCh <- struct{}{} tk.MustQuery("select c from conflict where id = 1").Check(testkit.Rows("3")) // Check pessimistic lock is not resolved. tk.MustExec("begin pessimistic") tk.MustExec("update conflict set c = 4 where id = 1") tk2.MustExec("begin optimistic") tk2.MustExec("update conflict set c = 5 where id = 1") require.Error(t, tk2.ExecToErr("commit")) tk.MustExec("rollback") // Update snapshotTS after a conflict, invalidate snapshot cache. tk.MustExec("truncate table conflict") tk.MustExec("insert into conflict values (1, 2)") tk.MustExec("begin pessimistic") // This SQL use BatchGet and cache data in the txn snapshot. // It can be changed to other SQLs that use BatchGet. tk.MustExec("insert ignore into conflict values (1, 2)") tk2.MustExec("update conflict set c = c - 1") // Make the txn update its forUpdateTS. tk.MustQuery("select * from conflict where id = 1 for update").Check(testkit.Rows("1 1")) // Cover a bug that the txn snapshot doesn't invalidate cache after ts change. tk.MustExec("insert into conflict values (1, 999) on duplicate key update c = c + 2") tk.MustExec("commit") tk.MustQuery("select * from conflict").Check(testkit.Rows("1 3")) }
explode_data.jsonl/12461
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 633 }
[ 2830, 3393, 21367, 318, 4532, 15578, 56445, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1855, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMapBuckets(t *testing.T) { // Test that maps of different sizes have the right number of buckets. // Non-escaping maps with small buckets (like map[int]int) never // have a nil bucket pointer due to starting with preallocated buckets // on the stack. Escaping maps start with a non-nil bucket pointer if // hint size is above bucketCnt and thereby have more than one bucket. // These tests depend on bucketCnt and loadFactor* in map.go. t.Run("mapliteral", func(t *testing.T) { for _, tt := range mapBucketTests { localMap := map[int]int{} if runtime.MapBucketsPointerIsNil(localMap) { t.Errorf("no escape: buckets pointer is nil for non-escaping map") } for i := 0; i < tt.n; i++ { localMap[i] = i } if got := runtime.MapBucketsCount(localMap); got != tt.noescape { t.Errorf("no escape: n=%d want %d buckets, got %d", tt.n, tt.noescape, got) } escapingMap := map[int]int{} if count := runtime.MapBucketsCount(escapingMap); count > 1 && runtime.MapBucketsPointerIsNil(escapingMap) { t.Errorf("escape: buckets pointer is nil for n=%d buckets", count) } for i := 0; i < tt.n; i++ { escapingMap[i] = i } if got := runtime.MapBucketsCount(escapingMap); got != tt.escape { t.Errorf("escape n=%d want %d buckets, got %d", tt.n, tt.escape, got) } mapSink = escapingMap } }) t.Run("nohint", func(t *testing.T) { for _, tt := range mapBucketTests { localMap := make(map[int]int) if runtime.MapBucketsPointerIsNil(localMap) { t.Errorf("no escape: buckets pointer is nil for non-escaping map") } for i := 0; i < tt.n; i++ { localMap[i] = i } if got := runtime.MapBucketsCount(localMap); got != tt.noescape { t.Errorf("no escape: n=%d want %d buckets, got %d", tt.n, tt.noescape, got) } escapingMap := make(map[int]int) if count := runtime.MapBucketsCount(escapingMap); count > 1 && runtime.MapBucketsPointerIsNil(escapingMap) { t.Errorf("escape: buckets pointer is nil for n=%d buckets", count) } for i := 0; i < tt.n; i++ { escapingMap[i] = i } if got := runtime.MapBucketsCount(escapingMap); got != tt.escape { t.Errorf("escape: n=%d want %d buckets, got %d", tt.n, tt.escape, got) } mapSink = escapingMap } }) t.Run("makemap", func(t *testing.T) { for _, tt := range mapBucketTests { localMap := make(map[int]int, tt.n) if runtime.MapBucketsPointerIsNil(localMap) { t.Errorf("no escape: buckets pointer is nil for non-escaping map") } for i := 0; i < tt.n; i++ { localMap[i] = i } if got := runtime.MapBucketsCount(localMap); got != tt.noescape { t.Errorf("no escape: n=%d want %d buckets, got %d", tt.n, tt.noescape, got) } escapingMap := make(map[int]int, tt.n) if count := runtime.MapBucketsCount(escapingMap); count > 1 && runtime.MapBucketsPointerIsNil(escapingMap) { t.Errorf("escape: buckets pointer is nil for n=%d buckets", count) } for i := 0; i < tt.n; i++ { escapingMap[i] = i } if got := runtime.MapBucketsCount(escapingMap); got != tt.escape { t.Errorf("escape: n=%d want %d buckets, got %d", tt.n, tt.escape, got) } mapSink = escapingMap } }) t.Run("makemap64", func(t *testing.T) { for _, tt := range mapBucketTests { localMap := make(map[int]int, int64(tt.n)) if runtime.MapBucketsPointerIsNil(localMap) { t.Errorf("no escape: buckets pointer is nil for non-escaping map") } for i := 0; i < tt.n; i++ { localMap[i] = i } if got := runtime.MapBucketsCount(localMap); got != tt.noescape { t.Errorf("no escape: n=%d want %d buckets, got %d", tt.n, tt.noescape, got) } escapingMap := make(map[int]int, tt.n) if count := runtime.MapBucketsCount(escapingMap); count > 1 && runtime.MapBucketsPointerIsNil(escapingMap) { t.Errorf("escape: buckets pointer is nil for n=%d buckets", count) } for i := 0; i < tt.n; i++ { escapingMap[i] = i } if got := runtime.MapBucketsCount(escapingMap); got != tt.escape { t.Errorf("escape: n=%d want %d buckets, got %d", tt.n, tt.escape, got) } mapSink = escapingMap } }) }
explode_data.jsonl/19925
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1808 }
[ 2830, 3393, 2227, 33, 38551, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 429, 14043, 315, 2155, 12282, 614, 279, 1290, 1372, 315, 42112, 624, 197, 322, 11581, 12, 42480, 14043, 448, 2613, 42112, 320, 4803, 2415, 18640, 63025, 8, 258...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestConfigUseContext(t *testing.T) { settings := &environment.AirshipCTLSettings{Config: testutil.DummyConfig()} cmdTests := []*testutil.CmdTest{ { Name: "config-use-context", CmdLine: "dummy_context", Cmd: cmd.NewUseContextCommand(settings), }, { Name: "config-use-context-no-args", CmdLine: "", Cmd: cmd.NewUseContextCommand(settings), Error: errors.New("accepts 1 arg(s), received 0"), }, { Name: "config-use-context-does-not-exist", CmdLine: "foo", Cmd: cmd.NewUseContextCommand(settings), Error: errors.New("missing configuration: context with name 'foo'"), }, } for _, tt := range cmdTests { testutil.RunTest(t, tt) } }
explode_data.jsonl/43214
{ "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, 2648, 10253, 1972, 1155, 353, 8840, 836, 8, 341, 62930, 1669, 609, 23294, 875, 404, 5270, 23871, 6086, 90, 2648, 25, 1273, 1314, 909, 8574, 2648, 23509, 25920, 18200, 1669, 29838, 1944, 1314, 64512, 2271, 515, 197, 197, 515,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestInMemoryChannelIsReady(t *testing.T) { tests := []struct { name string markServiceReady bool markChannelServiceReady bool setAddress bool markEndpointsReady bool wantReady bool dispatcherStatus *appsv1.DeploymentStatus }{{ name: "all happy", markServiceReady: true, markChannelServiceReady: true, markEndpointsReady: true, dispatcherStatus: deploymentStatusReady, setAddress: true, wantReady: true, }, { name: "service not ready", markServiceReady: false, markChannelServiceReady: false, markEndpointsReady: true, dispatcherStatus: deploymentStatusReady, setAddress: true, wantReady: false, }, { name: "endpoints not ready", markServiceReady: true, markChannelServiceReady: false, markEndpointsReady: false, dispatcherStatus: deploymentStatusReady, setAddress: true, wantReady: false, }, { name: "deployment not ready", markServiceReady: true, markEndpointsReady: true, markChannelServiceReady: false, dispatcherStatus: deploymentStatusNotReady, setAddress: true, wantReady: false, }, { name: "address not set", markServiceReady: true, markChannelServiceReady: false, markEndpointsReady: true, dispatcherStatus: deploymentStatusReady, setAddress: false, wantReady: false, }, { name: "channel service not ready", markServiceReady: true, markChannelServiceReady: false, markEndpointsReady: true, dispatcherStatus: deploymentStatusReady, setAddress: true, wantReady: false, }} for _, test := range tests { t.Run(test.name, func(t *testing.T) { cs := &InMemoryChannelStatus{} cs.InitializeConditions() if test.markServiceReady { cs.MarkServiceTrue() } else { cs.MarkServiceFailed("NotReadyService", "testing") } if test.markChannelServiceReady { cs.MarkChannelServiceTrue() } else { cs.MarkChannelServiceFailed("NotReadyChannelService", "testing") } if test.setAddress { cs.SetAddress(&apis.URL{Scheme: "http", Host: "foo.bar"}) } if test.markEndpointsReady { cs.MarkEndpointsTrue() } else { cs.MarkEndpointsFailed("NotReadyEndpoints", "testing") } if test.dispatcherStatus != nil { cs.PropagateDispatcherStatus(test.dispatcherStatus) } else { cs.MarkDispatcherFailed("NotReadyDispatcher", "testing") } got := cs.IsReady() if test.wantReady != got { t.Errorf("unexpected readiness: want %v, got %v", test.wantReady, got) } }) } }
explode_data.jsonl/22197
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1366 }
[ 2830, 3393, 641, 10642, 9629, 3872, 19202, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 503, 914, 198, 197, 2109, 838, 1860, 19202, 286, 1807, 198, 197, 2109, 838, 9629, 1860, 19202, 1807, 198, 197, 8196, 42...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestStandardMetricListID(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() resolution := 10 * time.Second opts := testOptions(ctrl) listID := standardMetricListID{resolution: resolution} l, err := newStandardMetricList(testShard, listID, opts) require.NoError(t, err) expectedListID := metricListID{ listType: standardMetricListType, standard: listID, } require.Equal(t, expectedListID, l.ID()) }
explode_data.jsonl/43585
{ "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, 19781, 54310, 852, 915, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 10202, 3214, 1669, 220, 16, 15, 353, 882, 32435, 198, 64734, 1669, 1273, 3798, 62100, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLength(t *testing.T) { u := Vec3{3, 4, -2} v := Vec3{15, -2, 0} assert.Equal(t, math.Sqrt(u.X*u.X+u.Y*u.Y+u.Z*u.Z), Length(u)) assert.Equal(t, math.Sqrt(v.X*v.X+v.Y*v.Y+v.Z*v.Z), Length(v)) assert.Equal(t, 1.0, Length(UnitVector(u))) assert.Equal(t, 1.0, Length(UnitVector(v))) u = Vec3{0, 5, 0} v = Vec3{0, 0, 5} assert.Equal(t, Length(v), Length(u)) }
explode_data.jsonl/33713
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 4373, 1155, 353, 8840, 836, 8, 341, 10676, 1669, 11312, 18, 90, 18, 11, 220, 19, 11, 481, 17, 532, 5195, 1669, 11312, 18, 90, 16, 20, 11, 481, 17, 11, 220, 15, 630, 6948, 12808, 1155, 11, 6888, 70815, 8154, 4338, 591...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuild(t *testing.T) { color.Disable(true) defer color.Disable(false) rand.Seed(time.Now().UTC().UnixNano()) spec.Run(t, "build", testBuild, spec.Report(report.Terminal{})) }
explode_data.jsonl/21234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 11066, 1155, 353, 8840, 836, 8, 341, 21481, 10166, 480, 3715, 340, 16867, 1894, 10166, 480, 3576, 340, 7000, 437, 5732, 291, 9730, 13244, 1005, 21183, 1005, 55832, 83819, 2398, 98100, 16708, 1155, 11, 330, 5834, 497, 1273, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestDFS(t *testing.T) { g := map[int][]int{ 1: {2, 3}, 2: {4, 5}, 3: {6, 7}, 6: {2}, } t1 := newTestTraversal(g) stopped := DFS(t1, t1.Iter, 1) if stopped { t.Fatalf("Did not expect traversal to stop") } expected := []int{1, 3, 7, 6, 2, 5, 4} if !reflect.DeepEqual(expected, t1.ordered) { t.Fatalf("Expected DFS ordering %v but got: %v", expected, t1.ordered) } }
explode_data.jsonl/30657
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 191 }
[ 2830, 3393, 62266, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 2415, 18640, 45725, 396, 515, 197, 197, 16, 25, 314, 17, 11, 220, 18, 1583, 197, 197, 17, 25, 314, 19, 11, 220, 20, 1583, 197, 197, 18, 25, 314, 21, 11, 220, 22, 158...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEncrypt(t *testing.T){ fmt.Println("Test Encrypt ***") key := ReadFile("./keyfile") secret := Base64Decode(key) data := []byte("this is a test from Go") encResult, err := Encrypt(data, secret) fmt.Println("encResult:", key) fmt.Println("encResult:", encResult) if err != nil { fmt.Println("enc err", err) } fmt.Println("writing ./goencrypted.txt") writeErr := ioutil.WriteFile("./goencrypted.txt", []byte(encResult), 0644) if writeErr != nil { return } result, err := Decrypt(encResult, secret) fmt.Println("decrypted result:", result) fmt.Println("decryption err:", err) fmt.Println("") }
explode_data.jsonl/37322
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 61520, 1155, 353, 8840, 836, 1264, 11009, 12419, 445, 2271, 55459, 17160, 1138, 23634, 1669, 4457, 1703, 13988, 792, 1192, 1138, 197, 20474, 1669, 5351, 21, 19, 32564, 4857, 340, 8924, 1669, 3056, 3782, 445, 574, 374, 264, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResource_payload(t *testing.T) { type fields struct { session session.ServiceFormatter } type args struct { haltOnError bool requesters []Subrequester } tests := []struct { name string fields fields args args want *bytes.Reader wantErr bool }{ { name: "success", fields: fields{}, args: args{ haltOnError: true, requesters: []Subrequester{ &mockSubrequester{ url: "www.something.com", method: http.MethodGet, binaryPartAlais: "Alais", binaryPartName: "Name", richInput: map[string]interface{}{ "Name": "NewName", }, }, }, }, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { r := &Resource{ session: tt.fields.session, } _, err := r.payload(tt.args.haltOnError, tt.args.requesters) if (err != nil) != tt.wantErr { t.Errorf("Resource.payload() error = %v, wantErr %v", err, tt.wantErr) return } }) } }
explode_data.jsonl/19626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 498 }
[ 2830, 3393, 4783, 32813, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 25054, 3797, 13860, 14183, 198, 197, 532, 13158, 2827, 2036, 341, 197, 9598, 3145, 74945, 1807, 198, 197, 23555, 388, 220, 3056, 3136, 2035, 261, 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 TestAtLeast(t *testing.T) { t.Parallel() ctx, cancel := testAllocate(t, "js.html") defer cancel() var nodes []*cdp.Node if err := Run(ctx, Nodes("//input", &nodes, AtLeast(3))); err != nil { t.Fatalf("got error: %v", err) } if len(nodes) < 3 { t.Errorf("expected to have at least 3 nodes: got %d", len(nodes)) } }
explode_data.jsonl/59462
{ "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, 1655, 81816, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 20985, 11, 9121, 1669, 1273, 75380, 1155, 11, 330, 2519, 2564, 1138, 16867, 9121, 2822, 2405, 7798, 29838, 4385, 79, 21714, 198, 743, 1848, 1669, 6452, 7502...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetVolumeHandle(t *testing.T) { pv := &v1.PersistentVolume{ Spec: v1.PersistentVolumeSpec{ PersistentVolumeSource: v1.PersistentVolumeSource{ CSI: &v1.CSIPersistentVolumeSource{ Driver: "myDriver", VolumeHandle: "name", ReadOnly: false, }, }, }, } validPV := pv.DeepCopy() readOnlyPV := pv.DeepCopy() readOnlyPV.Spec.PersistentVolumeSource.CSI.ReadOnly = true invalidPV := pv.DeepCopy() invalidPV.Spec.PersistentVolumeSource.CSI = nil tests := []struct { pv *v1.PersistentVolume output string readOnly bool expectError bool }{ { pv: validPV, output: "name", }, { pv: readOnlyPV, output: "name", readOnly: true, }, { pv: invalidPV, output: "", expectError: true, }, } for i, test := range tests { output, readOnly, err := GetVolumeHandle(test.pv.Spec.CSI) if output != test.output { t.Errorf("test %d: expected volume ID %q, got %q", i, test.output, output) } if readOnly != test.readOnly { t.Errorf("test %d: expected readonly %v, got %v", i, test.readOnly, readOnly) } if err == nil && test.expectError { t.Errorf("test %d: expected error, got none", i) } if err != nil && !test.expectError { t.Errorf("test %d: got error %s", i, err) } } }
explode_data.jsonl/42157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 617 }
[ 2830, 3393, 1949, 18902, 6999, 1155, 353, 8840, 836, 8, 341, 3223, 85, 1669, 609, 85, 16, 61655, 18902, 515, 197, 7568, 992, 25, 348, 16, 61655, 18902, 8327, 515, 298, 10025, 13931, 18902, 3608, 25, 348, 16, 61655, 18902, 3608, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestGetGroupSyncable(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() group := th.CreateGroup() groupSyncable := &model.GroupSyncable{ GroupId: group.Id, CanLeave: true, AutoAdd: false, SyncableId: th.BasicTeam.Id, Type: model.GroupSyncableTypeTeam, } gs, err := th.App.CreateGroupSyncable(groupSyncable) require.Nil(t, err) require.NotNil(t, gs) gs, err = th.App.GetGroupSyncable(group.Id, th.BasicTeam.Id, model.GroupSyncableTypeTeam) require.Nil(t, err) require.NotNil(t, gs) }
explode_data.jsonl/37042
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 1949, 2808, 12154, 480, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 44260, 1669, 270, 7251, 2808, 741, 44260, 12154, 480, 1669, 609, 2528, 5407, 12154, 480,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultProcessor_RequestSignatures(t *testing.T) { srv := &testingcommons.MockIdentityService{} dp := DefaultProcessor(srv, nil, nil, cfg).(defaultProcessor) ctxh := testingconfig.CreateAccountContext(t, cfg) self, err := contextutil.Account(ctxh) assert.NoError(t, err) sr := utils.RandomSlice(32) sig, err := self.SignMsg(sr) assert.NoError(t, err) // data validations failed model := new(mockModel) model.On("ID").Return([]byte{}) model.On("CurrentVersion").Return([]byte{}) model.On("NextVersion").Return([]byte{}) model.On("CalculateSigningRoot").Return(nil, errors.New("error")) err = dp.RequestSignatures(ctxh, model) model.AssertExpectations(t) assert.Error(t, err) // key validation failed model = new(mockModel) id := utils.RandomSlice(32) next := utils.RandomSlice(32) model.On("ID").Return(id) model.On("CurrentVersion").Return(id) model.On("NextVersion").Return(next) model.On("CalculateSigningRoot").Return(sr, nil) model.On("Signatures").Return() model.sigs = append(model.sigs, sig) c := new(p2pClient) srv.On("ValidateSignature", mock.Anything, mock.Anything).Return(errors.New("cannot validate key")).Once() err = dp.RequestSignatures(ctxh, model) model.AssertExpectations(t) c.AssertExpectations(t) assert.Error(t, err) assert.Contains(t, err.Error(), "cannot validate key") // failed signature collection model = new(mockModel) model.On("ID").Return(id) model.On("CurrentVersion").Return(id) model.On("NextVersion").Return(next) model.On("CalculateSigningRoot").Return(sr, nil) model.On("Signatures").Return() model.sigs = append(model.sigs, sig) c = new(p2pClient) srv.On("ValidateSignature", mock.Anything, mock.Anything).Return(nil) c.On("GetSignaturesForDocument", ctxh, model).Return(nil, errors.New("failed to get signatures")).Once() dp.p2pClient = c err = dp.RequestSignatures(ctxh, model) model.AssertExpectations(t) c.AssertExpectations(t) assert.Error(t, err) assert.Contains(t, err.Error(), "failed to get signatures") // success model = new(mockModel) model.On("ID").Return(id) model.On("CurrentVersion").Return(id) model.On("NextVersion").Return(next) model.On("CalculateSigningRoot").Return(sr, nil) model.On("Signatures").Return() model.On("AppendSignatures", []*coredocumentpb.Signature{sig}).Return().Once() model.sigs = append(model.sigs, sig) c = new(p2pClient) c.On("GetSignaturesForDocument", ctxh, model).Return([]*coredocumentpb.Signature{sig}, nil).Once() dp.p2pClient = c err = dp.RequestSignatures(ctxh, model) model.AssertExpectations(t) c.AssertExpectations(t) assert.Nil(t, err) }
explode_data.jsonl/57867
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 985 }
[ 2830, 3393, 3675, 22946, 44024, 7264, 2789, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 1669, 609, 8840, 52361, 24664, 18558, 1860, 16094, 55256, 1669, 7899, 22946, 1141, 10553, 11, 2092, 11, 2092, 11, 13286, 68615, 2258, 22946, 340, 20985...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCloseIdleConnections(t *testing.T) { t.Parallel() ln := fasthttputil.NewInmemoryListener() s := &Server{ Handler: func(ctx *RequestCtx) { }, } go func() { if err := s.Serve(ln); err != nil { t.Error(err) } }() c := &Client{ Dial: func(addr string) (net.Conn, error) { return ln.Dial() }, } if _, _, err := c.Get(nil, "http://google.com"); err != nil { t.Fatal(err) } connsLen := func() int { c.mLock.Lock() defer c.mLock.Unlock() if _, ok := c.m["google.com"]; !ok { return 0 } c.m["google.com"].connsLock.Lock() defer c.m["google.com"].connsLock.Unlock() return len(c.m["google.com"].conns) } if conns := connsLen(); conns > 1 { t.Errorf("expected 1 conns got %d", conns) } c.CloseIdleConnections() if conns := connsLen(); conns > 0 { t.Errorf("expected 0 conns got %d", conns) } }
explode_data.jsonl/79328
{ "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, 7925, 41370, 54751, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 2261, 1669, 4937, 96336, 628, 321, 7121, 641, 17269, 2743, 2822, 1903, 1669, 609, 5475, 515, 197, 197, 3050, 25, 2915, 7502, 353, 1900, 23684, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEntry_DoubleTapped_AfterCol(t *testing.T) { entry := widget.NewEntry() entry.SetText("A\nB\n") c := fyne.CurrentApp().Driver().CanvasForObject(entry) test.Tap(entry) assert.Equal(t, c.Focused(), entry) testCharSize := theme.TextSize() pos := fyne.NewPos(testCharSize, testCharSize*4) // tap below rows ev := &fyne.PointEvent{Position: pos} entry.Tapped(ev) entry.DoubleTapped(ev) assert.Equal(t, "", entry.SelectedText()) }
explode_data.jsonl/57281
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 5874, 84390, 51, 5677, 1566, 1046, 6127, 1155, 353, 8840, 836, 8, 341, 48344, 1669, 9086, 7121, 5874, 741, 48344, 92259, 445, 32, 1699, 33, 1699, 1138, 1444, 1669, 51941, 811, 11517, 2164, 1005, 11349, 1005, 18226, 94604, 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 TestPeerWithSubstitutedConfig_WithEmptySubstituteUrl(t *testing.T) { _, fetchedConfig := testCommonConfigPeer(t, "peer0.org1.example.com", "peer4.org1.example3.com") if fetchedConfig.URL != "peer0.org1.example.com:7051" { t.Fatal("Fetched Config should have the same url") } if fetchedConfig.GRPCOptions["ssl-target-name-override"] != "peer0.org1.example.com" { t.Fatal("Fetched config should have the same ssl-target-name-override as its hostname") } }
explode_data.jsonl/34082
{ "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, 30888, 2354, 3136, 3696, 2774, 2648, 62, 2354, 3522, 3136, 7660, 2864, 1155, 353, 8840, 836, 8, 341, 197, 6878, 41442, 2648, 1669, 1273, 10839, 2648, 30888, 1155, 11, 330, 16537, 15, 2659, 16, 7724, 905, 497, 330, 16537, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQuotingIfNecessary(t *testing.T) { cases := map[string]string{ "foo": "foo", "\"foo\"": "\"foo\"", "foo bar": "\"foo bar\"", "Allen, C.": "\"Allen, C.\"", } for input, expected := range cases { if dot.QuoteIfNecessary(input) != expected { t.Errorf("'%s' != '%s'", dot.QuoteIfNecessary(input), expected) } } }
explode_data.jsonl/405
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 2183, 11519, 2679, 45, 20122, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 7975, 788, 981, 330, 7975, 756, 197, 197, 1, 2105, 7975, 2105, 788, 256, 15898, 7975, 95901, 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...
3
func TestLoggedIn_Hydra_Success_Log(t *testing.T) { s, cfg, _, h, _, err := setupHydraTest(true) if err != nil { t.Fatalf("setupHydraTest() failed: %v", err) } logs, close := fakesdl.New() defer close() s.logger = logs.Client serviceinfo.Project = "p1" serviceinfo.Type = "t1" serviceinfo.Name = "n1" pname := "dr_joe_elixir" sendLoggedIn(t, s, cfg, h, pname, "", loginStateID, pb.ResourceTokenRequestState_DATASET) logs.Client.Close() got := logs.Server.Logs[0].Entries[0] want := &lepb.LogEntry{ Payload: &lepb.LogEntry_JsonPayload{}, Severity: lspb.LogSeverity_DEFAULT, Labels: map[string]string{ "type": "policy_decision_log", "token_id": "token-id-dr_joe_elixir", "token_subject": "dr_joe_elixir", "token_issuer": "https://hydra.example.com/", "pass_auth_check": "true", "error_type": "", "resource": "master/ga4gh-apis/gcs_read/viewer", "ttl": "1h", "project_id": "p1", "service_type": "t1", "service_name": "n1", "cart_id": "ls-1234", "config_revision": "1", }, } got.Timestamp = nil if diff := cmp.Diff(want, got, protocmp.Transform()); diff != "" { t.Fatalf("Logs returned diff (-want +got):\n%s", diff) } }
explode_data.jsonl/18497
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 615 }
[ 2830, 3393, 28559, 2039, 88, 22248, 87161, 44083, 1155, 353, 8840, 836, 8, 341, 1903, 11, 13286, 11, 8358, 305, 11, 8358, 1848, 1669, 6505, 30816, 22248, 2271, 3715, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 15188, 30816, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetIndexFromCache(t *testing.T) { repoURL := "https://test.com" data := []byte("foo") index, sha := getIndexFromCache(repoURL, data) if index != nil { t.Error("Index should be empty since it's not in the cache yet") } fakeIndex := &repo.IndexFile{} storeIndexInCache(repoURL, fakeIndex, sha) index, _ = getIndexFromCache(repoURL, data) if index != fakeIndex { t.Error("It should return the stored index") } }
explode_data.jsonl/12751
{ "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, 1949, 1552, 3830, 8233, 1155, 353, 8840, 836, 8, 341, 17200, 5368, 3144, 1669, 330, 2428, 1110, 1944, 905, 698, 8924, 1669, 3056, 3782, 445, 7975, 1138, 26327, 11, 15870, 1669, 89771, 3830, 8233, 50608, 3144, 11, 821, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_runShowCmd(t *testing.T) { runningUnattended := isRunningUnattended() cmd := ShowKeysCmd() mockIn, _, _ := tests.ApplyMockIO(cmd) require.EqualError(t, runShowCmd(cmd, []string{"invalid"}), "The specified item could not be found in the keyring") require.EqualError(t, runShowCmd(cmd, []string{"invalid1", "invalid2"}), "The specified item could not be found in the keyring") // Prepare a key base // Now add a temporary keybase kbHome, cleanUp := tests.NewTestCaseDir(t) defer cleanUp() viper.Set(flags.FlagHome, kbHome) fakeKeyName1 := "runShowCmd_Key1" fakeKeyName2 := "runShowCmd_Key2" kb, err := keys.NewKeyring(sdk.KeyringServiceName(), viper.GetString(flags.FlagKeyringBackend), viper.GetString(flags.FlagHome), mockIn) require.NoError(t, err) defer func() { kb.Delete("runShowCmd_Key1", "", false) kb.Delete("runShowCmd_Key2", "", false) }() if runningUnattended { mockIn.Reset("testpass1\ntestpass1\n") } _, err = kb.CreateAccount(fakeKeyName1, tests.TestMnemonic, "", "", "0", keys.Secp256k1) require.NoError(t, err) if runningUnattended { mockIn.Reset("testpass1\n") } _, err = kb.CreateAccount(fakeKeyName2, tests.TestMnemonic, "", "", "1", keys.Secp256k1) require.NoError(t, err) // Now try single key if runningUnattended { mockIn.Reset("testpass1\n") } require.EqualError(t, runShowCmd(cmd, []string{fakeKeyName1}), "invalid Bech32 prefix encoding provided: ") // Now try single key - set bech to acc viper.Set(FlagBechPrefix, sdk.PrefixAccount) if runningUnattended { mockIn.Reset("testpass1\n") } require.NoError(t, runShowCmd(cmd, []string{fakeKeyName1})) // Now try multisig key - set bech to acc viper.Set(FlagBechPrefix, sdk.PrefixAccount) if runningUnattended { mockIn.Reset("testpass1\ntestpass1\n") } require.EqualError(t, runShowCmd(cmd, []string{fakeKeyName1, fakeKeyName2}), "threshold must be a positive integer") // Now try multisig key - set bech to acc + threshold=2 viper.Set(FlagBechPrefix, sdk.PrefixAccount) viper.Set(flagMultiSigThreshold, 2) if runningUnattended { mockIn.Reset("testpass1\ntestpass1\n") } err = runShowCmd(cmd, []string{fakeKeyName1, fakeKeyName2}) require.NoError(t, err) // Now try multisig key - set bech to acc + threshold=2 viper.Set(FlagBechPrefix, "acc") viper.Set(FlagDevice, true) viper.Set(flagMultiSigThreshold, 2) if runningUnattended { mockIn.Reset("testpass1\ntestpass1\n") } err = runShowCmd(cmd, []string{fakeKeyName1, fakeKeyName2}) require.EqualError(t, err, "the device flag (-d) can only be used for accounts stored in devices") viper.Set(FlagBechPrefix, "val") if runningUnattended { mockIn.Reset("testpass1\ntestpass1\n") } err = runShowCmd(cmd, []string{fakeKeyName1, fakeKeyName2}) require.EqualError(t, err, "the device flag (-d) can only be used for accounts") viper.Set(FlagPublicKey, true) if runningUnattended { mockIn.Reset("testpass1\ntestpass1\n") } err = runShowCmd(cmd, []string{fakeKeyName1, fakeKeyName2}) require.EqualError(t, err, "the device flag (-d) can only be used for addresses not pubkeys") // TODO: Capture stdout and compare }
explode_data.jsonl/45324
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1216 }
[ 2830, 3393, 14007, 7812, 15613, 1155, 353, 8840, 836, 8, 341, 197, 27173, 1806, 84906, 1669, 374, 18990, 1806, 84906, 741, 25920, 1669, 6928, 8850, 15613, 741, 77333, 641, 11, 8358, 716, 1669, 7032, 36051, 11571, 3810, 14160, 340, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNew_Only48BitAddresses(t *testing.T) { tc := []struct { addr string success bool }{ {"00:00:5e:00:53:01", true}, {"02:00:5e:10:00:00:00:01", false}, {"00:00:00:00:fe:80:00:00:00:00:00:00:02:00:5e:10:00:00:00:01", false}, {"00-00-5e-00-53-01", true}, {"02-00-5e-10-00-00-00-01", false}, {"00-00-00-00-fe-80-00-00-00-00-00-00-02-00-5e-10-00-00-00-01", false}, {"0000.5e00.5301", true}, {"0200.5e10.0000.0001", false}, {"0000.0000.fe80.0000.0000.0000.0200.5e10.0000.0001", false}, } for _, tt := range tc { t.Run(tt.addr, func(t *testing.T) { _, err := New(tt.addr) if (err == nil) != tt.success { t.Errorf("parsing %+v should fail, but it didnt", tt.addr) } }) } }
explode_data.jsonl/8289
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 384 }
[ 2830, 3393, 3564, 62, 7308, 19, 23, 8344, 52290, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 3056, 1235, 341, 197, 53183, 262, 914, 198, 197, 30553, 1807, 198, 197, 59403, 197, 197, 4913, 15, 15, 25, 15, 15, 25, 20, 68, 25, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCondBreakpoint(t *testing.T) { skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("parallel_next", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 9) bp.UserBreaklet().Cond = &ast.BinaryExpr{ Op: token.EQL, X: &ast.Ident{Name: "n"}, Y: &ast.BasicLit{Kind: token.INT, Value: "7"}, } assertNoError(p.Continue(), t, "Continue()") nvar := evalVariable(p, t, "n") n, _ := constant.Int64Val(nvar.Value) if n != 7 { t.Fatalf("Stopped on wrong goroutine %d\n", n) } }) }
explode_data.jsonl/56238
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 49696, 22524, 2768, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 1925, 1155, 11, 330, 48909, 497, 330, 10593, 51835, 1138, 197, 776, 1944, 29081, 52856, 1155, 340, 46948, 2271, 7423, 445, 46103, 11257, 497, 259, 11, 2915, 1295...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestToBytes(t *testing.T) { type args struct { lang string s []string } tests := []struct { name string args args want []byte wantErr bool }{ // these are the reverse of all of the tests above {"a", args{"en", []string{"abandon", "amount", "mom"}}, []byte{0, 1, 2}, false}, {"b", args{"en", strings.Split("abandon amount liar amount expire adjust cage candy arch gather drum bundle", " ")}, []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, false}, {"c", args{"en", strings.Split("goat amount liar amount expire adjust cage candy arch gather drum buyer", " ")}, []byte{100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, false}, {"d", args{"en", strings.Split("average spy bicycle", " ")}, []byte{15, 218, 104}, false}, {"e", args{"en", strings.Split("forum circle differ help use suspect this dune soon seek swamp joy artefact stone hill guide silver addict", " ")}, []byte{91, 165, 36, 247, 53, 142, 251, 181, 184, 50, 32, 207, 88, 99, 108, 188, 64, 207, 172, 154, 235, 60, 200, 192}, false}, {"f", args{"en", strings.Split("clarify say gorilla brass coach capable shock knock tongue width earn negative floor staff elbow aim", " ")}, []byte{41, 247, 253, 146, 141, 146, 202, 67, 241, 147, 222, 228, 127, 89, 21, 73, 245, 151, 168, 17, 200}, false}, // check for bad language {"g", args{"sp", []string{"abandon", "amount", "mom"}}, nil, true}, // check for bad checksum {"i", args{"en", strings.Split("badge badge badge badge badge badge badge badge mushroom mushroom snake snake", " ")}, nil, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := ToBytes(tt.args.lang, tt.args.s) if (err != nil) != tt.wantErr { t.Errorf("ToBytes() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("ToBytes() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/32824
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 762 }
[ 2830, 3393, 1249, 7078, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 197, 5205, 914, 198, 197, 1903, 262, 3056, 917, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMemPipe(t *testing.T) { a, b := memPipe() if err := a.writePacket([]byte{42}); err != nil { t.Fatalf("writePacket: %v", err) } if err := a.Close(); err != nil { t.Fatal("Close: ", err) } p, err := b.readPacket() if err != nil { t.Fatal("readPacket: ", err) } if len(p) != 1 || p[0] != 42 { t.Fatalf("got %v, want {42}", p) } p, err = b.readPacket() if err != io.EOF { t.Fatalf("got %v, %v, want EOF", p, err) } }
explode_data.jsonl/62916
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 18816, 34077, 1155, 353, 8840, 836, 8, 341, 262, 264, 11, 293, 1669, 1833, 34077, 741, 262, 421, 1848, 1669, 264, 3836, 16679, 10556, 3782, 90, 19, 17, 14088, 1848, 961, 2092, 341, 286, 259, 30762, 445, 4934, 16679, 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...
7
func TestNormalize(t *testing.T) { t.Parallel() assert.Equal(t, ".", Normalize("")) assert.Equal(t, ".", Normalize(".")) assert.Equal(t, ".", Normalize("./.")) assert.Equal(t, "foo", Normalize("./foo")) assert.Equal(t, "../foo", Normalize("../foo")) assert.Equal(t, "../foo", Normalize("../foo")) assert.Equal(t, "foo", Normalize("foo/")) assert.Equal(t, "foo", Normalize("./foo/")) assert.Equal(t, "/foo", Normalize("/foo")) assert.Equal(t, "/foo", Normalize("/foo/")) assert.Equal(t, "/foo/bar", Normalize("/foo/../foo/bar")) }
explode_data.jsonl/11896
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 87824, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 6948, 12808, 1155, 11, 68514, 68092, 73303, 6948, 12808, 1155, 11, 68514, 68092, 5680, 5455, 6948, 12808, 1155, 11, 68514, 68092, 13988, 13, 5455, 6948, 12808, 1155,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidateSpanType(t *testing.T) { validateTransaction(t, func(tx *apm.Transaction) { tx.StartSpan("name", strings.Repeat("x", 1025), nil).End() }) }
explode_data.jsonl/787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 62 }
[ 2830, 3393, 17926, 12485, 929, 1155, 353, 8840, 836, 8, 341, 197, 7067, 8070, 1155, 11, 2915, 27301, 353, 391, 76, 29284, 8, 341, 197, 46237, 12101, 12485, 445, 606, 497, 9069, 2817, 10979, 445, 87, 497, 220, 16, 15, 17, 20, 701, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFailureBadIntTags(t *testing.T) { badTagESSpan, err := loadESSpanFixture(1) require.NoError(t, err) badTagESSpan.Tags = []KeyValue{ { Key: "meh", Value: "meh", Type: "int64", }, } failingSpanTransformAnyMsg(t, &badTagESSpan) }
explode_data.jsonl/5143
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 17507, 17082, 1072, 15930, 1155, 353, 8840, 836, 8, 341, 2233, 329, 5668, 9996, 848, 11, 1848, 1669, 2795, 9996, 848, 18930, 7, 16, 340, 17957, 35699, 1155, 11, 1848, 692, 2233, 329, 5668, 9996, 848, 73522, 284, 3056, 7208...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestActionLoadSetField(t *testing.T) { var tests = []struct { desc string a Action action string err error }{ { desc: "set field both empty", a: SetField("", ""), err: errLoadSetFieldZero, }, { desc: "set field value empty", a: SetField("", "arp_spa"), err: errLoadSetFieldZero, }, { desc: "set field field empty", a: SetField("192.168.1.1", ""), err: errLoadSetFieldZero, }, { desc: "load both empty", a: Load("", ""), err: errLoadSetFieldZero, }, { desc: "load value empty", a: Load("", "NXM_OF_ARP_OP[]"), err: errLoadSetFieldZero, }, { desc: "load field empty", a: Load("0x2", ""), err: errLoadSetFieldZero, }, { desc: "set field OK", a: SetField("192.168.1.1", "arp_spa"), action: "set_field:192.168.1.1->arp_spa", }, { desc: "load OK", a: Load("0x2", "NXM_OF_ARP_OP[]"), action: "load:0x2->NXM_OF_ARP_OP[]", }, } for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { action, err := tt.a.MarshalText() if want, got := tt.err, err; want != got { t.Fatalf("unexpected error:\n- want: %v\n- got: %v", want, got) } if err != nil { return } if want, got := tt.action, string(action); want != got { t.Fatalf("unexpected Action:\n- want: %q\n- got: %q", want, got) } }) } }
explode_data.jsonl/49516
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 714 }
[ 2830, 3393, 2512, 5879, 1649, 1877, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 41653, 256, 914, 198, 197, 11323, 414, 5586, 198, 197, 38933, 914, 198, 197, 9859, 262, 1465, 198, 197, 59403, 197, 197, 515, 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 Test_prepareResponse(t *testing.T) { rsp := httptest.NewRecorder() prepareResponse(rsp, json.TypeCharset) assert.Equal(t, json.TypeCharset, rsp.Header().Get(encoding.ContentTypeHeader)) }
explode_data.jsonl/54959
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 47460, 2582, 1155, 353, 8840, 836, 8, 341, 7000, 2154, 1669, 54320, 70334, 7121, 47023, 741, 197, 13609, 2582, 2601, 2154, 11, 2951, 10184, 78172, 340, 6948, 12808, 1155, 11, 2951, 10184, 78172, 11, 42160, 15753, 1005, 1949, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestM(t *testing.T) { m := Money{} if m.M != 0 { t.Errorf("expected money amount to be %v, got %v", 0, m.M) } m = Money{-123, "EUR"} if m.M != -123 { t.Errorf("expected money amount to be %v, got %v", -123, m.M) } m = Money{123, "EUR"} if m.M != 123 { t.Errorf("expected money amount to be %v, got %v", 123, m.M) } }
explode_data.jsonl/61364
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 44, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 17633, 16094, 743, 296, 1321, 961, 220, 15, 341, 197, 3244, 13080, 445, 7325, 3220, 3311, 311, 387, 1018, 85, 11, 2684, 1018, 85, 497, 220, 15, 11, 296, 1321, 340, 197, 630...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestMatchIP(t *testing.T) { // Check that pattern matching is working. c := &Certificate{ DNSNames: []string{"*.foo.bar.baz"}, Subject: pkix.Name{ CommonName: "*.foo.bar.baz", }, } err := c.VerifyHostname("quux.foo.bar.baz") if err != nil { t.Fatalf("VerifyHostname(quux.foo.bar.baz): %v", err) } // But check that if we change it to be matching against an IP address, // it is rejected. c = &Certificate{ DNSNames: []string{"*.2.3.4"}, Subject: pkix.Name{ CommonName: "*.2.3.4", }, } err = c.VerifyHostname("1.2.3.4") if err == nil { t.Fatalf("VerifyHostname(1.2.3.4) should have failed, did not") } c = &Certificate{ IPAddresses: []net.IP{net.ParseIP("127.0.0.1"), net.ParseIP("::1")}, } err = c.VerifyHostname("127.0.0.1") if err != nil { t.Fatalf("VerifyHostname(127.0.0.1): %v", err) } err = c.VerifyHostname("::1") if err != nil { t.Fatalf("VerifyHostname(::1): %v", err) } err = c.VerifyHostname("[::1]") if err != nil { t.Fatalf("VerifyHostname([::1]): %v", err) } }
explode_data.jsonl/56545
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 480 }
[ 2830, 3393, 8331, 3298, 1155, 353, 8840, 836, 8, 341, 197, 322, 4248, 429, 5383, 12579, 374, 3238, 624, 1444, 1669, 609, 33202, 515, 197, 10957, 2448, 7980, 25, 3056, 917, 4913, 19922, 7975, 22001, 948, 1370, 7115, 197, 197, 13019, 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...
6
func TestClustersReplicationMinMaxNoRealloc(t *testing.T) { ctx := context.Background() if nClusters < 5 { t.Skip("Need at least 5 peers") } clusters, mock := createClusters(t) defer shutdownClusters(t, clusters, mock) for _, c := range clusters { c.config.ReplicationFactorMin = 1 c.config.ReplicationFactorMax = nClusters } ttlDelay() h := test.Cid1 _, err := clusters[0].Pin(ctx, h, api.PinOptions{}) if err != nil { t.Fatal(err) } pinDelay() // Shutdown two peers clusters[nClusters-1].Shutdown(ctx) waitForLeaderAndMetrics(t, clusters) clusters[nClusters-2].Shutdown(ctx) waitForLeaderAndMetrics(t, clusters) _, err = clusters[0].Pin(ctx, h, api.PinOptions{}) if err != nil { t.Fatal(err) } pinDelay() p, err := clusters[0].PinGet(ctx, h) if err != nil { t.Fatal(err) } if len(p.Allocations) != nClusters { t.Error("allocations should still be nCluster even if not all available") } if p.ReplicationFactorMax != nClusters { t.Error("rplMax should have not changed") } }
explode_data.jsonl/66616
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 406 }
[ 2830, 3393, 94992, 18327, 1693, 92304, 2753, 693, 4742, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 743, 308, 94992, 366, 220, 20, 341, 197, 3244, 57776, 445, 23657, 518, 3245, 220, 20, 25029, 1138, 197, 630, 39407, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBytes_EncodedLength(t *testing.T) { assertEncodedLength(t, []encodedLengthAssert{ {NewBytes(MustHexDecodeString("0x00")), 2}, {NewBytes(MustHexDecodeString("0xab1234")), 4}, {NewBytes(MustHexDecodeString("0x0001")), 3}, }) }
explode_data.jsonl/70593
{ "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, 7078, 93529, 6737, 4373, 1155, 353, 8840, 836, 8, 341, 6948, 46795, 4373, 1155, 11, 3056, 19329, 4373, 8534, 515, 197, 197, 90, 3564, 7078, 3189, 590, 20335, 32564, 703, 445, 15, 87, 15, 15, 35674, 220, 17, 1583, 197, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStrArray_Chunk(t *testing.T) { gtest.C(t, func(t *gtest.T) { a1 := []string{"1", "2", "3", "4", "5"} array1 := garray.NewStrArrayFrom(a1) chunks := array1.Chunk(2) t.Assert(len(chunks), 3) t.Assert(chunks[0], []string{"1", "2"}) t.Assert(chunks[1], []string{"3", "4"}) t.Assert(chunks[2], []string{"5"}) t.Assert(len(array1.Chunk(0)), 0) }) gtest.C(t, func(t *gtest.T) { a1 := []string{"1", "2", "3", "4", "5"} array1 := garray.NewStrArrayFrom(a1) chunks := array1.Chunk(3) t.Assert(len(chunks), 2) t.Assert(chunks[0], []string{"1", "2", "3"}) t.Assert(chunks[1], []string{"4", "5"}) t.Assert(array1.Chunk(0), nil) }) gtest.C(t, func(t *gtest.T) { a1 := []string{"1", "2", "3", "4", "5", "6"} array1 := garray.NewStrArrayFrom(a1) chunks := array1.Chunk(2) t.Assert(len(chunks), 3) t.Assert(chunks[0], []string{"1", "2"}) t.Assert(chunks[1], []string{"3", "4"}) t.Assert(chunks[2], []string{"5", "6"}) t.Assert(array1.Chunk(0), nil) }) gtest.C(t, func(t *gtest.T) { a1 := []string{"1", "2", "3", "4", "5", "6"} array1 := garray.NewStrArrayFrom(a1) chunks := array1.Chunk(3) t.Assert(len(chunks), 2) t.Assert(chunks[0], []string{"1", "2", "3"}) t.Assert(chunks[1], []string{"4", "5", "6"}) t.Assert(array1.Chunk(0), nil) }) }
explode_data.jsonl/53093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 687 }
[ 2830, 3393, 2580, 1857, 27588, 3122, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11323, 16, 1669, 3056, 917, 4913, 16, 497, 330, 17, 497, 330, 18, 497, 330, 19, 497, 330, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_ElasticsearchTarget(t *testing.T) { t.Run("Send with Annually Result", func(t *testing.T) { callback := func(req *http.Request) { if contentType := req.Header.Get("Content-Type"); contentType != "application/json; charset=utf-8" { t.Errorf("Unexpected Content-Type: %s", contentType) } if agend := req.Header.Get("User-Agent"); agend != "Policy-Reporter" { t.Errorf("Unexpected Host: %s", agend) } if url := req.URL.String(); url != "http://localhost:9200/policy-reporter-"+time.Now().Format("2006")+"/event" { t.Errorf("Unexpected Host: %s", url) } } client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "annually", "", false, testClient{callback, 200}) client.Send(completeResult) }) t.Run("Send with Monthly Result", func(t *testing.T) { callback := func(req *http.Request) { if url := req.URL.String(); url != "http://localhost:9200/policy-reporter-"+time.Now().Format("2006.01")+"/event" { t.Errorf("Unexpected Host: %s", url) } } client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "monthly", "", false, testClient{callback, 200}) client.Send(completeResult) }) t.Run("Send with Monthly Result", func(t *testing.T) { callback := func(req *http.Request) { if url := req.URL.String(); url != "http://localhost:9200/policy-reporter-"+time.Now().Format("2006.01.02")+"/event" { t.Errorf("Unexpected Host: %s", url) } } client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "daily", "", false, testClient{callback, 200}) client.Send(completeResult) }) t.Run("Send with None Result", func(t *testing.T) { callback := func(req *http.Request) { if url := req.URL.String(); url != "http://localhost:9200/policy-reporter/event" { t.Errorf("Unexpected Host: %s", url) } } client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "none", "", false, testClient{callback, 200}) client.Send(completeResult) }) t.Run("Send with ignored Priority", func(t *testing.T) { callback := func(req *http.Request) { t.Errorf("Unexpected Call") } client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "none", "error", false, testClient{callback, 200}) client.Send(completeResult) }) t.Run("SkipExistingOnStartup", func(t *testing.T) { callback := func(req *http.Request) { t.Errorf("Unexpected Call") } client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "none", "", true, testClient{callback, 200}) if !client.SkipExistingOnStartup() { t.Error("Should return configured SkipExistingOnStartup") } }) t.Run("Name", func(t *testing.T) { client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "none", "", true, testClient{}) if client.Name() != "Elasticsearch" { t.Errorf("Unexpected Name %s", client.Name()) } }) t.Run("MinimumPriority", func(t *testing.T) { client := elasticsearch.NewClient("http://localhost:9200", "policy-reporter", "none", "debug", true, testClient{}) if client.MinimumPriority() != "debug" { t.Errorf("Unexpected MinimumPriority %s", client.MinimumPriority()) } }) }
explode_data.jsonl/38183
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1179 }
[ 2830, 3393, 2089, 51179, 1836, 6397, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 11505, 448, 9305, 1832, 5714, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 43350, 1669, 2915, 6881, 353, 1254, 9659, 8, 341, 298, 743, 32103, 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...
4
func TestResolveMapParamUnknown(t *testing.T) { cxt := context.NewTestContext(t) m := &Manifest{ Parameters: []ParameterDefinition{}, } rm := NewRuntimeManifest(cxt.Context, ActionInstall, m) s := &Step{ Data: map[string]interface{}{ "description": "a test step", "Parameters": map[string]interface{}{ "Thing": "{{bundle.parameters.person}}", }, }, } err := rm.ResolveStep(s) require.Error(t, err) assert.Equal(t, "unable to resolve step: unable to render template Parameters:\n Thing: '{{bundle.parameters.person}}'\ndescription: a test step\n: Missing variable \"person\"", err.Error()) }
explode_data.jsonl/37709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 56808, 2227, 2001, 13790, 1155, 353, 8840, 836, 8, 341, 1444, 2252, 1669, 2266, 7121, 2271, 1972, 1155, 340, 2109, 1669, 609, 38495, 515, 197, 197, 9706, 25, 3056, 4971, 10398, 38837, 197, 532, 70945, 1669, 1532, 15123, 3849...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServerReloadTrigger(t *testing.T) { f := newFixture(t) store := f.server.store ctx := context.Background() txn := storage.NewTransactionOrDie(ctx, store, storage.WriteParams) if err := store.UpsertPolicy(ctx, txn, "test", []byte("package test\np = 1")); err != nil { panic(err) } if err := f.v1(http.MethodGet, "/data/test", "", 200, `{}`); err != nil { t.Fatalf("Unexpected error from server: %v", err) } if err := store.Commit(ctx, txn); err != nil { panic(err) } if err := f.v1(http.MethodGet, "/data/test", "", 200, `{"result": {"p": 1}}`); err != nil { t.Fatalf("Unexpected error from server: %v", err) } }
explode_data.jsonl/79031
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 5475, 50035, 17939, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 57279, 1669, 282, 12638, 16114, 198, 20985, 1669, 2266, 19047, 741, 3244, 42967, 1669, 5819, 7121, 8070, 2195, 18175, 7502, 11, 3553, 11, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSmallTimeout(t *testing.T) { conf := &Config{ Host: "127.0.0.1", Port: 8500, GossipInterval: 200 * time.Millisecond, } n := 3 cs := newN(t, n, conf) defer cleanup(cs[1:]) check: <-time.After(2 * conf.GossipInterval) for _, c := range cs { a := len(c.Alive(true)) if a != n { t.Log("waiting for membership to form: expected", n, "alive, got:", a, "me", c.Me()) goto check } } cs[0].Die() <-time.After(30 * conf.GossipInterval) for _, c := range cs[1:] { a := len(c.Alive(true)) if a != n-1 { t.Error("expected", n-1, "alive, got:", a, "me", c.Me()) } } }
explode_data.jsonl/22695
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 312 }
[ 2830, 3393, 25307, 7636, 1155, 353, 8840, 836, 8, 341, 67850, 1669, 609, 2648, 515, 197, 197, 9296, 25, 1843, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 756, 197, 98459, 25, 1843, 220, 23, 20, 15, 15, 345, 197, 9600, 41473, 10256,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccAppfwurlencodedformcontenttype_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAppfwurlencodedformcontenttypeDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAppfwurlencodedformcontenttype_basic, Check: resource.ComposeTestCheckFunc( testAccCheckAppfwurlencodedformcontenttypeExist("citrixadc_appfwurlencodedformcontenttype.tf_urlencodedformcontenttype", nil), resource.TestCheckResourceAttr("citrixadc_appfwurlencodedformcontenttype.tf_urlencodedformcontenttype", "urlencodedformcontenttypevalue", "tf_urlencodedformcontenttype"), resource.TestCheckResourceAttr("citrixadc_appfwurlencodedformcontenttype.tf_urlencodedformcontenttype", "isregex", "NOTREGEX"), ), }, }, }) }
explode_data.jsonl/2083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 313 }
[ 2830, 3393, 14603, 2164, 20564, 1085, 19329, 627, 1796, 1313, 34729, 1155, 353, 8840, 836, 8, 341, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 257, 2915, 368, 314, 1273, 14603, 4703, 3973, 1155, 8, 1153, 197, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParse(t *testing.T) { node := new(Node) nodeConfig := config.NodeConfig{ Name: "node1", DownAfterNoAlive: 100, IdleConns: 16, User: "hello", Password: "world", Master: "127.0.0.1:3307", Slave: []string{ "192.168.1.12:3306@2", "192.168.1.13:3306@4", "192.168.1.14:3306@8", }, } node.Cfg = nodeConfig err := node.ParseMaster(nodeConfig.Master) if err != nil { t.Fatal(err.Error()) } if node.Master.addr != "127.0.0.1:3307" { t.Fatal(node.Master) } err = node.ParseSlave(nodeConfig.Slave) if err != nil { t.Fatal(err.Error()) } t.Logf("%v\n", node.RoundRobinQ) t.Logf("%v\n", node.SlaveWeights) t.Logf("%v\n", node.Master) t.Logf("%v\n", node.Slave) }
explode_data.jsonl/62471
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 406 }
[ 2830, 3393, 14463, 1155, 353, 8840, 836, 8, 341, 20831, 1669, 501, 22078, 340, 20831, 2648, 1669, 2193, 21714, 2648, 515, 197, 21297, 25, 1797, 330, 3509, 16, 756, 197, 197, 4454, 6025, 2753, 32637, 25, 220, 16, 15, 15, 345, 197, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetModification(t *testing.T) { visitor := createVisitor("test", nil) // Test before sync _, err := visitor.getModification("not_exists", true) assert.NotEqual(t, nil, err, "Should raise an error as modifications are not synced") // Test infos before sync _, err = visitor.GetModificationInfo("not_exists") assert.NotEqual(t, nil, err, "Should raise an error as modifications are not synced") visitor.SynchronizeModifications() // Test default value val, err := visitor.getModification("not_exists", true) assert.NotEqual(t, nil, err, "Should have an error as key does not exist") assert.Equal(t, nil, val, "Expected nil value") // Test infos of missing key _, err = visitor.GetModificationInfo("not_exists") assert.NotEqual(t, nil, err, "Should raise an error as modification key does not exist") // Test response value val, err = visitor.getModification("test_string", true) assert.Equal(t, nil, err, "Should not have an error as flag exists") assert.Equal(t, "string", val, "Expected string value") // Test modification info response value infos, err := visitor.GetModificationInfo("test_string") assert.Equal(t, nil, err, "Should not have an error as flag exists") assert.Equal(t, caID, infos.CampaignID) assert.Equal(t, vgID, infos.VariationGroupID) assert.Equal(t, testVID, infos.VariationID) assert.Equal(t, true, infos.IsReference) assert.Equal(t, "string", infos.Value) }
explode_data.jsonl/12289
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 1949, 80795, 1155, 353, 8840, 836, 8, 341, 197, 39985, 1669, 1855, 16796, 445, 1944, 497, 2092, 692, 197, 322, 3393, 1573, 12811, 198, 197, 6878, 1848, 1669, 20181, 670, 80795, 445, 1921, 9766, 497, 830, 340, 6948, 15000, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOrthodoxEaster(t *testing.T) { easter2019 := time.Date(2019, time.April, 28, 0, 0, 0, 0, time.UTC) easter2020 := time.Date(2020, time.April, 19, 0, 0, 0, 0, time.UTC) assert.Equal(t, easter2019, easter(2019, EasterOrthodox)) assert.Equal(t, easter2020, easter(2020, EasterOrthodox)) assert.NotEqual(t, easter2020, easter(2019, EasterOrthodox)) }
explode_data.jsonl/66808
{ "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, 66537, 30062, 36, 2300, 1155, 353, 8840, 836, 8, 341, 7727, 2300, 17, 15, 16, 24, 1669, 882, 8518, 7, 17, 15, 16, 24, 11, 882, 875, 649, 321, 11, 220, 17, 23, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFileResolve(t *testing.T) { set := NewHTMLSet("./testData/resolve") RunJetTestWithSet(t, set, nil, nil, "simple", "", "simple") RunJetTestWithSet(t, set, nil, nil, "simple.jet", "", "simple.jet") RunJetTestWithSet(t, set, nil, nil, "extension", "", "extension.jet.html") RunJetTestWithSet(t, set, nil, nil, "extension.jet.html", "", "extension.jet.html") RunJetTestWithSet(t, set, nil, nil, "./sub/subextend", "", "simple - simple.jet - extension.jet.html") RunJetTestWithSet(t, set, nil, nil, "./sub/extend", "", "simple - simple.jet - extension.jet.html") //for key, _ := range set.templates { // t.Log(key) //} }
explode_data.jsonl/22906
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 252 }
[ 2830, 3393, 1703, 56808, 1155, 353, 8840, 836, 8, 341, 8196, 1669, 1532, 5835, 1649, 13988, 1944, 1043, 14, 17325, 1138, 85952, 35641, 2271, 2354, 1649, 1155, 11, 738, 11, 2092, 11, 2092, 11, 330, 22944, 497, 7342, 330, 22944, 1138, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStopperNumTasks(t *testing.T) { s := stop.NewStopper() var tasks []chan bool for i := 0; i < 3; i++ { c := make(chan bool) tasks = append(tasks, c) s.RunAsyncTask(func() { // Wait for channel to close <-c }) tm := s.RunningTasks() if numTypes, numTasks := len(tm), s.NumTasks(); numTypes != 1 || numTasks != i+1 { t.Errorf("stopper should have %d running tasks, got %d / %+v", i+1, numTasks, tm) } m := s.RunningTasks() if len(m) != 1 { t.Fatalf("expected exactly one task map entry: %+v", m) } for _, v := range m { if expNum := len(tasks); v != expNum { t.Fatalf("%d: expected %d tasks, got %d", i, expNum, v) } } } for i, c := range tasks { m := s.RunningTasks() if len(m) != 1 { t.Fatalf("%d: expected exactly one task map entry: %+v", i, m) } for _, v := range m { if expNum := len(tasks[i:]); v != expNum { t.Fatalf("%d: expected %d tasks, got %d:\n%s", i, expNum, v, m) } } // Close the channel to let the task proceed. close(c) expNum := len(tasks[i+1:]) err := util.IsTrueWithin(func() bool { return s.NumTasks() == expNum }, 20*time.Millisecond) if err != nil { t.Errorf("%d: stopper should have %d running tasks, got %d", i, expNum, s.NumTasks()) } } // The taskmap should've been cleared out. if m := s.RunningTasks(); len(m) != 0 { t.Fatalf("task map not empty: %+v", m) } s.Stop() }
explode_data.jsonl/2425
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 629 }
[ 2830, 3393, 10674, 712, 4651, 25449, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 2936, 7121, 10674, 712, 741, 2405, 9079, 3056, 5658, 1807, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 18, 26, 600, 1027, 341, 197, 1444, 1669, 128...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_GetUidForWatchEntry(t *testing.T) { untyped.TestHookSetPartitionDuration(time.Hour) db, err := (&badgerwrap.MockFactory{}).Open(badger.DefaultOptions("")) assert.Nil(t, err) tables := typed.NewTableList(db) ts, err := ptypes.TimestampProto(someWatchTime) assert.Nil(t, err) watchRec := typed.KubeWatchResult{Kind: kubeextractor.PodKind, WatchType: typed.KubeWatchResult_UPDATE, Timestamp: ts, Payload: somePodPayload} metadata := &kubeextractor.KubeMetadata{Name: "someName", Namespace: "someNamespace"} err = tables.Db().Update(func(txn badgerwrap.Txn) error { return updateKubeWatchTable(tables, txn, &watchRec, metadata, true) }) assert.Nil(t, err) err = tables.Db().View(func(txn badgerwrap.Txn) error { uid, err := GetUidForWatchEntry(tables, txn, kubeextractor.PodKind, metadata.Namespace, "differentName", time.Time{}) assert.NotNil(t, err) assert.Equal(t, "", uid) uid, err = GetUidForWatchEntry(tables, txn, kubeextractor.PodKind, metadata.Namespace, metadata.Name, time.Time{}) assert.Nil(t, err) assert.Equal(t, "6c2a9795-a282-11e9-ba2f-14187761de09", uid) return nil }) assert.Nil(t, err) }
explode_data.jsonl/38958
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 462 }
[ 2830, 3393, 13614, 33507, 2461, 14247, 5874, 1155, 353, 8840, 836, 8, 341, 20479, 44181, 8787, 31679, 1649, 49978, 12945, 9730, 73550, 340, 20939, 11, 1848, 1669, 15899, 13855, 1389, 10097, 24664, 4153, 6257, 568, 5002, 1883, 329, 1389, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigDefaultFileSettingsDirectory(t *testing.T) { c1 := Config{} c1.SetDefaults() if *c1.FileSettings.Directory != "./data/" { t.Fatal("FileSettings.Directory should default to './data/'") } }
explode_data.jsonl/50668
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 2648, 3675, 1703, 6086, 9310, 1155, 353, 8840, 836, 8, 341, 1444, 16, 1669, 5532, 16094, 1444, 16, 4202, 16273, 2822, 743, 353, 66, 16, 8576, 6086, 54107, 961, 5924, 691, 11225, 341, 197, 3244, 26133, 445, 1703, 6086, 5410...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQuerier_Tail_QueryTimeoutConfigFlag(t *testing.T) { request := logproto.TailRequest{ Query: "{type=\"test\"}", DelayFor: 0, Limit: 10, Start: time.Now(), } store := newStoreMock() store.On("SelectLogs", mock.Anything, mock.Anything).Return(mockStreamIterator(1, 2), nil) queryClient := newQueryClientMock() queryClient.On("Recv").Return(mockQueryResponse([]logproto.Stream{mockStream(1, 2)}), nil) tailClient := newTailClientMock() tailClient.On("Recv").Return(mockTailResponse(mockStream(1, 2)), nil) ingesterClient := newQuerierClientMock() ingesterClient.On("Query", mock.Anything, mock.Anything, mock.Anything).Return(queryClient, nil) ingesterClient.On("Tail", mock.Anything, &request, mock.Anything).Return(tailClient, nil) ingesterClient.On("TailersCount", mock.Anything, mock.Anything, mock.Anything).Return(&logproto.TailersCountResponse{}, nil) limits, err := validation.NewOverrides(defaultLimitsTestConfig(), nil) require.NoError(t, err) q, err := newQuerier( mockQuerierConfig(), mockIngesterClientConfig(), newIngesterClientMockFactory(ingesterClient), mockReadRingWithOneActiveIngester(), store, limits) require.NoError(t, err) ctx := user.InjectOrgID(context.Background(), "test") _, err = q.Tail(ctx, &request) require.NoError(t, err) calls := ingesterClient.GetMockedCallsByMethod("Query") assert.Equal(t, 1, len(calls)) deadline, ok := calls[0].Arguments.Get(0).(context.Context).Deadline() assert.True(t, ok) assert.WithinDuration(t, deadline, time.Now().Add(queryTimeout), 1*time.Second) calls = ingesterClient.GetMockedCallsByMethod("Tail") assert.Equal(t, 1, len(calls)) _, ok = calls[0].Arguments.Get(0).(context.Context).Deadline() assert.False(t, ok) calls = store.GetMockedCallsByMethod("SelectLogs") assert.Equal(t, 1, len(calls)) deadline, ok = calls[0].Arguments.Get(0).(context.Context).Deadline() assert.True(t, ok) assert.WithinDuration(t, deadline, time.Now().Add(queryTimeout), 1*time.Second) store.AssertExpectations(t) }
explode_data.jsonl/5417
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 753 }
[ 2830, 3393, 2183, 261, 1268, 1139, 604, 48042, 7636, 2648, 12135, 1155, 353, 8840, 836, 8, 341, 23555, 1669, 1487, 15110, 836, 604, 1900, 515, 197, 60362, 25, 262, 13868, 1313, 4070, 1944, 2105, 24375, 197, 10957, 6895, 2461, 25, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInsufficientCapacityNodeDaemonDoesNotLaunchPod(t *testing.T) { for _, strategy := range updateStrategies() { podSpec := resourcePodSpec("too-much-mem", "75M", "75m") ds := newDaemonSet("foo") ds.Spec.UpdateStrategy = *strategy ds.Spec.Template.Spec = podSpec manager, podControl, _, err := newTestController(ds) if err != nil { t.Fatalf("error creating DaemonSets controller: %v", err) } node := newNode("too-much-mem", nil) node.Status.Allocatable = allocatableResources("100M", "200m") manager.nodeStore.Add(node) manager.podStore.Add(&v1.Pod{ Spec: podSpec, }) manager.dsStore.Add(ds) switch strategy.Type { case apps.OnDeleteDaemonSetStrategyType: syncAndValidateDaemonSets(t, manager, ds, podControl, 0, 0, 2) case apps.RollingUpdateDaemonSetStrategyType: syncAndValidateDaemonSets(t, manager, ds, podControl, 0, 0, 3) default: t.Fatalf("unexpected UpdateStrategy %+v", strategy) } } }
explode_data.jsonl/50310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 15474, 26683, 29392, 1955, 89177, 21468, 2623, 32067, 23527, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 8282, 1669, 2088, 2647, 2580, 69388, 368, 341, 197, 3223, 347, 8327, 1669, 5101, 23527, 8327, 445, 36127, 1448, 1387, 1448,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestErrorResponse(t *testing.T) { s := `{ "status": 400, "type": "urn:acme:error:xxx", "detail": "text" }` res := &http.Response{ StatusCode: 400, Status: "400 Bad Request", Body: ioutil.NopCloser(strings.NewReader(s)), Header: http.Header{"X-Foo": {"bar"}}, } err := responseError(res) v, ok := err.(*Error) if !ok { t.Fatalf("err = %+v (%T); want *Error type", err, err) } if v.StatusCode != 400 { t.Errorf("v.StatusCode = %v; want 400", v.StatusCode) } if v.ProblemType != "urn:acme:error:xxx" { t.Errorf("v.ProblemType = %q; want urn:acme:error:xxx", v.ProblemType) } if v.Detail != "text" { t.Errorf("v.Detail = %q; want text", v.Detail) } if !reflect.DeepEqual(v.Header, res.Header) { t.Errorf("v.Header = %+v; want %+v", v.Header, res.Header) } }
explode_data.jsonl/38186
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 375 }
[ 2830, 3393, 55901, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1565, 515, 197, 197, 1, 2829, 788, 220, 19, 15, 15, 345, 197, 197, 44470, 788, 330, 399, 25, 580, 2660, 69195, 25, 24048, 756, 197, 197, 1, 14585, 788, 330, 1318, 698, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArray_Iterator(t *testing.T) { slice := g.Slice{"a", "b", "d", "c"} array := garray.NewArrayFrom(slice) gtest.C(t, func(t *gtest.T) { array.Iterator(func(k int, v interface{}) bool { t.Assert(v, slice[k]) return true }) }) gtest.C(t, func(t *gtest.T) { array.IteratorAsc(func(k int, v interface{}) bool { t.Assert(v, slice[k]) return true }) }) gtest.C(t, func(t *gtest.T) { array.IteratorDesc(func(k int, v interface{}) bool { t.Assert(v, slice[k]) return true }) }) gtest.C(t, func(t *gtest.T) { index := 0 array.Iterator(func(k int, v interface{}) bool { index++ return false }) t.Assert(index, 1) }) gtest.C(t, func(t *gtest.T) { index := 0 array.IteratorAsc(func(k int, v interface{}) bool { index++ return false }) t.Assert(index, 1) }) gtest.C(t, func(t *gtest.T) { index := 0 array.IteratorDesc(func(k int, v interface{}) bool { index++ return false }) t.Assert(index, 1) }) }
explode_data.jsonl/13917
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 471 }
[ 2830, 3393, 1857, 7959, 465, 850, 1155, 353, 8840, 836, 8, 341, 1903, 4754, 1669, 342, 95495, 4913, 64, 497, 330, 65, 497, 330, 67, 497, 330, 66, 16707, 11923, 1669, 342, 1653, 7121, 1857, 3830, 75282, 340, 3174, 1944, 727, 1155, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAttributes_FilterSpansByNameRegexp(t *testing.T) { testCases := []testCase{ { name: "apply_to_span_with_no_attrs", serviceName: "svcB", inputAttributes: map[string]pdata.AttributeValue{}, expectedAttributes: map[string]pdata.AttributeValue{ "attribute1": pdata.NewAttributeValueInt(123), }, }, { name: "apply_to_span_with_attr", serviceName: "svcB", inputAttributes: map[string]pdata.AttributeValue{ "NoModification": pdata.NewAttributeValueBool(false), }, expectedAttributes: map[string]pdata.AttributeValue{ "attribute1": pdata.NewAttributeValueInt(123), "NoModification": pdata.NewAttributeValueBool(false), }, }, { name: "incorrect_span_name", serviceName: "svcB", inputAttributes: map[string]pdata.AttributeValue{}, expectedAttributes: map[string]pdata.AttributeValue{}, }, { name: "apply_dont_apply", serviceName: "svcB", inputAttributes: map[string]pdata.AttributeValue{}, expectedAttributes: map[string]pdata.AttributeValue{}, }, { name: "incorrect_span_name_with_attr", serviceName: "svcB", inputAttributes: map[string]pdata.AttributeValue{ "NoModification": pdata.NewAttributeValueBool(true), }, expectedAttributes: map[string]pdata.AttributeValue{ "NoModification": pdata.NewAttributeValueBool(true), }, }, } factory := NewFactory() cfg := factory.CreateDefaultConfig() oCfg := cfg.(*Config) oCfg.Actions = []processorhelper.ActionKeyValue{ {Key: "attribute1", Action: processorhelper.INSERT, Value: 123}, } oCfg.Include = &filterconfig.MatchProperties{ SpanNames: []string{"^apply.*"}, Config: *createConfig(filterset.Regexp), } oCfg.Exclude = &filterconfig.MatchProperties{ SpanNames: []string{".*dont_apply$"}, Config: *createConfig(filterset.Regexp), } tp, err := factory.CreateTracesProcessor(context.Background(), component.ProcessorCreateSettings{}, cfg, consumertest.NewNop()) require.Nil(t, err) require.NotNil(t, tp) for _, tt := range testCases { runIndividualTestCase(t, tt, tp) } }
explode_data.jsonl/76283
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 900 }
[ 2830, 3393, 10516, 68935, 6406, 596, 16898, 3477, 4580, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 66194, 515, 197, 197, 515, 298, 11609, 25, 310, 330, 10280, 2346, 37382, 6615, 6536, 39578, 756, 298, 52934, 675, 25, 257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRedisGet_Run(t *testing.T) { testImage := container.CurrentStepImage(t) serviceUrls := redistest.SetupRedis(t) cases := []container.Test{ { Name: "no params", Image: testImage, Envs: map[string]string{}, Args: []string{}, WantExitCode: step.ExitCodeFailure, WantError: "failed init step arguments, env: required environment variable", WantOutput: nil, }, { Name: "failed to connect redis - invalid dns", Image: testImage, Envs: map[string]string{"KEY": "mykey", "REDIS_URL": "redis://invalid-hostname.internal"}, Args: []string{}, WantExitCode: step.ExitCodeFailure, WantError: "no such host", WantOutput: nil, }, { Name: "failed to connect redis - invalid ip", Image: testImage, Envs: map[string]string{"KEY": "mykey", "REDIS_URL": "redis://127.0.0.2"}, Args: []string{}, WantExitCode: step.ExitCodeFailure, WantError: "connection refused", WantOutput: nil, }, { Name: "key not found", Image: testImage, Envs: map[string]string{"KEY": "not-exist", "REDIS_URL": serviceUrls.FullURL}, Args: []string{}, WantExitCode: step.ExitCodeFailure, WantError: "key not found", WantOutput: nil, }, { Name: "numerical key - found", Image: testImage, Envs: map[string]string{"KEY": "number", "REDIS_URL": serviceUrls.FullURL}, Args: []string{}, WantExitCode: step.ExitCodeOK, WantError: "", WantOutput: matcher.StepOutputTextEqual("42"), }, { Name: "numerical key - string", Image: testImage, Envs: map[string]string{"KEY": "string", "REDIS_URL": serviceUrls.FullURL}, Args: []string{}, WantExitCode: step.ExitCodeOK, WantError: "", WantOutput: matcher.StepOutputTextEqual("foo"), }, } for _, tc := range cases { t.Run(tc.Name, tc.Run) } }
explode_data.jsonl/50744
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 956 }
[ 2830, 3393, 48137, 1949, 84158, 1155, 353, 8840, 836, 8, 341, 18185, 1906, 1669, 5476, 11517, 8304, 1906, 1155, 340, 52934, 15638, 1669, 2518, 380, 477, 39820, 48137, 1155, 692, 1444, 2264, 1669, 3056, 3586, 8787, 515, 197, 197, 515, 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 TestX12Encoder_encode(t *testing.T) { enc := NewX12Encoder() ctx, _ := NewEncoderContext("^") ctx.SignalEncoderChange(HighLevelEncoder_X12_ENCODATION) e := enc.encode(ctx) if e == nil { t.Fatalf("encode must be error") } ctx, _ = NewEncoderContext("AAA000000") ctx.SignalEncoderChange(HighLevelEncoder_X12_ENCODATION) e = enc.encode(ctx) if e != nil { t.Fatalf("encode returns error: %v", e) } expect := []byte{89, 191, 254} if r := ctx.GetCodewords(); !reflect.DeepEqual(r, expect) { t.Fatalf("context codewords = %v, expect %v", r, expect) } if ctx.pos != 3 { t.Fatalf("context pos = %v, expect 3", ctx.pos) } if r := ctx.GetNewEncoding(); r != HighLevelEncoder_ASCII_ENCODATION { t.Fatalf("context nextEncoding = %v, expect %v", r, HighLevelEncoder_ASCII_ENCODATION) } }
explode_data.jsonl/49806
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 339 }
[ 2830, 3393, 55, 16, 17, 19921, 11224, 1155, 353, 8840, 836, 8, 341, 197, 954, 1669, 1532, 55, 16, 17, 19921, 2822, 20985, 11, 716, 1669, 1532, 19921, 1972, 48654, 1138, 20985, 75669, 19921, 4072, 10896, 1090, 4449, 19921, 6859, 16, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestCreateOrStopIssueStopwatch(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) user2, err := GetUserByID(2) assert.NoError(t, err) user3, err := GetUserByID(3) assert.NoError(t, err) issue1, err := GetIssueByID(1) assert.NoError(t, err) issue2, err := GetIssueByID(2) assert.NoError(t, err) assert.NoError(t, CreateOrStopIssueStopwatch(user3, issue1)) sw := AssertExistsAndLoadBean(t, &Stopwatch{UserID: 3, IssueID: 1}).(*Stopwatch) assert.Equal(t, true, sw.CreatedUnix <= util.TimeStampNow()) assert.NoError(t, CreateOrStopIssueStopwatch(user2, issue2)) AssertNotExistsBean(t, &Stopwatch{UserID: 2, IssueID: 2}) AssertExistsAndLoadBean(t, &TrackedTime{UserID: 2, IssueID: 2}) }
explode_data.jsonl/55033
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 286 }
[ 2830, 3393, 4021, 2195, 10674, 42006, 10674, 14321, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 31166, 2271, 5988, 12367, 19060, 17, 11, 1848, 1669, 85937, 60572, 7, 17, 340, 6948, 35699, 1155, 11, 1848, 340, 19060, 18, 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...
1
func TestReceiveTicket_InvalidWinProb(t *testing.T) { sender, b, v, ts, faceValue, winProb, sig := newRecipientFixtureOrFatal(t) r := newRecipientOrFatal(t, RandAddress(), b, v, ts, faceValue, winProb) params := r.TicketParams(sender) // Test invalid winProb ticket := newTicket(sender, params, 0) ticket.WinProb = big.NewInt(0) // Using invalid winProb _, _, err := r.ReceiveTicket(ticket, sig, params.Seed) if err == nil { t.Error("expected invalid winProb error") } if err != nil && !strings.Contains(err.Error(), "invalid ticket winProb") { t.Errorf("expected invalid winProb error, got %v", err) } }
explode_data.jsonl/44754
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 14742, 34058, 62, 7928, 16970, 36980, 1155, 353, 8840, 836, 8, 341, 1903, 1659, 11, 293, 11, 348, 11, 10591, 11, 3579, 1130, 11, 3164, 36980, 11, 8366, 1669, 501, 74432, 18930, 2195, 62396, 1155, 340, 7000, 1669, 501, 7443...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTapeFix(t *testing.T) { //stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, //stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01 //stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001 //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 kit.QuietMiningLogs() var blocktime = 2 * time.Millisecond // The "before" case is disabled, because we need the builder to mock 32 GiB sectors to accurately repro this case // TODO: Make the mock sector size configurable and reenable this // t.Run("before", func(t *testing.T) { testTapeFix(t, b, blocktime, false) }) t.Run("after", func(t *testing.T) { testTapeFix(t, blocktime, true) }) }
explode_data.jsonl/70937
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 51, 2027, 25958, 1155, 353, 8840, 836, 8, 341, 197, 322, 24855, 25, 569, 90733, 39189, 640, 24042, 42362, 83366, 62, 15, 15, 16, 11, 569, 90733, 39189, 640, 57925, 1139, 3298, 5884, 62, 15, 15, 16, 345, 197, 322, 24855, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAutoRebalanceOnCaptureOnline(t *testing.T) { // This test case tests the following scenario: // 1. Capture-1 and Capture-2 are online. // 2. Owner dispatches three tables to these two captures. // 3. While the pending dispatches are in progress, Capture-3 goes online. // 4. Capture-1 and Capture-2 finish the dispatches. // // We expect that the workload is eventually balanced by migrating // a table to Capture-3. t.Parallel() ctx := cdcContext.NewBackendContext4Test(false) communicator := NewMockScheduleDispatcherCommunicator() dispatcher := NewBaseScheduleDispatcher("cf-1", communicator, 1000) captureList := map[model.CaptureID]*model.CaptureInfo{ "capture-1": { ID: "capture-1", AdvertiseAddr: "fakeip:1", }, "capture-2": { ID: "capture-2", AdvertiseAddr: "fakeip:2", }, } communicator.On("Announce", mock.Anything, "cf-1", "capture-1").Return(true, nil) communicator.On("Announce", mock.Anything, "cf-1", "capture-2").Return(true, nil) checkpointTs, resolvedTs, err := dispatcher.Tick(ctx, 1000, []model.TableID{1, 2, 3}, captureList) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) dispatcher.OnAgentSyncTaskStatuses("capture-1", []model.TableID{}, []model.TableID{}, []model.TableID{}) dispatcher.OnAgentSyncTaskStatuses("capture-2", []model.TableID{}, []model.TableID{}, []model.TableID{}) 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) communicator.On("DispatchTable", mock.Anything, "cf-1", model.TableID(3), mock.Anything, false). Return(true, nil) checkpointTs, resolvedTs, err = dispatcher.Tick(ctx, 1000, []model.TableID{1, 2, 3}, captureList) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) require.NotEqual(t, 0, len(communicator.addTableRecords["capture-1"])) require.NotEqual(t, 0, len(communicator.addTableRecords["capture-2"])) require.Equal(t, 0, len(communicator.removeTableRecords["capture-1"])) require.Equal(t, 0, len(communicator.removeTableRecords["capture-2"])) dispatcher.OnAgentCheckpoint("capture-1", 2000, 2000) dispatcher.OnAgentCheckpoint("capture-1", 2001, 2001) communicator.ExpectedCalls = nil checkpointTs, resolvedTs, err = dispatcher.Tick(ctx, 1000, []model.TableID{1, 2, 3}, captureList) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) captureList["capture-3"] = &model.CaptureInfo{ ID: "capture-3", AdvertiseAddr: "fakeip:3", } communicator.ExpectedCalls = nil communicator.On("Announce", mock.Anything, "cf-1", "capture-3").Return(true, nil) checkpointTs, resolvedTs, err = dispatcher.Tick(ctx, 1000, []model.TableID{1, 2, 3}, captureList) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) communicator.ExpectedCalls = nil dispatcher.OnAgentSyncTaskStatuses("capture-3", []model.TableID{}, []model.TableID{}, []model.TableID{}) checkpointTs, resolvedTs, err = dispatcher.Tick(ctx, 1000, []model.TableID{1, 2, 3}, captureList) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) for captureID, tables := range communicator.addTableRecords { for _, tableID := range tables { dispatcher.OnAgentFinishedTableOperation(captureID, tableID) } } communicator.Reset() var removeTableFromCapture model.CaptureID communicator.On("DispatchTable", mock.Anything, "cf-1", mock.Anything, mock.Anything, true). Return(true, nil).Run(func(args mock.Arguments) { removeTableFromCapture = args.Get(3).(model.CaptureID) }) checkpointTs, resolvedTs, err = dispatcher.Tick(ctx, 1000, []model.TableID{1, 2, 3}, captureList) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) removedTableID := communicator.removeTableRecords[removeTableFromCapture][0] dispatcher.OnAgentFinishedTableOperation(removeTableFromCapture, removedTableID) dispatcher.OnAgentCheckpoint("capture-1", 1100, 1400) dispatcher.OnAgentCheckpoint("capture-2", 1200, 1300) communicator.ExpectedCalls = nil communicator.On("DispatchTable", mock.Anything, "cf-1", removedTableID, "capture-3", false). Return(true, nil) checkpointTs, resolvedTs, err = dispatcher.Tick(ctx, 1000, []model.TableID{1, 2, 3}, captureList) require.NoError(t, err) require.Equal(t, CheckpointCannotProceed, checkpointTs) require.Equal(t, CheckpointCannotProceed, resolvedTs) communicator.AssertExpectations(t) }
explode_data.jsonl/28512
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1859 }
[ 2830, 3393, 13253, 693, 21571, 1925, 27429, 19598, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 1273, 1142, 7032, 279, 2701, 15048, 510, 197, 322, 220, 16, 13, 39885, 12, 16, 323, 39885, 12, 17, 525, 2860, 624, 197, 322, 220, 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 TestStoreMount(t *testing.T) { db := dbm.NewMemDB() store := NewStore(db) key1 := types.NewKVStoreKey("store1") key2 := types.NewKVStoreKey("store2") dup1 := types.NewKVStoreKey("store1") require.NotPanics(t, func() { store.MountStoreWithDB(key1, types.StoreTypeIAVL, db) }) require.NotPanics(t, func() { store.MountStoreWithDB(key2, types.StoreTypeIAVL, db) }) require.Panics(t, func() { store.MountStoreWithDB(key1, types.StoreTypeIAVL, db) }) require.Panics(t, func() { store.MountStoreWithDB(nil, types.StoreTypeIAVL, db) }) require.Panics(t, func() { store.MountStoreWithDB(dup1, types.StoreTypeIAVL, db) }) }
explode_data.jsonl/21880
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 6093, 16284, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 2927, 76, 7121, 18816, 3506, 741, 57279, 1669, 1532, 6093, 9791, 692, 23634, 16, 1669, 4494, 7121, 82707, 6093, 1592, 445, 4314, 16, 1138, 23634, 17, 1669, 4494, 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 TestSelect_BinaryExpr_NilValues(t *testing.T) { shardMapper := ShardMapper{ MapShardsFn: func(sources influxql.Sources, _ influxql.TimeRange) query.ShardGroup { return &ShardGroup{ Fields: map[string]influxql.DataType{ "total": influxql.Float, "value": influxql.Float, }, CreateIteratorFn: func(ctx context.Context, m *influxql.Measurement, opt query.IteratorOptions) (query.Iterator, error) { if m.Name != "cpu" { t.Fatalf("unexpected source: %s", m.Name) } return &FloatIterator{Points: []query.FloatPoint{ {Name: "cpu", Time: 0 * Second, Aux: []interface{}{float64(20), nil}}, {Name: "cpu", Time: 5 * Second, Aux: []interface{}{float64(10), float64(15)}}, {Name: "cpu", Time: 9 * Second, Aux: []interface{}{nil, float64(5)}}, }}, nil }, } }, } for _, test := range []struct { Name string Statement string Rows []query.Row }{ { Name: "Addition", Statement: `SELECT total + value FROM cpu`, Rows: []query.Row{ {Time: 0 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, {Time: 5 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{float64(25)}}, {Time: 9 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, }, }, { Name: "Subtraction", Statement: `SELECT total - value FROM cpu`, Rows: []query.Row{ {Time: 0 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, {Time: 5 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{float64(-5)}}, {Time: 9 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, }, }, { Name: "Multiplication", Statement: `SELECT total * value FROM cpu`, Rows: []query.Row{ {Time: 0 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, {Time: 5 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{float64(150)}}, {Time: 9 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, }, }, { Name: "Division", Statement: `SELECT total / value FROM cpu`, Rows: []query.Row{ {Time: 0 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, {Time: 5 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{float64(10) / float64(15)}}, {Time: 9 * Second, Series: query.Series{Name: "cpu"}, Values: []interface{}{nil}}, }, }, } { t.Run(test.Name, func(t *testing.T) { stmt := MustParseSelectStatement(test.Statement) stmt.OmitTime = true cur, err := query.Select(context.Background(), stmt, &shardMapper, query.SelectOptions{}) if err != nil { t.Errorf("%s: parse error: %s", test.Name, err) } else if a, err := ReadCursor(cur); err != nil { t.Fatalf("%s: unexpected error: %s", test.Name, err) } else if diff := cmp.Diff(test.Rows, a); diff != "" { t.Errorf("%s: unexpected points:\n%s", test.Name, diff) } }) } }
explode_data.jsonl/39407
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1250 }
[ 2830, 3393, 3379, 1668, 3287, 16041, 1604, 321, 6227, 1155, 353, 8840, 836, 8, 341, 36196, 567, 10989, 1669, 95366, 10989, 515, 197, 26873, 2016, 2347, 24911, 25, 2915, 1141, 2360, 52852, 1470, 808, 2360, 11, 716, 52852, 1470, 16299, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestClosedTimestampCantServeBasedOnMaxTimestamp(t *testing.T) { defer leaktest.AfterTest(t)() if util.RaceEnabled { // Limiting how long transactions can run does not work // well with race unless we're extremely lenient, which // drives up the test duration. t.Skip("skipping under race") } ctx := context.Background() // Set up the target duration to be very long and rely on lease transfers to // drive MaxClosed. tc, db0, desc, repls := setupTestClusterForClosedTimestampTesting(ctx, t, time.Hour) defer tc.Stopper().Stop(ctx) if _, err := db0.Exec(`INSERT INTO cttest.kv VALUES(1, $1)`, "foo"); err != nil { t.Fatal(err) } // Grab a timestamp before initiating a lease transfer, transfer the lease, // then ensure that reads at that timestamp can occur from all the replicas. ts := hlc.Timestamp{WallTime: timeutil.Now().UnixNano()} lh := getCurrentLeaseholder(t, tc, desc) target := pickRandomTarget(tc, lh, desc) require.Nil(t, tc.TransferRangeLease(desc, target)) baRead := makeReadBatchRequestForDesc(desc, ts) testutils.SucceedsSoon(t, func() error { return verifyCanReadFromAllRepls(ctx, t, baRead, repls, expectRows(1)) }) // Make a non-writing transaction that has a MaxTimestamp after the lease // transfer but a timestamp before. roTxn := roachpb.MakeTransaction("test", nil, roachpb.NormalUserPriority, ts, timeutil.Now().UnixNano()-ts.WallTime) baRead.Header.Txn = &roTxn // Send the request to all three replicas. One should succeed and // the other two should return NotLeaseHolderErrors. verifyNotLeaseHolderErrors(t, baRead, repls, 2) }
explode_data.jsonl/65033
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 546 }
[ 2830, 3393, 26884, 20812, 34, 517, 60421, 28715, 1925, 5974, 20812, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 743, 4094, 2013, 578, 5462, 341, 197, 197, 322, 28008, 287, 1246, 1293, 14131, 646, 1598, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatterObject(test *testing.T) { object := struct { Value int Message string }{ Value: 2, Message: "text", } formatted, err := formatter.Format("", object) assert.NoError(test, err) assert.Equal(test, "{2 text}", formatted) formatted, err = formatter.Format(" ", object) assert.NoError(test, err) assert.Equal(test, " {2 text}", formatted) }
explode_data.jsonl/39798
{ "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, 14183, 1190, 8623, 353, 8840, 836, 8, 341, 35798, 1669, 2036, 341, 197, 47399, 256, 526, 198, 197, 46733, 914, 198, 197, 59403, 197, 47399, 25, 256, 220, 17, 345, 197, 46733, 25, 330, 1318, 756, 197, 630, 37410, 12127, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRegistration(t *testing.T) { mockUserRepo := new(mocks.UserRepository) mockUser := model.User{ FullName: "Mr. Test", Email: "mrtest@example.com", Hash: "super_password", IsActive: 1, UpdatedAt: time.Now().UTC(), } t.Run("success", func(t *testing.T) { tMockUser := mockUser tMockUser.ID = 0 mockUserRepo.On("GetUserByEmail", mock.Anything, mock.AnythingOfType("string")). Return(model.User{}, errors.New("not found")).Once() mockUserRepo.On("CreateUser", mock.Anything, mock.AnythingOfType("*model.User")). Return(nil).Once() u := usecase.NewUserUsecase(mockUserRepo, time.Second*2) err := u.Registration(context.TODO(), &tMockUser) assert.NoError(t, err) assert.Equal(t, mockUser.FullName, tMockUser.FullName) mockUserRepo.AssertExpectations(t) }) t.Run("existing-user", func(t *testing.T) { existingUser := mockUser mockUserRepo.On("GetUserByEmail", mock.Anything, mock.AnythingOfType("string")). Return(existingUser, nil).Once() u := usecase.NewUserUsecase(mockUserRepo, time.Second*2) err := u.Registration(context.TODO(), &existingUser) assert.Error(t, err) mockUserRepo.AssertExpectations(t) }) }
explode_data.jsonl/76994
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 23365, 1155, 353, 8840, 836, 8, 341, 77333, 1474, 25243, 1669, 501, 1255, 25183, 7344, 4624, 692, 77333, 1474, 1669, 1614, 7344, 515, 197, 197, 36217, 25, 220, 330, 12275, 13, 3393, 756, 197, 197, 4781, 25, 257, 330, 20946...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFullWindowReceive(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() opt := tcpip.ReceiveBufferSizeOption(10) c.CreateConnected(789, 30000, &opt) we, ch := waiter.NewChannelEntry(nil) c.WQ.EventRegister(&we, waiter.EventIn) defer c.WQ.EventUnregister(&we) _, _, err := c.EP.Read(nil) if err != tcpip.ErrWouldBlock { t.Fatalf("Read failed: %v", err) } // Fill up the window. data := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} c.SendPacket(data, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: 790, AckNum: c.IRS.Add(1), RcvWnd: 30000, }) // Wait for receive to be notified. select { case <-ch: case <-time.After(5 * time.Second): t.Fatalf("Timed out waiting for data to arrive") } // Check that data is acknowledged, and window goes to zero. checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(uint32(c.IRS)+1), checker.AckNum(uint32(790+len(data))), checker.TCPFlags(header.TCPFlagAck), checker.Window(0), ), ) // Receive data and check it. v, _, err := c.EP.Read(nil) if err != nil { t.Fatalf("Read failed: %v", err) } if !bytes.Equal(data, v) { t.Fatalf("got data = %v, want = %v", v, data) } // Check that we get an ACK for the newly non-zero window. checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(uint32(c.IRS)+1), checker.AckNum(uint32(790+len(data))), checker.TCPFlags(header.TCPFlagAck), checker.Window(10), ), ) }
explode_data.jsonl/22287
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 717 }
[ 2830, 3393, 9432, 4267, 14742, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 64838, 1669, 28051, 573, 86363, 52661, 5341, 7, 16, 15, 340, 1444, 7251, 21146, 7, 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...
6
func TestIgnoresNonPodObject(t *testing.T) { obj := &api.Namespace{} attrs := admission.NewAttributesRecord(obj, nil, api.Kind("Pod").WithVersion("version"), "myns", "myname", api.Resource("pods").WithVersion("version"), "", admission.Create, false, nil) err := NewServiceAccount().Admit(attrs) if err != nil { t.Errorf("Expected non pod object allowed, got err: %v", err) } }
explode_data.jsonl/61338
{ "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, 40, 70, 2152, 416, 8121, 23527, 1190, 1155, 353, 8840, 836, 8, 341, 22671, 1669, 609, 2068, 46011, 16094, 197, 20468, 1669, 25293, 7121, 10516, 6471, 6779, 11, 2092, 11, 6330, 54199, 445, 23527, 1827, 2354, 5637, 445, 4366, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHelmSet(t *testing.T) { Given(t). Path("helm"). When(). Create(). AppSet("--helm-set", "foo=bar", "--helm-set", "foo=baz", "--helm-set", "app=$ARGOCD_APP_NAME"). Then(). And(func(app *Application) { assert.Equal(t, []HelmParameter{{Name: "foo", Value: "baz"}, {Name: "app", Value: "$ARGOCD_APP_NAME"}}, app.Spec.Source.Helm.Parameters) }) }
explode_data.jsonl/69405
{ "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, 39, 23162, 1649, 1155, 353, 8840, 836, 8, 341, 9600, 2071, 1155, 4292, 197, 69640, 445, 51899, 38609, 197, 197, 4498, 25829, 197, 75569, 25829, 197, 59557, 1649, 21549, 51899, 24096, 497, 330, 7975, 28, 2257, 497, 14482, 518...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScalarBls12377G1Div(t *testing.T) { bls12377G1 := BLS12377G1() nine := bls12377G1.Scalar.New(9) actual := nine.Div(nine) require.Equal(t, actual.Cmp(bls12377G1.Scalar.New(1)), 0) require.Equal(t, bls12377G1.Scalar.New(54).Div(nine).Cmp(bls12377G1.Scalar.New(6)), 0) }
explode_data.jsonl/15758
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 20639, 33, 4730, 16, 17, 18, 22, 22, 38, 16, 12509, 1155, 353, 8840, 836, 8, 341, 96421, 82, 16, 17, 18, 22, 22, 38, 16, 1669, 425, 7268, 16, 17, 18, 22, 22, 38, 16, 741, 9038, 482, 1669, 1501, 82, 16, 17, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetEra(t *testing.T) { //104 26 //4137894- 4138406 //88 2 //4138853- 4138917 era := GetEra(4138853) fmt.Printf("%+v", era) }
explode_data.jsonl/43218
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 1949, 36, 956, 1155, 353, 8840, 836, 8, 341, 197, 322, 16, 15, 19, 220, 17, 21, 198, 197, 322, 19, 16, 18, 22, 23, 24, 19, 12, 220, 19, 16, 18, 23, 19, 15, 21, 271, 197, 322, 23, 23, 220, 17, 198, 197, 322, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Static_Folder_Forbidden(t *testing.T) { gtest.C(t, func(t *gtest.T) { p, _ := ports.PopRand() s := g.Server(p) path := fmt.Sprintf(`%s/ghttp/static/test/%d`, gfile.TempDir(), p) defer gfile.Remove(path) gfile.PutContents(path+"/test.html", "test") s.SetServerRoot(path) s.SetPort(p) s.Start() defer s.Shutdown() time.Sleep(100 * time.Millisecond) client := g.Client() client.SetPrefix(fmt.Sprintf("http://127.0.0.1:%d", p)) t.Assert(client.GetContent("/"), "Forbidden") t.Assert(client.GetContent("/index.html"), "Not Found") t.Assert(client.GetContent("/test.html"), "test") }) }
explode_data.jsonl/40520
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 27049, 1400, 2018, 84368, 22108, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 3223, 11, 716, 1669, 20325, 47424, 56124, 741, 197, 1903, 1669, 342, 22997, 1295, 340, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTidbClusterControllerEnqueueTidbCluster(t *testing.T) { g := NewGomegaWithT(t) tc := newTidbCluster() tcc, _, _ := newFakeTidbClusterController() tcc.enqueueTidbCluster(tc) g.Expect(tcc.queue.Len()).To(Equal(1)) }
explode_data.jsonl/68172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 51, 307, 65, 28678, 2051, 1702, 4584, 51, 307, 65, 28678, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 340, 78255, 1669, 501, 51, 307, 65, 28678, 741, 3244, 638, 11, 8358, 716, 1669, 501, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGatewayNameFromInstanceName(t *testing.T) { actual := GatewayNameFromInstanceName("inst1") expected := "inst1--gateway" if diff := cmp.Diff(expected, actual); diff != "" { t.Errorf("GatewayNameFromInstanceName (-expected, +actual)\n%v", diff) } }
explode_data.jsonl/54876
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 40709, 675, 3830, 2523, 675, 1155, 353, 8840, 836, 8, 341, 88814, 1669, 39378, 675, 3830, 2523, 675, 445, 6308, 16, 1138, 42400, 1669, 330, 6308, 16, 313, 46473, 698, 743, 3638, 1669, 26089, 98063, 15253, 11, 5042, 1215, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetUsersWithoutTeam(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client SystemAdminClient := th.SystemAdminClient if _, resp := Client.GetUsersWithoutTeam(0, 100, ""); resp.Error == nil { t.Fatal("should prevent non-admin user from getting users without a team") } // These usernames need to appear in the first 100 users for this to work user, resp := Client.CreateUser(&model.User{ Username: "a000000000" + model.NewId(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Password: "Password1", }) CheckNoError(t, resp) th.LinkUserToTeam(user, th.BasicTeam) defer th.App.Srv.Store.User().PermanentDelete(user.Id) user2, resp := Client.CreateUser(&model.User{ Username: "a000000001" + model.NewId(), Email: "success+" + model.NewId() + "@simulator.amazonses.com", Password: "Password1", }) CheckNoError(t, resp) defer th.App.Srv.Store.User().PermanentDelete(user2.Id) rusers, resp := SystemAdminClient.GetUsersWithoutTeam(0, 100, "") CheckNoError(t, resp) found1 := false found2 := false for _, u := range rusers { if u.Id == user.Id { found1 = true } else if u.Id == user2.Id { found2 = true } } if found1 { t.Fatal("shouldn't have returned user that has a team") } else if !found2 { t.Fatal("should've returned user that has no teams") } }
explode_data.jsonl/21538
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 517 }
[ 2830, 3393, 1949, 7137, 26040, 14597, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 1005, 3803, 2320, 7210, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 198, 5816, 7210, 2959, 1669, 270, 16620, 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...
7
func TestSetLoadedConfigPath(t *testing.T) { conf, cleanup := testutil.InitConfig(t) defer cleanup(t) testPath := "/tmp/loadedconfig" assert.NotEqual(t, testPath, conf.LoadedConfigPath()) conf.SetLoadedConfigPath(testPath) assert.Equal(t, testPath, conf.LoadedConfigPath()) }
explode_data.jsonl/57899
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 1649, 22369, 2648, 1820, 1155, 353, 8840, 836, 8, 341, 67850, 11, 21290, 1669, 1273, 1314, 26849, 2648, 1155, 340, 16867, 21290, 1155, 692, 18185, 1820, 1669, 3521, 5173, 14, 15589, 1676, 1837, 6948, 15000, 2993, 1155, 11, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestApprovedBadPool(t *testing.T) { em, cancel := newTestEventManager(t) defer cancel() mdi := em.database.(*databasemocks.Plugin) mti := &tokenmocks.Plugin{} approval := newApproval() mdi.On("GetTokenPoolByProtocolID", em.ctx, "erc1155", "F1").Return(nil, nil) err := em.TokensApproved(mti, approval) assert.NoError(t, err) mdi.AssertExpectations(t) mti.AssertExpectations(t) }
explode_data.jsonl/15921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 59651, 17082, 10551, 1155, 353, 8840, 836, 8, 341, 66204, 11, 9121, 1669, 501, 2271, 83694, 1155, 340, 16867, 9121, 2822, 2109, 8579, 1669, 976, 15062, 41399, 67, 2096, 300, 336, 25183, 64378, 340, 2109, 10251, 1669, 609, 58...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetOSLoginEnabled(t *testing.T) { var tests = []struct { md string enable, twofactor bool }{ { md: `{"instance": {"attributes": {"enable-oslogin": "true", "enable-oslogin-2fa": "true"}}}`, enable: true, twofactor: true, }, { md: `{"project": {"attributes": {"enable-oslogin": "true", "enable-oslogin-2fa": "true"}}}`, enable: true, twofactor: true, }, { // Instance keys take precedence md: `{"project": {"attributes": {"enable-oslogin": "false", "enable-oslogin-2fa": "false"}}, "instance": {"attributes": {"enable-oslogin": "true", "enable-oslogin-2fa": "true"}}}`, enable: true, twofactor: true, }, { // Instance keys take precedence md: `{"project": {"attributes": {"enable-oslogin": "true", "enable-oslogin-2fa": "true"}}, "instance": {"attributes": {"enable-oslogin": "false", "enable-oslogin-2fa": "false"}}}`, enable: false, twofactor: false, }, { // Handle weird values md: `{"instance": {"attributes": {"enable-oslogin": "TRUE", "enable-oslogin-2fa": "foobar"}}}`, enable: true, twofactor: false, }, { // Mixed test md: `{"project": {"attributes": {"enable-oslogin": "true", "enable-oslogin-2fa": "true"}}, "instance": {"attributes": {"enable-oslogin-2fa": "false"}}}`, enable: true, twofactor: false, }, } for idx, tt := range tests { var md metadata if err := json.Unmarshal([]byte(tt.md), &md); err != nil { t.Errorf("Failed to unmarshal metadata JSON for test %v: %v", idx, err) } enable, twofactor := getOSLoginEnabled(&md) if enable != tt.enable || twofactor != tt.twofactor { t.Errorf("Test %v failed. Expected: %v/%v Got: %v/%v", idx, tt.enable, tt.twofactor, enable, twofactor) } } }
explode_data.jsonl/7391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 783 }
[ 2830, 3393, 1949, 3126, 6231, 5462, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 84374, 394, 914, 198, 197, 197, 12552, 11, 4384, 1055, 5621, 1807, 198, 197, 59403, 197, 197, 515, 298, 84374, 25, 286, 1565, 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...
5
func TestAfterFunc(t *testing.T) { assert.NotPanics(t, func() { out := make(chan bool, 1) mj, _ := AfterFunc(time.Millisecond*10, func() { out <- true }, nil) v := <-out assert.True(t, v) mj.Cancel() }) }
explode_data.jsonl/56059
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 106 }
[ 2830, 3393, 6025, 9626, 1155, 353, 8840, 836, 8, 341, 6948, 15000, 35693, 1211, 1155, 11, 2915, 368, 341, 197, 13967, 1669, 1281, 35190, 1807, 11, 220, 16, 340, 197, 2109, 73, 11, 716, 1669, 4636, 9626, 9730, 71482, 9, 16, 15, 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 TestIssue53(t *testing.T) { const data = "PRI * HTTP/2.0\r\n\r\nSM" + "\r\n\r\n\x00\x00\x00\x01\ainfinfin\ad" s := &http.Server{ ErrorLog: log.New(io.MultiWriter(stderrv(), twriter{t: t}), "", log.LstdFlags), Handler: http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { w.Write([]byte("hello")) }), } s2 := &Server{ MaxReadFrameSize: 1 << 16, PermitProhibitedCipherSuites: true, } c := &issue53Conn{[]byte(data), false, false} s2.ServeConn(c, &ServeConnOpts{BaseConfig: s}) if !c.closed { t.Fatal("connection is not closed") } }
explode_data.jsonl/71692
{ "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, 42006, 20, 18, 1155, 353, 8840, 836, 8, 341, 4777, 821, 284, 330, 57342, 353, 10130, 14, 17, 13, 15, 12016, 1699, 12016, 1699, 9501, 1, 3610, 197, 197, 11934, 81, 1699, 12016, 1699, 3462, 15, 15, 3462, 15, 15, 3462, 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 Test_SingleCommandWithLongFlagHelp(t *testing.T) { out, err := test.ExecuteCommand(buildTestCmd(), "completion", "--help") if err != nil { assert.Error(t, err) } assert.NotContains(t, out, `Error:`) assert.Contains(t, out, `Usage:`) assert.NotContains(t, out, `Available Commands:`) assert.Contains(t, out, `Flags:`) assert.Contains(t, out, `To load completions:`) assert.Contains(t, out, `Bash:`) assert.Contains(t, out, `Zsh:`) assert.Contains(t, out, `Fish:`) assert.Contains(t, out, `PowerShell:`) }
explode_data.jsonl/59259
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 1098, 2173, 4062, 2354, 6583, 12135, 12689, 1155, 353, 8840, 836, 8, 341, 13967, 11, 1848, 1669, 1273, 13827, 4062, 43333, 2271, 15613, 1507, 330, 43312, 497, 14482, 8653, 1138, 743, 1848, 961, 2092, 341, 197, 6948, 6141, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestClusterServiceBrokerClient(t *testing.T) { const name = "test-broker" client, _, shutdownServer := getFreshApiserverAndClient(t, func() runtime.Object { return &servicecatalog.ClusterServiceBroker{} }) defer shutdownServer() if err := testClusterServiceBrokerClient(client, name); err != nil { t.Fatal(err) } }
explode_data.jsonl/51879
{ "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, 28678, 1860, 65545, 2959, 1155, 353, 8840, 836, 8, 341, 4777, 829, 284, 330, 1944, 1455, 45985, 698, 25291, 11, 8358, 23766, 5475, 1669, 633, 55653, 91121, 2836, 3036, 2959, 1155, 11, 2915, 368, 15592, 8348, 341, 197, 853, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestABCIRecorder(t *testing.T) { assert, require := assert.New(t), require.New(t) // This mock returns errors on everything but Query m := mock.ABCIMock{ Info: mock.Call{Response: abci.ResponseInfo{ Data: "data", Version: "v0.9.9", }}, Query: mock.Call{Error: errors.New("query")}, Broadcast: mock.Call{Error: errors.New("broadcast")}, BroadcastCommit: mock.Call{Error: errors.New("broadcast_commit")}, } r := mock.NewABCIRecorder(m) require.Equal(0, len(r.Calls)) _, err := r.ABCIInfo(context.Background()) assert.Nil(err, "expected no err on info") _, err = r.ABCIQueryWithOptions( context.Background(), "path", bytes.HexBytes("data"), client.ABCIQueryOptions{Prove: false}, ) assert.NotNil(err, "expected error on query") require.Equal(2, len(r.Calls)) info := r.Calls[0] assert.Equal("abci_info", info.Name) assert.Nil(info.Error) assert.Nil(info.Args) require.NotNil(info.Response) ir, ok := info.Response.(*ctypes.ResultABCIInfo) require.True(ok) assert.Equal("data", ir.Response.Data) assert.Equal("v0.9.9", ir.Response.Version) query := r.Calls[1] assert.Equal("abci_query", query.Name) assert.Nil(query.Response) require.NotNil(query.Error) assert.Equal("query", query.Error.Error()) require.NotNil(query.Args) qa, ok := query.Args.(mock.QueryArgs) require.True(ok) assert.Equal("path", qa.Path) assert.EqualValues("data", qa.Data) assert.False(qa.Prove) // now add some broadcasts (should all err) txs := []types.Tx{{1}, {2}, {3}} _, err = r.BroadcastTxCommit(context.Background(), txs[0]) assert.NotNil(err, "expected err on broadcast") _, err = r.BroadcastTxSync(context.Background(), txs[1]) assert.NotNil(err, "expected err on broadcast") _, err = r.BroadcastTxAsync(context.Background(), txs[2]) assert.NotNil(err, "expected err on broadcast") require.Equal(5, len(r.Calls)) bc := r.Calls[2] assert.Equal("broadcast_tx_commit", bc.Name) assert.Nil(bc.Response) require.NotNil(bc.Error) assert.EqualValues(bc.Args, txs[0]) bs := r.Calls[3] assert.Equal("broadcast_tx_sync", bs.Name) assert.Nil(bs.Response) require.NotNil(bs.Error) assert.EqualValues(bs.Args, txs[1]) ba := r.Calls[4] assert.Equal("broadcast_tx_async", ba.Name) assert.Nil(ba.Response) require.NotNil(ba.Error) assert.EqualValues(ba.Args, txs[2]) }
explode_data.jsonl/19429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 968 }
[ 2830, 3393, 1867, 11237, 47023, 1155, 353, 8840, 836, 8, 341, 6948, 11, 1373, 1669, 2060, 7121, 1155, 701, 1373, 7121, 1155, 692, 197, 322, 1096, 7860, 4675, 5975, 389, 4297, 714, 11361, 198, 2109, 1669, 7860, 875, 4897, 1791, 1176, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOne(t *testing.T) { var user User qs := dORM.QueryTable("user") err := qs.One(&user) throwFail(t, err) user = User{} err = qs.OrderBy("Id").Limit(1).One(&user) throwFailNow(t, err) throwFail(t, AssertIs(user.UserName, "slene")) throwFail(t, AssertNot(err, ErrMultiRows)) user = User{} err = qs.OrderBy("-Id").Limit(100).One(&user) throwFailNow(t, err) throwFail(t, AssertIs(user.UserName, "nobody")) throwFail(t, AssertNot(err, ErrMultiRows)) err = qs.Filter("user_name", "nothing").One(&user) throwFail(t, AssertIs(err, ErrNoRows)) }
explode_data.jsonl/18135
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 240 }
[ 2830, 3393, 3966, 1155, 353, 8840, 836, 8, 341, 2405, 1196, 2657, 198, 18534, 82, 1669, 294, 4365, 15685, 2556, 445, 872, 1138, 9859, 1669, 32421, 37067, 2099, 872, 340, 9581, 19524, 1155, 11, 1848, 692, 19060, 284, 2657, 16094, 9859, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEventRequestToUrl(t *testing.T) { externalUrl := "http://localhost:8000" tests := map[string]struct { er *analytics.EventRequest want string }{ "one": { er: &analytics.EventRequest{ Type: analytics.Imp, BidID: "bidid", AccountID: "accountId", Bidder: "bidder", Timestamp: 1234567, Format: analytics.Blank, Analytics: analytics.Enabled, }, want: "http://localhost:8000/event?t=imp&b=bidid&a=accountId&bidder=bidder&f=b&ts=1234567&x=1", }, "two": { er: &analytics.EventRequest{ Type: analytics.Win, BidID: "bidid", AccountID: "accountId", Bidder: "bidder", Timestamp: 1234567, Format: analytics.Image, Analytics: analytics.Disabled, }, want: "http://localhost:8000/event?t=win&b=bidid&a=accountId&bidder=bidder&f=i&ts=1234567&x=0", }, "three": { er: &analytics.EventRequest{ Type: analytics.Win, BidID: "bidid", AccountID: "accountId", Bidder: "bidder", Timestamp: 1234567, Format: analytics.Image, Analytics: analytics.Disabled, Integration: "integration", }, want: "http://localhost:8000/event?t=win&b=bidid&a=accountId&bidder=bidder&f=i&int=integration&ts=1234567&x=0", }, } for name, test := range tests { t.Run(name, func(t *testing.T) { expected := EventRequestToUrl(externalUrl, test.er) // validate assert.Equal(t, test.want, expected) }) } }
explode_data.jsonl/147
{ "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, 1556, 1900, 1249, 2864, 1155, 353, 8840, 836, 8, 341, 197, 20921, 2864, 1669, 330, 1254, 1110, 8301, 25, 23, 15, 15, 15, 698, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 197, 261, 256, 353, 77652, 6904, 1900, 198, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdateDCAnnotations(t *testing.T) { tests := []struct { name string dcName string annotations map[string]string existingDc appsv1.DeploymentConfig wantErr bool }{ { name: "existing dc", dcName: "nodejs", annotations: map[string]string{ "app.kubernetes.io/url": "file:///temp/nodejs-ex", "app.kubernetes.io/component-source-type": "local", }, existingDc: appsv1.DeploymentConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "nodejs", Annotations: map[string]string{"app.kubernetes.io/url": "https://github.com/sclorg/nodejs-ex", "app.kubernetes.io/component-source-type": "git", }, }, }, wantErr: false, }, { name: "non existing dc", dcName: "nodejs", annotations: map[string]string{ "app.kubernetes.io/url": "file:///temp/nodejs-ex", "app.kubernetes.io/component-source-type": "local", }, existingDc: appsv1.DeploymentConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "wildfly", Annotations: map[string]string{"app.kubernetes.io/url": "https://github.com/sclorg/nodejs-ex", "app.kubernetes.io/component-source-type": "git", }, }, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { fkclient, fkclientset := FakeNew() fkclientset.AppsClientset.PrependReactor("get", "deploymentconfigs", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { dcName := action.(ktesting.GetAction).GetName() if dcName != tt.dcName { return true, nil, fmt.Errorf("'get' called with a different dcName") } if tt.dcName != tt.existingDc.Name { return true, nil, fmt.Errorf("got different dc") } return true, &tt.existingDc, nil }) fkclientset.AppsClientset.PrependReactor("update", "deploymentconfigs", func(action ktesting.Action) (handled bool, ret runtime.Object, err error) { dc := action.(ktesting.UpdateAction).GetObject().(*appsv1.DeploymentConfig) if dc.Name != tt.existingDc.Name { return true, nil, fmt.Errorf("got different dc") } return true, dc, nil }) err := fkclient.UpdateDCAnnotations(tt.dcName, tt.annotations) if err == nil && !tt.wantErr { // Check for validating actions performed if (len(fkclientset.AppsClientset.Actions()) != 2) && (tt.wantErr != true) { t.Errorf("expected 2 action in UpdateDeploymentConfig got: %v", fkclientset.AppsClientset.Actions()) } updatedDc := fkclientset.AppsClientset.Actions()[1].(ktesting.UpdateAction).GetObject().(*appsv1.DeploymentConfig) if updatedDc.Name != tt.dcName { t.Errorf("deploymentconfig name is not matching with expected value, expected: %s, got %s", tt.dcName, updatedDc.Name) } if !reflect.DeepEqual(updatedDc.Annotations, tt.annotations) { t.Errorf("deployment Config annotations not matching with expected values, expected: %s, got %s", tt.annotations, updatedDc.Annotations) } } else if err == nil && tt.wantErr { t.Error("error was expected, but no error was returned") } else if err != nil && !tt.wantErr { t.Errorf("test failed, no error was expected, but got unexpected error: %s", err) } }) } }
explode_data.jsonl/65148
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1392 }
[ 2830, 3393, 4289, 5626, 21418, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 87249, 675, 414, 914, 198, 197, 197, 39626, 2415, 14032, 30953, 198, 197, 8122, 11083, 35, 66, 220, 906, 3492, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVerificationMethods(t *testing.T) { assert := tdd.New(t) // New DID with master key id, err := NewIdentifierWithMode("bryk", "sample-network", ModeUUID) assert.Nil(err, "new identifier") assert.Nil(id.AddNewVerificationMethod("master", KeyTypeEd), "add key") // Add verification methods key := id.GetReference("master") assert.Nil(id.AddVerificationRelationship(key, AuthenticationVM), "authentication") assert.Nil(id.AddVerificationRelationship(key, AssertionVM), "assertion") assert.Nil(id.AddVerificationRelationship(key, KeyAgreementVM), "key agreement") assert.Nil(id.AddVerificationRelationship(key, CapabilityInvocationVM), "invocation") assert.Nil(id.AddVerificationRelationship(key, CapabilityDelegationVM), "delegation") // Retrieve verification methods assert.Equal(1, len(id.GetVerificationRelationship(AuthenticationVM)), "authentication") assert.Equal(1, len(id.GetVerificationRelationship(AssertionVM)), "assertion") assert.Equal(1, len(id.GetVerificationRelationship(KeyAgreementVM)), "key agreement") assert.Equal(1, len(id.GetVerificationRelationship(CapabilityInvocationVM)), "invocation") assert.Equal(1, len(id.GetVerificationRelationship(CapabilityDelegationVM)), "delegation") // Verify proof mk := id.VerificationMethod("master") data, err := id.Document(true).NormalizedLD() assert.Nil(err, "normalized DID document") proof, err := id.GetProof(mk.ID, "did.bryk.io") assert.Nil(err, "get proof") assert.True(mk.VerifyProof(data, proof), "verify proof") }
explode_data.jsonl/37747
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 502 }
[ 2830, 3393, 62339, 17856, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 259, 631, 7121, 1155, 692, 197, 322, 1532, 59119, 448, 7341, 1376, 198, 15710, 11, 1848, 1669, 1532, 8714, 2354, 3636, 445, 65, 884, 74, 497, 330, 13611, 56732, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIssue_8(t *testing.T) { notify := testNotify{} event.On("*", &notify) err, _ := event.Fire("test_notify", event.M{}) assert.Nil(t, err) assert.True(t, isRun) event.On("test_notify", &notify) err, _ = event.Fire("test_notify", event.M{}) assert.Nil(t, err) assert.True(t, isRun) }
explode_data.jsonl/35464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 42006, 62, 23, 1155, 353, 8840, 836, 8, 341, 197, 21948, 1669, 1273, 28962, 31483, 28302, 8071, 29592, 497, 609, 21948, 340, 9859, 11, 716, 1669, 1538, 71305, 445, 1944, 36654, 497, 1538, 1321, 37790, 6948, 59678, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1