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_medianSlidingWindow(t *testing.T) { type args struct { nums []int k int } tests := []struct { name string args args want []float64 }{ {name: "1", args: args{nums: []int{1, 3, -1, -3, 5, 3, 6, 7}, k: 3}, want: []float64{1, -1, -1, 3, 5, 6}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := medianSlidingWindow(tt.args.nums, tt.args.k); !reflect.DeepEqual(got, tt.want) { t.Errorf("medianSlidingWindow() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/73049
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 249 }
[ 2830, 3393, 83003, 7442, 6577, 4267, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 22431, 82, 3056, 396, 198, 197, 16463, 262, 526, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 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...
2
func Test_Tokenize(t *testing.T) { type expected struct { tokens []string err string } tests := []struct { input string expected expected }{ { input: "$", expected: expected{ tokens: []string{ "$", }, }, }, { input: "@", expected: expected{ tokens: []string{ "@", }, }, }, { input: "%", expected: expected{ err: "unexpected token '%' at index 0", }, }, { input: "$.store.book[*].author", expected: expected{ tokens: []string{ "$", "store", "book", "[*]", "author", }, }, }, { input: "$..author", expected: expected{ tokens: []string{ "$", "..", "author", }, }, }, { input: "$.store.*", expected: expected{ tokens: []string{ "$", "store", "*", }, }, }, { input: "$.store..price", expected: expected{ tokens: []string{ "$", "store", "..", "price", }, }, }, { input: "$..book[2]", expected: expected{ tokens: []string{ "$", "..", "book", "[2]", }, }, }, { input: "$..book[(@.length-1)]", expected: expected{ tokens: []string{ "$", "..", "book", "[(@.length-1)]", }, }, }, { input: "$..book[-1:]", expected: expected{ tokens: []string{ "$", "..", "book", "[-1:]", }, }, }, { input: "$..book[0,1]", expected: expected{ tokens: []string{ "$", "..", "book", "[0,1]", }, }, }, { input: "$..book[:2]", expected: expected{ tokens: []string{ "$", "..", "book", "[:2]", }, }, }, { input: "$..book[?(@.isbn)]", expected: expected{ tokens: []string{ "$", "..", "book", "[?(@.isbn)]", }, }, }, { input: "$..book[?(@.price<10)]", expected: expected{ tokens: []string{ "$", "..", "book", "[?(@.price<10)]", }, }, }, { input: "$..*", expected: expected{ tokens: []string{ "$", "..", "*", }, }, }, { input: "@.sub.query", expected: expected{ tokens: []string{ "@", "sub", "query", }, }, }, { input: "user.email", expected: expected{ tokens: nil, err: "unexpected token 'u' at index 0", }, }, { input: "$['store']['book'][*]['author']", expected: expected{ tokens: []string{ "$", "['store']", "['book']", "[*]", "['author']", }, }, }, { input: "$['store'].book[*].author", expected: expected{ tokens: []string{ "$", "['store']", "book", "[*]", "author", }, }, }, { input: "$*", expected: expected{ err: "unexpected token '*' at index 1", }, }, { input: "$['store']book.author", expected: expected{ tokens: []string{ "$", "['store']", "book", "author", }, }, }, { input: "", expected: expected{ err: "unexpected token '' at index 0", }, }, { input: "$.store.book[($.totals[0])].author", expected: expected{ tokens: []string{ "$", "store", "book", "[($.totals[0])]", "author", }, }, }, { input: "$.['book'].[*].author", expected: expected{ tokens: []string{ "$", "['book']", "[*]", "author", }, }, }, { input: "@.isbn", expected: expected{ tokens: []string{"@", "isbn"}, }, }, { input: "@.'.'", expected: expected{ tokens: []string{"@", "'.'"}, }, }, } for idx, test := range tests { t.Run(fmt.Sprintf("%d", idx), func(t *testing.T) { tokens, err := Tokenize(test.input) if test.expected.err != "" { assert.EqualError(t, err, test.expected.err, "unexpected error for %s", test.input) } else { assert.Nil(t, err) } for i, actual := range tokens { expected := test.expected.tokens[i] assert.EqualValues(t, expected, actual, "unexpected token for %s", test.input) } }) } }
explode_data.jsonl/45851
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2353 }
[ 2830, 3393, 1139, 1679, 551, 1155, 353, 8840, 836, 8, 1476, 13158, 3601, 2036, 341, 197, 3244, 9713, 3056, 917, 198, 197, 9859, 262, 914, 198, 197, 630, 78216, 1669, 3056, 1235, 341, 197, 22427, 262, 914, 198, 197, 42400, 3601, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSmall(t *testing.T) { l := New() el1 := l.PushBack(1) el2 := l.PushBack(2) el3 := l.PushBack(3) if l.Len() != 3 { t.Error("Expected len 3, got ", l.Len()) } //fmt.Printf("%p %v\n", el1, el1) //fmt.Printf("%p %v\n", el2, el2) //fmt.Printf("%p %v\n", el3, el3) r1 := l.Remove(el1) //fmt.Printf("%p %v\n", el1, el1) //fmt.Printf("%p %v\n", el2, el2) //fmt.Printf("%p %v\n", el3, el3) r2 := l.Remove(el2) //fmt.Printf("%p %v\n", el1, el1) //fmt.Printf("%p %v\n", el2, el2) //fmt.Printf("%p %v\n", el3, el3) r3 := l.Remove(el3) if r1 != 1 { t.Error("Expected 1, got ", r1) } if r2 != 2 { t.Error("Expected 2, got ", r2) } if r3 != 3 { t.Error("Expected 3, got ", r3) } if l.Len() != 0 { t.Error("Expected len 0, got ", l.Len()) } }
explode_data.jsonl/12512
{ "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, 25307, 1155, 353, 8840, 836, 8, 972, 8810, 1669, 1532, 3568, 59636, 16, 1669, 326, 34981, 3707, 7, 16, 1218, 59636, 17, 1669, 326, 34981, 3707, 7, 17, 1218, 59636, 18, 1669, 326, 34981, 3707, 7, 18, 1218, 743, 326, 65819...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestLineInvalidArgs(t *testing.T) { // // Invalid pos arguments // type testElement struct { bytes []byte pos int } tests := []testElement{ {[]byte{'a', 'b'}, -2}, {[]byte{'a', 'b'}, -1}, {[]byte{'a', 'b'}, 2}, {[]byte{'a', 'b'}, 3}, } for testI, test := range tests { r := LineBreakAfter(test.bytes, test.pos) if r != InvalidPos { t.Errorf("%v \"%v\" [%v]: expect %v, got %v", testI, test.bytes, test.pos, InvalidPos, r) } r = LineBreakBefore(test.bytes, test.pos) if r != InvalidPos { t.Errorf("%v \"%v\" [%v]: expect %v, got %v", testI, test.bytes, test.pos, InvalidPos, r) } } // // Empty string // for _, bytes := range [][]byte{nil, {}} { r := FirstLineBreak(bytes) if r != InvalidPos { t.Errorf("\"%v\": expect %v, got %v", bytes, InvalidPos, r) } r = LastLineBreak(bytes) if r != InvalidPos { t.Errorf("\"%v\": expect %v, got %v", bytes, InvalidPos, r) } ris := LineBreaks(bytes) if len(ris) != 0 || cap(ris) != 0 { t.Errorf("\"%v\": expect empty slice with cap=0, got %v with cap=%v", bytes, ris, cap(ris)) } } }
explode_data.jsonl/5996
{ "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, 2460, 7928, 4117, 1155, 353, 8840, 836, 8, 341, 197, 2289, 197, 322, 13882, 1133, 5977, 198, 197, 2289, 13158, 1273, 1691, 2036, 341, 197, 70326, 3056, 3782, 198, 197, 28164, 256, 526, 198, 197, 532, 78216, 1669, 3056, 194...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitPolicyFromFile(t *testing.T) { dir, err := ioutil.TempDir(os.TempDir(), "policy") if err != nil { t.Errorf("unexpected error: %v", err) } defer os.RemoveAll(dir) for i, test := range []struct { policy string expectedPredicates sets.String expectedPrioritizers sets.String }{ // Test json format policy file { policy: `{ "kind" : "Policy", "apiVersion" : "v1", "predicates" : [ {"name" : "PredicateOne"}, {"name" : "PredicateTwo"} ], "priorities" : [ {"name" : "PriorityOne", "weight" : 1}, {"name" : "PriorityTwo", "weight" : 5} ] }`, expectedPredicates: sets.NewString( "PredicateOne", "PredicateTwo", ), expectedPrioritizers: sets.NewString( "PriorityOne", "PriorityTwo", ), }, // Test yaml format policy file { policy: `apiVersion: v1 kind: Policy predicates: - name: PredicateOne - name: PredicateTwo priorities: - name: PriorityOne weight: 1 - name: PriorityTwo weight: 5 `, expectedPredicates: sets.NewString( "PredicateOne", "PredicateTwo", ), expectedPrioritizers: sets.NewString( "PriorityOne", "PriorityTwo", ), }, } { file := fmt.Sprintf("scheduler-policy-config-file-%d", i) fullPath := path.Join(dir, file) if err := ioutil.WriteFile(fullPath, []byte(test.policy), 0644); err != nil { t.Fatalf("Failed writing a policy config file: %v", err) } policy := &schedulerapi.Policy{} if err := initPolicyFromFile(fullPath, policy); err != nil { t.Fatalf("Failed writing a policy config file: %v", err) } // Verify that the policy is initialized correctly. schedPredicates := sets.NewString() for _, p := range policy.Predicates { schedPredicates.Insert(p.Name) } schedPrioritizers := sets.NewString() for _, p := range policy.Priorities { schedPrioritizers.Insert(p.Name) } if !schedPredicates.Equal(test.expectedPredicates) { t.Errorf("Expected predicates %v, got %v", test.expectedPredicates, schedPredicates) } if !schedPrioritizers.Equal(test.expectedPrioritizers) { t.Errorf("Expected priority functions %v, got %v", test.expectedPrioritizers, schedPrioritizers) } } }
explode_data.jsonl/24715
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 908 }
[ 2830, 3393, 3803, 13825, 43633, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 9638, 65009, 6184, 1507, 330, 34790, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 53859, 1465, 25, 1018, 85, 497, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestResourceNotStarted(t *testing.T) { tests := []struct { name string fn func(*Parser) error }{ {"CNAMEResource", func(p *Parser) error { _, err := p.CNAMEResource(); return err }}, {"MXResource", func(p *Parser) error { _, err := p.MXResource(); return err }}, {"NSResource", func(p *Parser) error { _, err := p.NSResource(); return err }}, {"PTRResource", func(p *Parser) error { _, err := p.PTRResource(); return err }}, {"SOAResource", func(p *Parser) error { _, err := p.SOAResource(); return err }}, {"TXTResource", func(p *Parser) error { _, err := p.TXTResource(); return err }}, {"SRVResource", func(p *Parser) error { _, err := p.SRVResource(); return err }}, {"AResource", func(p *Parser) error { _, err := p.AResource(); return err }}, {"AAAAResource", func(p *Parser) error { _, err := p.AAAAResource(); return err }}, } for _, test := range tests { if err := test.fn(&Parser{}); err != ErrNotStarted { t.Errorf("got _, %v = p.%s(), want = _, %v", err, test.name, ErrNotStarted) } } }
explode_data.jsonl/60553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 394 }
[ 2830, 3393, 4783, 2623, 32527, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 40095, 256, 2915, 4071, 6570, 8, 1465, 198, 197, 59403, 197, 197, 4913, 28668, 1402, 640, 288, 919, 497, 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...
1
func TestUpdateEdgeNode(t *testing.T) { locationCache := LocationCache{} nodeName := nodes[0] locationCache.EdgeNodes.Store(nodeName, "") tests := []struct { name string lc *LocationCache want bool }{ { name: "TestUpdateEdgeNode() Case: Node status update to OK", lc: &locationCache, want: true, }, { name: "TestUpdateEdgeNode() Case: Node status update to Unknown", lc: &locationCache, want: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { test.lc.UpdateEdgeNode(nodeName) if _, ok := test.lc.EdgeNodes.Load(nodeName); !ok { t.Errorf("Manager.TestUpdateEdgeNode() case failed: got = %v, want = %v.", ok, test.want) } }) } }
explode_data.jsonl/53307
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 295 }
[ 2830, 3393, 4289, 11656, 1955, 1155, 353, 8840, 836, 8, 341, 53761, 8233, 1669, 9866, 8233, 16094, 20831, 675, 1669, 7798, 58, 15, 921, 53761, 8233, 13, 11656, 12288, 38047, 6958, 675, 11, 85617, 78216, 1669, 3056, 1235, 341, 197, 11609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidateContainer(t *testing.T) { newPod := func(profile string) *api.Pod { pod := &api.Pod{ Spec: api.PodSpec{ Containers: []api.Container{ api.Container{ Name: "test", }, }, }, } if profile != "" { pod.Annotations = map[string]string{ api.SeccompContainerAnnotationKeyPrefix + "test": profile, } } return pod } tests := map[string]struct { allowedProfiles []string pod *api.Pod expectedMsg string }{ "empty allowed profiles, no container profile": { allowedProfiles: nil, pod: newPod(""), expectedMsg: "", }, "empty allowed profiles, container profile": { allowedProfiles: nil, pod: newPod("foo"), expectedMsg: "seccomp may not be set", }, "good container profile": { allowedProfiles: []string{"foo"}, pod: newPod("foo"), expectedMsg: "", }, "bad container profile": { allowedProfiles: []string{"foo"}, pod: newPod("bar"), expectedMsg: "bar is not a valid seccomp profile", }, "wildcard allows container profile": { allowedProfiles: []string{"*"}, pod: newPod("foo"), expectedMsg: "", }, "wildcard allows no profile": { allowedProfiles: []string{"*"}, pod: newPod(""), expectedMsg: "", }, } for name, tc := range tests { strategy, err := NewWithSeccompProfile(tc.allowedProfiles) if err != nil { t.Errorf("%s failed to create strategy with error %v", name, err) continue } errs := strategy.ValidateContainer(tc.pod, &tc.pod.Spec.Containers[0]) //should've passed but didn't if len(tc.expectedMsg) == 0 && len(errs) > 0 { t.Errorf("%s expected no errors but received %v", name, errs) } //should've failed but didn't if len(tc.expectedMsg) != 0 && len(errs) == 0 { t.Errorf("%s expected error %s but received no errors", name, tc.expectedMsg) } //failed with additional messages if len(tc.expectedMsg) != 0 && len(errs) > 1 { t.Errorf("%s expected error %s but received multiple errors: %v", name, tc.expectedMsg, errs) } //check that we got the right message if len(tc.expectedMsg) != 0 && len(errs) == 1 { if !strings.Contains(errs[0].Error(), tc.expectedMsg) { t.Errorf("%s expected error to contain %s but it did not: %v", name, tc.expectedMsg, errs) } } } }
explode_data.jsonl/13179
{ "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, 17926, 4502, 1155, 353, 8840, 836, 8, 341, 8638, 23527, 1669, 2915, 36606, 914, 8, 353, 2068, 88823, 341, 197, 3223, 347, 1669, 609, 2068, 88823, 515, 298, 7568, 992, 25, 6330, 88823, 8327, 515, 571, 197, 74632, 25, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConvertBlkIOToIOWeightValue(t *testing.T) { cases := map[uint16]uint64{ 0: 0, 10: 1, 1000: 10000, } for i, expected := range cases { got := ConvertBlkIOToIOWeightValue(i) if got != expected { t.Errorf("expected ConvertBlkIOToIOWeightValue(%d) to be %d, got %d", i, expected, got) } } }
explode_data.jsonl/34409
{ "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, 12012, 4923, 74, 3810, 1249, 3810, 8295, 1130, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 2415, 58, 2496, 16, 21, 60, 2496, 21, 19, 515, 197, 197, 15, 25, 262, 220, 15, 345, 197, 197, 16, 15, 25, 256, 220, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEcPointBytes(t *testing.T) { curve := btcec.S256() point, err := NewScalarBaseMult(curve, big.NewInt(2)) require.NoError(t, err) data := point.Bytes() point2, err := PointFromBytesUncompressed(curve, data) require.NoError(t, err) if point.X.Cmp(point2.X) != 0 && point.Y.Cmp(point2.Y) != 0 { t.Errorf("Points are not equal. Expected %v, found %v", point, point2) } curve2 := elliptic.P224() p2, err := NewScalarBaseMult(curve2, big.NewInt(2)) require.NoError(t, err) dta := p2.Bytes() point3, err := PointFromBytesUncompressed(curve2, dta) require.NoError(t, err) if p2.X.Cmp(point3.X) != 0 && p2.Y.Cmp(point3.Y) != 0 { t.Errorf("Points are not equal. Expected %v, found %v", p2, point3) } curve3 := elliptic.P521() p3, err := NewScalarBaseMult(curve3, big.NewInt(2)) require.NoError(t, err) data = p3.Bytes() point4, err := PointFromBytesUncompressed(curve3, data) require.NoError(t, err) if p3.X.Cmp(point4.X) != 0 && p3.Y.Cmp(point4.Y) != 0 { t.Errorf("Points are not equal. Expected %v, found %v", p3, point4) } }
explode_data.jsonl/75667
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 474 }
[ 2830, 3393, 50730, 2609, 7078, 1155, 353, 8840, 836, 8, 341, 33209, 586, 1669, 19592, 68955, 808, 17, 20, 21, 2822, 58474, 11, 1848, 1669, 1532, 20639, 3978, 40404, 17591, 586, 11, 2409, 7121, 1072, 7, 17, 1171, 17957, 35699, 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...
7
func TestClient_Login_DNSKDCs(t *testing.T) { test.Privileged(t) //ns := os.Getenv("DNSUTILS_OVERRIDE_NS") //if ns == "" { // os.Setenv("DNSUTILS_OVERRIDE_NS", testdata.TEST_NS) //} c, _ := config.NewConfigFromString(testdata.TEST_KRB5CONF) // Set to lookup KDCs in DNS c.LibDefaults.DNSLookupKDC = true //Blank out the KDCs to ensure they are not being used c.Realms = []config.Realm{} b, _ := hex.DecodeString(testdata.TESTUSER1_KEYTAB) kt := keytab.New() kt.Unmarshal(b) cl := NewClientWithKeytab("testuser1", "TEST.GOKRB5", kt, c) err := cl.Login() if err != nil { t.Errorf("error on logging in using DNS lookup of KDCs: %v\n", err) } }
explode_data.jsonl/5659
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 291 }
[ 2830, 3393, 2959, 79232, 1557, 2448, 42, 5626, 82, 1155, 353, 8840, 836, 8, 341, 18185, 17947, 344, 68431, 1155, 692, 197, 322, 4412, 1669, 2643, 64883, 445, 61088, 36969, 50, 49372, 33777, 1138, 197, 322, 333, 12268, 621, 1591, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestLoggerDebugSuppressed(t *testing.T) { checkMessages(t, zapcore.InfoLevel, []Option{WithDebug()}, zapcore.DebugLevel, nil, func(logger *Logger) { logger.Print("hello") logger.Printf("world") logger.Println("foo") }) }
explode_data.jsonl/58461
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 7395, 7939, 10048, 14318, 1155, 353, 8840, 836, 8, 341, 25157, 15820, 1155, 11, 32978, 2153, 20132, 4449, 11, 3056, 5341, 90, 2354, 7939, 76777, 32978, 2153, 20345, 4449, 11, 2092, 11, 2915, 37833, 353, 7395, 8, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestPublishWithoutEventTypeVersion(t *testing.T) { payload := buildDefaultTestPayloadWithoutEventTypeVersion() body, statusCode := performPublishRequest(t, publishServer.URL, payload) assertExpectedError(t, body, statusCode, http.StatusBadRequest, api.FieldEventTypeVersion, api.ErrorTypeValidationViolation) }
explode_data.jsonl/74413
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 50145, 26040, 47906, 5637, 1155, 353, 8840, 836, 8, 341, 76272, 1669, 1936, 3675, 2271, 29683, 26040, 47906, 5637, 741, 35402, 11, 35532, 1669, 2736, 50145, 1900, 1155, 11, 3415, 5475, 20893, 11, 7729, 340, 6948, 18896, 1454, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStmtCloseOrder(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) db.SetMaxIdleConns(0) setStrictFakeConnClose(t) defer setStrictFakeConnClose(nil) _, err := db.Query("SELECT|non_existent|name|") if err == nil { t.Fatal("Querying non-existent table should fail") } }
explode_data.jsonl/16013
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 31063, 7925, 4431, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 2271, 3506, 1155, 11, 330, 16069, 1138, 16867, 3265, 3506, 1155, 11, 2927, 692, 20939, 4202, 5974, 41370, 1109, 4412, 7, 15, 340, 8196, 41857, 52317, 9701, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildGenesis(t *testing.T) { ss := CreateStaticService() addrMap := map[string]string{} for _, addrStr := range addrStrArray { b, err := formatting.Decode(formatting.CB58, addrStr) if err != nil { t.Fatal(err) } addrMap[addrStr], err = formatting.FormatBech32(testHRP, b) if err != nil { t.Fatal(err) } } args := BuildGenesisArgs{ Encoding: formatting.Hex, GenesisData: map[string]AssetDefinition{ "asset1": { Name: "myFixedCapAsset", Symbol: "MFCA", Denomination: 8, InitialState: map[string][]interface{}{ "fixedCap": { Holder{ Amount: 100000, Address: addrMap["A9bTQjfYGBFK3JPRJqF2eh3JYL7cHocvy"], }, Holder{ Amount: 100000, Address: addrMap["6mxBGnjGDCKgkVe7yfrmvMA7xE7qCv3vv"], }, Holder{ Amount: json.Uint64(startBalance), Address: addrMap["6ncQ19Q2U4MamkCYzshhD8XFjfwAWFzTa"], }, Holder{ Amount: json.Uint64(startBalance), Address: addrMap["Jz9ayEDt7dx9hDx45aXALujWmL9ZUuqe7"], }, }, }, }, "asset2": { Name: "myVarCapAsset", Symbol: "MVCA", InitialState: map[string][]interface{}{ "variableCap": { Owners{ Threshold: 1, Minters: []string{ addrMap["A9bTQjfYGBFK3JPRJqF2eh3JYL7cHocvy"], addrMap["6mxBGnjGDCKgkVe7yfrmvMA7xE7qCv3vv"], }, }, Owners{ Threshold: 2, Minters: []string{ addrMap["6ncQ19Q2U4MamkCYzshhD8XFjfwAWFzTa"], addrMap["Jz9ayEDt7dx9hDx45aXALujWmL9ZUuqe7"], }, }, }, }, }, "asset3": { Name: "myOtherVarCapAsset", InitialState: map[string][]interface{}{ "variableCap": { Owners{ Threshold: 1, Minters: []string{ addrMap["A9bTQjfYGBFK3JPRJqF2eh3JYL7cHocvy"], }, }, }, }, }, }, } reply := BuildGenesisReply{} err := ss.BuildGenesis(nil, &args, &reply) if err != nil { t.Fatal(err) } }
explode_data.jsonl/10750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1145 }
[ 2830, 3393, 11066, 84652, 1155, 353, 8840, 836, 8, 341, 34472, 1669, 4230, 11690, 1860, 741, 53183, 2227, 1669, 2415, 14032, 30953, 16094, 2023, 8358, 10789, 2580, 1669, 2088, 10789, 2580, 1857, 341, 197, 2233, 11, 1848, 1669, 36566, 5637...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInvalidChecksum(t *testing.T) { for _, test := range invalidChecksum { hrp, data, err := bech32.Decode(test) if err != nil { t.Logf("Invalid checksum for %s : ok / hrp : %+v , data : %+v\n", test, hrp, data) } else { t.Errorf("Invalid checksum for %s : FAIL\n", test) } } }
explode_data.jsonl/72629
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 7928, 73190, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 8318, 73190, 341, 197, 78847, 79, 11, 821, 11, 1848, 1669, 387, 331, 18, 17, 56372, 8623, 340, 197, 743, 1848, 961, 2092, 341, 298, 3244, 98954, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestIntegration(t *testing.T) { fstests.Run(t, &fstests.Opt{ RemoteName: "TestB2:", NilObject: (*Object)(nil), ChunkedUpload: fstests.ChunkedUploadConfig{ MinChunkSize: minChunkSize, }, }) }
explode_data.jsonl/81146
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 52464, 1155, 353, 8840, 836, 8, 341, 1166, 267, 17966, 16708, 1155, 11, 609, 49494, 17966, 8382, 417, 515, 197, 197, 24703, 675, 25, 330, 2271, 33, 17, 55120, 197, 18317, 321, 1190, 25, 220, 4609, 1190, 2376, 8385, 1326, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWipe(t *testing.T) { t.Parallel() // First, create a temporary directory to be used for the duration of // this test. tempDirName, err := ioutil.TempDir("", "channeldb") if err != nil { t.Fatalf("unable to create temp dir: %v", err) } defer os.RemoveAll(tempDirName) // Next, open thereby creating channeldb for the first time. dbPath := filepath.Join(tempDirName, "cdb") cdb, err := Open(dbPath) if err != nil { t.Fatalf("unable to create channeldb: %v", err) } defer cdb.Close() if err := cdb.Wipe(); err != nil { t.Fatalf("unable to wipe channeldb: %v", err) } // Check correct errors are returned _, err = cdb.FetchAllOpenChannels() if err != ErrNoActiveChannels { t.Fatalf("fetching open channels: expected '%v' instead got '%v'", ErrNoActiveChannels, err) } _, err = cdb.FetchClosedChannels(false) if err != ErrNoClosedChannels { t.Fatalf("fetching closed channels: expected '%v' instead got '%v'", ErrNoClosedChannels, err) } }
explode_data.jsonl/47871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 386 }
[ 2830, 3393, 54, 3444, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 5512, 11, 1855, 264, 13340, 6220, 311, 387, 1483, 369, 279, 8090, 315, 198, 197, 322, 419, 1273, 624, 16280, 6184, 675, 11, 1848, 1669, 43144, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestClient_GetReceivers(t *testing.T) { client, _ := newTestClient() recs, err := client.GetReceivers(testNID) assert.NoError(t, err) assert.Equal(t, 4, len(recs)) assert.Equal(t, "receiver", recs[0].Name) assert.Equal(t, "slack", recs[1].Name) assert.Equal(t, "webhook", recs[2].Name) assert.Equal(t, "email", recs[3].Name) recs, err = client.GetReceivers(otherNID) assert.NoError(t, err) assert.Equal(t, 1, len(recs)) recs, err = client.GetReceivers("bad_nid") assert.NoError(t, err) assert.Equal(t, 0, len(recs)) }
explode_data.jsonl/63852
{ "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, 2959, 13614, 693, 346, 1945, 1155, 353, 8840, 836, 8, 341, 25291, 11, 716, 1669, 501, 2271, 2959, 741, 67904, 82, 11, 1848, 1669, 2943, 2234, 693, 346, 1945, 8623, 45, 915, 340, 6948, 35699, 1155, 11, 1848, 340, 6948, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestV3AuthenticateWithDomainIdAndTenantId(t *testing.T) { ctx := context.Background() if !isV3Api() { return } c, rollback := makeConnection(t) defer rollback() c.Tenant = "" c.Domain = "" c.TenantId = os.Getenv("SWIFT_TENANT_ID") c.DomainId = os.Getenv("SWIFT_API_DOMAIN_ID") err := c.Authenticate(ctx) if err != nil { t.Fatal("Auth failed", err) } if !c.Authenticated() { t.Fatal("Not authenticated") } }
explode_data.jsonl/12654
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 53, 18, 99087, 2354, 13636, 764, 3036, 71252, 764, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 743, 753, 285, 53, 18, 6563, 368, 341, 197, 853, 198, 197, 630, 1444, 11, 60414, 1669, 1281, 4526, 1155, 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...
4
func TestGenerateConfigForDCACSVCandles(t *testing.T) { fp := filepath.Join("..", "testdata", "binance_BTCUSDT_24h_2019_01_01_2020_01_01.csv") cfg := Config{ Nickname: "ExampleStrategyDCACSVCandles", Goal: "To demonstrate the DCA strategy using CSV candle data", StrategySettings: StrategySettings{ Name: dca, }, CurrencySettings: []CurrencySettings{ { ExchangeName: testExchange, Asset: asset.Spot.String(), Base: currency.BTC.String(), Quote: currency.USDT.String(), InitialQuoteFunds: initialQuoteFunds2, BuySide: minMax, SellSide: minMax, Leverage: Leverage{ CanUseLeverage: false, }, MakerFee: makerFee, TakerFee: takerFee, }, }, DataSettings: DataSettings{ Interval: kline.OneDay.Duration(), DataType: common.CandleStr, CSVData: &CSVData{ FullPath: fp, }, }, PortfolioSettings: PortfolioSettings{ BuySide: minMax, SellSide: minMax, Leverage: Leverage{ CanUseLeverage: false, }, }, StatisticSettings: StatisticSettings{ RiskFreeRate: decimal.NewFromFloat(0.03), }, } if saveConfig { result, err := json.MarshalIndent(cfg, "", " ") if err != nil { t.Fatal(err) } p, err := os.Getwd() if err != nil { t.Fatal(err) } err = ioutil.WriteFile(filepath.Join(p, "examples", "dca-csv-candles.strat"), result, 0770) if err != nil { t.Error(err) } } }
explode_data.jsonl/58412
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 691 }
[ 2830, 3393, 31115, 2648, 2461, 5626, 62687, 11287, 20125, 1155, 353, 8840, 836, 8, 341, 65219, 1669, 26054, 22363, 95032, 497, 330, 92425, 497, 330, 6863, 681, 1668, 7749, 2034, 10599, 62, 17, 19, 71, 62, 17, 15, 16, 24, 62, 15, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestMatNormalize(t *testing.T) { src := NewMatWithSize(101, 102, MatTypeCV8U) dst := NewMat() Normalize(src, &dst, 0.0, 255.0, NormMixMax) if dst.Empty() { t.Error("TestMatNormalize dst should not be empty.") } }
explode_data.jsonl/81716
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 11575, 87824, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 1532, 11575, 2354, 1695, 7, 16, 15, 16, 11, 220, 16, 15, 17, 11, 6867, 929, 19589, 23, 52, 340, 52051, 1669, 1532, 11575, 741, 197, 87824, 14705, 11, 609, 15658, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateDoubleSign(t *testing.T) { stakedValidator := getStakedValidator() type args struct { validator types.Validator increasedContext int64 maxMissed int64 } type expected struct { validator types.Validator tombstoned bool message string pubKeyRelation bool } tests := []struct { name string panics bool args expected }{ { name: "handles double signature", panics: false, args: args{validator: stakedValidator}, expected: expected{ validator: stakedValidator, pubKeyRelation: true, tombstoned: false, }, }, { name: "ignores double signature on tombstoned validator", panics: true, args: args{validator: stakedValidator}, expected: expected{ validator: stakedValidator, pubKeyRelation: true, tombstoned: true, message: fmt.Sprintf("ERROR:\nCodespace: pos\nCode: 113\nMessage: \"Warning: validator is already tombstoned\"\n"), }, }, { name: "ignores double signature on tombstoned validator", panics: true, args: args{validator: stakedValidator}, expected: expected{ validator: stakedValidator, pubKeyRelation: false, tombstoned: false, message: fmt.Sprintf("ERROR:\nCodespace: pos\nCode: 114\nMessage: \"Warning: the DS evidence is unable to be handled\"\n"), }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { context, _, keeper := createTestInput(t, true) cryptoAddr := test.args.validator.GetPublicKey().Address() keeper.SetValidator(context, test.args.validator) signingInfo := types.ValidatorSigningInfo{ Address: test.args.validator.GetAddress(), StartHeight: context.BlockHeight(), JailedUntil: time.Unix(0, 0), } if test.expected.tombstoned { signingInfo.Tombstoned = test.expected.tombstoned } infractionHeight := context.BlockHeight() if test.expected.pubKeyRelation { keeper.setAddrPubkeyRelation(context, cryptoAddr, test.args.validator.GetPublicKey()) } keeper.SetValidatorSigningInfo(context, sdk.Address(cryptoAddr), signingInfo) signingInfo, found := keeper.GetValidatorSigningInfo(context, sdk.Address(cryptoAddr)) if !found { t.FailNow() } address, signedInfo, validator, err := keeper.validateDoubleSign(context, cryptoAddr, infractionHeight, time.Unix(0, 0)) if err != nil { assert.Equal(t, test.expected.message, err.Error()) } else { assert.Equal(t, sdk.Address(cryptoAddr), address, "addresses do not match") assert.Equal(t, signedInfo, signingInfo, "signed Info do not match") assert.Equal(t, test.expected.validator, validator, "validators do not match") } }) } }
explode_data.jsonl/9980
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1125 }
[ 2830, 3393, 17926, 7378, 7264, 1155, 353, 8840, 836, 8, 341, 18388, 7741, 14256, 1669, 633, 623, 7741, 14256, 2822, 13158, 2827, 2036, 341, 197, 197, 16112, 286, 4494, 13, 14256, 198, 197, 17430, 837, 1475, 1972, 526, 21, 19, 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...
5
func TestFilterForeignOrgLeadershipMessages(t *testing.T) { t.Parallel() org1 := api.OrgIdentityType("org1") org2 := api.OrgIdentityType("org2") p1 := common.PKIidType("p1") p2 := common.PKIidType("p2") cs := &cryptoService{} adapter := &gossipAdapterMock{} relayedLeadershipMsgs := make(chan interface{}, 2) adapter.On("GetOrgOfPeer", p1).Return(org1) adapter.On("GetOrgOfPeer", p2).Return(org2) adapter.On("GetMembership").Return([]discovery.NetworkMember{}) adapter.On("GetConf").Return(conf) adapter.On("DeMultiplex", mock.Anything).Run(func(args mock.Arguments) { relayedLeadershipMsgs <- args.Get(0) }) joinMsg := &joinChanMsg{ members2AnchorPeers: map[string][]api.AnchorPeer{ string(org1): {}, string(org2): {}, }, } loggedEntries := make(chan string, 1) logger := flogging.MustGetLogger("test").WithOptions(zap.Hooks(func(entry zapcore.Entry) error { loggedEntries <- entry.Message return nil })) assertLogged := func(s string) { assert.Len(t, loggedEntries, 1) loggedEntry := <-loggedEntries assert.Contains(t, loggedEntry, s) } gc := NewGossipChannel(pkiIDInOrg1, org1, cs, channelA, adapter, joinMsg, disabledMetrics) gc.(*gossipChannel).logger = logger leadershipMsg := func(sender common.PKIidType, creator common.PKIidType) proto.ReceivedMessage { return &receivedMsg{PKIID: sender, msg: &proto.SignedGossipMessage{ GossipMessage: &proto.GossipMessage{ Channel: common.ChainID("A"), Tag: proto.GossipMessage_CHAN_AND_ORG, Content: &proto.GossipMessage_LeadershipMsg{ LeadershipMsg: &proto.LeadershipMessage{ PkiId: creator, }}, }, }, } } gc.HandleMessage(leadershipMsg(p1, p1)) assert.Len(t, relayedLeadershipMsgs, 1, "should have relayed a message from p1 (same org)") assert.Len(t, loggedEntries, 0) gc.HandleMessage(leadershipMsg(p2, p1)) assert.Len(t, relayedLeadershipMsgs, 1, "should not have relayed a message from p2 (foreign org)") assertLogged("Received leadership message from that belongs to a foreign organization org2") gc.HandleMessage(leadershipMsg(p1, p2)) assert.Len(t, relayedLeadershipMsgs, 1, "should not have relayed a message from p2 (foreign org)") assertLogged("Received leadership message created by a foreign organization org2") }
explode_data.jsonl/66334
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 878 }
[ 2830, 3393, 5632, 58632, 42437, 92724, 2151, 15820, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 87625, 16, 1669, 6330, 8382, 1984, 18558, 929, 445, 1775, 16, 1138, 87625, 17, 1669, 6330, 8382, 1984, 18558, 929, 445, 1775, 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 TestReadLoadConfigExternal(t *testing.T) { LoadConfigExternal("read", "goapi", "password", "127.0.0.1", "3306", "goapi") fmt.Printf("username: %v password: %v host: %v port %v database: %v\n", readUser, readPass, readHost, readPort, readDB) }
explode_data.jsonl/68480
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 4418, 5879, 2648, 25913, 1155, 353, 8840, 836, 8, 1476, 197, 5879, 2648, 25913, 445, 878, 497, 330, 3346, 2068, 497, 330, 3833, 497, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 497, 330, 18, 18, 15, 21, 497, 330, 3346, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApiDevAuthGetTenantLimit(t *testing.T) { t.Parallel() // enforce specific field naming in errors returned by API updateRestErrorFieldName() tcases := []struct { limit string tenantId string daLimit *model.Limit daErr error code int body string }{ { limit: "max_devices", tenantId: "tenant-foo", daLimit: &model.Limit{ Name: model.LimitMaxDeviceCount, Value: 123, }, daErr: nil, code: http.StatusOK, body: string(asJSON( LimitValue{ Limit: 123, }, )), }, { limit: "bogus", tenantId: "tenant-foo", code: http.StatusBadRequest, body: RestError("unsupported limit bogus"), }, { limit: "max_devices", tenantId: "tenant-foo", daLimit: nil, daErr: errors.New("generic error"), code: http.StatusInternalServerError, body: RestError("internal error"), }, } for i := range tcases { tc := tcases[i] t.Run(fmt.Sprintf("tc %d", i), func(t *testing.T) { t.Parallel() req := test.MakeSimpleRequest("GET", "http://1.2.3.4/api/internal/v1/devauth/tenant/"+ tc.tenantId+ "/limits/"+ tc.limit, nil) da := &mocks.App{} da.On("GetTenantLimit", mtest.ContextMatcher(), tc.limit, tc.tenantId). Return(tc.daLimit, tc.daErr) apih := makeMockApiHandler(t, da, nil) runTestRequest(t, apih, req, tc.code, tc.body) }) } }
explode_data.jsonl/639
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 657 }
[ 2830, 3393, 6563, 14592, 5087, 1949, 71252, 16527, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 28162, 3151, 2070, 34948, 304, 5975, 5927, 553, 5333, 198, 27175, 12416, 1454, 51241, 2822, 3244, 23910, 1669, 3056, 1235,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFiles(t *testing.T) { dir := filepath.Join("testdata", "files") // Keep this synced with testdata/files directory. exp := []string{ // dot.md is excluded. filepath.Join(dir, "jack.txt"), filepath.Join(dir, "phryne", "fisher.txt"), } ret, err := fileutil.Files(dir, ".txt") if err != nil { t.Error(err) } if !reflect.DeepEqual(exp, ret) { t.Errorf("expected %s, but returned %s", exp, ret) } }
explode_data.jsonl/16284
{ "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, 10809, 1155, 353, 8840, 836, 8, 341, 48532, 1669, 26054, 22363, 445, 92425, 497, 330, 7198, 5130, 197, 322, 13655, 419, 85028, 448, 1273, 691, 33220, 6220, 624, 48558, 1669, 3056, 917, 515, 197, 197, 322, 12756, 21324, 374, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAssessMetricStatusCountReached(t *testing.T) { count := intstr.FromInt(10) metric := v1alpha1.Metric{ Name: "success-rate", Count: &count, } result := v1alpha1.MetricResult{ Successful: 10, Count: 10, Measurements: []v1alpha1.Measurement{{ Value: "99", Phase: v1alpha1.AnalysisPhaseSuccessful, StartedAt: timePtr(metav1.NewTime(time.Now().Add(-60 * time.Second))), FinishedAt: timePtr(metav1.NewTime(time.Now().Add(-60 * time.Second))), }}, } assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, assessMetricStatus(metric, result, false)) result.Successful = 5 result.Inconclusive = 5 assert.Equal(t, v1alpha1.AnalysisPhaseInconclusive, assessMetricStatus(metric, result, false)) }
explode_data.jsonl/75821
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 301 }
[ 2830, 3393, 5615, 433, 54310, 2522, 2507, 98526, 1155, 353, 8840, 836, 8, 341, 18032, 1669, 526, 495, 11439, 1072, 7, 16, 15, 340, 2109, 16340, 1669, 348, 16, 7141, 16, 1321, 16340, 515, 197, 21297, 25, 220, 330, 5630, 43026, 756, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestToBoolOrDefault(t *testing.T) { type args struct { s string d bool } tests := []struct { name string args args want bool }{ { name: "", args: args{ s: "true", d: false, }, want: true, }, { name: "", args: args{ s: "21a", d: true, }, want: true, }, { name: "", args: args{ s: "", d: true, }, want: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := ToBoolOrDefault(tt.args.s, tt.args.d); got != tt.want { t.Errorf("ToBoolOrDefault() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/5487
{ "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, 1249, 11233, 14188, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 914, 198, 197, 2698, 1807, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 1807, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_MsgDryRun(t *testing.T) { tutils.CheckSkip(t, tutils.SkipTestArgs{Long: true}) t.Setenv("AIS_STREAM_DRY_RUN", "true") // fill in common shared read-only bug random := newRand(mono.NanoTime()) buf, slab := memsys.PageMM().AllocSize(cos.MiB) defer slab.Free(buf) random.Read(buf) wg := &sync.WaitGroup{} num := atomic.NewInt64(0) for i := 0; i < 10; i++ { wg.Add(1) go func(idx int) { defer wg.Done() myrand := newRand(int64(idx * idx)) tsize, prevsize, off := int64(0), int64(0), 0 total := int64(cos.GiB * 4) if testing.Short() { total = cos.GiB } stream := transport.NewMsgStream(nil, "dry-msg"+strconv.Itoa(idx), cos.GenTie()) for tsize < total { msize := myrand.Intn(memsys.PageSize - 64) // <= s.maxheader, zero-length OK if off+msize > len(buf) { off = 0 } msg := &transport.Msg{Body: buf[off : off+msize]} off += msize err := stream.Send(msg) tassert.CheckFatal(t, err) num.Inc() tsize += int64(msize) if tsize-prevsize > total/2 { prevsize = tsize tlog.Logf("%s: %s\n", stream, cos.B2S(tsize, 0)) } } stream.Fin() }(i) } wg.Wait() tlog.Logf("total messages: %d\n", num.Load()) }
explode_data.jsonl/157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 589 }
[ 2830, 3393, 90653, 85215, 6727, 1155, 353, 8840, 836, 8, 341, 3244, 6031, 10600, 35134, 1155, 11, 259, 6031, 57776, 2271, 4117, 90, 6583, 25, 830, 3518, 3244, 4202, 3160, 445, 32, 1637, 23584, 1557, 11242, 24068, 497, 330, 1866, 5130, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrivateLinkHubID(t *testing.T) { cases := []struct { Input string Valid bool }{ { // empty Input: "", Valid: false, }, { // missing SubscriptionId Input: "/", Valid: false, }, { // missing value for SubscriptionId Input: "/subscriptions/", Valid: false, }, { // missing ResourceGroup Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", Valid: false, }, { // missing value for ResourceGroup Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", Valid: false, }, { // missing Name Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Synapse/", Valid: false, }, { // missing value for Name Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Synapse/privateLinkHubs/", Valid: false, }, { // valid Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Synapse/privateLinkHubs/privateLinkHub1", Valid: true, }, { // upper-cased Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.SYNAPSE/PRIVATELINKHUBS/PRIVATELINKHUB1", Valid: false, }, } for _, tc := range cases { t.Logf("[DEBUG] Testing Value %s", tc.Input) _, errors := PrivateLinkHubID(tc.Input, "test") valid := len(errors) == 0 if tc.Valid != valid { t.Fatalf("Expected %t but got %t", tc.Valid, valid) } } }
explode_data.jsonl/2954
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 683 }
[ 2830, 3393, 16787, 3939, 19316, 915, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 66588, 914, 198, 197, 197, 4088, 1807, 198, 197, 92, 4257, 197, 197, 515, 298, 197, 322, 4287, 198, 298, 66588, 25, 8324, 298...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSeekEmptyIndex(t *testing.T) { dir, err := ioutil.TempDir("", "testdb") if err != nil { t.Fatal(err) } filePathPrefix := filepath.Join(dir, "") defer os.RemoveAll(dir) w := newTestWriter(t, filePathPrefix) writerOpts := DataWriterOpenOptions{ BlockSize: testBlockSize, Identifier: FileSetFileIdentifier{ Namespace: testNs1ID, Shard: 0, BlockStart: testWriterStart, }, } err = w.Open(writerOpts) assert.NoError(t, err) assert.NoError(t, w.Close()) resources := newTestReusableSeekerResources() s := newTestSeeker(filePathPrefix) err = s.Open(testNs1ID, 0, testWriterStart, 0, resources) assert.NoError(t, err) _, err = s.SeekByID(ident.StringID("foo"), resources) assert.Error(t, err) assert.Equal(t, errSeekIDNotFound, err) assert.NoError(t, s.Close()) }
explode_data.jsonl/10713
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 333 }
[ 2830, 3393, 39350, 3522, 1552, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 1944, 1999, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 17661, 1820, 14335, 1669, 26054, 223...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestJsReturnStringWithEmbeddedNulls(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() res, err := ctx.Eval(`"foo\000bar"`, "test.js") if err != nil { t.Fatalf("Error evaluating javascript, err: %v", err) } if str := res.String(); str != "foo\000bar" { t.Errorf("Expected 'foo\\000bar', got %q", str) } }
explode_data.jsonl/81544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 30480, 5598, 703, 2354, 83466, 3280, 82, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 741, 10202, 11, 1848, 1669, 5635, 5142, 831, 5809, 1, 7975, 59, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSugarAddCaller(t *testing.T) { tests := []struct { options []Option pat string }{ {opts(AddCaller()), `.+/sugar_test.go:[\d]+$`}, {opts(AddCaller(), AddCallerSkip(1), AddCallerSkip(-1)), `.+/zap/sugar_test.go:[\d]+$`}, {opts(AddCaller(), AddCallerSkip(1)), `.+/zap/common_test.go:[\d]+$`}, {opts(AddCaller(), AddCallerSkip(1), AddCallerSkip(5)), `.+/src/runtime/.*:[\d]+$`}, } for _, tt := range tests { withSugar(t, DebugLevel, tt.options, func(logger *SugaredLogger, logs *observer.ObservedLogs) { logger.Info("") output := logs.AllUntimed() assert.Equal(t, 1, len(output), "Unexpected number of logs written out.") assert.Regexp( t, tt.pat, output[0].Entry.Caller, "Expected to find package name and file name in output.", ) }) } }
explode_data.jsonl/5028
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 83414, 2212, 58735, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 35500, 3056, 5341, 198, 197, 3223, 266, 257, 914, 198, 197, 59403, 197, 197, 90, 10518, 7, 2212, 58735, 11858, 74090, 40631, 82, 8566, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAttrsAppendErrorHTTP(t *testing.T) { c := setupTest([]string{"append", "attrs", "--host", "orion", "--id", "urn:ngsi-ld:Product:010", "--data", "{\"specialOffer\":{\"value\": true}}"}) reqRes := helper.MockHTTPReqRes{} reqRes.Res.StatusCode = http.StatusNoContent reqRes.Path = "/v2/entities/urn:ngsi-ld:Product:010/attrs" reqRes.Err = errors.New("http error") helper.SetClientHTTP(c, reqRes) err := attrsAppend(c, c.Ngsi, c.Client) if assert.Error(t, err) { ngsiErr := err.(*ngsierr.NgsiError) assert.Equal(t, 4, ngsiErr.ErrNo) assert.Equal(t, "http error", ngsiErr.Message) } }
explode_data.jsonl/33069
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 53671, 23877, 1454, 9230, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 6505, 2271, 10556, 917, 4913, 5090, 497, 330, 20468, 497, 14482, 3790, 497, 330, 269, 290, 497, 14482, 307, 497, 330, 399, 25, 968, 6321, 12, 507, 25, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStartupAndShutdown(t *testing.T) { opts := DefaultOptions() s := RunServer(opts) defer s.Shutdown() if !s.isRunning() { t.Fatal("Could not run server") } // Debug stuff. numRoutes := s.NumRoutes() if numRoutes != 0 { t.Fatalf("Expected numRoutes to be 0 vs %d\n", numRoutes) } numRemotes := s.NumRemotes() if numRemotes != 0 { t.Fatalf("Expected numRemotes to be 0 vs %d\n", numRemotes) } numClients := s.NumClients() if numClients != 0 && numClients != 1 { t.Fatalf("Expected numClients to be 1 or 0 vs %d\n", numClients) } numSubscriptions := s.NumSubscriptions() if numSubscriptions != 0 { t.Fatalf("Expected numSubscriptions to be 0 vs %d\n", numSubscriptions) } }
explode_data.jsonl/3598
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 39076, 3036, 62004, 1155, 353, 8840, 836, 8, 1476, 64734, 1669, 7899, 3798, 2822, 1903, 1669, 6452, 5475, 30885, 340, 16867, 274, 10849, 18452, 2822, 743, 753, 82, 2079, 18990, 368, 341, 197, 3244, 26133, 445, 12895, 537, 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...
7
func TestLs_JSON(t *testing.T) { assert := assert.New(t) ls := &subcmd.LsCmd{ Path: "foo/bar/", Json: true, Page: 1, Recursive: true, } driver := NewMockDriver(t) printer := &MockPrinterImpl{} driver.MockListOrTagSearch = func(path string, postNum int, recursive bool) ([]*model.Post, bool, error) { assert.Equal("foo/bar/", path) assert.Equal(1, postNum) assert.True(recursive) return []*model.Post{ { Name: "zoo", Wip: true, Tags: []string{"tagA", "tagB"}, Category: "foo/bar", }, { Name: "baz", Wip: false, Tags: []string{"tagB"}, Category: "foo/bar", }, }, true, nil } err := ls.Run(&kasa.Context{ Driver: driver, Fmt: printer, }) assert.NoError(err) assert.Equal(`{"number":0,"name":"zoo","wip":true,"created_at":"0001-01-01T00:00:00Z","message":"","url":"","updated_at":"0001-01-01T00:00:00Z","tags":["tagA","tagB"],"category":"foo/bar","revision_number":0} {"number":0,"name":"baz","wip":false,"created_at":"0001-01-01T00:00:00Z","message":"","url":"","updated_at":"0001-01-01T00:00:00Z","tags":["tagB"],"category":"foo/bar","revision_number":0} `, printer.String()) }
explode_data.jsonl/28553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 552 }
[ 2830, 3393, 43, 82, 25356, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 197, 4730, 1669, 609, 1966, 8710, 1214, 82, 15613, 515, 197, 69640, 25, 414, 330, 7975, 49513, 35075, 197, 86687, 25, 414, 830, 345, 197, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDecoderRaw(t *testing.T) { source := "AAAAAA" want := []byte{0, 0, 0, 0} // Direct. dec1, err := RawURLEncoding.DecodeString(source) if err != nil || !bytes.Equal(dec1, want) { t.Errorf("RawURLEncoding.DecodeString(%q) = %x, %v, want %x, nil", source, dec1, err, want) } // Through reader. Used to fail. r := NewDecoder(RawURLEncoding, bytes.NewReader([]byte(source))) dec2, err := ioutil.ReadAll(io.LimitReader(r, 100)) if err != nil || !bytes.Equal(dec2, want) { t.Errorf("reading NewDecoder(RawURLEncoding, %q) = %x, %v, want %x, nil", source, dec2, err, want) } // Should work with padding. r = NewDecoder(URLEncoding, bytes.NewReader([]byte(source+"=="))) dec3, err := ioutil.ReadAll(r) if err != nil || !bytes.Equal(dec3, want) { t.Errorf("reading NewDecoder(URLEncoding, %q) = %x, %v, want %x, nil", source+"==", dec3, err, want) } }
explode_data.jsonl/35064
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 369 }
[ 2830, 3393, 20732, 20015, 1155, 353, 8840, 836, 8, 341, 47418, 1669, 330, 25699, 6029, 698, 50780, 1669, 3056, 3782, 90, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 630, 197, 322, 7139, 624, 197, 8169, 16, 11, 1848, 1669, 23022, 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...
7
func TestHTTPPostInvalidParameter(t *testing.T) { sender := NewHTTPSender("", "", false) // Channels are not marshalable to JSON and generate an error data := make(chan int) continuePipeline, result := sender.HTTPPost(context, data) assert.False(t, continuePipeline, "Pipeline should stop") assert.Error(t, result.(error), "Result should be an error") assert.Equal(t, "marshaling input data to JSON failed, "+ "passed in data must be of type []byte, string, or support marshaling to JSON", result.(error).Error()) }
explode_data.jsonl/75581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 9230, 4133, 7928, 4971, 1155, 353, 8840, 836, 8, 1476, 1903, 1659, 1669, 1532, 9230, 20381, 19814, 7342, 895, 340, 197, 322, 62900, 525, 537, 60771, 480, 311, 4718, 323, 6923, 458, 1465, 198, 8924, 1669, 1281, 35190, 526, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateAppOK(t *testing.T) { testServer(func(s *core.Server) { headers := make(map[string]string) headers["X-Access-Token"] = accessToken url := "/api/v1/developers/apps/" + apiToken //make request res, err := testHTTPRequestWithHeaders("PUT", url, `{"name":"traverik alpha","os":"iOS"}`, headers) if err != nil { t.Fatalf("unable to update: %v , %v", url, err) } else { body, _ := ioutil.ReadAll(res.Body) if res.StatusCode != 200 { t.Fatalf("unable to update: %v , %v", url, string(body)) } //fmt.Printf("update response: %v ", string(body)) } }) }
explode_data.jsonl/42215
{ "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, 4289, 2164, 3925, 1155, 353, 8840, 836, 8, 1476, 18185, 5475, 18552, 1141, 353, 2153, 22997, 8, 1476, 197, 67378, 1669, 1281, 9147, 14032, 30953, 340, 197, 67378, 1183, 55, 12, 6054, 89022, 1341, 284, 37725, 271, 197, 19320,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNodeNumberCalculation(t *testing.T) { var nodesUptoTests = []struct { n uint64 expected uint64 }{ {1, 1}, {2, 3}, {3, 5}, {4, 8}, {5, 10}, {6, 13}, {7, 16}, {8, 20}, {9, 22}, {10, 25}, {11, 28}, {12, 32}, {13, 35}, {14, 39}, {15, 43}, {16, 48}, } for _, tt := range nodesUptoTests { actual := nodesUpto(tt.n) require.Equal(t, tt.expected, actual) require.Equal(t, tt.expected, nodesUntil(tt.n)+uint64(levelsAt(tt.n))+1) } }
explode_data.jsonl/49657
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 1955, 2833, 47168, 2914, 1155, 353, 8840, 836, 8, 341, 2405, 7798, 52, 57991, 18200, 284, 3056, 1235, 341, 197, 9038, 286, 2622, 21, 19, 198, 197, 42400, 2622, 21, 19, 198, 197, 59403, 197, 197, 90, 16, 11, 220, 16, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStruct_Nil(t *testing.T) { err := Scrub(nil, []string{}) assert.Error(t, err) var testItem *Person err = Scrub(testItem, []string{"test"}) assert.Error(t, err) err = Scrub(&testItem, []string{"test"}) assert.Error(t, err) }
explode_data.jsonl/9421
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 9422, 1604, 321, 1155, 353, 8840, 836, 8, 1476, 9859, 1669, 32134, 392, 27907, 11, 3056, 917, 37790, 6948, 6141, 1155, 11, 1848, 340, 2405, 1273, 1234, 353, 10680, 198, 9859, 284, 32134, 392, 8623, 1234, 11, 3056, 917, 491...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPreferredAffinityWithHardPodAffinitySymmetricWeight(t *testing.T) { podLabelServiceS1 := map[string]string{ "service": "S1", } labelRgChina := map[string]string{ "region": "China", } labelRgIndia := map[string]string{ "region": "India", } labelAzAz1 := map[string]string{ "az": "az1", } hardPodAffinity := &v1.Affinity{ PodAffinity: &v1.PodAffinity{ RequiredDuringSchedulingIgnoredDuringExecution: []v1.PodAffinityTerm{ { LabelSelector: &metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ { Key: "service", Operator: metav1.LabelSelectorOpIn, Values: []string{"S1"}, }, }, }, Namespaces: []string{"", "subteam2.team2"}, NamespaceSelector: &metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ { Key: "team", Operator: metav1.LabelSelectorOpIn, Values: []string{"team1"}, }, }, }, TopologyKey: "region", }, }, }, } tests := []struct { pod *v1.Pod pods []*v1.Pod nodes []*v1.Node hardPodAffinityWeight int32 expectedList framework.NodeScoreList name string disableNSSelector bool }{ { name: "with default weight", pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Labels: podLabelServiceS1}}, pods: []*v1.Pod{ {Spec: v1.PodSpec{NodeName: "machine1", Affinity: hardPodAffinity}}, {Spec: v1.PodSpec{NodeName: "machine2", Affinity: hardPodAffinity}}, }, nodes: []*v1.Node{ {ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelRgChina}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}}, }, hardPodAffinityWeight: v1.DefaultHardPodAffinitySymmetricWeight, expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}}, }, { name: "with zero weight", pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Labels: podLabelServiceS1}}, pods: []*v1.Pod{ {Spec: v1.PodSpec{NodeName: "machine1", Affinity: hardPodAffinity}}, {Spec: v1.PodSpec{NodeName: "machine2", Affinity: hardPodAffinity}}, }, nodes: []*v1.Node{ {ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelRgChina}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}}, }, hardPodAffinityWeight: 0, expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: 0}}, }, { name: "with no matching namespace", pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: "subteam1.team2", Labels: podLabelServiceS1}}, pods: []*v1.Pod{ {Spec: v1.PodSpec{NodeName: "machine1", Affinity: hardPodAffinity}}, {Spec: v1.PodSpec{NodeName: "machine2", Affinity: hardPodAffinity}}, }, nodes: []*v1.Node{ {ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelRgChina}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}}, }, hardPodAffinityWeight: v1.DefaultHardPodAffinitySymmetricWeight, expectedList: []framework.NodeScore{{Name: "machine1", Score: 0}, {Name: "machine2", Score: 0}, {Name: "machine3", Score: 0}}, }, { name: "with matching NamespaceSelector", pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: "subteam1.team1", Labels: podLabelServiceS1}}, pods: []*v1.Pod{ {Spec: v1.PodSpec{NodeName: "machine1", Affinity: hardPodAffinity}}, {Spec: v1.PodSpec{NodeName: "machine2", Affinity: hardPodAffinity}}, }, nodes: []*v1.Node{ {ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelRgChina}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}}, }, hardPodAffinityWeight: v1.DefaultHardPodAffinitySymmetricWeight, expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}}, }, { name: "with matching Namespaces", pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: "subteam2.team2", Labels: podLabelServiceS1}}, pods: []*v1.Pod{ {Spec: v1.PodSpec{NodeName: "machine1", Affinity: hardPodAffinity}}, {Spec: v1.PodSpec{NodeName: "machine2", Affinity: hardPodAffinity}}, }, nodes: []*v1.Node{ {ObjectMeta: metav1.ObjectMeta{Name: "machine1", Labels: labelRgChina}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine2", Labels: labelRgIndia}}, {ObjectMeta: metav1.ObjectMeta{Name: "machine3", Labels: labelAzAz1}}, }, hardPodAffinityWeight: v1.DefaultHardPodAffinitySymmetricWeight, expectedList: []framework.NodeScore{{Name: "machine1", Score: framework.MaxNodeScore}, {Name: "machine2", Score: framework.MaxNodeScore}, {Name: "machine3", Score: 0}}, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() state := framework.NewCycleState() fts := feature.Features{EnablePodAffinityNamespaceSelector: !test.disableNSSelector} p := plugintesting.SetupPluginWithInformers(ctx, t, frameworkruntime.FactoryAdapter(fts, New), &config.InterPodAffinityArgs{HardPodAffinityWeight: test.hardPodAffinityWeight}, cache.NewSnapshot(test.pods, test.nodes), namespaces) status := p.(framework.PreScorePlugin).PreScore(ctx, state, test.pod, test.nodes) if !status.IsSuccess() { t.Errorf("unexpected error: %v", status) } var gotList framework.NodeScoreList for _, n := range test.nodes { nodeName := n.ObjectMeta.Name score, status := p.(framework.ScorePlugin).Score(ctx, state, test.pod, nodeName) if !status.IsSuccess() { t.Errorf("unexpected error: %v", status) } gotList = append(gotList, framework.NodeScore{Name: nodeName, Score: score}) } status = p.(framework.ScorePlugin).ScoreExtensions().NormalizeScore(ctx, state, test.pod, gotList) if !status.IsSuccess() { t.Errorf("unexpected error: %v", status) } if !reflect.DeepEqual(test.expectedList, gotList) { t.Errorf("expected:\n\t%+v,\ngot:\n\t%+v", test.expectedList, gotList) } }) } }
explode_data.jsonl/74457
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2837 }
[ 2830, 3393, 22482, 25841, 13489, 2354, 26907, 23527, 25841, 13489, 27912, 15903, 8295, 1155, 353, 8840, 836, 8, 341, 3223, 347, 2476, 1860, 50, 16, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 7936, 788, 330, 50, 16, 756, 197, 532, 292...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOutOfRegionRangeEvent(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} ch1 := make(chan *cdcpb.ChangeDataEvent, 10) srv1 := newMockChangeDataService(t, ch1) server1, addr1 := newMockService(ctx, t, srv1, wg) defer func() { close(ch1) server1.Stop() wg.Wait() }() rpcClient, cluster, pdClient, err := testutils.NewMockTiKV("", mockcopr.NewCoprRPCHandler()) require.Nil(t, err) pdClient = &mockPDClient{Client: pdClient, versionGen: defaultVersionGen} kvStorage, err := tikv.NewTestTiKVStore(rpcClient, pdClient, nil, nil, 0) require.Nil(t, err) defer kvStorage.Close() //nolint:errcheck cluster.AddStore(1, addr1) cluster.Bootstrap(3, []uint64{1}, []uint64{4}, 4) baseAllocatedID := currentRequestID() lockResolver := txnutil.NewLockerResolver(kvStorage, model.DefaultChangeFeedID("changefeed-test"), util.RoleTester) isPullInit := &mockPullerInit{} grpcPool := NewGrpcPoolImpl(ctx, &security.Credential{}) defer grpcPool.Close() regionCache := tikv.NewRegionCache(pdClient) defer regionCache.Close() cdcClient := NewCDCClient( ctx, pdClient, grpcPool, regionCache, pdutil.NewClock4Test(), model.DefaultChangeFeedID(""), config.GetDefaultServerConfig().KVClient) eventCh := make(chan model.RegionFeedEvent, 50) wg.Add(1) go func() { defer wg.Done() err := cdcClient.EventFeed(ctx, regionspan.ComparableSpan{Start: []byte("a"), End: []byte("b")}, 100, lockResolver, isPullInit, eventCh) require.Equal(t, context.Canceled, errors.Cause(err)) }() // wait request id allocated with: new session, new request waitRequestID(t, baseAllocatedID+1) eventsBeforeInit := &cdcpb.ChangeDataEvent{Events: []*cdcpb.Event{ // will be filtered out { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Entries_{ Entries: &cdcpb.Event_Entries{ Entries: []*cdcpb.Event_Row{{ Type: cdcpb.Event_COMMITTED, OpType: cdcpb.Event_Row_PUT, Key: []byte("ccc"), Value: []byte("key out of region range"), StartTs: 105, CommitTs: 115, }}, }, }, }, { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Entries_{ Entries: &cdcpb.Event_Entries{ Entries: []*cdcpb.Event_Row{{ Type: cdcpb.Event_COMMITTED, OpType: cdcpb.Event_Row_PUT, Key: []byte("aaaa"), Value: []byte("committed put event before init"), StartTs: 105, CommitTs: 115, }}, }, }, }, }} initialized := mockInitializedEvent(3 /*regionID */, currentRequestID()) eventsAfterInit := &cdcpb.ChangeDataEvent{Events: []*cdcpb.Event{ // will be filtered out { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Entries_{ Entries: &cdcpb.Event_Entries{ Entries: []*cdcpb.Event_Row{{ Type: cdcpb.Event_PREWRITE, OpType: cdcpb.Event_Row_PUT, Key: []byte("cccd"), Value: []byte("key out of region range"), StartTs: 135, }}, }, }, }, // will be filtered out { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Entries_{ Entries: &cdcpb.Event_Entries{ Entries: []*cdcpb.Event_Row{{ Type: cdcpb.Event_COMMIT, OpType: cdcpb.Event_Row_PUT, Key: []byte("cccd"), StartTs: 135, CommitTs: 145, }}, }, }, }, { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Entries_{ Entries: &cdcpb.Event_Entries{ Entries: []*cdcpb.Event_Row{{ Type: cdcpb.Event_PREWRITE, OpType: cdcpb.Event_Row_PUT, Key: []byte("a-normal-put"), Value: []byte("normal put event"), StartTs: 135, }}, }, }, }, { RegionId: 3, RequestId: currentRequestID(), Event: &cdcpb.Event_Entries_{ Entries: &cdcpb.Event_Entries{ Entries: []*cdcpb.Event_Row{{ Type: cdcpb.Event_COMMIT, OpType: cdcpb.Event_Row_PUT, Key: []byte("a-normal-put"), StartTs: 135, CommitTs: 145, }}, }, }, }, }} // batch resolved ts eventResolvedBatch := &cdcpb.ChangeDataEvent{ ResolvedTs: &cdcpb.ResolvedTs{ Regions: []uint64{3}, Ts: 145, }, } expected := []model.RegionFeedEvent{ { Resolved: &model.ResolvedSpan{ Span: regionspan.ComparableSpan{Start: []byte("a"), End: []byte("b")}, ResolvedTs: 100, }, RegionID: 3, }, { Val: &model.RawKVEntry{ OpType: model.OpTypePut, Key: []byte("aaaa"), Value: []byte("committed put event before init"), StartTs: 105, CRTs: 115, RegionID: 3, }, RegionID: 3, }, { Val: &model.RawKVEntry{ OpType: model.OpTypePut, Key: []byte("a-normal-put"), Value: []byte("normal put event"), StartTs: 135, CRTs: 145, RegionID: 3, }, RegionID: 3, }, { Resolved: &model.ResolvedSpan{ Span: regionspan.ComparableSpan{Start: []byte("a"), End: []byte("b")}, ResolvedTs: 145, }, RegionID: 3, }, } ch1 <- eventsBeforeInit ch1 <- initialized ch1 <- eventsAfterInit ch1 <- eventResolvedBatch for _, expectedEv := range expected { select { case event := <-eventCh: require.Equal(t, expectedEv, event) case <-time.After(time.Second): require.Fail(t, fmt.Sprintf("expected event %v not received", expectedEv)) } } cancel() }
explode_data.jsonl/32879
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2585 }
[ 2830, 3393, 31731, 14091, 6046, 1556, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 72079, 1669, 609, 12996, 28384, 2808, 31483, 23049, 16, 1669, 1281, 35190, 353, 4385, 4672, 65, 39348, 1043, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRollupNewRollupFuncError(t *testing.T) { if nrf := getRollupFunc("non-existing-func"); nrf != nil { t.Fatalf("expecting nil func; got %p", nrf) } f := func(funcName string, args []interface{}) { t.Helper() nrf := getRollupFunc(funcName) rf, err := nrf(args) if err == nil { t.Fatalf("expecting non-nil error") } if rf != nil { t.Fatalf("expecting nil rf; got %p", rf) } } // Invalid number of args f("default_rollup", nil) f("holt_winters", nil) f("predict_linear", nil) f("quantile_over_time", nil) // Invalid arg type scalarTs := []*timeseries{{ Values: []float64{321}, Timestamps: []int64{123}, }} me := &metricsql.MetricExpr{} f("holt_winters", []interface{}{123, 123, 321}) f("holt_winters", []interface{}{me, 123, 321}) f("holt_winters", []interface{}{me, scalarTs, 321}) f("predict_linear", []interface{}{123, 123}) f("predict_linear", []interface{}{me, 123}) f("quantile_over_time", []interface{}{123, 123}) }
explode_data.jsonl/23118
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 32355, 454, 3564, 32355, 454, 9626, 1454, 1155, 353, 8840, 836, 8, 341, 743, 308, 8052, 1669, 633, 32355, 454, 9626, 445, 6280, 49357, 2220, 1347, 5038, 308, 8052, 961, 2092, 341, 197, 3244, 30762, 445, 17119, 287, 2092, 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...
3
func Test_DeployHandler_Execution_Works(t *testing.T) { release := MockRelease() awsc := MockAwsClients(release) state_machine := createTestStateMachine(t, awsc) exec, err := state_machine.Execute(release) output := exec.Output assert.NoError(t, err) assert.Equal(t, output["success"], true) assert.NotRegexp(t, "error", exec.LastOutputJSON) assertNoRootLockWithReleseLock(t, awsc, release) assert.Equal(t, []string{ "Validate", "Lock", "ValidateResources", "Deploy", "Success", }, exec.Path()) t.Run("root lock acquired in dynamodb", func(t *testing.T) { assert.Equal(t, 1, len(awsc.DynamoDB.PutItemInputs)) assert.Contains(t, awsc.DynamoDB.PutItemInputs[0].Item["key"].String(), "00000000/project/development/lock") assert.Equal(t, "lock-locks", *awsc.DynamoDB.PutItemInputs[0].TableName) }) t.Run("root lock released in dynamodb", func(t *testing.T) { assert.Equal(t, 1, len(awsc.DynamoDB.DeleteItemInputs)) assert.Contains(t, awsc.DynamoDB.DeleteItemInputs[0].Key["key"].String(), "00000000/project/development/lock") assert.Equal(t, "lock-locks", *awsc.DynamoDB.PutItemInputs[0].TableName) }) }
explode_data.jsonl/62288
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 450 }
[ 2830, 3393, 90680, 1989, 3050, 62, 20294, 2763, 73302, 1155, 353, 8840, 836, 8, 341, 17200, 1623, 1669, 14563, 16077, 741, 197, 672, 2388, 1669, 14563, 47359, 47174, 5801, 1623, 340, 24291, 38695, 1669, 1855, 2271, 94666, 1155, 11, 1360, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNullsTruncate(t *testing.T) { for _, size := range pos { n := NewNulls(BatchSize) n.Truncate(uint16(size)) for i := uint16(0); i < BatchSize; i++ { expected := uint64(i) >= size require.Equal(t, expected, n.NullAt(i), "NullAt(%d) should be %t after Truncate(%d)", i, expected, size) } } }
explode_data.jsonl/37156
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 3280, 82, 1282, 26900, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1379, 1669, 2088, 1133, 341, 197, 9038, 1669, 1532, 3280, 82, 5349, 754, 1695, 340, 197, 9038, 8240, 26900, 8488, 16, 21, 6856, 1171, 197, 2023, 600, 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...
3
func TestCreateImage(t *testing.T) { const ( sizeX = 16 sizeY = 8 ) imgHexData := "89504e470d0a1a0a0000000d49484452000000100000000808020000007f14e8c00000001a49444154789c62e9e3f9c4400a602249f5a8062201200000ffff6d62019f6525f13f0000000049454e44ae426082" if _, err := CreateImage(refClr, 0, sizeY); err == nil { t.Error("no error when sizeX = 0") } if _, err := CreateImage(refClr, sizeX, 0); err == nil { t.Error("no error when sizeY = 0") } buff, err := CreateImage(refClr, sizeX, sizeY) if err != nil { t.Error(err) } if d := fmt.Sprintf("%x", buff.Bytes()); d != imgHexData { t.Errorf( "wrong image data:\n"+ "was: %s\n"+ "must: %s\n", d, imgHexData) } }
explode_data.jsonl/37827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 4021, 1906, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 13832, 55, 284, 220, 16, 21, 198, 197, 13832, 56, 284, 220, 23, 198, 197, 692, 39162, 20335, 1043, 1669, 330, 23, 24, 20, 15, 19, 68, 19, 22, 15, 67, 15, 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...
5
func TestRequest(t *testing.T) { LastRequest = time.Time{} SetRequestMutex(true) RequestData() if time.Since(LastRequest).Seconds() < 1 { t.Error("Should have not updated the time") } SetRequestMutex(false) RequestData() if time.Since(LastRequest).Seconds() > 1 { t.Error("Should have updated the time") } RequestData() }
explode_data.jsonl/66529
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 1900, 1155, 353, 8840, 836, 8, 341, 197, 5842, 1900, 284, 882, 16299, 31483, 22212, 1900, 38099, 3715, 340, 73806, 1043, 741, 743, 882, 93404, 4957, 559, 1900, 568, 15343, 368, 366, 220, 16, 341, 197, 3244, 6141, 445, 1499...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFixedSlice(t *testing.T) { { var v, r []int v = []int{-1, 1} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []uint v = []uint{0, 100} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []int8 v = []int8{math.MinInt8, math.MaxInt8} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []int16 v = []int16{math.MinInt16, math.MaxInt16} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []int32 v = []int32{math.MinInt32, math.MaxInt32} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []int64 v = []int64{math.MinInt64, math.MaxInt64} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { // byte array var v, r []uint8 v = []uint8{0, math.MaxUint8} if err := encdec(v, &r, func(code byte) bool { return def.Bin8 == code }); err != nil { t.Error(err) } } { var v, r []uint16 v = []uint16{0, math.MaxUint16} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []uint32 v = []uint32{0, math.MaxUint32} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []uint64 v = []uint64{0, math.MaxUint64} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []float32 v = []float32{math.SmallestNonzeroFloat32, math.MaxFloat32} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []float64 v = []float64{math.SmallestNonzeroFloat64, math.MaxFloat64} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []string v = []string{"aaa", "bbb"} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } { var v, r []bool v = []bool{true, false} if err := encdec(v, &r, func(code byte) bool { return def.FixArray <= code && code <= def.FixArray+0x0f }); err != nil { t.Error(err) } } }
explode_data.jsonl/64216
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1411 }
[ 2830, 3393, 13520, 33236, 1155, 353, 8840, 836, 8, 341, 197, 515, 197, 2405, 348, 11, 435, 3056, 396, 198, 197, 5195, 284, 3056, 396, 19999, 16, 11, 220, 16, 532, 197, 743, 1848, 1669, 3209, 8169, 3747, 11, 609, 81, 11, 2915, 1584...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrepare_MissingSchemaPrepare(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() s := createSession(t) conn := getRandomConn(t, s) defer s.Close() insertQry := s.Query("INSERT INTO invalidschemaprep (val) VALUES (?)", 5) if err := conn.executeQuery(ctx, insertQry).err; err == nil { t.Fatal("expected error, but got nil.") } if err := createTable(s, "CREATE TABLE gocql_test.invalidschemaprep (val int, PRIMARY KEY (val))"); err != nil { t.Fatal("create table:", err) } if err := conn.executeQuery(ctx, insertQry).err; err != nil { t.Fatal(err) // unconfigured columnfamily } }
explode_data.jsonl/11157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 50590, 1245, 13577, 8632, 50590, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 2822, 1903, 1669, 1855, 5283, 1155, 340, 32917, 1669, 52436, 9701, 1155, 11, 274, 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...
4
func TestGetProduct(t *testing.T) { t.Parallel() migration := sqltest.New(t, sqltest.Options{ Force: *force, Path: "../../migrations", }) pool := migration.Setup(context.Background(), "") db := &DB{ Postgres: pool, } createProducts(t, db, []inventory.CreateProductParams{ { ID: "product", Name: "A product name", Description: "A great description", Price: 10000, }, }) type args struct { ctx context.Context id string } tests := []struct { name string args args want *inventory.Product wantErr string }{ { name: "product", args: args{ ctx: context.Background(), id: "product", }, want: &inventory.Product{ ID: "product", Name: "A product name", Description: "A great description", Price: 10000, CreatedAt: time.Now(), ModifiedAt: time.Now(), }, }, { name: "not_found", args: args{ ctx: context.Background(), id: "not_found", }, want: nil, }, { name: "canceled_ctx", args: args{ ctx: canceledContext(), }, wantErr: "context canceled", }, { name: "deadline_exceeded_ctx", args: args{ ctx: deadlineExceededContext(), }, wantErr: "context deadline exceeded", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := db.GetProduct(tt.args.ctx, tt.args.id) if err == nil && tt.wantErr != "" || err != nil && tt.wantErr != err.Error() { t.Errorf("DB.GetProduct() error = %v, wantErr %v", err, tt.wantErr) } if err != nil { return } if !cmp.Equal(tt.want, got, cmpopts.EquateApproxTime(time.Minute)) { t.Errorf("value returned by DB.GetProduct() doesn't match: %v", cmp.Diff(tt.want, got)) } }) } }
explode_data.jsonl/25451
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 831 }
[ 2830, 3393, 1949, 4816, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2109, 5033, 1669, 5704, 1944, 7121, 1155, 11, 5704, 1944, 22179, 515, 197, 197, 18573, 25, 353, 8833, 345, 197, 69640, 25, 220, 10208, 76, 17824, 756, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestSleepWithContext(t *testing.T) { ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})} err := aws.SleepWithContext(ctx, 1*time.Millisecond) if err != nil { t.Errorf("expect context to not be canceled, got %v", err) } }
explode_data.jsonl/49372
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 41745, 91101, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 609, 672, 267, 59855, 991, 726, 1972, 90, 17453, 1143, 25, 1281, 35190, 2036, 28875, 630, 9859, 1669, 31521, 31586, 91101, 7502, 11, 220, 16, 77053, 71482, 340, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMigrationErrorFrom(t *testing.T) { defer func(v []migration, s string) { schemaMigrations = v DbSchemaCurrent = s }(schemaMigrations, DbSchemaCurrent) DbSchemaCurrent = "koo-koo-schema" shouldNotRun := false schemaMigrations = []migration{ {name: "langur", fn: func(db *DB) error { shouldNotRun = true return nil }}, {name: "coconut", fn: func(db *DB) error { shouldNotRun = true return nil }}, {name: "chutney", fn: func(db *DB) error { shouldNotRun = true return nil }}, } dir, err := ioutil.TempDir("", "localstore-test") if err != nil { t.Fatal(err) } defer os.RemoveAll(dir) baseKey := make([]byte, 32) if _, err := rand.Read(baseKey); err != nil { t.Fatal(err) } logger := logging.New(ioutil.Discard, 0) // start the fresh localstore with the sanctuary schema name db, err := New(dir, baseKey, nil, logger) if err != nil { t.Fatal(err) } err = db.Close() if err != nil { t.Fatal(err) } DbSchemaCurrent = "foo" // start the existing localstore and expect the migration to run _, err = New(dir, baseKey, nil, logger) if !strings.Contains(err.Error(), errMissingCurrentSchema.Error()) { t.Fatalf("expected errCannotFindSchema but got %v", err) } if shouldNotRun { t.Errorf("migration ran but shouldnt have") } }
explode_data.jsonl/79613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 531 }
[ 2830, 3393, 20168, 1454, 3830, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 3747, 3056, 80227, 11, 274, 914, 8, 341, 197, 1903, 3416, 44, 17824, 284, 348, 198, 197, 197, 7994, 8632, 5405, 284, 274, 198, 197, 25547, 17349, 44, 17824, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDimensions(t *testing.T) { t.Parallel() ctx, cancel := testAllocate(t, "image.html") defer cancel() tests := []struct { sel string by QueryOption width int64 height int64 }{ {`/html/body/img`, BySearch, 239, 239}, {`img`, ByQueryAll, 239, 239}, {`img`, ByQuery, 239, 239}, {`#icon-github`, ByID, 120, 120}, {`document.querySelector("#icon-github")`, ByJSPath, 120, 120}, } for i, test := range tests { var model *dom.BoxModel if err := Run(ctx, Dimensions(test.sel, &model, test.by)); err != nil { t.Fatalf("test %d got error: %v", i, err) } if model.Height != test.height || model.Width != test.width { t.Errorf("test %d expected %dx%d, got: %dx%d", i, test.width, test.height, model.Height, model.Width) } } }
explode_data.jsonl/59467
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 322 }
[ 2830, 3393, 21351, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 20985, 11, 9121, 1669, 1273, 75380, 1155, 11, 330, 1805, 2564, 1138, 16867, 9121, 2822, 78216, 1669, 3056, 1235, 341, 197, 1903, 301, 262, 914, 198, 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...
5
func TestSub(t *testing.T) { mux := new(TypeMux) defer mux.Stop() sub := mux.Subscribe(testEvent(0)) go func() { if err := mux.Post(testEvent(5)); err != nil { t.Errorf("Post returned unexpected error: %v", err) } }() ev := <-sub.Chan() if ev.Data.(testEvent) != testEvent(5) { t.Errorf("Got %v (%T), expected event %v (%T)", ev, ev, testEvent(5), testEvent(5)) } }
explode_data.jsonl/61573
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 3136, 1155, 353, 8840, 836, 8, 341, 2109, 2200, 1669, 501, 22498, 44, 2200, 340, 16867, 59807, 30213, 2822, 28624, 1669, 59807, 82628, 8623, 1556, 7, 15, 1171, 30680, 2915, 368, 341, 197, 743, 1848, 1669, 59807, 23442, 8623,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnvironmentVariableOverrideName(t *testing.T) { var args struct { Foo string `arg:"env:BAZ"` } setenv(t, "BAZ", "bar") os.Args = []string{"example"} MustParse(&args) assert.Equal(t, "bar", args.Foo) }
explode_data.jsonl/13036
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 12723, 7827, 2177, 675, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 12727, 2624, 914, 1565, 858, 2974, 3160, 25, 7064, 57, 8805, 197, 532, 8196, 3160, 1155, 11, 330, 7064, 57, 497, 330, 2257, 1138, 25078, 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 TestTicketBundleSubdigestsCanonicalDigest(t *testing.T) { m := TicketBundleSubdigests{ TicketRequestDigest: [][]byte{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, {4, 5, 6, 7, 8, 9, 0, 1, 2, 3}, {7, 8, 9, 0, 1, 2, 3, 4, 5, 6}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, }, TicketL1Digest: [][]byte{ {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, {4, 5, 6, 7, 8, 9, 0, 1, 2, 3}, {7, 8, 9, 0, 1, 2, 3, 4, 5, 6}, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, }, EncryptedTicketL2Digest: []byte{1, 2, 3, 4, 5}, RemainderDigest: []byte{6, 7, 8, 9, 0}, } digest := m.CanonicalDigest() expected := []byte{0x17, 0x3d, 0x8e, 0x4b, 0x4b, 0xcb, 0x34, 0x61, 0x59, 0x4a, 0x95, 0x3d, 0x43, 0xd9, 0xfa, 0xe2, 0x4a, 0x76, 0x70, 0x38, 0x75, 0x8e, 0x36, 0x5f, 0xc0, 0xae, 0x23, 0x62, 0x33, 0x5e, 0xa0, 0x97, 0x79, 0x52, 0xfb, 0x79, 0x17, 0x43, 0x27, 0xa7, 0x3e, 0x1c, 0xf4, 0xea, 0x7, 0x30, 0xb, 0xf6} assert.Equal(t, expected, digest) }
explode_data.jsonl/45217
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 566 }
[ 2830, 3393, 34058, 8409, 3136, 36339, 82, 70914, 45217, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 28397, 8409, 3136, 36339, 82, 515, 197, 10261, 5897, 1900, 45217, 25, 52931, 3782, 515, 298, 197, 90, 16, 11, 220, 17, 11, 220, 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
func Test_nthRun(t *testing.T) { type args struct { n int runlen int b []byte } tests := []struct { name string args args want int }{ {"a", args{0, 2, []byte{0xC5}}, 3}, {"b", args{1, 2, []byte{0xC5}}, 0}, {"c", args{2, 2, []byte{0xC5}}, 1}, {"d", args{2, 4, []byte{0xAB, 0xCD}}, 12}, {"e", args{2, 11, []byte{0x01, 0x23, 0x45, 0x67, 0x89}}, 0x2CF}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := nthRun(tt.args.n, tt.args.runlen, tt.args.b); got != tt.want { t.Errorf("nthRun() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/32821
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 78342, 6727, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 9038, 414, 526, 198, 197, 56742, 2892, 526, 198, 197, 2233, 414, 3056, 3782, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_GetConfig_NotFound(t *testing.T) { setup(t) defer cleanup(t) userID := makeUserID() for _, c := range allClients { w := requestAsUser(t, userID, "GET", c.Endpoint, "", nil) assert.Equal(t, http.StatusNotFound, w.Code) } }
explode_data.jsonl/37308
{ "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, 13614, 2648, 60816, 6650, 1155, 353, 8840, 836, 8, 341, 84571, 1155, 340, 16867, 21290, 1155, 692, 19060, 915, 1669, 1281, 36899, 741, 2023, 8358, 272, 1669, 2088, 678, 47174, 341, 197, 6692, 1669, 1681, 2121, 1474, 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...
2
func TestDecodeCmdMessageReleaseStream(t *testing.T) { bin := []byte{ // nil 0x05, // string: abc 0x02, 0x00, 0x03, 0x61, 0x62, 0x63, } r := bytes.NewReader(bin) d := amf0.NewDecoder(r) var v AMFConvertible err := CmdBodyDecoderFor("releaseStream", 42)(r, d, &v) assert.Nil(t, err) assert.Equal(t, &NetConnectionReleaseStream{ StreamName: "abc", }, v) }
explode_data.jsonl/7727
{ "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, 32564, 15613, 2052, 16077, 3027, 1155, 353, 8840, 836, 8, 341, 2233, 258, 1669, 3056, 3782, 515, 197, 197, 322, 2092, 198, 197, 197, 15, 87, 15, 20, 345, 197, 197, 322, 914, 25, 39022, 198, 197, 197, 15, 87, 15, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestContentTypesServiceList(t *testing.T) { var err error assert := assert.New(t) handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal(r.Method, "GET") assert.Equal(r.URL.Path, "/spaces/"+spaceID+"/content_types") checkHeaders(r, assert) w.WriteHeader(200) fmt.Fprintln(w, readTestData("content_types.json")) }) // test server server := httptest.NewServer(handler) defer server.Close() // cma client cma = NewCMA(CMAToken) cma.BaseURL = server.URL _, err = cma.ContentTypes.List(spaceID).Next() assert.Nil(err) }
explode_data.jsonl/66076
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 2762, 4173, 1860, 852, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 6948, 1669, 2060, 7121, 1155, 692, 53326, 1669, 1758, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 6948, 12808, 2601, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMapProxy_Remove(t *testing.T) { testKey := "testingKey" testValue := "testingValue" mp.Put(testKey, testValue) removed, err := mp.Remove(testKey) AssertEqualf(t, err, removed, testValue, "remove returned a wrong value") size, err := mp.Size() AssertEqualf(t, err, size, int32(0), "map size should be 0.") found, err := mp.ContainsKey(testKey) AssertEqualf(t, err, found, false, "containsKey returned a wrong result") mp.Clear() }
explode_data.jsonl/56965
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 2227, 16219, 66843, 1155, 353, 8840, 836, 8, 341, 18185, 1592, 1669, 330, 8840, 1592, 698, 18185, 1130, 1669, 330, 8840, 1130, 698, 53230, 39825, 8623, 1592, 11, 1273, 1130, 340, 197, 45756, 11, 1848, 1669, 10490, 13270, 862...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRootHandlerFactory(t *testing.T) { hand := RootHandlerFactory(nil, context.Background(), &signed.Ed25519{}) handler := hand(MockContextHandler) if _, ok := interface{}(handler).(http.Handler); !ok { t.Fatalf("A rootHandler must implement the http.Handler interface") } ts := httptest.NewServer(handler) defer ts.Close() res, err := http.Get(ts.URL) if err != nil { t.Fatal(err) } if res.StatusCode != http.StatusOK { t.Fatalf("Expected 200, received %d", res.StatusCode) } }
explode_data.jsonl/6726
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 8439, 3050, 4153, 1155, 353, 8840, 836, 8, 341, 9598, 437, 1669, 18854, 3050, 4153, 27907, 11, 2266, 19047, 1507, 609, 2215, 81333, 17, 20, 20, 16, 24, 37790, 53326, 1669, 1424, 66436, 1972, 3050, 340, 743, 8358, 5394, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestNewConfigService(t *testing.T) { if service, err := NewConfigService(); service != nil || err == nil { t.Errorf("no backend specified but service created: %v: %v", service, err) } if service, err := NewConfigService(WithMockBackend()); service == nil || err != nil { t.Errorf("backend specified but service not created: %v: %v", service, err) } }
explode_data.jsonl/16480
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 3564, 2648, 1860, 1155, 353, 8840, 836, 8, 341, 743, 2473, 11, 1848, 1669, 1532, 2648, 1860, 2129, 2473, 961, 2092, 1369, 1848, 621, 2092, 341, 197, 3244, 13080, 445, 2152, 19163, 5189, 714, 2473, 3465, 25, 1018, 85, 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...
5
func TestCollection_UpdateMany(t *testing.T) { mgoClient := Ins() result, err := mgoClient.C("test").UpdateMany(bson.M{"name": bson.M{"$ne": ""}}, bson.M{"$set": bson.M{"age": 18}}) if err != nil { t.Errorf("UpdateMany error: %s", err) t.FailNow() } t.Log("UpdateMany ok: ", result) }
explode_data.jsonl/30108
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 6482, 47393, 8441, 1155, 353, 8840, 836, 8, 341, 2109, 3346, 2959, 1669, 9726, 2822, 9559, 11, 1848, 1669, 296, 3346, 2959, 727, 445, 1944, 1827, 4289, 8441, 1883, 930, 1321, 4913, 606, 788, 50980, 1321, 4913, 3, 811, 788,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_GetProcessInfo(t *testing.T) { getInfo := &GetProcessInfoLinux{} _, err := getInfo.GetInfo("/mnt/hgfs/Source/c++/iVideo/Source/APS/Bin/aps") if nil != err { t.Error(err) } }
explode_data.jsonl/33944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 13614, 7423, 1731, 1155, 353, 8840, 836, 8, 341, 10366, 1731, 1669, 609, 1949, 7423, 1731, 46324, 16094, 197, 6878, 1848, 1669, 91824, 2234, 1731, 4283, 40882, 7530, 70, 3848, 14, 3608, 2899, 1027, 14, 72, 10724, 14, 3608, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func Test_aggregations_bucket_datehistogram_aggregation_51b40610ae05730b4c6afd25647d7ae0(t *testing.T) { es, _ := elasticsearch.NewDefaultClient() // tag:51b40610ae05730b4c6afd25647d7ae0[] { res, err := es.Index( "my-index-000001", strings.NewReader(`{ "date": "2015-10-01T05:30:00Z" }`), es.Index.WithDocumentID("1"), es.Index.WithRefresh("true"), es.Index.WithPretty(), ) fmt.Println(res, err) if err != nil { // SKIP t.Fatalf("Error getting the response: %s", err) // SKIP } // SKIP defer res.Body.Close() // SKIP } { res, err := es.Index( "my-index-000001", strings.NewReader(`{ "date": "2015-10-01T06:30:00Z" }`), es.Index.WithDocumentID("2"), es.Index.WithRefresh("true"), es.Index.WithPretty(), ) fmt.Println(res, err) if err != nil { // SKIP t.Fatalf("Error getting the response: %s", err) // SKIP } // SKIP defer res.Body.Close() // SKIP } { res, err := es.Search( es.Search.WithIndex("my-index-000001"), es.Search.WithBody(strings.NewReader(`{ "aggs": { "by_day": { "date_histogram": { "field": "date", "calendar_interval": "day", "offset": "+6h" } } } }`)), es.Search.WithSize(0), es.Search.WithPretty(), ) fmt.Println(res, err) if err != nil { // SKIP t.Fatalf("Error getting the response: %s", err) // SKIP } // SKIP defer res.Body.Close() // SKIP } // end:51b40610ae05730b4c6afd25647d7ae0[] }
explode_data.jsonl/71454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 727 }
[ 2830, 3393, 20587, 7998, 804, 38749, 4164, 21158, 12958, 20587, 34442, 62, 20, 16, 65, 19, 15, 21, 16, 15, 5918, 15, 20, 22, 18, 15, 65, 19, 66, 21, 92139, 17, 20, 21, 19, 22, 67, 22, 5918, 15, 1155, 353, 8840, 836, 8, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestQualifyVariables(t *testing.T) { assert := assert.New(t) f := getRule(qualifyColumnsId) sessionTable := memory.NewTable("@@session", sql.NewPrimaryKeySchema(sql.Schema{{Name: "autocommit", Type: sql.Int64, Source: "@@session"}}), nil) globalTable := memory.NewTable("@@global", sql.NewPrimaryKeySchema(sql.Schema{{Name: "max_allowed_packet", Type: sql.Int64, Source: "@@global"}}), nil) node := plan.NewProject( []sql.Expression{ uc("@@max_allowed_packet"), }, plan.NewResolvedTable(globalTable, nil, nil), ) col, ok := node.Projections[0].(*expression.UnresolvedColumn) assert.True(ok) assert.Truef(strings.HasPrefix(col.Name(), "@@") || strings.HasPrefix(col.Table(), "@@"), "@@max_allowed_packet is not global or session column") expected := plan.NewProject( []sql.Expression{ uqc("", "@@max_allowed_packet"), }, plan.NewResolvedTable(globalTable, nil, nil), ) result, _, err := f.Apply(sql.NewEmptyContext(), nil, node, nil, DefaultRuleSelector) assert.NoError(err) assert.Equal(expected, result) node = plan.NewProject( []sql.Expression{ uc("@@autocommit"), }, plan.NewResolvedTable(sessionTable, nil, nil), ) col, ok = node.Projections[0].(*expression.UnresolvedColumn) assert.True(ok) assert.Truef(strings.HasPrefix(col.Name(), "@@") || strings.HasPrefix(col.Table(), "@@"), "@@autocommit is not global or session column") expected = plan.NewProject( []sql.Expression{ uqc("", "@@autocommit"), }, plan.NewResolvedTable(sessionTable, nil, nil), ) result, _, err = f.Apply(sql.NewEmptyContext(), nil, node, nil, DefaultRuleSelector) assert.NoError(err) assert.Equal(expected, result) }
explode_data.jsonl/58300
{ "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, 31029, 1437, 22678, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 1166, 1669, 633, 11337, 7, 1751, 1437, 13965, 764, 692, 25054, 2556, 1669, 4938, 7121, 2556, 10662, 31, 5920, 497, 5704, 7121, 25981, 8632,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Pool_Package_Timeout(t *testing.T) { p, _ := ports.PopRand() s := gtcp.NewServer(fmt.Sprintf(`:%d`, p), func(conn *gtcp.Conn) { defer conn.Close() for { data, err := conn.RecvPkg() if err != nil { break } time.Sleep(time.Second) gtest.Assert(conn.SendPkg(data), nil) } }) go s.Run() defer s.Close() time.Sleep(100 * time.Millisecond) gtest.C(t, func(t *gtest.T) { conn, err := gtcp.NewPoolConn(fmt.Sprintf("127.0.0.1:%d", p)) t.Assert(err, nil) defer conn.Close() data := []byte("10000") result, err := conn.SendRecvPkgWithTimeout(data, time.Millisecond*500) t.AssertNE(err, nil) t.Assert(result, nil) }) gtest.C(t, func(t *gtest.T) { conn, err := gtcp.NewPoolConn(fmt.Sprintf("127.0.0.1:%d", p)) t.Assert(err, nil) defer conn.Close() data := []byte("10000") result, err := conn.SendRecvPkgWithTimeout(data, time.Second*2) t.Assert(err, nil) t.Assert(result, data) }) }
explode_data.jsonl/26287
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 452 }
[ 2830, 3393, 1088, 1749, 1088, 1434, 39080, 411, 1155, 353, 8840, 836, 8, 341, 3223, 11, 716, 1669, 20325, 47424, 56124, 741, 1903, 1669, 25161, 4672, 7121, 5475, 28197, 17305, 5809, 7533, 67, 7808, 281, 701, 2915, 20571, 353, 5178, 4672...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAcquireIfSecond(t *testing.T) { // GIVEN permitFunction := func() bool { return true } lock := state.NewLock(1) handler := NewLockHandler(lock, timeout, permitFunction) req, _ := http.NewRequest("GET", "/", nil) prepareResponseRecorder(req, handler) // WHEN rr := prepareResponseRecorder(req, handler) // THEN assertResponseStatusCode(http.StatusLocked, rr.Code, t) }
explode_data.jsonl/66022
{ "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, 11654, 984, 2679, 15666, 1155, 353, 8840, 836, 8, 341, 197, 322, 89836, 198, 197, 39681, 5152, 1669, 2915, 368, 1807, 341, 197, 853, 830, 198, 197, 630, 58871, 1669, 1584, 7121, 11989, 7, 16, 340, 53326, 1669, 1532, 11989,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAggregatorOneFunc(t *testing.T) { testCases := []aggregatorTestCase{ { input: tuples{ {0, 1}, }, expected: tuples{ {1}, }, name: "OneTuple", outputBatchSize: 4, }, { input: tuples{ {0, 1}, {0, 1}, }, expected: tuples{ {2}, }, name: "OneGroup", }, { input: tuples{ {0, 1}, {0, 0}, {0, 1}, {1, 4}, {2, 5}, }, expected: tuples{ {2}, {4}, {5}, }, batchSize: 2, name: "MultiGroup", }, { input: tuples{ {0, 1}, {0, 2}, {0, 3}, {1, 4}, {1, 5}, }, expected: tuples{ {6}, {9}, }, batchSize: 1, name: "CarryBetweenInputBatches", }, { input: tuples{ {0, 1}, {0, 2}, {0, 3}, {0, 4}, {1, 5}, {2, 6}, }, expected: tuples{ {10}, {5}, {6}, }, batchSize: 2, outputBatchSize: 1, name: "CarryBetweenOutputBatches", }, { input: tuples{ {0, 1}, {0, 1}, {1, 2}, {2, 3}, {2, 3}, {3, 4}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, }, expected: tuples{ {2}, {2}, {6}, {8}, {5}, {6}, {7}, {8}, }, batchSize: 4, outputBatchSize: 1, name: "CarryBetweenInputAndOutputBatches", }, { input: tuples{ {0, 1}, {0, 2}, {0, 3}, {0, 4}, }, expected: tuples{ {10}, }, batchSize: 1, outputBatchSize: 1, name: "NoGroupingCols", groupCols: []uint32{}, }, { input: tuples{ {1, 0, 0}, {2, 0, 0}, {3, 0, 0}, {4, 0, 0}, }, expected: tuples{ {10}, }, batchSize: 1, outputBatchSize: 1, name: "UnusedInputColumns", colTypes: []types.T{types.Int64, types.Int64, types.Int64}, groupCols: []uint32{1, 2}, aggCols: [][]uint32{{0}}, }, } // Run tests with deliberate batch sizes and no selection vectors. for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { if err := tc.init(); err != nil { t.Fatal(err) } tupleSource := newOpTestInput(uint16(tc.batchSize), tc.input) a, err := NewOrderedAggregator( tupleSource, tc.colTypes, tc.aggFns, tc.groupCols, tc.aggCols, ) if err != nil { t.Fatal(err) } out := newOpTestOutput(a, []int{0}, tc.expected) // Explicitly reinitialize the aggregator with the given output batch // size. a.(*orderedAggregator).initWithBatchSize(tc.batchSize, tc.outputBatchSize) if err := out.VerifyAnyOrder(); err != nil { t.Fatal(err) } // Run randomized tests on this test case. t.Run(fmt.Sprintf("Randomized"), func(t *testing.T) { for _, agg := range aggTypes { t.Run(agg.name, func(t *testing.T) { runTests(t, []tuples{tc.input}, func(t *testing.T, input []Operator) { a, err := agg.new( input[0], tc.colTypes, tc.aggFns, tc.groupCols, tc.aggCols, ) if err != nil { t.Fatal(err) } out := newOpTestOutput(a, []int{0}, tc.expected) if err := out.VerifyAnyOrder(); err != nil { t.Fatal(err) } }) }) } }) }) } }
explode_data.jsonl/8882
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1934 }
[ 2830, 3393, 9042, 58131, 3966, 9626, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 351, 58131, 16458, 515, 197, 197, 515, 298, 22427, 25, 45225, 515, 571, 197, 90, 15, 11, 220, 16, 1583, 298, 197, 1583, 298, 42400, 25, 452...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUint16ToBytes(t *testing.T) { f := func(v ...byte) { assert.Equal(t, v, uint16ToBytes(int(binary.BigEndian.Uint16(v)))) } f(0x00, 0x01) f(0x00, 0x11) f(0x01, 0x01) }
explode_data.jsonl/16990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 21570, 16, 21, 1249, 7078, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 2915, 3747, 2503, 3782, 8, 341, 197, 6948, 12808, 1155, 11, 348, 11, 2622, 16, 21, 1249, 7078, 1548, 63926, 69223, 43231, 71869, 16, 21, 3747, 22788, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetFile(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { t.Errorf("Bad method: %s", r.Method) } if r.URL.Path != "/repos/k8s/kuber/contents/foo.txt" { t.Errorf("Bad request path: %s", r.URL.Path) } if r.URL.RawQuery != "" { t.Errorf("Bad request query: %s", r.URL.RawQuery) } c := &Content{ Content: base64.StdEncoding.EncodeToString([]byte("abcde")), } b, err := json.Marshal(&c) if err != nil { t.Fatalf("Didn't expect error: %v", err) } fmt.Fprint(w, string(b)) })) defer ts.Close() c := getClient(ts.URL) if content, err := c.GetFile("k8s", "kuber", "foo.txt", ""); err != nil { t.Errorf("Didn't expect error: %v", err) } else if string(content) != "abcde" { t.Errorf("Wrong content -- expect: abcde, got: %s", string(content)) } }
explode_data.jsonl/6281
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 396 }
[ 2830, 3393, 1949, 1703, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 743, 435, 20798, 961, 1758, 20798, 1949, 341, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestLang_English_Constellation(t *testing.T) { assert := assert.New(t) tests := []struct { input string // 输入值 expected string // 期望值 }{ {"", ""}, {"0", ""}, {"0000-00-00", ""}, {"00:00:00", ""}, {"0000-00-00 00:00:00", ""}, {"2020-01-05", "Capricorn"}, {"2020-02-05", "Aquarius"}, {"2020-03-05", "Pisces"}, {"2020-04-05", "Aries"}, {"2020-05-05", "Taurus"}, {"2020-06-05", "Gemini"}, {"2020-07-05", "Cancer"}, {"2020-08-05", "Leo"}, {"2020-09-05", "Virgo"}, {"2020-10-05", "Libra"}, {"2020-11-05", "Scorpio"}, {"2020-12-05", "Sagittarius"}, } for index, test := range tests { c := SetTimezone(PRC).Parse(test.input).SetLocale(english) assert.Nil(c.Error) assert.Equal(test.expected, c.Constellation(), "test index id is "+strconv.Itoa(index)) } }
explode_data.jsonl/29471
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 385 }
[ 2830, 3393, 26223, 2089, 968, 1672, 15100, 41137, 367, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 78216, 1669, 3056, 1235, 341, 197, 22427, 262, 914, 442, 69058, 25511, 198, 197, 42400, 914, 442, 220, 106076, 25511...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetBucketLocation(t *testing.T) { for _, test := range s3LocationTests { s := s3.New(unit.Session) s.Handlers.Send.Clear() s.Handlers.Send.PushBack(func(r *request.Request) { reader := ioutil.NopCloser(bytes.NewReader([]byte(test.body))) r.HTTPResponse = &http.Response{StatusCode: 200, Body: reader} }) resp, err := s.GetBucketLocation(&s3.GetBucketLocationInput{Bucket: aws.String("bucket")}) assert.NoError(t, err) if test.loc == "" { assert.Nil(t, resp.LocationConstraint) } else { assert.Equal(t, test.loc, *resp.LocationConstraint) } } }
explode_data.jsonl/769
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 1949, 36018, 4707, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 274, 18, 4707, 18200, 341, 197, 1903, 1669, 274, 18, 7121, 24144, 20674, 340, 197, 1903, 35308, 9254, 20176, 13524, 741, 197, 1903, 35308, 9254, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdatePod(t *testing.T) { ns := api.NamespaceDefault requestPod := &api.Pod{ ObjectMeta: api.ObjectMeta{ Name: "foo", ResourceVersion: "1", Labels: map[string]string{ "foo": "bar", "name": "baz", }, }, Status: api.PodStatus{ Phase: api.PodRunning, }, } c := &testClient{ Request: testRequest{Method: "PUT", Path: testapi.Default.ResourcePath("pods", ns, "foo"), Query: buildQueryValues(nil)}, Response: Response{StatusCode: http.StatusOK, Body: requestPod}, } receivedPod, err := c.Setup(t).Pods(ns).Update(requestPod) c.Validate(t, receivedPod, err) }
explode_data.jsonl/36097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 4289, 23527, 1155, 353, 8840, 836, 8, 341, 84041, 1669, 6330, 46011, 3675, 198, 23555, 23527, 1669, 609, 2068, 88823, 515, 197, 23816, 12175, 25, 6330, 80222, 515, 298, 21297, 25, 310, 330, 7975, 756, 298, 79487, 5637, 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 TestSolution(t *testing.T) { t.Parallel() type in struct { n int a [][2]int } tests := []struct { in in want int }{ {in: in{n: 10, a: [][2]int{{9, 4}, {4, 3}, {1, 1}, {4, 2}, {2, 4}, {5, 8}, {4, 0}, {5, 3}, {0, 5}, {5, 2}}}, want: 10}, } for i, tt := range tests { i, tt := i, tt t.Run(fmt.Sprint(i), func(t *testing.T) { t.Parallel() got := solution(tt.in.n, tt.in.a) if got != tt.want { t.Fatalf("in: %v got: %v want: %v", tt.in, got, tt.want) } }) } }
explode_data.jsonl/82188
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 278 }
[ 2830, 3393, 36842, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 13158, 304, 2036, 341, 197, 9038, 526, 198, 197, 11323, 508, 1457, 17, 63025, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 17430, 256, 304, 198, 197, 50780,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAssignSDKServerToUser_SDKAlreadyAssigned(t *testing.T) { setupTest() u := &models.User{ID: 4} u.LbrynetServerID.SetValid(55) rt := sdkrouter.New(config.GetLbrynetServers()) l := logrus.NewEntry(logrus.New()) err := assignSDKServerToUser(boil.GetDB(), u, rt.RandomServer(), l) assert.EqualError(t, err, "user already has an sdk assigned") }
explode_data.jsonl/1636
{ "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, 28933, 31534, 5475, 1249, 1474, 84197, 38370, 94025, 1155, 353, 8840, 836, 8, 341, 84571, 2271, 741, 10676, 1669, 609, 6507, 7344, 90, 915, 25, 220, 19, 532, 10676, 1214, 65, 884, 4711, 5475, 915, 4202, 4088, 7, 20, 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 TestAPICreateUserInvalidEmail(t *testing.T) { defer prepareTestEnv(t)() adminUsername := "user1" session := loginUser(t, adminUsername) token := getTokenForLoggedInUser(t, session) urlStr := fmt.Sprintf("/api/v1/admin/users?token=%s", token) req := NewRequestWithValues(t, "POST", urlStr, map[string]string{ "email": "invalid_email@domain.com\r\n", "full_name": "invalid user", "login_name": "invalidUser", "must_change_password": "true", "password": "password", "send_notify": "true", "source_id": "0", "username": "invalidUser", }) session.MakeRequest(t, req, http.StatusUnprocessableEntity) }
explode_data.jsonl/71785
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 2537, 1317, 964, 1474, 7928, 4781, 1155, 353, 8840, 836, 8, 341, 16867, 10549, 2271, 14359, 1155, 8, 741, 64394, 11115, 1669, 330, 872, 16, 698, 25054, 1669, 87169, 1155, 11, 3986, 11115, 340, 43947, 1669, 54111, 2461, 28559...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPodSpecForKvdbAuthCerts(t *testing.T) { fakeClient := fakek8sclient.NewSimpleClientset( &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "kvdb-auth-secret", Namespace: "kube-test", }, Data: map[string][]byte{ secretKeyKvdbCA: []byte("kvdb-ca-file"), secretKeyKvdbCert: []byte("kvdb-cert-file"), secretKeyKvdbCertKey: []byte("kvdb-key-file"), secretKeyKvdbACLToken: []byte("kvdb-acl-token"), secretKeyKvdbUsername: []byte("kvdb-username"), secretKeyKvdbPassword: []byte("kvdb-password"), }, }, ) coreops.SetInstance(coreops.New(fakeClient)) expected := getExpectedPodSpecFromDaemonset(t, "testspec/px_kvdb_certs.yaml") nodeName := "testNode" cluster := &corev1.StorageCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "px-cluster", Namespace: "kube-test", }, Spec: corev1.StorageClusterSpec{ Image: "portworx/oci-monitor:2.1.1", Kvdb: &corev1.KvdbSpec{ Endpoints: []string{"ep1", "ep2", "ep3"}, AuthSecret: "kvdb-auth-secret", }, }, } driver := portworx{} actual, err := driver.GetStoragePodSpec(cluster, nodeName) assert.NoError(t, err, "Unexpected error on GetStoragePodSpec") assertPodSpecEqual(t, expected, &actual) }
explode_data.jsonl/55465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 565 }
[ 2830, 3393, 23527, 8327, 2461, 42, 85, 1999, 5087, 34, 15546, 1155, 353, 8840, 836, 8, 341, 1166, 726, 2959, 1669, 12418, 74, 23, 82, 2972, 7121, 16374, 2959, 746, 1006, 197, 197, 5, 85, 16, 74779, 515, 298, 23816, 12175, 25, 77520,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetIndexAndMarkPrice(t *testing.T) { t.Parallel() _, err := b.GetIndexAndMarkPrice(context.Background(), "", "BTCUSD") if err != nil { t.Error(err) } }
explode_data.jsonl/76601
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 1949, 1552, 3036, 8949, 6972, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 2234, 1552, 3036, 8949, 6972, 5378, 19047, 1507, 7342, 330, 59118, 26749, 1138, 743, 1848, 961, 2092, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestMultiMiddleware(t *testing.T) { //per-manager middlwares are called separately, global middleware is called in each manager namespace := "prod" setupTestConfigWithNamespace(namespace) rc := Config.Client processed := make(chan *Args) testJob := (func(message *Msg) error { processed <- message.Args() return nil }) mid1 := &customMid{base: "1"} mid2 := &customMid{base: "2"} mid3 := &customMid{base: "3"} oldMiddlewares := defaultMiddlewares defer func() { defaultMiddlewares = oldMiddlewares }() defaultMiddlewares = NewMiddlewares(mid1.AsMiddleware()) manager1 := newManager("manager1", testJob, 10) manager2 := newManager("manager2", testJob, 10, mid2.AsMiddleware()) manager3 := newManager("manager3", testJob, 10, mid3.AsMiddleware()) rc.LPush("prod:queue:manager1", message.ToJson()).Result() rc.LPush("prod:queue:manager2", message.ToJson()).Result() rc.LPush("prod:queue:manager3", message.ToJson()).Result() manager1.start() manager2.start() manager3.start() <-processed <-processed <-processed assert.Equal(t, []string{"11", "12"}, mid1.Trace()) assert.Equal(t, []string{"21", "22"}, mid2.Trace()) assert.Equal(t, []string{"31", "32"}, mid3.Trace()) manager1.quit() manager2.quit() manager3.quit() }
explode_data.jsonl/70778
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 467 }
[ 2830, 3393, 20358, 24684, 1155, 353, 8840, 836, 8, 341, 197, 322, 712, 44896, 64603, 75, 37903, 525, 2598, 25156, 11, 3644, 29679, 374, 2598, 304, 1817, 6645, 198, 56623, 1669, 330, 19748, 698, 84571, 2271, 2648, 2354, 22699, 52397, 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...
1
func Test_PostBlockSuccess(t *testing.T) { chain, mock33 := createBlockChain(t) ps := &bcMocks.PostService{} ps.On("PostData", mock.Anything, mock.Anything, mock.Anything).Return(nil) chain.push.postService = ps subscribe := new(types.PushSubscribeReq) subscribe.Name = "push-test" subscribe.URL = "http://localhost" subscribe.Type = PushBlock err := chain.push.addSubscriber(subscribe) time.Sleep(2 * time.Second) assert.Equal(t, err, nil) createBlocks(t, mock33, chain, 10) keyStr := string(calcPushKey(subscribe.Name)) pushNotify := chain.push.tasks[keyStr] assert.Equal(t, pushNotify.subscribe.Name, subscribe.Name) assert.Equal(t, pushNotify.status, running) time.Sleep(1 * time.Second) //注册相同的push,不会有什么问题 err = chain.push.addSubscriber(subscribe) assert.Equal(t, err, nil) createBlocks(t, mock33, chain, 1) assert.Equal(t, atomic.LoadInt32(&pushNotify.postFail2Sleep), int32(0)) time.Sleep(1 * time.Second) lastSeq, _ := chain.ProcGetLastPushSeq(subscribe.Name) assert.Greater(t, lastSeq, int64(21)) mock33.Close() }
explode_data.jsonl/61724
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 426 }
[ 2830, 3393, 66726, 4713, 7188, 1155, 353, 8840, 836, 8, 341, 197, 8819, 11, 7860, 18, 18, 1669, 1855, 4713, 18837, 1155, 340, 35009, 1669, 609, 8904, 72577, 23442, 1860, 16094, 35009, 8071, 445, 4133, 1043, 497, 7860, 13311, 1596, 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 TestElementWithAttributes(t *testing.T) { e := Tags(struct{ a, b Tag }{}) root := e.a(e.b("b", Attrs{"c": "d", "e:f": "g"}), Attrs{"xmlns:e": "x.y.z"}) assert.Equal(t, `<a xmlns:e="x.y.z"><b c="d" e:f="g">b</b></a>`, marshal(root)) }
explode_data.jsonl/15616
{ "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, 1691, 2354, 10516, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 27683, 6163, 90, 264, 11, 293, 12353, 335, 37790, 33698, 1669, 384, 5849, 2026, 948, 445, 65, 497, 50943, 82, 4913, 66, 788, 330, 67, 497, 330, 68, 55477, 788,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCrudDistributionsWithFailures(t *testing.T) { var res middleware.Responder db := entity.NewTestDB() c := &crud{} defer db.Close() defer gostub.StubFunc(&getDB, db).Reset() c.CreateFlag(flag.CreateFlagParams{ Body: &models.CreateFlagRequest{ Description: util.StringPtr("funny flag"), }, }) c.CreateSegment(segment.CreateSegmentParams{ FlagID: int64(1), Body: &models.CreateSegmentRequest{ Description: util.StringPtr("segment1"), RolloutPercent: util.Int64Ptr(int64(100)), }, }) c.CreateVariant(variant.CreateVariantParams{ FlagID: int64(1), Body: &models.CreateVariantRequest{ Key: util.StringPtr("control"), }, }) c.PutDistributions(distribution.PutDistributionsParams{ FlagID: int64(1), SegmentID: int64(1), Body: &models.PutDistributionsRequest{ Distributions: []*models.Distribution{ { Percent: util.Int64Ptr(int64(100)), VariantID: util.Int64Ptr(int64(1)), VariantKey: util.StringPtr("control"), }, }, }, }) t.Run("FindDistributions - db generic error", func(t *testing.T) { db.Error = fmt.Errorf("db generic error") res = c.FindDistributions(distribution.FindDistributionsParams{ FlagID: int64(1), SegmentID: int64(1), }) assert.NotZero(t, res.(*distribution.FindDistributionsDefault).Payload) db.Error = nil }) t.Run("PutDistributions - validatePutDistributions error", func(t *testing.T) { res = c.PutDistributions(distribution.PutDistributionsParams{ FlagID: int64(1), SegmentID: int64(1), Body: &models.PutDistributionsRequest{ Distributions: []*models.Distribution{ { Percent: util.Int64Ptr(int64(50)), // not adds up to 100 VariantID: util.Int64Ptr(int64(1)), VariantKey: util.StringPtr("control"), }, }, }, }) assert.NotZero(t, res.(*distribution.PutDistributionsDefault).Payload) }) t.Run("PutDistributions - cannot delete previous distribution error", func(t *testing.T) { defer gostub.StubFunc(&validatePutDistributions, nil).Reset() db.Error = fmt.Errorf("cannot delete previous distribution") res = c.PutDistributions(distribution.PutDistributionsParams{ FlagID: int64(1), SegmentID: int64(1), Body: &models.PutDistributionsRequest{ Distributions: []*models.Distribution{ { Percent: util.Int64Ptr(int64(100)), VariantID: util.Int64Ptr(int64(1)), VariantKey: util.StringPtr("control"), }, }, }, }) assert.NotZero(t, res.(*distribution.PutDistributionsDefault).Payload) db.Error = nil }) }
explode_data.jsonl/19458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1075 }
[ 2830, 3393, 92061, 35, 17994, 2354, 19524, 1413, 1155, 353, 8840, 836, 8, 341, 2405, 592, 29679, 8377, 20328, 198, 20939, 1669, 5387, 7121, 2271, 3506, 741, 1444, 1669, 609, 53569, 31483, 16867, 2927, 10421, 741, 16867, 67934, 392, 7758, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_getSha256(t *testing.T) { sha, err := getSha256([]byte("this is a test")) assert.Equal(t, err, nil, "Unable to get sha") assert.Equal(t, sha, "2e99758548972a8e8822ad47fa1017ff72f06f3ff6a016851f45c398732bc50c", "Unable to get sha") }
explode_data.jsonl/67807
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 3062, 62316, 17, 20, 21, 1155, 353, 8840, 836, 8, 341, 197, 15247, 11, 1848, 1669, 633, 62316, 17, 20, 21, 10556, 3782, 445, 574, 374, 264, 1273, 5455, 6948, 12808, 1155, 11, 1848, 11, 2092, 11, 330, 17075, 311, 633, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileList(t *testing.T) { is := is.New(t) s := NewShell(shellUrl) list, err := s.FileList(fmt.Sprintf("/ipfs/%s", examplesHash)) is.Nil(err) is.Equal(list.Type, "Directory") is.Equal(list.Size, 0) is.Equal(len(list.Links), 7) // TODO: document difference in sice betwen 'ipfs ls' and 'ipfs file ls -v'. additional object encoding in data block? expected := map[string]UnixLsLink{ "about": {Type: "File", Hash: "QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V", Name: "about", Size: 1677}, "contact": {Type: "File", Hash: "QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y", Name: "contact", Size: 189}, "help": {Type: "File", Hash: "QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7", Name: "help", Size: 311}, "ping": {Type: "File", Hash: "QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y", Name: "ping", Size: 4}, "quick-start": {Type: "File", Hash: "QmXgqKTbzdh83pQtKFb19SpMCpDDcKR2ujqk3pKph9aCNF", Name: "quick-start", Size: 1681}, "readme": {Type: "File", Hash: "QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", Name: "readme", Size: 1091}, "security-notes": {Type: "File", Hash: "QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm", Name: "security-notes", Size: 1162}, } for _, l := range list.Links { el, ok := expected[l.Name] is.True(ok) is.NotNil(el) is.Equal(*l, el) } }
explode_data.jsonl/61080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 704 }
[ 2830, 3393, 1703, 852, 1155, 353, 8840, 836, 8, 341, 19907, 1669, 374, 7121, 1155, 340, 1903, 1669, 1532, 25287, 93558, 2864, 692, 14440, 11, 1848, 1669, 274, 8576, 852, 28197, 17305, 4283, 573, 3848, 12627, 82, 497, 10295, 6370, 1171, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_UpForbid(t *testing.T) { Convey("UpForbid", t, func() { _, err := d.UpForbid(context.TODO(), 1, 1, 1, 1) So(err, ShouldBeNil) }) }
explode_data.jsonl/48602
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 88425, 2461, 20648, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 2324, 2461, 20648, 497, 259, 11, 2915, 368, 341, 197, 197, 6878, 1848, 1669, 294, 60828, 2461, 20648, 5378, 90988, 1507, 220, 16, 11, 220, 16, 11, 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
func TestBadIPMask(t *testing.T) { block, _ := pem.Decode([]byte(badIPMaskPEM)) _, err := ParseCertificate(block.Bytes) if err == nil { t.Fatalf("unexpected success") } const expected = "contained invalid mask" if !strings.Contains(err.Error(), expected) { t.Fatalf("expected %q in error but got: %s", expected, err) } }
explode_data.jsonl/68019
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 17082, 3298, 12686, 1155, 353, 8840, 836, 8, 341, 47996, 11, 716, 1669, 54184, 56372, 10556, 3782, 1883, 329, 3298, 12686, 1740, 44, 1171, 197, 6878, 1848, 1669, 14775, 33202, 18682, 36868, 340, 743, 1848, 621, 2092, 341, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMatchPath(t *testing.T) { for k, c := range []struct { path string haystack []string ok bool }{ {path: "foo", haystack: []string{"foo", "bar"}, ok: true}, {path: "bar", haystack: []string{"foo", "bar"}, ok: true}, {path: "foo", haystack: []string{"foo/bar"}, ok: true}, {path: "bar", haystack: []string{"foo/bar"}, ok: false}, {path: "/foo", haystack: []string{"/foo/bar", "bar"}, ok: true}, {path: "/bar", haystack: []string{"/foo/bar", "bar"}, ok: false}, {path: "foo", haystack: []string{"bar"}, ok: false}, {path: "bar", haystack: []string{"bar"}, ok: true}, {path: "foo", haystack: []string{}, ok: false}, } { assert.Equal(t, c.ok, matchPath(c.path, c.haystack), "%d", k) t.Logf("Passed test case %d", k) } }
explode_data.jsonl/48816
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 322 }
[ 2830, 3393, 8331, 1820, 1155, 353, 8840, 836, 8, 341, 2023, 595, 11, 272, 1669, 2088, 3056, 1235, 341, 197, 26781, 257, 914, 198, 197, 9598, 352, 7693, 3056, 917, 198, 197, 59268, 981, 1807, 198, 197, 59403, 197, 197, 90, 2343, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestBasicClusterPubSub(t *testing.T) { srvA, srvB, optsA, optsB := runServers(t) defer srvA.Shutdown() defer srvB.Shutdown() clientA := createClientConn(t, optsA.Host, optsA.Port) defer clientA.Close() clientB := createClientConn(t, optsB.Host, optsB.Port) defer clientB.Close() sendA, expectA := setupConn(t, clientA) sendA("SUB foo 22\r\n") sendA("PING\r\n") expectA(pongRe) if err := checkExpectedSubs(1, srvA, srvB); err != nil { t.Fatalf("%v", err) } sendB, expectB := setupConn(t, clientB) sendB("PUB foo 2\r\nok\r\n") sendB("PING\r\n") expectB(pongRe) expectMsgs := expectMsgsCommand(t, expectA) matches := expectMsgs(1) checkMsg(t, matches[0], "foo", "22", "", "2", "ok") }
explode_data.jsonl/5071
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 15944, 28678, 29162, 3136, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 32, 11, 43578, 33, 11, 12185, 32, 11, 12185, 33, 1669, 1598, 78139, 1155, 340, 16867, 43578, 32, 10849, 18452, 741, 16867, 43578, 33, 10849, 18452, 2822, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDestroyedFlagIsSetWhenDestroyed(t *testing.T) { sm := NewNativeSM(config.Config{}, &dummySM{}, nil) sm.Loaded() sm.Offloaded() if sm.loadedCount != 0 { t.Errorf("loadedCount is not 0") } if sm.destroyed { t.Errorf("destroyed flag unexpectedly set") } select { case <-sm.DestroyedC(): t.Errorf("destroyedC unexpected closed") default: } sm.Close() if !sm.destroyed { t.Errorf("destroyed flag not set") } select { case <-sm.DestroyedC(): default: t.Errorf("destroyed ch not closed") } }
explode_data.jsonl/62404
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 85742, 12135, 3872, 1649, 4498, 85742, 1155, 353, 8840, 836, 8, 341, 72023, 1669, 1532, 20800, 9501, 8754, 10753, 22655, 609, 31390, 9501, 22655, 2092, 340, 72023, 13969, 291, 741, 72023, 13, 4596, 15589, 741, 743, 1525, 60879...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInclude(t *testing.T) { testStr := `<?php include "test.php"; ?>` p := NewParser() p.disableScoping = true _, err := p.Parse("test.php", testStr) if err != nil { fmt.Println(err) t.Fatalf("Did not parse include correctly") } }
explode_data.jsonl/28430
{ "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, 22283, 1155, 353, 8840, 836, 8, 341, 18185, 2580, 1669, 1565, 1316, 1208, 198, 220, 2924, 330, 1944, 2296, 5123, 3370, 3989, 3223, 1669, 1532, 6570, 741, 3223, 42628, 3326, 33707, 284, 830, 198, 197, 6878, 1848, 1669, 281, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMap(t *testing.T) { var q = 5 p := &q a := person{"deen", 22, 1, p} mapA, err := Map(a, DefaultTagName) ass := assert.New(t) ass.NoError(err) ass.Equal("deen", mapA["name"]) ass.Equal(22, mapA["age"]) var ok bool _, ok = mapA["foo"] ass.False(ok) _, ok = mapA["cc"] ass.False(ok) }
explode_data.jsonl/18646
{ "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, 2227, 1155, 353, 8840, 836, 8, 341, 2405, 2804, 284, 220, 20, 198, 3223, 1669, 609, 80, 198, 11323, 1669, 1697, 4913, 64481, 497, 220, 17, 17, 11, 220, 16, 11, 281, 630, 19567, 32, 11, 1848, 1669, 5027, 2877, 11, 7899,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_CLG_Input_GetInformationIDError(t *testing.T) { newCLG := MustNew() newCtx := context.MustNew() newInput := "test input" informationIDKey := fmt.Sprintf("information-sequence:%s:information-id", newInput) // Prepare the storage connection to fake a returned error. c := redigomock.NewConn() c.Command("GET", "prefix:"+informationIDKey).ExpectError(invalidConfigError) newStorageCollection := testMustNewStorageCollectionWithConn(t, c) // Set prepared storage to CLG we want to test. newCLG.SetStorageCollection(newStorageCollection) // Execute CLG. err := newCLG.(*clg).calculate(newCtx, newInput) if !IsInvalidConfig(err) { t.Fatal("expected", true, "got", false) } }
explode_data.jsonl/52855
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 6843, 38, 48653, 13614, 14873, 915, 1454, 1155, 353, 8840, 836, 8, 341, 8638, 3140, 38, 1669, 15465, 3564, 741, 8638, 23684, 1669, 2266, 50463, 3564, 2822, 8638, 2505, 1669, 330, 1944, 1946, 698, 17430, 1627, 915, 1592, 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...
2
func TestClient_Ping(t *testing.T) { resp, err := client.Ping() if err != nil { t.Errorf("unexpected error. error: %+v", err) return } if resp.Err() != nil { t.Errorf("unexpected error. error: %+v", resp.Err()) return } if resp.RespData == nil { t.Error("resp.RespData unexpected nil") return } }
explode_data.jsonl/24784
{ "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, 2959, 1088, 287, 1155, 353, 8840, 836, 8, 341, 34653, 11, 1848, 1669, 2943, 1069, 287, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 53859, 1465, 13, 1465, 25, 68524, 85, 497, 1848, 340, 197, 853, 198, 197, 532,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetOfferByID(t *testing.T) { tt := test.Start(t) defer tt.Finish() test.ResetHorizonDB(t, tt.HorizonDB) q := &Q{tt.HorizonSession()} err := insertOffer(q, eurOffer) tt.Assert.NoError(err) offer, err := q.GetOfferByID(eurOffer.OfferID) tt.Assert.NoError(err) tt.Assert.Equal(offer, eurOffer) }
explode_data.jsonl/69693
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 1949, 39462, 60572, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 1273, 12101, 1155, 340, 16867, 17853, 991, 18176, 741, 18185, 36660, 39601, 16973, 3506, 1155, 11, 17853, 3839, 269, 16973, 3506, 340, 18534, 1669, 609, 48, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAttributeRestrictionsCovering(t *testing.T) { escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.Role{}}, }, expectedCovered: true, expectedUncoveredRules: []authorizationapi.PolicyRule{}, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds")}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.Role{}}, }, expectedCovered: true, expectedUncoveredRules: []authorizationapi.PolicyRule{}, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}}, {Verbs: sets.NewString("update"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.Role{}}, }, servantRules: []authorizationapi.PolicyRule{}, expectedCovered: true, expectedUncoveredRules: []authorizationapi.PolicyRule{}, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{}, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.Role{}}, {Verbs: sets.NewString("update"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}}, }, expectedCovered: true, expectedUncoveredRules: []authorizationapi.PolicyRule{}, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("pods")}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.Role{}}, {Verbs: sets.NewString("update"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}}, {Verbs: sets.NewString("delete"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.ClusterRole{}}, {Verbs: sets.NewString("impersonate"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.ClusterPolicyBinding{}}, }, expectedCovered: true, expectedUncoveredRules: []authorizationapi.PolicyRule{}, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString(authorizationapi.VerbAll), Resources: sets.NewString(authorizationapi.ResourceAll), AttributeRestrictions: &authorizationapi.Role{}}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.Role{}}, {Verbs: sets.NewString("update"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}}, {Verbs: sets.NewString("delete"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.ClusterRole{}}, {Verbs: sets.NewString("impersonate"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.ClusterPolicyBinding{}}, }, expectedCovered: true, expectedUncoveredRules: []authorizationapi.PolicyRule{}, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds")}, }, expectedCovered: false, expectedUncoveredRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("create"), Resources: sets.NewString("builds")}, }, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("delete"), Resources: sets.NewString("builds"), AttributeRestrictions: &authorizationapi.Role{}}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("delete"), Resources: sets.NewString("builds")}, }, expectedCovered: false, expectedUncoveredRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("delete"), Resources: sets.NewString("builds")}, }, }.test(t) escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString(authorizationapi.VerbAll), Resources: sets.NewString(authorizationapi.ResourceAll), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("delete"), Resources: sets.NewString("builds")}, }, expectedCovered: false, expectedUncoveredRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("delete"), Resources: sets.NewString("builds")}, }, }.test(t) }
explode_data.jsonl/9066
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1779 }
[ 2830, 3393, 3907, 50360, 21439, 30896, 287, 1155, 353, 8840, 836, 8, 341, 80629, 278, 367, 2271, 515, 197, 197, 8118, 26008, 25, 3056, 39554, 2068, 1069, 8018, 11337, 515, 298, 197, 90, 10141, 1279, 25, 7289, 7121, 703, 445, 3182, 397...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClient_DestroyExternalInitiator(t *testing.T) { t.Parallel() app := startNewApplication(t) client, r := app.NewClientAndRenderer() token := auth.NewToken() exi, err := bridges.NewExternalInitiator(token, &bridges.ExternalInitiatorRequest{Name: "name"}, ) require.NoError(t, err) err = app.BridgeORM().CreateExternalInitiator(exi) require.NoError(t, err) set := flag.NewFlagSet("test", 0) set.Parse([]string{exi.Name}) c := cli.NewContext(nil, set, nil) assert.NoError(t, client.DeleteExternalInitiator(c)) assert.Empty(t, r.Renders) }
explode_data.jsonl/5267
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 2959, 79266, 25913, 3803, 36122, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 1669, 1191, 3564, 4988, 1155, 340, 25291, 11, 435, 1669, 906, 7121, 2959, 3036, 11541, 2822, 43947, 1669, 4166, 7121, 3323, 741, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1