golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/quic/quic_test.go (about)

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build go1.21
     6  
     7  package quic
     8  
     9  import (
    10  	"testing"
    11  )
    12  
    13  func testSides(t *testing.T, name string, f func(*testing.T, connSide)) {
    14  	if name != "" {
    15  		name += "/"
    16  	}
    17  	t.Run(name+"server", func(t *testing.T) { f(t, serverSide) })
    18  	t.Run(name+"client", func(t *testing.T) { f(t, clientSide) })
    19  }
    20  
    21  func testStreamTypes(t *testing.T, name string, f func(*testing.T, streamType)) {
    22  	if name != "" {
    23  		name += "/"
    24  	}
    25  	t.Run(name+"bidi", func(t *testing.T) { f(t, bidiStream) })
    26  	t.Run(name+"uni", func(t *testing.T) { f(t, uniStream) })
    27  }
    28  
    29  func testSidesAndStreamTypes(t *testing.T, name string, f func(*testing.T, connSide, streamType)) {
    30  	if name != "" {
    31  		name += "/"
    32  	}
    33  	t.Run(name+"server/bidi", func(t *testing.T) { f(t, serverSide, bidiStream) })
    34  	t.Run(name+"client/bidi", func(t *testing.T) { f(t, clientSide, bidiStream) })
    35  	t.Run(name+"server/uni", func(t *testing.T) { f(t, serverSide, uniStream) })
    36  	t.Run(name+"client/uni", func(t *testing.T) { f(t, clientSide, uniStream) })
    37  }