On Fri, Aug 28, 2015 at 6:07 PM, Kay Schenk <kay.sch...@gmail.com> wrote:
>
> On 08/27/2015 09:05 PM, Damjan Jovanovic wrote:
>> Hi
>>
>> I am in the process of migrating our unit tests from cppunit to Google
>> Test. However AOO doesn't build with cppunit and hasn't been routinely
>> built with cppunit for a while, which means our unit tests are in a
>> state of neglect, and unsurprisingly, there are many failures both
>> compiling and running our unit tests.
>>
>> Ideally we should investigate why and fix the tests. But the APIs
>> being tested are complex and unfamiliar to me (eg. SVG parsing), and
>> would take very long to investigate properly.
>>
>> I could commit changes that will just get the tests to compile, then
>> fail during testing and stop the build, thus forcing others to fix
>> them quickly :-), but I don't imagine that will go down well. So I am
>> taking this approach instead:
>>
>> // FIXME:
>> #define RUN_OLD_FAILING_TESTS 0
>>
>> #if RUN_OLD_FAILING_TESTS
>> broken_test();
>> #endif
>>
>> Also I am making unit tests run on every build. This way at least some
>> unit tests will be run, and any future regressions to tests can be
>> caught immediately, while the broken tests can be fixed gradually.
>>
>> Everyone happy?
>
> Well pretty much. :)
>
> I've been watching your commits. Thank you for taking on this
> challenging task.

Thank you.

> OK, just to be clear. It looks like you're converting the cppunit calls
> to Google Test api calls. But, what you're saying is the actual use of
> the Google test routines needs additional modification to work
> correctly, right?

Yes that's what I am doing.

No, the C++ conversions are very easy (feel free to help ;-)):
#include "cppunit..."   =>   #include "gtest/gtest.h"
class X : public CppUnit::TestFixture  =>  class X : public ::testing:Test
CPPUNIT_ASSERT_MESSAGE(msg, condition)   =>   ASSERT_TRUE(condition) << msg
CPPUNIT_ASSERT_EQUAL(c1, c2)    =>   ASSERT_EQ(c1, c2)
CPPUNIT_FALSE(msg)   =>   FAIL() << msg
private:  =>  protected:
test methods move outside of class declaration and become
TEST_F(className, methodName) instead
CPPUNIT_TEST...() registrations disappear

but the problem is that tests themselves are wrong no matter what the
testing library. For example:
basegfx::tools::importFromSvgD( aPoly, aSvg );
won't compile, as importfromSvgD() requires 4 parameters now instead
of just 2 (as I explained in an earlier email, this was caused by
commit 1536730 on 2013-10-29 by alg).

Damjan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org

Reply via email to