random ai stuff
This commit is contained in:
9
telldus-core/tests/common/CMakeLists.txt
Normal file
9
telldus-core/tests/common/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
FILE(GLOB SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*Test.cpp" )
|
||||
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
|
||||
|
||||
ADD_LIBRARY(TelldusCommonTests STATIC ${SRCS} )
|
||||
|
||||
TARGET_LINK_LIBRARIES( TelldusCommonTests TelldusCommon ${CPPUNIT} )
|
||||
ADD_DEPENDENCIES( TelldusCommonTests TelldusCommon )
|
||||
|
||||
11
telldus-core/tests/common/CommonTests.h
Normal file
11
telldus-core/tests/common/CommonTests.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef COMMONTESTS_H
|
||||
#define COMMONTESTS_H
|
||||
|
||||
#include "StringsTest.h"
|
||||
|
||||
namespace CommonTests {
|
||||
inline void setup() {
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (StringsTest);
|
||||
}
|
||||
}
|
||||
#endif // COMMONTESTS_H
|
||||
16
telldus-core/tests/common/StringsTest.cpp
Normal file
16
telldus-core/tests/common/StringsTest.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "StringsTest.h"
|
||||
#include "Strings.h"
|
||||
|
||||
void StringsTest :: setUp (void)
|
||||
{
|
||||
}
|
||||
|
||||
void StringsTest :: tearDown (void)
|
||||
{
|
||||
}
|
||||
|
||||
void StringsTest :: formatfTest (void) {
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("42"), TelldusCore::formatf("%u", 42));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("2A"), TelldusCore::formatf("%X", 42));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("42"), TelldusCore::formatf("%s", "42"));
|
||||
}
|
||||
21
telldus-core/tests/common/StringsTest.h
Normal file
21
telldus-core/tests/common/StringsTest.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef STRINGSTEST_H
|
||||
#define STRINGSTEST_H
|
||||
|
||||
#include <cppunit/TestFixture.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
class StringsTest : public CPPUNIT_NS :: TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE (StringsTest);
|
||||
CPPUNIT_TEST (formatfTest);
|
||||
CPPUNIT_TEST_SUITE_END ();
|
||||
|
||||
public:
|
||||
void setUp (void);
|
||||
void tearDown (void);
|
||||
|
||||
protected:
|
||||
void formatfTest(void);
|
||||
};
|
||||
|
||||
#endif //STRINGSTEST_H
|
||||
Reference in New Issue
Block a user