From 3d8e298b02dd09ca0ff896fbd8c1d4fc91be0b03 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Tue, 7 Sep 2021 12:45:11 +0200 Subject: prepare for recipe encoding by exporting fileds --- repo_test.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'repo_test.go') 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) { -- cgit v1.2.3