From 29434c98f83f902a5a483cb2aedc380ad3e90bd9 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Fri, 13 Nov 2009 23:43:46 +0000 Subject: Rename test case classes. --- UnitTests/MCPKitTest.h | 35 ++++++++++++++ UnitTests/MCPKitTest.m | 85 +++++++++++++++++++++++++++++++++ UnitTests/SPStringAdditionsTest.h | 30 ++++++++++++ UnitTests/SPStringAdditionsTest.m | 57 ++++++++++++++++++++++ UnitTests/mcpKitTest.h | 33 ------------- UnitTests/mcpKitTest.m | 83 -------------------------------- UnitTests/stringCategoryAdditionsTest.h | 28 ----------- UnitTests/stringCategoryAdditionsTest.m | 55 --------------------- 8 files changed, 207 insertions(+), 199 deletions(-) create mode 100644 UnitTests/MCPKitTest.h create mode 100644 UnitTests/MCPKitTest.m create mode 100644 UnitTests/SPStringAdditionsTest.h create mode 100644 UnitTests/SPStringAdditionsTest.m delete mode 100644 UnitTests/mcpKitTest.h delete mode 100644 UnitTests/mcpKitTest.m delete mode 100644 UnitTests/stringCategoryAdditionsTest.h delete mode 100644 UnitTests/stringCategoryAdditionsTest.m (limited to 'UnitTests') diff --git a/UnitTests/MCPKitTest.h b/UnitTests/MCPKitTest.h new file mode 100644 index 00000000..d4d1ffec --- /dev/null +++ b/UnitTests/MCPKitTest.h @@ -0,0 +1,35 @@ +// +// $Id$ +// +// MCPKitTest.h +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +@class MCPConnection; + +@interface MCPKitTest : SenTestCase +{ + MCPConnection *connection; +} + +@end diff --git a/UnitTests/MCPKitTest.m b/UnitTests/MCPKitTest.m new file mode 100644 index 00000000..e347d9da --- /dev/null +++ b/UnitTests/MCPKitTest.m @@ -0,0 +1,85 @@ +// +// $Id$ +// +// MCPKitTest.m +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +#import "MCPKitTest.h" + +@implementation MCPKitTest + +- (void)setUp +{ + // For now, we try an find the following database in the local connection. + // If the connection fails for any reasons, tests are not run. + // http://downloads.mysql.com/docs/sakila-db.zip + // + // Set up a user called 'sakila' with no password that has all privs on the + // database 'sakila'. + + connection = [[MCPConnection alloc] initToSocket:@"/var/mysql/mysql.sock" withLogin:@"sakila"]; + + // Set the 'sakila' user's password + [connection setPassword:@""]; + + if (![connection isConnected]) { + [connection dealloc]; + connection = nil; + STFail(@"Error connecting to database server. No tests were run."); + } + else { + if (![connection selectDB:@"sakila"]) { + [connection dealloc]; + connection = nil; + STFail(@"Error selecting database 'sakila'. No tests were run."); + } + } +} + +- (void)tearDown +{ + if (connection != nil) { + [connection disconnect]; + [connection dealloc]; + } +} + +- (void)testServerVersion +{ + if (connection == nil) return; + + STAssertTrue([connection serverMajorVersion] != 0, @"server version"); + STAssertTrue([connection serverMajorVersion] != 0, @"server version"); +} + +- (void)testTableList +{ + if (connection == nil) return; + + MCPResult *queryResult = [connection queryString:@"SELECT * FROM actor"]; + + STAssertEquals([queryResult numOfRows], (my_ulonglong)200, @"actors table count"); +} + +@end diff --git a/UnitTests/SPStringAdditionsTest.h b/UnitTests/SPStringAdditionsTest.h new file mode 100644 index 00000000..66570b35 --- /dev/null +++ b/UnitTests/SPStringAdditionsTest.h @@ -0,0 +1,30 @@ +// +// $Id$ +// +// SPStringAdditionsTest.h +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +@interface SPStringAdditionsTest : SenTestCase + +@end diff --git a/UnitTests/SPStringAdditionsTest.m b/UnitTests/SPStringAdditionsTest.m new file mode 100644 index 00000000..208381a8 --- /dev/null +++ b/UnitTests/SPStringAdditionsTest.m @@ -0,0 +1,57 @@ +// +// $Id$ +// +// SPStringAdditionsTest.m +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import "SPStringAdditionsTest.h" +#import "SPStringAdditions.h" + +@implementation SPStringAdditionsTest + +- (void)setUp +{ + +} + +- (void)tearDown +{ + +} + +- (void)testStringByRemovingCharactersInSet +{ + NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:@"abc',ü"]; + + NSString *s = @"this is big, crazy st'ring"; + NSString *expect = @"this is ig rzy string"; + + STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); + + // Check UTF + s = @"In der Kürze liegt die Würz"; + expect = @"In der Krze liegt die Wrz"; + + STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); +} + +@end diff --git a/UnitTests/mcpKitTest.h b/UnitTests/mcpKitTest.h deleted file mode 100644 index 14f263bd..00000000 --- a/UnitTests/mcpKitTest.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// mcpKitTest.h -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -@class MCPConnection; - -@interface mcpKitTest : SenTestCase -{ - MCPConnection *connection; -} - -@end diff --git a/UnitTests/mcpKitTest.m b/UnitTests/mcpKitTest.m deleted file mode 100644 index 49c02eb8..00000000 --- a/UnitTests/mcpKitTest.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// mcpKitTest.m -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -#import "mcpKitTest.h" - -@implementation mcpKitTest - -- (void)setUp -{ - // For now, we try an find the following database in the local connection. - // If the connection fails for any reasons, tests are not run. - // http://downloads.mysql.com/docs/sakila-db.zip - // - // Set up a user called 'sakila' with no password that has all privs on the - // database 'sakila'. - - connection = [[MCPConnection alloc] initToSocket:@"/var/mysql/mysql.sock" withLogin:@"sakila"]; - - // Set the 'sakila' user's password - [connection setPassword:@""]; - - if (![connection isConnected]) { - [connection dealloc]; - connection = nil; - STFail(@"Error connecting to database server. No tests were run."); - } - else { - if (![connection selectDB:@"sakila"]) { - [connection dealloc]; - connection = nil; - STFail(@"Error selecting database 'sakila'. No tests were run."); - } - } -} - -- (void)tearDown -{ - if (connection != nil) { - [connection disconnect]; - [connection dealloc]; - } -} - -- (void)testServerVersion -{ - if (connection == nil) return; - - STAssertTrue([connection serverMajorVersion] != 0, @"server version"); - STAssertTrue([connection serverMajorVersion] != 0, @"server version"); -} - -- (void)testTableList -{ - if (connection == nil) return; - - MCPResult *queryResult = [connection queryString:@"SELECT * FROM actor"]; - - STAssertEquals([queryResult numOfRows], (my_ulonglong)200, @"actors table count"); -} - -@end diff --git a/UnitTests/stringCategoryAdditionsTest.h b/UnitTests/stringCategoryAdditionsTest.h deleted file mode 100644 index d995a29e..00000000 --- a/UnitTests/stringCategoryAdditionsTest.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// stringCategoryAdditionsTest.h -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -@interface stringCategoryAdditionsTest : SenTestCase - -@end diff --git a/UnitTests/stringCategoryAdditionsTest.m b/UnitTests/stringCategoryAdditionsTest.m deleted file mode 100644 index 11a4a49b..00000000 --- a/UnitTests/stringCategoryAdditionsTest.m +++ /dev/null @@ -1,55 +0,0 @@ -// -// stringCategoryAdditionsTest.m -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import "stringCategoryAdditionsTest.h" -#import "SPStringAdditions.h" - -@implementation stringCategoryAdditionsTest - -- (void)setUp -{ - -} - -- (void)tearDown -{ - -} - -- (void)testStringByRemovingCharactersInSet -{ - NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:@"abc',ü"]; - - NSString *s = @"this is big, crazy st'ring"; - NSString *expect = @"this is ig rzy string"; - - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); - - // Check UTF - s = @"In der Kürze liegt die Würz"; - expect = @"In der Krze liegt die Wrz"; - - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); -} - -@end -- cgit v1.2.3