Search code examples
iosassertocunit

ios: OCUnit STAssertEquals -> Type missmatch


I wrote a unit test for my code. The code looks like the following:

bool result = [t1 isSimilarToTransaktion:t2];
if( result )
    NSLog(@"YEAH!!!!");
STAssertEquals( YES, result, @"Not equal" );

Actually I checked that in this particular case result is YES. But the test fails with the error message "Type missmatch". Actually I thought YES and YES are of the same type? Btw: YEAH!!! is plotet when I execute this.

Oh I just replaced STAssertEquals with STAssertTrue but it is still a mystery to me


Solution

  • Your type for result should be BOOL, not bool.

    Alternatively you could check for "true" instead of "YES".