Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //in the tester
- XCTAssertNotNil(testList.head.next);
- failed: ((testList.head.next) != nil) failed: throwing "-[__NSCFNumber next]: unrecognized selector sent to instance 0x8d75720"
- - (void)add:(NSObject *)node {
- Node *newNode = [[Node alloc] init];
- if (self.head)
- newNode.next = self.head;
- else
- self.head = newNode;
- self.num_nodes++;
- }
- NList *testList = [[NList alloc] initWithSize:2];
- @property (nonatomic,readwrite) NSInteger size;
- .....
- - (id) initWithSize:(NSInteger *)size {
- self = [super init];
- if (self){
- self.head = nil;
- self.size = *size;
- self.num_nodes = 0;
- }
- return self;
- }
- - (void)testAdd
- {
- NList *testList = [[NList alloc] initWithSize:2];
- NSObject *testNodeOne = @1;
- [testList add:(testNodeOne)];
- XCTAssertNotNil(testList.head);
- NSObject *testNodeTwo = @3;
- [testList add:testNodeTwo];
- XCTAssertNotNil(testList.head);
- XCTAssertNotNil(testList.head.next);
- }
- /LinkedListTest.m: test failure: -[LinkedListTest testAdd] failed: ((testList.head.next) != nil) failed: throwing "-[__NSCFNumber next]: unrecognized selector sent to instance 0x8d75720"
- -(id) initWithSize:(NSInteger)size
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement