]> sigrok.org Git - pulseview.git/blobdiff - test/data/logicsnapshot.cpp
Replaced using namespace with using class directives
[pulseview.git] / test / data / logicsnapshot.cpp
index 3e3ff2f959da2577b2e21d3083c44146bbeddc34..8be915f02544bc6a8f10ade5f770438150c95357 100644 (file)
@@ -27,9 +27,8 @@
 
 #include "../../pv/data/logicsnapshot.h"
 
-using namespace std;
-
 using pv::data::LogicSnapshot;
+using std::vector;
 
 BOOST_AUTO_TEST_SUITE(LogicSnapshotTest)
 
@@ -490,7 +489,7 @@ BOOST_AUTO_TEST_CASE(WideData)
        logic.length = Length * sizeof(data[0]);
        logic.data = data;
 
-       for(int i = 0; i < Length; i++)
+       for (int i = 0; i < Length; i++)
                data[i] = 0x0FF0;
 
        LogicSnapshot s(logic);
@@ -509,4 +508,28 @@ BOOST_AUTO_TEST_CASE(WideData)
        delete [] data;
 }
 
+/*
+ * This test is a replica of sixteen.sr attached to Bug #33.
+ */
+BOOST_AUTO_TEST_CASE(Sixteen)
+{
+       const int Length = 8;
+       uint16_t data[Length];
+
+       sr_datafeed_logic logic;
+       logic.unitsize = sizeof(data[0]);
+       logic.length = Length * sizeof(data[0]);
+       logic.data = data;
+
+       for (int i = 0; i < Length; i++)
+               data[i] = 0xFFFE;
+
+       LogicSnapshot s(logic);
+
+       vector<LogicSnapshot::EdgePair> edges;
+       s.get_subsampled_edges(edges, 0, 2, 0.0004, 1);
+
+       BOOST_CHECK_EQUAL(edges.size(), 2);
+}
+
 BOOST_AUTO_TEST_SUITE_END()