Skip to content

Commit

Permalink
tests: add additional TestWrite10Tight test
Browse files Browse the repository at this point in the history
Try to find out what goes wrong in
#363
  • Loading branch information
rfjakob committed Apr 8, 2019
1 parent fe06e9f commit 311c34a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/matrix/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,45 @@ func TestWrite100x100(t *testing.T) {
}
}

func TestWrite10Tight(t *testing.T) {
path := test_helpers.DefaultPlainDir + "/TestWrite10Tight"
content := make([]byte, 10)
buf := make([]byte, 100)
for i := 0; i < 1000; i++ {
file, err := os.Create(path)
if err != nil {
t.Fatal(err)
}
_, err = file.Write(content)
if err != nil {
t.Fatal(err)
}
err = file.Close()
if err != nil {
t.Fatal(err)
}
file, err = os.Open(path)
if err != nil {
t.Fatal(err)
}
n, err := file.Read(buf)
if err != nil {
t.Fatal(err)
}
if n != 10 {
t.Fatalf("want 10 bytes, got %d", n)
}
err = file.Close()
if err != nil {
t.Fatal(err)
}
err = os.Remove(path)
if err != nil {
t.Fatal()
}
}
}

// Hint for calculating reference md5sums:
// dd if=/dev/zero count=1 bs=XYZ | md5sum
func TestTruncate(t *testing.T) {
Expand Down

0 comments on commit 311c34a

Please sign in to comment.