📄 group__clienttest.tex
字号:
\index{ADD_TEST@{ADD\_\-TEST}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ADD\_\-TEST(\_\-class, \_\-function)~addTest(new CppUnit::TestCaller$<$\_\-class$>$(getName() + \char`\"{}::\char`\"{} \#\_\-function, \&\_\-class::\_\-function, $\ast$this))}\label{group__ClientTest_ga0731adcbc3fa00240a5b8e3949d5ecb}convenience macro for adding a test name like a function, to be used inside an instance of that class \begin{Desc}\item[Parameters:]\begin{description}\item[{\em \_\-class}]class which contains the function \item[{\em \_\-function}]a function without parameters in that class \end{description}\end{Desc}\index{ClientTest@{ClientTest}!SOURCE_ASSERT@{SOURCE\_\-ASSERT}}\index{SOURCE_ASSERT@{SOURCE\_\-ASSERT}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SOURCE\_\-ASSERT(\_\-source, \_\-x)}\label{group__ClientTest_g59fc0b73d4abeacf0cc61dc6668ef382}\textbf{Value:}\begin{Code}\begin{verbatim}{ \ CPPUNIT_ASSERT(_x); \ CPPUNIT_ASSERT((_source) && (!(_source)->getReport() || (_source)->getReport()->getState() != SOURCE_ERROR)); \}\end{verbatim}\end{Code}check \_\-x for true and then the status of the \_\-source pointer \index{ClientTest@{ClientTest}!SOURCE_ASSERT_EQUAL@{SOURCE\_\-ASSERT\_\-EQUAL}}\index{SOURCE_ASSERT_EQUAL@{SOURCE\_\-ASSERT\_\-EQUAL}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SOURCE\_\-ASSERT\_\-EQUAL(\_\-source, \_\-value, \_\-x)}\label{group__ClientTest_g932996dcff4a40bf513c4ac5456740b0}\textbf{Value:}\begin{Code}\begin{verbatim}{ \ CPPUNIT_ASSERT_EQUAL(_value, _x); \ CPPUNIT_ASSERT((_source) && (!(_source)->getReport() || (_source)->getReport()->getState() != SOURCE_ERROR)); \}\end{verbatim}\end{Code}check that \_\-x evaluates to a specific value and then the status of the \_\-source pointer \index{ClientTest@{ClientTest}!SOURCE_ASSERT_MESSAGE@{SOURCE\_\-ASSERT\_\-MESSAGE}}\index{SOURCE_ASSERT_MESSAGE@{SOURCE\_\-ASSERT\_\-MESSAGE}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SOURCE\_\-ASSERT\_\-MESSAGE(\_\-message, \_\-source, \_\-x)}\label{group__ClientTest_g0196a5db399ede0ae97ae532302ec427}\textbf{Value:}\begin{Code}\begin{verbatim}{ \ CPPUNIT_ASSERT_MESSAGE((_message), (_x)); \ CPPUNIT_ASSERT((_source) && (!(_source)->getReport() || (_source)->getReport()->getState() != SOURCE_ERROR)); \}\end{verbatim}\end{Code}same as \doxyref{SOURCE\_\-ASSERT()}{p.}{group__ClientTest_g59fc0b73d4abeacf0cc61dc6668ef382} with a specific failure message \index{ClientTest@{ClientTest}!SOURCE_ASSERT_NO_FAILURE@{SOURCE\_\-ASSERT\_\-NO\_\-FAILURE}}\index{SOURCE_ASSERT_NO_FAILURE@{SOURCE\_\-ASSERT\_\-NO\_\-FAILURE}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SOURCE\_\-ASSERT\_\-NO\_\-FAILURE(\_\-source, \_\-x)}\label{group__ClientTest_gce6318609dc370cbe0ca7591349eeaa4}\textbf{Value:}\begin{Code}\begin{verbatim}{ \ CPPUNIT_ASSERT_NO_THROW(_x); \ CPPUNIT_ASSERT((_source) && (!(_source)->getReport() || (_source)->getReport()->getState() != SOURCE_ERROR)); \}\end{verbatim}\end{Code}execute \_\-x and then check the status of the \_\-source pointer \subsection{Function Documentation}\index{ClientTest@{ClientTest}!check@{check}}\index{check@{check}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void CheckSyncReport::check (int {\em res}, {\bf SyncReport} \& {\em report}) const\hspace{0.3cm}{\tt [virtual, inherited]}}\label{group__ClientTest_g45d1c4c6d24edb024843606151052950}checks that the sync completed as expected and throws CPPUnit exceptions if something is wrong \begin{Desc}\item[Parameters:]\begin{description}\item[{\em res}]return code from SyncClient::sync() \item[{\em report}]the sync report stored in the \doxyref{SyncClient}{p.}{classSyncClient} \end{description}\end{Desc}\index{ClientTest@{ClientTest}!getTestData@{getTestData}}\index{getTestData@{getTestData}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ClientTest::getTestData (const char $\ast$ {\em type}, {\bf Config} \& {\em config})\hspace{0.3cm}{\tt [static, inherited]}}\label{group__ClientTest_g7b51aaa5b68b806d3719e7d74e4c2bc0}A derived class can use this call to get default test cases, but still has to add callbacks which create sources and execute a sync session. Some of the test cases are compiled into the library, other depend on the auxiliary files from the \char`\"{}test\char`\"{} directory. Currently supported types:\begin{itemize}\item vcard30 = vCard 3.0 contacts\item vcard21 = vCard 2.1 contacts\item ical20 = iCal 2.0 events\item vcal10 = vCal 1.0 events\item itodo20 = iCal 2.0 tasks \end{itemize}\index{ClientTest@{ClientTest}!postSync@{postSync}}\index{postSync@{postSync}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ClientTest::postSync (int {\em res}, const std::string \& {\em logname})\hspace{0.3cm}{\tt [virtual, inherited]}}\label{group__ClientTest_g6793f73554f9f225ddc059d1aa95c09b}This is called after successful \doxyref{sync()}{p.}{classClientTest_5e5a95277a8c953307c6c4c9415fe627} calls (res == 0) as well as after unsuccessful ones (res != 1). The default implementation sleeps for the number of seconds specified when constructing this instance and copies the server log if one was named.\begin{Desc}\item[Parameters:]\begin{description}\item[{\em res}]result of \doxyref{sync()}{p.}{classClientTest_5e5a95277a8c953307c6c4c9415fe627} \item[{\em logname}]base name of the current sync log (without \char`\"{}.client.[AB].log\char`\"{} suffix) \end{description}\end{Desc}\index{ClientTest@{ClientTest}!registerTests@{registerTests}}\index{registerTests@{registerTests}!ClientTest@{ClientTest}}\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ClientTest::registerTests ()\hspace{0.3cm}{\tt [virtual, inherited]}}\label{group__ClientTest_g44bbf4c7cf9b7dbce51b9f4eacf5a064}This is the only function provided by \doxyref{ClientTest}{p.}{classClientTest} itself: it registers tests using this instance of \doxyref{ClientTest}{p.}{classClientTest} for later use during a test run. Theinstance must remain valid until after the tests were run. To run them use a separate test runner, like the one from client-test-main.cpp.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -