Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for testBytes (0.23 sec)

  1. src/bytes/buffer_test.go

    var testString string // test data for write tests
    var testBytes []byte  // test data; same as testString but as a slice.
    
    type negativeReader struct{}
    
    func (r *negativeReader) Read([]byte) (int, error) { return -1, nil }
    
    func init() {
    	testBytes = make([]byte, N)
    	for i := 0; i < N; i++ {
    		testBytes[i] = 'a' + byte(i%26)
    	}
    	testString = string(testBytes)
    }
    
    // Verify that contents of buf match the string s.
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Apr 26 13:31:36 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  2. src/bytes/reader_test.go

    	}
    	wg.Wait()
    }
    
    func TestReaderWriteTo(t *testing.T) {
    	for i := 0; i < 30; i += 3 {
    		var l int
    		if i > 0 {
    			l = len(testString) / i
    		}
    		s := testString[:l]
    		r := NewReader(testBytes[:l])
    		var b Buffer
    		n, err := r.WriteTo(&b)
    		if expect := int64(len(s)); n != expect {
    			t.Errorf("got %v; want %v", n, expect)
    		}
    		if err != nil {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Dec 13 18:45:54 GMT 2021
    - 8K bytes
    - Viewed (0)
Back to top