Mercurial > dedupe
comparison TestBitDecoder.cpp @ 50:f9fa7ea71d37
Plug leaks in tests.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 13 Sep 2012 23:08:07 +0200 |
| parents | 41cc0d8ac77f |
| children |
comparison
equal
deleted
inserted
replaced
| 49:f8d0ea827db3 | 50:f9fa7ea71d37 |
|---|---|
| 6 BOOST_AUTO_TEST_CASE( TestSimple ) | 6 BOOST_AUTO_TEST_CASE( TestSimple ) |
| 7 { | 7 { |
| 8 BitDecoder* up = new BitDecoder("a"); | 8 BitDecoder* up = new BitDecoder("a"); |
| 9 BitDecoder* down = new BitDecoder("b"); | 9 BitDecoder* down = new BitDecoder("b"); |
| 10 | 10 |
| 11 BitDecoder* full = BitDecoder::merge(down, up); | 11 std::auto_ptr<BitDecoder> full(BitDecoder::merge(down, up)); |
| 12 | 12 |
| 13 BOOST_REQUIRE(full->data().isNull()); | 13 BOOST_REQUIRE(full->data().isNull()); |
| 14 BOOST_REQUIRE_EQUAL(up->data(), "a"); | 14 BOOST_REQUIRE_EQUAL(up->data(), "a"); |
| 15 BOOST_REQUIRE_EQUAL(down->data(), "b"); | 15 BOOST_REQUIRE_EQUAL(down->data(), "b"); |
| 16 | 16 |
| 29 for (int i = 0; i < 12; ++i) { | 29 for (int i = 0; i < 12; ++i) { |
| 30 down = BitDecoder::merge(down, up); | 30 down = BitDecoder::merge(down, up); |
| 31 up = new BitDecoder(QString('c' + i)); | 31 up = new BitDecoder(QString('c' + i)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 BitDecoder* full = BitDecoder::merge(down, up); | 34 std::auto_ptr<BitDecoder> full(BitDecoder::merge(down, up)); |
| 35 | 35 |
| 36 BOOST_REQUIRE(full->data().isNull()); | 36 BOOST_REQUIRE(full->data().isNull()); |
| 37 BOOST_REQUIRE_EQUAL(full->decode("1"), "n"); | 37 BOOST_REQUIRE_EQUAL(full->decode("1"), "n"); |
| 38 BOOST_REQUIRE_EQUAL(full->decode("01"), "m"); | 38 BOOST_REQUIRE_EQUAL(full->decode("01"), "m"); |
| 39 BOOST_REQUIRE_EQUAL(full->decode("001"), "l"); | 39 BOOST_REQUIRE_EQUAL(full->decode("001"), "l"); |
| 46 BOOST_REQUIRE_EQUAL(full->decode("0000000001"), "e"); | 46 BOOST_REQUIRE_EQUAL(full->decode("0000000001"), "e"); |
| 47 BOOST_REQUIRE_EQUAL(full->decode("00000000001"), "d"); | 47 BOOST_REQUIRE_EQUAL(full->decode("00000000001"), "d"); |
| 48 BOOST_REQUIRE_EQUAL(full->decode("000000000001"), "c"); | 48 BOOST_REQUIRE_EQUAL(full->decode("000000000001"), "c"); |
| 49 BOOST_REQUIRE_EQUAL(full->decode("0000000000001"), "b"); | 49 BOOST_REQUIRE_EQUAL(full->decode("0000000000001"), "b"); |
| 50 BOOST_REQUIRE_EQUAL(full->decode("0000000000000"), "a"); | 50 BOOST_REQUIRE_EQUAL(full->decode("0000000000000"), "a"); |
| 51 | |
| 52 } | 51 } |
