Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestAllocations (0.3 sec)

  1. src/reflect/all_test.go

    	}
    	i := -1
    	allocs := testing.AllocsPerRun(n, func() {
    		f(i)
    		i++
    	})
    	if allocs > 0 {
    		t.Errorf("%d iterations: got %v mallocs, want 0", n, allocs)
    	}
    }
    
    func TestAllocations(t *testing.T) {
    	noAlloc(t, 100, func(j int) {
    		var i any
    		var v Value
    
    		i = 42 + j
    		v = ValueOf(i)
    		if int(v.Int()) != 42+j {
    			panic("wrong int")
    		}
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 218.8K bytes
    - Viewed (0)
Back to top