Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 69 for setstruct (0.38 sec)

  1. src/cmd/cgo/internal/test/test.go

    	*x = 1;
    }
    
    void setintptr(intptr x) {
    	*x = 1;
    }
    
    void setvoidptr(void *x) {
    	*(int*)x = 1;
    }
    
    typedef struct Struct Struct;
    struct Struct {
    	int *P;
    };
    
    void setstruct(Struct s) {
    	*s.P = 1;
    }
    
    // issue 11925
    // Structs with zero-length trailing fields are now padded by the Go compiler.
    
    struct a11925 {
    	int i;
    	char a[0];
    	char b[0];
    };
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 15:50:06 UTC 2024
    - 48.5K bytes
    - Viewed (0)
  2. src/encoding/asn1/marshal_test.go

    type marshalWithParamsTest struct {
    	in     any
    	params string
    	out    string // hex encoded
    }
    
    var marshalWithParamsTests = []marshalWithParamsTest{
    	{intStruct{10}, "set", "310302010a"},
    	{intStruct{10}, "application", "600302010a"},
    	{intStruct{10}, "private", "e00302010a"},
    }
    
    func TestMarshalWithParams(t *testing.T) {
    	for i, test := range marshalWithParamsTests {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 10K bytes
    - Viewed (0)
  3. pkg/typemap/map_test.go

    	typemap.Set[TestInterface[string]](tm, TestStruct{Field: "interface"})
    
    	assert.Equal(t, typemap.Get[int](tm), ptr.Of(1))
    	assert.Equal(t, typemap.Get[int32](tm), ptr.Of(int32(2)))
    	assert.Equal(t, typemap.Get[string](tm), ptr.Of("string"))
    	assert.Equal(t, typemap.Get[*TestStruct](tm), ptr.Of(&TestStruct{Field: "pointer"}))
    	assert.Equal(t, typemap.Get[TestInterface[string]](tm), ptr.Of(TestInterface[string](TestStruct{Field: "interface"})))
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Apr 17 16:38:40 UTC 2024
    - 1.5K bytes
    - Viewed (0)
  4. test/fixedbugs/bug054.go

    func (v *Vector) At(i int) Element {
    	return v.elem[i];
    }
    
    type TStruct struct {
    	name string;
    	fields *Vector;
    }
    
    func (s *TStruct) field(i int) *TStruct {
    	return s.fields.At(i).(*TStruct);
    }
    
    func main() {
    	v := new(Vector);
    	v.elem = make([]Element, 10);
    	t := new(TStruct);
    	t.name = "hi";
    	v.elem[0] = t;
    	s := new(TStruct);
    	s.name = "foo";
    	s.fields = v;
    	if s.field(0).name != "hi" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 17 04:48:57 UTC 2012
    - 669 bytes
    - Viewed (0)
  5. src/cmd/compile/internal/types/type.go

    	if fieldsHasShape(allParams) {
    		t.SetHasShape(true)
    	}
    
    	return t
    }
    
    // NewStruct returns a new struct with the given fields.
    func NewStruct(fields []*Field) *Type {
    	t := newType(TSTRUCT)
    	t.setFields(fields)
    	if fieldsHasShape(fields) {
    		t.SetHasShape(true)
    	}
    	for _, f := range fields {
    		if f.Type.NotInHeap() {
    			t.SetNotInHeap(true)
    			break
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:29:45 UTC 2024
    - 49.5K bytes
    - Viewed (0)
  6. staging/src/k8s.io/cli-runtime/pkg/printers/json_test.go

    	"k8s.io/apimachinery/pkg/util/json"
    	"k8s.io/client-go/kubernetes/scheme"
    )
    
    var testData = TestStruct{
    	TypeMeta:   metav1.TypeMeta{APIVersion: "foo/bar", Kind: "TestStruct"},
    	Key:        "testValue",
    	Map:        map[string]int{"TestSubkey": 1},
    	StringList: []string{"a", "b", "c"},
    	IntList:    []int{1, 2, 3},
    }
    
    type TestStruct struct {
    	metav1.TypeMeta   `json:",inline"`
    	metav1.ObjectMeta `json:"metadata,omitempty"`
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 12 15:46:12 UTC 2023
    - 4K bytes
    - Viewed (0)
  7. pkg/config/model_test.go

    				return c
    			},
    			protocmp.Transform(),
    		},
    		// Random struct pointer
    		{
    			&TestStruct{Name: "foobar"},
    			func(c Spec) Spec {
    				c.(*TestStruct).Name = "bar"
    				return c
    			},
    			nil,
    		},
    		// Random struct
    		{
    			TestStruct{Name: "foobar"},
    			func(c Spec) Spec {
    				x := c.(TestStruct)
    				x.Name = "bar"
    				return x
    			},
    			nil,
    		},
    		// Slice
    		{
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Apr 12 17:37:32 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  8. src/unique/handle_test.go

    	testHandle[testStringStruct](t, testStringStruct{"x"})
    	testHandle[testStringStructArrayStruct](t, testStringStructArrayStruct{
    		s: [2]testStringStruct{testStringStruct{"y"}, testStringStruct{"z"}},
    	})
    	testHandle[testStruct](t, testStruct{0.5, "184"})
    }
    
    func testHandle[T comparable](t *testing.T, value T) {
    	name := reflect.TypeFor[T]().Name()
    	t.Run(fmt.Sprintf("%s/%#v", name, value), func(t *testing.T) {
    		t.Parallel()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 22 18:14:07 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/noder/lex_test.go

    		if !eq(got, tt.want) {
    			t.Errorf("pragmaFields(%q) = %v; want %v", tt.in, got, tt.want)
    			continue
    		}
    	}
    }
    
    func TestPragcgo(t *testing.T) {
    	type testStruct struct {
    		in   string
    		want []string
    	}
    
    	var tests = []testStruct{
    		{`go:cgo_export_dynamic local`, []string{`cgo_export_dynamic`, `local`}},
    		{`go:cgo_export_dynamic local remote`, []string{`cgo_export_dynamic`, `local`, `remote`}},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Dec 23 06:39:06 UTC 2020
    - 3.6K bytes
    - Viewed (0)
  10. operator/pkg/util/reflect_test.go

    	}
    }
    
    func TestIsValueFuncs(t *testing.T) {
    	testInt := int(42)
    	testStruct := struct{}{}
    	testSlice := []bool{}
    	testMap := map[bool]bool{}
    	var testNilSlice []bool
    	var testNilMap map[bool]bool
    
    	allValues := []any{nil, testInt, &testInt, testStruct, &testStruct, testNilSlice, testSlice, &testSlice, testNilMap, testMap, &testMap}
    
    	tests := []struct {
    		desc     string
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 10.2K bytes
    - Viewed (0)
Back to top