diff options
author | josh.macdonald <jmacd@users.noreply.github.com> | 2008-08-09 15:24:05 +0000 |
---|---|---|
committer | josh.macdonald <jmacd@users.noreply.github.com> | 2008-08-09 15:24:05 +0000 |
commit | 3f6c6bfbaf34894a6e879a39bd66491525fd552c (patch) | |
tree | 1428a6bd9fd38e9e180c14fd65dad5e85ec7bc3f /xdelta3/testing/cmp.h | |
parent | 0cece8d64b78073424d481e5b9f788c6f886ed44 (diff) |
Merge test actually finding problems now.
Diffstat (limited to 'xdelta3/testing/cmp.h')
-rw-r--r-- | xdelta3/testing/cmp.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xdelta3/testing/cmp.h b/xdelta3/testing/cmp.h index fb499ae..6f65742 100644 --- a/xdelta3/testing/cmp.h +++ b/xdelta3/testing/cmp.h | |||
@@ -41,4 +41,24 @@ inline xoff_t CmpDifferentBytes(const FileSpec &a, const FileSpec &b) { | |||
41 | return total; | 41 | return total; |
42 | } | 42 | } |
43 | 43 | ||
44 | inline bool TmpFile::EqualsSpec(const FileSpec &spec) const { | ||
45 | main_file t; | ||
46 | main_file_init(&t); | ||
47 | CHECK_EQ(0, main_file_open(&t, Name(), XO_READ)); | ||
48 | |||
49 | Block tblock; | ||
50 | Block sblock; | ||
51 | for (BlockIterator iter(spec); !iter.Done(); iter.Next()) { | ||
52 | iter.Get(&sblock); | ||
53 | tblock.SetSize(sblock.Size()); | ||
54 | usize_t tread; | ||
55 | CHECK_EQ(0, main_file_read(&t, tblock.Data(), tblock.Size(), &tread, "read failed")); | ||
56 | CHECK_EQ(0, CmpDifferentBlockBytes(tblock, sblock)); | ||
57 | } | ||
58 | |||
59 | CHECK_EQ(0, main_file_close(&t)); | ||
60 | main_file_cleanup(&t); | ||
61 | return true; | ||
62 | } | ||
63 | |||
44 | } // namespace regtest | 64 | } // namespace regtest |