]> sigrok.org Git - pulseview.git/blobdiff - test/data/logicsegment.cpp
Drop some trailing whitespace.
[pulseview.git] / test / data / logicsegment.cpp
index 29bffdda47c3801876157eb2b679186fccd3a232..b5cf0ba45c85adad2b36b2a96870e34db5f75ae2 100644 (file)
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <extdef.h>
 
-#include <stdint.h>
+#include <cstdint>
 
 #include <boost/test/unit_test.hpp>
 
 #include <pv/data/logicsegment.hpp>
 
+#if 0
 using pv::data::LogicSegment;
 using std::vector;
+#endif
 
 // Dummy, remove again when unit tests are fixed.
 BOOST_AUTO_TEST_SUITE(DummyTestSuite)
@@ -74,7 +75,7 @@ BOOST_AUTO_TEST_CASE(Basic)
        sr_datafeed_logic logic;
        logic.length = 0;
        logic.unitsize = 1;
-       logic.data = NULL;
+       logic.data = nullptr;
 
        LogicSegment s(logic);
 
@@ -86,7 +87,7 @@ BOOST_AUTO_TEST_CASE(Basic)
                const LogicSegment::MipMapLevel &m = s.mip_map_[i];
                BOOST_CHECK_EQUAL(m.length, 0);
                BOOST_CHECK_EQUAL(m.data_length, 0);
-               BOOST_CHECK(m.data == NULL);
+               BOOST_CHECK(m.data == nullptr);
        }
 
        // Push 8 samples of all zeros
@@ -100,7 +101,7 @@ BOOST_AUTO_TEST_CASE(Basic)
                const LogicSegment::MipMapLevel &m = s.mip_map_[i];
                BOOST_CHECK_EQUAL(m.length, 0);
                BOOST_CHECK_EQUAL(m.data_length, 0);
-               BOOST_CHECK(m.data == NULL);
+               BOOST_CHECK(m.data == nullptr);
        }
 
        // Push 8 samples of 0x11s to bring the total up to 16
@@ -111,7 +112,7 @@ BOOST_AUTO_TEST_CASE(Basic)
        const LogicSegment::MipMapLevel &m0 = s.mip_map_[0];
        BOOST_CHECK_EQUAL(m0.length, 1);
        BOOST_CHECK_EQUAL(m0.data_length, LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(m0.data != NULL);
+       BOOST_REQUIRE(m0.data != nullptr);
        BOOST_CHECK_EQUAL(((uint8_t*)m0.data)[0], 0x11);
 
        // The higher levels should still be empty
@@ -120,7 +121,7 @@ BOOST_AUTO_TEST_CASE(Basic)
                const LogicSegment::MipMapLevel &m = s.mip_map_[i];
                BOOST_CHECK_EQUAL(m.length, 0);
                BOOST_CHECK_EQUAL(m.data_length, 0);
-               BOOST_CHECK(m.data == NULL);
+               BOOST_CHECK(m.data == nullptr);
        }
 
        // Push 240 samples of all zeros to bring the total up to 256
