#import <UnitKit/UnitKit.h>
#import "NSDate+GanttAdditions.h"

@interface NSDateGanttAdditionsTests : NSObject <UKTest>
{
}

@end

@implementation NSDateGanttAdditionsTests 

- (id)init
{
    if ((self = [super init]))
    {
    }
    return self;
}

- (void)testRound1
{
    NSDate *aDate = [NSDate dateWithString:@"2010-03-10 13:43:55 +0000"];
    NSDate *actual = [aDate dateByRoundingToNearest:GanttHalfDay];
    NSDate *expected = [NSDate dateWithString:@"2010-03-10 12:00:00 +0000"];
    UKTrue([expected isEqualToDate:actual]);
}

- (void)testRound2
{
    NSDate *aDate = [NSDate dateWithString:@"2010-03-10 21:43:55 +0000"];
    NSDate *actual = [aDate dateByRoundingToNearest:GanttHalfDay];
    NSDate *expected = [NSDate dateWithString:@"2010-03-11 00:00:00 +0000"];
    UKTrue([expected isEqualToDate:actual]);
}

- (void)testRound3
{
    NSDate *aDate = [NSDate dateWithString:@"2010-03-10 21:43:55 +0000"];
    NSDate *actual = [aDate dateByRoundingToNearest:GanttDay];
    NSDate *expected = [NSDate dateWithString:@"2010-03-11 00:00:00 +0000"];
    UKTrue([expected isEqualToDate:actual]);
}

- (void)dealloc
{
    [super dealloc];
}
@end
