Explorar o código

Add some length/offset tests where offset < length.

Nigel Tao %!s(int64=10) %!d(string=hai) anos
pai
achega
51195a16b0
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      snappy_test.go

+ 10 - 0
snappy_test.go

@@ -197,6 +197,16 @@ func TestDecode(t *testing.T) {
 		"\x08" + "\x0cabcd" + "\x01\x04",
 		"abcdabcd",
 		nil,
+	}, {
+		`decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=2; valid input`,
+		"\x08" + "\x0cabcd" + "\x01\x02",
+		"abcdcdcd",
+		nil,
+	}, {
+		`decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=1; valid input`,
+		"\x08" + "\x0cabcd" + "\x01\x01",
+		"abcddddd",
+		nil,
 	}, {
 		`decodedLen=8; tagLiteral (4 bytes "abcd"); tagCopy1; length=4 offset=0; zero offset`,
 		"\x08" + "\x0cabcd" + "\x01\x00",