• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fwd: Unit Testing and Run Loops
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Unit Testing and Run Loops


  • Subject: Fwd: Unit Testing and Run Loops
  • From: Jamie Hardt <email@hidden>
  • Date: Sat, 4 Jul 2009 12:31:10 -0700

Thanks, I dimly recall seeing something like this before...

On Jul 4, 2009, at 12:19 PM, A.M. wrote:


On Jul 4, 2009, at 3:10 PM, Jamie Hardt wrote:
[...]
But does anyone know how to setup something like a stream read or URL download, and make sure run loop completely services the download/stream, and then write a unit test that makes sure all this happens?

NSTimeInterval timeout=3.0;
while(1)
{
NSTimeInterval runtime=[NSDate timeIntervalSinceReferenceDate];
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate: [NSDate dateWithTimeIntervalSinceNow:t timeout];
timeout-=[NSDate timeIntervalSinceReferenceDate]-runtime;
if(mFileDownloaded || timeout<0.0)
break;
}
STAssertTrue(mFileDownloaded==YES,@"File failed to download");


Cheers,
M



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Unit Testing and Run Loops
  • Next by Date: Re: Animation Did Stop - Works For OS3 but not OS2.2
  • Previous by thread: Unit Testing and Run Loops
  • Next by thread: Can we pass pointer of a class to a function?
  • Index(es):
    • Date
    • Thread