Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 980 for u8marshal (0.2 sec)

  1. staging/src/k8s.io/apimachinery/pkg/api/resource/quantity_proto_test.go

    	}
    	for _, testCase := range table2 {
    		q := Quantity{d: infDecAmount{testCase.dec}, Format: DecimalSI}
    		// Won't currently get an error as MarshalTo can't return one
    		result, _ := q.Marshal()
    		q.Unmarshal(result)
    		if q.Cmp(testCase.expect) != 0 {
    			t.Errorf("Expected: %v, Actual: %v", testCase.expect, q)
    		}
    	}
    }
    
    func TestQuantityProtoUnmarshal(t *testing.T) {
    	// Test when d is nil
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Apr 25 07:12:11 UTC 2017
    - 3.7K bytes
    - Viewed (0)
  2. pkg/model/proxy_test.go

    		t.Run(tt.name, func(t *testing.T) {
    			j, err := json.Marshal(tt.in)
    			if err != nil {
    				t.Fatalf("failed to marshal: %v", err)
    			}
    			if string(j) != tt.out {
    				t.Errorf("Got json '%s', expected '%s'", string(j), tt.out)
    			}
    			var meta model.BootstrapNodeMetadata
    			if err := json.Unmarshal(j, &meta); err != nil {
    				t.Fatalf("failed to unmarshal: %v", err)
    			}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Mar 28 20:38:02 UTC 2024
    - 8.2K bytes
    - Viewed (0)
  3. src/encoding/json/fuzz_test.go

    			func() interface{} { return new([]interface{}) },
    		} {
    			i := typ()
    			if err := Unmarshal(b, i); err != nil {
    				return
    			}
    
    			encoded, err := Marshal(i)
    			if err != nil {
    				t.Fatalf("failed to marshal: %s", err)
    			}
    
    			if err := Unmarshal(encoded, i); err != nil {
    				t.Fatalf("failed to roundtrip: %s", err)
    			}
    		}
    	})
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 13 18:06:33 UTC 2022
    - 1.3K bytes
    - Viewed (0)
  4. pkg/api/testing/serialization_proto_test.go

    	for i := range items {
    		data, err := (&items[i]).Marshal()
    		if err != nil {
    			b.Fatal(err)
    		}
    		encoded[i] = data
    		validate := &v1.Pod{}
    		if err := proto.Unmarshal(data, validate); err != nil {
    			b.Fatalf("Failed to unmarshal %d: %v\n%#v", i, err, items[i])
    		}
    	}
    
    	for i := 0; i < b.N; i++ {
    		obj := v1.Pod{}
    		if err := proto.Unmarshal(encoded[i%width], &obj); err != nil {
    			b.Fatal(err)
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Jun 25 16:23:43 UTC 2022
    - 7.1K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct/direct.go

    package direct
    
    import (
    	"k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes"
    )
    
    func Marshal(src interface{}) ([]byte, error) {
    	return modes.Encode.Marshal(src)
    }
    
    func Unmarshal(src []byte, dst interface{}) error {
    	return modes.Decode.Unmarshal(src, dst)
    }
    
    func Diagnose(src []byte) (string, error) {
    	return modes.Diagnostic.Diagnose(src)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Feb 15 15:31:10 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  6. internal/bucket/lifecycle/filter_test.go

    		},
    		ObjectSizeGreaterThan: 100 * humanize.MiByte,
    		ObjectSizeLessThan:    100 * humanize.GiByte,
    	}
    	b, err := xml.Marshal(f1)
    	if err != nil {
    		t.Fatalf("Failed to marshal %v", f1)
    	}
    	var f2 Filter
    	err = xml.Unmarshal(b, &f2)
    	if err != nil {
    		t.Fatalf("Failed to unmarshal %s", string(b))
    	}
    	if f1.ObjectSizeLessThan != f2.ObjectSizeLessThan {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue Feb 27 00:01:20 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go

    	m.Time = time.Unix(p.Seconds, int64(truncatedNanoseconds)).Local()
    	return nil
    }
    
    // Marshal implements the protobuf marshalling interface.
    func (m *MicroTime) Marshal() (data []byte, err error) {
    	if m == nil || m.Time.IsZero() {
    		return nil, nil
    	}
    	return m.ProtoMicroTime().Marshal()
    }
    
    // MarshalTo implements the protobuf marshalling interface.
    func (m *MicroTime) MarshalTo(data []byte) (int, error) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Sep 02 08:21:04 UTC 2022
    - 2.3K bytes
    - Viewed (0)
  8. src/encoding/json/tagkey_test.go

    	}
    	for _, tt := range tests {
    		t.Run(tt.Name, func(t *testing.T) {
    			b, err := Marshal(tt.raw)
    			if err != nil {
    				t.Fatalf("%s: Marshal error: %v", tt.Where, err)
    			}
    			var f any
    			err = Unmarshal(b, &f)
    			if err != nil {
    				t.Fatalf("%s: Unmarshal error: %v", tt.Where, err)
    			}
    			for k, v := range f.(map[string]any) {
    				if k == tt.key {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Aug 25 16:00:37 UTC 2023
    - 2.9K bytes
    - Viewed (0)
  9. pkg/kubelet/checkpointmanager/testing/example_checkpoint_formats/v1/types.go

    }
    
    // MarshalCheckpoint tries to marshal the CheckpointData into JSON data.
    func (cp *CheckpointData) MarshalCheckpoint() ([]byte, error) {
    	cp.Checksum = checksum.New(*cp.Data)
    	return json.Marshal(*cp)
    }
    
    // UnmarshalCheckpoint tries to unmarshal the passed JSON data into CheckpointData.
    func (cp *CheckpointData) UnmarshalCheckpoint(blob []byte) error {
    	return json.Unmarshal(blob, cp)
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Dec 19 03:53:33 UTC 2019
    - 1.9K bytes
    - Viewed (0)
  10. pkg/kube/inject/template.go

    	if m == nil {
    		return "{}"
    	}
    
    	ba, err := json.Marshal(m)
    	if err != nil {
    		log.Warnf("Unable to marshal %v", m)
    		return "{}"
    	}
    
    	return string(ba)
    }
    
    func fromJSON(j string) any {
    	var m any
    	err := json.Unmarshal([]byte(j), &m)
    	if err != nil {
    		log.Warnf("Unable to unmarshal %s", j)
    		return "{}"
    	}
    
    	return m
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Nov 16 02:12:03 UTC 2023
    - 9.9K bytes
    - Viewed (0)
Back to top