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 8730515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:02:26+00:00 2026-06-13T09:02:26+00:00

I recently upgraded from iOS 5 to iOS 6 and found this unit test

  • 0

I recently upgraded from iOS 5 to iOS 6 and found this unit test was failing

- (void)testCalculatesDistanceBetweenTwoPoints
{
    self.sut = [[DistanceCalculator alloc] init];
    CLLocationCoordinate2D start = {.latitude = 34.32, .longitude = 99.13};
    CLLocationCoordinate2D finish = {.latitude = 105.94, .longitude = 27.73};
    NSNumber *distance = [self.sut kilometresBetweenPlace1:start andPlace2:finish];
    NSNumber *expected = [NSNumber numberWithDouble:3822.23073702318];
    STAssertEqualObjects(distance, expected, @"");
}

The failing asserting

‘3822.23073702318’ should be equal to ‘3822.23073702318’

When I print the raw value of each number I get what looks like the same value

2012-10-23 20:01:42.970 HelloWorld[1573:c07] 1 3822.23073702318
2012-10-23 20:01:42.970 HelloWorld[1573:c07] 2 3822.23073702318

When I print the type of each number I get what looks like the same (could I be doing this wrong?)

2012-10-23 20:06:37.309 HelloWorld[1611:c07] 1 __NSCFNumber 
2012-10-23 20:06:37.309 HelloWorld[1611:c07] 2 __NSCFNumber

Here is the full blown implementation if that helps

- (NSNumber *)kilometresBetweenPlace1:(CLLocationCoordinate2D)place1 andPlace2:(CLLocationCoordinate2D)place2
{
    MKMapPoint start = MKMapPointForCoordinate(place1);
    MKMapPoint finish = MKMapPointForCoordinate(place2);

    double distance = MKMetersBetweenMapPoints(start, finish) / 1600;

    return [NSNumber numberWithDouble:distance];
}
  • 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-13T09:02:27+00:00Added an answer on June 13, 2026 at 9:02 am

    For anyone who might follow this discussion -here is what I ended up with

    - (void)testCalculatesDistanceBetweenTwoPoints
    {
        double accuracy = 0.00000000001;
        self.sut = [[DistanceCalculator alloc] init];
        CLLocationCoordinate2D start = {.latitude = 34.32, .longitude = 99.13};
        CLLocationCoordinate2D finish = {.latitude = 105.94, .longitude = 27.73};
        NSNumber *distance = [self.sut kilometresBetweenPlace1:start andPlace2:finish];
        NSNumber *expected = [NSNumber numberWithDouble:3822.23073702318];
        STAssertEqualsWithAccuracy([distance doubleValue], [expected doubleValue], accuracy, @"");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've recently upgraded from Visual SourceSafe to SVN based on recommendations on this site.
I recently upgraded XCode to run iOS 4.2 from iOS 3.2. However, now, when
I'm using XCode 4.4 (recently upgraded from 4.2). Just got my individual iOS developer
I've recently upgraded an application from jQuery 1.2 to 1.3.2 - and we've found
I've just recently upgraded from ABCPdf 6 to ABCPdf 8.1. I've got this webpage
I've recently upgraded from Xcode 3 to Xcode 4.2, and migrated an existing iOS
We recently upgraded from Excel 2007 to Excel 2010, and we have found that
I recently upgraded from jQuery 1.2.6 to 1.3.2 Now on the page I'm using
I recently upgraded from Vista/32 to Win7/64. On my old machine, everything was working
I recently upgraded from Grails 1.3.7 to Grails 2.0.1. The application runs normal, but

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.