diff --git a/Jamrules b/Jamrules index a0f20da800..a3b50eca1a 100644 --- a/Jamrules +++ b/Jamrules @@ -220,6 +220,117 @@ rule Server NOTFILE obostests ; NOTFILE r5tests ; +rule CommonTestLib +{ + # CommonUnitTest : : + # : : ; + # Builds a unit test for both OBOS and R5 modules. + # The name of the target. + # The list of sources. + # A list of link libraries for the OBOS tests (as passed + # to LinkSharedOSLibs). + # A list of link libraries for the R5 tests (as passed + # to LinkSharedOSLibs). + # A list of public header dirs (as passed to + # UsePublicHeaders). + + local testlibdir = [ FDirName $(OBOS_TEST_DIR) lib ] ; #/boot/home/config/lib/obos_tests ; + + TestLib $(1) : $(2) : $(testlibdir) : $(3) : $(5) ; + R5TestLib $(1) : $(2) : $(testlibdir) : $(4) ; +} + +rule TestLib +{ + # TestLib : : : : + # Builds a unit test library for an OBOS module. + # The name of the target. + # The list of sources. + # The directory for the target (as passed to FDirName). + # A list of link libraries (as passed to LinkSharedOSLibs). + # A list of public header dirs (as passed to + # UsePublicHeaders). + + local target = $(1) ; + local sources = $(2) ; + local dest = $(3) ; + local libraries = $(4) ; + local headerDirs = $(5) ; + + # Turn optimization off. + local optim = $(OPTIM) ; + OPTIM = ; + +# SetupIncludes ; + UseCppUnitHeaders ; + SetupObjectsDir ; + MakeLocateObjects $(sources) ; + Main $(target) : $(sources) ; + MakeLocate $(target) : $(dest) ; + DEPENDS $(target) : libcppunit.so ; + DEPENDS obostests : $(target) ; + LinkSharedOSLibs $(target) : libcppunit.so $(libraries) ; + UsePublicObjectHeaders $(sources) : $(headerDirs) ; + ObjectDefines $(sources) : TEST_OBOS ; + LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ; + + # Turn debugging on. That is usually desired for test code. + ObjectCcFlags $(sources) : "-g" ; + ObjectC++Flags $(sources) : "-g" ; + + # Turn optimization on again. + OPTIM = $(optim) ; +} + +rule R5TestLib +{ + # R5UnitTest : : : + # Builds a unit test for an R5 module. "_r5" is appended to the object + # and the target name. + # The name of the target. + # The list of sources. + # The directory for the target (as passed to FDirName). + # A list of link libraries (as passed to LinkSharedOSLibs). + + local target = $(1:B)_r5$(1:S) ; + local sources = $(2) ; + local dest = $(3)_r5 ; + local libraries = $(4) ; + local objects = [ R5ObjectNames $(sources) ] ; + + # Turn optimization off. + local optim = $(OPTIM) ; + OPTIM = ; + + UseCppUnitHeaders ; + SetupObjectsDir ; + MakeLocateObjects $(objects) ; + + # Our Main replacement. + MainFromObjects $(target) : $(objects) ; + local source ; + for source in [ FGristFiles $(sources) ] + { + local object = [ R5ObjectNames $(source) ] ; + Object $(object) : $(source) ; + Depends obj : $(object) ; + } + + MakeLocate $(target) : $(dest) ; + DEPENDS $(target) : libcppunit.so ; + DEPENDS r5tests : $(target) ; + LinkSharedOSLibs $(target) : libcppunit.so $(libraries) ; + ObjectDefines $(objects) : TEST_R5 ; + LINKFLAGS on $(target) = $(LINKFLAGS) -nostart -Xlinker -soname=\"$(target)\" ; + + # Turn debugging on. That is usually desired for test code. + ObjectCcFlags $(objects) : "-g" ; + ObjectC++Flags $(objects) : "-g" ; + + # Turn optimization on again. + OPTIM = $(optim) ; +} + rule CommonUnitTest { # CommonUnitTest : : : diff --git a/headers/tools/cppunit/TestCase.h b/headers/tools/cppunit/TestCase.h index 64a778c36b..dcf11b0789 100644 --- a/headers/tools/cppunit/TestCase.h +++ b/headers/tools/cppunit/TestCase.h @@ -16,6 +16,11 @@ public: //! Starts a new sub test block (i.e. prints a newline :-) virtual void NextSubTestBlock(); + /*! \brief Prints to standard out just like printf, except shell verbosity + settings are honored. + */ + virtual void Outputf(const char *str, ...); + //! Saves the location of the current working directory. void SaveCWD(); @@ -24,6 +29,9 @@ public: //! Restores the current working directory to last directory saved by a call to SaveCWD(). void RestoreCWD(const char *alternate = NULL); protected: + //! Returns true if the current shell settings allow us to print to standard output. + bool BeVerbose(); + bool fValidCWD; char fCurrentWorkingDir[B_PATH_NAME_LENGTH+1]; int32 fSubTestNum; diff --git a/headers/tools/cppunit/TestShell.h b/headers/tools/cppunit/TestShell.h index 3858dd627e..52d9fccde0 100644 --- a/headers/tools/cppunit/TestShell.h +++ b/headers/tools/cppunit/TestShell.h @@ -64,41 +64,69 @@ public: // Returns true if verbosity is high enough that individual tests are // allowed to make noise. bool BeVerbose() const { return Verbosity() >= v2; }; - + + static bool GlobalBeVerbose() { return (fGlobalShell ? fGlobalShell->BeVerbose() : true); }; + + // Returns a pointer to a global BTestShell object. This function is + // something of a hack, used to give BTestCase and its subclasses + // access to verbosity information. Don't rely on it if you don't + // have to (and always make sure the pointer it returns isn't NULL + // before you try to use it :-). static BTestShell* Shell() { return fGlobalShell; }; - static void SetShell(BTestShell *shell) { fGlobalShell = shell; }; + // Sets the global BTestShell pointer. The BTestShell class does + // not assume ownership of the object. + static void SetShell(BTestShell *shell) { fGlobalShell = shell; }; protected: VerbosityLevel fVerbosityLevel; std::set fTestsToRun; std::map fTests; - std::map fSuites; + std::map fSuites; + std::set fLibDirs; CppUnit::TestResult fTestResults; CppUnit::TestResultCollector fResultsCollector; std::string fDescription; static BTestShell* fGlobalShell; + static const char indent[]; + bool fListTestsAndExit; - // Prints a brief description of the program and a guess as to - // which Storage Kit library the app was linked with based on - // the filename of the app + //! Prints a brief description of the program. virtual void PrintDescription(int argc, char *argv[]); - // Prints out command line argument instructions + //! Prints out command line argument instructions void PrintHelp(); + + /*! \brief Prints out the list of valid command line arguments. + Called by PrintHelp(). + */ + virtual void PrintValidArguments(); - // Handles command line arguments; returns true if everything goes - // okay, false if not (or if the program just needs to terminate without - // running any tests). Modifies settings in "settings" as necessary. + //! Prints out a list of all the currently available tests + void PrintInstalledTests(); + + /*! \brief Handles command line arguments; returns true if everything goes + okay, false if not (or if the program just needs to terminate without + running any tests). Modifies settings in "settings" as necessary. + */ bool ProcessArguments(int argc, char *argv[]); + + //! Processes a single argument, given by the \c arg parameter. + virtual bool ProcessArgument(std::string arg, int argc, char *argv[]); - // Makes any necessary pre-test preparations + //! Makes any necessary pre-test preparations void InitOutput(); - // Prints out the test results in the proper format per - // the specified verbosity level. + /*! \brief Prints out the test results in the proper format per + the specified verbosity level. + */ void PrintResults(); + /*! \brief Searches all the paths in \c fLibDirs, loading any dynamically + loadable suites it finds. + */ + virtual void LoadDynamicSuites(); + private: //! Prevents the use of the copy constructor. BTestShell( const BTestShell © ); diff --git a/headers/tools/cppunit/TestSuite.h b/headers/tools/cppunit/TestSuite.h index 39883fb439..3e1f5f0f56 100644 --- a/headers/tools/cppunit/TestSuite.h +++ b/headers/tools/cppunit/TestSuite.h @@ -10,7 +10,7 @@ class CppUnit::TestResult; //! Groups together a set of tests for a given kit. class BTestSuite : public CppUnit::Test { public: - BTestSuite( std::string name ); + BTestSuite( std::string name = "" ); virtual ~BTestSuite(); virtual void run( CppUnit::TestResult *result ); diff --git a/headers/tools/cppunit/ThreadedTestCaller.h b/headers/tools/cppunit/ThreadedTestCaller.h index 30efa25047..6615d41783 100644 --- a/headers/tools/cppunit/ThreadedTestCaller.h +++ b/headers/tools/cppunit/ThreadedTestCaller.h @@ -153,6 +153,7 @@ BThreadedTestCaller::run(CppUnit::TestResult *resu // Try to acquire the semaphore err = acquire_sem_etc(fThreadSem, fThreads.size(), B_RELATIVE_TIMEOUT, 500000); + // Get a pointer to the current global shell BTestShell *shell = BTestShell::Shell(); // Empty the UpdateList @@ -161,7 +162,9 @@ BThreadedTestCaller::run(CppUnit::TestResult *resu i != list.end(); i++) { - if (shell && shell->BeVerbose()) { + // Only print to standard out if the current global shell + // lets us (or if no global shell is designated). + if ((shell && shell->BeVerbose()) || !shell) { printf("%s", (*i).c_str()); fflush(stdout); } diff --git a/headers/tools/cppunit/ThreadedTestCase.h b/headers/tools/cppunit/ThreadedTestCase.h index dbfd8384b1..5ada956a54 100644 --- a/headers/tools/cppunit/ThreadedTestCase.h +++ b/headers/tools/cppunit/ThreadedTestCase.h @@ -18,6 +18,16 @@ public: thread in which it's called (i.e. [A.0][B.0][A.1][A.2][B.1]...). */ virtual void NextSubTest(); + /*! \brief Prints to standard out just like printf, except shell verbosity + settings are honored, and output from threads other than the main thread + happens before the test is over. + + \note Currently your output is limited to a length of 1024 characters. If + you really need to print a single string that's long than that, fix the + function yourself :-). + */ + virtual void Outputf(const char *str, ...); + //! Saves the location of the current working directory. void SaveCWD(); diff --git a/src/tests/ExampleTest.cpp b/src/tests/ExampleTest.cpp index 9484ac5e71..421719f3a1 100644 --- a/src/tests/ExampleTest.cpp +++ b/src/tests/ExampleTest.cpp @@ -20,22 +20,22 @@ ExampleTest::Suite() { // Add a multithreaded test ExampleTest *test = new ExampleTest("This name is never used, just so you know :-)"); - caller = new BThreadedTestCaller("MultiThreaded Test #1", test); + caller = new BThreadedTestCaller("ExampleTests::MultiThreaded Test #1", test); caller->addThread("A", &ExampleTest::TestFunc1); caller->addThread("B", &ExampleTest::TestFunc2); caller->addThread("C", &ExampleTest::TestFunc3); suite->addTest(caller); // And another - caller = new BThreadedTestCaller("MultiThreaded Test #2"); + caller = new BThreadedTestCaller("ExampleTests::MultiThreaded Test #2"); caller->addThread("Thread1", &ExampleTest::TestFunc1); caller->addThread("Thread2", &ExampleTest::TestFunc1); caller->addThread("Thread3", &ExampleTest::TestFunc1); suite->addTest(caller); // And some single threaded ones - suite->addTest(new CppUnit::TestCaller("SingleThreaded Test #1", &ExampleTest::TestFunc1)); - suite->addTest(new CppUnit::TestCaller("SingleThreaded Test #2", &ExampleTest::TestFunc2)); + suite->addTest(new CppUnit::TestCaller("ExampleTests::SingleThreaded Test #1", &ExampleTest::TestFunc1)); + suite->addTest(new CppUnit::TestCaller("ExampleTests::SingleThreaded Test #2", &ExampleTest::TestFunc2)); return suite; } @@ -48,10 +48,10 @@ ExampleTest::TestFunc1() { // Get the lock and do our business NextSubTest(); fLocker->Lock(); -// printf("TestFunc1() -- %d + 10 = %d\n", fNum, fNum+10); fNum += 10; fLocker->Unlock(); snooze(sleeptime); +// Outputf("(1:%d)", i); } } @@ -61,10 +61,10 @@ ExampleTest::TestFunc2() { // Get the lock and do our business NextSubTest(); fLocker->Lock(); -// printf("TestFunc2() -- %d * 2 = %d\n", fNum, fNum*2); fNum *= 2; fLocker->Unlock(); snooze(sleeptime); +// Outputf("(2:%d)", i); } } @@ -74,10 +74,10 @@ ExampleTest::TestFunc3() { // Get the lock and do our business NextSubTest(); fLocker->Lock(); -// printf("TestFunc3() -- %d - 5 = %d\n", fNum, fNum-5); fNum += 10; fLocker->Unlock(); snooze(sleeptime); +// Outputf("(3:%d)", i); } } diff --git a/src/tests/ExampleTest.h b/src/tests/ExampleTest.h index 6c22060188..059ad22f90 100644 --- a/src/tests/ExampleTest.h +++ b/src/tests/ExampleTest.h @@ -9,7 +9,7 @@ public: ExampleTest(std::string name = ""); virtual ~ExampleTest() { delete fLocker; } - static Test* Suite(); + static CppUnit::Test* Suite(); void TestFunc1(); // num += 10 void TestFunc2(); // num *= 2 diff --git a/src/tests/ExampleTestAddon.cpp b/src/tests/ExampleTestAddon.cpp index 87711e491f..21667a51a2 100644 --- a/src/tests/ExampleTestAddon.cpp +++ b/src/tests/ExampleTestAddon.cpp @@ -3,7 +3,7 @@ #include BTestSuite* getTestSuite() { - BTestSuite *suite = new BTestSuite("Example"); - suite->addTest("BExample", ExampleTest::Suite()); + BTestSuite *suite = new BTestSuite("ExampleSuite"); + suite->addTest("ExampleTests", ExampleTest::Suite()); return suite; } diff --git a/src/tests/Jamfile b/src/tests/Jamfile index ac4d6b00c9..bbd3e7b851 100644 --- a/src/tests/Jamfile +++ b/src/tests/Jamfile @@ -1,4 +1,20 @@ SubDir OBOS_TOP src tests ; +CommonTestLib libexampletest.so + : ExampleTestAddon.cpp + ExampleTest.cpp + : be stdc++.r4 + : be stdc++.r4 + : +; + +UnitTest UnitTester + : UnitTester.cpp + : + : be stdc++.r4 +# : be stdc++.r4 + : +; + SubInclude OBOS_TOP src tests add-ons ; SubInclude OBOS_TOP src tests kits ; diff --git a/src/tests/UnitTester.cpp b/src/tests/UnitTester.cpp index f0b40cd3aa..8820c356fb 100644 --- a/src/tests/UnitTester.cpp +++ b/src/tests/UnitTester.cpp @@ -1,6 +1,5 @@ #include "UnitTester.h" #include -#include #include // ##### Include headers for statically linked tests here ##### @@ -15,15 +14,15 @@ int main(int argc, char *argv[]) { BTestShell::SetShell(&shell); // Load our dynamically linked tests - BDirectory libDir("./lib"); - int count = shell.LoadSuitesFrom(&libDir); - cout << "Loaded " << count << " suites" << endl; return shell.Run(argc, argv); } +const std::string UnitTesterShell::defaultLibDir = "./lib"; + UnitTesterShell::UnitTesterShell(const std::string &description, SyncObject *syncObject) : BTestShell(description, syncObject) + , doR5Tests(false) { } @@ -35,6 +34,7 @@ UnitTesterShell::PrintDescription(int argc, char *argv[]) { cout << "of testing and verifying the various kits, classes, functions," << endl; cout << "and the like that comprise OpenBeOS." << endl; +/* if (AppName.rfind("UnitTester_r5") != std::string::npos) { cout << endl; cout << "Judging by its name (UnitTester_r5), this copy was" << endl; @@ -45,5 +45,34 @@ UnitTesterShell::PrintDescription(int argc, char *argv[]) { cout << "Judging by its name (UnitTester), this copy was probably" << endl; cout << "linked against our own OpenBeOS implementations." << endl; } +*/ } +void +UnitTesterShell::PrintValidArguments() { + BTestShell::PrintValidArguments(); + cout << indent << "-obos Runs tests linked against our OpenBeOS libraries (*default*)" << endl; + cout << indent << "-r5 Runs tests linked against Be Inc.'s R5 libraries (instead" << endl; + cout << indent << " of our libraries) for the sake of comparison." << endl; +} + +bool +UnitTesterShell::ProcessArgument(std::string arg, int argc, char *argv[]) { + if (arg == "-r5") { + doR5Tests = true; + } else if (arg == "-obos") { + doR5Tests = false; + } else + return BTestShell::ProcessArgument(arg, argc, argv); + + return true; +} + +void +UnitTesterShell::LoadDynamicSuites() { + // Add the appropriate test lib path + fLibDirs.insert(defaultLibDir + (doR5Tests ? "_r5" : "")); + + // Load away + BTestShell::LoadDynamicSuites(); +} diff --git a/src/tests/UnitTester.h b/src/tests/UnitTester.h index 7e12c7e6c0..e387acb915 100644 --- a/src/tests/UnitTester.h +++ b/src/tests/UnitTester.h @@ -2,11 +2,18 @@ #define __testing_is_delightful_h__ #include +#include class UnitTesterShell : public BTestShell { public: UnitTesterShell(const std::string &description = "", SyncObject *syncObject = 0); +protected: + static const std::string defaultLibDir; + bool doR5Tests; virtual void PrintDescription(int argc, char *argv[]); + virtual void PrintValidArguments(); + virtual bool ProcessArgument(std::string arg, int argc, char *argv[]); + virtual void LoadDynamicSuites(); }; //extern UnitTesterShell shell; diff --git a/src/tests/kits/storage/BasicTest.cpp b/src/tests/kits/storage/BasicTest.cpp index 4803701fc8..8ab6c83ff6 100644 --- a/src/tests/kits/storage/BasicTest.cpp +++ b/src/tests/kits/storage/BasicTest.cpp @@ -23,7 +23,7 @@ count_available_fds() // constructor BasicTest::BasicTest() - : StorageKit::TestCase(), + : BTestCase(), fSubTestNumber(0), fAvailableFDs(0) { @@ -33,6 +33,7 @@ BasicTest::BasicTest() void BasicTest::setUp() { + BTestCase::setUp(); fAvailableFDs = count_available_fds(); SaveCWD(); fSubTestNumber = 0; @@ -43,32 +44,13 @@ void BasicTest::tearDown() { RestoreCWD(); - nextSubTestBlock(); int32 availableFDs = count_available_fds(); if (availableFDs != fAvailableFDs) { printf("WARNING: Number of available file descriptors has changed " "during test: %ld -> %ld\n", fAvailableFDs, availableFDs); fAvailableFDs = availableFDs; } -} - -// nextSubTest -void -BasicTest::nextSubTest() -{ - if (shell.BeVerbose()) { - printf("[%ld]", fSubTestNumber++); - fflush(stdout); - } -} - -// nextSubTestBlock -void -BasicTest::nextSubTestBlock() -{ - if (shell.BeVerbose()) - printf("\n"); - fSubTestNumber = 0; + BTestCase::tearDown(); } // execCommand diff --git a/src/tests/kits/storage/BasicTest.h b/src/tests/kits/storage/BasicTest.h index aa0844f88e..c783eba768 100644 --- a/src/tests/kits/storage/BasicTest.h +++ b/src/tests/kits/storage/BasicTest.h @@ -3,14 +3,13 @@ #ifndef __sk_basic_test_h__ #define __sk_basic_test_h__ +#include +#include +#include #include #include -#include - -#include "StorageKitTester.h" - -class BasicTest : public StorageKit::TestCase +class BasicTest : public BTestCase { public: BasicTest(); @@ -23,8 +22,8 @@ public: // helper functions - void nextSubTest(); - void nextSubTestBlock(); +// void nextSubTest(); +// void nextSubTestBlock(); static void execCommand(const string &command); @@ -110,7 +109,7 @@ public: fTestedNames.clear(); } - bool test(string name, bool dump = shell.BeVerbose()) + bool test(string name, bool dump = BTestShell::GlobalBeVerbose()) { bool result = (fUntestedNames.find(name) != fUntestedNames.end()); if (result) { diff --git a/src/tests/kits/storage/DirectoryTest.cpp b/src/tests/kits/storage/DirectoryTest.cpp index 14dffb2b0b..7d53b41d66 100644 --- a/src/tests/kits/storage/DirectoryTest.cpp +++ b/src/tests/kits/storage/DirectoryTest.cpp @@ -11,7 +11,6 @@ #include #include -#include "StorageKitTester.h" #include "DirectoryTest.h" // Suite @@ -111,46 +110,46 @@ DirectoryTest::InitTest1() const char *nonExistingSuper = nonExistingSuperDirname; const char *nonExistingRel = nonExistingRelDirname; // 1. default constructor - nextSubTest(); + NextSubTest(); { BDirectory dir; CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); } // 2. BDirectory(const char*) - nextSubTest(); + NextSubTest(); { BDirectory dir(existing); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BDirectory dir(nonExisting); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BDirectory dir((const char *)NULL); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory dir(""); // R5 returns B_ENTRY_NOT_FOUND instead of B_BAD_VALUE. CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BDirectory dir(existingFile); // R5 returns B_BAD_VALUE instead of B_NOT_A_DIRECTORY. CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory dir(tooLongEntryname); CPPUNIT_ASSERT( dir.InitCheck() == B_NAME_TOO_LONG ); } - nextSubTest(); + NextSubTest(); { BDirectory dir(fileDirname); // R5 returns B_ENTRY_NOT_FOUND instead of B_NOT_A_DIRECTORY. @@ -158,32 +157,32 @@ DirectoryTest::InitTest1() } // 3. BDirectory(const BEntry*) - nextSubTest(); + NextSubTest(); { BEntry entry(existing); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); BDirectory dir(&entry); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BEntry entry(nonExisting); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); BDirectory dir(&entry); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BDirectory dir((BEntry *)NULL); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BEntry entry; BDirectory dir(&entry); CPPUNIT_ASSERT( equals(dir.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) ); } - nextSubTest(); + NextSubTest(); { BEntry entry(existingFile); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -191,7 +190,7 @@ DirectoryTest::InitTest1() // R5 returns B_BAD_VALUE instead of B_NOT_A_DIRECTORY. CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BEntry entry(tooLongEntryname); // R5 returns E2BIG instead of B_NAME_TOO_LONG @@ -201,7 +200,7 @@ DirectoryTest::InitTest1() } // 4. BDirectory(const entry_ref*) - nextSubTest(); + NextSubTest(); { BEntry entry(existing); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -210,7 +209,7 @@ DirectoryTest::InitTest1() BDirectory dir(&ref); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BEntry entry(nonExisting); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -219,12 +218,12 @@ DirectoryTest::InitTest1() BDirectory dir(&ref); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BDirectory dir((entry_ref *)NULL); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BEntry entry(existingFile); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -236,7 +235,7 @@ DirectoryTest::InitTest1() } // 5. BDirectory(const node_ref*) - nextSubTest(); + NextSubTest(); { BNode node(existing); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); @@ -246,14 +245,14 @@ DirectoryTest::InitTest1() CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); } // R5: crashs, when passing a NULL node_ref. -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); { BDirectory dir((node_ref *)NULL); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } #endif - nextSubTest(); + NextSubTest(); { BNode node(existingFile); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); @@ -266,45 +265,45 @@ DirectoryTest::InitTest1() } // 6. BDirectory(const BDirectory*, const char*) - nextSubTest(); + NextSubTest(); { BDirectory pathDir(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BDirectory dir(&pathDir, existingRelSub); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BDirectory dir(&pathDir, existingSub); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(nonExistingSuper); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BDirectory dir(&pathDir, nonExistingRel); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BDirectory dir((BDirectory *)NULL, (const char *)NULL); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory dir((BDirectory *)NULL, existingSub); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BDirectory dir(&pathDir, (const char *)NULL); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); @@ -312,7 +311,7 @@ DirectoryTest::InitTest1() // This does not fail in R5, but inits the object to pathDir. CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(existingSuperFile); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); @@ -320,14 +319,14 @@ DirectoryTest::InitTest1() // R5 returns B_BAD_VALUE instead of B_NOT_A_DIRECTORY. CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(tooLongSuperEntryname); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BDirectory dir(&pathDir, tooLongRelEntryname); CPPUNIT_ASSERT( dir.InitCheck() == B_NAME_TOO_LONG ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(fileSuperDirname); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); @@ -352,71 +351,71 @@ DirectoryTest::InitTest2() const char *nonExistingRel = nonExistingRelDirname; BDirectory dir; // 2. SetTo(const char*) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); dir.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); dir.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo((const char *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); // R5 returns B_ENTRY_NOT_FOUND instead of B_BAD_VALUE. CPPUNIT_ASSERT( dir.SetTo("") == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); dir.Unset(); // - nextSubTest(); + NextSubTest(); // R5 returns B_BAD_VALUE instead of B_NOT_A_DIRECTORY. CPPUNIT_ASSERT( dir.SetTo(existingFile) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(tooLongEntryname) == B_NAME_TOO_LONG ); CPPUNIT_ASSERT( dir.InitCheck() == B_NAME_TOO_LONG ); dir.Unset(); // - nextSubTest(); + NextSubTest(); // R5 returns B_ENTRY_NOT_FOUND instead of B_NOT_A_DIRECTORY. CPPUNIT_ASSERT( dir.SetTo(fileDirname) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); dir.Unset(); // 3. BDirectory(const BEntry*) - nextSubTest(); + NextSubTest(); BEntry entry(existing); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.SetTo(&entry) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); dir.Unset(); // - nextSubTest(); + NextSubTest(); entry.SetTo(nonExisting); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.SetTo(&entry) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); dir.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo((BEntry *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); entry.Unset(); CPPUNIT_ASSERT( equals(dir.SetTo(&entry), B_BAD_ADDRESS, B_BAD_VALUE) ); CPPUNIT_ASSERT( equals(dir.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) ); dir.Unset(); // - nextSubTest(); + NextSubTest(); entry.SetTo(existingFile); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); // R5 returns B_BAD_VALUE instead of B_NOT_A_DIRECTORY. @@ -424,7 +423,7 @@ DirectoryTest::InitTest2() CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); entry.SetTo(tooLongEntryname); // R5 returns E2BIG instead of B_NAME_TOO_LONG CPPUNIT_ASSERT( equals(entry.InitCheck(), E2BIG, B_NAME_TOO_LONG) ); @@ -433,7 +432,7 @@ DirectoryTest::InitTest2() dir.Unset(); // 4. BDirectory(const entry_ref*) - nextSubTest(); + NextSubTest(); entry.SetTo(existing); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); entry_ref ref; @@ -442,7 +441,7 @@ DirectoryTest::InitTest2() CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); dir.Unset(); // - nextSubTest(); + NextSubTest(); entry.SetTo(nonExisting); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); @@ -450,12 +449,12 @@ DirectoryTest::InitTest2() CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); dir.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo((entry_ref *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); entry.SetTo(existingFile); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); @@ -465,7 +464,7 @@ DirectoryTest::InitTest2() dir.Unset(); // 5. BDirectory(const node_ref*) - nextSubTest(); + NextSubTest(); BNode node(existing); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); node_ref nref; @@ -475,14 +474,14 @@ DirectoryTest::InitTest2() dir.Unset(); // // R5: crashs, when passing a NULL node_ref. -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo((node_ref *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); #endif // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo(existingFile) == B_OK ); CPPUNIT_ASSERT( node.GetNodeRef(&nref) == B_OK ); // R5 returns B_BAD_VALUE instead of B_NOT_A_DIRECTORY. @@ -492,45 +491,45 @@ DirectoryTest::InitTest2() dir.Unset(); // 6. BDirectory(const BDirectory*, const char*) - nextSubTest(); + NextSubTest(); BDirectory pathDir(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.SetTo(&pathDir, existingRelSub) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); dir.Unset(); // - nextSubTest(); + NextSubTest(); pathDir.SetTo(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.SetTo(&pathDir, existingSub) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); pathDir.SetTo(nonExistingSuper); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.SetTo(&pathDir, nonExistingRel) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); dir.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo((BDirectory *)NULL, (const char *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo((BDirectory *)NULL, existingSub) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); pathDir.SetTo(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.SetTo(&pathDir, (const char *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); pathDir.SetTo(existing); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); // This does not fail in R5, but inits the object to pathDir. @@ -538,7 +537,7 @@ DirectoryTest::InitTest2() CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); dir.Unset(); // - nextSubTest(); + NextSubTest(); pathDir.SetTo(existingSuperFile); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); // R5 returns B_BAD_VALUE instead of B_NOT_A_DIRECTORY. @@ -546,7 +545,7 @@ DirectoryTest::InitTest2() CPPUNIT_ASSERT( dir.InitCheck() == B_BAD_VALUE ); dir.Unset(); // - nextSubTest(); + NextSubTest(); pathDir.SetTo(tooLongSuperEntryname); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.SetTo(&pathDir, tooLongRelEntryname) @@ -554,7 +553,7 @@ DirectoryTest::InitTest2() CPPUNIT_ASSERT( dir.InitCheck() == B_NAME_TOO_LONG ); dir.Unset(); // - nextSubTest(); + NextSubTest(); pathDir.SetTo(fileSuperDirname); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); // R5 returns B_ENTRY_NOT_FOUND instead of B_NOT_A_DIRECTORY. @@ -570,7 +569,7 @@ DirectoryTest::GetEntryTest() const char *existing = existingDirname; const char *nonExisting = nonExistingDirname; // - nextSubTest(); + NextSubTest(); BDirectory dir; CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); BEntry entry; @@ -578,7 +577,7 @@ DirectoryTest::GetEntryTest() dir.Unset(); entry.Unset(); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.GetEntry(&entry) == B_OK ); @@ -586,9 +585,9 @@ DirectoryTest::GetEntryTest() dir.Unset(); entry.Unset(); // -#if !SK_TEST_R5 +#if !TEST_R5 // R5: crashs, when passing a NULL BEntry. - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.GetEntry((BEntry *)NULL) == B_BAD_VALUE ); @@ -596,7 +595,7 @@ DirectoryTest::GetEntryTest() entry.Unset(); #endif // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.GetEntry(&entry) == B_NO_INIT ); @@ -609,27 +608,27 @@ void DirectoryTest::IsRootTest() { // - nextSubTest(); + NextSubTest(); BDirectory dir; CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.IsRootDirectory() == false ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.IsRootDirectory() == true ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/boot/beos") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.IsRootDirectory() == false ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/tmp") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.IsRootDirectory() == false ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.IsRootDirectory() == true ); @@ -650,7 +649,7 @@ DirectoryTest::FindEntryTest() const char *badLink = badLinkname; const char *cyclicLink1 = cyclicLinkname1; // existing absolute path, uninitialized BDirectory - nextSubTest(); + NextSubTest(); BDirectory dir; BEntry entry; BPath path; @@ -663,7 +662,7 @@ DirectoryTest::FindEntryTest() entry.Unset(); path.Unset(); // existing absolute path, badly initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.FindEntry(existing, &entry) == B_OK ); @@ -674,7 +673,7 @@ DirectoryTest::FindEntryTest() entry.Unset(); path.Unset(); // existing path relative to current dir, uninitialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); chdir(existing); CPPUNIT_ASSERT( dir.FindEntry(existingRelSub, &entry) == B_OK ); @@ -687,7 +686,7 @@ DirectoryTest::FindEntryTest() chdir("/"); // existing path relative to current dir, // initialized BDirectory != current dir - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSub) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); chdir(existing); @@ -699,7 +698,7 @@ DirectoryTest::FindEntryTest() path.Unset(); chdir("/"); // abstract entry - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExistingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); chdir(existing); @@ -711,25 +710,25 @@ DirectoryTest::FindEntryTest() path.Unset(); chdir("/"); // bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); // R5: crashs, when passing a NULL BEntry. -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( dir.FindEntry(existingRelSub, NULL) == B_BAD_VALUE ); #endif CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK ); CPPUNIT_ASSERT( dir.FindEntry(NULL, &entry) == B_BAD_VALUE ); CPPUNIT_ASSERT( equals(entry.InitCheck(), B_BAD_VALUE, B_NO_INIT) ); // R5: crashs, when passing a NULL BEntry. -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( dir.FindEntry(NULL, NULL) == B_BAD_VALUE ); #endif dir.Unset(); entry.Unset(); path.Unset(); // don't traverse a valid link - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.FindEntry(dirLink, &entry) == B_OK ); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -739,7 +738,7 @@ DirectoryTest::FindEntryTest() entry.Unset(); path.Unset(); // traverse a valid link - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.FindEntry(dirLink, &entry, true) == B_OK ); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -749,7 +748,7 @@ DirectoryTest::FindEntryTest() entry.Unset(); path.Unset(); // don't traverse an invalid link - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.FindEntry(badLink, &entry) == B_OK ); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -759,7 +758,7 @@ DirectoryTest::FindEntryTest() entry.Unset(); path.Unset(); // traverse an invalid link - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.FindEntry(badLink, &entry, true) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( equals(entry.InitCheck(), B_ENTRY_NOT_FOUND, B_NO_INIT) ); @@ -767,7 +766,7 @@ DirectoryTest::FindEntryTest() entry.Unset(); path.Unset(); // don't traverse a cyclic link - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.FindEntry(cyclicLink1, &entry) == B_OK ); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -777,7 +776,7 @@ DirectoryTest::FindEntryTest() entry.Unset(); path.Unset(); // traverse a cyclic link - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.FindEntry(cyclicLink1, &entry, true) == B_LINK_LIMIT ); CPPUNIT_ASSERT( entry.InitCheck() == B_LINK_LIMIT ); @@ -802,109 +801,109 @@ DirectoryTest::ContainsTest() const char *dirSuperLink = dirSuperLinkname; // 1. Contains(const char *, int32) // existing entry, initialized BDirectory - nextSubTest(); + NextSubTest(); BDirectory dir(existing); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existingSub) == true ); dir.Unset(); // existing entry, uninitialized BDirectory // R5 returns true! - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.Contains(existing) == true ); dir.Unset(); // non-existing entry, uninitialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.Contains(nonExisting) == false ); dir.Unset(); // existing entry, badly initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.Contains(existing) == true ); dir.Unset(); // non-existing entry, badly initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.Contains(nonExisting) == false ); dir.Unset(); // initialized BDirectory, bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains((const char*)NULL) == true ); dir.Unset(); // uninitialized BDirectory, bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.Contains((const char*)NULL) == false ); dir.Unset(); // existing entry (second level, absolute path), initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existingSub) == true ); dir.Unset(); // existing entry (second level, name only), initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existingRelSub) == false ); dir.Unset(); // initialized BDirectory, self containing - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existing) == true ); dir.Unset(); // existing entry (dir), initialized BDirectory, matching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existing, B_DIRECTORY_NODE) == true ); dir.Unset(); // existing entry (dir), initialized BDirectory, mismatching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existing, B_FILE_NODE) == false ); dir.Unset(); // existing entry (file), initialized BDirectory, matching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuperFile) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existingFile, B_FILE_NODE) == true ); dir.Unset(); // existing entry (file), initialized BDirectory, mismatching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuperFile) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existingFile, B_SYMLINK_NODE) == false ); dir.Unset(); // existing entry (link), initialized BDirectory, matching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(dirSuperLink) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(dirLink, B_SYMLINK_NODE) == true ); dir.Unset(); // existing entry (link), initialized BDirectory, mismatching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(dirSuperLink) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(dirLink, B_DIRECTORY_NODE) == false ); dir.Unset(); // existing entry (relative path), initialized BDirectory, // matching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuperFile) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existingRelFile, B_FILE_NODE) == true ); dir.Unset(); // existing entry (relative path), initialized BDirectory, // mismatching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuperFile) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains(existingRelFile, B_SYMLINK_NODE) == false ); @@ -912,7 +911,7 @@ DirectoryTest::ContainsTest() // 2. Contains(const BEntry *, int32) // existing entry, initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); BEntry entry(existingSub); @@ -922,14 +921,14 @@ DirectoryTest::ContainsTest() // existing entry, uninitialized BDirectory // R5: unlike the other version, this one returns false // OBOS: both versions return true - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( entry.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( equals(dir.Contains(&entry), false, true) ); dir.Unset(); entry.Unset(); // non-existing entry, uninitialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK); CPPUNIT_ASSERT( dir.Contains(&entry) == false ); @@ -938,7 +937,7 @@ DirectoryTest::ContainsTest() // existing entry, badly initialized BDirectory // R5: unlike the other version, this one returns false // OBOS: both versions return true - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( entry.SetTo(existing) == B_OK); @@ -946,7 +945,7 @@ DirectoryTest::ContainsTest() dir.Unset(); entry.Unset(); // non-existing entry, badly initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK); @@ -955,20 +954,20 @@ DirectoryTest::ContainsTest() entry.Unset(); // initialized BDirectory, bad args // R5 crashs, when passing a NULL BEntry -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.Contains((const BEntry*)NULL) == false ); dir.Unset(); #endif // uninitialized BDirectory, bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( dir.Contains((const BEntry*)NULL) == false ); dir.Unset(); // existing entry (second level, absolute path), initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(existingSub) == B_OK); @@ -978,7 +977,7 @@ DirectoryTest::ContainsTest() // initialized BDirectory, self containing // R5: behavior is different from Contains(const char*) // OBOS: both versions return true - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(existing) == B_OK); @@ -986,7 +985,7 @@ DirectoryTest::ContainsTest() dir.Unset(); entry.Unset(); // existing entry (dir), initialized BDirectory, matching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(existing) == B_OK); @@ -994,7 +993,7 @@ DirectoryTest::ContainsTest() dir.Unset(); entry.Unset(); // existing entry (dir), initialized BDirectory, mismatching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(existing) == B_OK); @@ -1003,8 +1002,8 @@ DirectoryTest::ContainsTest() entry.Unset(); // existing entry (file), initialized BDirectory, matching node kind // R5 bug: returns false -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuperFile) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK); @@ -1013,7 +1012,7 @@ DirectoryTest::ContainsTest() entry.Unset(); #endif // existing entry (file), initialized BDirectory, mismatching node kind - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuperFile) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK); @@ -1022,8 +1021,8 @@ DirectoryTest::ContainsTest() entry.Unset(); // existing entry (link), initialized BDirectory, matching node kind // R5 bug: returns false -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(dirSuperLink) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(dirLink) == B_OK); @@ -1033,8 +1032,8 @@ DirectoryTest::ContainsTest() #endif // existing entry (link), initialized BDirectory, mismatching node kind // R5 bug: returns true -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(dirSuperLink) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( entry.SetTo(dirLink) == B_OK); @@ -1053,7 +1052,7 @@ DirectoryTest::GetStatForTest() const char *existingRel = existingRelDirname; const char *nonExisting = nonExistingDirname; // uninitialized dir, existing entry, absolute path - nextSubTest(); + NextSubTest(); BDirectory dir; BEntry entry; struct stat stat1, stat2; @@ -1064,7 +1063,7 @@ DirectoryTest::GetStatForTest() dir.Unset(); entry.Unset(); // badly initialized dir, existing entry, absolute path - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND ); memset(&stat1, 0, sizeof(struct stat)); @@ -1073,7 +1072,7 @@ DirectoryTest::GetStatForTest() dir.Unset(); entry.Unset(); // initialized dir, existing entry, absolute path - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); memset(&stat1, 0, sizeof(struct stat)); @@ -1085,7 +1084,7 @@ DirectoryTest::GetStatForTest() dir.Unset(); entry.Unset(); // initialized dir, existing entry, relative path - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(existingSuper) == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); memset(&stat1, 0, sizeof(struct stat)); @@ -1097,7 +1096,7 @@ DirectoryTest::GetStatForTest() dir.Unset(); entry.Unset(); // initialized dir, non-existing entry, absolute path - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); memset(&stat1, 0, sizeof(struct stat)); @@ -1107,7 +1106,7 @@ DirectoryTest::GetStatForTest() entry.Unset(); // initialized dir, bad args (NULL path) // R5 returns B_OK and the stat structure for the directory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); memset(&stat1, 0, sizeof(struct stat)); @@ -1120,7 +1119,7 @@ DirectoryTest::GetStatForTest() entry.Unset(); // initialized dir, bad args (empty path) // R5 returns B_ENTRY_NOT_FOUND - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( dir.GetStatFor("", &stat1) == B_ENTRY_NOT_FOUND ); @@ -1128,7 +1127,7 @@ DirectoryTest::GetStatForTest() entry.Unset(); // initialized dir, bad args // R5 returns B_BAD_ADDRESS instead of B_BAD_VALUE - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/") == B_OK ); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); CPPUNIT_ASSERT( equals(dir.GetStatFor(existing, NULL), B_BAD_ADDRESS, @@ -1153,7 +1152,7 @@ DirectoryTest::EntryIterationTest() testSet.add("."); testSet.add(".."); // GetNextEntry - nextSubTest(); + NextSubTest(); BDirectory dir(testDir1); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); BEntry entry; @@ -1162,7 +1161,7 @@ DirectoryTest::EntryIterationTest() dir.Unset(); entry.Unset(); // GetNextRef - nextSubTest(); + NextSubTest(); entry_ref ref; CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); CPPUNIT_ASSERT( dir.GetNextRef(&ref) == B_ENTRY_NOT_FOUND ); @@ -1170,7 +1169,7 @@ DirectoryTest::EntryIterationTest() dir.Unset(); entry.Unset(); // GetNextDirents - nextSubTest(); + NextSubTest(); size_t bufSize = (sizeof(dirent) + B_FILE_NAME_LENGTH) * 10; char buffer[bufSize]; dirent *ents = (dirent *)buffer; @@ -1183,7 +1182,7 @@ DirectoryTest::EntryIterationTest() entry.Unset(); testSet.rewind(); // CountEntries - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); CPPUNIT_ASSERT( dir.CountEntries() == 0 ); dir.Unset(); @@ -1221,7 +1220,7 @@ DirectoryTest::EntryIterationTest() + dirPathName + entryName); testSet.add(entryName); // GetNextEntry - nextSubTest(); + NextSubTest(); testSet.test("."); testSet.test(".."); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); @@ -1237,7 +1236,7 @@ DirectoryTest::EntryIterationTest() entry.Unset(); testSet.rewind(); // GetNextRef - nextSubTest(); + NextSubTest(); testSet.test("."); testSet.test(".."); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); @@ -1249,7 +1248,7 @@ DirectoryTest::EntryIterationTest() entry.Unset(); testSet.rewind(); // GetNextDirents - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); while (dir.GetNextDirents(ents, bufSize, 1) == 1) CPPUNIT_ASSERT( testSet.test(ents->d_name) == true ); @@ -1259,7 +1258,7 @@ DirectoryTest::EntryIterationTest() entry.Unset(); testSet.rewind(); // CountEntries - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); CPPUNIT_ASSERT( dir.CountEntries() == 9 ); CPPUNIT_ASSERT( dir.GetNextRef(&ref) == B_OK ); @@ -1267,7 +1266,7 @@ DirectoryTest::EntryIterationTest() dir.Unset(); // 3. interleaving use of the different methods - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); while (dir.GetNextDirents(ents, bufSize, 1) == 1) { CPPUNIT_ASSERT( testSet.test(ents->d_name) == true ); @@ -1289,7 +1288,7 @@ DirectoryTest::EntryIterationTest() testSet.rewind(); // 4. uninitialized BDirectory - nextSubTest(); + NextSubTest(); dir.Unset(); // R5: unlike the others GetNextRef() returns B_NO_INIT CPPUNIT_ASSERT( dir.GetNextEntry(&entry) == B_FILE_ERROR ); @@ -1300,7 +1299,7 @@ DirectoryTest::EntryIterationTest() dir.Unset(); // 5. badly initialized BDirectory - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); // R5: unlike the others GetNextRef() returns B_NO_INIT CPPUNIT_ASSERT( dir.GetNextEntry(&entry) == B_FILE_ERROR ); @@ -1312,8 +1311,8 @@ DirectoryTest::EntryIterationTest() // 6. bad args // R5 crashs, when passing a NULL BEntry or entry_ref -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); CPPUNIT_ASSERT( dir.GetNextEntry(NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( dir.GetNextRef(NULL) == B_BAD_VALUE ); @@ -1323,7 +1322,7 @@ DirectoryTest::EntryIterationTest() #endif // 7. link traversation - nextSubTest(); + NextSubTest(); execCommand(string("rm -rf ") + testDir1); execCommand(string("mkdir ") + testDir1); entryName = ("link1"); @@ -1354,7 +1353,7 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); // CreateDirectory // dir doesn't already exist - nextSubTest(); + NextSubTest(); BDirectory subdir; string dirPathName(string(testDir1) + "/"); string entryName("subdir1"); @@ -1368,14 +1367,14 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( subdir.SetTo((dirPathName + entryName).c_str()) == B_OK ); subdir.Unset(); // dir does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), &subdir) == B_FILE_EXISTS ); CPPUNIT_ASSERT( subdir.InitCheck() == B_NO_INIT ); subdir.Unset(); // CreateFile // file doesn't already exist - nextSubTest(); + NextSubTest(); BFile file; entryName = "file1"; CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_OK ); @@ -1385,7 +1384,7 @@ DirectoryTest::EntryCreationTest() B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, don't fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, false) == B_OK ); CPPUNIT_ASSERT( file.InitCheck() == B_OK ); file.Unset(); @@ -1393,14 +1392,14 @@ DirectoryTest::EntryCreationTest() B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_FILE_EXISTS ); CPPUNIT_ASSERT( file.InitCheck() == B_NO_INIT ); file.Unset(); // CreateSymLink // link doesn't already exist - nextSubTest(); + NextSubTest(); BSymLink link; entryName = "link1"; CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) @@ -1410,7 +1409,7 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( link.SetTo((dirPathName + entryName).c_str()) == B_OK ); link.Unset(); // link does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) == B_FILE_EXISTS ); CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT ); @@ -1423,7 +1422,7 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( dir.SetTo(existing) == B_OK ); // CreateDirectory // dir doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "subdir1"; CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), &subdir) == B_OK ); CPPUNIT_ASSERT( subdir.InitCheck() == B_OK ); @@ -1434,14 +1433,14 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); subdir.Unset(); // dir does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), &subdir) == B_FILE_EXISTS ); CPPUNIT_ASSERT( subdir.InitCheck() == B_NO_INIT ); subdir.Unset(); // CreateFile // file doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "file1"; CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_OK ); CPPUNIT_ASSERT( file.InitCheck() == B_OK ); @@ -1449,21 +1448,21 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( file.SetTo(entryName.c_str(), B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, don't fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, false) == B_OK ); CPPUNIT_ASSERT( file.InitCheck() == B_OK ); file.Unset(); CPPUNIT_ASSERT( file.SetTo(entryName.c_str(), B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_FILE_EXISTS ); CPPUNIT_ASSERT( file.InitCheck() == B_NO_INIT ); file.Unset(); // CreateSymLink // link doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "link1"; CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) == B_OK ); @@ -1472,7 +1471,7 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( link.SetTo(entryName.c_str()) == B_OK ); link.Unset(); // link does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) == B_FILE_EXISTS ); CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT ); @@ -1485,7 +1484,7 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); // CreateDirectory // dir doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "subdir1"; CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), &subdir) == B_OK ); CPPUNIT_ASSERT( subdir.InitCheck() == B_OK ); @@ -1496,14 +1495,14 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); subdir.Unset(); // dir does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), &subdir) == B_FILE_EXISTS ); CPPUNIT_ASSERT( subdir.InitCheck() == B_NO_INIT ); subdir.Unset(); // CreateFile // file doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "file1"; CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_OK ); CPPUNIT_ASSERT( file.InitCheck() == B_OK ); @@ -1511,21 +1510,21 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( file.SetTo(entryName.c_str(), B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, don't fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, false) == B_OK ); CPPUNIT_ASSERT( file.InitCheck() == B_OK ); file.Unset(); CPPUNIT_ASSERT( file.SetTo(entryName.c_str(), B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_FILE_EXISTS ); CPPUNIT_ASSERT( file.InitCheck() == B_NO_INIT ); file.Unset(); // CreateSymLink // link doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "link1"; CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) == B_OK ); @@ -1534,7 +1533,7 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( link.SetTo(entryName.c_str()) == B_OK ); link.Unset(); // link does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) == B_FILE_EXISTS ); CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT ); @@ -1548,7 +1547,7 @@ DirectoryTest::EntryCreationTest() chdir(testDir1); // CreateDirectory // dir doesn't already exist - nextSubTest(); + NextSubTest(); entryName = "subdir1"; CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), &subdir) == B_OK ); CPPUNIT_ASSERT( subdir.InitCheck() == B_OK ); @@ -1559,14 +1558,14 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( subdir.SetTo((dirPathName + entryName).c_str()) == B_OK ); subdir.Unset(); // dir does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), &subdir) == B_FILE_EXISTS ); CPPUNIT_ASSERT( subdir.InitCheck() == B_NO_INIT ); subdir.Unset(); // CreateFile // file doesn't already exist - nextSubTest(); + NextSubTest(); entryName = "file1"; CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_OK ); CPPUNIT_ASSERT( file.InitCheck() == B_OK ); @@ -1575,7 +1574,7 @@ DirectoryTest::EntryCreationTest() B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, don't fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, false) == B_OK ); CPPUNIT_ASSERT( file.InitCheck() == B_OK ); file.Unset(); @@ -1583,14 +1582,14 @@ DirectoryTest::EntryCreationTest() B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), &file, true) == B_FILE_EXISTS ); CPPUNIT_ASSERT( file.InitCheck() == B_NO_INIT ); file.Unset(); // CreateSymLink // link doesn't already exist - nextSubTest(); + NextSubTest(); entryName = "link1"; CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) == B_OK ); @@ -1599,7 +1598,7 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( link.SetTo((dirPathName + entryName).c_str()) == B_OK ); link.Unset(); // link does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, &link) == B_FILE_EXISTS ); CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT ); @@ -1612,7 +1611,7 @@ DirectoryTest::EntryCreationTest() execCommand(string("mkdir ") + testDir1); CPPUNIT_ASSERT( dir.SetTo(testDir1) == B_OK ); // CreateDirectory - nextSubTest(); + NextSubTest(); entryName = "subdir1"; CPPUNIT_ASSERT( equals(dir.CreateDirectory(NULL, &subdir), B_BAD_ADDRESS, B_BAD_VALUE) ); @@ -1621,14 +1620,14 @@ DirectoryTest::EntryCreationTest() // CreateFile // R5: unlike CreateDirectory/SymLink() CreateFile() returns // B_ENTRY_NOT_FOUND - nextSubTest(); + NextSubTest(); entryName = "file1"; CPPUNIT_ASSERT( equals(dir.CreateFile(NULL, &file), B_ENTRY_NOT_FOUND, B_BAD_VALUE) ); CPPUNIT_ASSERT( file.InitCheck() == B_NO_INIT ); file.Unset(); // CreateSymLink - nextSubTest(); + NextSubTest(); entryName = "link1"; CPPUNIT_ASSERT( equals(dir.CreateSymLink(NULL, existingFile, &link), B_BAD_ADDRESS, B_BAD_VALUE) ); @@ -1645,42 +1644,42 @@ DirectoryTest::EntryCreationTest() CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); // CreateDirectory // dir doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "subdir1"; CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), NULL) == B_OK ); CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); subdir.Unset(); // dir does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateDirectory(entryName.c_str(), NULL) == B_FILE_EXISTS ); subdir.Unset(); // CreateFile // file doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "file1"; CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), NULL, true) == B_OK ); CPPUNIT_ASSERT( file.SetTo(entryName.c_str(), B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, don't fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), NULL, false) == B_OK ); CPPUNIT_ASSERT( file.SetTo(entryName.c_str(), B_READ_ONLY) == B_OK ); file.Unset(); // file does already exist, fail - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateFile(entryName.c_str(), NULL, true) == B_FILE_EXISTS ); // CreateSymLink // link doesn't already exist - nextSubTest(); + NextSubTest(); entryName = dirPathName + "link1"; CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, NULL) == B_OK ); CPPUNIT_ASSERT( link.SetTo(entryName.c_str()) == B_OK ); link.Unset(); // link does already exist - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.CreateSymLink(entryName.c_str(), existingFile, NULL) == B_FILE_EXISTS ); } @@ -1692,7 +1691,7 @@ DirectoryTest::AssignmentTest() const char *existing = existingDirname; // 1. copy constructor // uninitialized - nextSubTest(); + NextSubTest(); { BDirectory dir; CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); @@ -1701,7 +1700,7 @@ DirectoryTest::AssignmentTest() CPPUNIT_ASSERT( equals(dir2.InitCheck(), B_BAD_VALUE, B_NO_INIT) ); } // existing dir - nextSubTest(); + NextSubTest(); { BDirectory dir(existing); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); @@ -1711,7 +1710,7 @@ DirectoryTest::AssignmentTest() // 2. assignment operator // uninitialized - nextSubTest(); + NextSubTest(); { BDirectory dir; BDirectory dir2; @@ -1719,7 +1718,7 @@ DirectoryTest::AssignmentTest() // R5 returns B_BAD_VALUE instead of B_NO_INIT CPPUNIT_ASSERT( equals(dir2.InitCheck(), B_BAD_VALUE, B_NO_INIT) ); } - nextSubTest(); + NextSubTest(); { BDirectory dir; BDirectory dir2(existing); @@ -1729,7 +1728,7 @@ DirectoryTest::AssignmentTest() CPPUNIT_ASSERT( equals(dir2.InitCheck(), B_BAD_VALUE, B_NO_INIT) ); } // existing dir - nextSubTest(); + NextSubTest(); { BDirectory dir(existing); CPPUNIT_ASSERT( dir.InitCheck() == B_OK ); @@ -1750,7 +1749,7 @@ DirectoryTest::CreateDirectoryTest() // 1. absolute path execCommand(string("mkdir ") + testDir1); // two levels - nextSubTest(); + NextSubTest(); string dirPathName(string(testDir1) + "/"); string entryName(dirPathName + "subdir1/subdir1.1"); CPPUNIT_ASSERT( create_directory(entryName.c_str(), 0x1ff) == B_OK ); @@ -1758,13 +1757,13 @@ DirectoryTest::CreateDirectoryTest() CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); subdir.Unset(); // one level - nextSubTest(); + NextSubTest(); entryName = dirPathName + "subdir2"; CPPUNIT_ASSERT( create_directory(entryName.c_str(), 0x1ff) == B_OK ); CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); subdir.Unset(); // existing dir - nextSubTest(); + NextSubTest(); entryName = dirPathName; CPPUNIT_ASSERT( create_directory(entryName.c_str(), 0x1ff) == B_OK ); CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); @@ -1775,19 +1774,19 @@ DirectoryTest::CreateDirectoryTest() execCommand(string("mkdir ") + testDir1); chdir(testDir1); // two levels - nextSubTest(); + NextSubTest(); entryName = "subdir1/subdir1.1"; CPPUNIT_ASSERT( create_directory(entryName.c_str(), 0x1ff) == B_OK ); CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); subdir.Unset(); // one level - nextSubTest(); + NextSubTest(); entryName = "subdir2"; CPPUNIT_ASSERT( create_directory(entryName.c_str(), 0x1ff) == B_OK ); CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); subdir.Unset(); // existing dir - nextSubTest(); + NextSubTest(); entryName = "."; CPPUNIT_ASSERT( create_directory(entryName.c_str(), 0x1ff) == B_OK ); CPPUNIT_ASSERT( subdir.SetTo(entryName.c_str()) == B_OK ); @@ -1796,14 +1795,14 @@ DirectoryTest::CreateDirectoryTest() // 3. error cases // existing file/link - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( equals(create_directory(existingFile, 0x1ff), B_BAD_VALUE, B_NOT_A_DIRECTORY) ); CPPUNIT_ASSERT( equals(create_directory(fileLink, 0x1ff), B_BAD_VALUE, B_NOT_A_DIRECTORY) ); CPPUNIT_ASSERT( create_directory(dirLink, 0x1ff) == B_OK ); // bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( create_directory(NULL, 0x1ff) == B_BAD_VALUE ); } diff --git a/src/tests/kits/storage/Jamfile b/src/tests/kits/storage/Jamfile index ee88fc7e61..2f5a02b73c 100644 --- a/src/tests/kits/storage/Jamfile +++ b/src/tests/kits/storage/Jamfile @@ -1,27 +1,25 @@ SubDir OBOS_TOP src tests kits storage ; -# Exclude the whole thing until it compiles again. -if "" -{ +# EntryTest.cpp +# FileTest.cpp +# FindDirectoryTest.cpp +# MimeTypeTest.cpp +# PathTest.cpp +# QueryTest.cpp +# ResourcesTest.cpp +# ResourceStringsTest.cpp +# StatableTest.cpp +# SymLinkTest.cpp +# TestApp.cpp -CommonUnitTest StorageKitTester - : StorageKitTester.cpp +CommonTestLib libstoragetest.so + : StorageKitTestAddon.cpp BasicTest.cpp DirectoryTest.cpp - EntryTest.cpp - FileTest.cpp - FindDirectoryTest.cpp - MimeTypeTest.cpp NodeTest.cpp PathTest.cpp - QueryTest.cpp - ResourcesTest.cpp - ResourceStringsTest.cpp StatableTest.cpp - SymLinkTest.cpp - TestApp.cpp TestUtils.cpp - : kits storage : libstorage.so be stdc++.r4 : be stdc++.r4 : storage @@ -29,21 +27,20 @@ CommonUnitTest StorageKitTester # To run the tests the libraries must be around. { - local libdir = [ on StorageKitTester FDirName $(LOCATE[1]) lib ] ; + local libdir = [ on UnitTester FDirName $(LOCATE[1]) lib ] ; MakeLocate <$(SOURCE_GRIST)>libstorage.so : $(libdir) ; MakeLocate <$(SOURCE_GRIST)>libbeadapter.so : $(libdir) ; RelSymLink <$(SOURCE_GRIST)>libstorage.so : libstorage.so ; RelSymLink <$(SOURCE_GRIST)>libbeadapter.so : libbeadapter.so ; - DEPENDS StorageKitTester StorageKitTester_r5 + DEPENDS libstoragetest.so : <$(SOURCE_GRIST)>libstorage.so <$(SOURCE_GRIST)>libbeadapter.so ; } # To run the tests some test files must be around. { local resdir = resources ; - MakeLocate $(resdir) : [ on StorageKitTester return $(LOCATE[1]) ] ; + MakeLocate $(resdir) : [ on libstoragetest.so return $(LOCATE[1]) ] ; RelSymLink $(resdir) : [ FDirName $(SUBDIR) resources ] ; - DEPENDS StorageKitTester StorageKitTester_r5 : $(resdir) ; + DEPENDS libstoragetest.so : $(resdir) ; } -} # if "" diff --git a/src/tests/kits/storage/NodeTest.cpp b/src/tests/kits/storage/NodeTest.cpp index 89885f49fb..0cd33a9a1d 100644 --- a/src/tests/kits/storage/NodeTest.cpp +++ b/src/tests/kits/storage/NodeTest.cpp @@ -41,7 +41,7 @@ NodeTest::Suite() { suite->addTest( new CppUnit::TestCaller("BNode::Attribute Directory Test", &NodeTest::AttrDirTest) ); suite->addTest( new CppUnit::TestCaller("BNode::Attribute Read/Write/Remove Test", &NodeTest::AttrTest) ); suite->addTest( new CppUnit::TestCaller("BNode::Attribute Rename Test" -#if SK_TEST_R5 +#if TEST_R5 " (NOTE: test not actually performed with R5 libraries)" #endif , &NodeTest::AttrRenameTest) ); @@ -52,7 +52,7 @@ NodeTest::Suite() { suite->addTest( new CppUnit::TestCaller("BNode::Equality Test", &NodeTest::EqualityTest) ); suite->addTest( new CppUnit::TestCaller("BNode::Assignment Test", &NodeTest::AssignmentTest) ); suite->addTest( new CppUnit::TestCaller("BNode::Lock Test" -#if SK_TEST_OBOS_POSIX +#if TEST_OBOS /* !!!POSIX ONLY!!! */ " (NOTE: test not actually performed with OpenBeOS Posix libraries)" #endif , &NodeTest::LockTest) ); @@ -202,76 +202,76 @@ NodeTest::InitTest1() const char *nonExistingSuper = nonExistingSuperDirname; const char *nonExistingRel = nonExistingRelDirname; // 1. default constructor - nextSubTest(); + NextSubTest(); { BNode node; CPPUNIT_ASSERT( node.InitCheck() == B_NO_INIT ); } // 2. BNode(const char*) - nextSubTest(); + NextSubTest(); { BNode node(fileLink); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BNode node(nonExisting); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BNode node((const char *)NULL); CPPUNIT_ASSERT( equals(node.InitCheck(), B_BAD_VALUE, B_NO_INIT) ); } - nextSubTest(); + NextSubTest(); { BNode node(""); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BNode node(existingFile); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BNode node(existingDir); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BNode node(tooLongEntryname); CPPUNIT_ASSERT( node.InitCheck() == B_NAME_TOO_LONG ); } // 3. BNode(const BEntry*) - nextSubTest(); + NextSubTest(); { BEntry entry(dirLink); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); BNode node(&entry); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BEntry entry(nonExisting); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); BNode node(&entry); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BNode node((BEntry *)NULL); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BEntry entry; BNode node(&entry); CPPUNIT_ASSERT( equals(node.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) ); } - nextSubTest(); + NextSubTest(); { BEntry entry(existingFile); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -279,7 +279,7 @@ NodeTest::InitTest1() CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BEntry entry(existingDir); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -287,7 +287,7 @@ NodeTest::InitTest1() CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BEntry entry(tooLongEntryname); // R5 returns E2BIG instead of B_NAME_TOO_LONG @@ -297,7 +297,7 @@ NodeTest::InitTest1() } // 4. BNode(const entry_ref*) - nextSubTest(); + NextSubTest(); { BEntry entry(dirLink); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -306,7 +306,7 @@ NodeTest::InitTest1() BNode node(&ref); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BEntry entry(nonExisting); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -315,12 +315,12 @@ NodeTest::InitTest1() BNode node(&ref); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BNode node((entry_ref *)NULL); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BEntry entry(existingFile); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -329,7 +329,7 @@ NodeTest::InitTest1() BNode node(&ref); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BEntry entry(existingDir); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); @@ -340,73 +340,73 @@ NodeTest::InitTest1() } // 5. BNode(const BDirectory*, const char*) - nextSubTest(); + NextSubTest(); { BDirectory pathDir(dirSuperLink); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, dirRelLink); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(dirSuperLink); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, dirLink); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(nonExistingSuper); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, nonExistingRel); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); } - nextSubTest(); + NextSubTest(); { BNode node((BDirectory *)NULL, (const char *)NULL); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BNode node((BDirectory *)NULL, dirLink); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(dirSuperLink); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, (const char *)NULL); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(dirSuperLink); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, ""); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(existingSuperFile); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, existingRelFile); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(existingSuperDir); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, existingRelDir); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(tooLongSuperEntryname); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); BNode node(&pathDir, tooLongRelEntryname); CPPUNIT_ASSERT( node.InitCheck() == B_NAME_TOO_LONG ); } - nextSubTest(); + NextSubTest(); { BDirectory pathDir(fileSuperDirname); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); @@ -434,155 +434,155 @@ NodeTest::InitTest2() const char *nonExistingRel = nonExistingRelDirname; BNode node; // 2. BNode(const char*) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo(fileLink) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo(nonExisting) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( equals(node.SetTo((const char *)NULL), B_BAD_VALUE, B_NO_INIT) ); CPPUNIT_ASSERT( equals(node.InitCheck(), B_BAD_VALUE, B_NO_INIT) ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo("") == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo(existingFile) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo(existingDir) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo(tooLongEntryname) == B_NAME_TOO_LONG ); CPPUNIT_ASSERT( node.InitCheck() == B_NAME_TOO_LONG ); // 3. BNode(const BEntry*) - nextSubTest(); + NextSubTest(); BEntry entry(dirLink); CPPUNIT_ASSERT( entry.InitCheck() == B_OK ); CPPUNIT_ASSERT( node.SetTo(&entry) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&entry) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo((BEntry *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); // - nextSubTest(); + NextSubTest(); entry.Unset(); CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( equals(node.SetTo(&entry), B_BAD_ADDRESS, B_BAD_VALUE) ); CPPUNIT_ASSERT( equals(node.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&entry) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&entry) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); // R5 returns E2BIG instead of B_NAME_TOO_LONG CPPUNIT_ASSERT( equals(entry.SetTo(tooLongEntryname), E2BIG, B_NAME_TOO_LONG) ); CPPUNIT_ASSERT( equals(node.SetTo(&entry), B_BAD_ADDRESS, B_BAD_VALUE) ); CPPUNIT_ASSERT( equals(node.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) ); // 4. BNode(const entry_ref*) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo(dirLink) == B_OK ); entry_ref ref; CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&ref) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&ref) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo((entry_ref *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&ref) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&ref) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // 5. BNode(const BDirectory*, const char*) - nextSubTest(); + NextSubTest(); BDirectory pathDir(dirSuperLink); CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, dirRelLink) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, dirLink) == B_BAD_VALUE ); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(nonExistingSuper) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, nonExistingRel) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo((BDirectory *)NULL, (const char *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( node.SetTo((BDirectory *)NULL, dirLink) == B_BAD_VALUE ); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, (const char *)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( node.InitCheck() == B_BAD_VALUE ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, "") == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(existingSuperFile) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, existingRelFile) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(existingSuperDir) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, existingRelDir) == B_OK ); CPPUNIT_ASSERT( node.InitCheck() == B_OK ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(tooLongSuperEntryname) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, tooLongRelEntryname) == B_NAME_TOO_LONG ); CPPUNIT_ASSERT( node.InitCheck() == B_NAME_TOO_LONG ); // - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( pathDir.SetTo(fileSuperDirname) == B_OK ); CPPUNIT_ASSERT( node.SetTo(&pathDir, fileRelDirname) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( node.InitCheck() == B_ENTRY_NOT_FOUND ); @@ -645,7 +645,7 @@ NodeTest::AttrDirTest(BNode &node) CPPUNIT_ASSERT( node.RewindAttrs() == B_OK ); testSet.rewind(); // R5: crashs, if passing a NULL buffer -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( node.GetNextAttrName(NULL) == B_BAD_VALUE ); #endif } @@ -655,7 +655,7 @@ void NodeTest::AttrDirTest() { // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -667,7 +667,7 @@ NodeTest::AttrDirTest() } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { AttrDirTest(*node); @@ -760,7 +760,7 @@ void NodeTest::AttrTest() { // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -775,7 +775,7 @@ NodeTest::AttrTest() } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { AttrTest(*node); @@ -787,7 +787,7 @@ NodeTest::AttrTest() void NodeTest::AttrRenameTest(BNode &node) { -#if !SK_TEST_R5 +#if !TEST_R5 const char attr1[] = "StorageKit::SomeAttribute"; const char attr2[] = "StorageKit::AnotherAttribute"; const char str[] = "This is my testing string and it rules your world."; @@ -837,7 +837,7 @@ void NodeTest::AttrRenameTest() { // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -847,7 +847,7 @@ NodeTest::AttrRenameTest() } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { AttrRenameTest(*node); @@ -920,7 +920,7 @@ void NodeTest::AttrInfoTest() { // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -931,7 +931,7 @@ NodeTest::AttrInfoTest() } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { AttrInfoTest(*node); @@ -985,7 +985,7 @@ NodeTest::AttrBStringTest(BNode &node) BString readValue; BString writeValue("test"); // R5: crashes, if supplying a NULL BString -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( node.WriteAttrString(attrNames[0], NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( node.ReadAttrString(attrNames[0], NULL) == B_BAD_VALUE ); #endif @@ -993,7 +993,7 @@ NodeTest::AttrBStringTest(BNode &node) B_BAD_ADDRESS, B_BAD_VALUE) ); CPPUNIT_ASSERT( equals(node.ReadAttrString(NULL, &readValue), B_BAD_ADDRESS, B_BAD_VALUE) ); -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( node.WriteAttrString(NULL, NULL) == B_BAD_VALUE ); #endif CPPUNIT_ASSERT( equals(node.ReadAttrString(NULL, NULL), @@ -1021,7 +1021,7 @@ void NodeTest::AttrBStringTest() { // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -1035,7 +1035,7 @@ NodeTest::AttrBStringTest() } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { AttrBStringTest(*node); @@ -1051,7 +1051,7 @@ NodeTest::SyncTest() { const char str[] = "This string rules your world."; const int len = strlen(str) + 1; // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -1061,7 +1061,7 @@ NodeTest::SyncTest() { } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { CPPUNIT_ASSERT( node->WriteAttr(attr, B_STRING_TYPE, 0, str, len) @@ -1085,7 +1085,7 @@ void NodeTest::DupTest() { // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -1095,7 +1095,7 @@ NodeTest::DupTest() } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { DupTest(*node); @@ -1172,9 +1172,9 @@ NodeTest::LockTest(BNode &node, const char *entryName) void NodeTest::LockTest() { -#if !SK_TEST_OBOS_POSIX +#if !TEST_OBOS /* !!!POSIX ONLY!!! */ // uninitialized objects - nextSubTest(); + NextSubTest(); TestNodes testEntries; CreateUninitializedNodes(testEntries); BNode *node; @@ -1184,7 +1184,7 @@ NodeTest::LockTest() } testEntries.delete_all(); // existing entries - nextSubTest(); + NextSubTest(); CreateRWNodes(testEntries); for (testEntries.rewind(); testEntries.getNext(node, nodeName); ) { LockTest(*node, nodeName.c_str()); diff --git a/src/tests/kits/storage/PathTest.cpp b/src/tests/kits/storage/PathTest.cpp index 4b6817e96c..abe68f9af4 100644 --- a/src/tests/kits/storage/PathTest.cpp +++ b/src/tests/kits/storage/PathTest.cpp @@ -1,16 +1,16 @@ // PathTest.cpp - -#include -#include -#include - #include - +//#include "StorageKitTester.h" +#include +#include +#include #include #include #include #include -#include "StorageKitTester.h" +#include +#include +#include // Suite CppUnit::Test* @@ -52,7 +52,7 @@ void PathTest::InitTest1() { // 1. default constructor - nextSubTest(); + NextSubTest(); { BPath path; CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); @@ -61,7 +61,7 @@ PathTest::InitTest1() // 2. BPath(const char*, const char*, bool) // absolute existing path (root dir), no leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; BPath path(pathName); @@ -69,7 +69,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // absolute existing path, no leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; BPath path(pathName); @@ -77,7 +77,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // absolute non-existing path, no leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/doesn't/exist/but/who/cares"; BPath path(pathName); @@ -85,7 +85,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // absolute existing path (root dir), no leaf, auto normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/.///."; const char *normalizedPathName = "/"; @@ -94,7 +94,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(normalizedPathName) == path.Path() ); } // absolute existing path, no leaf, auto normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot/"; const char *normalizedPathName = "/boot"; @@ -103,7 +103,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(normalizedPathName) == path.Path() ); } // absolute non-existing path, no leaf, auto normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/doesn't/exist/but///who/cares"; BPath path(pathName); @@ -111,7 +111,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // absolute existing path (root dir), no leaf, normalization forced - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; BPath path(pathName, NULL, true); @@ -119,7 +119,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // absolute existing path, no leaf, normalization forced - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; BPath path(pathName, NULL, true); @@ -127,7 +127,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // absolute non-existing path, no leaf, normalization forced - nextSubTest(); + NextSubTest(); { const char *pathName = "/doesn't/exist/but/who/cares"; BPath path(pathName, NULL, true); @@ -136,7 +136,7 @@ PathTest::InitTest1() } // relative existing path, no leaf, no normalization needed, but done chdir("/"); - nextSubTest(); + NextSubTest(); { const char *pathName = "boot"; const char *absolutePathName = "/boot"; @@ -146,7 +146,7 @@ PathTest::InitTest1() } // relative non-existing path, no leaf, no normalization needed, but done chdir("/boot"); - nextSubTest(); + NextSubTest(); { const char *pathName = "doesn't/exist/but/who/cares"; BPath path(pathName); @@ -155,7 +155,7 @@ PathTest::InitTest1() } // relative existing path, no leaf, auto normalization chdir("/"); - nextSubTest(); + NextSubTest(); { const char *pathName = "boot/"; const char *normalizedPathName = "/boot"; @@ -165,7 +165,7 @@ PathTest::InitTest1() } // relative non-existing path, no leaf, auto normalization chdir("/boot"); - nextSubTest(); + NextSubTest(); { const char *pathName = "doesn't/exist/but///who/cares"; BPath path(pathName); @@ -174,7 +174,7 @@ PathTest::InitTest1() } // relative existing path, no leaf, normalization forced chdir("/"); - nextSubTest(); + NextSubTest(); { const char *pathName = "boot"; const char *absolutePathName = "/boot"; @@ -184,7 +184,7 @@ PathTest::InitTest1() } // relative non-existing path, no leaf, normalization forced chdir("/boot"); - nextSubTest(); + NextSubTest(); { const char *pathName = "doesn't/exist/but/who/cares"; BPath path(pathName, NULL, true); @@ -192,7 +192,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // absolute existing path (root dir), leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; const char *leafName = "boot"; @@ -202,7 +202,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // absolute existing path, leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; const char *leafName = "home/Desktop"; @@ -212,7 +212,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // absolute non-existing path, leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/doesn't/exist"; const char *leafName = "but/who/cares"; @@ -222,7 +222,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // absolute existing path (root dir), leaf, auto normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/.///"; const char *leafName = "."; @@ -232,7 +232,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // absolute existing path, leaf, auto normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; const char *leafName = "home/.."; @@ -242,7 +242,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // absolute non-existing path, leaf, auto normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/doesn't/exist"; const char *leafName = "but//who/cares"; @@ -251,7 +251,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // absolute non-existing path, leaf, normalization forced - nextSubTest(); + NextSubTest(); { const char *pathName = "/doesn't/exist"; const char *leafName = "but/who/cares"; @@ -261,7 +261,7 @@ PathTest::InitTest1() } // relative existing path, leaf, no normalization needed, but done chdir("/"); - nextSubTest(); + NextSubTest(); { const char *pathName = "boot"; const char *leafName = "home"; @@ -272,7 +272,7 @@ PathTest::InitTest1() } // relative non-existing path, leaf, no normalization needed, but done chdir("/boot"); - nextSubTest(); + NextSubTest(); { const char *pathName = "doesn't/exist"; const char *leafName = "but/who/cares"; @@ -282,7 +282,7 @@ PathTest::InitTest1() } // relative existing path, leaf, auto normalization chdir("/boot"); - nextSubTest(); + NextSubTest(); { const char *pathName = "home"; const char *leafName = "Desktop//"; @@ -292,7 +292,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(normalizedPathName) == path.Path() ); } // bad args (absolute lead) - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; const char *leafName = "/boot"; @@ -301,14 +301,14 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // bad args - nextSubTest(); + NextSubTest(); { BPath path((const char*)NULL, "test"); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); } // bad args - nextSubTest(); + NextSubTest(); { BPath path((const char*)NULL); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); @@ -317,7 +317,7 @@ PathTest::InitTest1() // 3. BPath(const BDirectory*, const char*, bool) // existing dir (root dir), no leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; BDirectory dir(pathName); @@ -326,7 +326,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // existing dir, no leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; BDirectory dir(pathName); @@ -335,7 +335,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // existing dir (root dir), no leaf, normalization forced - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; BDirectory dir(pathName); @@ -344,7 +344,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // existing dir, no leaf, normalization forced - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; BDirectory dir(pathName); @@ -353,7 +353,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // existing dir (root dir), leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; const char *leafName = "boot"; @@ -364,7 +364,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // existing dir, leaf, no normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; const char *leafName = "home/Desktop"; @@ -375,7 +375,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // existing dir, leaf, auto normalization - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; const char *leafName = "home/.."; @@ -386,7 +386,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); } // bad args (absolute leaf) - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; const char *leafName = "/boot"; @@ -396,7 +396,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // bad args (uninitialized dir) - nextSubTest(); + NextSubTest(); { BDirectory dir; BPath path(&dir, "test"); @@ -404,7 +404,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // bad args (badly initialized dir) - nextSubTest(); + NextSubTest(); { BDirectory dir("/this/dir/doesn't/exists"); BPath path(&dir, "test"); @@ -413,15 +413,15 @@ PathTest::InitTest1() } // bad args (NULL dir) // R5: crashs, when passing a NULL BDirectory -#if !SK_TEST_R5 - nextSubTest(); +#if !TEST_R5 + NextSubTest(); { BPath path((const BDirectory*)NULL, "test"); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); } // bad args (NULL dir) - nextSubTest(); + NextSubTest(); { BPath path((const BDirectory*)NULL, NULL); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); @@ -431,7 +431,7 @@ PathTest::InitTest1() // 4. BPath(const BEntry*) // existing entry (root dir) - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; BEntry entry(pathName); @@ -440,7 +440,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // existing entry - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; BEntry entry(pathName); @@ -449,7 +449,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // abstract entry - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot/shouldn't exist"; BEntry entry(pathName); @@ -458,7 +458,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // bad args (uninitialized BEntry) - nextSubTest(); + NextSubTest(); { BEntry entry; BPath path(&entry); @@ -466,7 +466,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // bad args (badly initialized BEntry) - nextSubTest(); + NextSubTest(); { BEntry entry("/this/doesn't/exist"); BPath path(&entry); @@ -474,7 +474,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( path.Path() == NULL ); } // bad args (NULL BEntry) - nextSubTest(); + NextSubTest(); { BPath path((const BEntry*)NULL); CPPUNIT_ASSERT( equals(path.InitCheck(), B_NO_INIT, B_BAD_VALUE) ); @@ -483,7 +483,7 @@ PathTest::InitTest1() // 5. BPath(const entry_ref*) // existing entry (root dir) - nextSubTest(); + NextSubTest(); { const char *pathName = "/"; BEntry entry(pathName); @@ -494,7 +494,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // existing entry - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot"; BEntry entry(pathName); @@ -505,7 +505,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // abstract entry - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot/shouldn't exist"; BEntry entry(pathName); @@ -516,7 +516,7 @@ PathTest::InitTest1() CPPUNIT_ASSERT( string(pathName) == path.Path() ); } // bad args (NULL entry_ref) - nextSubTest(); + NextSubTest(); { BPath path((const entry_ref*)NULL); CPPUNIT_ASSERT( equals(path.InitCheck(), B_NO_INIT, B_BAD_VALUE) ); @@ -539,28 +539,28 @@ PathTest::InitTest2() // 2. SetTo(const char*, const char*, bool) // absolute existing path (root dir), no leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.InitCheck() == B_OK ); CPPUNIT_ASSERT( string(pathName) == path.Path() ); path.Unset(); // absolute existing path, no leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/boot"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.InitCheck() == B_OK ); CPPUNIT_ASSERT( string(pathName) == path.Path() ); path.Unset(); // absolute non-existing path, no leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/doesn't/exist/but/who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.InitCheck() == B_OK ); CPPUNIT_ASSERT( string(pathName) == path.Path() ); path.Unset(); // absolute existing path (root dir), no leaf, auto normalization - nextSubTest(); + NextSubTest(); pathName = "/.///."; normalizedPathName = "/"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_OK ); @@ -568,7 +568,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(normalizedPathName) == path.Path() ); path.Unset(); // absolute existing path, no leaf, auto normalization - nextSubTest(); + NextSubTest(); pathName = "/boot/"; normalizedPathName = "/boot"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_OK ); @@ -576,28 +576,28 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(normalizedPathName) == path.Path() ); path.Unset(); // absolute non-existing path, no leaf, auto normalization - nextSubTest(); + NextSubTest(); pathName = "/doesn't/exist/but///who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( path.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // absolute existing path (root dir), no leaf, normalization forced - nextSubTest(); + NextSubTest(); pathName = "/"; CPPUNIT_ASSERT( path.SetTo(pathName, NULL, true) == B_OK ); CPPUNIT_ASSERT( path.InitCheck() == B_OK ); CPPUNIT_ASSERT( string(pathName) == path.Path() ); path.Unset(); // absolute existing path, no leaf, normalization forced - nextSubTest(); + NextSubTest(); pathName = "/boot"; CPPUNIT_ASSERT( path.SetTo(pathName, NULL, true) == B_OK ); CPPUNIT_ASSERT( path.InitCheck() == B_OK ); CPPUNIT_ASSERT( string(pathName) == path.Path() ); path.Unset(); // absolute non-existing path, no leaf, normalization forced - nextSubTest(); + NextSubTest(); pathName = "/doesn't/exist/but/who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName, NULL, true) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( path.InitCheck() == B_ENTRY_NOT_FOUND ); @@ -605,7 +605,7 @@ PathTest::InitTest2() path.Unset(); // relative existing path, no leaf, no normalization needed, but done chdir("/"); - nextSubTest(); + NextSubTest(); pathName = "boot"; absolutePathName = "/boot"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_OK ); @@ -614,7 +614,7 @@ PathTest::InitTest2() path.Unset(); // relative non-existing path, no leaf, no normalization needed, but done chdir("/boot"); - nextSubTest(); + NextSubTest(); pathName = "doesn't/exist/but/who/cares"; absolutePathName = "/boot/doesn't/exist/but/who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_ENTRY_NOT_FOUND ); @@ -623,7 +623,7 @@ PathTest::InitTest2() path.Unset(); // relative existing path, no leaf, auto normalization chdir("/"); - nextSubTest(); + NextSubTest(); pathName = "boot/"; normalizedPathName = "/boot"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_OK ); @@ -632,7 +632,7 @@ PathTest::InitTest2() path.Unset(); // relative non-existing path, no leaf, auto normalization chdir("/boot"); - nextSubTest(); + NextSubTest(); pathName = "doesn't/exist/but///who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( path.InitCheck() == B_ENTRY_NOT_FOUND ); @@ -640,7 +640,7 @@ PathTest::InitTest2() path.Unset(); // relative existing path, no leaf, normalization forced chdir("/"); - nextSubTest(); + NextSubTest(); pathName = "boot"; absolutePathName = "/boot"; CPPUNIT_ASSERT( path.SetTo(pathName, NULL, true) == B_OK ); @@ -649,14 +649,14 @@ PathTest::InitTest2() path.Unset(); // relative non-existing path, no leaf, normalization forced chdir("/boot"); - nextSubTest(); + NextSubTest(); pathName = "doesn't/exist/but/who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName, NULL, true) == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( path.InitCheck() == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // absolute existing path (root dir), leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/"; leafName = "boot"; absolutePathName = "/boot"; @@ -665,7 +665,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); path.Unset(); // absolute existing path, leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/boot"; leafName = "home/Desktop"; absolutePathName = "/boot/home/Desktop"; @@ -674,7 +674,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); path.Unset(); // absolute non-existing path, leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/doesn't/exist"; leafName = "but/who/cares"; absolutePathName = "/doesn't/exist/but/who/cares"; @@ -683,7 +683,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); path.Unset(); // absolute existing path (root dir), leaf, auto normalization - nextSubTest(); + NextSubTest(); pathName = "/.///"; leafName = "."; absolutePathName = "/"; @@ -692,7 +692,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); path.Unset(); // absolute existing path, leaf, auto normalization - nextSubTest(); + NextSubTest(); pathName = "/boot"; leafName = "home/.."; absolutePathName = "/boot"; @@ -701,7 +701,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); path.Unset(); // absolute existing path, leaf, self assignment - nextSubTest(); + NextSubTest(); pathName = "/boot/home"; leafName = "home/Desktop"; absolutePathName = "/boot/home/Desktop"; @@ -714,7 +714,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(absolutePathName) == path.Path() ); path.Unset(); // absolute non-existing path, leaf, auto normalization - nextSubTest(); + NextSubTest(); pathName = "/doesn't/exist"; leafName = "but//who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName, leafName) == B_ENTRY_NOT_FOUND ); @@ -722,7 +722,7 @@ PathTest::InitTest2() CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // absolute non-existing path, leaf, normalization forced - nextSubTest(); + NextSubTest(); pathName = "/doesn't/exist"; leafName = "but/who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName, leafName, true) == B_ENTRY_NOT_FOUND ); @@ -731,7 +731,7 @@ PathTest::InitTest2() path.Unset(); // relative existing path, leaf, no normalization needed, but done chdir("/"); - nextSubTest(); + NextSubTest(); pathName = "boot"; leafName = "home"; absolutePathName = "/boot/home"; @@ -741,7 +741,7 @@ PathTest::InitTest2() path.Unset(); // relative non-existing path, leaf, no normalization needed, but done chdir("/boot"); - nextSubTest(); + NextSubTest(); pathName = "doesn't/exist"; leafName = "but/who/cares"; CPPUNIT_ASSERT( path.SetTo(pathName, leafName) == B_ENTRY_NOT_FOUND ); @@ -750,7 +750,7 @@ PathTest::InitTest2() path.Unset(); // relative existing path, leaf, auto normalization chdir("/boot"); - nextSubTest(); + NextSubTest(); pathName = "home"; leafName = "Desktop//"; normalizedPathName = "/boot/home/Desktop"; @@ -759,19 +759,19 @@ PathTest::InitTest2() CPPUNIT_ASSERT( string(normalizedPathName) == path.Path() ); path.Unset(); // bad args (absolute leaf) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/", "/boot") == B_BAD_VALUE ); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo((const char*)NULL, "test") == B_BAD_VALUE ); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo((const char*)NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); @@ -779,7 +779,7 @@ PathTest::InitTest2() // 3. SetTo(const BDirectory*, const char*, bool) // existing dir (root dir), no leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/"; CPPUNIT_ASSERT( dir.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.SetTo(&dir, NULL) == B_OK ); @@ -788,7 +788,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // existing dir, no leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/boot"; CPPUNIT_ASSERT( dir.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.SetTo(&dir, NULL) == B_OK ); @@ -797,7 +797,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // existing dir (root dir), no leaf, normalization forced - nextSubTest(); + NextSubTest(); pathName = "/"; CPPUNIT_ASSERT( dir.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.SetTo(&dir, NULL, true) == B_OK ); @@ -806,7 +806,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // existing dir, no leaf, normalization forced - nextSubTest(); + NextSubTest(); pathName = "/boot"; CPPUNIT_ASSERT( dir.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.SetTo(&dir, NULL, true) == B_OK ); @@ -815,7 +815,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // existing dir (root dir), leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/"; leafName = "boot"; absolutePathName = "/boot"; @@ -826,7 +826,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // existing dir, leaf, no normalization - nextSubTest(); + NextSubTest(); pathName = "/boot"; leafName = "home/Desktop"; absolutePathName = "/boot/home/Desktop"; @@ -837,7 +837,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // existing dir, leaf, auto normalization - nextSubTest(); + NextSubTest(); pathName = "/boot"; leafName = "home/.."; absolutePathName = "/boot"; @@ -848,7 +848,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // bad args (absolute leaf) - nextSubTest(); + NextSubTest(); pathName = "/"; leafName = "/boot"; CPPUNIT_ASSERT( dir.SetTo(pathName) == B_OK ); @@ -858,7 +858,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // bad args (uninitialized dir) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path.SetTo(&dir, "test") == B_BAD_VALUE ); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); @@ -866,7 +866,7 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // bad args (badly initialized dir) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( dir.SetTo("/this/dir/doesn't/exists") == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( path.SetTo(&dir, "test") == B_BAD_VALUE ); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); @@ -874,16 +874,16 @@ PathTest::InitTest2() path.Unset(); dir.Unset(); // R5: crashs, when passing a NULL BDirectory -#if !SK_TEST_R5 +#if !TEST_R5 // bad args (NULL dir) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo((const BDirectory*)NULL, "test") == B_BAD_VALUE ); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); dir.Unset(); // bad args (NULL dir) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo((const BDirectory*)NULL, NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( path.InitCheck() == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); @@ -893,7 +893,7 @@ PathTest::InitTest2() // 4. SetTo(const BEntry*) // existing entry (root dir) - nextSubTest(); + NextSubTest(); pathName = "/"; CPPUNIT_ASSERT( entry.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.SetTo(&entry) == B_OK ); @@ -902,7 +902,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // existing entry - nextSubTest(); + NextSubTest(); pathName = "/boot"; CPPUNIT_ASSERT( entry.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.SetTo(&entry) == B_OK ); @@ -911,7 +911,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // abstract entry - nextSubTest(); + NextSubTest(); pathName = "/boot/shouldn't exist"; CPPUNIT_ASSERT( entry.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( path.SetTo(&entry) == B_OK ); @@ -920,7 +920,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // bad args (uninitialized BEntry) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path.SetTo(&entry) == B_NO_INIT ); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); @@ -928,7 +928,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // bad args (badly initialized BEntry) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( entry.SetTo("/this/doesn't/exist") == B_ENTRY_NOT_FOUND ); CPPUNIT_ASSERT( equals(path.SetTo(&entry), B_NO_INIT, B_ENTRY_NOT_FOUND) ); CPPUNIT_ASSERT( equals(path.InitCheck(), B_NO_INIT, B_ENTRY_NOT_FOUND) ); @@ -936,7 +936,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // bad args (NULL BEntry) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( equals(path.SetTo((const BEntry*)NULL), B_NO_INIT, B_BAD_VALUE) ); CPPUNIT_ASSERT( equals(path.InitCheck(), B_NO_INIT, B_BAD_VALUE) ); @@ -946,7 +946,7 @@ PathTest::InitTest2() // 5. SetTo(const entry_ref*) // existing entry (root dir) - nextSubTest(); + NextSubTest(); pathName = "/"; CPPUNIT_ASSERT( entry.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); @@ -956,7 +956,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // existing entry - nextSubTest(); + NextSubTest(); pathName = "/boot"; CPPUNIT_ASSERT( entry.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); @@ -966,7 +966,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // abstract entry - nextSubTest(); + NextSubTest(); pathName = "/boot/shouldn't exist"; CPPUNIT_ASSERT( entry.SetTo(pathName) == B_OK ); CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK ); @@ -976,7 +976,7 @@ PathTest::InitTest2() path.Unset(); entry.Unset(); // bad args (NULL entry_ref) - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( equals(path.SetTo((const entry_ref*)NULL), B_NO_INIT, B_BAD_VALUE) ); CPPUNIT_ASSERT( equals(path.InitCheck(), B_NO_INIT, B_BAD_VALUE) ); @@ -991,13 +991,13 @@ PathTest::AppendTest() { BPath path; // uninitialized BPath - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path.Append("test") == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // dir hierarchy, from existing to non-existing - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/") == B_OK ); CPPUNIT_ASSERT( string("/") == path.Path() ); CPPUNIT_ASSERT( path.Append("boot") == B_OK ); @@ -1012,7 +1012,7 @@ PathTest::AppendTest() CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // force normalization - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/boot") == B_OK ); CPPUNIT_ASSERT( string("/boot") == path.Path() ); CPPUNIT_ASSERT( path.Append("home/non-existing", true) == B_OK ); @@ -1022,7 +1022,7 @@ PathTest::AppendTest() CPPUNIT_ASSERT( path.Path() == NULL ); path.Unset(); // bad/strange args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/boot") == B_OK ); CPPUNIT_ASSERT( path.Append(NULL) == B_OK ); CPPUNIT_ASSERT( string("/boot") == path.Path() ); @@ -1041,17 +1041,17 @@ PathTest::LeafTest() { BPath path; // uninitialized BPath - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path.Leaf() == NULL ); path.Unset(); // root dir - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/") == B_OK ); CPPUNIT_ASSERT( string("") == path.Leaf() ); path.Unset(); // existing dirs - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/boot") == B_OK ); CPPUNIT_ASSERT( string("boot") == path.Leaf() ); CPPUNIT_ASSERT( path.SetTo("/boot/home") == B_OK ); @@ -1060,7 +1060,7 @@ PathTest::LeafTest() CPPUNIT_ASSERT( string("Desktop") == path.Leaf() ); path.Unset(); // non-existing dirs - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/non-existing") == B_OK ); CPPUNIT_ASSERT( string("non-existing") == path.Leaf() ); CPPUNIT_ASSERT( path.SetTo("/non/existing/dir") == B_OK ); @@ -1075,22 +1075,22 @@ PathTest::ParentTest() BPath path; BPath parent; // R5: crashs, when GetParent() is called on uninitialized BPath -#if !SK_TEST_R5 +#if !TEST_R5 // uninitialized BPath - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path.GetParent(&parent) == B_NO_INIT ); path.Unset(); parent.Unset(); #endif // root dir - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/") == B_OK ); CPPUNIT_ASSERT( path.GetParent(&parent) == B_ENTRY_NOT_FOUND ); path.Unset(); parent.Unset(); // existing dirs - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/boot") == B_OK ); CPPUNIT_ASSERT( path.GetParent(&parent) == B_OK ); CPPUNIT_ASSERT( string("/") == parent.Path() ); @@ -1103,7 +1103,7 @@ PathTest::ParentTest() path.Unset(); parent.Unset(); // non-existing dirs - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/non-existing") == B_OK ); CPPUNIT_ASSERT( path.GetParent(&parent) == B_OK ); CPPUNIT_ASSERT( string("/") == parent.Path() ); @@ -1113,7 +1113,7 @@ PathTest::ParentTest() path.Unset(); parent.Unset(); // destructive parenting - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/non/existing/dir") == B_OK ); CPPUNIT_ASSERT( path.GetParent(&path) == B_OK ); CPPUNIT_ASSERT( string("/non/existing") == path.Path() ); @@ -1125,9 +1125,9 @@ PathTest::ParentTest() path.Unset(); parent.Unset(); // R5: crashs, when passing a NULL BPath -#if !SK_TEST_R5 +#if !TEST_R5 // bad args - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/non/existing/dir") == B_OK ); CPPUNIT_ASSERT( path.GetParent(NULL) == B_BAD_VALUE ); path.Unset(); @@ -1144,17 +1144,17 @@ PathTest::ComparisonTest() BPath path2; // uninitialized BPaths // R5: uninitialized paths are unequal - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path2.InitCheck() == B_NO_INIT ); -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( (path == path2) == true ); CPPUNIT_ASSERT( (path != path2) == false ); #endif path.Unset(); path2.Unset(); // uninitialized argument BPath - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/") == B_OK ); CPPUNIT_ASSERT( path2.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( (path == path2) == false ); @@ -1162,7 +1162,7 @@ PathTest::ComparisonTest() path.Unset(); path2.Unset(); // uninitialized this BPath - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path2.SetTo("/") == B_OK ); CPPUNIT_ASSERT( (path == path2) == false ); @@ -1170,7 +1170,7 @@ PathTest::ComparisonTest() path.Unset(); path2.Unset(); // various paths - nextSubTest(); + NextSubTest(); const char *paths[] = { "/", "/boot", "/boot/home", "/boot/home/Desktop" }; int32 pathCount = sizeof(paths) / sizeof(const char*); for (int32 i = 0; i < pathCount; i++) { @@ -1187,14 +1187,14 @@ PathTest::ComparisonTest() // 2. ==/!= const char * const char *pathName; // uninitialized BPath - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); pathName = "/"; CPPUNIT_ASSERT( (path == pathName) == false ); CPPUNIT_ASSERT( (path != pathName) == true ); path.Unset(); // various paths - nextSubTest(); + NextSubTest(); for (int32 i = 0; i < pathCount; i++) { for (int32 k = 0; k < pathCount; k++) { CPPUNIT_ASSERT( path.SetTo(paths[i]) == B_OK ); @@ -1207,16 +1207,16 @@ PathTest::ComparisonTest() // bad args (NULL const char*) // R5: initialized path equals NULL argument! // R5: uninitialized path does not equal NULL argument! - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/") == B_OK ); pathName = NULL; -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( (path == pathName) == false ); CPPUNIT_ASSERT( (path != pathName) == true ); #endif path.Unset(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( (path == pathName) == true ); CPPUNIT_ASSERT( (path != pathName) == false ); #endif @@ -1229,7 +1229,7 @@ PathTest::AssignmentTest() { // 1. copy constructor // uninitialized - nextSubTest(); + NextSubTest(); { BPath path; CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); @@ -1237,7 +1237,7 @@ PathTest::AssignmentTest() CPPUNIT_ASSERT( path2.InitCheck() == B_NO_INIT ); } // initialized - nextSubTest(); + NextSubTest(); { BPath path("/boot/home/Desktop"); CPPUNIT_ASSERT( path.InitCheck() == B_OK ); @@ -1248,7 +1248,7 @@ PathTest::AssignmentTest() // 2. assignment operator, const BPath & // uninitialized - nextSubTest(); + NextSubTest(); { BPath path; BPath path2; @@ -1256,7 +1256,7 @@ PathTest::AssignmentTest() CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path2.InitCheck() == B_NO_INIT ); } - nextSubTest(); + NextSubTest(); { BPath path; BPath path2("/"); @@ -1266,7 +1266,7 @@ PathTest::AssignmentTest() CPPUNIT_ASSERT( path2.InitCheck() == B_NO_INIT ); } // initialized - nextSubTest(); + NextSubTest(); { BPath path("/boot/home"); CPPUNIT_ASSERT( path.InitCheck() == B_OK ); @@ -1278,7 +1278,7 @@ PathTest::AssignmentTest() // 2. assignment operator, const char * // initialized - nextSubTest(); + NextSubTest(); { const char *pathName = "/boot/home"; BPath path2; @@ -1287,7 +1287,7 @@ PathTest::AssignmentTest() CPPUNIT_ASSERT( path2 == pathName ); } // bad args - nextSubTest(); + NextSubTest(); { const char *pathName = NULL; BPath path2; @@ -1303,7 +1303,7 @@ PathTest::FlattenableTest() BPath path; // 1. trivial methods (IsFixedSize(), TypeCode(), AllowsTypeCode) // uninitialized - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); CPPUNIT_ASSERT( path.IsFixedSize() == false ); CPPUNIT_ASSERT( path.TypeCode() == B_REF_TYPE ); @@ -1312,7 +1312,7 @@ PathTest::FlattenableTest() CPPUNIT_ASSERT( path.AllowsTypeCode(B_FLOAT_TYPE) == false ); path.Unset(); // initialized - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.SetTo("/boot/home") == B_OK ); CPPUNIT_ASSERT( path.IsFixedSize() == false ); CPPUNIT_ASSERT( path.TypeCode() == B_REF_TYPE ); @@ -1324,7 +1324,7 @@ PathTest::FlattenableTest() // 2. non-trivial methods char buffer[1024]; // uninitialized - nextSubTest(); + NextSubTest(); CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); ssize_t size = path.FlattenedSize(); CPPUNIT_ASSERT( size == sizeof(dev_t) + sizeof(ino_t) ); @@ -1333,7 +1333,7 @@ PathTest::FlattenableTest() CPPUNIT_ASSERT( path.InitCheck() == B_NO_INIT ); path.Unset(); // some flatten/unflatten tests - nextSubTest(); + NextSubTest(); const char *paths[] = { "/", "/boot", "/boot/home", "/boot/home/Desktop", "/boot/home/non-existing" }; int32 pathCount = sizeof(paths) / sizeof(const char*); @@ -1365,11 +1365,11 @@ PathTest::FlattenableTest() path.Unset(); } // bad args - nextSubTest(); + NextSubTest(); // R5: crashs, when passing a NULL buffer // R5: doesn't check the buffer size CPPUNIT_ASSERT( path.SetTo("/boot/home") == B_OK ); -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( path.Flatten(NULL, sizeof(buffer)) == B_BAD_VALUE ); CPPUNIT_ASSERT( path.Flatten(buffer, path.FlattenedSize() - 2) == B_BAD_VALUE ); diff --git a/src/tests/kits/storage/PathTest.h b/src/tests/kits/storage/PathTest.h index 30565d57e8..391da8fa7e 100644 --- a/src/tests/kits/storage/PathTest.h +++ b/src/tests/kits/storage/PathTest.h @@ -3,13 +3,11 @@ #ifndef __sk_path_test_h__ #define __sk_path_test_h__ -#include -#include - #include #include +#include -#include "BasicTest.h" +class CppUnit::Test; class PathTest : public BasicTest { diff --git a/src/tests/kits/storage/StatableTest.cpp b/src/tests/kits/storage/StatableTest.cpp index 1eacc06fda..74fb32463d 100644 --- a/src/tests/kits/storage/StatableTest.cpp +++ b/src/tests/kits/storage/StatableTest.cpp @@ -34,7 +34,7 @@ StatableTest::GetStatTest() BStatable *statable; string entryName; // existing entries - nextSubTest(); + NextSubTest(); CreateROStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { struct stat st1, st2; @@ -44,7 +44,7 @@ StatableTest::GetStatTest() } testEntries.delete_all(); // uninitialized objects - nextSubTest(); + NextSubTest(); CreateUninitializedStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { struct stat st1; @@ -52,7 +52,7 @@ StatableTest::GetStatTest() } testEntries.delete_all(); // bad args - nextSubTest(); + NextSubTest(); CreateROStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) CPPUNIT_ASSERT( statable->GetStat(NULL) != B_OK ); @@ -67,7 +67,7 @@ StatableTest::IsXYZTest() BStatable *statable; string entryName; // existing entries - nextSubTest(); + NextSubTest(); CreateROStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { struct stat st; @@ -78,7 +78,7 @@ StatableTest::IsXYZTest() } testEntries.delete_all(); // uninitialized objects - nextSubTest(); + NextSubTest(); CreateUninitializedStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { CPPUNIT_ASSERT( statable->IsDirectory() == false ); @@ -96,7 +96,7 @@ StatableTest::GetXYZTest() BStatable *statable; string entryName; // test with existing entries - nextSubTest(); + NextSubTest(); CreateROStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { struct stat st; @@ -108,7 +108,7 @@ StatableTest::GetXYZTest() time_t mtime; time_t ctime; // R5: access time unused -#if !SK_TEST_R5 && !SK_TEST_OBOS_POSIX +#if !TEST_R5 && !TEST_OBOS /* !!!POSIX ONLY!!! */ time_t atime; #endif BVolume volume; @@ -120,7 +120,7 @@ StatableTest::GetXYZTest() CPPUNIT_ASSERT( statable->GetSize(&size) == B_OK ); CPPUNIT_ASSERT( statable->GetModificationTime(&mtime) == B_OK ); CPPUNIT_ASSERT( statable->GetCreationTime(&ctime) == B_OK ); -#if !SK_TEST_R5 && !SK_TEST_OBOS_POSIX +#if !TEST_R5 && !TEST_OBOS /* !!!POSIX ONLY!!! */ CPPUNIT_ASSERT( statable->GetAccessTime(&atime) == B_OK ); #endif CPPUNIT_ASSERT( statable->GetVolume(&volume) == B_OK ); @@ -133,17 +133,17 @@ StatableTest::GetXYZTest() CPPUNIT_ASSERT( size == st.st_size ); CPPUNIT_ASSERT( mtime == st.st_mtime ); CPPUNIT_ASSERT( ctime == st.st_crtime ); -#if !SK_TEST_R5 && !SK_TEST_OBOS_POSIX +#if !TEST_R5 && !TEST_OBOS /* !!!POSIX ONLY!!! */ CPPUNIT_ASSERT( atime == st.st_atime ); #endif // OBOS: BVolume::==() is not implemented yet -#if !SK_TEST_OBOS_POSIX +#if !TEST_OBOS /* !!!POSIX ONLY!!! */ CPPUNIT_ASSERT( volume == BVolume(st.st_dev) ); #endif } testEntries.delete_all(); // test with uninitialized objects - nextSubTest(); + NextSubTest(); CreateUninitializedStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { node_ref ref; @@ -167,11 +167,11 @@ StatableTest::GetXYZTest() } testEntries.delete_all(); // bad args - nextSubTest(); + NextSubTest(); CreateROStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { // R5: crashs, if passing NULL to any of these methods -#if !SK_TEST_R5 +#if !TEST_R5 CPPUNIT_ASSERT( statable->GetNodeRef(NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( statable->GetOwner(NULL) == B_BAD_VALUE ); CPPUNIT_ASSERT( statable->GetGroup(NULL) == B_BAD_VALUE ); @@ -194,48 +194,48 @@ StatableTest::SetXYZTest() BStatable *statable; string entryName; // test with existing entries - nextSubTest(); + NextSubTest(); CreateRWStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { struct stat st; uid_t owner = 0xdad; gid_t group = 0xdee; // OBOS: no fchmod(), no FD time setters -#if !SK_TEST_OBOS_POSIX +#if !TEST_OBOS /* !!!POSIX ONLY!!! */ mode_t perms = 0x0ab; // -w- r-x -wx -- unusual enough? ;-) time_t mtime = 1234567; time_t ctime = 654321; #endif // R5: access time unused -#if !SK_TEST_R5 && !SK_TEST_OBOS_POSIX +#if !TEST_R5 && !TEST_OBOS /* !!!POSIX ONLY!!! */ time_t atime = 2345678; #endif // OBOS: no fchmod(), no FD time setters CPPUNIT_ASSERT( statable->SetOwner(owner) == B_OK ); CPPUNIT_ASSERT( statable->SetGroup(group) == B_OK ); -#if !SK_TEST_OBOS_POSIX +#if !TEST_OBOS /* !!!POSIX ONLY!!! */ CPPUNIT_ASSERT( statable->SetPermissions(perms) == B_OK ); CPPUNIT_ASSERT( statable->SetModificationTime(mtime) == B_OK ); CPPUNIT_ASSERT( statable->SetCreationTime(ctime) == B_OK ); #endif -#if !SK_TEST_R5 && !SK_TEST_OBOS_POSIX +#if !TEST_R5 && !TEST_OBOS /* !!!POSIX ONLY!!! */ CPPUNIT_ASSERT( statable->SetAccessTime(atime) == B_OK ); #endif CPPUNIT_ASSERT( lstat(entryName.c_str(), &st) == 0 ); CPPUNIT_ASSERT( owner == st.st_uid ); CPPUNIT_ASSERT( group == st.st_gid ); -#if !SK_TEST_OBOS_POSIX +#if !TEST_OBOS /* !!!POSIX ONLY!!! */ CPPUNIT_ASSERT( perms == (st.st_mode & S_IUMSK) ); CPPUNIT_ASSERT( mtime == st.st_mtime ); CPPUNIT_ASSERT( ctime == st.st_crtime ); #endif -#if !SK_TEST_R5 && !SK_TEST_OBOS_POSIX +#if !TEST_R5 && !TEST_OBOS /* !!!POSIX ONLY!!! */ CPPUNIT_ASSERT( atime == st.st_atime ); #endif } testEntries.delete_all(); // test with uninitialized objects - nextSubTest(); + NextSubTest(); CreateUninitializedStatables(testEntries); for (testEntries.rewind(); testEntries.getNext(statable, entryName); ) { uid_t owner = 0xdad; diff --git a/src/tests/kits/storage/StatableTest.h b/src/tests/kits/storage/StatableTest.h index 88129f05c5..59589ac0f0 100644 --- a/src/tests/kits/storage/StatableTest.h +++ b/src/tests/kits/storage/StatableTest.h @@ -3,6 +3,9 @@ #ifndef __sk_statable_test_h__ #define __sk_statable_test_h__ +#include +#include + #include #include diff --git a/src/tests/kits/storage/StorageKitTestAddon.cpp b/src/tests/kits/storage/StorageKitTestAddon.cpp new file mode 100644 index 0000000000..a8a72cdfc9 --- /dev/null +++ b/src/tests/kits/storage/StorageKitTestAddon.cpp @@ -0,0 +1,18 @@ +#include +#include + +// ##### Include headers for your tests here ##### +#include +#include +#include + +BTestSuite* getTestSuite() { + BTestSuite *suite = new BTestSuite("Storage"); + + // ##### Add test suites for statically linked tests here ##### + suite->addTest("BDirectory", DirectoryTest::Suite()); + suite->addTest("BNode", NodeTest::Suite()); + suite->addTest("BPath", PathTest::Suite()); + + return suite; +} diff --git a/src/tests/kits/storage/TestUtils.cpp b/src/tests/kits/storage/TestUtils.cpp index ecffb72121..2d8604bfe3 100644 --- a/src/tests/kits/storage/TestUtils.cpp +++ b/src/tests/kits/storage/TestUtils.cpp @@ -1,10 +1,10 @@ // TestUtils.cpp #include "TestUtils.h" -#include "StorageKitTester.h" +#include status_t DecodeResult(status_t result) { - if (!shell.BeVerbose()) + if (!BTestShell::GlobalBeVerbose()) return result; std::string str; diff --git a/src/tools/cppunit/TestCase.cpp b/src/tools/cppunit/TestCase.cpp index f1cd19449d..15cb812c18 100644 --- a/src/tools/cppunit/TestCase.cpp +++ b/src/tools/cppunit/TestCase.cpp @@ -2,6 +2,7 @@ #include #include #include +#include BTestCase::BTestCase(std::string name) : CppUnit::TestCase(name) @@ -17,8 +18,7 @@ BTestCase::tearDown() { void BTestCase::NextSubTest() { - BTestShell *shell = BTestShell::Shell(); - if (shell && shell->BeVerbose()) { + if (BeVerbose()) { printf("[%ld]", fSubTestNum++); fflush(stdout); } @@ -26,11 +26,21 @@ BTestCase::NextSubTest() { void BTestCase::NextSubTestBlock() { - BTestShell *shell = BTestShell::Shell(); - if (shell && shell->BeVerbose()) + if (BeVerbose()) printf("\n"); } +void +BTestCase::Outputf(const char *str, ...) { + if (BeVerbose()) { + va_list args; + va_start(args, str); + vprintf(str, args); + va_end(args); + fflush(stdout); + } +} + /*! To return to the last saved working directory, call RestoreCWD(). */ void BTestCase::SaveCWD() { @@ -49,3 +59,9 @@ BTestCase::RestoreCWD(const char *alternate) { else if (alternate != NULL) chdir(alternate); } + +bool +BTestCase::BeVerbose() { + BTestShell *shell = BTestShell::Shell(); + return ((shell && shell->BeVerbose()) || !shell); +} diff --git a/src/tools/cppunit/TestShell.cpp b/src/tools/cppunit/TestShell.cpp index 7aa33d1594..110e823ff2 100644 --- a/src/tools/cppunit/TestShell.cpp +++ b/src/tools/cppunit/TestShell.cpp @@ -15,17 +15,22 @@ #include #include +BTestShell *BTestShell::fGlobalShell = NULL; +const char BTestShell::indent[] = " "; + BTestShell::BTestShell(const std::string &description, SyncObject *syncObject) : fVerbosityLevel(v2) , fDescription(description) , fTestResults(syncObject) + , fListTestsAndExit(false) { }; status_t BTestShell::AddSuite(BTestSuite *suite) { if (suite) { - cout << "Adding suite '" << suite->getName() << "'" << endl; + if (Verbosity() >= v3) + cout << "Adding suite '" << suite->getName() << "'" << endl; // Add the suite fSuites[suite->getName()] = suite; @@ -67,14 +72,18 @@ BTestShell::LoadSuitesFrom(BDirectory *libDir) { status_t err; err = addonEntry.GetPath(&addonPath); if (!err) { +// cout << "Checking " << addonPath.Path() << "..." << flush; addonImage = load_add_on(addonPath.Path()); err = (addonImage > 0 ? B_OK : B_ERROR); } if (!err) { +// cout << "..." << endl; err = get_image_symbol(addonImage, "getTestSuite", B_SYMBOL_TYPE_TEXT, reinterpret_cast(&func)); + } else { +// cout << " !!! err == " << err << endl; } if (!err) err = AddSuite(func()); @@ -90,6 +99,16 @@ BTestShell::Run(int argc, char *argv[]) { if (!ProcessArguments(argc, argv)) return 0; + // Load any dynamically loadable tests we can find + LoadDynamicSuites(); + + // See if the user requested a list of tests. If so, + // print and bail. + if (fListTestsAndExit) { + PrintInstalledTests(); + return 0; + } + // Add the proper tests to our suite (or exit if there // are no tests installed). CppUnit::TestSuite suite; @@ -106,12 +125,19 @@ BTestShell::Run(int argc, char *argv[]) { for (i = fTests.begin(); i != fTests.end(); ++i) suite.addTest( i->second ); - } else { - + } else { // One or more specified, so only run those std::set::const_iterator i; - for (i = fTestsToRun.begin(); i != fTestsToRun.end(); ++i) - suite.addTest( fTests[*i] ); + for (i = fTestsToRun.begin(); i != fTestsToRun.end(); ++i) { + // Make sure it's a valid test + if (fTests.find(*i) != fTests.end()) { + suite.addTest( fTests[*i] ); + } else { + cout << endl << "ERROR: Invalid argument \"" << *i << "\"" << endl; + PrintHelp(); + return 0; + } + } } @@ -123,8 +149,6 @@ BTestShell::Run(int argc, char *argv[]) { return 0; } -BTestShell *BTestShell::fGlobalShell = NULL; - BTestShell::VerbosityLevel BTestShell::Verbosity() const { return fVerbosityLevel; @@ -137,9 +161,15 @@ BTestShell::PrintDescription(int argc, char *argv[]) { void BTestShell::PrintHelp() { - const char indent[] = " "; cout << endl; cout << "VALID ARGUMENTS: " << endl; + PrintValidArguments(); + cout << endl; + +} + +void +BTestShell::PrintValidArguments() { cout << indent << "--help Displays this help text plus some other garbage" << endl; cout << indent << "--list Lists the names of classes with installed tests" << endl; cout << indent << "-v0 Sets verbosity level to 0 (concise summary only)" << endl; @@ -150,8 +180,20 @@ BTestShell::PrintHelp() { cout << indent << " plus complete summary)" << endl; cout << indent << "CLASSNAME Instructs the program to run the test for the given class; if" << endl; cout << indent << " no classes are specified, all tests are run" << endl; + cout << indent << "-lPATH Adds PATH to the search path for dynamically loadable test" << endl; + cout << indent << " libraries." << endl; +} + +void +BTestShell::PrintInstalledTests() { + // Print out the list of installed tests + cout << "------------------------------------------------------------------------------" << endl; + cout << "Available Tests:" << endl; + cout << "------------------------------------------------------------------------------" << endl; + std::map::const_iterator i; + for (i = fTests.begin(); i != fTests.end(); ++i) + cout << i->first << endl; cout << endl; - } bool @@ -166,51 +208,47 @@ BTestShell::ProcessArguments(int argc, char *argv[]) { for (int i = 1; i < argc; i++) { std::string str(argv[i]); - if (str == "--help") { - PrintDescription(argc, argv); - PrintHelp(); - return false; - } - else if (str == "--list") { - // Print out the list of installed tests - cout << "------------------------------------------------------------------------------" << endl; - cout << "Available Tests:" << endl; - cout << "------------------------------------------------------------------------------" << endl; - std::map::const_iterator i; - for (i = fTests.begin(); i != fTests.end(); ++i) - cout << i->first << endl; - cout << endl; - return false; - } - else if (str == "-v0") { - fVerbosityLevel = v0; - } - else if (str == "-v1") { - fVerbosityLevel = v1; - } - else if (str == "-v2") { - fVerbosityLevel = v2; - } - else if (fTests.find(str) != fTests.end()) { - fTestsToRun.insert(str); - } - else { - cout << endl << "ERROR: Invalid argument \"" << str << "\"" << endl; - PrintHelp(); - return false; - } - + if (!ProcessArgument(str, argc, argv)) + return false; } return true; } +bool +BTestShell::ProcessArgument(std::string arg, int argc, char *argv[]) { + if (arg == "--help") { + PrintDescription(argc, argv); + PrintHelp(); + return false; + } + else if (arg == "--list") { + fListTestsAndExit = true; + } + else if (arg == "-v0") { + fVerbosityLevel = v0; + } + else if (arg == "-v1") { + fVerbosityLevel = v1; + } + else if (arg == "-v2") { + fVerbosityLevel = v2; + } + else if (arg == "-v3") { + fVerbosityLevel = v3; + } + else { + fTestsToRun.insert(arg); + } + return true; +} + void BTestShell::InitOutput() { // For vebosity level 2, we output info about each test // as we go. This involves a custom CppUnit::TestListener // class. - if (fVerbosityLevel == v2) { + if (fVerbosityLevel >= v2) { cout << "------------------------------------------------------------------------------" << endl; cout << "Tests" << endl; cout << "------------------------------------------------------------------------------" << endl; @@ -269,3 +307,15 @@ BTestShell::PrintResults() { } +void +BTestShell::LoadDynamicSuites() { + std::set::iterator i; + for (i = fLibDirs.begin(); i != fLibDirs.end(); i++) { + BDirectory libDir((*i).c_str()); + int count = LoadSuitesFrom(&libDir); + if (Verbosity() >= v3) { + cout << "Loaded " << count << " suite" << (count == 1 ? "" : "s"); + cout << " from " << *i << endl; + } + } +} diff --git a/src/tools/cppunit/ThreadedTestCase.cpp b/src/tools/cppunit/ThreadedTestCase.cpp index a320317377..e7c900e554 100644 --- a/src/tools/cppunit/ThreadedTestCase.cpp +++ b/src/tools/cppunit/ThreadedTestCase.cpp @@ -46,6 +46,37 @@ BThreadedTestCase::NextSubTest() { BTestCase::NextSubTest(); } +void +BThreadedTestCase::Outputf(const char *str, ...) { + if (BeVerbose()) { + // Figure out if this is a multithreaded test or not + thread_id id = find_thread(NULL); + bool isSingleThreaded; + { + BAutolock lock(fUpdateLock); + isSingleThreaded = fNumberMap.find(id) == fNumberMap.end(); + } + if (isSingleThreaded) { + va_list args; + va_start(args, str); + vprintf(str, args); + va_end(args); + fflush(stdout); + } else { + va_list args; + va_start(args, str); + char msg[1024]; // Need a longer string? Change the constant or change the function. :-) + vsprintf(msg, str, args); + va_end(args); + { + // Acquire the update lock and post our update + BAutolock lock(fUpdateLock); + fUpdateList.push_back(std::string(msg)); + } + } + } +} + void BThreadedTestCase::InitThreadInfo(thread_id id, std::string threadName) { BAutolock lock(fUpdateLock); // Lock the number map