From 4ca1c3bbb76834c69b0d8e63c921ca3548f529ac Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Tue, 14 Sep 2021 16:43:29 +0200 Subject: add load/store sketches+fingerprints & store them Fix corresponding Commit tests by adding sketches and fingerprints files in repo_8k and repo_8k_zlib. Also enhance CommitTests by checking recipe files --- repo_test.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'repo_test.go') diff --git a/repo_test.go b/repo_test.go index b16ddc6..f6f6edd 100644 --- a/repo_test.go +++ b/repo_test.go @@ -319,6 +319,7 @@ func assertSameTree(t *testing.T, apply func(t *testing.T, expected string, actu func assertCompatibleRepoFile(t *testing.T, expected string, actual string, prefix string) { if filepath.Base(expected) == filesName { + // Filelist file eFiles := loadFileList(expected) aFiles := loadFileList(actual) assertLen(t, len(eFiles), aFiles, prefix) @@ -329,8 +330,23 @@ func assertCompatibleRepoFile(t *testing.T, expected string, actual string, pref } } } else if filepath.Base(expected) == recipeName { - // TODO: check recipies equality + // Recipe file + eRecipe := loadRecipe(expected) + aRecipe := loadRecipe(actual) + assertLen(t, len(eRecipe), aRecipe, prefix) + for i, eChunk := range eRecipe { + if reflect.DeepEqual(eChunk, aRecipe[i]) { + continue + } else { + t.Fatal(prefix, "chunk do not match:", aRecipe[i], ", expected", eChunk) + } + } + } else if filepath.Base(expected) == sketchesName { + // TODO: check Sketches file + } else if filepath.Base(expected) == fingerprintsName { + // TODO: check Fingerprints file } else { + // Chunk content file assertSameFile(t, expected, actual, prefix) } } -- cgit v1.2.3