headers/bsd: Add sys/queue.h.
[haiku.git] / src / tests / UnitTester.cpp
blobf06507995d526a5805f420cc917229ab1163f594
1 /*
2 * Copyright 2002-2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #include <stdio.h>
9 #include <SemaphoreSyncObject.h>
10 #include <Directory.h>
12 #include "UnitTester.h"
15 UnitTesterShell::UnitTesterShell(const std::string &description,
16 SyncObject *syncObject)
18 BTestShell(description, syncObject)
23 void
24 UnitTesterShell::PrintDescription(int argc, char *argv[])
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");
32 void
33 UnitTesterShell::PrintValidArguments()
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");
44 void
45 UnitTesterShell::LoadDynamicSuites()
47 // Add the appropriate test lib path
48 std::string defaultLibDir = std::string(GlobalTestDir()) + "/lib";
49 fLibDirs.insert(defaultLibDir);
51 // Load away
52 BTestShell::LoadDynamicSuites();
56 // #pragma mark -
59 int
60 main(int argc, char *argv[])
62 UnitTesterShell shell("Haiku Unit Testing Framework",
63 new SemaphoreSyncObject);
65 // ##### Add test suites for statically linked tests here #####
66 //shell.AddTest("Example", ExampleTest::Suite());
68 BTestShell::SetGlobalShell(&shell);
70 // Load our dynamically linked tests
72 int result = shell.Run(argc, argv);
74 // Unset global shell, just to be sure
75 BTestShell::SetGlobalShell(NULL);
77 return result;