Browse Source

Add some length/offset tests where offset < length.

Nigel Tao 9 years ago
parent
commit
51195a16b0
1 changed files with 10 additions and 0 deletions
  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",