add_subdirectory(ftdi_eeprom)
add_subdirectory(examples)
add_subdirectory(packages)
+add_subdirectory(test)
--- /dev/null
+# 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)
--- /dev/null
+/**@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()
--- /dev/null
+/**@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()