From fff1088e78d89e081f8313d1fd376ac92fc2eadb Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Sun, 17 Apr 2016 15:08:25 +0200 Subject: [PATCH] navdata test (requires manual download of data" --- .../xcdebugger/Breakpoints_v2.xcbkptlist | 66 +++++++++++++++++++ FMC Planner 2/ViewController.m | 1 + FMC Planner 2/ViewControllerScreen.m | 4 +- FMC Planner 2Tests/FMC_Planner_2Tests.m | 32 ++++++++- 4 files changed, 101 insertions(+), 2 deletions(-) diff --git a/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index ed9a9b4..2e13b82 100644 --- a/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/FMC PLanner 2.xcworkspace/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -2,4 +2,70 @@ + + + + + + + + + + + + + + + + + + diff --git a/FMC Planner 2/ViewController.m b/FMC Planner 2/ViewController.m index 2869886..77351ce 100644 --- a/FMC Planner 2/ViewController.m +++ b/FMC Planner 2/ViewController.m @@ -28,6 +28,7 @@ // Override point for customization after application launch. _dbClient = [[DropboxV2ObjC alloc] init]; + ((AppDelegate *)[UIApplication sharedApplication].delegate).main = self; NSDictionary *credentials = [[NSURLCredentialStorage sharedCredentialStorage] credentialsForProtectionSpace:_dbClient.kDropboxProtectionSpace]; diff --git a/FMC Planner 2/ViewControllerScreen.m b/FMC Planner 2/ViewControllerScreen.m index cabcd0e..3749fe9 100644 --- a/FMC Planner 2/ViewControllerScreen.m +++ b/FMC Planner 2/ViewControllerScreen.m @@ -264,7 +264,9 @@ NavDataParser *parser = nil; } else { // Right hand LSKs, aka waypoint entry - if ([precedingWaypoint.text isEqualToString:@""]) { + if ([precedingWaypoint.text isEqualToString:@""] && + ![[_Header.text substringToIndex:7] + isEqualToString:@"ROUTE 1"]) { // Not allowed NSLog(@"NOT ALLOWED 3"); } diff --git a/FMC Planner 2Tests/FMC_Planner_2Tests.m b/FMC Planner 2Tests/FMC_Planner_2Tests.m index d2f033f..aab605d 100644 --- a/FMC Planner 2Tests/FMC_Planner_2Tests.m +++ b/FMC Planner 2Tests/FMC_Planner_2Tests.m @@ -6,9 +6,12 @@ // Copyright © 2016 Kilian Hofmann. All rights reserved. // +#import "NavDataParser.h" #import -@interface FMC_Planner_2Tests : XCTestCase +@interface FMC_Planner_2Tests : XCTestCase { + NavDataParser *parser; +} @end @@ -19,6 +22,9 @@ [super setUp]; // Put setup code here. This method is called before the invocation of each // test method in the class. + if (parser == nil) { + parser = [[NavDataParser alloc] init]; + } } - (void)tearDown @@ -28,4 +34,28 @@ [super tearDown]; } +#pragma mark - NavData + +- (void)testWaypoint +{ + XCTAssertTrue([parser findWaypoint:@"DKB"].count > 0); +} + +- (void)testAirway +{ + XCTAssertTrue([parser findAirway:@"T104"].count > 0); +} + +- (void)testWaypointOnAirway +{ + XCTAssertTrue([parser findWaypoint:@"DKB" onAirway:@"T702"].count == 0); +} + +- (void)testCrosspoint +{ + XCTAssertTrue( + [[parser findCrosspointBetween:@"T104" and:@"T702" withStart:@"DKB"] + .firstObject isEqualToString:@"WLD"]); +} + @end