mirror of
				https://github.com/ipfs/kubo.git
				synced 2025-10-31 09:56:05 +08:00 
			
		
		
		
	 bf22aeec0a
			
		
	
	bf22aeec0a
	
	
	
		
			
			- Modified Godeps/Godeps.json by hand - [TEST] Updated welcome docs hash to sharness - [TEST] Updated contact doc - [TEST] disabled breaking test (t0080-repo refs local)
		
			
				
	
	
		
			26 lines
		
	
	
		
			483 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			483 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package core
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	peer "github.com/ipfs/go-ipfs/p2p/peer"
 | |
| 	testutil "github.com/ipfs/go-ipfs/util/testutil"
 | |
| )
 | |
| 
 | |
| func TestSubsetWhenMaxIsGreaterThanLengthOfSlice(t *testing.T) {
 | |
| 	var ps []peer.PeerInfo
 | |
| 	sizeofSlice := 100
 | |
| 	for i := 0; i < sizeofSlice; i++ {
 | |
| 		pid, err := testutil.RandPeerID()
 | |
| 		if err != nil {
 | |
| 			t.Fatal(err)
 | |
| 		}
 | |
| 
 | |
| 		ps = append(ps, peer.PeerInfo{ID: pid})
 | |
| 	}
 | |
| 	out := randomSubsetOfPeers(ps, 2*sizeofSlice)
 | |
| 	if len(out) != len(ps) {
 | |
| 		t.Fail()
 | |
| 	}
 | |
| }
 |