1/* 2 * Copyright 2002-2010, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#include <stdio.h> 8 9#include <SemaphoreSyncObject.h> 10#include <Directory.h> 11 12#include "UnitTester.h" 13 14 15UnitTesterShell::UnitTesterShell(const std::string &description, 16 SyncObject *syncObject) 17 : 18 BTestShell(description, syncObject) 19{ 20} 21 22 23void 24UnitTesterShell::PrintDescription(int argc, char *argv[]) 25{ 26 printf("This program is the central testing framework for the purpose\n" 27 "of testing and verifying the various kits, classes, functions,\n" 28 "and the like that comprise Haiku.\n"); 29} 30 31 32void 33UnitTesterShell::PrintValidArguments() 34{ 35 BTestShell::PrintValidArguments(); 36 printf(" -haiku Runs tests linked against our Haiku " 37 "libraries (*default*)\n" 38 " -r5 Runs tests linked against Be Inc.'s R5 " 39 "libraries (instead\n" 40 " of our libraries) for the sake of comparison.\n"); 41} 42 43 44void 45UnitTesterShell::LoadDynamicSuites() 46{ 47 // Add the appropriate test lib path 48 std::string defaultLibDir = std::string(GlobalTestDir()) + "/lib"; 49 fLibDirs.insert(defaultLibDir); 50 51 // Load away 52 BTestShell::LoadDynamicSuites(); 53} 54 55 56// #pragma mark - 57 58 59int 60main(int argc, char *argv[]) 61{ 62 UnitTesterShell shell("Haiku Unit Testing Framework", 63 new SemaphoreSyncObject); 64 65 // ##### Add test suites for statically linked tests here ##### 66 //shell.AddTest("Example", ExampleTest::Suite()); 67 68 BTestShell::SetGlobalShell(&shell); 69 70 // Load our dynamically linked tests 71 72 int result = shell.Run(argc, argv); 73 74 // Unset global shell, just to be sure 75 BTestShell::SetGlobalShell(NULL); 76 77 return result; 78} 79