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

  • SEARCH
  • Home
  • 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 8412877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:47:19+00:00 2026-06-10T00:47:19+00:00

I was trying to do: [[[mockQuestion stub] andReturnValue:YES] shouldNegate]; [[[mockQuestion stub] andReturnValue:123] randomNumberWithLimit]; But

  • 0

I was trying to do:

[[[mockQuestion stub] andReturnValue:YES] shouldNegate];
[[[mockQuestion stub] andReturnValue:123] randomNumberWithLimit];

But that gave me this warning/error “incompatible integer pointer conversion sending ‘BOOL’ (aka ‘signed char’) to parameter of type ‘NSValue *'”

The only way I could figure out to get around it was to do:

BOOL boolValue = YES;
int num = 123;

[[[mockQuestion stub] andReturnValue:OCMOCK_VALUE(boolValue)] shouldNegate];
[[[mockQuestion stub] andReturnValue:OCMOCK_VALUE(num)] randomNumberWithLimit];

But that makes my test code seem so overly verbose.. Is there a way to do this all inline without having to set variables?

  • 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-10T00:47:20+00:00Added an answer on June 10, 2026 at 12:47 am

    You can use a literal style that looks like (type){value}. This is commonly used to create struct literals but works for basic datatypes too. The important aspect here is that this type of literal creates a temporary that can be addressed. This means you can write your code like

    [[[mockQuestion stub] andReturnValue:OCMOCK_VALUE((BOOL){YES})] shouldNegate];
    [[[mockQuestion stub] andReturnValue:OCMOCK_VALUE((int){123})] randomNumberWithLimit];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to do this, but is it wrong? Below is my style and script
Trying to find some information on this but am unable to get any results
Trying to merge 8 pre-sorted arrays. I'm fairly new to C, but this is
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
Trying to develop hello world, but getting force close error on emulator. thanks in
Trying to create a backbone plugin that inherits from Backbone.Model but overrides the sync
Trying to setup Heroku according to this start guide, but Im experiencing a no
Trying to figure out how I can do this properly. The print_r looks like
Trying to copy the msdn refernce here doesn't work and gives an error I

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.