diff options
author | Chris Wilson <chris+github@qwirx.com> | 2009-07-05 21:43:57 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2009-07-05 21:43:57 +0000 |
commit | c184849dc3b79d631fb5f279c9868e5a6bc05990 (patch) | |
tree | 5302cae2521abeb481ebcf4360d6f08c706bdee0 /test | |
parent | 53b9012b757ddd3ee451a3d71296e9391f895c42 (diff) |
Allow RaidFileWrite to test that the reference count of an object is
correct before overwriting or deleting it.
Diffstat (limited to 'test')
-rw-r--r-- | test/raidfile/testraidfile.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/raidfile/testraidfile.cpp b/test/raidfile/testraidfile.cpp index 530fb7f8..160de5c9 100644 --- a/test/raidfile/testraidfile.cpp +++ b/test/raidfile/testraidfile.cpp @@ -627,6 +627,30 @@ int test(int argc, const char *argv[]) "', '" << n3); } + // Test that creating and deleting a RaidFile with the wrong + // reference counts throws the expected errors. + { + RaidFileWrite write1(0, "write1", 1); + write1.Open(); + write1.Commit(); + TEST_CHECK_THROWS(write1.Delete(), RaidFileException, + RequestedDeleteReferencedFile); + } + + { + RaidFileWrite write1(0, "write1", 0); + write1.Open(true); + TEST_CHECK_THROWS(write1.Commit(), RaidFileException, + RequestedModifyUnreferencedFile); + write1.Delete(); + } + + { + TEST_CHECK_THROWS(RaidFileWrite write1(0, "write1", 2), + RaidFileException, + RequestedModifyMultiplyReferencedFile); + } + // Create a RaidFile RaidFileWrite write1(0, "test1"); IOStream &write1stream = write1; // use the stream interface where possible |