diff options
author | josh.macdonald <jmacd@users.noreply.github.com> | 2008-06-30 05:15:05 +0000 |
---|---|---|
committer | josh.macdonald <jmacd@users.noreply.github.com> | 2008-06-30 05:15:05 +0000 |
commit | 9e896b470f5a4550a7fbbdc515db08b0249f5950 (patch) | |
tree | 8f2ea4d701f554a578a7d7e441f98e1f77425e9a /xdelta3/testing/modify.h | |
parent | e127914b71638072798f7c02e93caf9377ba7385 (diff) |
A test is taking shape...
Diffstat (limited to 'xdelta3/testing/modify.h')
-rw-r--r-- | xdelta3/testing/modify.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/xdelta3/testing/modify.h b/xdelta3/testing/modify.h new file mode 100644 index 0000000..8d6b480 --- /dev/null +++ b/xdelta3/testing/modify.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* -*- Mode: C++ -*- */ | ||
2 | namespace regtest { | ||
3 | |||
4 | class Modify1stByte { | ||
5 | public: | ||
6 | static void Mutate(SegmentMap *table, MTRandom *rand) { | ||
7 | CHECK(!table->empty()); | ||
8 | |||
9 | SegmentMap::iterator i1 = table->begin(); | ||
10 | CHECK_EQ(0, i1->first); | ||
11 | |||
12 | if (i1->second.length == 1) { | ||
13 | i1->second.seed = rand->Rand32(); | ||
14 | } else { | ||
15 | i1->second.seed_offset += 1; | ||
16 | i1->second.length -= 1; | ||
17 | table->insert(make_pair(1, i1->second)); | ||
18 | i1->second = Segment(rand->Rand32(), 1); | ||
19 | } | ||
20 | } | ||
21 | }; | ||
22 | |||
23 | } // namespace regtest | ||