Show
Ignore:
Timestamp:
12/24/06 07:27:43 (2 years ago)
Author:
cneumann
Message:

Added copyright headers,
wrapped test contents in SUITEs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/Base/Base/OSGMultiPoolTest.cpp

    r397 r457  
     1/*---------------------------------------------------------------------------*\ 
     2 *                                OpenSG                                     * 
     3 *                                                                           * 
     4 *                                                                           * 
     5 *             Copyright (C) 2000-2006 by the OpenSG Forum                   * 
     6 *                                                                           * 
     7 *                            www.opensg.org                                 * 
     8 *                                                                           * 
     9 *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          * 
     10 *                                                                           * 
     11\*---------------------------------------------------------------------------*/ 
     12/*---------------------------------------------------------------------------*\ 
     13 *                                License                                    * 
     14 *                                                                           * 
     15 * This library is free software; you can redistribute it and/or modify it   * 
     16 * under the terms of the GNU Library General Public License as published    * 
     17 * by the Free Software Foundation, version 2.                               * 
     18 *                                                                           * 
     19 * This library is distributed in the hope that it will be useful, but       * 
     20 * WITHOUT ANY WARRANTY; without even the implied warranty of                * 
     21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         * 
     22 * Library General Public License for more details.                          * 
     23 *                                                                           * 
     24 * You should have received a copy of the GNU Library General Public         * 
     25 * License along with this library; if not, write to the Free Software       * 
     26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 * 
     27 *                                                                           * 
     28\*---------------------------------------------------------------------------*/ 
     29/*---------------------------------------------------------------------------*\ 
     30 *                                Changes                                    * 
     31 *                                                                           * 
     32 *                                                                           * 
     33 *                                                                           * 
     34 *                                                                           * 
     35 *                                                                           * 
     36 *                                                                           * 
     37\*---------------------------------------------------------------------------*/ 
    138 
    239#include <UnitTest++.h> 
     
    1148OSG_USING_NAMESPACE 
    1249 
    13 // make the test noisy. Not like it's supposed ot be used, but good for 
     50// make the test noisy. Not like it's supposed to be used, but good for 
    1451// debugging 
    1552#if 0 
     
    2865        OUT(("elBase %p\n", this)); 
    2966    } 
    30      
     67 
    3168    virtual ~elBase() 
    3269    { 
    33         OUT(("~elBase %p\n", this));         
     70        OUT(("~elBase %p\n", this)); 
    3471    } 
    35      
     72 
    3673  private: 
    3774    virtual void reset(void) 
     
    4077        return; 
    4178    } 
    42      
     79 
    4380    friend class MultiPool<elBase>::TypeStore; 
    4481}; 
     
    4986    Int32 a; 
    5087 
    51     el1(void) : a(1)  
     88    el1(void) : a(1) 
    5289    { 
    5390        OUT(("el1 %p\n", this)); 
    5491    } 
    55      
     92 
    5693    virtual ~el1() 
    5794    { 
     
    5996        a = -11; 
    6097    } 
    61      
     98 
    6299  private: 
    63100    virtual void reset(void) 
     
    66103        a = -1; 
    67104    } 
    68      
     105 
    69106    friend class MultiPool<elBase>::TypeStore; 
    70107}; 
     
    77114    Int32 b; 
    78115 
    79     el2(void) : a(2), b(3)  
     116    el2(void) : a(2), b(3) 
    80117    { 
    81118        OUT(("el2 %p\n", this)); 
    82119    } 
    83      
     120 
    84121    virtual ~el2() 
    85122    { 
     
    96133        b = -3; 
    97134    } 
    98      
     135 
    99136    friend class MultiPool<elBase>::TypeStore; 
    100137}; 
     
    106143    OUT(("CreateAndInit: start\n")); 
    107144    MultiPool<elBase> pool; 
    108      
    109     el1 *val1 = pool.create(el1::Proto);    
     145 
     146    el1 *val1 = pool.create(el1::Proto); 
    110147    CHECK(val1 != 0); 
    111148    CHECK(val1->a == 1); 
    112      
     149 
    113150    el1 *val2 = pool.create(el1::Proto); 
    114151    CHECK(val2 != 0); 
     
    122159    OUT(("ReuseDataAndCallReset: start\n")); 
    123160    MultiPool<elBase> pool; 
    124      
    125     el1 *val1 = pool.create(el1::Proto);    
     161 
     162    el1 *val1 = pool.create(el1::Proto); 
    126163    CHECK(val1 != 0); 
    127164    CHECK(val1->a == 1); 
    128      
     165 
    129166    pool.freeAll(); 
    130167    el1 *val2 = pool.create(el1::Proto); 
     
    142179 
    143180    UInt16 cnt = MultiPool<elBase>::TypeStore::BLOCKSIZE * 4; 
    144      
     181 
    145182    for(UInt16 i = 0; i < cnt; ++i) 
    146183        v.push_back(pool.create(el1::Proto)); 
    147      
     184 
    148185    for(UInt16 i = 0; i < cnt; ++i) 
    149186        CHECK(v[i]->a == 1); 
    150      
     187 
    151188    pool.freeAll(); 
    152189 
    153190    for(UInt16 i = 0; i < cnt; ++i) 
    154191        v.push_back(pool.create(el1::Proto)); 
    155      
     192 
    156193    for(UInt16 i = 0; i < cnt; ++i) 
    157194        CHECK(v[i]->a == -1); 
    158          
     195 
    159196    OUT(("CreateMoreThanOneBlock: end\n")); 
    160197}