Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestInit0 (0.15 sec)

  1. src/container/heap/heap_test.go

    		}
    		h.verify(t, j1)
    	}
    	if j2 < n {
    		if h.Less(j2, i) {
    			t.Errorf("heap invariant invalidated [%d] = %d > [%d] = %d", i, h[i], j1, h[j2])
    			return
    		}
    		h.verify(t, j2)
    	}
    }
    
    func TestInit0(t *testing.T) {
    	h := new(myHeap)
    	for i := 20; i > 0; i-- {
    		h.Push(0) // all elements are the same
    	}
    	Init(h)
    	h.verify(t, 0)
    
    	for i := 1; h.Len() > 0; i++ {
    		x := Pop(h).(int)
    		h.verify(t, 0)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 3.4K bytes
    - Viewed (0)
Back to top