|
@@ -8,6 +8,7 @@ import (
|
|
|
"bytes"
|
|
"bytes"
|
|
|
"reflect"
|
|
"reflect"
|
|
|
"testing"
|
|
"testing"
|
|
|
|
|
+ "unsafe"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func testFramer() (*Framer, *bytes.Buffer) {
|
|
func testFramer() (*Framer, *bytes.Buffer) {
|
|
@@ -15,6 +16,13 @@ func testFramer() (*Framer, *bytes.Buffer) {
|
|
|
return NewFramer(buf, buf), buf
|
|
return NewFramer(buf, buf), buf
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func TestFrameSizes(t *testing.T) {
|
|
|
|
|
+ // Catch people rearranging the FrameHeader fields.
|
|
|
|
|
+ if got, want := int(unsafe.Sizeof(FrameHeader{})), 12; got != want {
|
|
|
|
|
+ t.Errorf("FrameHeader size = %d; want %d", got, want)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func TestWriteRST(t *testing.T) {
|
|
func TestWriteRST(t *testing.T) {
|
|
|
fr, buf := testFramer()
|
|
fr, buf := testFramer()
|
|
|
var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4
|
|
var streamID uint32 = 1<<24 + 2<<16 + 3<<8 + 4
|