Skip to content

Commit

Permalink
Added starting point for unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
InfiniteLoopDK committed Jan 11, 2011
1 parent 72fb587 commit b62427d
Show file tree
Hide file tree
Showing 10 changed files with 335 additions and 2 deletions.
18 changes: 18 additions & 0 deletions Classes/NSAttributedStringHTMLTest.h
@@ -0,0 +1,18 @@
//
// NSAttributedStringHTMLTest.h
// CoreTextExtensions
//
// Created by Claus Broch on 11/01/11.
// Copyright 2011 Infinite Loop. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <UIKit/UIKit.h>
//#import "application_headers" as required


@interface NSAttributedStringHTMLTest : SenTestCase {

}

@end
15 changes: 15 additions & 0 deletions Classes/NSAttributedStringHTMLTest.m
@@ -0,0 +1,15 @@
//
// NSAttributedStringHTMLTest.m
// CoreTextExtensions
//
// Created by Claus Broch on 11/01/11.
// Copyright 2011 Infinite Loop. All rights reserved.
//

#import "NSAttributedStringHTMLTest.h"


@implementation NSAttributedStringHTMLTest


@end
19 changes: 19 additions & 0 deletions Classes/NSStringHTMLTest.h
@@ -0,0 +1,19 @@
//
// NSStringHTMLTest.h
// CoreTextExtensions
//
// Created by Claus Broch on 11/01/11.
// Copyright 2011 Infinite Loop. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <UIKit/UIKit.h>
//#import "application_headers" as required


@interface NSStringHTMLTest : SenTestCase {

}


@end
17 changes: 17 additions & 0 deletions Classes/NSStringHTMLTest.m
@@ -0,0 +1,17 @@
//
// NSStringHTMLTest.m
// CoreTextExtensions
//
// Created by Claus Broch on 11/01/11.
// Copyright 2011 Infinite Loop. All rights reserved.
//

#import "NSStringHTMLTest.h"


@implementation NSStringHTMLTest




@end
1 change: 1 addition & 0 deletions Classes/UIColor+HTML.h
Expand Up @@ -8,6 +8,7 @@

#import <Foundation/Foundation.h>

@class UIColor;

@interface UIColor (HTML)

Expand Down
1 change: 1 addition & 0 deletions Classes/UIColor+HTML.m
Expand Up @@ -6,6 +6,7 @@
// Copyright 2011 Drobnik.com. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UIColor+HTML.h"
#import "NSString+HTML.h"

Expand Down
20 changes: 20 additions & 0 deletions Classes/UIColorHTMLTest.h
@@ -0,0 +1,20 @@
//
// UIColorHTMLTest.h
// CoreTextExtensions
//
// Created by Claus Broch on 11/01/11.
// Copyright 2011 Infinite Loop. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
#import <UIKit/UIKit.h>
//#import "application_headers" as required


@interface UIColorHTMLTest : SenTestCase {

}

- (void) testValidColorWithHexString;

@end
52 changes: 52 additions & 0 deletions Classes/UIColorHTMLTest.m
@@ -0,0 +1,52 @@
//
// UIColorHTMLTest.m
// CoreTextExtensions
//
// Created by Claus Broch on 11/01/11.
// Copyright 2011 Infinite Loop. All rights reserved.
//

#import "UIColorHTMLTest.h"
#import "UIColor+HTML.h"

@implementation UIColorHTMLTest


- (void) testValidColorWithHexString
{
UIColor *htmlColor;
UIColor *namedColor;

namedColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
htmlColor = [UIColor colorWithHexString:@"000000"];
STAssertNotNil(htmlColor, @"Failed to create black color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... black is not black");

namedColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
htmlColor = [UIColor colorWithHexString:@"FFFFFF"];
STAssertNotNil(htmlColor, @"Failed to create white color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... white is not white");

namedColor = [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0];
htmlColor = [UIColor colorWithHexString:@"FF0000"];
STAssertNotNil(htmlColor, @"Failed to create red color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... red is not red");

namedColor = [UIColor colorWithRed:0.0 green:1.0 blue:0.0 alpha:1.0];
htmlColor = [UIColor colorWithHexString:@"00FF00"];
STAssertNotNil(htmlColor, @"Failed to create green color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... green is not green");

namedColor = [UIColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
htmlColor = [UIColor colorWithHexString:@"0000FF"];
STAssertNotNil(htmlColor, @"Failed to create blue color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... blue is not blue");

namedColor = [UIColor colorWithRed:1.0 green:0.0 blue:1.0 alpha:1.0];
htmlColor = [UIColor colorWithHexString:@"F0F"];
STAssertNotNil(htmlColor, @"Failed to create purple color");
STAssertEqualObjects(namedColor, htmlColor, @"Hmmm... purple is not purple");
}


@end

0 comments on commit b62427d

Please sign in to comment.