Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9219029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:00:22+00:00 2026-06-18T03:00:22+00:00

Can someone please tell me that this assert could be optimized? Unit testing in

  • 0

Can someone please tell me that this assert could be optimized? Unit testing in iOS is driving me up the wall. A simple assertion on the count of an NSArray should not be this verbose:

GHAssertEquals([[NSNumber numberWithInt:[caseArray count]] intValue], 
                             [[NSNumber numberWithInt:627] intValue], 
                                              @"array count equals");

EDIT: Suggested line below

GHAssertEquals([caseArray count], 627, @"array count equals");

produces this output:

Reason: Type mismatch -- array count equals

0   CoreFoundation                      0x01cfd02e __exceptionPreprocess + 206
1   libobjc.A.dylib                     0x0113ae7e objc_exception_throw + 44
2   CoreFoundation                      0x01d85fb1 -[NSException raise] + 17
3   Tests                               0x00027711 -[GHTestCase failWithException:] + 33
4   Tests                               0x0001a0ed -[CaseTest testGetCaseArrayFromJSONArray] + 3293
5   libobjc.A.dylib                     0x0114e663 -[NSObject performSelector:] + 62
6   Tests                               0x00022e19 +[GHTesting runTestWithTarget:selector:exception:interval:reraiseExceptions:] + 450
7   Tests                               0x0001ea90 -[GHTest run:] + 275
8   Tests                               0x000211ea -[GHTestGroup _run:] + 696
9   Tests                               0x00021513 -[GHTestGroup run:] + 130
10  Tests                               0x000211ea -[GHTestGroup _run:] + 696
11  Tests                               0x00021513 -[GHTestGroup run:] + 130
12  Tests                               0x000239a2 -[GHTestRunner runTests] + 257
13  Tests                               0x00023b12 -[GHTestRunner _runInBackground] + 79
14  Foundation                          0x00b85805 -[NSThread main] + 76
15  Foundation                          0x00b85764 __NSThread__main__ + 1304
16  libsystem_c.dylib                   0x983c7557 _pthread_start + 344
17  libsystem_c.dylib                   0x983b1cee thread_start + 34

FAIL (0.033s)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:00:24+00:00Added an answer on June 18, 2026 at 3:00 am

    “Type mismatch” is because GHAssertEquals requires that both arguments be the same type. [caseArray count] returns an unsigned integer. This doesn’t match 627 which is a signed integer. So instead, compare against an unsigned 627, namely 627U:

    GHAssertEquals([caseArray count], 627U, @"array count equals");
    

    Alternatively, you could use OCHamcrest to say

    assertThat(caseArray, hasCountOf(627));
    

    (OCHamcrest is compatible with GHUnit.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please tell me what this means: 07-04 09:54:38.048: I/DetailActivity(15496): Title that is
Can someone please tell me what this is doing. Its a class that holds
can someone please tell why , Great Microsoft that created C# language and now
Can someone please tell me what's wrong with this sp. The logic seems to
Can someone please tell me why this doesn't work? I'm trying to show and
Can someone please tell me whats wrong with this code. I'm not getting complete
Can someone please tell me how to do this in C#? Convert from Quoted
Can someone please tell me how I can use this piece of code?. I'm
Can someone please tell me why this isn't working? var items = <select id=\orderer_search\
Can someone please tell me what's wrong with this code? Chrome and Firefox are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.