Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for ValueFuzz (0.13 sec)

  1. staging/src/k8s.io/apimachinery/pkg/api/apitesting/fuzzer/valuefuzz.go

    limitations under the License.
    */
    
    package fuzzer
    
    import (
    	"reflect"
    )
    
    // ValueFuzz recursively changes all basic type values in an object. Any kind of references will not
    // be touch, i.e. the addresses of slices, maps, pointers will stay unchanged.
    func ValueFuzz(obj interface{}) {
    	valueFuzz(reflect.ValueOf(obj))
    }
    
    func valueFuzz(obj reflect.Value) {
    	switch obj.Kind() {
    	case reflect.Array:
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Jun 25 16:23:43 UTC 2022
    - 2.3K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/api/apitesting/fuzzer/valuefuzz_test.go

    			Map   map[string]int
    			Slice []int
    		}
    	)
    
    	x := X{
    		Ptr:   &X{},
    		Map:   map[string]int{"foo": 42},
    		Slice: []int{1, 2, 3},
    	}
    
    	p := x.Ptr
    	m := x.Map
    	s := x.Slice
    
    	ValueFuzz(x)
    
    	if x.Ptr.Y.I == 0 {
    		t.Errorf("x.Ptr.Y.I should have changed")
    	}
    
    	if x.Map["foo"] == 42 {
    		t.Errorf("x.Map[foo] should have changed")
    	}
    
    	if x.Slice[0] == 1 {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Aug 01 19:31:12 UTC 2018
    - 1.3K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apimachinery/pkg/api/apitesting/roundtrip/roundtrip.go

    	// the deep-copy was actually only a shallow copy. Then original and obj3 will be different after fuzzing.
    	// NOTE: we use the encoding+decoding here as an alternative, guaranteed deep-copy to compare against.
    	fuzzer.ValueFuzz(object)
    	if !apiequality.Semantic.DeepEqual(original, obj3) {
    		t.Errorf("%v: fuzzing a copy altered the original, diff: %v", name, cmp.Diff(original, obj3))
    		return
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 12 15:48:03 UTC 2023
    - 16.8K bytes
    - Viewed (0)
Back to top