@@ -136,7 +137,7 @@ BOOST_AUTO_TEST_CASE(Basic)
        const LogicSegment::MipMapLevel &m1 = s.mip_map_[1];
        BOOST_CHECK_EQUAL(m1.length, 1);
        BOOST_CHECK_EQUAL(m1.data_length, LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(m1.data != NULL);
+       BOOST_REQUIRE(m1.data != nullptr);
        BOOST_CHECK_EQUAL(((uint8_t*)m1.data)[0], 0x11);
 
        //----- Test LogicSegment::get_subsampled_edges -----//
@@ -185,7 +186,7 @@ BOOST_AUTO_TEST_CASE(LargeData)
        BOOST_CHECK_EQUAL(s.mip_map_[0].length, 62500);
        BOOST_CHECK_EQUAL(s.mip_map_[0].data_length,
                LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(s.mip_map_[0].data != NULL);
+       BOOST_REQUIRE(s.mip_map_[0].data != nullptr);
 
        prev_sample = 0;
        for (unsigned int i = 0; i < s.mip_map_[0].length;)
@@ -208,7 +209,7 @@ BOOST_AUTO_TEST_CASE(LargeData)
        BOOST_CHECK_EQUAL(s.mip_map_[1].length, 3906);
        BOOST_CHECK_EQUAL(s.mip_map_[1].data_length,
                LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(s.mip_map_[1].data != NULL);
+       BOOST_REQUIRE(s.mip_map_[1].data != nullptr);
 
        prev_sample = 0;
        for (unsigned int i = 0; i < s.mip_map_[1].length; i++)
@@ -226,7 +227,7 @@ BOOST_AUTO_TEST_CASE(LargeData)
        BOOST_CHECK_EQUAL(s.mip_map_[2].length, 244);
        BOOST_CHECK_EQUAL(s.mip_map_[2].data_length,
                LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(s.mip_map_[2].data != NULL);
+       BOOST_REQUIRE(s.mip_map_[2].data != nullptr);
 
        prev_sample = 0;
        for (unsigned int i = 0; i < s.mip_map_[2].length; i++)
@@ -244,7 +245,7 @@ BOOST_AUTO_TEST_CASE(LargeData)
        BOOST_CHECK_EQUAL(s.mip_map_[3].length, 15);
        BOOST_CHECK_EQUAL(s.mip_map_[3].data_length,
                LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(s.mip_map_[3].data != NULL);
+       BOOST_REQUIRE(s.mip_map_[3].data != nullptr);
 
        for (unsigned int i = 0; i < s.mip_map_[3].length; i++)
                BOOST_CHECK_EQUAL(*((uint8_t*)s.mip_map_[3].data + i),
@@ -256,7 +257,7 @@ BOOST_AUTO_TEST_CASE(LargeData)
                const LogicSegment::MipMapLevel &m = s.mip_map_[i];
                BOOST_CHECK_EQUAL(m.length, 0);
                BOOST_CHECK_EQUAL(m.data_length, 0);
-               BOOST_CHECK(m.data == NULL);
+               BOOST_CHECK(m.data == nullptr);
        }
 
        //----- Test LogicSegment::get_subsampled_edges -----//
@@ -310,7 +311,7 @@ BOOST_AUTO_TEST_CASE(Pulses)
        BOOST_CHECK_EQUAL(s.mip_map_[0].length, 12);
        BOOST_CHECK_EQUAL(s.mip_map_[0].data_length,
                LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(s.mip_map_[0].data != NULL);
+       BOOST_REQUIRE(s.mip_map_[0].data != nullptr);
 
        for (unsigned int i = 0; i < s.mip_map_[0].length;) {
                BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]");
@@ -330,7 +331,7 @@ BOOST_AUTO_TEST_CASE(Pulses)
                const LogicSegment::MipMapLevel &m = s.mip_map_[i];
                BOOST_CHECK_EQUAL(m.length, 0);
                BOOST_CHECK_EQUAL(m.data_length, 0);
-               BOOST_CHECK(m.data == NULL);
+               BOOST_CHECK(m.data == nullptr);
        }
 
        //----- Test get_subsampled_edges at reduced scale -----//
@@ -374,7 +375,7 @@ BOOST_AUTO_TEST_CASE(LongPulses)
        BOOST_CHECK_EQUAL(s.mip_map_[0].length, 12);
        BOOST_CHECK_EQUAL(s.mip_map_[0].data_length,
                LogicSegment::MipMapDataUnit);
-       BOOST_REQUIRE(s.mip_map_[0].data != NULL);
+       BOOST_REQUIRE(s.mip_map_[0].data != nullptr);
 
        for (unsigned int i = 0; i < s.mip_map_[0].length;) {
                for (j = 0; i < s.mip_map_[0].length && j < 2; j++) {
@@ -396,7 +397,7 @@ BOOST_AUTO_TEST_CASE(LongPulses)
                const LogicSegment::MipMapLevel &m = s.mip_map_[i];
                BOOST_CHECK_EQUAL(m.length, 0);
                BOOST_CHECK_EQUAL(m.data_length, 0);
-               BOOST_CHECK(m.data == NULL);
+               BOOST_CHECK(m.data == nullptr);
        }
 
        //----- Test get_subsampled_edges at a full scale -----//
@@ -421,7 +422,7 @@ BOOST_AUTO_TEST_CASE(LongPulses)
        BOOST_CHECK_EQUAL(edges[0].second, true);
        BOOST_CHECK_EQUAL(edges[1].first, 16);
        BOOST_CHECK_EQUAL(edges[1].second, false);
-       
+
        for (int i = 1; i < Cycles; i++) {
                BOOST_CHECK_EQUAL(edges[i+1].first, i * Period);
                BOOST_CHECK_EQUAL(edges[i+1].second, false);