Explorar el Código

Make TestDecodeLengthOffset test values above 16.

An upcoming commit will switch algorithms at values near this magic cutoff.
Nigel Tao hace 10 años
padre
commit
12528fe033
Se han modificado 1 ficheros con 5 adiciones y 5 borrados
  1. 5 5
      snappy_test.go

+ 5 - 5
snappy_test.go

@@ -330,8 +330,8 @@ loop:
 // copy-length-offset + literal. For example: "abcdefghijkl" + "efghij" + "AB".
 func TestDecodeLengthOffset(t *testing.T) {
 	const (
-		prefix = "abcdefghijkl"
-		suffix = "ABCDEFGHIJKL"
+		prefix = "abcdefghijklmnopqr"
+		suffix = "ABCDEFGHIJKLMNOPQR"
 
 		// notPresent is a byte value that is not present in either the input
 		// or the output. It is written to gotBuf to check that Decode does not
@@ -339,10 +339,10 @@ func TestDecodeLengthOffset(t *testing.T) {
 		notPresent = 0xfe
 	)
 	var gotBuf, wantBuf, inputBuf [256]byte
-	for length := 1; length < 12; length++ {
-		for offset := 1; offset < 12; offset++ {
+	for length := 1; length <= 18; length++ {
+		for offset := 1; offset <= 18; offset++ {
 		loop:
-			for suffixLen := 0; suffixLen < 12; suffixLen++ {
+			for suffixLen := 0; suffixLen <= 18; suffixLen++ {
 				totalLen := uint64(len(prefix) + length + suffixLen)
 
 				inputLen := binary.PutUvarint(inputBuf[:], totalLen)