From: Joel Holdsworth Date: Sun, 13 Jan 2013 19:24:31 +0000 (+0000) Subject: Added Sixteen test case X-Git-Tag: pulseview-0.1.0~165 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c6013ca7dd2aaf5d3de86c92c916457ffd330cc0;p=pulseview.git Added Sixteen test case This test case is a replica of sixteen.sr attached to the Bug #33 --- diff --git a/test/data/logicsnapshot.cpp b/test/data/logicsnapshot.cpp index 3e3ff2f9..67321c86 100644 --- a/test/data/logicsnapshot.cpp +++ b/test/data/logicsnapshot.cpp @@ -509,4 +509,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 edges; + s.get_subsampled_edges(edges, 0, 2, 0.0004, 1); + + BOOST_CHECK_EQUAL(edges.size(), 2); +} + BOOST_AUTO_TEST_SUITE_END()