From a5caf49b945179abdc0570a6ba8797b4552c793b Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 26 Feb 2012 13:01:37 +0000 Subject: More QueryKit SELECT tests. --- .../QueryKit/QueryKit.xcodeproj/project.pbxproj | 44 +++++++++++++++++++--- .../QueryKit/Tests/QKSelectQueryGroupByTests.m | 2 +- .../QueryKit/Tests/QKSelectQueryOrderByTests.m | 18 +++++++++ 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj b/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj index 6d52f5f0..efbdb9f1 100644 --- a/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj +++ b/Frameworks/QueryKit/QueryKit.xcodeproj/project.pbxproj @@ -133,6 +133,40 @@ path = Source; sourceTree = ""; }; + 17322A7214FA645300F0CF9B /* SELECT Tests */ = { + isa = PBXGroup; + children = ( + 17E5969714F307B70054EE08 /* QKSelectQueryTests.h */, + 17E5969814F307B70054EE08 /* QKSelectQueryTests.m */, + 1713ECAE14F96A5C0013C4F0 /* QKSelectQueryOrderByTests.h */, + 1713ECAF14F96A5C0013C4F0 /* QKSelectQueryOrderByTests.m */, + 1713ECD614F970BB0013C4F0 /* QKSelectQueryGroupByTests.h */, + 1713ECD714F970BB0013C4F0 /* QKSelectQueryGroupByTests.m */, + ); + name = "SELECT Tests"; + sourceTree = ""; + }; + 17322A7414FA646000F0CF9B /* UPDATE Tests */ = { + isa = PBXGroup; + children = ( + ); + name = "UPDATE Tests"; + sourceTree = ""; + }; + 17322A7514FA647200F0CF9B /* DELETE Tests */ = { + isa = PBXGroup; + children = ( + ); + name = "DELETE Tests"; + sourceTree = ""; + }; + 17322A7614FA648100F0CF9B /* INSERT Tests */ = { + isa = PBXGroup; + children = ( + ); + name = "INSERT Tests"; + sourceTree = ""; + }; 17E5952814F301F40054EE08 /* Constants */ = { isa = PBXGroup; children = ( @@ -145,12 +179,10 @@ 17E5969614F3079E0054EE08 /* Tests */ = { isa = PBXGroup; children = ( - 17E5969714F307B70054EE08 /* QKSelectQueryTests.h */, - 17E5969814F307B70054EE08 /* QKSelectQueryTests.m */, - 1713ECAE14F96A5C0013C4F0 /* QKSelectQueryOrderByTests.h */, - 1713ECAF14F96A5C0013C4F0 /* QKSelectQueryOrderByTests.m */, - 1713ECD614F970BB0013C4F0 /* QKSelectQueryGroupByTests.h */, - 1713ECD714F970BB0013C4F0 /* QKSelectQueryGroupByTests.m */, + 17322A7614FA648100F0CF9B /* INSERT Tests */, + 17322A7514FA647200F0CF9B /* DELETE Tests */, + 17322A7414FA646000F0CF9B /* UPDATE Tests */, + 17322A7214FA645300F0CF9B /* SELECT Tests */, ); path = Tests; sourceTree = ""; diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m b/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m index 722d7df0..9bbe75a2 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m +++ b/Frameworks/QueryKit/Tests/QKSelectQueryGroupByTests.m @@ -67,7 +67,7 @@ static NSString *QKTestFieldTwo = @"test_field2"; STAssertTrue([[_query query] hasSuffix:query], @"query group by"); } -- (void)testSelectQueryMultipleGroupByIsCorrect +- (void)testSelectQueryGroupByMultipleFieldsIsCorrect { [_query groupByFields:[NSArray arrayWithObjects:QKTestFieldOne, QKTestFieldTwo, nil]]; diff --git a/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m b/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m index 4f33d657..84bd5ddb 100644 --- a/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m +++ b/Frameworks/QueryKit/Tests/QKSelectQueryOrderByTests.m @@ -67,6 +67,15 @@ static NSString *QKTestFieldTwo = @"test_field2"; STAssertTrue([[_query query] hasSuffix:query], @"query order by"); } +- (void)testSelectQueryOrderByMultipleFieldsAscendingIsCorrect +{ + [_query orderByFields:[NSArray arrayWithObjects:QKTestFieldOne, QKTestFieldTwo, nil] descending:NO]; + + NSString *query = [NSString stringWithFormat:@"ORDER BY %@, %@ ASC", QKTestFieldOne, QKTestFieldTwo]; + + STAssertTrue([[_query query] hasSuffix:query], @"query order by"); +} + - (void)testSelectQueryOrderByDescendingIsCorrect { [_query orderByField:QKTestFieldOne descending:YES]; @@ -76,4 +85,13 @@ static NSString *QKTestFieldTwo = @"test_field2"; STAssertTrue([[_query query] hasSuffix:query], @"query order by"); } +- (void)testSelectQueryOrderByMultipleFieldsDescendingIsCorrect +{ + [_query orderByFields:[NSArray arrayWithObjects:QKTestFieldOne, QKTestFieldTwo, nil] descending:YES]; + + NSString *query = [NSString stringWithFormat:@"ORDER BY %@, %@ DESC", QKTestFieldOne, QKTestFieldTwo]; + + STAssertTrue([[_query query] hasSuffix:query], @"query order by"); +} + @end -- cgit v1.2.3