summaryrefslogtreecommitdiff
path: root/xdelta3/testing/file.h
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2008-08-09 15:24:05 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2008-08-09 15:24:05 +0000
commit3f6c6bfbaf34894a6e879a39bd66491525fd552c (patch)
tree1428a6bd9fd38e9e180c14fd65dad5e85ec7bc3f /xdelta3/testing/file.h
parent0cece8d64b78073424d481e5b9f788c6f886ed44 (diff)
Merge test actually finding problems now.
Diffstat (limited to 'xdelta3/testing/file.h')
-rw-r--r--xdelta3/testing/file.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/xdelta3/testing/file.h b/xdelta3/testing/file.h
index d3b9d4a..a0231be 100644
--- a/xdelta3/testing/file.h
+++ b/xdelta3/testing/file.h
@@ -137,7 +137,6 @@ public:
137 137
138 void WriteTmpFile(TmpFile *f) const; 138 void WriteTmpFile(TmpFile *f) const;
139 139
140private:
141 void SetSize(size_t size) { 140 void SetSize(size_t size) {
142 size_ = size; 141 size_ = size;
143 142
@@ -149,7 +148,7 @@ private:
149 data_size_ = size; 148 data_size_ = size;
150 } 149 }
151 } 150 }
152 151private:
153 friend class BlockIterator; 152 friend class BlockIterator;
154 153
155 mutable uint8_t *data_; 154 mutable uint8_t *data_;
@@ -226,8 +225,8 @@ public:
226 char buf[32]; 225 char buf[32];
227 snprintf(buf, 32, "/tmp/regtest.%d", static_counter++); 226 snprintf(buf, 32, "/tmp/regtest.%d", static_counter++);
228 filename_.append(buf); 227 filename_.append(buf);
228 unlink(filename_.c_str());
229 main_file_init(&file_); 229 main_file_init(&file_);
230 CHECK_EQ(0, main_file_open(&file_, filename_.c_str(), XO_WRITE));
231 } 230 }
232 231
233 ~TmpFile() { 232 ~TmpFile() {
@@ -236,6 +235,9 @@ public:
236 } 235 }
237 236
238 void Append(const Block *block) { 237 void Append(const Block *block) {
238 if (!main_file_isopen(&file_)) {
239 CHECK_EQ(0, main_file_open(&file_, filename_.c_str(), XO_WRITE));
240 }
239 CHECK_EQ(0, main_file_write(&file_, 241 CHECK_EQ(0, main_file_write(&file_,
240 block->Data(), block->Size(), 242 block->Data(), block->Size(),
241 "tmpfile write failed")); 243 "tmpfile write failed"));
@@ -246,6 +248,9 @@ public:
246 return filename_.c_str(); 248 return filename_.c_str();
247 } 249 }
248 250
251 // Check whether a real file matches a file spec.
252 bool EqualsSpec(const FileSpec &spec) const;
253
249private: 254private:
250 string filename_; 255 string filename_;
251 mutable main_file file_; 256 mutable main_file file_;