libftdi-git Archives

Subject: port libftdi to libusb-1.0 branch, master, updated. v0.17-238-ga87a071

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 2 Sep 2011 11:43:45 +0200 (CEST)
The branch, master has been updated
       via  a87a0712f7166d3418a7b522b44ffbce97a93d50 (commit)
      from  a4eac20496c663784e2a655712ec6459dac244dc (commit)


- Log -----------------------------------------------------------------
commit a87a0712f7166d3418a7b522b44ffbce97a93d50
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date:   Fri Sep 2 11:40:41 2011 +0200

    Add (optional) unit test infrastructure
    
    Requires unit test framework from boost
    so we can test the C and C++ code.
    
    Also has automatic test registration
    and the ability to run tests individually.

-----------------------------------------------------------------------

Summary of changes:
 CMakeLists.txt      |    1 +
 test/CMakeLists.txt |   30 ++++++++++++++++++++++++++++++
 test/basic.cpp      |   33 +++++++++++++++++++++++++++++++++
 test/baudrate.cpp   |   24 ++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 test/CMakeLists.txt
 create mode 100644 test/basic.cpp
 create mode 100644 test/baudrate.cpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73517cf..30f8a9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,6 +99,7 @@ add_subdirectory(bindings)
 add_subdirectory(ftdi_eeprom)
 add_subdirectory(examples)
 add_subdirectory(packages)
+add_subdirectory(test)
 
 
 
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..424cbca
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Optional unit test
+
+find_package(Boost COMPONENTS unit_test_framework)
+
+if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
+
+    message(STATUS "Building unit test")
+
+    enable_testing()
+
+    INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/src)
+
+    set(cpp_tests
+        basic.cpp
+        baudrate.cpp
+    )
+
+    add_executable(test_libftdi ${cpp_tests})
+    target_link_libraries(test_libftdi ftdi 
${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
+
+    add_test(test_libftdi test_libftdi)
+
+    # Add custom target so we run easily run "make check"
+    add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS 
test_libftdi)
+
+else(Boost_UNIT_TEST_FRAMEWORK_FOUND)
+
+    message(STATUS "NOT building unit test (requires boost unit test 
framework)")
+
+endif(Boost_UNIT_TEST_FRAMEWORK_FOUND)
diff --git a/test/basic.cpp b/test/basic.cpp
new file mode 100644
index 0000000..3710916
--- /dev/null
+++ b/test/basic.cpp
@@ -0,0 +1,33 @@
+/**@file
+@brief Test basic FTDI functionality
+
+@author Thomas Jarosch
+*/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Lesser General Public License           *
+ *   version 2.1 as published by the Free Software Foundation;             *
+ *                                                                         *
+ ***************************************************************************/
+
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp>
+
+#include <ftdi.h>
+
+BOOST_AUTO_TEST_SUITE(Basic)
+
+BOOST_AUTO_TEST_CASE(SimpleInit)
+{
+    ftdi_context ftdi;
+
+    int rtn_init = ftdi_init(&ftdi);
+    BOOST_REQUIRE_EQUAL(0, rtn_init);
+
+    ftdi_deinit(&ftdi);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/baudrate.cpp b/test/baudrate.cpp
new file mode 100644
index 0000000..163950b
--- /dev/null
+++ b/test/baudrate.cpp
@@ -0,0 +1,24 @@
+/**@file
+@brief Test baudrate calculator code
+
+@author Thomas Jarosch
+*/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Lesser General Public License           *
+ *   version 2.1 as published by the Free Software Foundation;             *
+ *                                                                         *
+ ***************************************************************************/
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+
+BOOST_AUTO_TEST_SUITE(Baudrate)
+
+BOOST_AUTO_TEST_CASE(Simple)
+{
+}
+
+BOOST_AUTO_TEST_SUITE_END()


hooks/post-receive
-- 
port libftdi to libusb-1.0

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • port libftdi to libusb-1.0 branch, master, updated. v0.17-238-ga87a071, libftdi-git <=