Mercurial > dedupe
changeset 50:f9fa7ea71d37
Plug leaks in tests.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 13 Sep 2012 23:08:07 +0200 |
| parents | f8d0ea827db3 |
| children | 0bd3c1c46251 |
| files | TestBitDecoder.cpp TestFastBitDecoder.cpp |
| diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/TestBitDecoder.cpp Mon Sep 10 23:59:46 2012 +0200 +++ b/TestBitDecoder.cpp Thu Sep 13 23:08:07 2012 +0200 @@ -8,7 +8,7 @@ BitDecoder* up = new BitDecoder("a"); BitDecoder* down = new BitDecoder("b"); - BitDecoder* full = BitDecoder::merge(down, up); + std::auto_ptr<BitDecoder> full(BitDecoder::merge(down, up)); BOOST_REQUIRE(full->data().isNull()); BOOST_REQUIRE_EQUAL(up->data(), "a"); @@ -31,7 +31,7 @@ up = new BitDecoder(QString('c' + i)); } - BitDecoder* full = BitDecoder::merge(down, up); + std::auto_ptr<BitDecoder> full(BitDecoder::merge(down, up)); BOOST_REQUIRE(full->data().isNull()); BOOST_REQUIRE_EQUAL(full->decode("1"), "n"); @@ -48,5 +48,4 @@ BOOST_REQUIRE_EQUAL(full->decode("000000000001"), "c"); BOOST_REQUIRE_EQUAL(full->decode("0000000000001"), "b"); BOOST_REQUIRE_EQUAL(full->decode("0000000000000"), "a"); - }
--- a/TestFastBitDecoder.cpp Mon Sep 10 23:59:46 2012 +0200 +++ b/TestFastBitDecoder.cpp Thu Sep 13 23:08:07 2012 +0200 @@ -9,7 +9,7 @@ BitDecoder* up = new BitDecoder("a"); BitDecoder* down = new BitDecoder("b"); - BitDecoder* full = BitDecoder::merge(down, up); + std::auto_ptr<BitDecoder> full(BitDecoder::merge(down, up)); BOOST_REQUIRE(full->data().isNull()); BOOST_REQUIRE_EQUAL(up->data(), "a"); @@ -23,6 +23,7 @@ BOOST_REQUIRE_EQUAL(fast.decode("0000"), "bbbb"); BOOST_REQUIRE_EQUAL(fast.decode("1101"), "aaba"); BOOST_REQUIRE_EQUAL(fast.decode("1111"), "aaaa"); + } BOOST_AUTO_TEST_CASE( TestLong ) @@ -34,7 +35,7 @@ up = new BitDecoder(QString('c' + i)); } - BitDecoder* full = BitDecoder::merge(down, up); + std::auto_ptr<BitDecoder> full(BitDecoder::merge(down, up)); BOOST_REQUIRE(full->data().isNull());
