Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. //in the tester
  2. XCTAssertNotNil(testList.head.next);
  3.  
  4. failed: ((testList.head.next) != nil) failed: throwing "-[__NSCFNumber next]: unrecognized selector sent to instance 0x8d75720"
  5.  
  6. - (void)add:(NSObject *)node {
  7. Node *newNode = [[Node alloc] init];
  8. if (self.head)
  9. newNode.next = self.head;
  10. else
  11. self.head = newNode;
  12. self.num_nodes++;
  13. }
  14.  
  15.  
  16. NList *testList = [[NList alloc] initWithSize:2];
  17.  
  18. @property (nonatomic,readwrite) NSInteger size;
  19.  
  20. .....
  21.  
  22. - (id) initWithSize:(NSInteger *)size {
  23. self = [super init];
  24. if (self){
  25. self.head = nil;
  26. self.size = *size;
  27. self.num_nodes = 0;
  28. }
  29. return self;
  30. }
  31.  
  32. - (void)testAdd
  33. {
  34. NList *testList = [[NList alloc] initWithSize:2];
  35. NSObject *testNodeOne = @1;
  36. [testList add:(testNodeOne)];
  37. XCTAssertNotNil(testList.head);
  38. NSObject *testNodeTwo = @3;
  39.  
  40. [testList add:testNodeTwo];
  41. XCTAssertNotNil(testList.head);
  42. XCTAssertNotNil(testList.head.next);
  43.  
  44. }
  45.  
  46. /LinkedListTest.m: test failure: -[LinkedListTest testAdd] failed: ((testList.head.next) != nil) failed: throwing "-[__NSCFNumber next]: unrecognized selector sent to instance 0x8d75720"
  47.  
  48. -(id) initWithSize:(NSInteger)size
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement