loolwsd: cppunit skeleton
This commit is contained in:
parent
71ce604adb
commit
443486117a
9 changed files with 99 additions and 0 deletions
1
loolwsd/.gitignore
vendored
1
loolwsd/.gitignore
vendored
|
@ -17,6 +17,7 @@
|
|||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
/test-driver
|
||||
|
||||
*.o
|
||||
*.exe
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
SUBDIRS = test
|
||||
|
||||
bin_PROGRAMS = loolwsd
|
||||
|
||||
dist_bin_SCRIPTS = loolwsd-systemplate-setup
|
||||
|
|
|
@ -46,6 +46,10 @@ AC_ARG_WITH([libpng-libs],
|
|||
AS_HELP_STRING([--with-libpng-libs=<path>],
|
||||
[Path the "lib" directory with the libpng libraries]))
|
||||
|
||||
AC_ARG_ENABLE([tests],
|
||||
AS_HELP_STRING([--disable-tests],
|
||||
[Build and run unit tests]))
|
||||
|
||||
# Handle options
|
||||
AS_IF([test "$enable_debug" = yes -a -n "$with_poco_libs"],
|
||||
[POCO_DEBUG_SUFFIX=d],
|
||||
|
@ -95,6 +99,9 @@ AS_IF([test `uname -s` = Linux],
|
|||
[],
|
||||
[AC_MSG_ERROR([libcap not available?])])])
|
||||
|
||||
AS_IF([test "$enable_tests" != "no"],
|
||||
[PKG_CHECK_MODULES([CPPUNIT], [cppunit])])
|
||||
|
||||
LIBS="$LIBS -lPocoNet${POCO_DEBUG_SUFFIX} -lPocoUtil${POCO_DEBUG_SUFFIX} -lPocoXML${POCO_DEBUG_SUFFIX} -lPocoJSON${POCO_DEBUG_SUFFIX} -lPocoFoundation${POCO_DEBUG_SUFFIX}"
|
||||
|
||||
AC_CHECK_HEADERS([LibreOfficeKit/LibreOfficeKit.h],
|
||||
|
@ -141,7 +148,10 @@ AC_DEFINE_UNQUOTED([LOOLWSD_CACHEDIR],["$LOOLWSD_CACHEDIR"],[Cache folder])
|
|||
AC_SUBST(LOOLWSD_CACHEDIR)
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
test/Makefile
|
||||
loolwsd.spec])
|
||||
AC_OUTPUT
|
||||
|
||||
AC_LANG_POP
|
||||
|
||||
dnl vim:set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
|
9
loolwsd/test/.gitignore
vendored
Normal file
9
loolwsd/test/.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Autofoo
|
||||
/.deps
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
*.log
|
||||
*.trs
|
||||
|
||||
*.o
|
||||
test
|
13
loolwsd/test/Makefile.am
Normal file
13
loolwsd/test/Makefile.am
Normal file
|
@ -0,0 +1,13 @@
|
|||
check_PROGRAMS = test
|
||||
|
||||
AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
|
||||
|
||||
test_CPPFLAGS = -DTDOC=\"$(top_srcdir)/test/data\"
|
||||
|
||||
test_LDADD = $(CPPUNIT_LIBS)
|
||||
|
||||
test_SOURCES = httpposttest.cpp test.cpp
|
||||
|
||||
EXTRA_DIST = data/hello.odt data/hello.txt $(test_SOURCES)
|
||||
|
||||
TESTS = test
|
BIN
loolwsd/test/data/hello.odt
Normal file
BIN
loolwsd/test/data/hello.odt
Normal file
Binary file not shown.
1
loolwsd/test/data/hello.txt
Normal file
1
loolwsd/test/data/hello.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Hello world
|
27
loolwsd/test/httpposttest.cpp
Normal file
27
loolwsd/test/httpposttest.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
class HTTPPostTest : public CPPUNIT_NS::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(HTTPPostTest);
|
||||
CPPUNIT_TEST(testConvertTo);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
void testConvertTo();
|
||||
};
|
||||
|
||||
void HTTPPostTest::testConvertTo()
|
||||
{
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(HTTPPostTest);
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
36
loolwsd/test/test.cpp
Normal file
36
loolwsd/test/test.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cppunit/TestRunner.h>
|
||||
#include <cppunit/TestResult.h>
|
||||
#include <cppunit/TestResultCollector.h>
|
||||
#include <cppunit/BriefTestProgressListener.h>
|
||||
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||
#include <cppunit/CompilerOutputter.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
CPPUNIT_NS::TestResult controller;
|
||||
CPPUNIT_NS::TestResultCollector result;
|
||||
controller.addListener(&result);
|
||||
CPPUNIT_NS::BriefTestProgressListener progress;
|
||||
controller.addListener(&progress);
|
||||
|
||||
CPPUNIT_NS::TestRunner runner;
|
||||
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
|
||||
runner.run(controller);
|
||||
|
||||
CPPUNIT_NS::CompilerOutputter outputter(&result, std::cerr);
|
||||
outputter.write();
|
||||
|
||||
return result.wasSuccessful() ? 0 : 1;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
Loading…
Reference in a new issue