浏览代码

Add some length/offset tests where offset < length.

Nigel Tao 9 年之前
父节点
当前提交
51195a16b0
共有 1 个文件被更改,包括 10 次插入0 次删除
  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",