//
//  ArenaTest.m
//  OaxacaCocoaTools
//
//  Created by Niko Matsakis on 19.10.05.
//  Copyright 2005 __MyCompanyName__. All rights reserved.
//

#import "OAArenaTest.h"
#import "Foundation/Foundation.h"

@interface TestObject : NSObject {
    int _value;
}
- initWithValue:(int)value;
- (int) value;
@end

@implementation TestObject

- initWithValue:(int)value
{
    self = [super init];
    _value = value;
    return self;
}

- (int) value
{
    return _value;
}

@end

@implementation OAArenaTest

- (void) testBasic
{
    int i;
    OAArena *arena = [[[OAArena alloc] init] autorelease];
    
    NSMutableArray *array = [NSMutableArray arrayWithCapacity:25];
    for (i = 0; i < 10; i++)
        [array addObject:[[TestObject allocWithArena:arena] initWithValue:i]];

    for (i = 0; i < 10; i++) {
        TestObject *tobj = [array objectAtIndex:i];
        int tval = [tobj value];
        STAssertEquals (i, tval, @"Object #%d has unexpected value %d!", i, tval);
    }
}

@end
