ios - STAssertEquals: null pointer and NULL gives type mismatch error -
what wrong, here doing?
ptr == null
true
,
this ok,
stasserttrue(ptr == null, @"ptr null");
//succeeded
but,
stassertequals(ptr, null, @"");
is giving error, "type mismatch ---
".
- (void) testnilencoding { nsstring * nils = nil; const char * ptr = [nils datausingencoding:nsutf8stringencoding].bytes; const char * ptr2 = [nils cstringusingencoding:nsutf8stringencoding]; if (ptr == null) { nslog(@"ptr null"); // ok } stasserttrue(ptr == null, @"ptr null"); //ok stassertequals(ptr, null, @""); //fails stassertequals(ptr2, null, @""); //fails }
Comments
Post a Comment