Initial tests for LogicDataSnapshot
authorJoel Holdsworth <joel@airwebreathe.org.uk>
Sun, 15 Jul 2012 16:08:21 +0000 (17:08 +0100)
committerJoel Holdsworth <joel@airwebreathe.org.uk>
Mon, 3 Sep 2012 13:00:02 +0000 (14:00 +0100)
CMakeLists.txt
test/test.cpp

index 445cb630f01154c149398b54715bdc9ee5a15d57..e0edfbc3d86132fc66d2beafce24b8914e589e87 100644 (file)
@@ -47,6 +47,8 @@ set(sigrok-qt2_RESOURCES
 
 set(sigrok-qt2_TEST_SOURCES
        test/test.cpp
 
 set(sigrok-qt2_TEST_SOURCES
        test/test.cpp
+       datasnapshot.cpp
+       logicdatasnapshot.cpp
 )
 
 set(QT_USE_QTOPENGL TRUE)
 )
 
 set(QT_USE_QTOPENGL TRUE)
@@ -92,6 +94,8 @@ add_executable(sigrok-qt2-test
 
 target_link_libraries(sigrok-qt2-test
        ${Boost_LIBRARIES}
 
 target_link_libraries(sigrok-qt2-test
        ${Boost_LIBRARIES}
+       ${PKGDEPS_LIBRARIES}
+       ${QT_LIBRARIES}
 )
 
 enable_testing()
 )
 
 enable_testing()
index 2c278c04e650a1eb9b090eff0e5c4d254510ad7c..acb3c963dcfb8a1488440c1f7165fe2f07a6a81a 100644 (file)
 
 #define BOOST_TEST_MAIN
 #include <boost/test/unit_test.hpp>
 
 #define BOOST_TEST_MAIN
 #include <boost/test/unit_test.hpp>
+
+#include "../logicdatasnapshot.h"
+
+BOOST_AUTO_TEST_CASE(LogicDataSnapshotTest)
+{
+       // Create an empty LogicDataSnapshot object
+       sr_datafeed_logic logic;
+       logic.length = 0;
+       logic.unitsize = 1;
+       logic.data = NULL;
+
+       LogicDataSnapshot s(logic);
+
+       BOOST_CHECK(s.get_sample_count() == 0);
+}