diff options
author | Jakob Unterwurzacher | 2015-11-01 12:11:36 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2015-11-01 12:11:36 +0100 |
commit | 902babdf22199d73171716e643f1ffbb65e6fb48 (patch) | |
tree | c3194bce9fd9b4db0a569fca3b5041abd278be70 /main_test.go | |
parent | 14276c96328a1a1ad2b354c65d8db7fa720559e1 (diff) |
Refactor ciphertext <-> plaintext offset translation functions
Move all the intelligence into the new file address_translation.go.
That the calculations were spread out too much became apparent when adding
the file header. This should make the code much easier to modify in the
future.
Diffstat (limited to 'main_test.go')
-rw-r--r-- | main_test.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/main_test.go b/main_test.go index 287c792..9262e6f 100644 --- a/main_test.go +++ b/main_test.go @@ -1,8 +1,6 @@ package main import ( - "runtime" - "sync" "bytes" "crypto/md5" "encoding/hex" @@ -11,6 +9,8 @@ import ( "io/ioutil" "os" "os/exec" + "runtime" + "sync" "testing" ) @@ -121,7 +121,7 @@ func testWriteN(t *testing.T, fn string, n int) string { } file.Close() - verifySize(t, plainDir + fn, n) + verifySize(t, plainDir+fn, n) bin := md5.Sum(d) hashWant := hex.EncodeToString(bin[:]) @@ -244,12 +244,12 @@ func TestFileHoles(t *testing.T) { } func sContains(haystack []string, needle string) bool { - for _, element := range haystack { - if element == needle { - return true - } - } - return false + for _, element := range haystack { + if element == needle { + return true + } + } + return false } func TestRmwRace(t *testing.T) { @@ -313,10 +313,10 @@ func TestRmwRace(t *testing.T) { goodMd5[m] = goodMd5[m] + 1 /* - if m == "6c1660fdabccd448d1359f27b3db3c99" { - fmt.Println(hex.Dump(buf)) - t.FailNow() - } + if m == "6c1660fdabccd448d1359f27b3db3c99" { + fmt.Println(hex.Dump(buf)) + t.FailNow() + } */ } fmt.Println(goodMd5) |