aboutsummaryrefslogtreecommitdiff
path: root/repo_test.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-07 12:45:11 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-07 12:45:11 +0200
commit3d8e298b02dd09ca0ff896fbd8c1d4fc91be0b03 (patch)
tree40a19c594b72b9623378656507a26e462a84b603 /repo_test.go
parent88ecfcb7b517fd3cbed1c683b0d8835a4d55b2fc (diff)
downloaddna-backup-3d8e298b02dd09ca0ff896fbd8c1d4fc91be0b03.tar.gz
dna-backup-3d8e298b02dd09ca0ff896fbd8c1d4fc91be0b03.zip
prepare for recipe encoding by exporting fileds
Diffstat (limited to 'repo_test.go')
-rw-r--r--repo_test.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/repo_test.go b/repo_test.go
index 244942e..dc04126 100644
--- a/repo_test.go
+++ b/repo_test.go
@@ -123,11 +123,11 @@ func TestLoadChunks(t *testing.T) {
func TestExtractNewChunks(t *testing.T) {
repo := NewRepo("")
chunks := []Chunk{
- &TempChunk{value: []byte{'a'}},
- &LoadedChunk{id: &ChunkId{0, 0}},
- &TempChunk{value: []byte{'b'}},
- &TempChunk{value: []byte{'c'}},
- &LoadedChunk{id: &ChunkId{0, 1}},
+ &TempChunk{Value: []byte{'a'}},
+ &LoadedChunk{Id: &ChunkId{0, 0}},
+ &TempChunk{Value: []byte{'b'}},
+ &TempChunk{Value: []byte{'c'}},
+ &LoadedChunk{Id: &ChunkId{0, 1}},
}
newChunks := extractTempChunks(repo.mergeTempChunks(chunks))
assertLen(t, 2, newChunks, "New chunks:")
@@ -197,9 +197,9 @@ func TestBsdiff(t *testing.T) {
newChunks := extractDeltaChunks(repo.mergeTempChunks(recipe))
assertLen(t, 2, newChunks, "New delta chunks:")
for _, c := range newChunks {
- log.Println("Patch size:", len(c.patch))
- if len(c.patch) >= repo.chunkSize/10 {
- t.Errorf("Bsdiff of chunk is too large: %d", len(c.patch))
+ log.Println("Patch size:", len(c.Patch))
+ if len(c.Patch) >= repo.chunkSize/10 {
+ t.Errorf("Bsdiff of chunk is too large: %d", len(c.Patch))
}
}
}
@@ -209,6 +209,8 @@ func TestCommit(t *testing.T) {
source := path.Join("test", "data")
repo := NewRepo(dest)
repo.Commit(source)
+ recipe := loadRecipe(path.Join(dest, "00000", recipeName))
+ log.Println(recipe)
}
func assertLen(t *testing.T, expected int, actual interface{}, prefix string) {