-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add interoperability tests #151
Comments
All the LZ4 compressed files in the testdata directory have been generated by the C reference implementation. |
It is interesting.
|
Here is an example of interoperability test for legacy writer diff --git a/writer_test.go b/writer_test.go
index e43fd36..f0fee40 100644
--- a/writer_test.go
+++ b/writer_test.go
@@ -7,6 +7,7 @@ import (
"io"
"io/ioutil"
"os"
+ "os/exec"
"reflect"
"strings"
"testing"
@@ -247,6 +248,22 @@ func TestWriterLegacy(t *testing.T) {
t.Fatal(err)
}
+ tmp, err := os.CreateTemp("", "")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.Remove(tmp.Name())
+ if _, err := tmp.Write(out.Bytes()); err != nil {
+ t.Fatal(err)
+ }
+
+ cmd := exec.Command("lz4", "--test", tmp.Name())
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ if err := cmd.Run(); err != nil {
+ t.Fatal(err)
+ }
+
out2 := new(bytes.Buffer) |
Weird fact that
but the error code is 0. |
It would be great to add tests to make sure this library is compatible with
lz4
C library (that can be considered here as a reference implementation).Add a test that
lz4
command-line tool and then decompresses with this golang libraryVerify different compression mode, legacy/modern formats, ....
The text was updated successfully, but these errors were encountered: