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 TestGenModel_Issue381(t *testing.T) {
specDoc, err := loads.Spec("../fixtures/codegen/todolist.models.yml")
require.NoError(t, err)
definitions := specDoc.Spec().Definitions
k := "flags_list"
opts := opts()
genModel, err := makeGenDefinition(k, "models", definitions[k], specDoc, opts)
require.NoError(t, err)
buf := bytes.NewBuffer(nil)
require.NoError(t, opts.templates.MustGet("model").Execute(buf, genModel))
ct, err := opts.LanguageOpts.FormatContent("flags_list.go", buf.Bytes())
require.NoError(t, err)
res := string(ct)
assertNotInCode(t, "m[i] != nil", res)
} | explode_data.jsonl/2544 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 225
} | [
2830,
3393,
9967,
1712,
7959,
83890,
18,
23,
16,
1155,
353,
8840,
836,
8,
341,
98100,
9550,
11,
1848,
1669,
20907,
36473,
17409,
45247,
46928,
4370,
5523,
347,
34675,
8235,
33936,
1138,
17957,
35699,
1155,
11,
1848,
692,
7452,
4054,
82,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAdoption(t *testing.T) {
boolPtr := func(b bool) *bool { return &b }
testCases := []struct {
name string
existingOwnerReferences func(rs *apps.ReplicaSet) []metav1.OwnerReference
expectedOwnerReferences func(rs *apps.ReplicaSet) []metav1.OwnerReference
}{
{
"pod refers rs as an owner, not a controller",
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{{UID: rs.UID, Name: rs.Name, APIVersion: "apps/v1", Kind: "ReplicaSet"}}
},
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{{UID: rs.UID, Name: rs.Name, APIVersion: "apps/v1", Kind: "ReplicaSet", Controller: boolPtr(true), BlockOwnerDeletion: boolPtr(true)}}
},
},
{
"pod doesn't have owner references",
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{}
},
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{{UID: rs.UID, Name: rs.Name, APIVersion: "apps/v1", Kind: "ReplicaSet", Controller: boolPtr(true), BlockOwnerDeletion: boolPtr(true)}}
},
},
{
"pod refers rs as a controller",
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{{UID: rs.UID, Name: rs.Name, APIVersion: "apps/v1", Kind: "ReplicaSet", Controller: boolPtr(true)}}
},
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{{UID: rs.UID, Name: rs.Name, APIVersion: "apps/v1", Kind: "ReplicaSet", Controller: boolPtr(true)}}
},
},
{
"pod refers other rs as the controller, refers the rs as an owner",
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{
{UID: "1", Name: "anotherRS", APIVersion: "apps/v1", Kind: "ReplicaSet", Controller: boolPtr(true)},
{UID: rs.UID, Name: rs.Name, APIVersion: "apps/v1", Kind: "ReplicaSet"},
}
},
func(rs *apps.ReplicaSet) []metav1.OwnerReference {
return []metav1.OwnerReference{
{UID: "1", Name: "anotherRS", APIVersion: "apps/v1", Kind: "ReplicaSet", Controller: boolPtr(true)},
{UID: rs.UID, Name: rs.Name, APIVersion: "apps/v1", Kind: "ReplicaSet"},
}
},
},
}
for i, tc := range testCases {
func() {
s, closeFn, rm, informers, clientSet := rmSetup(t)
defer closeFn()
ns := framework.CreateTestingNamespace(fmt.Sprintf("rs-adoption-%d", i), s, t)
defer framework.DeleteTestingNamespace(ns, s, t)
rsClient := clientSet.AppsV1().ReplicaSets(ns.Name)
podClient := clientSet.CoreV1().Pods(ns.Name)
const rsName = "rs"
rs, err := rsClient.Create(newRS(rsName, ns.Name, 1))
if err != nil {
t.Fatalf("Failed to create replica set: %v", err)
}
podName := fmt.Sprintf("pod%d", i)
pod := newMatchingPod(podName, ns.Name)
pod.OwnerReferences = tc.existingOwnerReferences(rs)
_, err = podClient.Create(pod)
if err != nil {
t.Fatalf("Failed to create Pod: %v", err)
}
stopCh := runControllerAndInformers(t, rm, informers, 1)
defer close(stopCh)
if err := wait.PollImmediate(interval, timeout, func() (bool, error) {
updatedPod, err := podClient.Get(pod.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
e, a := tc.expectedOwnerReferences(rs), updatedPod.OwnerReferences
if reflect.DeepEqual(e, a) {
return true, nil
}
t.Logf("ownerReferences don't match, expect %v, got %v", e, a)
return false, nil
}); err != nil {
t.Fatalf("test %q failed: %v", tc.name, err)
}
}()
}
} | explode_data.jsonl/40112 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1480
} | [
2830,
3393,
2589,
2047,
1155,
353,
8840,
836,
8,
341,
7562,
5348,
1669,
2915,
1883,
1807,
8,
353,
2641,
314,
470,
609,
65,
456,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
503,
914,
198,
197,
8122,
11083,
13801,
31712,
2915,
1702... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIPv6ReceiveControl(t *testing.T) {
newUint16 := func(v uint16) *uint16 { return &v }
const mtu = 0xffff
cases := []struct {
name string
expectedCount int
fragmentOffset *uint16
typ header.ICMPv6Type
code uint8
expectedTyp stack.ControlType
expectedExtra uint32
trunc int
}{
{"PacketTooBig", 1, nil, header.ICMPv6PacketTooBig, 0, stack.ControlPacketTooBig, mtu, 0},
{"Truncated (10 bytes missing)", 0, nil, header.ICMPv6PacketTooBig, 0, stack.ControlPacketTooBig, mtu, 10},
{"Truncated (missing IPv6 header)", 0, nil, header.ICMPv6PacketTooBig, 0, stack.ControlPacketTooBig, mtu, header.IPv6MinimumSize + 8},
{"Truncated PacketTooBig (missing 'extra info')", 0, nil, header.ICMPv6PacketTooBig, 0, stack.ControlPacketTooBig, mtu, 4 + header.IPv6MinimumSize + 8},
{"Truncated (missing ICMP header)", 0, nil, header.ICMPv6PacketTooBig, 0, stack.ControlPacketTooBig, mtu, header.ICMPv6PacketTooBigMinimumSize + header.IPv6MinimumSize + 8},
{"Port unreachable", 1, nil, header.ICMPv6DstUnreachable, header.ICMPv6PortUnreachable, stack.ControlPortUnreachable, 0, 0},
{"Truncated DstUnreachable (missing 'extra info')", 0, nil, header.ICMPv6DstUnreachable, header.ICMPv6PortUnreachable, stack.ControlPortUnreachable, 0, 4 + header.IPv6MinimumSize + 8},
{"Fragmented, zero offset", 1, newUint16(0), header.ICMPv6DstUnreachable, header.ICMPv6PortUnreachable, stack.ControlPortUnreachable, 0, 0},
{"Non-zero fragment offset", 0, newUint16(100), header.ICMPv6DstUnreachable, header.ICMPv6PortUnreachable, stack.ControlPortUnreachable, 0, 0},
{"Zero-length packet", 0, nil, header.ICMPv6DstUnreachable, header.ICMPv6PortUnreachable, stack.ControlPortUnreachable, 0, 2*header.IPv6MinimumSize + header.ICMPv6DstUnreachableMinimumSize + 8},
}
r := stack.Route{
LocalAddress: "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01",
RemoteAddress: "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa",
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
var views [1]buffer.View
o := testObject{t: t}
proto := ipv6.NewProtocol()
ep, err := proto.NewEndpoint(1, "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", nil, &o, nil)
if err != nil {
t.Fatalf("NewEndpoint failed: %v", err)
}
defer ep.Close()
dataOffset := header.IPv6MinimumSize*2 + header.ICMPv6MinimumSize + 4
if c.fragmentOffset != nil {
dataOffset += header.IPv6FragmentHeaderSize
}
view := buffer.NewView(dataOffset + 8)
// Create the outer IPv6 header.
ip := header.IPv6(view)
ip.Encode(&header.IPv6Fields{
PayloadLength: uint16(len(view) - header.IPv6MinimumSize - c.trunc),
NextHeader: uint8(header.ICMPv6ProtocolNumber),
HopLimit: 20,
SrcAddr: "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa",
DstAddr: "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01",
})
// Create the ICMP header.
icmp := header.ICMPv6(view[header.IPv6MinimumSize:])
icmp.SetType(c.typ)
icmp.SetCode(c.code)
copy(view[header.IPv6MinimumSize+header.ICMPv6MinimumSize:], []byte{0xde, 0xad, 0xbe, 0xef})
// Create the inner IPv6 header.
ip = header.IPv6(view[header.IPv6MinimumSize+header.ICMPv6MinimumSize+4:])
ip.Encode(&header.IPv6Fields{
PayloadLength: 100,
NextHeader: 10,
HopLimit: 20,
SrcAddr: "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01",
DstAddr: "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02",
})
// Build the fragmentation header if needed.
if c.fragmentOffset != nil {
ip.SetNextHeader(header.IPv6FragmentHeader)
frag := header.IPv6Fragment(view[2*header.IPv6MinimumSize+header.ICMPv6MinimumSize+4:])
frag.Encode(&header.IPv6FragmentFields{
NextHeader: 10,
FragmentOffset: *c.fragmentOffset,
M: true,
Identification: 0x12345678,
})
}
// Make payload be non-zero.
for i := dataOffset; i < len(view); i++ {
view[i] = uint8(i)
}
// Give packet to IPv6 endpoint, dispatcher will validate that
// it's ok.
o.protocol = 10
o.srcAddr = "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02"
o.dstAddr = "\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"
o.contents = view[dataOffset:]
o.typ = c.expectedTyp
o.extra = c.expectedExtra
vv := view.ToVectorisedView(views)
vv.CapLength(len(view) - c.trunc)
ep.HandlePacket(&r, &vv)
if want := c.expectedCount; o.controlCalls != want {
t.Fatalf("Bad number of control calls for %q case: got %v, want %v", c.name, o.controlCalls, want)
}
})
}
} | explode_data.jsonl/53352 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2257
} | [
2830,
3393,
58056,
21,
14742,
3273,
1155,
353,
8840,
836,
8,
341,
8638,
21570,
16,
21,
1669,
2915,
3747,
2622,
16,
21,
8,
353,
2496,
16,
21,
314,
470,
609,
85,
555,
4777,
11965,
84,
284,
220,
15,
20518,
198,
1444,
2264,
1669,
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... | 1 |
func TestAlbumDetail(t *testing.T) {
Convey("get AlbumDetail", t, func() {
_, err := dao.AlbumDetail(ctx(), 27515258, []int64{27515258})
err = nil
So(err, ShouldBeNil)
})
} | explode_data.jsonl/51617 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 81
} | [
2830,
3393,
32378,
10649,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
455,
25665,
10649,
497,
259,
11,
2915,
368,
341,
197,
197,
6878,
1848,
1669,
24775,
9636,
5377,
10649,
7502,
1507,
220,
17,
22,
20,
16,
20,
17,
20,
23,
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 TestDoubleDataPoint_LabelsMap(t *testing.T) {
ms := NewDoubleDataPoint()
ms.InitEmpty()
assert.EqualValues(t, NewStringMap(), ms.LabelsMap())
fillTestStringMap(ms.LabelsMap())
testValLabelsMap := generateTestStringMap()
assert.EqualValues(t, testValLabelsMap, ms.LabelsMap())
} | explode_data.jsonl/19539 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 103
} | [
2830,
3393,
7378,
1043,
2609,
53557,
82,
2227,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
7378,
1043,
2609,
741,
47691,
26849,
3522,
741,
6948,
12808,
6227,
1155,
11,
1532,
703,
2227,
1507,
9829,
4679,
82,
2227,
2398,
65848,
2271,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestReturnsCredentials(t *testing.T) {
defer leaktest.Check(t)()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
const roleName = "running_role"
source := kt.NewFakeControllerSource()
defer source.Shutdown()
source.Add(testutil.NewPodWithRole("ns", "name", "192.168.0.1", "Running", roleName))
podCache := k8s.NewPodCache(sts.DefaultResolver("arn:account:"), source, time.Second, defaultBuffer)
podCache.Run(ctx)
server := &KiamServer{pods: podCache, assumePolicy: &allowPolicy{}, credentialsProvider: &stubCredentialsProvider{accessKey: "A1234"}, arnResolver: sts.DefaultResolver("prefix")}
creds, err := server.GetPodCredentials(ctx, &pb.GetPodCredentialsRequest{Ip: "192.168.0.1", Role: roleName})
if err != nil {
t.Error("unexpected error", err)
}
if creds == nil {
t.Fatal("credentials were nil")
}
if creds.AccessKeyId != "A1234" {
t.Error("unexpected access key", creds.AccessKeyId)
}
} | explode_data.jsonl/43098 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 345
} | [
2830,
3393,
16446,
27025,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
10600,
1155,
8,
2822,
20985,
11,
9121,
1669,
2266,
26124,
9269,
5378,
19047,
2398,
16867,
9121,
2822,
4777,
90947,
284,
330,
27173,
19792,
1837,
47418,
1669,
1854... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIfElseRetVal(t *testing.T) {
const SCRIPT = `
var x;
if (x === undefined) {
"passed";
} else {
"failed";
}
`
testScript1(SCRIPT, asciiString("passed"), t)
} | explode_data.jsonl/75232 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 80
} | [
2830,
3393,
2679,
22971,
95200,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
2405,
856,
280,
743,
320,
87,
2049,
5614,
8,
341,
197,
197,
1,
35422,
876,
197,
92,
770,
341,
197,
197,
1,
16091,
876,
197,
532,
197,
19324,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestWhen_UnmarshalYAML(t *testing.T) {
for _, tt := range unmarshalTests {
w := When{}
if err := yaml.Unmarshal([]byte(tt.input), &w); err != nil {
t.Errorf(
`Unmarshalling %s: unexpected error: %s`,
tt.desc, err,
)
continue
}
expected := tt.expected.String()
actual := w.String()
if expected != actual {
t.Errorf("want %q, got %q", expected, actual)
}
}
} | explode_data.jsonl/17478 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 182
} | [
2830,
3393,
4498,
40687,
27121,
56,
31102,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17853,
1669,
2088,
650,
27121,
18200,
341,
197,
6692,
1669,
3197,
16094,
197,
743,
1848,
1669,
32246,
38097,
10556,
3782,
47152,
10046,
701,
609,
86,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestJob_Upload(t *testing.T) {
type fields struct {
session session.ServiceFormatter
info Response
}
type args struct {
body io.Reader
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
{
name: "Passing",
fields: fields{
info: Response{
ID: "1234",
},
session: &mockSessionFormatter{
url: "https://test.salesforce.com",
client: mockHTTPClient(func(req *http.Request) *http.Response {
if req.URL.String() != "https://test.salesforce.com/jobs/ingest/1234/batches" {
return &http.Response{
StatusCode: 500,
Status: "Invalid URL",
Body: ioutil.NopCloser(strings.NewReader(req.URL.String())),
Header: make(http.Header),
}
}
if req.Method != http.MethodPut {
return &http.Response{
StatusCode: 500,
Status: "Invalid Method",
Body: ioutil.NopCloser(strings.NewReader(req.Method)),
Header: make(http.Header),
}
}
return &http.Response{
StatusCode: http.StatusCreated,
Status: "Good",
Body: ioutil.NopCloser(strings.NewReader("")),
Header: make(http.Header),
}
}),
},
},
args: args{
body: strings.NewReader("some reader"),
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
j := &Job{
session: tt.fields.session,
info: tt.fields.info,
}
if err := j.Upload(tt.args.body); (err != nil) != tt.wantErr {
t.Errorf("Job.Upload() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
} | explode_data.jsonl/19885 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 823
} | [
2830,
3393,
12245,
62,
13844,
1155,
353,
8840,
836,
8,
341,
13158,
5043,
2036,
341,
197,
25054,
3797,
13860,
14183,
198,
197,
27043,
262,
5949,
198,
197,
532,
13158,
2827,
2036,
341,
197,
35402,
6399,
47431,
198,
197,
532,
78216,
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 TestApplyFieldPaths(t *testing.T) {
submap := mapval(map[string]*pb.Value{
"b": intval(1),
"c": intval(2),
})
fields := map[string]*pb.Value{
"a": submap,
"d": intval(3),
}
for _, test := range []struct {
fps []FieldPath
want map[string]*pb.Value
}{
{nil, nil},
{[]FieldPath{[]string{"z"}}, nil},
{[]FieldPath{[]string{"a"}}, map[string]*pb.Value{"a": submap}},
{[]FieldPath{[]string{"a", "b", "c"}}, nil},
{[]FieldPath{[]string{"d"}}, map[string]*pb.Value{"d": intval(3)}},
{
[]FieldPath{[]string{"d"}, []string{"a", "c"}},
map[string]*pb.Value{
"a": mapval(map[string]*pb.Value{"c": intval(2)}),
"d": intval(3),
},
},
} {
got := applyFieldPaths(fields, test.fps, nil)
if !testEqual(got, test.want) {
t.Errorf("%v:\ngot %v\nwant \n%v", test.fps, got, test.want)
}
}
} | explode_data.jsonl/15822 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 402
} | [
2830,
3393,
28497,
1877,
26901,
1155,
353,
8840,
836,
8,
341,
28624,
2186,
1669,
2415,
831,
9147,
14032,
8465,
16650,
6167,
515,
197,
197,
1,
65,
788,
26217,
7,
16,
1326,
197,
197,
96946,
788,
26217,
7,
17,
1326,
197,
3518,
55276,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCache_Remove(t *testing.T) {
type fields struct {
m *collect.SafeMap
}
type args struct {
id string
}
tests := []struct {
name string
fields fields
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &Cache{
m: tt.fields.m,
}
c.Remove(tt.args.id)
})
}
} | explode_data.jsonl/59942 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 169
} | [
2830,
3393,
8233,
66843,
1155,
353,
8840,
836,
8,
341,
13158,
5043,
2036,
341,
197,
2109,
353,
17384,
89828,
2227,
198,
197,
532,
13158,
2827,
2036,
341,
197,
15710,
914,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
256,
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 TestConfigurableSleeper(t *testing.T) {
sleepTime := 5 * time.Second
spyTime := &SpyTime{}
sleeper := ConfigurableSleeper{sleepTime, spyTime.Sleep}
sleeper.Sleep()
if spyTime.durationSlept != sleepTime {
t.Errorf("should have slept for %v but slept for %v", sleepTime, spyTime.durationSlept)
}
} | explode_data.jsonl/17769 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 127
} | [
2830,
3393,
2648,
18329,
50,
8501,
712,
1155,
353,
8840,
836,
8,
341,
262,
6084,
1462,
1669,
220,
20,
353,
882,
32435,
271,
262,
21236,
1462,
1669,
609,
44027,
1462,
16094,
262,
82547,
1669,
5532,
18329,
50,
8501,
712,
90,
25809,
1462... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTx_CopyFile(t *testing.T) {
db := MustOpenDB()
defer db.MustClose()
path := tempfile()
if err := db.Update(func(tx *bolt.Tx) error {
b, err := tx.CreateBucket([]byte("widgets"))
if err != nil {
t.Fatal(err)
}
if err := b.Put([]byte("foo"), []byte("bar")); err != nil {
t.Fatal(err)
}
if err := b.Put([]byte("baz"), []byte("bat")); err != nil {
t.Fatal(err)
}
return nil
}); err != nil {
t.Fatal(err)
}
if err := db.View(func(tx *bolt.Tx) error {
return tx.CopyFile(path, 0600)
}); err != nil {
t.Fatal(err)
}
db2, err := bolt.Open(path, 0600, nil)
if err != nil {
t.Fatal(err)
}
if err := db2.View(func(tx *bolt.Tx) error {
if v := tx.Bucket([]byte("widgets")).Get([]byte("foo")); !bytes.Equal(v, []byte("bar")) {
t.Fatalf("unexpected value: %v", v)
}
if v := tx.Bucket([]byte("widgets")).Get([]byte("baz")); !bytes.Equal(v, []byte("bat")) {
t.Fatalf("unexpected value: %v", v)
}
return nil
}); err != nil {
t.Fatal(err)
}
if err := db2.Close(); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/1702 | {
"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,
31584,
77637,
1703,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
15465,
5002,
3506,
741,
16867,
2927,
50463,
7925,
2822,
26781,
1669,
54819,
741,
743,
1848,
1669,
2927,
16689,
18552,
27301,
353,
52433,
81362,
8,
1465,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestChannelUnregister(t *testing.T) {
opts := NewOptions()
opts.Logger = newTestLogger(t)
tcpAddr, httpAddr, nsqlookupd := mustStartLookupd(opts)
defer nsqlookupd.Exit()
topics := nsqlookupd.DB.FindRegistrations("topic", "*", "*")
equal(t, len(topics), 0)
topicName := "channel_unregister"
conn := mustConnectLookupd(t, tcpAddr)
defer conn.Close()
tcpPort := 5000
httpPort := 5555
identify(t, conn, "ip.address", tcpPort, httpPort, "fake-version")
nsq.Register(topicName, "ch1").WriteTo(conn)
v, err := nsq.ReadResponse(conn)
equal(t, err, nil)
equal(t, v, []byte("OK"))
topics = nsqlookupd.DB.FindRegistrations("topic", topicName, "")
equal(t, len(topics), 1)
channels := nsqlookupd.DB.FindRegistrations("channel", topicName, "*")
equal(t, len(channels), 1)
nsq.UnRegister(topicName, "ch1").WriteTo(conn)
v, err = nsq.ReadResponse(conn)
equal(t, err, nil)
equal(t, v, []byte("OK"))
topics = nsqlookupd.DB.FindRegistrations("topic", topicName, "")
equal(t, len(topics), 1)
// we should still have mention of the topic even though there is no producer
// (ie. we haven't *deleted* the channel, just unregistered as a producer)
channels = nsqlookupd.DB.FindRegistrations("channel", topicName, "*")
equal(t, len(channels), 1)
endpoint := fmt.Sprintf("http://%s/lookup?topic=%s", httpAddr, topicName)
data, err := http_api.NegotiateV1("GET", endpoint, nil)
equal(t, err, nil)
returnedProducers, err := data.Get("producers").Array()
equal(t, err, nil)
equal(t, len(returnedProducers), 1)
} | explode_data.jsonl/12599 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 601
} | [
2830,
3393,
9629,
1806,
6343,
1155,
353,
8840,
836,
8,
341,
64734,
1669,
1532,
3798,
741,
64734,
12750,
284,
501,
2271,
7395,
1155,
340,
3244,
4672,
13986,
11,
1758,
13986,
11,
12268,
80,
21020,
67,
1669,
1969,
3479,
34247,
67,
30885,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDesCBC(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
key := []byte("11111111")
text := []byte("1234567812345678")
padding := gdes.NOPADDING
iv := []byte("12345678")
result := "40826a5800608c87585ca7c9efabee47"
// encrypt test
cipherText, err := gdes.EncryptCBC(text, key, iv, padding)
t.AssertEQ(err, nil)
t.AssertEQ(hex.EncodeToString(cipherText), result)
// decrypt test
clearText, err := gdes.DecryptCBC(cipherText, key, iv, padding)
t.AssertEQ(err, nil)
t.AssertEQ(string(clearText), "1234567812345678")
// encrypt err test.
errEncrypt, err := gdes.EncryptCBC(text, errKey, iv, padding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
// the iv is err
errEncrypt, err = gdes.EncryptCBC(text, key, errIv, padding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
// the padding is err
errEncrypt, err = gdes.EncryptCBC(text, key, iv, errPadding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
// decrypt err test. the key is err
errDecrypt, err := gdes.DecryptCBC(cipherText, errKey, iv, padding)
t.AssertNE(err, nil)
t.AssertEQ(errDecrypt, nil)
// the iv is err
errDecrypt, err = gdes.DecryptCBC(cipherText, key, errIv, padding)
t.AssertNE(err, nil)
t.AssertEQ(errDecrypt, nil)
// the padding is err
errDecrypt, err = gdes.DecryptCBC(cipherText, key, iv, errPadding)
t.AssertNE(err, nil)
t.AssertEQ(errDecrypt, nil)
})
gtest.C(t, func(t *gtest.T) {
key := []byte("11111111")
text := []byte("12345678")
padding := gdes.PKCS5PADDING
iv := []byte("12345678")
result := "40826a5800608c87100a25d86ac7c52c"
// encrypt test
cipherText, err := gdes.EncryptCBC(text, key, iv, padding)
t.AssertEQ(err, nil)
t.AssertEQ(hex.EncodeToString(cipherText), result)
// decrypt test
clearText, err := gdes.DecryptCBC(cipherText, key, iv, padding)
t.AssertEQ(err, nil)
t.AssertEQ(string(clearText), "12345678")
// err test
errEncrypt, err := gdes.EncryptCBC(text, key, errIv, padding)
t.AssertNE(err, nil)
t.AssertEQ(errEncrypt, nil)
})
} | explode_data.jsonl/61846 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 916
} | [
2830,
3393,
4896,
69972,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
23634,
1669,
3056,
3782,
445,
16,
16,
16,
16,
16,
16,
16,
16,
1138,
197,
15425,
1669,
3056,
3782,
445,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_sqsRepository_GetQueueAttributes(t *testing.T) {
tests := []struct {
name string
mocks func(client *awstest.MockFakeSQS)
want *sqs.GetQueueAttributesOutput
wantErr error
}{
{
name: "get attributes",
mocks: func(client *awstest.MockFakeSQS) {
client.On(
"GetQueueAttributes",
&sqs.GetQueueAttributesInput{
AttributeNames: awssdk.StringSlice([]string{sqs.QueueAttributeNamePolicy}),
QueueUrl: awssdk.String("http://example.com"),
},
).Return(
&sqs.GetQueueAttributesOutput{
Attributes: map[string]*string{
sqs.QueueAttributeNamePolicy: awssdk.String("foobar"),
},
},
nil,
).Once()
},
want: &sqs.GetQueueAttributesOutput{
Attributes: map[string]*string{
sqs.QueueAttributeNamePolicy: awssdk.String("foobar"),
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
store := cache.New(1)
client := &awstest.MockFakeSQS{}
tt.mocks(client)
r := &sqsRepository{
client: client,
cache: store,
}
got, err := r.GetQueueAttributes("http://example.com")
assert.Equal(t, tt.wantErr, err)
if err == nil {
// Check that results were cached
cachedData, err := r.GetQueueAttributes("http://example.com")
assert.NoError(t, err)
assert.Equal(t, got, cachedData)
assert.IsType(t, &sqs.GetQueueAttributesOutput{}, store.Get("sqsGetQueueAttributes_http://example.com"))
}
changelog, err := diff.Diff(got, tt.want)
assert.Nil(t, err)
if len(changelog) > 0 {
for _, change := range changelog {
t.Errorf("%s: %s -> %s", strings.Join(change.Path, "."), change.From, change.To)
}
t.Fail()
}
})
}
} | explode_data.jsonl/27763 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 785
} | [
2830,
3393,
643,
26358,
4624,
13614,
7554,
10516,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
262,
914,
198,
197,
2109,
25183,
256,
2915,
12805,
353,
672,
267,
477,
24664,
52317,
64308,
50,
340,
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... | 1 |
func TestCleanName(t *testing.T) {
testCases := []struct {
givenApplication *applicationv1alpha1.Application
wantName string
}{
// application type label is missing, then use the application name
{
givenApplication: applicationtest.NewApplication("alphanumeric0123", nil),
wantName: "alphanumeric0123",
},
{
givenApplication: applicationtest.NewApplication("alphanumeric0123", map[string]string{"ignore-me": "value"}),
wantName: "alphanumeric0123",
},
{
givenApplication: applicationtest.NewApplication("with.!@#none-$%^alphanumeric_&*-characters", nil),
wantName: "withnonealphanumericcharacters",
},
{
givenApplication: applicationtest.NewApplication("with.!@#none-$%^alphanumeric_&*-characters", map[string]string{"ignore-me": "value"}),
wantName: "withnonealphanumericcharacters",
},
// application type label is available, then use it instead of the application name
{
givenApplication: applicationtest.NewApplication("alphanumeric0123", map[string]string{typeLabel: "apptype"}),
wantName: "apptype",
},
{
givenApplication: applicationtest.NewApplication("with.!@#none-$%^alphanumeric_&*-characters", map[string]string{typeLabel: "apptype"}),
wantName: "apptype",
},
{
givenApplication: applicationtest.NewApplication("alphanumeric0123", map[string]string{typeLabel: "apptype=with.!@#none-$%^alphanumeric_&*-characters"}),
wantName: "apptypewithnonealphanumericcharacters",
},
{
givenApplication: applicationtest.NewApplication("with.!@#none-$%^alphanumeric_&*-characters", map[string]string{typeLabel: "apptype=with.!@#none-$%^alphanumeric_&*-characters"}),
wantName: "apptypewithnonealphanumericcharacters",
},
}
for _, tc := range testCases {
if gotName := CleanName(tc.givenApplication); tc.wantName != gotName {
t.Errorf("Clean application name:[%s] failed, want:[%v] but got:[%v]", tc.givenApplication.Name, tc.wantName, gotName)
}
}
} | explode_data.jsonl/8399 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 748
} | [
2830,
3393,
27529,
675,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
3174,
2071,
4988,
353,
5132,
85,
16,
7141,
16,
17521,
198,
197,
50780,
675,
260,
914,
198,
197,
59403,
197,
197,
322,
3766,
943,
2383,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestNetworkID(t *testing.T) {
if !testutils.IsRunningInContainer() {
defer testutils.SetupTestOSContext(t)()
}
netOption := options.Generic{
netlabel.GenericData: options.Generic{
"BridgeName": "testnetwork",
},
}
n, err := createTestNetwork(bridgeNetType, "testnetwork", netOption, nil, nil)
if err != nil {
t.Fatal(err)
}
defer func() {
if err := n.Delete(); err != nil {
t.Fatal(err)
}
}()
if n.ID() == "" {
t.Fatal("Expected non-empty network id")
}
} | explode_data.jsonl/6355 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 201
} | [
2830,
3393,
12320,
915,
1155,
353,
8840,
836,
8,
341,
743,
753,
1944,
6031,
4506,
18990,
641,
4502,
368,
341,
197,
16867,
1273,
6031,
39820,
2271,
3126,
1972,
1155,
8,
741,
197,
630,
59486,
5341,
1669,
2606,
4341,
515,
197,
59486,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCacheSanity(t *testing.T) {
testCache := &cache{}
request := (&dns.Msg{}).SetQuestion("google.com.", dns.TypeA)
ci, expired, key := testCache.get(request)
assert.Nil(t, ci)
assert.False(t, expired)
assert.Nil(t, key)
} | explode_data.jsonl/18902 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 97
} | [
2830,
3393,
8233,
23729,
487,
1155,
353,
8840,
836,
8,
341,
18185,
8233,
1669,
609,
9360,
16094,
23555,
1669,
15899,
45226,
30365,
6257,
568,
1649,
14582,
445,
17485,
905,
10465,
44077,
10184,
32,
692,
1444,
72,
11,
26391,
11,
1376,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMessageOptionsWithGoTemplate(t *testing.T) {
tests := []struct {
descr string
msgDescs []*descriptorpb.DescriptorProto
schema map[string]openapi_options.Schema // per-message schema to add
defs openapiDefinitionsObject
openAPIOptions *openapiconfig.OpenAPIOptions
useGoTemplate bool
}{
{
descr: "external docs option",
msgDescs: []*descriptorpb.DescriptorProto{
{Name: proto.String("Message")},
},
schema: map[string]openapi_options.Schema{
"Message": {
JsonSchema: &openapi_options.JSONSchema{
Title: "{{.Name}}",
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
},
ExternalDocs: &openapi_options.ExternalDocumentation{
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
},
},
},
defs: map[string]openapiSchemaObject{
"Message": {
schemaCore: schemaCore{
Type: "object",
},
Title: "Message",
Description: `Description "which means nothing"`,
ExternalDocs: &openapiExternalDocumentationObject{
Description: `Description "which means nothing"`,
},
},
},
useGoTemplate: true,
},
{
descr: "external docs option",
msgDescs: []*descriptorpb.DescriptorProto{
{Name: proto.String("Message")},
},
schema: map[string]openapi_options.Schema{
"Message": {
JsonSchema: &openapi_options.JSONSchema{
Title: "{{.Name}}",
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
},
ExternalDocs: &openapi_options.ExternalDocumentation{
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
},
},
},
defs: map[string]openapiSchemaObject{
"Message": {
schemaCore: schemaCore{
Type: "object",
},
Title: "{{.Name}}",
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
ExternalDocs: &openapiExternalDocumentationObject{
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
},
},
},
useGoTemplate: false,
},
{
descr: "registered OpenAPIOption",
msgDescs: []*descriptorpb.DescriptorProto{
{Name: proto.String("Message")},
},
openAPIOptions: &openapiconfig.OpenAPIOptions{
Message: []*openapiconfig.OpenAPIMessageOption{
{
Message: "example.Message",
Option: &openapi_options.Schema{
JsonSchema: &openapi_options.JSONSchema{
Title: "{{.Name}}",
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
},
ExternalDocs: &openapi_options.ExternalDocumentation{
Description: "Description {{with \"which means nothing\"}}{{printf \"%q\" .}}{{end}}",
},
},
},
},
},
defs: map[string]openapiSchemaObject{
"Message": {
schemaCore: schemaCore{
Type: "object",
},
Title: "Message",
Description: `Description "which means nothing"`,
ExternalDocs: &openapiExternalDocumentationObject{
Description: `Description "which means nothing"`,
},
},
},
useGoTemplate: true,
},
}
for _, test := range tests {
t.Run(test.descr, func(t *testing.T) {
msgs := []*descriptor.Message{}
for _, msgdesc := range test.msgDescs {
msgdesc.Options = &descriptorpb.MessageOptions{}
msgs = append(msgs, &descriptor.Message{DescriptorProto: msgdesc})
}
reg := descriptor.NewRegistry()
reg.SetUseGoTemplate(test.useGoTemplate)
file := descriptor.File{
FileDescriptorProto: &descriptorpb.FileDescriptorProto{
SourceCodeInfo: &descriptorpb.SourceCodeInfo{},
Name: proto.String("example.proto"),
Package: proto.String("example"),
Dependency: []string{},
MessageType: test.msgDescs,
EnumType: []*descriptorpb.EnumDescriptorProto{},
Service: []*descriptorpb.ServiceDescriptorProto{},
Options: &descriptorpb.FileOptions{
GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"),
},
},
Messages: msgs,
}
err := reg.Load(&pluginpb.CodeGeneratorRequest{
ProtoFile: []*descriptorpb.FileDescriptorProto{file.FileDescriptorProto},
})
if err != nil {
t.Fatalf("failed to load code generator request: %v", err)
}
msgMap := map[string]*descriptor.Message{}
for _, d := range test.msgDescs {
name := d.GetName()
msg, err := reg.LookupMsg("example", name)
if err != nil {
t.Fatalf("lookup message %v: %v", name, err)
}
msgMap[msg.FQMN()] = msg
if schema, ok := test.schema[name]; ok {
proto.SetExtension(d.Options, openapi_options.E_Openapiv2Schema, &schema)
}
}
if test.openAPIOptions != nil {
if err := reg.RegisterOpenAPIOptions(test.openAPIOptions); err != nil {
t.Fatalf("failed to register OpenAPI options: %s", err)
}
}
refs := make(refMap)
actual := make(openapiDefinitionsObject)
renderMessagesAsDefinition(msgMap, actual, reg, refs, nil)
if !reflect.DeepEqual(actual, test.defs) {
t.Errorf("Expected renderMessagesAsDefinition() to add defs %+v, not %+v", test.defs, actual)
}
})
}
} | explode_data.jsonl/32806 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2341
} | [
2830,
3393,
2052,
3798,
2354,
10850,
7275,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
41653,
81,
688,
914,
198,
197,
21169,
11065,
82,
981,
29838,
53132,
16650,
23548,
6820,
31549,
198,
197,
1903,
3416,
260,
2415,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRoundTrip(t *testing.T) {
intVal := int64(42)
testCases := []struct {
obj interface{}
}{
{
obj: &unstructured.UnstructuredList{
Object: map[string]interface{}{
"kind": "List",
},
// Not testing a list with nil Items because items is a non-optional field and hence
// is always marshaled into an empty array which is not equal to nil when unmarshalled and will fail.
// That is expected.
Items: []unstructured.Unstructured{},
},
},
{
obj: &unstructured.UnstructuredList{
Object: map[string]interface{}{
"kind": "List",
},
Items: []unstructured.Unstructured{
{
Object: map[string]interface{}{
"kind": "Pod",
},
},
},
},
},
{
obj: &unstructured.Unstructured{
Object: map[string]interface{}{
"kind": "Pod",
},
},
},
{
obj: &unstructured.Unstructured{
Object: map[string]interface{}{
"apiVersion": "v1",
"kind": "Foo",
"metadata": map[string]interface{}{
"name": "foo1",
},
},
},
},
{
// This (among others) tests nil map, slice and pointer.
obj: &C{
C: "ccc",
},
},
{
// This (among others) tests empty map and slice.
obj: &C{
A: []A{},
C: "ccc",
E: map[string]int{},
I: []interface{}{},
},
},
{
obj: &C{
A: []A{
{
A: 1,
B: "11",
C: true,
},
{
A: 2,
B: "22",
C: false,
},
},
B: B{
A: A{
A: 3,
B: "33",
},
B: "bbb",
C: map[string]string{
"k1": "v1",
"k2": "v2",
},
D: []string{"s1", "s2"},
},
C: "ccc",
D: &intVal,
E: map[string]int{
"k1": 1,
"k2": 2,
},
F: []bool{true, false, false},
G: []int{1, 2, 5},
H: 3.3,
I: []interface{}{nil, nil, nil},
},
},
{
// Test slice of interface{} with empty slices.
obj: &D{
A: []interface{}{[]interface{}{}, []interface{}{}},
},
},
{
// Test slice of interface{} with different values.
obj: &D{
A: []interface{}{3.0, "3.0", nil},
},
},
}
for i := range testCases {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
doRoundTrip(t, testCases[i].obj)
})
}
} | explode_data.jsonl/77961 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1333
} | [
2830,
3393,
27497,
56352,
1155,
353,
8840,
836,
8,
972,
2084,
2208,
1669,
526,
21,
19,
7,
19,
17,
1218,
18185,
37302,
1669,
3056,
1235,
972,
197,
22671,
3749,
90,
1771,
197,
92,
1666,
197,
197,
1666,
298,
22671,
25,
609,
359,
51143,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ShowJobSpec_Exists(t *testing.T) {
t.Parallel()
app, cleanup := cltest.NewApplication(t, cltest.EthMockRegisterChainID)
defer cleanup()
require.NoError(t, app.Start())
job := cltest.NewJob()
app.Store.CreateJob(&job)
client, r := app.NewClientAndRenderer()
set := flag.NewFlagSet("test", 0)
set.Parse([]string{job.ID.String()})
c := cli.NewContext(nil, set, nil)
require.Nil(t, client.ShowJobSpec(c))
require.Equal(t, 1, len(r.Renders))
assert.Equal(t, job.ID, r.Renders[0].(*presenters.JobSpec).ID)
} | explode_data.jsonl/78836 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 217
} | [
2830,
3393,
2959,
79665,
12245,
8327,
62,
15575,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
28236,
11,
21290,
1669,
1185,
1944,
7121,
4988,
1155,
11,
1185,
1944,
5142,
339,
11571,
8690,
18837,
915,
340,
16867,
21290,
741,
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 TestGetTotal(t *testing.T) {
ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
ctx = OrderBy(ctx, "test", ASC)
ctx = StartPage(ctx, 1, 2)
total := GetTotal(ctx)
t.Log(total)
if total != 0 {
t.Fail()
}
} | explode_data.jsonl/64348 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 96
} | [
2830,
3393,
1949,
7595,
1155,
353,
8840,
836,
8,
341,
20985,
11,
716,
1669,
2266,
26124,
7636,
5378,
19047,
1507,
220,
17,
77053,
32435,
340,
20985,
284,
7217,
1359,
7502,
11,
330,
1944,
497,
19796,
340,
20985,
284,
5145,
2665,
7502,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestCancelUnsynced(t *testing.T) {
b, tmpPath := backend.NewDefaultTmpBackend()
// manually create watchableStore instead of newWatchableStore
// because newWatchableStore automatically calls syncWatchers
// method to sync watchers in unsynced map. We want to keep watchers
// in unsynced to test if syncWatchers works as expected.
s := &watchableStore{
store: NewStore(zap.NewExample(), b, &lease.FakeLessor{}, nil, StoreConfig{}),
unsynced: newWatcherGroup(),
// to make the test not crash from assigning to nil map.
// 'synced' doesn't get populated in this test.
synced: newWatcherGroup(),
}
defer func() {
s.store.Close()
os.Remove(tmpPath)
}()
// Put a key so that we can spawn watchers on that key.
// (testKey in this test). This increases the rev to 1,
// and later we can we set the watcher's startRev to 1,
// and force watchers to be in unsynced.
testKey := []byte("foo")
testValue := []byte("bar")
s.Put(testKey, testValue, lease.NoLease)
w := s.NewWatchStream()
// arbitrary number for watchers
watcherN := 100
// create watcherN of watch ids to cancel
watchIDs := make([]WatchID, watcherN)
for i := 0; i < watcherN; i++ {
// use 1 to keep watchers in unsynced
watchIDs[i], _ = w.Watch(0, testKey, nil, 1)
}
for _, idx := range watchIDs {
if err := w.Cancel(idx); err != nil {
t.Error(err)
}
}
// After running CancelFunc
//
// unsynced should be empty
// because cancel removes watcher from unsynced
if size := s.unsynced.size(); size != 0 {
t.Errorf("unsynced size = %d, want 0", size)
}
} | explode_data.jsonl/67203 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 563
} | [
2830,
3393,
9269,
1806,
12996,
291,
1155,
353,
8840,
836,
8,
341,
2233,
11,
4174,
1820,
1669,
19163,
7121,
3675,
35986,
29699,
2822,
197,
322,
20083,
1855,
3736,
480,
6093,
4518,
315,
501,
14247,
480,
6093,
198,
197,
322,
1576,
501,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSourceRootURL(t *testing.T) {
jsonStr := sourceMapJSON
jsonStr = strings.Replace(jsonStr, "/the/root", "http://the/root", 1)
jsonStr = strings.Replace(jsonStr, "one.js", "../one.js", 1)
smap, err := sourcemap.Parse("", []byte(jsonStr))
if err != nil {
t.Fatal(err)
}
tests := []*sourceMapTest{
{1, 1, "http://the/one.js", "", 1, 1},
{2, 1, "http://the/root/two.js", "", 1, 1},
}
for _, test := range tests {
test.assert(t, smap)
}
} | explode_data.jsonl/42998 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 202
} | [
2830,
3393,
3608,
8439,
3144,
1155,
353,
8840,
836,
8,
341,
30847,
2580,
1669,
2530,
2227,
5370,
198,
30847,
2580,
284,
9069,
20858,
9304,
2580,
11,
3521,
1782,
72074,
497,
330,
1254,
1110,
1782,
72074,
497,
220,
16,
340,
30847,
2580,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLOr1(t *testing.T) {
label1 := NewLabel("a")
code := newBuilder().
Push(true).
JmpIf(exec.JcTrue|exec.JcNotPopMask, label1).
Push(false).
BuiltinOp(exec.Bool, exec.OpLOr).
Label(label1).
Resolve()
ctx := NewContext(code)
ctx.Exec(0, code.Len())
if v := checkPop(ctx); v != true {
t.Fatal("must ret true, ret =", v)
}
_ = label1.Name()
} | explode_data.jsonl/74966 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 166
} | [
2830,
3393,
1593,
81,
16,
1155,
353,
8840,
836,
8,
341,
29277,
16,
1669,
1532,
2476,
445,
64,
1138,
43343,
1669,
501,
3297,
25829,
197,
10025,
1116,
3715,
4292,
197,
17100,
1307,
2679,
46896,
3503,
66,
2514,
91,
11748,
3503,
66,
2623,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateToken(t *testing.T) {
var tests = []struct {
token string
expected bool
}{
{"772ef5.6b6baab1d4a0a171", true},
{".6b6baab1d4a0a171", false},
{"772ef5.", false},
{"772ef5.6b6baab1d4a0a171", true},
{".6b6baab1d4a0a171", false},
{"772ef5.", false},
{"abcdef.1234567890123456@foobar", false},
}
for _, rt := range tests {
err := ValidateToken(rt.token, nil).ToAggregate()
if (err == nil) != rt.expected {
t.Errorf(
"failed ValidateToken:\n\texpected: %t\n\t actual: %t",
rt.expected,
(err == nil),
)
}
}
} | explode_data.jsonl/39218 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 281
} | [
2830,
3393,
17926,
3323,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
1235,
341,
197,
43947,
262,
914,
198,
197,
42400,
1807,
198,
197,
59403,
197,
197,
4913,
22,
22,
17,
823,
20,
13,
21,
65,
21,
4645,
370,
16,
67,
19,
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... | 3 |
func TestAccessApplicationWithCORS(t *testing.T) {
setup()
defer teardown()
handler := func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, r.Method, "GET", "Expected method 'GET', got %s", r.Method)
w.Header().Set("content-type", "application/json")
fmt.Fprintf(w, `{
"success": true,
"errors": [],
"messages": [
],
"result":{
"id": "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
"created_at": "2014-01-01T05:20:00.12345Z",
"updated_at": "2014-01-01T05:20:00.12345Z",
"aud": "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893",
"name": "Admin Site",
"domain": "test.example.com/admin",
"session_duration": "24h",
"cors_headers": {
"allowed_methods": [
"GET"
],
"allowed_origins": [
"https://example.com"
],
"allow_all_headers": true,
"max_age": -1
}
}
}
`)
}
createdAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
want := AccessApplication{
ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
CreatedAt: &createdAt,
UpdatedAt: &updatedAt,
AUD: "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893",
Name: "Admin Site",
Domain: "test.example.com/admin",
SessionDuration: "24h",
CorsHeaders: &AccessApplicationCorsHeaders{
AllowedMethods: []string{"GET"},
AllowedOrigins: []string{"https://example.com"},
AllowAllHeaders: true,
MaxAge: -1,
},
}
mux.HandleFunc("/accounts/"+accountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler)
actual, err := client.AccessApplication(accountID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db")
if assert.NoError(t, err) {
assert.Equal(t, want, actual)
}
mux.HandleFunc("/zones/"+zoneID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler)
actual, err = client.ZoneLevelAccessApplication(zoneID, "480f4f69-1a28-4fdd-9240-1ed29f0ac1db")
if assert.NoError(t, err) {
assert.Equal(t, want, actual)
}
} | explode_data.jsonl/45475 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1133
} | [
2830,
3393,
6054,
4988,
2354,
34,
9821,
1155,
353,
8840,
836,
8,
341,
84571,
741,
16867,
49304,
2822,
53326,
1669,
2915,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
6948,
12808,
1155,
11,
435,
20798,
11,
330,
3806,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetResponseBody(t *testing.T) {
cases := []struct {
name string
url string
want string
errExpected bool
}{
{
name: "read body works",
url: testServerURL,
want: "value doesn't matter as long as it matches",
errExpected: false,
},
{
name: "bad url",
url: "://missing/scheme",
errExpected: true,
},
{
name: "empty url",
url: "",
errExpected: true,
},
}
for _, c := range cases {
c := c
t.Run(c.name, func(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, c.want)
}))
defer ts.Close()
if c.url == testServerURL {
c.url = ts.URL
}
body, err := getResponseBody(c.url)
if err != nil {
if c.errExpected {
return
}
t.Fatal(err)
}
buf, err := ioutil.ReadAll(body)
if err != nil {
t.Fatal(err)
}
got := string(buf)
if got != c.want {
t.Fatalf("Didn't get expected response. got=%v, want=%v", got, c.want)
}
})
}
} | explode_data.jsonl/57758 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 567
} | [
2830,
3393,
1949,
29637,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
11609,
286,
914,
198,
197,
19320,
260,
914,
198,
197,
50780,
286,
914,
198,
197,
9859,
18896,
1807,
198,
197,
59403,
197,
197,
515,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPart2Example(t *testing.T) {
n, err := ParseNotes(strings.NewReader(`class: 0-1 or 4-19
row: 0-5 or 8-19
seat: 0-13 or 16-19
your ticket:
11,12,13
nearby tickets:
3,9,18
15,1,5
5,14,9`))
if err != nil {
t.Fatal(err)
}
got, err := n.IdentifyFields()
if err != nil {
t.Fatal(err)
}
want := map[string]int{"row": 0, "class": 1, "seat": 2}
if !reflect.DeepEqual(got, want) {
t.Errorf("Got %+v, want %+v", got, want)
}
} | explode_data.jsonl/8835 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 214
} | [
2830,
3393,
5800,
17,
13314,
1155,
353,
8840,
836,
8,
341,
9038,
11,
1848,
1669,
14775,
21667,
51442,
68587,
5809,
1040,
25,
220,
15,
12,
16,
476,
220,
19,
12,
16,
24,
198,
651,
25,
220,
15,
12,
20,
476,
220,
23,
12,
16,
24,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLocale(t *testing.T) {
trans := New()
expected := "el_GR"
if trans.Locale() != expected {
t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
}
} | explode_data.jsonl/10316 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 70
} | [
2830,
3393,
19231,
1155,
353,
8840,
836,
8,
1476,
72453,
1669,
1532,
741,
42400,
1669,
330,
301,
17874,
1837,
743,
1356,
59094,
368,
961,
3601,
341,
197,
3244,
13080,
445,
18896,
7677,
82,
6,
24528,
7677,
82,
22772,
3601,
11,
1356,
59... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestGetWithdrawnPath(t *testing.T) {
attrs := []bgp.PathAttributeInterface{
bgp.NewPathAttributeOrigin(0),
}
p1 := NewPath(nil, bgp.NewIPAddrPrefix(24, "13.2.3.0"), false, attrs, time.Now(), false)
p2 := NewPath(nil, bgp.NewIPAddrPrefix(24, "13.2.4.0"), false, attrs, time.Now(), false)
p3 := NewPath(nil, bgp.NewIPAddrPrefix(24, "13.2.5.0"), false, attrs, time.Now(), false)
u := &Update{
KnownPathList: []*Path{p2},
OldKnownPathList: []*Path{p1, p2, p3},
}
l := u.GetWithdrawnPath()
assert.Equal(t, len(l), 2)
assert.Equal(t, l[0].GetNlri(), p1.GetNlri())
} | explode_data.jsonl/14527 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 271
} | [
2830,
3393,
1949,
92261,
77,
1820,
1155,
353,
8840,
836,
8,
341,
197,
20468,
1669,
3056,
12220,
79,
17474,
3907,
5051,
515,
197,
2233,
21888,
7121,
1820,
3907,
13298,
7,
15,
1326,
197,
532,
3223,
16,
1669,
1532,
1820,
27907,
11,
8951,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidate_gte(t *testing.T) {
assert := assert.New(t)
type User struct {
Age *int64 `validate:"gte=2"`
}
assert.NoError(
v.Validate(User{}, valis.EachFields(tagrule.Validate)),
)
assert.EqualError(
v.Validate(User{Age: henge.ToIntPtr(1)}, valis.EachFields(tagrule.Validate)),
"(gte) .Age must be greater than or equal to 2",
)
assert.NoError(
v.Validate(User{Age: henge.ToIntPtr(2)}, valis.EachFields(tagrule.Validate)),
)
assert.NoError(
v.Validate(User{Age: henge.ToIntPtr(20)}, valis.EachFields(tagrule.Validate)),
)
} | explode_data.jsonl/17252 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 241
} | [
2830,
3393,
17926,
1889,
665,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
13158,
2657,
2036,
341,
197,
197,
16749,
353,
396,
21,
19,
1565,
7067,
2974,
55067,
28,
17,
8805,
197,
532,
6948,
35699,
1006,
197,
5195,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNotContainsWrapper(t *testing.T) {
assert := New(new(testing.T))
if !assert.NotContains("Hello World", "Hello!") {
t.Error("NotContains should return true: \"Hello World\" does not contain \"Hello!\"")
}
if assert.NotContains("Hello World", "Hello") {
t.Error("NotContains should return false: \"Hello World\" contains \"Hello\"")
}
} | explode_data.jsonl/54973 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 119
} | [
2830,
3393,
2623,
23805,
11542,
1155,
353,
8840,
836,
8,
1476,
6948,
1669,
1532,
1755,
8623,
287,
836,
4390,
743,
753,
2207,
15000,
23805,
445,
9707,
4337,
497,
330,
9707,
88783,
341,
197,
3244,
6141,
445,
2623,
23805,
1265,
470,
830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_in(t *testing.T) {
resource := &resource{}
eResource := &emptyResource{}
var tests = []struct {
input []byte
output []byte
}{
{
[]byte(`{"source":{},"params":{},"version":null}`),
[]byte(`{"version":{"c":"d"},"metadata":[{"name":"e","value":"f"}]}`),
},
{
[]byte(`{"source":{},"params":{},"version":{"a":"b"}}`),
[]byte(`{"version":{"c":"d"},"metadata":[{"name":"e","value":"f"}]}`),
},
{
[]byte(`{"source":{"a":"b"},"params":{"x":"y"},"version":{"a":"b"}}`),
[]byte(`{"version":{"c":"d"},"metadata":[{"name":"e","value":"f"}]}`),
},
{
[]byte(`{"source":{"a":"b"},"params":{"x":"y"},"version":null}`),
[]byte(`{"version":{"c":"d"},"metadata":[{"name":"e","value":"f"}]}`),
},
}
for _, test := range tests {
output, _ := in(resource, "foo", test.input)
assert.Equal(t, output, test.output)
}
tests = []struct {
input []byte
output []byte
}{
{
[]byte(`{"source":{},"version":null}`),
[]byte(`{"version":{},"metadata":[]}`),
},
}
for _, test := range tests {
output, _ := in(eResource, "foo", test.input)
assert.Equal(t, output, test.output)
}
} | explode_data.jsonl/15555 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 475
} | [
2830,
3393,
1243,
1155,
353,
8840,
836,
8,
341,
50346,
1669,
609,
9233,
16094,
7727,
4783,
1669,
609,
3194,
4783,
31483,
2405,
7032,
284,
3056,
1235,
341,
197,
22427,
220,
3056,
3782,
198,
197,
21170,
3056,
3782,
198,
197,
59403,
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... | 3 |
func TestCodeConvert(t *testing.T) {
var table = map[codes.Code]ecode.Code{
codes.OK: ecode.OK,
// codes.Canceled
codes.Unknown: ecode.ServerErr,
codes.InvalidArgument: ecode.RequestErr,
codes.DeadlineExceeded: ecode.Deadline,
codes.NotFound: ecode.NothingFound,
// codes.AlreadyExists
codes.PermissionDenied: ecode.AccessDenied,
codes.ResourceExhausted: ecode.LimitExceed,
// codes.FailedPrecondition
// codes.Aborted
// codes.OutOfRange
codes.Unimplemented: ecode.MethodNotAllowed,
codes.Unavailable: ecode.ServiceUnavailable,
// codes.DataLoss
codes.Unauthenticated: ecode.Unauthorized,
}
for k, v := range table {
assert.Equal(t, toECode(status.New(k, "-500")), v)
}
for k, v := range table {
assert.Equal(t, togRPCCode(v), k, fmt.Sprintf("togRPC code error: %d -> %d", v, k))
}
} | explode_data.jsonl/58600 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 360
} | [
2830,
3393,
2078,
12012,
1155,
353,
8840,
836,
8,
341,
2405,
1965,
284,
2415,
12447,
2539,
20274,
60,
757,
534,
20274,
515,
197,
1444,
2539,
15480,
25,
384,
1851,
15480,
345,
197,
197,
322,
13912,
727,
38392,
198,
197,
1444,
2539,
699... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDuration(t *testing.T) {
testCases := []struct {
s string
d time.Duration
}{
{s: "1s", d: time.Second},
{s: "never", d: 0},
{s: "'1m'", d: time.Minute},
}
for i, tc := range testCases {
comment := fmt.Sprintf("test case %v", i)
conf, err := ReadFromString(base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf(`
teleport:
advertise_ip: 10.10.10.1
auth_service:
enabled: yes
client_idle_timeout: %v
`, tc.s))))
require.NoError(t, err, comment)
require.Equal(t, tc.d, conf.Auth.ClientIdleTimeout.Value(), comment)
}
} | explode_data.jsonl/47159 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 238
} | [
2830,
3393,
12945,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
1903,
914,
198,
197,
2698,
882,
33795,
198,
197,
59403,
197,
197,
84386,
25,
330,
16,
82,
497,
294,
25,
882,
32435,
1583,
197,
197,
84386,
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 TestQuickQueueIsEmpty(t *testing.T) {
q := NewQuickQueue()
q.Add(5)
q.Add(6)
assert.False(t, q.IsEmpty())
assert.Equal(t, 5, q.Poll())
assert.Equal(t, 6, q.Peek())
q.Clear()
assert.Equal(t, 0, q.Len())
assert.True(t, q.IsEmpty())
} | explode_data.jsonl/42916 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 118
} | [
2830,
3393,
24318,
7554,
91307,
1155,
353,
8840,
836,
8,
341,
18534,
1669,
1532,
24318,
7554,
741,
18534,
1904,
7,
20,
340,
18534,
1904,
7,
21,
340,
6948,
50757,
1155,
11,
2804,
54723,
12367,
6948,
12808,
1155,
11,
220,
20,
11,
2804,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRecycleMultiSync(t *testing.T) {
tests := []controllerTest{
{
// recycle failure - recycle returns error. The controller should
// try again.
"7-1 - recycle returns error",
newVolumeArray("volume7-1", "1Gi", "uid7-1", "claim7-1", v1.VolumeBound, v1.PersistentVolumeReclaimRecycle, classEmpty),
newVolumeArray("volume7-1", "1Gi", "", "claim7-1", v1.VolumeAvailable, v1.PersistentVolumeReclaimRecycle, classEmpty),
noclaims,
noclaims,
[]string{"Warning VolumeFailedRecycle"}, noerrors,
wrapTestWithReclaimCalls(operationRecycle, []error{errors.New("Mock recycle error"), nil}, testSyncVolume),
},
}
runMultisyncTests(t, tests, []*storage.StorageClass{}, "")
} | explode_data.jsonl/19332 | {
"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,
3820,
5449,
20358,
12154,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
7152,
2271,
515,
197,
197,
515,
298,
197,
322,
60743,
7901,
481,
60743,
4675,
1465,
13,
576,
6461,
1265,
198,
298,
197,
322,
1430,
1549,
624,
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... | 1 |
func TestDefaultRedundancyUsedWhenOmitted(t *testing.T) {
cluster := &logging.ClusterLogging{
Spec: logging.ClusterLoggingSpec{
LogStore: &logging.LogStoreSpec{
Type: "elasticsearch",
ElasticsearchSpec: logging.ElasticsearchSpec{},
},
},
}
cr := &ClusterLoggingRequest{
Cluster: cluster,
}
existing := &elasticsearch.Elasticsearch{}
elasticsearchCR := cr.newElasticsearchCR("test-app-name", existing)
if !reflect.DeepEqual(elasticsearchCR.Spec.RedundancyPolicy, elasticsearch.ZeroRedundancy) {
t.Errorf("Exp. the redundancyPolicy to be %q but was %q", elasticsearch.ZeroRedundancy, elasticsearchCR.Spec.RedundancyPolicy)
}
} | explode_data.jsonl/72374 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 251
} | [
2830,
3393,
3675,
6033,
1241,
6572,
22743,
4498,
46,
5483,
1155,
353,
8840,
836,
8,
341,
197,
18855,
1669,
609,
25263,
72883,
34575,
515,
197,
7568,
992,
25,
8392,
72883,
34575,
8327,
515,
298,
24201,
6093,
25,
609,
25263,
5247,
6093,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSyncResourceByLabel(t *testing.T) {
Given(t).
Path(guestbookPath).
When().
CreateApp().
Sync().
Then().
And(func(app *Application) {
_, _ = RunCli("app", "sync", app.Name, "--label", fmt.Sprintf("app.kubernetes.io/instance=%s", app.Name))
}).
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
_, err := RunCli("app", "sync", app.Name, "--label", "this-label=does-not-exist")
assert.Error(t, err)
assert.Contains(t, err.Error(), "level=fatal")
})
} | explode_data.jsonl/35639 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 219
} | [
2830,
3393,
12154,
4783,
1359,
2476,
1155,
353,
8840,
836,
8,
341,
9600,
2071,
1155,
4292,
197,
69640,
3268,
3045,
2190,
1820,
4292,
197,
197,
4498,
25829,
197,
75569,
2164,
25829,
197,
7568,
1721,
25829,
197,
197,
12209,
25829,
197,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetApp(t *testing.T) {
app = nil
n := GetApp()
if n == nil {
t.Errorf("should return an app")
}
MiddlewareStack = []negroni.Handler{}
} | explode_data.jsonl/51056 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 63
} | [
2830,
3393,
1949,
2164,
1155,
353,
8840,
836,
8,
341,
28236,
284,
2092,
198,
9038,
1669,
2126,
2164,
741,
743,
308,
621,
2092,
341,
197,
3244,
13080,
445,
5445,
470,
458,
906,
1138,
197,
532,
9209,
11603,
4336,
284,
3056,
28775,
2248,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFilesInOptOutConfigRedacted(t *testing.T) {
testPath := []*ipb.FileSet{testconfigcreator.SingleFileWithPath(testFilePath)}
testCases := []struct {
desc string
fileCheck *ipb.FileCheck
optOutConfig *apb.OptOutConfig
expectedResult *apb.ComplianceResult
}{
{
desc: "content not displayed",
fileCheck: &ipb.FileCheck{
FilesToCheck: testPath,
CheckType: &ipb.FileCheck_Content{Content: &ipb.ContentCheck{Content: "content"}},
},
optOutConfig: &apb.OptOutConfig{
ContentOptoutRegexes: []string{".*"},
},
expectedResult: &apb.ComplianceResult{
Id: "id",
ComplianceOccurrence: &cpb.ComplianceOccurrence{
NonCompliantFiles: []*cpb.NonCompliantFile{
&cpb.NonCompliantFile{
Path: testFilePath,
Reason: "Got content \"[redacted due to opt-out config]\", expected \"content\"",
},
},
},
},
},
{
desc: "filename not displayed",
fileCheck: &ipb.FileCheck{
FilesToCheck: testPath,
CheckType: &ipb.FileCheck_Content{Content: &ipb.ContentCheck{Content: "content"}},
},
optOutConfig: &apb.OptOutConfig{
FilenameOptoutRegexes: []string{".*"},
},
expectedResult: &apb.ComplianceResult{
Id: "id",
ComplianceOccurrence: &cpb.ComplianceOccurrence{
NonCompliantFiles: []*cpb.NonCompliantFile{
&cpb.NonCompliantFile{
Path: "[redacted due to opt-out config]",
Reason: fmt.Sprintf("Got content %q, expected \"content\"", testFileContent),
},
},
},
},
},
{
desc: "don't redact if regex doesn't match",
fileCheck: &ipb.FileCheck{
FilesToCheck: testPath,
CheckType: &ipb.FileCheck_Content{Content: &ipb.ContentCheck{Content: "content"}},
},
optOutConfig: &apb.OptOutConfig{
ContentOptoutRegexes: []string{"no match"},
},
expectedResult: &apb.ComplianceResult{
Id: "id",
ComplianceOccurrence: &cpb.ComplianceOccurrence{
NonCompliantFiles: []*cpb.NonCompliantFile{
&cpb.NonCompliantFile{
Path: testFilePath,
Reason: fmt.Sprintf("Got content %q, expected \"content\"", testFileContent),
},
},
},
},
},
}
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
scanInstruction := testconfigcreator.NewFileScanInstruction([]*ipb.FileCheck{tc.fileCheck})
config := testconfigcreator.NewBenchmarkConfig(t, "id", scanInstruction)
scanConfig := &apb.ScanConfig{
BenchmarkConfigs: []*apb.BenchmarkConfig{config},
OptOutConfig: tc.optOutConfig,
}
check := createFileCheckBatchFromScanConfig(t, "id", scanConfig, newFakeAPI())
resultMap, err := check.Exec()
if err != nil {
t.Fatalf("check.Exec() returned an error: %v", err)
}
result, gotSingleton := singleComplianceResult(resultMap)
if !gotSingleton {
t.Fatalf("check.Exec() expected to return 1 result, got %d", len(resultMap))
}
if diff := cmp.Diff(tc.expectedResult, result, protocmp.Transform()); diff != "" {
t.Errorf("check.Exec() returned unexpected diff (-want +got):\n%s", diff)
}
})
}
} | explode_data.jsonl/24468 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1315
} | [
2830,
3393,
10809,
641,
21367,
2662,
2648,
6033,
22167,
1155,
353,
8840,
836,
8,
341,
18185,
1820,
1669,
29838,
573,
65,
8576,
1649,
90,
1944,
1676,
32398,
23119,
1703,
89534,
8623,
19090,
10569,
18185,
37302,
1669,
3056,
1235,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestShouldReturnCorrectAmountOfResulstIfFewerVariablesThanLimit(t *testing.T) {
db, mock, err := sqlmock.New()
assertNoError(t, err, "Failed to make DB")
limit := uint(4)
r := mock.NewRows([]string{"id"}).
AddRow(1).
AddRow(2).
AddRow(3)
mock.ExpectQuery(`SELECT id WHERE id IN \(\$1, \$2, \$3\)`).WillReturnRows(r)
// nolint:goconst
q := "SELECT id WHERE id IN ($1)"
v := []int{1, 2, 3}
iKeyIDs := make([]interface{}, len(v))
for i, d := range v {
iKeyIDs[i] = d
}
ctx := context.Background()
var result = make([]int, 0)
err = RunLimitedVariablesQuery(ctx, q, db, iKeyIDs, limit, func(rows *sql.Rows) error {
for rows.Next() {
var id int
err = rows.Scan(&id)
assertNoError(t, err, "rows.Scan returned an error")
result = append(result, id)
}
return nil
})
assertNoError(t, err, "Call returned an error")
if len(result) != len(v) {
t.Fatalf("Result should be 3 long")
}
} | explode_data.jsonl/47312 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 390
} | [
2830,
3393,
14996,
5598,
33092,
10093,
2124,
1061,
360,
267,
2679,
71104,
261,
22678,
26067,
16527,
1155,
353,
8840,
836,
8,
341,
20939,
11,
7860,
11,
1848,
1669,
5704,
16712,
7121,
741,
6948,
2753,
1454,
1155,
11,
1848,
11,
330,
9408,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestGetDockerResources(t *testing.T) {
testTask := &Task{
Arn: "arn:aws:ecs:us-east-1:012345678910:task/c09f0188-7f87-4b0f-bfc3-16296622b6fe",
Family: "myFamily",
Version: "1",
Containers: []*apicontainer.Container{
{
Name: "c1",
CPU: uint(10),
Memory: uint(256),
},
},
}
resources := testTask.getDockerResources(testTask.Containers[0])
assert.Equal(t, int64(10), resources.CPUShares, "Wrong number of CPUShares")
assert.Equal(t, int64(268435456), resources.Memory, "Wrong amount of memory")
} | explode_data.jsonl/37194 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 247
} | [
2830,
3393,
1949,
35,
13659,
11277,
1155,
353,
8840,
836,
8,
341,
18185,
6262,
1669,
609,
6262,
515,
197,
197,
58331,
25,
257,
330,
1885,
25,
8635,
25,
53717,
25,
355,
39507,
12,
16,
25,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMSSQLExecStoredProcedure(t *testing.T) {
db, sc, err := mssqlConnect()
if err != nil {
t.Fatal(err)
}
defer closeDB(t, db, sc, sc)
db.Exec("drop procedure dbo.temp")
exec(t, db, `
create procedure dbo.temp
@a int,
@b int
as
begin
return @a + @b
end
`)
qry := `
declare @ret int
exec @ret = dbo.temp @a = ?, @b = ?
select @ret
`
var ret int64
if err := db.QueryRow(qry, 2, 3).Scan(&ret); err != nil {
t.Fatal(err)
}
if ret != 5 {
t.Fatalf("unexpected return value: should=5, is=%v", ret)
}
exec(t, db, `drop procedure dbo.temp`)
} | explode_data.jsonl/33561 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 261
} | [
2830,
3393,
44,
1220,
3588,
10216,
623,
45517,
1155,
353,
8840,
836,
8,
341,
20939,
11,
1136,
11,
1848,
1669,
296,
79713,
14611,
741,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
16867,
3265,
3506,
1155,
11,
2927,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSelectFieldRestore(t *testing.T) {
testCases := []NodeRestoreTestCase{
{"*", "*"},
{"t.*", "`t`.*"},
{"testdb.t.*", "`testdb`.`t`.*"},
{"col as a", "`col` AS `a`"},
{"col + 1 a", "`col`+1 AS `a`"},
}
extractNodeFunc := func(node Node) Node {
return node.(*SelectStmt).Fields.Fields[0]
}
runNodeRestoreTest(t, testCases, "SELECT %s", extractNodeFunc)
} | explode_data.jsonl/27570 | {
"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,
3379,
1877,
56284,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1955,
56284,
16458,
515,
197,
197,
4913,
78729,
15630,
7115,
197,
197,
4913,
83,
4908,
497,
35973,
83,
63,
4908,
7115,
197,
197,
4913,
1944,
1999,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMongo_BlockUser(t *testing.T) {
m, skip := prepMongo(t, true) // adds two comments
if skip {
return
}
assert.False(t, m.IsBlocked("radio-t", "user1"), "nothing blocked")
assert.NoError(t, m.SetBlock("radio-t", "user1", true, 0))
assert.True(t, m.IsBlocked("radio-t", "user1"), "user1 blocked")
assert.False(t, m.IsBlocked("radio-t", "user2"), "user2 still unblocked")
assert.NoError(t, m.SetBlock("radio-t", "user1", false, 0))
assert.False(t, m.IsBlocked("radio-t", "user1"), "user1 unblocked")
assert.NotNil(t, m.SetBlock("bad", "user1", true, 0), `site "bad" not found`)
assert.NoError(t, m.SetBlock("radio-t", "userX", false, 0))
assert.False(t, m.IsBlocked("radio-t-bad", "user1"), "nothing blocked on wrong site")
} | explode_data.jsonl/54205 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 302
} | [
2830,
3393,
54998,
51779,
1474,
1155,
353,
8840,
836,
8,
341,
2109,
11,
10706,
1669,
21327,
54998,
1155,
11,
830,
8,
442,
11367,
1378,
6042,
198,
743,
10706,
341,
197,
853,
198,
197,
532,
6948,
50757,
1155,
11,
296,
4506,
95847,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestGetFee(t *testing.T) {
t.Parallel()
feeBuilder := &exchange.FeeBuilder{
PurchasePrice: 10,
Amount: 1,
IsMaker: true,
}
fee, err := f.GetFee(context.Background(), feeBuilder)
if err != nil {
t.Error(err)
}
if fee <= 0 {
t.Errorf("incorrect maker fee value")
}
feeBuilder.IsMaker = false
if fee, err = f.GetFee(context.Background(), feeBuilder); err != nil {
t.Error(err)
}
if fee <= 0 {
t.Errorf("incorrect maker fee value")
}
feeBuilder.FeeType = exchange.OfflineTradeFee
fee, err = f.GetFee(context.Background(), feeBuilder)
if err != nil {
t.Error(err)
}
if fee <= 0 {
t.Errorf("incorrect maker fee value")
}
feeBuilder.IsMaker = true
fee, err = f.GetFee(context.Background(), feeBuilder)
if err != nil {
t.Error(err)
}
if fee <= 0 {
t.Errorf("incorrect maker fee value")
}
} | explode_data.jsonl/15224 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 353
} | [
2830,
3393,
1949,
41941,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
1166,
2127,
3297,
1669,
609,
39568,
991,
2127,
3297,
515,
197,
10025,
12877,
6972,
25,
220,
16,
15,
345,
197,
197,
10093,
25,
286,
220,
16,
345,
197,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
func TestJSCall(t *testing.T) {
const SCRIPT = `
function getter() {
return this.x;
}
var o = Object(1);
o.x = 42;
Object.defineProperty(o, "test", {get: getter});
var rv = o.test;
`
testScript(SCRIPT, intToValue(42), t)
} | explode_data.jsonl/75217 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 105
} | [
2830,
3393,
41,
3540,
541,
1155,
353,
8840,
836,
8,
341,
4777,
53679,
284,
22074,
7527,
33429,
368,
341,
197,
853,
419,
1993,
280,
197,
532,
2405,
297,
284,
3002,
7,
16,
317,
22229,
1993,
284,
220,
19,
17,
280,
23816,
24802,
10108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGatherAndPrint(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
registerer := mocktestutil.NewMockregistererGatherer(controller)
filterer := mocktestutil.NewMockfilterer(controller)
printer := mocktestutil.NewMockprinter(controller)
registerer.EXPECT().Gather().Return(utilMetricsA, nil)
filterer.EXPECT().FilterMetricsByName(utilMetricsA, "n0").Return(utilMetricsB)
printer.EXPECT().PrintMetrics(utilMetricsB)
defer mockGlobalFilterer(filterer)()
defer mockGlobalPrinter(printer)()
GatherAndPrint(registerer, "n0")
} | explode_data.jsonl/2904 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 207
} | [
2830,
3393,
38,
1856,
3036,
8994,
1155,
353,
8840,
836,
8,
341,
61615,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
6461,
991,
18176,
741,
29422,
261,
1669,
7860,
1944,
1314,
7121,
11571,
6343,
261,
38,
1856,
261,
40845,
340,
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 TestWSTokenAuth(t *testing.T) {
for _, test := range []struct {
name string
opts func() *Options
token string
err string
}{
{
"top level auth, no override, wrong token",
func() *Options {
o := testWSOptions()
o.Authorization = "goodtoken"
return o
},
"badtoken", "-ERR 'Authorization Violation'",
},
{
"top level auth, no override, correct token",
func() *Options {
o := testWSOptions()
o.Authorization = "goodtoken"
return o
},
"goodtoken", "",
},
{
"no top level auth, ws auth, wrong token",
func() *Options {
o := testWSOptions()
o.Websocket.Token = "goodtoken"
return o
},
"badtoken", "-ERR 'Authorization Violation'",
},
{
"no top level auth, ws auth, correct token",
func() *Options {
o := testWSOptions()
o.Websocket.Token = "goodtoken"
return o
},
"goodtoken", "",
},
{
"top level auth, ws override, wrong token",
func() *Options {
o := testWSOptions()
o.Authorization = "clienttoken"
o.Websocket.Token = "websockettoken"
return o
},
"clienttoken", "-ERR 'Authorization Violation'",
},
{
"top level auth, ws override, correct token",
func() *Options {
o := testWSOptions()
o.Authorization = "clienttoken"
o.Websocket.Token = "websockettoken"
return o
},
"websockettoken", "",
},
} {
t.Run(test.name, func(t *testing.T) {
o := test.opts()
s := RunServer(o)
defer s.Shutdown()
wsc, br, _ := testWSCreateClientGetInfo(t, false, false, o.Websocket.Host, o.Websocket.Port)
defer wsc.Close()
connectProto := fmt.Sprintf("CONNECT {\"verbose\":false,\"protocol\":1,\"auth_token\":\"%s\"}\r\nPING\r\n",
test.token)
wsmsg := testWSCreateClientMsg(wsBinaryMessage, 1, true, false, []byte(connectProto))
if _, err := wsc.Write(wsmsg); err != nil {
t.Fatalf("Error sending message: %v", err)
}
msg := testWSReadFrame(t, br)
if test.err == "" && !bytes.HasPrefix(msg, []byte("PONG\r\n")) {
t.Fatalf("Expected to receive PONG, got %q", msg)
} else if test.err != "" && !bytes.HasPrefix(msg, []byte(test.err)) {
t.Fatalf("Expected to receive %q, got %q", test.err, msg)
}
})
}
} | explode_data.jsonl/42729 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1000
} | [
2830,
3393,
54,
784,
1679,
5087,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
11609,
220,
914,
198,
197,
64734,
220,
2915,
368,
353,
3798,
198,
197,
43947,
914,
198,
197,
9859,
256,
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... | 1 |
func TestTrimSpace_unicode(t *testing.T) {
extraChars := "state\uFEFF"
want := "state"
got := TrimSpace(extraChars)
if want != got {
t.Fatalf("wrong trim, want: %q got: %q", want, got)
}
} | explode_data.jsonl/62251 | {
"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,
25656,
9914,
54662,
1155,
353,
8840,
836,
8,
341,
8122,
2172,
32516,
1669,
330,
2454,
3770,
11419,
1748,
698,
50780,
1669,
330,
2454,
698,
3174,
354,
1669,
44376,
9914,
83790,
32516,
692,
743,
1366,
961,
2684,
341,
197,
3244... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExportImportOwnAppAdminSuperTenant(t *testing.T) {
adminUsername := superAdminUser
adminPassword := superAdminPassword
dev := apimClients[0]
prod := apimClients[1]
app := addApp(t, dev, adminUsername, adminPassword)
args := &appImportExportTestArgs{
appOwner: credentials{username: adminUsername, password: adminPassword},
ctlUser: credentials{username: adminUsername, password: adminPassword},
application: app,
srcAPIM: dev,
destAPIM: prod,
}
validateAppExportImport(t, args)
} | explode_data.jsonl/42432 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 181
} | [
2830,
3393,
16894,
11511,
14182,
2164,
7210,
19284,
71252,
1155,
353,
8840,
836,
8,
341,
64394,
11115,
1669,
2256,
7210,
1474,
198,
64394,
4876,
1669,
2256,
7210,
4876,
271,
27302,
1669,
1443,
318,
47174,
58,
15,
921,
197,
19748,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGenerateModel_Nota(t *testing.T) {
specDoc, err := loads.Spec("../fixtures/codegen/todolist.models.yml")
require.NoError(t, err)
definitions := specDoc.Spec().Definitions
k := "Nota"
schema := definitions[k]
opts := opts()
genModel, err := makeGenDefinition(k, "models", schema, specDoc, opts)
require.NoError(t, err)
buf := bytes.NewBuffer(nil)
require.NoError(t, opts.templates.MustGet("model").Execute(buf, genModel))
res := buf.String()
assertInCode(t, "type Nota map[string]int32", res)
} | explode_data.jsonl/2498 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 197
} | [
2830,
3393,
31115,
1712,
1604,
6089,
1155,
353,
8840,
836,
8,
341,
98100,
9550,
11,
1848,
1669,
20907,
36473,
17409,
45247,
46928,
4370,
5523,
347,
34675,
8235,
33936,
1138,
17957,
35699,
1155,
11,
1848,
692,
7452,
4054,
82,
1669,
1398,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_boolFromString(t *testing.T) {
// TestCase 1: Valid Input: "true"
// mustn't raise any error
input := "true"
val, err := boolFromString(input)
if err != nil {
t.Errorf("function raised an error for a valid input(%s): %s", input, err)
}
if val != true {
t.Errorf("invalid output. Expected %v, found %v", true, val)
}
// TestCase 2: Valid Input: "true"
// mustn't raise any error
input = "false"
val, err = boolFromString(input)
if err != nil {
t.Errorf("function raised an error for a valid input(%s): %s", input, err)
}
if val != false {
t.Errorf("invalid output. Expected %v, found %v", false, val)
}
// TestCase 3: invalid input: ""
// it must raise an error
input = ""
val, err = boolFromString(input)
if err == nil {
t.Errorf("invalid input should've raised an error")
}
} | explode_data.jsonl/52719 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 305
} | [
2830,
3393,
22159,
44491,
1155,
353,
8840,
836,
8,
341,
197,
322,
30573,
220,
16,
25,
7818,
5571,
25,
330,
1866,
698,
197,
322,
1969,
77,
944,
4828,
894,
1465,
198,
22427,
1669,
330,
1866,
698,
19302,
11,
1848,
1669,
1807,
44491,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAll(t *testing.T) {
for _, test := range allTests {
switch res := All(test.n, test.s); {
case len(res) == 0 && len(test.out) == 0:
case reflect.DeepEqual(res, test.out):
default:
t.Fatalf("All(%d, %s) = %v, want %v.",
test.n, test.s, res, test.out)
}
}
} | explode_data.jsonl/76257 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 134
} | [
2830,
3393,
2403,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
678,
18200,
341,
197,
8961,
592,
1669,
2009,
8623,
1253,
11,
1273,
514,
1215,
341,
197,
2722,
2422,
4590,
8,
621,
220,
15,
1009,
2422,
8623,
2532,
8,
621,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadSectionName(t *testing.T) {
// Regular section name.
input := "[Section]"
expected := "Section"
rv, actual := readSectionName(input)
if !rv || actual != expected {
t.Errorf("expected: %q, actual: %q", expected, actual)
}
// Section name with spaces.
input = "[ Section A ]"
expected = "Section A"
rv, actual = readSectionName(input)
if !rv || actual != expected {
t.Errorf("expected: %q, actual: %q", expected, actual)
}
// Empty section name.
input = "[ ]"
expected = ""
rv, actual = readSectionName(input)
if !rv || actual != expected {
t.Errorf("expected: %q, actual: %q", expected, actual)
}
} | explode_data.jsonl/49350 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 230
} | [
2830,
3393,
4418,
9620,
675,
1155,
353,
8840,
836,
8,
341,
197,
322,
28800,
3772,
829,
624,
22427,
1669,
10545,
9620,
38445,
42400,
1669,
330,
9620,
698,
78484,
11,
5042,
1669,
1349,
9620,
675,
5384,
340,
743,
753,
10553,
1369,
5042,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 Test_trieTree_walkTreeByValue(t *testing.T) {
data := buildTestTrieTreeData()
expects := []struct {
prefixValue string
exhausted bool
nodeNumber uint64
}{
{"", true, 1},
{"e", true, 3},
{"z", false, 22},
{"ellme", false, 22},
{"elome", false, 22},
{"elemee", false, 22},
}
for _, testCase := range expects {
exhausted, nodeNumber := data.walkTreeByValue(testCase.prefixValue)
assert.Equal(t, testCase.exhausted, exhausted)
assert.Equal(t, testCase.nodeNumber, nodeNumber)
}
} | explode_data.jsonl/2674 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 207
} | [
2830,
3393,
3547,
645,
6533,
56131,
6533,
1359,
1130,
1155,
353,
8840,
836,
8,
341,
8924,
1669,
1936,
2271,
51,
7231,
6533,
1043,
2822,
8122,
7973,
1669,
3056,
1235,
341,
197,
3223,
5060,
1130,
914,
198,
197,
8122,
15074,
291,
256,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestClient(t *testing.T) {
stub, err := getMockStub()
assert.NoError(t, err, "Failed to get mock submitter")
sinfo, err := cid.New(stub)
assert.NoError(t, err, "Error getting submitter of the transaction")
id, err := cid.GetID(stub)
assert.NoError(t, err, "Error getting ID of the submitter of the transaction")
assert.NotEmpty(t, id, "Transaction submitter ID should not be empty")
t.Logf("The client's ID is: %s", id)
cert, err := cid.GetX509Certificate(stub)
assert.NoError(t, err, "Error getting X509 certificate of the submitter of the transaction")
assert.NotNil(t, cert, "Transaction submitter certificate should not be nil")
mspid, err := cid.GetMSPID(stub)
assert.NoError(t, err, "Error getting MSP ID of the submitter of the transaction")
assert.NotEmpty(t, mspid, "Transaction submitter MSP ID should not be empty")
_, found, err := sinfo.GetAttributeValue("foo")
assert.NoError(t, err, "Error getting Unique ID of the submitter of the transaction")
assert.False(t, found, "Attribute 'foo' should not be found in the submitter cert")
err = cid.AssertAttributeValue(stub, "foo", "")
assert.Error(t, err, "AssertAttributeValue should have returned an error with no attribute")
stub, err = getMockStubWithAttrs()
assert.NoError(t, err, "Failed to get mock submitter")
sinfo, err = cid.New(stub)
assert.NoError(t, err, "Failed to new client")
attrVal, found, err := sinfo.GetAttributeValue("attr1")
assert.NoError(t, err, "Error getting Unique ID of the submitter of the transaction")
assert.True(t, found, "Attribute 'attr1' should be found in the submitter cert")
assert.Equal(t, attrVal, "val1", "Value of attribute 'attr1' should be 'val1'")
attrVal, found, err = cid.GetAttributeValue(stub, "attr1")
assert.NoError(t, err, "Error getting Unique ID of the submitter of the transaction")
assert.True(t, found, "Attribute 'attr1' should be found in the submitter cert")
assert.Equal(t, attrVal, "val1", "Value of attribute 'attr1' should be 'val1'")
err = cid.AssertAttributeValue(stub, "attr1", "val1")
assert.NoError(t, err, "Error in AssertAttributeValue")
err = cid.AssertAttributeValue(stub, "attr1", "val2")
assert.Error(t, err, "Assert should have failed; value was val1, not val2")
// Error case1
stub, err = getMockStubWithNilCreator()
assert.NoError(t, err, "Failed to get mock submitter")
sinfo, err = cid.New(stub)
assert.Error(t, err, "NewSubmitterInfo should have returned an error when submitter with nil creator is passed")
// Error case2
stub, err = getMockStubWithFakeCreator()
assert.NoError(t, err, "Failed to get mock submitter")
sinfo, err = cid.New(stub)
assert.Error(t, err, "NewSubmitterInfo should have returned an error when submitter with fake creator is passed")
} | explode_data.jsonl/75723 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 940
} | [
2830,
3393,
2959,
1155,
353,
8840,
836,
8,
341,
18388,
392,
11,
1848,
1669,
633,
11571,
33838,
741,
6948,
35699,
1155,
11,
1848,
11,
330,
9408,
311,
633,
7860,
9318,
465,
1138,
1903,
2733,
11,
1848,
1669,
32141,
7121,
5895,
392,
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 TestInsertOrUpdate(t *testing.T) {
RegisterModel(new(User))
userName := "unique_username133"
column := "user_name"
user := User{UserName: userName, Status: 1, Password: "o"}
user1 := User{UserName: userName, Status: 2, Password: "o"}
user2 := User{UserName: userName, Status: 3, Password: "oo"}
dORM.Insert(&user)
fmt.Println(dORM.Driver().Name())
if dORM.Driver().Name() == "sqlite3" {
fmt.Println("sqlite3 is nonsupport")
return
}
specs := []struct {
description string
user User
colConflitAndArgs []string
assertion func(expected User, actual User)
isPostgresCompatible bool
}{
{
description: "test1",
user: user1,
colConflitAndArgs: []string{column},
assertion: func(expected, actual User) {
throwFailNow(t, AssertIs(expected.Status, actual.Status))
},
isPostgresCompatible: true,
},
{
description: "test2",
user: user2,
colConflitAndArgs: []string{column},
assertion: func(expected, actual User) {
throwFailNow(t, AssertIs(expected.Status, actual.Status))
throwFailNow(t, AssertIs(expected.Password, strings.TrimSpace(actual.Password)))
},
isPostgresCompatible: true,
},
{
description: "test3 +",
user: user2,
colConflitAndArgs: []string{column, "status=status+1"},
assertion: func(expected, actual User) {
throwFailNow(t, AssertIs(expected.Status+1, actual.Status))
},
isPostgresCompatible: false,
},
{
description: "test4 -",
user: user2,
colConflitAndArgs: []string{column, "status=status-1"},
assertion: func(expected, actual User) {
throwFailNow(t, AssertIs((expected.Status+1)-1, actual.Status))
},
isPostgresCompatible: false,
},
{
description: "test5 *",
user: user2,
colConflitAndArgs: []string{column, "status=status*3"},
assertion: func(expected, actual User) {
throwFailNow(t, AssertIs(((expected.Status+1)-1)*3, actual.Status))
},
isPostgresCompatible: false,
},
{
description: "test6 /",
user: user2,
colConflitAndArgs: []string{column, "Status=Status/3"},
assertion: func(expected, actual User) {
throwFailNow(t, AssertIs((((expected.Status+1)-1)*3)/3, actual.Status))
},
isPostgresCompatible: false,
},
}
for _, spec := range specs {
// postgres ON CONFLICT DO UPDATE SET can`t use colu=colu+values
if IsPostgres && !spec.isPostgresCompatible {
continue
}
_, err := dORM.InsertOrUpdate(&spec.user, spec.colConflitAndArgs...)
if err != nil {
fmt.Println(err)
if !(err.Error() == "postgres version must 9.5 or higher" || err.Error() == "`sqlite3` nonsupport InsertOrUpdate in beego") {
throwFailNow(t, err)
}
continue
}
test := User{UserName: userName}
err = dORM.Read(&test, column)
throwFailNow(t, AssertIs(err, nil))
spec.assertion(spec.user, test)
}
} | explode_data.jsonl/18167 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1302
} | [
2830,
3393,
13780,
56059,
1155,
353,
8840,
836,
8,
341,
79096,
1712,
1755,
13087,
1171,
19060,
675,
1669,
330,
9587,
21588,
16,
18,
18,
698,
51661,
1669,
330,
872,
1269,
698,
19060,
1669,
2657,
90,
18856,
25,
19855,
11,
8104,
25,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAESEncrypt(t *testing.T) {
orign := []byte("Hello World!")
key, iv := []byte("GoodPeopleGoodMe"), []byte("0000000000000000")
crypt, err := AESEncrypt(orign, key, iv)
if err != nil {
t.Error(err)
}
t.Log(crypt, len(crypt))
o2, err := AESDecrypt(crypt, key, iv)
if err != nil {
t.Error(err)
}
t.Log(o2)
} | explode_data.jsonl/81851 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 140
} | [
2830,
3393,
13669,
925,
1016,
3571,
1155,
353,
8840,
836,
8,
341,
81166,
622,
1669,
3056,
3782,
445,
9707,
4337,
22988,
23634,
11,
17509,
1669,
3056,
3782,
445,
15216,
15919,
15216,
7823,
3975,
3056,
3782,
445,
15,
15,
15,
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 TestDomainSetMaxMemory(t *testing.T) {
const mem = 8192 * 100
dom, conn := buildTestDomain()
defer func() {
dom.Free()
if res, _ := conn.Close(); res != 0 {
t.Errorf("Close() == %d, expected 0", res)
}
}()
if err := dom.SetMaxMemory(mem); err != nil {
t.Error(err)
return
}
} | explode_data.jsonl/64833 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 126
} | [
2830,
3393,
13636,
1649,
5974,
10642,
1155,
353,
8840,
836,
8,
341,
4777,
1833,
284,
220,
23,
16,
24,
17,
353,
220,
16,
15,
15,
198,
2698,
316,
11,
4534,
1669,
1936,
2271,
13636,
741,
16867,
2915,
368,
341,
197,
2698,
316,
52229,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUDSWriteRead(t *testing.T) {
addr, _ := net.ResolveUnixAddr("unix", "/tmp/test1.sock")
syscall.Unlink(addr.String())
l, err := net.Listen(addr.Network(), addr.String())
if err != nil {
t.Fatalf("listen error %v", err)
}
defer l.Close()
go func() {
conn, _ := l.Accept()
read := make([]byte, 1024)
i, _ := conn.Read(read)
if i <= 0 {
t.Fatalf("conn read error: %v", err)
}
if _, err = conn.Write([]byte("hello,client")); err != nil {
t.Fatalf("conn Write error: %v", err)
}
}()
time.Sleep(time.Second) // wait accept goroutine
cc := NewClientConnection(nil, 0, nil, addr, nil)
defer cc.Close(api.FlushWrite, api.RemoteClose)
// add read filter
filter := &testReadFilter{}
cc.FilterManager().AddReadFilter(filter)
if err := cc.Connect(); err != nil {
t.Fatalf("conn Connect error: %v", err)
}
if cc.State() != api.ConnActive {
t.Fatalf("ConnState should be ConnActive")
}
wb := buffer.GetIoBuffer(10)
wb.WriteString("hello,mosn")
if err := cc.Write(wb); err != nil {
t.Fatalf("conn WriteString error: %v", err)
}
time.Sleep(time.Millisecond * 500)
if filter.received <= 0 {
t.Fatalf("conn can not received server's msg")
}
} | explode_data.jsonl/50586 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 476
} | [
2830,
3393,
4656,
50,
7985,
4418,
1155,
353,
8840,
836,
8,
341,
53183,
11,
716,
1669,
4179,
57875,
55832,
13986,
445,
56646,
497,
3521,
5173,
12697,
16,
68171,
1138,
41709,
6659,
10616,
2080,
24497,
6431,
2398,
8810,
11,
1848,
1669,
417... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFormatIP(t *testing.T) {
cases := map[string]struct {
Input, Output string
}{
"ipv4-localhost": {"127.0.0.1", "127.0.0.1"},
"ipv4-internet": {"8.8.8.8", "8.8.8.8"},
"ipv6-localhost": {"::1", "[::1]"},
"ipv6-internet": {"2001:4860:4860::8888", "[2001:4860:4860::8888]"},
"invalid-ip": {"nonsense", "nonsense"},
"empty-ip": {"", ""},
}
for k, tc := range cases {
res := formatIP(tc.Input)
if res != tc.Output {
t.Errorf("%s: called formatIp('%s'); expected '%v' but returned '%v'", k, tc.Input, tc.Output, res)
}
}
} | explode_data.jsonl/80578 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 272
} | [
2830,
3393,
4061,
3298,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
2415,
14032,
60,
1235,
341,
197,
66588,
11,
9258,
914,
198,
197,
59403,
197,
197,
1,
42676,
19,
12,
8301,
788,
5212,
16,
17,
22,
13,
15,
13,
15,
13,
16,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestControllerUpdateRequeue(t *testing.T) {
// This server should force a requeue of the controller because it fails to update status.Replicas.
labelMap := map[string]string{"foo": "bar"}
rs := newReplicaSet(1, labelMap)
client := fake.NewSimpleClientset(rs)
client.PrependReactor("update", "replicasets",
func(action core.Action) (bool, runtime.Object, error) {
if action.GetSubresource() != "status" {
return false, nil, nil
}
return true, nil, errors.New("failed to update status")
})
stopCh := make(chan struct{})
defer close(stopCh)
manager, informers := testNewReplicaSetControllerFromClient(client, stopCh, BurstReplicas)
informers.Apps().V1().ReplicaSets().Informer().GetIndexer().Add(rs)
rs.Status = apps.ReplicaSetStatus{Replicas: 2}
newPodList(informers.Core().V1().Pods().Informer().GetIndexer(), 1, v1.PodRunning, labelMap, rs, "pod")
fakePodControl := controller.FakePodControl{}
manager.podControl = &fakePodControl
// Enqueue once. Then process it. Disable rate-limiting for this.
manager.queue = workqueue.NewRateLimitingQueue(workqueue.NewMaxOfRateLimiter())
manager.enqueueReplicaSet(rs)
manager.processNextWorkItem()
// It should have been requeued.
if got, want := manager.queue.Len(), 1; got != want {
t.Errorf("queue.Len() = %v, want %v", got, want)
}
} | explode_data.jsonl/7977 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 451
} | [
2830,
3393,
2051,
4289,
693,
4584,
1155,
353,
8840,
836,
8,
341,
197,
322,
1096,
3538,
1265,
5344,
264,
312,
4584,
315,
279,
6461,
1576,
432,
14525,
311,
2647,
2639,
2817,
79,
52210,
624,
29277,
2227,
1669,
2415,
14032,
30953,
4913,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestGnmDirected(t *testing.T) {
t.Parallel()
for n := 2; n <= 20; n++ {
nChoose2 := (n - 1) * n / 2
for m := 0; m <= nChoose2*2; m++ {
g := &gnDirected{DirectedBuilder: simple.NewDirectedGraph()}
orig := g.NewNode()
g.AddNode(orig)
err := Gnm(g, n, m, nil)
if err != nil {
t.Fatalf("unexpected error: n=%d, m=%d: %v", n, m, err)
}
if g.From(orig.ID()).Len() != 0 {
t.Errorf("edge added from already existing node: n=%d, m=%d", n, m)
}
if g.addSelfLoop {
t.Errorf("unexpected self edge: n=%d, m=%d", n, m)
}
if g.addMultipleEdge {
t.Errorf("unexpected multiple edge: n=%d, m=%d", n, m)
}
}
}
} | explode_data.jsonl/52031 | {
"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,
38,
19638,
92669,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2023,
308,
1669,
220,
17,
26,
308,
2651,
220,
17,
15,
26,
308,
1027,
341,
197,
9038,
24051,
17,
1669,
320,
77,
481,
220,
16,
8,
353,
308,
608,
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... | 7 |
func TestFormatStore_Put(t *testing.T) {
t.Run("Fail to format", func(t *testing.T) {
t.Run("Formatter uses non-deterministic key formatting", func(t *testing.T) {
provider := formattedstore.NewProvider(mem.NewProvider(),
&mockFormatter{errFormat: errors.New("formatting failure"), useDeterministicKeyFormatting: false})
require.NotNil(t, provider)
store, err := provider.OpenStore("StoreName")
require.NoError(t, err)
require.NotNil(t, store)
err = store.Put("KeyName", []byte("value"), spi.Tag{Name: "TagName1", Value: "TagValue1"})
require.EqualError(t, err, "failed to store data using non-deterministic key formatting: "+
"failed to query using the key tag: failed to format tag: formatting failure")
})
t.Run("Formatter uses deterministic key formatting", func(t *testing.T) {
provider := formattedstore.NewProvider(mem.NewProvider(),
&mockFormatter{errFormat: errors.New("formatting failure"), useDeterministicKeyFormatting: true})
require.NotNil(t, provider)
store, err := provider.OpenStore("StoreName")
require.NoError(t, err)
require.NotNil(t, store)
err = store.Put("KeyName", []byte("value"), spi.Tag{Name: "TagName1", Value: "TagValue1"})
require.EqualError(t, err, "failed to format and put data: failed to format data: formatting failure")
})
})
t.Run("Fail to get next result from iterator", func(t *testing.T) {
provider := formattedstore.NewProvider(&mock.Provider{
OpenStoreReturn: &mock.Store{
QueryReturn: &mock.Iterator{
ErrNext: errors.New("next error"),
},
},
},
&mockFormatter{
useDeterministicKeyFormatting: false,
formatTagsReturn: []spi.Tag{{}},
})
require.NotNil(t, provider)
store, err := provider.OpenStore("StoreName")
require.NoError(t, err)
require.NotNil(t, store)
err = store.Put("KeyName", []byte("value"), spi.Tag{Name: "TagName1", Value: "TagValue1"})
require.EqualError(t, err, "failed to store data using non-deterministic key formatting: "+
"failed to get next result from iterator: next error")
})
t.Run("Fail to get key from iterator", func(t *testing.T) {
provider := formattedstore.NewProvider(&mock.Provider{
OpenStoreReturn: &mock.Store{
QueryReturn: &mock.Iterator{
NextReturn: true,
ErrKey: errors.New("key error"),
},
},
},
&mockFormatter{
useDeterministicKeyFormatting: false,
formatTagsReturn: []spi.Tag{{}},
})
require.NotNil(t, provider)
store, err := provider.OpenStore("StoreName")
require.NoError(t, err)
require.NotNil(t, store)
err = store.Put("KeyName", []byte("value"), spi.Tag{Name: "TagName1", Value: "TagValue1"})
require.EqualError(t, err, "failed to store data using non-deterministic key formatting: "+
"failed to get key from iterator: key error")
})
t.Run("Unexpectedly found multiple keys matching query", func(t *testing.T) {
provider := formattedstore.NewProvider(&mock.Provider{
OpenStoreReturn: &mock.Store{
QueryReturn: &mock.Iterator{
NextReturn: true,
},
},
},
&mockFormatter{
useDeterministicKeyFormatting: false,
formatTagsReturn: []spi.Tag{{}},
})
require.NotNil(t, provider)
store, err := provider.OpenStore("StoreName")
require.NoError(t, err)
require.NotNil(t, store)
err = store.Put("KeyName", []byte("value"), spi.Tag{Name: "TagName1", Value: "TagValue1"})
require.EqualError(t, err, "failed to store data using non-deterministic key formatting: "+
"unexpectedly found multiple results matching query. Only one is expected")
})
} | explode_data.jsonl/28239 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1370
} | [
2830,
3393,
4061,
6093,
1088,
332,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
19524,
311,
3561,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
3244,
16708,
445,
14183,
5711,
2477,
1737,
16483,
4532,
1376,
36566,
497,
2915,
1155,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestHypervisorDefaults(t *testing.T) {
assert := assert.New(t)
h := hypervisor{}
assert.Equal(h.machineType(), defaultMachineType, "default hypervisor machine type wrong")
assert.Equal(h.defaultVCPUs(), defaultVCPUCount, "default vCPU number is wrong")
assert.Equal(h.defaultMemSz(), defaultMemSize, "default memory size is wrong")
machineType := "foo"
h.MachineType = machineType
assert.Equal(h.machineType(), machineType, "custom hypervisor machine type wrong")
// auto inferring
h.DefaultVCPUs = -1
assert.Equal(h.defaultVCPUs(), uint32(goruntime.NumCPU()), "default vCPU number is wrong")
h.DefaultVCPUs = 2
assert.Equal(h.defaultVCPUs(), uint32(2), "default vCPU number is wrong")
numCPUs := goruntime.NumCPU()
h.DefaultVCPUs = int32(numCPUs) + 1
assert.Equal(h.defaultVCPUs(), uint32(numCPUs), "default vCPU number is wrong")
h.DefaultMemSz = 1024
assert.Equal(h.defaultMemSz(), uint32(1024), "default memory size is wrong")
} | explode_data.jsonl/5126 | {
"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,
39,
1082,
31396,
16273,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
9598,
1669,
9751,
31396,
31483,
6948,
12808,
3203,
77726,
929,
1507,
1638,
21605,
929,
11,
330,
2258,
9751,
31396,
5662,
943,
4969,
113... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestModuleFormatter(t *testing.T) {
buf := &bytes.Buffer{}
entry := zapcore.Entry{LoggerName: "logger/name"}
f := fabenc.ModuleFormatter{FormatVerb: "%s"}
f.Format(buf, entry, nil)
assert.Equal(t, "logger/name", buf.String())
} | explode_data.jsonl/10935 | {
"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,
3332,
14183,
1155,
353,
8840,
836,
8,
341,
26398,
1669,
609,
9651,
22622,
16094,
48344,
1669,
32978,
2153,
22330,
90,
7395,
675,
25,
330,
9786,
75992,
16707,
1166,
1669,
9570,
954,
26958,
14183,
90,
4061,
66946,
25,
5962,
82... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestPodSpecLogForFailedPods(t *testing.T) {
wf := unmarshalWF(helloWorldWf)
cancel, controller := newController(wf)
defer cancel()
ctx := context.Background()
controller.Config.PodSpecLogStrategy.FailedPod = true
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
makePodsPhase(ctx, woc, apiv1.PodFailed)
woc = newWorkflowOperationCtx(woc.wf, controller)
woc.operate(ctx)
for _, node := range woc.wf.Status.Nodes {
assert.True(t, woc.shouldPrintPodSpec(node))
}
} | explode_data.jsonl/71001 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 197
} | [
2830,
3393,
23527,
8327,
2201,
2461,
9408,
23527,
82,
1155,
353,
8840,
836,
8,
341,
6692,
69,
1669,
650,
27121,
32131,
3203,
4791,
10134,
54,
69,
340,
84441,
11,
6461,
1669,
501,
2051,
3622,
69,
340,
16867,
9121,
2822,
20985,
1669,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSSNValidation(t *testing.T) {
tests := []struct {
param string
expected bool
}{
{"", false},
{"00-90-8787", false},
{"66690-76", false},
{"191 60 2869", true},
{"191-60-2869", true},
}
validate := New()
for i, test := range tests {
errs := validate.Var(test.param, "ssn")
if test.expected {
if !IsEqual(errs, nil) {
t.Fatalf("Index: %d SSN failed Error: %s", i, errs)
}
} else {
if IsEqual(errs, nil) {
t.Fatalf("Index: %d SSN failed Error: %s", i, errs)
} else {
val := getError(errs, "", "")
if val.Tag() != "ssn" {
t.Fatalf("Index: %d Latitude failed Error: %s", i, errs)
}
}
}
}
} | explode_data.jsonl/77260 | {
"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,
1220,
45,
13799,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
36037,
262,
914,
198,
197,
42400,
1807,
198,
197,
59403,
197,
197,
4913,
497,
895,
1583,
197,
197,
4913,
15,
15,
12,
24,
15,
12,
23,
22,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestConnectingRanWithMaxAttemptsReconnectionDissociateSucceeds(t *testing.T) {
_, _, readerMock, writerMock, ranReconnectionManager, httpClient:= initRanLostConnectionTest(t)
origNodebInfo := &entities.NodebInfo{RanName: ranName, GlobalNbId: &entities.GlobalNbId{PlmnId: "xxx", NbId: "yyy"}, ConnectionStatus: entities.ConnectionStatus_CONNECTING, ConnectionAttempts: 20, AssociatedE2TInstanceAddress: E2TAddress}
var rnibErr error
readerMock.On("GetNodeb", ranName).Return(origNodebInfo, rnibErr)
updatedNodebInfo1 := *origNodebInfo
updatedNodebInfo1.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
writerMock.On("UpdateNodebInfo", &updatedNodebInfo1).Return(rnibErr)
updatedNodebInfo2 := *origNodebInfo
updatedNodebInfo2.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
updatedNodebInfo2.AssociatedE2TInstanceAddress = ""
writerMock.On("UpdateNodebInfo", &updatedNodebInfo2).Return(rnibErr)
e2tInstance := &entities.E2TInstance{Address: E2TAddress, AssociatedRanList:[]string{ranName}}
readerMock.On("GetE2TInstance", E2TAddress).Return(e2tInstance, nil)
e2tInstanceToSave := * e2tInstance
e2tInstanceToSave .AssociatedRanList = []string{}
writerMock.On("SaveE2TInstance", &e2tInstanceToSave).Return(nil)
mockHttpClient(httpClient, clients.DissociateRanE2TInstanceApiSuffix, true)
err := ranReconnectionManager.ReconnectRan(ranName)
assert.Nil(t, err)
readerMock.AssertCalled(t, "GetNodeb", ranName)
writerMock.AssertNumberOfCalls(t, "UpdateNodebInfo", 2)
} | explode_data.jsonl/42900 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 541
} | [
2830,
3393,
62924,
49,
276,
2354,
5974,
81517,
693,
7742,
35,
1038,
2119,
349,
50,
29264,
82,
1155,
353,
8840,
836,
8,
341,
197,
6878,
8358,
6604,
11571,
11,
6916,
11571,
11,
10613,
693,
7742,
2043,
11,
45775,
14209,
2930,
49,
276,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPolicy_SetModerateDefaults(t *testing.T) {
tests := []struct {
name string
p *Policy
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tt.p.SetModerateDefaults()
})
}
} | explode_data.jsonl/10347 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 109
} | [
2830,
3393,
13825,
14812,
68623,
349,
16273,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
3223,
262,
353,
13825,
198,
197,
59403,
197,
197,
322,
5343,
25,
2691,
1273,
5048,
624,
197,
532,
2023... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestReplaceUint(t *testing.T) {
v := &Value{data: []uint{uint(1), uint(1), uint(1), uint(1), uint(1), uint(1)}}
rawArr := v.MustUintSlice()
replaced := v.ReplaceUint(func(index int, val uint) uint {
if index < len(rawArr)-1 {
return rawArr[index+1]
}
return rawArr[0]
})
replacedArr := replaced.MustUintSlice()
if assert.Equal(t, 6, len(replacedArr)) {
assert.Equal(t, replacedArr[0], rawArr[1])
assert.Equal(t, replacedArr[1], rawArr[2])
assert.Equal(t, replacedArr[2], rawArr[3])
assert.Equal(t, replacedArr[3], rawArr[4])
assert.Equal(t, replacedArr[4], rawArr[5])
assert.Equal(t, replacedArr[5], rawArr[0])
}
} | explode_data.jsonl/23462 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 304
} | [
2830,
3393,
23107,
21570,
1155,
353,
8840,
836,
8,
1476,
5195,
1669,
609,
1130,
90,
691,
25,
3056,
2496,
90,
2496,
7,
16,
701,
2622,
7,
16,
701,
2622,
7,
16,
701,
2622,
7,
16,
701,
2622,
7,
16,
701,
2622,
7,
16,
9139,
630,
765... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHTTPReadGetError(t *testing.T) {
u, _ := url.Parse("http://test.url/test")
sr, fg := getHttpReader()
fg.err = fmt.Errorf("URL Error")
rc, err := sr.Read(u)
if rc != nil {
t.Errorf("Unexpected stream returned: %#v", rc)
}
if err != fg.err {
t.Errorf("Unexpected error returned: %#v", err)
}
} | explode_data.jsonl/20554 | {
"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,
9230,
4418,
1949,
1454,
1155,
353,
8840,
836,
8,
341,
10676,
11,
716,
1669,
2515,
8937,
445,
1254,
1110,
1944,
7315,
12697,
1138,
1903,
81,
11,
29799,
1669,
633,
2905,
5062,
741,
1166,
70,
18441,
284,
8879,
13080,
445,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTSAsCast(t *testing.T) {
expectPrintedTS(t, "x as any\n(y);", "x;\ny;\n")
expectPrintedTS(t, "x as any\n`y`;", "x;\n`y`;\n")
expectPrintedTS(t, "x as any\n`${y}`;", "x;\n`${y}`;\n")
expectPrintedTS(t, "x as any\n--y;", "x;\n--y;\n")
expectPrintedTS(t, "x as any\n++y;", "x;\n++y;\n")
expectPrintedTS(t, "x + y as any\n(z as any) + 1;", "x + y;\nz + 1;\n")
expectPrintedTS(t, "x + y as any\n(z as any) = 1;", "x + y;\nz = 1;\n")
expectPrintedTS(t, "x = y as any\n(z as any) + 1;", "x = y;\nz + 1;\n")
expectPrintedTS(t, "x = y as any\n(z as any) = 1;", "x = y;\nz = 1;\n")
expectPrintedTS(t, "x * y as any\n['z'];", "x * y;\n[\"z\"];\n")
expectPrintedTS(t, "x * y as any\n.z;", "x * y;\n")
expectPrintedTS(t, "x as y['x'];", "x;\n")
expectPrintedTS(t, "x as y!['x'];", "x;\n")
expectPrintedTS(t, "x as y\n['x'];", "x;\n[\"x\"];\n")
expectPrintedTS(t, "x as y\n!['x'];", "x;\n![\"x\"];\n")
expectParseErrorTS(t, "x = y as any `z`;", "<stdin>: error: Expected \";\" but found \"`z`\"\n")
expectParseErrorTS(t, "x = y as any `${z}`;", "<stdin>: error: Expected \";\" but found \"`${\"\n")
expectParseErrorTS(t, "x = y as any?.z;", "<stdin>: error: Expected \";\" but found \"?.\"\n")
expectParseErrorTS(t, "x = y as any--;", "<stdin>: error: Expected \";\" but found \"--\"\n")
expectParseErrorTS(t, "x = y as any++;", "<stdin>: error: Expected \";\" but found \"++\"\n")
expectParseErrorTS(t, "x = y as any(z);", "<stdin>: error: Expected \";\" but found \"(\"\n")
expectParseErrorTS(t, "x = y as any\n= z;", "<stdin>: error: Unexpected \"=\"\n")
expectParseErrorTS(t, "a, x as y `z`;", "<stdin>: error: Expected \";\" but found \"`z`\"\n")
expectParseErrorTS(t, "a ? b : x as y `z`;", "<stdin>: error: Expected \";\" but found \"`z`\"\n")
expectParseErrorTS(t, "x as any = y;", "<stdin>: error: Expected \";\" but found \"=\"\n")
expectParseErrorTS(t, "(x as any = y);", "<stdin>: error: Expected \")\" but found \"=\"\n")
expectParseErrorTS(t, "(x = y as any(z));", "<stdin>: error: Expected \")\" but found \"(\"\n")
} | explode_data.jsonl/82313 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1009
} | [
2830,
3393,
9951,
2121,
18714,
1155,
353,
8840,
836,
8,
341,
24952,
8994,
291,
9951,
1155,
11,
330,
87,
438,
894,
1699,
7021,
1215,
497,
330,
87,
17882,
3834,
17882,
77,
1138,
24952,
8994,
291,
9951,
1155,
11,
330,
87,
438,
894,
169... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestActionsGenCommand(t *testing.T) {
t.Run("required options", func(t *testing.T) {
is := is.New(t)
app := &cli.App{
Writer: ioutil.Discard,
ExitErrHandler: func(_ *cli.Context, _ error) {},
}
set := flag.NewFlagSet("test", 0)
is.NoErr(set.Parse([]string{
commands.ActionsGenCommand.Name,
}))
c := cli.NewContext(app, set, nil)
err := commands.ActionsGenCommand.Run(c)
is.True(err != nil) // must be error
is.True(strings.Contains(strings.ToLower(err.Error()), "required")) // error must contains required msg
is.True(err != nil) // wanted error with required flags
})
t.Run("template not found", func(t *testing.T) {
is := is.New(t)
tempDir := t.TempDir()
app := &cli.App{
Writer: ioutil.Discard,
ExitErrHandler: func(_ *cli.Context, _ error) {},
}
set := flag.NewFlagSet("test", 0)
is.NoErr(set.Parse([]string{
commands.ActionsGenCommand.Name,
"-template", "not_exists",
"-output_dir", tempDir,
"-transitions", "./test_data/transitions.json",
}))
c := cli.NewContext(app, set, nil)
err := commands.ActionsGenCommand.Run(c)
is.True(err != nil) // wanted error with required flags
is.True(strings.Contains(strings.ToLower(err.Error()), "no such file"))
})
t.Run("transitions not found", func(t *testing.T) {
is := is.New(t)
tempDir := t.TempDir()
app := &cli.App{
Writer: ioutil.Discard,
ExitErrHandler: func(_ *cli.Context, _ error) {},
}
set := flag.NewFlagSet("test", 0)
is.NoErr(set.Parse([]string{
commands.ActionsGenCommand.Name,
"-template", "./test_data/action.go.tpl",
"-output_dir", tempDir,
"-transitions", "./test_data/not_exists.json",
}))
c := cli.NewContext(app, set, nil)
err := commands.ActionsGenCommand.Run(c)
is.True(err != nil) // wanted error with required flags
is.True(strings.Contains(strings.ToLower(err.Error()), "no such file"))
})
t.Run("all actions stubs were generated", func(t *testing.T) {
is := is.New(t)
tempDir := t.TempDir()
app := &cli.App{
Writer: ioutil.Discard,
ExitErrHandler: func(_ *cli.Context, _ error) {},
}
set := flag.NewFlagSet("test", 0)
is.NoErr(set.Parse([]string{
commands.ActionsGenCommand.Name,
"-template", "./test_data/action.go.tpl",
"-output_dir", tempDir,
"-transitions", "./test_data/transitions.json",
}))
c := cli.NewContext(app, set, nil)
err := commands.ActionsGenCommand.Run(c)
is.NoErr(err)
files, err := ioutil.ReadDir(tempDir)
is.NoErr(err)
trsData, err := ioutil.ReadFile("./test_data/transitions.json")
is.NoErr(err)
var trs fsm.Transitions
is.NoErr(json.Unmarshal(trsData, &trs))
actions := trs.Actions()
is.True(len(actions) == len(files))
for _, v := range files {
is.True(filepath.Ext(v.Name()) == ".go")
is.True(v.Size() > 0)
is.True(fsm.InStrings(actions, strings.TrimSuffix(v.Name(), ".go")))
}
})
} | explode_data.jsonl/31604 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1362
} | [
2830,
3393,
12948,
9967,
4062,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
6279,
2606,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
19907,
1669,
374,
7121,
1155,
692,
197,
28236,
1669,
609,
19521,
5105,
515,
298,
197,
6492,
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 TestYamlConfigParser_ParseConfig(t *testing.T) {
tests := []struct {
name string
yaml string
want *models.Config
wantErr bool
}{
{
name: "empty config",
yaml: "{}",
want: &models.Config{},
wantErr: false,
},
{
name: "invalid yaml",
yaml: ": invalid",
want: nil,
wantErr: true,
},
{
name: "claim policies deserialize",
yaml: "claimPolicies:\n" +
" TestPolicy:\n" +
" - claim: test\n" +
" values: [1,2,3]",
want: &models.Config{
ClaimPolicies: map[string][]models.ClaimRequirement{
"TestPolicy": {
models.ClaimRequirement{
Claim: "test",
Values: []string{"1", "2", "3"},
},
},
},
},
wantErr: false,
},
{
name: "route policies deserialize",
yaml: "routePolicies:\n" +
" - path: /test\n" +
" methods: [GET, POST]\n" +
" policyName: TestPolicy\n" +
" allowAnonymous: true",
want: &models.Config{
RoutePolicies: []models.RoutePolicy{
{Path: "/test", Methods: []string{"GET", "POST"}, PolicyName: "TestPolicy", AllowAnonymous: true},
},
},
wantErr: false,
},
{
name: "server config deserialize",
yaml: "server:\n" +
" originalRequestHeaders:\n" +
" path: X-test-path\n" +
" method: X-test-method\n" +
" upstreamUrl: http://url/to/upstream",
want: &models.Config{
Server: models.ServerConfig{
OriginalRequestHeaders: &models.OriginalRequestHeaders{
Method: "X-test-method",
Path: "X-test-path",
},
UpstreamURL: "http://url/to/upstream",
ParsedURL: &url.URL{
Scheme: "http",
Host: "url",
Path: "/to/upstream",
},
},
},
wantErr: false,
},
{
name: "upstream url error",
yaml: "server:\n" +
" upstreamUrl: ¡http://clearly not a valid url!",
want: nil,
wantErr: true,
},
{
name: "sorts route policies by specifity",
yaml: "routePolicies:\n" +
" - path: /**\n" +
" - path: /test/*/\n" +
" - path: /test/this\n" +
" - path: /test/**\n" +
" - path: /test/this/and/that\n" +
" - path: /test/**/that\n" +
" - path: /test",
want: &models.Config{
RoutePolicies: []models.RoutePolicy{
{Path: "/test/this/and/that"},
{Path: "/test/**/that"},
{Path: "/test/this"},
{Path: "/test/*/"},
{Path: "/test/**"},
{Path: "/test"},
{Path: "/**"},
},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
parser := YamlConfigParser{}
reader := bytes.Buffer{}
reader.WriteString(tt.yaml)
got, err := parser.ParseConfig(&reader)
if (err != nil) != tt.wantErr {
t.Errorf("ParseConfig() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("ParseConfig() got = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/32531 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1455
} | [
2830,
3393,
56,
9467,
2648,
6570,
77337,
2648,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
262,
914,
198,
197,
14522,
9467,
262,
914,
198,
197,
50780,
262,
353,
6507,
10753,
198,
197,
50780,
7747,
1807,
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 TestUpsert(t *testing.T) {
t.Run("Connections", testConnectionsUpsert)
t.Run("Crawls", testCrawlsUpsert)
t.Run("Latencies", testLatenciesUpsert)
t.Run("Neighbours", testNeighboursUpsert)
t.Run("PeerProperties", testPeerPropertiesUpsert)
t.Run("Peers", testPeersUpsert)
t.Run("Sessions", testSessionsUpsert)
} | explode_data.jsonl/48665 | {
"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,
98778,
529,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
54751,
497,
1273,
54751,
98778,
529,
692,
3244,
16708,
445,
34,
1041,
4730,
497,
1273,
34,
1041,
4730,
98778,
529,
692,
3244,
16708,
445,
23140,
5946,
497,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDirMgrCollection_AddDirMgrByPathNameStr_01(t *testing.T) {
testDirStr := ""
dMgrs := DirMgrCollection{}
err := dMgrs.AddDirMgrByPathNameStr(testDirStr)
if err == nil {
t.Error("Expected an error return from dMgrs.AddDirMgrByPathNameStr(testDirStr)\n" +
"because input parameter 'testDirStr' is an empty string!\n" +
"However, NO ERROR WAS RETURNED!!!!\n")
}
} | explode_data.jsonl/61222 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 157
} | [
2830,
3393,
6184,
25567,
6482,
21346,
6184,
25567,
1359,
1820,
675,
2580,
62,
15,
16,
1155,
353,
8840,
836,
8,
1476,
220,
1273,
6184,
2580,
1669,
35829,
220,
294,
25567,
82,
1669,
30094,
25567,
6482,
31483,
220,
1848,
1669,
294,
25567,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNearestIdx(t *testing.T) {
t.Parallel()
for _, test := range []struct {
in []float64
query float64
want int
desc string
}{
{
in: []float64{6.2, 3, 5, 6.2, 8},
query: 2,
want: 1,
desc: "Wrong index returned when value is less than all of elements",
},
{
in: []float64{6.2, 3, 5, 6.2, 8},
query: 9,
want: 4,
desc: "Wrong index returned when value is greater than all of elements",
},
{
in: []float64{6.2, 3, 5, 6.2, 8},
query: 3.1,
want: 1,
desc: "Wrong index returned when value is greater than closest element",
},
{
in: []float64{6.2, 3, 5, 6.2, 8},
query: 2.9,
want: 1,
desc: "Wrong index returned when value is less than closest element",
},
{
in: []float64{6.2, 3, 5, 6.2, 8},
query: 3,
want: 1,
desc: "Wrong index returned when value is equal to element",
},
{
in: []float64{6.2, 3, 5, 6.2, 8},
query: 6.2,
want: 0,
desc: "Wrong index returned when value is equal to several elements",
},
{
in: []float64{6.2, 3, 5, 6.2, 8},
query: 4,
want: 1,
desc: "Wrong index returned when value is exactly between two closest elements",
},
{
in: []float64{math.NaN(), 3, 2, -1},
query: 2,
want: 2,
desc: "Wrong index returned when initial element is NaN",
},
{
in: []float64{0, math.NaN(), -1, 2},
query: math.NaN(),
want: 0,
desc: "Wrong index returned when query is NaN and a NaN element exists",
},
{
in: []float64{0, math.NaN(), -1, 2},
query: math.Inf(1),
want: 3,
desc: "Wrong index returned when query is +Inf and no +Inf element exists",
},
{
in: []float64{0, math.NaN(), -1, 2},
query: math.Inf(-1),
want: 2,
desc: "Wrong index returned when query is -Inf and no -Inf element exists",
},
{
in: []float64{math.NaN(), math.NaN(), math.NaN()},
query: 1,
want: 0,
desc: "Wrong index returned when query is a number and only NaN elements exist",
},
{
in: []float64{math.NaN(), math.Inf(-1)},
query: 1,
want: 1,
desc: "Wrong index returned when query is a number and single NaN precedes -Inf",
},
} {
ind := NearestIdx(test.in, test.query)
if ind != test.want {
t.Errorf(test.desc+": got:%d want:%d", ind, test.want)
}
}
if !Panics(func() { NearestIdx([]float64{}, 0) }) {
t.Errorf("Expected panic with zero length")
}
} | explode_data.jsonl/1232 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1143
} | [
2830,
3393,
8813,
15432,
11420,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
17430,
262,
3056,
3649,
21,
19,
198,
197,
27274,
2224,
21,
19,
198,
197,
50780,
220,
526,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTree_String(t *testing.T) {
v := Tree{
SHA: String(""),
Truncated: Bool(false),
}
want := `github.Tree{SHA:"", Truncated:false}`
if got := v.String(); got != want {
t.Errorf("Tree.String = %v, want %v", got, want)
}
} | explode_data.jsonl/33295 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 108
} | [
2830,
3393,
6533,
31777,
1155,
353,
8840,
836,
8,
341,
5195,
1669,
8942,
515,
197,
7568,
17020,
25,
981,
923,
445,
4461,
197,
197,
1282,
38007,
25,
12608,
3576,
1326,
197,
532,
50780,
1669,
1565,
5204,
43640,
90,
33145,
83131,
1163,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestTypeSystem_FieldsArgsMustBeProperlyNamed_AcceptsFieldArgsWithValidNames(t *testing.T) {
_, err := schemaWithFieldType(graphql.NewObject(graphql.ObjectConfig{
Name: "SomeObject",
Fields: graphql.Fields{
"goodField": &graphql.Field{
Type: graphql.String,
Args: graphql.FieldConfigArgument{
"goodArgs": &graphql.ArgumentConfig{
Type: graphql.String,
},
},
},
},
}))
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
} | explode_data.jsonl/79147 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 203
} | [
2830,
3393,
929,
2320,
1400,
6907,
4117,
31776,
3430,
1336,
712,
398,
15810,
1566,
66,
57771,
1877,
4117,
2354,
4088,
7980,
1155,
353,
8840,
836,
8,
341,
197,
6878,
1848,
1669,
10802,
2354,
63733,
24312,
1470,
7121,
1190,
24312,
1470,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestHeaders(t *testing.T) {
pver := uint32(60002)
// Ensure the command is expected value.
wantCmd := "headers"
msg := wire.NewMsgHeaders()
if cmd := msg.Command(); cmd != wantCmd {
t.Errorf("NewMsgHeaders: wrong command - got %v want %v",
cmd, wantCmd)
}
// Ensure max payload is expected value for latest protocol version.
// Num headers (varInt) + max allowed headers (header length + 1 byte
// for the number of transactions which is always 0).
wantPayload := uint32(162009)
maxPayload := msg.MaxPayloadLength(pver)
if maxPayload != wantPayload {
t.Errorf("MaxPayloadLength: wrong max payload length for "+
"protocol version %d - got %v, want %v", pver,
maxPayload, wantPayload)
}
// Ensure headers are added properly.
bh := &blockOne.Header
msg.AddBlockHeader(bh)
if !reflect.DeepEqual(msg.Headers[0], bh) {
t.Errorf("AddHeader: wrong header - got %v, want %v",
spew.Sdump(msg.Headers),
spew.Sdump(bh))
}
// Ensure adding more than the max allowed headers per message returns
// error.
var err error
for i := 0; i < wire.MaxBlockHeadersPerMsg+1; i++ {
err = msg.AddBlockHeader(bh)
}
if reflect.TypeOf(err) != reflect.TypeOf(&wire.MessageError{}) {
t.Errorf("AddBlockHeader: expected error on too many headers " +
"not received")
}
return
} | explode_data.jsonl/52392 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 465
} | [
2830,
3393,
10574,
1155,
353,
8840,
836,
8,
341,
3223,
423,
1669,
2622,
18,
17,
7,
21,
15,
15,
15,
17,
692,
197,
322,
29279,
279,
3210,
374,
3601,
897,
624,
50780,
15613,
1669,
330,
7713,
698,
21169,
1669,
9067,
7121,
6611,
10574,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWalletBalance(t *testing.T) {
w, done := setupWallet(t)
defer done()
address, err := w.NewWallet(ctx, "bls")
checkErr(t, err)
bal, err := w.WalletBalance(ctx, address)
if err != nil {
t.Fatalf("failed to get wallet balance: %v", err)
}
if bal != 0 {
t.Fatalf("unexpected wallet balance: %v", bal)
}
} | explode_data.jsonl/49706 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
38259,
21190,
1155,
353,
8840,
836,
8,
341,
6692,
11,
2814,
1669,
6505,
38259,
1155,
340,
16867,
2814,
2822,
63202,
11,
1848,
1669,
289,
7121,
38259,
7502,
11,
330,
2024,
82,
1138,
25157,
7747,
1155,
11,
1848,
692,
2233,
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 TestShellQuote(t *testing.T) {
testcases := []struct {
input string
expected string
}{
{
"Hel'lo'p\"la`ygr'ound'",
`'Hel'\''lo'\''p"la` + "`" + `ygr'\''ound'\'''`,
},
{
`"PwEV@QG7/PYt"re9`,
`'"PwEV@QG7/PYt"re9'`,
},
{
"",
"''",
},
{
"plaintext1234",
`'plaintext1234'`,
},
{
"Hel'lo'p\"la`ygr'ound",
`'Hel'\''lo'\''p"la` + "`" + `ygr'\''ound'`,
},
{
`conse''cutive`,
`'conse'\'''\''cutive'`,
},
{
"conse\\\\cutive",
`'conse\\cutive'`,
},
{
"consec\"\"utive",
`'consec""utive'`,
},
{
`PwEV@QG7/PYt"re9`,
`'PwEV@QG7/PYt"re9'`,
},
{
"Lnsr@191",
"'Lnsr@191'",
},
{
"Jach#321",
"'Jach#321'",
},
{
"Bgmo%219",
"'Bgmo%219'",
},
{
"@#$%^&*-_!+=[]{}|\\:,.?/~\"();" + "`",
`'@#$%^&*-_!+=[]{}|\:,.?/~"();` + "`'",
},
}
for _, test := range testcases {
actual := ShellQuote(test.input)
if actual != test.expected {
t.Errorf("expected shellQuote to return %s, but got %s", test.expected, actual)
}
if runtime.GOOS != "windows" {
out, err := exec.Command("/bin/bash", "-c", "testvar="+actual+"; echo -n $testvar").Output()
if err != nil {
t.Errorf("unexpected error : %s", err.Error())
}
if string(out) != test.input {
t.Errorf("failed in Bash output test. Expected %s but got %s", test, out)
}
}
}
} | explode_data.jsonl/7030 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 783
} | [
2830,
3393,
25287,
19466,
1155,
353,
8840,
836,
8,
341,
18185,
23910,
1669,
3056,
1235,
341,
197,
22427,
262,
914,
198,
197,
42400,
914,
198,
197,
59403,
197,
197,
515,
298,
197,
1,
32713,
6,
385,
6,
79,
2105,
4260,
63,
88,
901,
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... | 6 |
func Test_MarkVolumeAsAttached_SuppliedVolumeName_Positive_NewVolume(t *testing.T) {
// Arrange
volumePluginMgr, _ := volumetesting.GetTestVolumePluginMgr(t)
asw := NewActualStateOfWorld("mynode" /* nodeName */, volumePluginMgr)
pod := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "pod1",
UID: "pod1uid",
},
Spec: v1.PodSpec{
Volumes: []v1.Volume{
{
Name: "volume-name",
VolumeSource: v1.VolumeSource{
GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{
PDName: "fake-device1",
},
},
},
},
},
}
volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]}
devicePath := "fake/device/path"
volumeName := v1.UniqueVolumeName("this-would-never-be-a-volume-name")
// Act
err := asw.MarkVolumeAsAttached(volumeName, volumeSpec, "" /* nodeName */, devicePath)
// Assert
if err != nil {
t.Fatalf("MarkVolumeAsAttached failed. Expected: <no error> Actual: <%v>", err)
}
verifyVolumeExistsAsw(t, volumeName, true /* shouldExist */, asw)
verifyVolumeExistsInUnmountedVolumes(t, volumeName, asw)
verifyVolumeDoesntExistInGloballyMountedVolumes(t, volumeName, asw)
} | explode_data.jsonl/28877 | {
"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,
1245,
838,
18902,
2121,
65987,
1098,
454,
3440,
18902,
675,
44246,
3404,
39582,
18902,
1155,
353,
8840,
836,
8,
341,
197,
322,
40580,
198,
5195,
4661,
11546,
25567,
11,
716,
1669,
62820,
57824,
287,
2234,
2271,
18902,
11546,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_part1(t *testing.T) {
e := 4
o, err := part1(i)
if err != nil {
t.Error(err)
}
if o != e {
t.Errorf("Expected %d, got %d", e, o)
}
} | explode_data.jsonl/61251 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 81
} | [
2830,
3393,
10495,
16,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
220,
19,
198,
22229,
11,
1848,
1669,
949,
16,
1956,
340,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
3964,
340,
197,
532,
743,
297,
961,
384,
341,
197,
3244,
13080,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestKustomize(t *testing.T) {
testCase := &tests.KustomizeTestCase{
Package: "../../../../../stacks/azure/application/cert-manager-kube-system-resources",
Expected: "test_data/expected",
}
tests.RunTestCase(t, testCase)
} | explode_data.jsonl/6607 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 89
} | [
2830,
3393,
42,
1450,
551,
1155,
353,
8840,
836,
8,
341,
18185,
4207,
1669,
609,
23841,
11352,
1450,
551,
16458,
515,
197,
10025,
1434,
25,
220,
10208,
26744,
7693,
82,
14,
39495,
33032,
2899,
529,
44896,
12646,
3760,
36648,
89811,
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 |
func TestFileServing(t *testing.T) {
tests := []testRun{{
Name: "index",
URL: "",
Status: http.StatusOK,
Expected: `<pre>
<a href="dir/">dir/</a>
<a href="file.txt">file.txt</a>
</pre>
`,
}, {
Name: "notfound",
URL: "notfound",
Status: http.StatusNotFound,
Expected: "404 page not found\n",
}, {
Name: "dirnotfound",
URL: "dirnotfound/",
Status: http.StatusNotFound,
Expected: "404 page not found\n",
}, {
Name: "dir",
URL: "dir/",
Status: http.StatusOK,
Expected: `<pre>
<a href="file2.txt">file2.txt</a>
</pre>
`,
}, {
Name: "file",
URL: "file.txt",
Status: http.StatusOK,
Expected: "this is file1.txt\n",
Headers: map[string]string{
"Content-Length": "18",
},
}, {
Name: "file2",
URL: "dir/file2.txt",
Status: http.StatusOK,
Expected: "this is dir/file2.txt\n",
}, {
Name: "file-head",
URL: "file.txt",
Method: "HEAD",
Status: http.StatusOK,
Expected: ``,
Headers: map[string]string{
"Content-Length": "18",
},
}, {
Name: "file-range",
URL: "file.txt",
Status: http.StatusPartialContent,
Range: "bytes=8-12",
Expected: `file1`,
}}
opt := newTestOpt()
opt.Serve = true
opt.Files = testFs
testServer(t, tests, &opt)
} | explode_data.jsonl/12959 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 639
} | [
2830,
3393,
1703,
50,
19505,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1944,
6727,
90,
515,
197,
21297,
25,
256,
330,
1252,
756,
197,
79055,
25,
262,
8324,
197,
58321,
25,
1758,
52989,
345,
197,
197,
18896,
25,
30586,
1726,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAdditions(t *testing.T) {
for _, test := range diffTests {
got, err := additions(strings.NewReader(test.diff))
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if !reflect.DeepEqual(got, test.want) {
t.Errorf("unexpected result for test %q\n%s",
test.commit, cmp.Diff(got, test.want),
)
}
}
} | explode_data.jsonl/9004 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 145
} | [
2830,
3393,
2212,
5930,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
3638,
18200,
341,
197,
3174,
354,
11,
1848,
1669,
37214,
51442,
68587,
8623,
40679,
1171,
197,
743,
1848,
961,
2092,
341,
298,
3244,
13080,
445,
53859,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetReturnPayloadWithCond(t *testing.T) {
stmts := []*sysl.Statement{
{
Stmt: &sysl.Statement_Cond{
Cond: &sysl.Cond{
Test: "cond 1",
Stmt: []*sysl.Statement{
{
Stmt: &sysl.Statement_Ret{
Ret: &sysl.Return{
Payload: "test",
},
},
},
},
},
},
},
}
actual := getReturnPayload(stmts)
assert.Equal(t, "test", actual)
} | explode_data.jsonl/58746 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 230
} | [
2830,
3393,
1949,
5598,
29683,
2354,
49696,
1155,
353,
8840,
836,
8,
341,
55822,
82,
1669,
29838,
7791,
75,
70215,
515,
197,
197,
515,
298,
197,
31063,
25,
609,
7791,
75,
70215,
920,
2111,
515,
571,
197,
49696,
25,
609,
7791,
75,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInjectableEndpointRawDispatch(t *testing.T) {
endpoint, sock, dstIP := makeTestInjectableEndpoint(t)
endpoint.WriteRawPacket(dstIP, []byte{0xFA})
buf := make([]byte, ipv4.MaxTotalSize)
bytesRead, err := sock.Read(buf)
if err != nil {
t.Fatalf("Unable to read from socketpair: %v", err)
}
if got, want := buf[:bytesRead], []byte{0xFA}; !bytes.Equal(got, want) {
t.Fatalf("Read %v from the socketpair, wanted %v", got, want)
}
} | explode_data.jsonl/74607 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 179
} | [
2830,
3393,
13738,
480,
27380,
20015,
11283,
1155,
353,
8840,
836,
8,
341,
6246,
2768,
11,
11087,
11,
10648,
3298,
1669,
1281,
2271,
13738,
480,
27380,
1155,
692,
6246,
2768,
4073,
20015,
16679,
30260,
3298,
11,
3056,
3782,
90,
15,
7206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateDockerfiles(t *testing.T) {
wantedDockerfiles := []string{"./Dockerfile", "backend/Dockerfile", "frontend/Dockerfile"}
testCases := map[string]struct {
mockFileSystem func(mockFS afero.Fs)
err error
}{
"find Dockerfiles": {
mockFileSystem: func(mockFS afero.Fs) {
mockFS.MkdirAll("frontend", 0755)
mockFS.MkdirAll("backend", 0755)
afero.WriteFile(mockFS, "Dockerfile", []byte("FROM nginx"), 0644)
afero.WriteFile(mockFS, "frontend/Dockerfile", []byte("FROM nginx"), 0644)
afero.WriteFile(mockFS, "backend/Dockerfile", []byte("FROM nginx"), 0644)
},
err: nil,
},
"no Dockerfiles": {
mockFileSystem: func(mockFS afero.Fs) {},
err: fmt.Errorf("no Dockerfiles found within / or a sub-directory level below"),
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
// GIVEN
fs := &afero.Afero{Fs: afero.NewMemMapFs()}
tc.mockFileSystem(fs)
ws := &Workspace{
workingDir: "/",
copilotDir: "copilot",
fsUtils: &afero.Afero{
Fs: fs,
},
}
got, err := ws.ListDockerfiles()
if tc.err != nil {
require.EqualError(t, err, tc.err.Error())
} else {
require.NoError(t, err)
require.Equal(t, wantedDockerfiles, got)
}
})
}
} | explode_data.jsonl/30123 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 607
} | [
2830,
3393,
17926,
35,
13659,
7198,
1155,
353,
8840,
836,
8,
341,
6692,
7566,
35,
13659,
7198,
1669,
3056,
917,
4913,
1725,
35,
13659,
1192,
497,
330,
20942,
14953,
13659,
1192,
497,
330,
28181,
14953,
13659,
1192,
16707,
18185,
37302,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConverterMapStructWithFieldMapToReqField(t *testing.T) {
fieldMap := make(map[string]codegen.FieldMapperEntry)
fieldMap["Four"] = codegen.FieldMapperEntry{
QualifiedName: "Three",
Override: true,
}
lines, err := convertTypes(
"Foo", "Bar",
`struct NestedFoo {
1: required string one
2: optional string two
}
struct Foo {
1: required NestedFoo three
}
struct Bar {
1: required NestedFoo three
2: required NestedFoo four
}`,
nil,
fieldMap,
)
assert.NoError(t, err)
assertPrettyEqual(t, trim(`
if in.Three != nil {
out.Three = &structs.NestedFoo{}
out.Three.One = string(in.Three.One)
out.Three.Two = (*string)(in.Three.Two)
} else {
out.Three = nil
}
if in.Three != nil {
out.Four = &structs.NestedFoo{}
if in.Three != nil {
out.Four.One = string(in.Three.One)
}
if in.Three != nil {
out.Four.Two = (*string)(in.Three.Two)
}
} else {
out.Four = nil
}`),
lines)
} | explode_data.jsonl/62073 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 448
} | [
2830,
3393,
14920,
2227,
9422,
2354,
1877,
2227,
1249,
27234,
1877,
1155,
353,
8840,
836,
8,
341,
39250,
2227,
1669,
1281,
9147,
14032,
60,
95859,
17087,
10989,
5874,
340,
39250,
2227,
1183,
26972,
1341,
284,
2038,
4370,
17087,
10989,
587... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRescheduleMessages(t *testing.T) {
_, tsv, db := newTestTxExecutor(t)
defer db.Close()
defer tsv.StopService()
target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY}
_, err := tsv.messager.GetGenerator("nonmsg")
want := "message table nonmsg not found in schema"
require.Error(t, err)
require.Contains(t, err.Error(), want)
gen, err := tsv.messager.GetGenerator("msg")
require.NoError(t, err)
_, err = tsv.PostponeMessages(ctx, &target, gen, []string{"1", "2"})
want = "query: 'update msg set time_next"
require.Error(t, err)
assert.Contains(t, err.Error(), want)
db.AddQueryPattern("update msg set time_next = .*", &sqltypes.Result{RowsAffected: 1})
count, err := tsv.PostponeMessages(ctx, &target, gen, []string{"1", "2"})
require.NoError(t, err)
require.EqualValues(t, 1, count)
} | explode_data.jsonl/80010 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 325
} | [
2830,
3393,
1061,
8796,
15820,
1155,
353,
8840,
836,
8,
341,
197,
6878,
259,
3492,
11,
2927,
1669,
501,
2271,
31584,
25255,
1155,
340,
16867,
2927,
10421,
741,
16867,
259,
3492,
30213,
1860,
741,
28861,
1669,
3239,
16650,
35016,
90,
255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCtracedBlobstoreStorage_GetCallTrace(t *testing.T) {
var blobFactMock *mocks.StoreFactory
var blobStoreMock *mocks.Store
someErr := errors.New("generic error")
ctid := "some_call_trace"
tk := storage.TK{Type: cstorage.CtracedBlobType, Key: ctid}
ctData := "abcdefghijklmnopqrstuvwxyz"
blob := blobstore.Blob{
Type: tk.Type,
Key: tk.Key,
Value: []byte(ctData),
}
// Fail to start transaction
blobFactMock = &mocks.StoreFactory{}
blobStoreMock = &mocks.Store{}
blobFactMock.On("StartTransaction", mock.Anything).Return(nil, someErr).Once()
store := cstorage.NewCtracedBlobstore(blobFactMock)
_, err := store.GetCallTrace(placeholderNetworkID, ctid)
assert.Error(t, err)
blobFactMock.AssertExpectations(t)
blobStoreMock.AssertExpectations(t)
// store.Get fails with ErrNotFound
blobFactMock = &mocks.StoreFactory{}
blobStoreMock = &mocks.Store{}
blobFactMock.On("StartTransaction", mock.Anything).Return(blobStoreMock, nil).Once()
blobStoreMock.On("Rollback").Return(nil).Once()
blobStoreMock.On("Get", placeholderNetworkID, tk).Return(blobstore.Blob{}, merrors.ErrNotFound).Once()
store = cstorage.NewCtracedBlobstore(blobFactMock)
_, err = store.GetCallTrace(placeholderNetworkID, ctid)
assert.Exactly(t, merrors.ErrNotFound, err)
blobFactMock.AssertExpectations(t)
blobStoreMock.AssertExpectations(t)
// store.Get fails with error other than ErrNotFound
blobFactMock = &mocks.StoreFactory{}
blobStoreMock = &mocks.Store{}
blobFactMock.On("StartTransaction", mock.Anything).Return(blobStoreMock, nil).Once()
blobStoreMock.On("Rollback").Return(nil).Once()
blobStoreMock.On("Get", placeholderNetworkID, tk).Return(blobstore.Blob{}, someErr).Once()
store = cstorage.NewCtracedBlobstore(blobFactMock)
_, err = store.GetCallTrace(placeholderNetworkID, ctid)
assert.Error(t, err)
assert.NotEqual(t, merrors.ErrNotFound, err)
blobFactMock.AssertExpectations(t)
blobStoreMock.AssertExpectations(t)
// Success
blobFactMock = &mocks.StoreFactory{}
blobStoreMock = &mocks.Store{}
blobFactMock.On("StartTransaction", mock.Anything).Return(blobStoreMock, nil).Once()
blobStoreMock.On("Rollback").Return(nil).Once()
blobStoreMock.On("Get", placeholderNetworkID, tk).Return(blob, nil).Once()
blobStoreMock.On("Commit").Return(nil).Once()
store = cstorage.NewCtracedBlobstore(blobFactMock)
callTraceRecvd, err := store.GetCallTrace(placeholderNetworkID, ctid)
assert.NoError(t, err)
assert.Equal(t, ctData, string(callTraceRecvd))
blobFactMock.AssertExpectations(t)
blobStoreMock.AssertExpectations(t)
} | explode_data.jsonl/81604 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1016
} | [
2830,
3393,
77227,
4435,
37985,
4314,
5793,
13614,
7220,
6550,
1155,
353,
8840,
836,
8,
341,
2405,
23404,
17417,
11571,
353,
16712,
82,
38047,
4153,
198,
2405,
23404,
6093,
11571,
353,
16712,
82,
38047,
198,
1903,
635,
7747,
1669,
5975,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetUserGroupsMultiple(t *testing.T) {
requests := []*http.Request{}
ts := httptest.NewTLSServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if len(requests) == 0 {
fmt.Fprintln(w, getGroupsPage1Response)
} else {
fmt.Fprintln(w, getGroupsPage2Response)
}
requests = append(requests, r)
}),
)
defer ts.Close()
duo := buildAdminClient(ts.URL, nil)
result, err := duo.GetUserGroups("DU3RP9I2WOC59VZX672N")
if len(requests) != 2 {
t.Errorf("Expected two requets, found %d", len(requests))
}
if len(result.Response) != 4 {
t.Errorf("Expected four groups in the response, found %d", len(result.Response))
}
if err != nil {
t.Errorf("Expected err to be nil, found %s", err)
}
} | explode_data.jsonl/61406 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 313
} | [
2830,
3393,
1949,
1474,
22173,
32089,
1155,
353,
8840,
836,
8,
341,
23555,
82,
1669,
29838,
1254,
9659,
16094,
57441,
1669,
54320,
70334,
7121,
13470,
1220,
2836,
1006,
197,
28080,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLaunchDebugRequest(t *testing.T) {
rescueStderr := os.Stderr
r, w, _ := os.Pipe()
os.Stderr = w
tmpBin := "__tmpBin"
runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) {
// We reuse the harness that builds, but ignore the built binary,
// only relying on the source to be built in response to LaunchRequest.
runDebugSession(t, client, "launch", func() {
wd, _ := os.Getwd()
client.LaunchRequestWithArgs(map[string]interface{}{
"mode": "debug", "program": fixture.Source, "output": filepath.Join(wd, tmpBin)})
}, fixture.Source)
})
// Wait for the test to finish to capture all stderr
time.Sleep(100 * time.Millisecond)
w.Close()
err, _ := ioutil.ReadAll(r)
t.Log(string(err))
os.Stderr = rescueStderr
rmErrRe, _ := regexp.Compile(`could not remove .*\n`)
rmErr := rmErrRe.FindString(string(err))
if rmErr != "" {
// On Windows, a file in use cannot be removed, resulting in "Access is denied".
// When the process exits, Delve releases the binary by calling
// BinaryInfo.Close(), but it appears that it is still in use (by Windows?)
// shortly after. gobuild.Remove has a delay to address this, but
// to avoid any test flakiness we guard against this failure here as well.
if runtime.GOOS != "windows" || !stringContainsCaseInsensitive(rmErr, "Access is denied") {
t.Fatalf("Binary removal failure:\n%s\n", rmErr)
}
} else {
// We did not get a removal error, but did we even try to remove before exiting?
// Confirm that the binary did get removed.
if _, err := os.Stat(tmpBin); err == nil || os.IsExist(err) {
t.Fatal("Failed to remove temp binary", tmpBin)
}
}
} | explode_data.jsonl/17345 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 595
} | [
2830,
3393,
32067,
7939,
1900,
1155,
353,
8840,
836,
8,
341,
10202,
31724,
22748,
615,
1669,
2643,
77319,
198,
7000,
11,
289,
11,
716,
1669,
2643,
1069,
3444,
741,
25078,
77319,
284,
289,
271,
20082,
28794,
1669,
13265,
5173,
28794,
698... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.