Changeset 919


Ignore:
Timestamp:
Sep 8, 2011, 3:35:55 AM (12 years ago)
Author:
sam
Message:

lolunit: free all the memory we allocated to avoid a minor memory leak,
and slightly tweak the API syntax.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lol/unit.h

    r914 r919  
    2929class FixtureBase
    3030{
    31     friend class TestRunner;
     31    friend class TextTestRunner;
    3232
    3333public:
     
    5555    }
    5656
    57     virtual void RunFixture() = 0;
     57    virtual void runFixture() = 0;
    5858
    5959    /* Prevent compiler complaints about unreachable code */
     
    9494
    9595    /* Run all test cases in this fixture. */
    96     virtual void RunFixture()
     96    virtual void runFixture()
    9797    {
    9898        m_errorlog.str("");
     
    125125};
    126126
    127 class TestRunner
     127class TextTestRunner
    128128{
    129129public:
    130     bool Run()
     130    bool run()
    131131    {
    132132        bool ret = true;
     
    137137        {
    138138            f->setUp();
    139             f->RunFixture();
     139            f->runFixture();
    140140            f->tearDown();
    141141
     
    172172    template<typename T> struct Make##FixtureName \
    173173    { \
    174         Make##FixtureName() { new T(); } \
     174        Make##FixtureName() { p = new T(); } \
     175        ~Make##FixtureName() { delete p; } \
     176        T *p; \
    175177    }; \
    176178    Make##FixtureName<FixtureName> lol_unit_fixture_##FixtureName; \
  • trunk/test/lol-test.cpp

    r913 r919  
    2020int main(void)
    2121{
    22     lol::TestRunner runner;
    23     bool success = runner.Run();
     22    lol::TextTestRunner runner;
     23    bool success = runner.run();
    2424    return success ? EXIT_SUCCESS : EXIT_FAILURE;
    2525}
Note: See TracChangeset for help on using the changeset viewer.