|
From: <chi...@us...> - 2003-06-15 03:17:00
|
Update of /cvsroot/log4cocoa/log4cocoa In directory sc8-pr-cvs1:/tmp/cvs-serv2080 Added Files: AllTests.h AllTests.m AllTests_Prefix.h L4LevelTest.h L4LevelTest.m test_main.m Log Message: adding testing target ***NOTE*** this is adding a dependency on ObjcUnit http://oops.se/objcunit/ I will be posting a new tarball tonight that contains ObjcUnit, a primitive demo app, and the latest code. --- NEW FILE: AllTests.h --- // // AllTests.h // Log4Cocoa // // Created by bob frank on Sun May 04 2003. // Copyright (c) 2003 __MyCompanyName__. All rights reserved. // #import <Foundation/Foundation.h> @interface AllTests : NSObject { } + (TestSuite *)suite; @end --- NEW FILE: AllTests.m --- // // AllTests.m // Log4Cocoa // // Created by bob frank on Sun May 04 2003. // Copyright (c) 2003 __MyCompanyName__. All rights reserved. // #import "AllTests.h" #import "L4LevelTest.h" @implementation AllTests + (TestSuite *) suite { TestSuite *suite = [TestSuite suiteWithName: @"My Tests"]; // Add your tests here ... // [suite addTest: [TestSuite suiteWithClass: [L4LevelTest class]]]; return suite; } @end --- NEW FILE: AllTests_Prefix.h --- /* * AllTests_Prefix.h * * * Created by bob frank on Sun May 04 2003. * Copyright (c) 2003 __MyCompanyName__. All rights reserved. * */ #ifdef __OBJC__ // #import <Cocoa/Cocoa.h> #import <Foundation/Foundation.h> #import <ObjcUnit/ObjcUnit.h> #import "Log4Cocoa.h" #endif --- NEW FILE: L4LevelTest.h --- // // L4LevelTest.h // Log4Cocoa // // Created by bob frank on Sun May 04 2003. // Copyright (c) 2003 __MyCompanyName__. All rights reserved. // #import <Foundation/Foundation.h> @interface L4LevelTest : TestCase { } @end --- NEW FILE: L4LevelTest.m --- // // L4LevelTest.m // Log4Cocoa // // Created by bob frank on Sun May 04 2003. // Copyright (c) 2003 __MyCompanyName__. All rights reserved. // #import "L4LevelTest.h" @implementation L4LevelTest - (void) testLevelIntValues { L4Level *debug = [L4Level debug]; L4Level *info = [L4Level info]; L4Level *warn = [L4Level warn]; L4Level *error = [L4Level error]; L4Level *fatal = [L4Level fatal]; [self assertInt: DEBUG_INT equals: 10 message: @"Debug Int should equal 10."]; [self assertInt: [debug intValue] equals: DEBUG_INT message: @"[debug intValue] should equal DEBUG_INT"]; [self assertInt: INFO_INT equals: 20 message: @"Debug Int should equal 20."]; [self assertInt: [info intValue] equals: INFO_INT message: @"[info intValue] should equal INFO_INT"]; [self assertInt: WARN_INT equals: 30 message: @"Debug Int should equal 30."]; [self assertInt: [warn intValue] equals: WARN_INT message: @"[warn intValue] should equal WARN_INT"]; [self assertInt: ERROR_INT equals: 40 message: @"Debug Int should equal 40."]; [self assertInt: [error intValue] equals: ERROR_INT message: @"[error intValue] should equal ERROR_INT"]; [self assertInt: FATAL_INT equals: 50 message: @"Debug Int should equal 50."]; [self assertInt: [fatal intValue] equals: FATAL_INT message: @"[fatal intValue] should equal FATAL_INT"]; } - (void) testLevelHierarchies { // - (void)assertTrue:(BOOL)condition message:(NSString *)message; [self assertTrue: [[L4Level fatal] isGreaterOrEqual: [L4Level debug]] message: @"Fatal should be >= debug"]; [self assertTrue: [[L4Level fatal] isGreaterOrEqual: [L4Level info]] message: @"Fatal should be >= info"]; [self assertTrue: [[L4Level fatal] isGreaterOrEqual: [L4Level warn]] message: @"Fatal should be >= warn"]; [self assertTrue: [[L4Level fatal] isGreaterOrEqual: [L4Level error]] message: @"Fatal should be >= error"]; [self assertTrue: [[L4Level fatal] isGreaterOrEqual: [L4Level fatal]] message: @"Fatal should be >= fatal"]; [self assertFalse: [[L4Level info] isGreaterOrEqual: [L4Level fatal]] message: @"info should not be >= fatal"]; } - (void) testGettingLevelsByName { [self assertTrue: [[L4Level levelWithName: @"DEBUG"] isEqual: [L4Level debug]] message: @"DEBUG string should yield 'debug' object"]; [self assertTrue: [[L4Level levelWithName: @"INFO"] isEqual: [L4Level info]] message: @"INFO string should yield 'info' object"]; [self assertTrue: [[L4Level levelWithName: @"WARN"] isEqual: [L4Level warn]] message: @"WARN string should yield 'warn' object"]; [self assertTrue: [[L4Level levelWithName: @"ERROR"] isEqual: [L4Level error]] message: @"ERROR string should yield 'error' object"]; [self assertTrue: [[L4Level levelWithName: @"FATAL"] isEqual: [L4Level fatal]] message: @"FATAL string should yield 'fatal' object"]; } @end --- NEW FILE: test_main.m --- // The test_main.m file #import <ObjcUnit/ObjcUnit.h> #import "AllTests.h" int main(int argc, const char *argv[]) { TestRunnerMain([AllTests class]); return 0; } |