File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,32 @@ func TestOR(t *testing.T) {
9292 }
9393}
9494
95+ func TestORBytesInexactOverlap (t * testing.T ) {
96+ shouldPanic := func (f func ()) (ok bool ) {
97+ defer func () {
98+ if r := recover (); r != nil {
99+ if r .(string ) == "ORBytes: invalid overlap" {
100+ ok = true
101+ }
102+ }
103+ }()
104+ f ()
105+ return
106+ }
107+ a := make ([]byte , 5 )
108+ if ok := shouldPanic (func () {
109+ ORBytes (a [1 :4 ], a [0 :3 ], make ([]byte , 3 ))
110+ }); ! ok {
111+ t .Error ("expected panic on inexact overlap" )
112+ }
113+
114+ if ok := shouldPanic (func () {
115+ ORBytes (a [1 :4 ], make ([]byte , 3 ), a [0 :3 ])
116+ }); ! ok {
117+ t .Error ("expected panic on inexact overlap" )
118+ }
119+ }
120+
95121// Tests that bit testing works for various alignments.
96122func TestTest (t * testing.T ) {
97123 for align := 0 ; align < 2 ; align ++ {
You can’t perform that action at this time.
0 commit comments