Permalink
Browse files

unit test to test -[CWQueue objectInFrontOf:]

  • Loading branch information...
1 parent 4244085 commit 6d711b84f25d43fd42c6b9596ff96ee0ef4303e8 @Machx committed Mar 11, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 Source/CWQueueTests.m
View
@@ -208,4 +208,19 @@ -(void)testContainsObjectWithBlock {
STAssertTrue(result2 == NO, @"Cthulhu should not be in the queue");
}
+-(void)testObjectInFrontOf
+{
+ NSString *ob1 = @"Fry";
+ NSString *ob2 = @"Leela";
+ NSString *ob3 = @"Bender";
+
+ CWQueue *queue = [[CWQueue alloc] init];
+ [queue addObject:ob1];
+ [queue addObject:ob2];
+ [queue addObject:ob3];
+
+ STAssertNil([queue objectInFrontOf:ob1],@"Fry should be at the front and therefore we should get nil back");
+ STAssertTrue([[queue objectInFrontOf:ob2] isEqualToString:@"Fry"],@"Pointing to the object in front of Leela should be Fry");
+}
+
@end

0 comments on commit 6d711b8

Please sign in to comment.