Finished migrating Storage Kit tests to new framework.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@292 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
// TestApp.h
|
||||||
|
|
||||||
|
#ifndef _beos_test_app_h_
|
||||||
|
#define _beos_test_app_h_
|
||||||
|
|
||||||
|
#include <Application.h>
|
||||||
|
#include <MessageQueue.h>
|
||||||
|
|
||||||
|
// TestHandler
|
||||||
|
|
||||||
|
class TestHandler : public BHandler {
|
||||||
|
public:
|
||||||
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
BMessageQueue &Queue();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMessageQueue fQueue;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// TestApp
|
||||||
|
|
||||||
|
class TestApp : public BApplication {
|
||||||
|
public:
|
||||||
|
TestApp(const char *signature);
|
||||||
|
|
||||||
|
status_t Init();
|
||||||
|
void Terminate();
|
||||||
|
|
||||||
|
virtual void ReadyToRun();
|
||||||
|
|
||||||
|
TestHandler &Handler();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static int32 _AppThreadStart(void *data);
|
||||||
|
|
||||||
|
private:
|
||||||
|
thread_id fAppThread;
|
||||||
|
TestHandler fHandler;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _beos_test_app_h_
|
||||||
@@ -29,9 +29,6 @@ public:
|
|||||||
//! Restores the current working directory to last directory saved by a call to SaveCWD().
|
//! Restores the current working directory to last directory saved by a call to SaveCWD().
|
||||||
void RestoreCWD(const char *alternate = NULL);
|
void RestoreCWD(const char *alternate = NULL);
|
||||||
protected:
|
protected:
|
||||||
//! Returns true if the current shell settings allow us to print to standard output.
|
|
||||||
bool BeVerbose();
|
|
||||||
|
|
||||||
bool fValidCWD;
|
bool fValidCWD;
|
||||||
char fCurrentWorkingDir[B_PATH_NAME_LENGTH+1];
|
char fCurrentWorkingDir[B_PATH_NAME_LENGTH+1];
|
||||||
int32 fSubTestNum;
|
int32 fSubTestNum;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ typedef CppUnit::SynchronizedObject::SynchronizationObject SyncObject;
|
|||||||
class BTestShell {
|
class BTestShell {
|
||||||
public:
|
public:
|
||||||
BTestShell(const std::string &description = "", SyncObject *syncObject = 0);
|
BTestShell(const std::string &description = "", SyncObject *syncObject = 0);
|
||||||
|
virtual ~BTestShell();
|
||||||
|
|
||||||
// This function is used to add the tests for a given kit (as contained
|
// This function is used to add the tests for a given kit (as contained
|
||||||
// in a BTestSuite object) to the list of available tests. The shell assumes
|
// in a BTestSuite object) to the list of available tests. The shell assumes
|
||||||
@@ -72,11 +73,15 @@ public:
|
|||||||
// access to verbosity information. Don't rely on it if you don't
|
// 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
|
// have to (and always make sure the pointer it returns isn't NULL
|
||||||
// before you try to use it :-).
|
// before you try to use it :-).
|
||||||
static BTestShell* Shell() { return fGlobalShell; };
|
static BTestShell* GlobalShell() { return fGlobalShell; };
|
||||||
|
|
||||||
// Sets the global BTestShell pointer. The BTestShell class does
|
// Sets the global BTestShell pointer. The BTestShell class does
|
||||||
// not assume ownership of the object.
|
// not assume ownership of the object.
|
||||||
static void SetShell(BTestShell *shell) { fGlobalShell = shell; };
|
static void SetGlobalShell(BTestShell *shell) { fGlobalShell = shell; };
|
||||||
|
|
||||||
|
const char* TestDir() const;
|
||||||
|
static const char* GlobalTestDir() { return (fGlobalShell ? fGlobalShell->TestDir() : NULL); };
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VerbosityLevel fVerbosityLevel;
|
VerbosityLevel fVerbosityLevel;
|
||||||
@@ -90,6 +95,7 @@ protected:
|
|||||||
static BTestShell* fGlobalShell;
|
static BTestShell* fGlobalShell;
|
||||||
static const char indent[];
|
static const char indent[];
|
||||||
bool fListTestsAndExit;
|
bool fListTestsAndExit;
|
||||||
|
BPath *fTestDir;
|
||||||
|
|
||||||
//! Prints a brief description of the program.
|
//! Prints a brief description of the program.
|
||||||
virtual void PrintDescription(int argc, char *argv[]);
|
virtual void PrintDescription(int argc, char *argv[]);
|
||||||
@@ -127,6 +133,10 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void LoadDynamicSuites();
|
virtual void LoadDynamicSuites();
|
||||||
|
|
||||||
|
//! Sets the current test directory.
|
||||||
|
void UpdateTestDir(char *argv[]);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Prevents the use of the copy constructor.
|
//! Prevents the use of the copy constructor.
|
||||||
BTestShell( const BTestShell © );
|
BTestShell( const BTestShell © );
|
||||||
|
|||||||
@@ -1,5 +1,29 @@
|
|||||||
#include <TestShell.h>
|
#ifndef __beos_test_utils_h__
|
||||||
|
#define __beos_test_utils_h__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
// Handy defines :-)
|
||||||
#define CHK CPPUNIT_ASSERT
|
#define CHK CPPUNIT_ASSERT
|
||||||
#define RES DecodeResult
|
#define RES DecodeResult
|
||||||
|
|
||||||
|
// Prints out a description of the given status_t
|
||||||
|
// return code to standard out. Helpful for figuring
|
||||||
|
// out just what the R5 libraries are returning.
|
||||||
|
// Returns the same value passed in, so you can
|
||||||
|
// use it inline in tests if necessary.
|
||||||
|
status_t DecodeResult(status_t result);
|
||||||
|
|
||||||
|
// Calls system() with the concatenated string of command and parameter.
|
||||||
|
void ExecCommand(const char *command, const char *parameter);
|
||||||
|
|
||||||
|
// Calls system() with the concatenated string of command, parameter1,
|
||||||
|
// " " and parameter2.
|
||||||
|
void ExecCommand(const char *command, const char *parameter1,
|
||||||
|
const char *parameter2);
|
||||||
|
|
||||||
|
// Calls system() with the given command (kind of silly, but it's consistent :-)
|
||||||
|
void ExecCommand(const char *command);
|
||||||
|
|
||||||
|
#endif // __beos_test_utils_h__
|
||||||
|
|||||||
@@ -153,9 +153,6 @@ BThreadedTestCaller<TestClass, ExpectedException>::run(CppUnit::TestResult *resu
|
|||||||
// Try to acquire the semaphore
|
// Try to acquire the semaphore
|
||||||
err = acquire_sem_etc(fThreadSem, fThreads.size(), B_RELATIVE_TIMEOUT, 500000);
|
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
|
// Empty the UpdateList
|
||||||
std::vector<std::string> &list = fObject->AcquireUpdateList();
|
std::vector<std::string> &list = fObject->AcquireUpdateList();
|
||||||
for (std::vector<std::string>::iterator i = list.begin();
|
for (std::vector<std::string>::iterator i = list.begin();
|
||||||
@@ -164,7 +161,7 @@ BThreadedTestCaller<TestClass, ExpectedException>::run(CppUnit::TestResult *resu
|
|||||||
{
|
{
|
||||||
// Only print to standard out if the current global shell
|
// Only print to standard out if the current global shell
|
||||||
// lets us (or if no global shell is designated).
|
// lets us (or if no global shell is designated).
|
||||||
if ((shell && shell->BeVerbose()) || !shell) {
|
if (BTestShell::GlobalBeVerbose()) {
|
||||||
printf("%s", (*i).c_str());
|
printf("%s", (*i).c_str());
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
SubDir OBOS_TOP src add-ons kernel file_systems ;
|
SubDir OBOS_TOP src add-ons kernel file_systems ;
|
||||||
|
|
||||||
SubInclude OBOS_TOP src add-ons kernel file_systems befs ;
|
#SubInclude OBOS_TOP src add-ons kernel file_systems befs ;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
SubDir OBOS_TOP src add-ons print drivers ;
|
SubDir OBOS_TOP src add-ons print drivers ;
|
||||||
|
|
||||||
SubInclude OBOS_TOP src add-ons print drivers canon_lips ;
|
SubInclude OBOS_TOP src add-ons print drivers canon_lips ;
|
||||||
SubInclude OBOS_TOP src add-ons print drivers pdf ;
|
#SubInclude OBOS_TOP src add-ons print drivers pdf ;
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ SubInclude OBOS_TOP src prefs drivesetup ;
|
|||||||
SubInclude OBOS_TOP src prefs dun ;
|
SubInclude OBOS_TOP src prefs dun ;
|
||||||
SubInclude OBOS_TOP src prefs fonts ;
|
SubInclude OBOS_TOP src prefs fonts ;
|
||||||
SubInclude OBOS_TOP src prefs keyboard ;
|
SubInclude OBOS_TOP src prefs keyboard ;
|
||||||
SubInclude OBOS_TOP src prefs keymap ;
|
#SubInclude OBOS_TOP src prefs keymap ;
|
||||||
SubInclude OBOS_TOP src prefs media ;
|
SubInclude OBOS_TOP src prefs media ;
|
||||||
SubInclude OBOS_TOP src prefs menu ;
|
SubInclude OBOS_TOP src prefs menu ;
|
||||||
SubInclude OBOS_TOP src prefs mouse ;
|
SubInclude OBOS_TOP src prefs mouse ;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// ##### Add test suites for statically linked tests here #####
|
// ##### Add test suites for statically linked tests here #####
|
||||||
// shell.AddTest( "Example", ExampleTest::Suite() );
|
// shell.AddTest( "Example", ExampleTest::Suite() );
|
||||||
|
|
||||||
BTestShell::SetShell(&shell);
|
BTestShell::SetGlobalShell(&shell);
|
||||||
|
|
||||||
// Load our dynamically linked tests
|
// Load our dynamically linked tests
|
||||||
|
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ EntryTest::InitTest1Paths(TestEntry &_testEntry, status_t error, bool traverse)
|
|||||||
{
|
{
|
||||||
TestEntry *testEntry = &_testEntry;
|
TestEntry *testEntry = &_testEntry;
|
||||||
// absolute path
|
// absolute path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
//printf("%s\n", testEntry->cpath);
|
//printf("%s\n", testEntry->cpath);
|
||||||
BEntry entry(testEntry->cpath, traverse);
|
BEntry entry(testEntry->cpath, traverse);
|
||||||
@@ -343,7 +343,7 @@ printf("error: %lx (%lx)\n", result, error);
|
|||||||
examine_entry(entry, testEntry, traverse);
|
examine_entry(entry, testEntry, traverse);
|
||||||
}
|
}
|
||||||
// relative path
|
// relative path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
//printf("%s\n", testEntry->cpath);
|
//printf("%s\n", testEntry->cpath);
|
||||||
if (chdir(testEntry->super->cpath) == 0) {
|
if (chdir(testEntry->super->cpath) == 0) {
|
||||||
@@ -365,7 +365,7 @@ EntryTest::InitTest1Refs(TestEntry &_testEntry, status_t error, bool traverse)
|
|||||||
{
|
{
|
||||||
TestEntry *testEntry = &_testEntry;
|
TestEntry *testEntry = &_testEntry;
|
||||||
// absolute path
|
// absolute path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
//printf("%s\n", testEntry->cpath);
|
//printf("%s\n", testEntry->cpath);
|
||||||
BEntry entry(&testEntry->get_ref(), traverse);
|
BEntry entry(&testEntry->get_ref(), traverse);
|
||||||
@@ -385,7 +385,7 @@ EntryTest::InitTest1DirPaths(TestEntry &_testEntry, status_t error,
|
|||||||
{
|
{
|
||||||
TestEntry *testEntry = &_testEntry;
|
TestEntry *testEntry = &_testEntry;
|
||||||
// absolute path
|
// absolute path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
if (!testEntry->isBad()
|
if (!testEntry->isBad()
|
||||||
&& testEntry->path.length() < B_PATH_NAME_LENGTH) {
|
&& testEntry->path.length() < B_PATH_NAME_LENGTH) {
|
||||||
@@ -402,7 +402,7 @@ printf("error: %lx (%lx)\n", result, error);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// relative path (one level)
|
// relative path (one level)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
if (!testEntry->isBad()
|
if (!testEntry->isBad()
|
||||||
&& testEntry->super->path.length() < B_PATH_NAME_LENGTH) {
|
&& testEntry->super->path.length() < B_PATH_NAME_LENGTH) {
|
||||||
@@ -419,7 +419,7 @@ printf("error: %lx (%lx)\n", result, error);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// relative path (two levels)
|
// relative path (two levels)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
if (!testEntry->super->isBad() && !testEntry->super->super->isBad()) {
|
if (!testEntry->super->isBad() && !testEntry->super->super->isBad()) {
|
||||||
string entryName = testEntry->super->name + "/" + testEntry->name;
|
string entryName = testEntry->super->name + "/" + testEntry->name;
|
||||||
@@ -442,7 +442,7 @@ void
|
|||||||
EntryTest::InitTest1()
|
EntryTest::InitTest1()
|
||||||
{
|
{
|
||||||
// 1. default constructor
|
// 1. default constructor
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
@@ -541,19 +541,19 @@ EntryTest::InitTest1()
|
|||||||
InitTest1Paths(tooLongDir16, fuzzy_error(B_ERROR, B_NAME_TOO_LONG), true);
|
InitTest1Paths(tooLongDir16, fuzzy_error(B_ERROR, B_NAME_TOO_LONG), true);
|
||||||
|
|
||||||
// special cases (root dir)
|
// special cases (root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry("/");
|
BEntry entry("/");
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
// special cases (fs root dir)
|
// special cases (fs root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry("/boot");
|
BEntry entry("/boot");
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry((const char*)NULL);
|
BEntry entry((const char*)NULL);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
||||||
@@ -641,7 +641,7 @@ EntryTest::InitTest1()
|
|||||||
InitTest1Refs(relVeryBadLink3, B_ENTRY_NOT_FOUND, true);
|
InitTest1Refs(relVeryBadLink3, B_ENTRY_NOT_FOUND, true);
|
||||||
InitTest1Refs(relVeryBadLink4, B_ENTRY_NOT_FOUND, true);
|
InitTest1Refs(relVeryBadLink4, B_ENTRY_NOT_FOUND, true);
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry((const entry_ref*)NULL);
|
BEntry entry((const entry_ref*)NULL);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
||||||
@@ -693,7 +693,7 @@ EntryTest::InitTest1()
|
|||||||
InitTest1DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG));
|
InitTest1DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG));
|
||||||
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
||||||
// name.
|
// name.
|
||||||
#if !SK_TEST_OBOS_POSIX
|
#if !TEST_OBOS /* !!!POSIX ONLY!!! */
|
||||||
InitTest1DirPaths(tooLongDir16, B_OK, true);
|
InitTest1DirPaths(tooLongDir16, B_OK, true);
|
||||||
#endif
|
#endif
|
||||||
// traverse
|
// traverse
|
||||||
@@ -741,26 +741,26 @@ EntryTest::InitTest1()
|
|||||||
InitTest1DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG), true);
|
InitTest1DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG), true);
|
||||||
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
||||||
// name.
|
// name.
|
||||||
#if !SK_TEST_OBOS_POSIX
|
#if !TEST_OBOS /* !!!POSIX ONLY!!! */
|
||||||
InitTest1DirPaths(tooLongDir16, B_OK, true);
|
InitTest1DirPaths(tooLongDir16, B_OK, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// special cases (root dir)
|
// special cases (root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir("/");
|
BDirectory dir("/");
|
||||||
BEntry entry(&dir, ".");
|
BEntry entry(&dir, ".");
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
// special cases (fs root dir)
|
// special cases (fs root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir("/");
|
BDirectory dir("/");
|
||||||
BEntry entry(&dir, "boot");
|
BEntry entry(&dir, "boot");
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
// NULL path
|
// NULL path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir("/");
|
BDirectory dir("/");
|
||||||
BEntry entry(&dir, (const char*)NULL);
|
BEntry entry(&dir, (const char*)NULL);
|
||||||
@@ -768,8 +768,8 @@ EntryTest::InitTest1()
|
|||||||
}
|
}
|
||||||
// bad args (NULL dir)
|
// bad args (NULL dir)
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
chdir("/");
|
chdir("/");
|
||||||
BEntry entry((const BDirectory*)NULL, "tmp");
|
BEntry entry((const BDirectory*)NULL, "tmp");
|
||||||
@@ -778,7 +778,7 @@ EntryTest::InitTest1()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// strange args (badly initialized dir, absolute path)
|
// strange args (badly initialized dir, absolute path)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir(badEntry1.cpath);
|
BDirectory dir(badEntry1.cpath);
|
||||||
CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
@@ -787,8 +787,8 @@ EntryTest::InitTest1()
|
|||||||
}
|
}
|
||||||
// bad args (NULL dir and path)
|
// bad args (NULL dir and path)
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry((const BDirectory*)NULL, (const char*)NULL);
|
BEntry entry((const BDirectory*)NULL, (const char*)NULL);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
||||||
@@ -796,8 +796,8 @@ EntryTest::InitTest1()
|
|||||||
#endif
|
#endif
|
||||||
// bad args(NULL dir, absolute path)
|
// bad args(NULL dir, absolute path)
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry((const BDirectory*)NULL, "/tmp");
|
BEntry entry((const BDirectory*)NULL, "/tmp");
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
||||||
@@ -812,7 +812,7 @@ EntryTest::InitTest2Paths(TestEntry &_testEntry, status_t error, bool traverse)
|
|||||||
TestEntry *testEntry = &_testEntry;
|
TestEntry *testEntry = &_testEntry;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
// absolute path
|
// absolute path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
//printf("%s\n", testEntry->cpath);
|
//printf("%s\n", testEntry->cpath);
|
||||||
status_t result = entry.SetTo(testEntry->cpath, traverse);
|
status_t result = entry.SetTo(testEntry->cpath, traverse);
|
||||||
@@ -824,7 +824,7 @@ printf("error: %lx (%lx)\n", result, error);
|
|||||||
examine_entry(entry, testEntry, traverse);
|
examine_entry(entry, testEntry, traverse);
|
||||||
}
|
}
|
||||||
// relative path
|
// relative path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
//printf("%s\n", testEntry->cpath);
|
//printf("%s\n", testEntry->cpath);
|
||||||
if (chdir(testEntry->super->cpath) == 0) {
|
if (chdir(testEntry->super->cpath) == 0) {
|
||||||
@@ -847,7 +847,7 @@ EntryTest::InitTest2Refs(TestEntry &_testEntry, status_t error, bool traverse)
|
|||||||
TestEntry *testEntry = &_testEntry;
|
TestEntry *testEntry = &_testEntry;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
// absolute path
|
// absolute path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
//printf("%s\n", testEntry->cpath);
|
//printf("%s\n", testEntry->cpath);
|
||||||
status_t result = entry.SetTo(&testEntry->get_ref(), traverse);
|
status_t result = entry.SetTo(&testEntry->get_ref(), traverse);
|
||||||
@@ -868,7 +868,7 @@ EntryTest::InitTest2DirPaths(TestEntry &_testEntry, status_t error,
|
|||||||
TestEntry *testEntry = &_testEntry;
|
TestEntry *testEntry = &_testEntry;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
// absolute path
|
// absolute path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
if (!testEntry->isBad()
|
if (!testEntry->isBad()
|
||||||
&& testEntry->path.length() < B_PATH_NAME_LENGTH) {
|
&& testEntry->path.length() < B_PATH_NAME_LENGTH) {
|
||||||
@@ -885,7 +885,7 @@ printf("error: %lx (%lx)\n", result, error);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// relative path (one level)
|
// relative path (one level)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
if (!testEntry->isBad()
|
if (!testEntry->isBad()
|
||||||
&& testEntry->super->path.length() < B_PATH_NAME_LENGTH) {
|
&& testEntry->super->path.length() < B_PATH_NAME_LENGTH) {
|
||||||
@@ -902,7 +902,7 @@ printf("error: %lx (%lx)\n", result, error);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// relative path (two levels)
|
// relative path (two levels)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
if (!testEntry->super->isBad() && !testEntry->super->super->isBad()) {
|
if (!testEntry->super->isBad() && !testEntry->super->super->isBad()) {
|
||||||
string entryName = testEntry->super->name + "/" + testEntry->name;
|
string entryName = testEntry->super->name + "/" + testEntry->name;
|
||||||
@@ -1017,17 +1017,17 @@ EntryTest::InitTest2()
|
|||||||
// R5: returns B_ERROR instead of B_NAME_TOO_LONG
|
// R5: returns B_ERROR instead of B_NAME_TOO_LONG
|
||||||
InitTest2Paths(tooLongDir16, fuzzy_error(B_ERROR, B_NAME_TOO_LONG), true);
|
InitTest2Paths(tooLongDir16, fuzzy_error(B_ERROR, B_NAME_TOO_LONG), true);
|
||||||
// special cases (root dir)
|
// special cases (root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// special cases (fs root dir)
|
// special cases (fs root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo("/boot") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo("/boot") == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo((const char*)NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.SetTo((const char*)NULL) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1114,7 +1114,7 @@ EntryTest::InitTest2()
|
|||||||
InitTest2Refs(relVeryBadLink3, B_ENTRY_NOT_FOUND, true);
|
InitTest2Refs(relVeryBadLink3, B_ENTRY_NOT_FOUND, true);
|
||||||
InitTest2Refs(relVeryBadLink4, B_ENTRY_NOT_FOUND, true);
|
InitTest2Refs(relVeryBadLink4, B_ENTRY_NOT_FOUND, true);
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo((const entry_ref*)NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.SetTo((const entry_ref*)NULL) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_BAD_VALUE );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1165,7 +1165,7 @@ EntryTest::InitTest2()
|
|||||||
InitTest2DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG));
|
InitTest2DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG));
|
||||||
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
||||||
// name.
|
// name.
|
||||||
#if !SK_TEST_OBOS_POSIX
|
#if !TEST_OBOS /* !!!POSIX ONLY!!! */
|
||||||
InitTest2DirPaths(tooLongDir16, B_OK, true);
|
InitTest2DirPaths(tooLongDir16, B_OK, true);
|
||||||
#endif
|
#endif
|
||||||
// traverse
|
// traverse
|
||||||
@@ -1213,11 +1213,11 @@ EntryTest::InitTest2()
|
|||||||
InitTest2DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG), true);
|
InitTest2DirPaths(tooLongEntry1, fuzzy_error(E2BIG, B_NAME_TOO_LONG), true);
|
||||||
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
||||||
// name.
|
// name.
|
||||||
#if !SK_TEST_OBOS_POSIX
|
#if !TEST_OBOS /* !!!POSIX ONLY!!! */
|
||||||
InitTest2DirPaths(tooLongDir16, B_OK, true);
|
InitTest2DirPaths(tooLongDir16, B_OK, true);
|
||||||
#endif
|
#endif
|
||||||
// special cases (root dir)
|
// special cases (root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir("/");
|
BDirectory dir("/");
|
||||||
CPPUNIT_ASSERT( entry.SetTo(&dir, ".") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(&dir, ".") == B_OK );
|
||||||
@@ -1225,7 +1225,7 @@ EntryTest::InitTest2()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
}
|
}
|
||||||
// special cases (fs root dir)
|
// special cases (fs root dir)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir("/");
|
BDirectory dir("/");
|
||||||
CPPUNIT_ASSERT( entry.SetTo(&dir, "boot") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(&dir, "boot") == B_OK );
|
||||||
@@ -1233,7 +1233,7 @@ EntryTest::InitTest2()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
}
|
}
|
||||||
// NULL path
|
// NULL path
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir("/");
|
BDirectory dir("/");
|
||||||
CPPUNIT_ASSERT( entry.SetTo(&dir, (const char*)NULL) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(&dir, (const char*)NULL) == B_OK );
|
||||||
@@ -1242,8 +1242,8 @@ EntryTest::InitTest2()
|
|||||||
}
|
}
|
||||||
// bad args (NULL dir)
|
// bad args (NULL dir)
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
chdir("/");
|
chdir("/");
|
||||||
CPPUNIT_ASSERT( entry.SetTo((const BDirectory*)NULL, "tmp")
|
CPPUNIT_ASSERT( entry.SetTo((const BDirectory*)NULL, "tmp")
|
||||||
@@ -1254,7 +1254,7 @@ EntryTest::InitTest2()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// strange args (badly initialized dir, absolute path)
|
// strange args (badly initialized dir, absolute path)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory dir(badEntry1.cpath);
|
BDirectory dir(badEntry1.cpath);
|
||||||
CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( dir.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
@@ -1263,8 +1263,8 @@ EntryTest::InitTest2()
|
|||||||
}
|
}
|
||||||
// bad args (NULL dir and path)
|
// bad args (NULL dir and path)
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT( entry.SetTo((const BDirectory*)NULL, (const char*)NULL)
|
CPPUNIT_ASSERT( entry.SetTo((const BDirectory*)NULL, (const char*)NULL)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
@@ -1274,8 +1274,8 @@ EntryTest::InitTest2()
|
|||||||
#endif
|
#endif
|
||||||
// bad args(NULL dir, absolute path)
|
// bad args(NULL dir, absolute path)
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT( entry.SetTo((const BDirectory*)NULL, "/tmp")
|
CPPUNIT_ASSERT( entry.SetTo((const BDirectory*)NULL, "/tmp")
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
@@ -1296,17 +1296,17 @@ EntryTest::SpecialGetCasesTest()
|
|||||||
BEntry entry;
|
BEntry entry;
|
||||||
// 1. Exists()
|
// 1. Exists()
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.Exists() == false );
|
CPPUNIT_ASSERT( entry.Exists() == false );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// badly initialized
|
// badly initialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.Exists() == false );
|
CPPUNIT_ASSERT( entry.Exists() == false );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// root
|
// root
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Exists() == true );
|
CPPUNIT_ASSERT( entry.Exists() == true );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1314,20 +1314,20 @@ EntryTest::SpecialGetCasesTest()
|
|||||||
// 2. GetPath()
|
// 2. GetPath()
|
||||||
BPath path;
|
BPath path;
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.GetPath(&path) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetPath(&path) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// badly initialized
|
// badly initialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.GetPath(&path) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetPath(&path) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// too long pathname
|
// too long pathname
|
||||||
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
// OBOS: Fails, because the implementation concatenates the dir and leaf
|
||||||
// name.
|
// name.
|
||||||
#if !SK_TEST_OBOS_POSIX
|
#if !TEST_OBOS /* !!!POSIX ONLY!!! */
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BDirectory dir(tooLongDir16.super->super->cpath);
|
BDirectory dir(tooLongDir16.super->super->cpath);
|
||||||
string entryName = tooLongDir16.super->name + "/" + tooLongDir16.name;
|
string entryName = tooLongDir16.super->name + "/" + tooLongDir16.name;
|
||||||
CPPUNIT_ASSERT( entry.SetTo(&dir, entryName.c_str()) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(&dir, entryName.c_str()) == B_OK );
|
||||||
@@ -1339,12 +1339,12 @@ EntryTest::SpecialGetCasesTest()
|
|||||||
// 3. GetName()
|
// 3. GetName()
|
||||||
char name[B_FILE_NAME_LENGTH + 1];
|
char name[B_FILE_NAME_LENGTH + 1];
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.GetName(name) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetName(name) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// badly initialized
|
// badly initialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.GetName(name) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetName(name) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1352,17 +1352,17 @@ EntryTest::SpecialGetCasesTest()
|
|||||||
// 4. GetParent(BEntry *)
|
// 4. GetParent(BEntry *)
|
||||||
BEntry parentEntry;
|
BEntry parentEntry;
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.GetParent(&parentEntry) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetParent(&parentEntry) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// badly initialized
|
// badly initialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.GetParent(&parentEntry) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetParent(&parentEntry) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// parent of root dir
|
// parent of root dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetParent(&parentEntry) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.GetParent(&parentEntry) == B_ENTRY_NOT_FOUND );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1370,17 +1370,17 @@ EntryTest::SpecialGetCasesTest()
|
|||||||
// 5. GetParent(BDirectory *)
|
// 5. GetParent(BDirectory *)
|
||||||
BDirectory parentDir;
|
BDirectory parentDir;
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.GetParent(&parentDir) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetParent(&parentDir) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// badly initialized
|
// badly initialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.GetParent(&parentDir) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetParent(&parentDir) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// parent of root dir
|
// parent of root dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetParent(&parentDir) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.GetParent(&parentDir) == B_ENTRY_NOT_FOUND );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1388,17 +1388,17 @@ EntryTest::SpecialGetCasesTest()
|
|||||||
// 6. GetRef()
|
// 6. GetRef()
|
||||||
entry_ref ref, ref2;
|
entry_ref ref, ref2;
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// badly initialized
|
// badly initialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// ref for root dir
|
// ref for root dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo("/") == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1410,7 +1410,7 @@ EntryTest::RenameTestEntry(TestEntry *testEntry, TestEntry *newTestEntry,
|
|||||||
string newName, bool existing, bool clobber,
|
string newName, bool existing, bool clobber,
|
||||||
status_t error, uint32 kind)
|
status_t error, uint32 kind)
|
||||||
{
|
{
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BDirectory dir;
|
BDirectory dir;
|
||||||
// get all the names
|
// get all the names
|
||||||
@@ -1565,7 +1565,7 @@ EntryTest::RenameTest()
|
|||||||
RenameTestLink(&file2, &file3, true, false, B_FILE_EXISTS);
|
RenameTestLink(&file2, &file3, true, false, B_FILE_EXISTS);
|
||||||
|
|
||||||
// try to clobber a non-empty directory
|
// try to clobber a non-empty directory
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CreateFile(file3.cpath);
|
CreateFile(file3.cpath);
|
||||||
CPPUNIT_ASSERT( entry.SetTo(file3.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(file3.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Rename(dir1.cpath, true) == B_DIRECTORY_NOT_EMPTY );
|
CPPUNIT_ASSERT( entry.Rename(dir1.cpath, true) == B_DIRECTORY_NOT_EMPTY );
|
||||||
@@ -1575,7 +1575,7 @@ EntryTest::RenameTest()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// clobber an empty directory
|
// clobber an empty directory
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CreateFile(file3.cpath);
|
CreateFile(file3.cpath);
|
||||||
CPPUNIT_ASSERT( entry.SetTo(file3.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(file3.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Rename(subDir1.cpath, true) == B_OK );
|
CPPUNIT_ASSERT( entry.Rename(subDir1.cpath, true) == B_OK );
|
||||||
@@ -1585,30 +1585,30 @@ EntryTest::RenameTest()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// abstract entry
|
// abstract entry
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(file2.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(file2.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Rename(file4.cname) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.Rename(file4.cname) == B_ENTRY_NOT_FOUND );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// uninitialized entry
|
// uninitialized entry
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.Rename(file4.cpath) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.Rename(file4.cpath) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// badly initialized entry
|
// badly initialized entry
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.Rename(file4.cpath) == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.Rename(file4.cpath) == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// Verify attempts to rename root
|
// Verify attempts to rename root
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BEntry root("/");
|
BEntry root("/");
|
||||||
CPPUNIT_ASSERT( root.Rename("/", false) == B_FILE_EXISTS );
|
CPPUNIT_ASSERT( root.Rename("/", false) == B_FILE_EXISTS );
|
||||||
CPPUNIT_ASSERT( root.Rename("/", true) == B_NOT_ALLOWED );
|
CPPUNIT_ASSERT( root.Rename("/", true) == B_NOT_ALLOWED );
|
||||||
// Verify abstract entries
|
// Verify abstract entries
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BEntry abstract(abstractEntry1.cpath);
|
BEntry abstract(abstractEntry1.cpath);
|
||||||
CPPUNIT_ASSERT( abstract.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( abstract.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( !abstract.Exists() );
|
CPPUNIT_ASSERT( !abstract.Exists() );
|
||||||
@@ -1617,7 +1617,7 @@ EntryTest::RenameTest()
|
|||||||
CPPUNIT_ASSERT( abstract.Rename("/DoesntMatter") == B_CROSS_DEVICE_LINK );
|
CPPUNIT_ASSERT( abstract.Rename("/DoesntMatter") == B_CROSS_DEVICE_LINK );
|
||||||
CPPUNIT_ASSERT( abstract.Rename("/DontMatter", true) == B_CROSS_DEVICE_LINK );
|
CPPUNIT_ASSERT( abstract.Rename("/DontMatter", true) == B_CROSS_DEVICE_LINK );
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(file1.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(file1.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( equals(entry.Rename(NULL, false), B_FILE_EXISTS,
|
CPPUNIT_ASSERT( equals(entry.Rename(NULL, false), B_FILE_EXISTS,
|
||||||
B_BAD_VALUE) );
|
B_BAD_VALUE) );
|
||||||
@@ -1631,7 +1631,7 @@ EntryTest::MoveToTestEntry(TestEntry *testEntry, TestEntry *testDir,
|
|||||||
string newName, bool existing, bool clobber,
|
string newName, bool existing, bool clobber,
|
||||||
status_t error, uint32 kind)
|
status_t error, uint32 kind)
|
||||||
{
|
{
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BDirectory dir;
|
BDirectory dir;
|
||||||
// get all the names
|
// get all the names
|
||||||
@@ -1888,7 +1888,7 @@ EntryTest::MoveToTest()
|
|||||||
dir.Unset();
|
dir.Unset();
|
||||||
// bad args (NULL dir)
|
// bad args (NULL dir)
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CreateFile(file2.cpath);
|
CreateFile(file2.cpath);
|
||||||
CPPUNIT_ASSERT( entry.SetTo(file2.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(file2.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.MoveTo(NULL, file3.cpath) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( entry.MoveTo(NULL, file3.cpath) == B_BAD_VALUE );
|
||||||
@@ -1912,41 +1912,41 @@ EntryTest::RemoveTest()
|
|||||||
{
|
{
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
// file
|
// file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(file1.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(file1.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Remove() == B_OK );
|
CPPUNIT_ASSERT( entry.Remove() == B_OK );
|
||||||
CPPUNIT_ASSERT( !PingFile(file1.cpath) );
|
CPPUNIT_ASSERT( !PingFile(file1.cpath) );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// symlink
|
// symlink
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(absFileLink1.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(absFileLink1.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Remove() == B_OK );
|
CPPUNIT_ASSERT( entry.Remove() == B_OK );
|
||||||
CPPUNIT_ASSERT( !PingLink(absFileLink1.cpath) );
|
CPPUNIT_ASSERT( !PingLink(absFileLink1.cpath) );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// empty dir
|
// empty dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(subDir1.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(subDir1.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Remove() == B_OK );
|
CPPUNIT_ASSERT( entry.Remove() == B_OK );
|
||||||
CPPUNIT_ASSERT( !PingDir(subDir1.cpath) );
|
CPPUNIT_ASSERT( !PingDir(subDir1.cpath) );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// non-empty dir
|
// non-empty dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(dir1.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(dir1.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Remove() == B_DIRECTORY_NOT_EMPTY );
|
CPPUNIT_ASSERT( entry.Remove() == B_DIRECTORY_NOT_EMPTY );
|
||||||
CPPUNIT_ASSERT( PingDir(dir1.cpath) );
|
CPPUNIT_ASSERT( PingDir(dir1.cpath) );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// abstract entry
|
// abstract entry
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(abstractEntry1.cpath) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(abstractEntry1.cpath) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.Remove() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.Remove() == B_ENTRY_NOT_FOUND );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( entry.Remove() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.Remove() == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
// badly initialized
|
// badly initialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( entry.SetTo(badEntry1.cpath) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( entry.Remove() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.Remove() == B_NO_INIT );
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
@@ -1976,7 +1976,7 @@ void
|
|||||||
EntryTest::ComparisonTest()
|
EntryTest::ComparisonTest()
|
||||||
{
|
{
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BEntry entry2;
|
BEntry entry2;
|
||||||
@@ -1986,7 +1986,7 @@ EntryTest::ComparisonTest()
|
|||||||
CPPUNIT_ASSERT( !(entry2 != entry) );
|
CPPUNIT_ASSERT( !(entry2 != entry) );
|
||||||
}
|
}
|
||||||
// initialized + uninitialized
|
// initialized + uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(file1.cpath);
|
BEntry entry(file1.cpath);
|
||||||
BEntry entry2;
|
BEntry entry2;
|
||||||
@@ -2017,7 +2017,7 @@ EntryTest::ComparisonTest()
|
|||||||
};
|
};
|
||||||
int32 testEntryCount = sizeof(testEntries) / sizeof(TestEntry*);
|
int32 testEntryCount = sizeof(testEntries) / sizeof(TestEntry*);
|
||||||
for (int32 i = 0; i < testEntryCount; i++) {
|
for (int32 i = 0; i < testEntryCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestEntry *testEntry = testEntries[i];
|
TestEntry *testEntry = testEntries[i];
|
||||||
TestEntry *traversedTestEntry = resolve_link(testEntry);
|
TestEntry *traversedTestEntry = resolve_link(testEntry);
|
||||||
BEntry entry(testEntry->cpath);
|
BEntry entry(testEntry->cpath);
|
||||||
@@ -2045,7 +2045,7 @@ EntryTest::AssignmentTest()
|
|||||||
{
|
{
|
||||||
// 1. copy constructor
|
// 1. copy constructor
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
@@ -2068,7 +2068,7 @@ EntryTest::AssignmentTest()
|
|||||||
};
|
};
|
||||||
int32 testEntryCount = sizeof(testEntries) / sizeof(TestEntry*);
|
int32 testEntryCount = sizeof(testEntries) / sizeof(TestEntry*);
|
||||||
for (int32 i = 0; i < testEntryCount; i++) {
|
for (int32 i = 0; i < testEntryCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestEntry *testEntry = testEntries[i];
|
TestEntry *testEntry = testEntries[i];
|
||||||
BEntry entry(testEntry->cpath);
|
BEntry entry(testEntry->cpath);
|
||||||
BEntry entry2(entry);
|
BEntry entry2(entry);
|
||||||
@@ -2080,7 +2080,7 @@ EntryTest::AssignmentTest()
|
|||||||
|
|
||||||
// 2. assignment operator
|
// 2. assignment operator
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
@@ -2090,7 +2090,7 @@ EntryTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( equals(entry2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(entry2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
CPPUNIT_ASSERT( entry == entry2 );
|
CPPUNIT_ASSERT( entry == entry2 );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
@@ -2102,7 +2102,7 @@ EntryTest::AssignmentTest()
|
|||||||
}
|
}
|
||||||
// initialized
|
// initialized
|
||||||
for (int32 i = 0; i < testEntryCount; i++) {
|
for (int32 i = 0; i < testEntryCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestEntry *testEntry = testEntries[i];
|
TestEntry *testEntry = testEntries[i];
|
||||||
BEntry entry(testEntry->cpath);
|
BEntry entry(testEntry->cpath);
|
||||||
BEntry entry2;
|
BEntry entry2;
|
||||||
@@ -2167,7 +2167,7 @@ EntryTest::CFunctionsTest()
|
|||||||
};
|
};
|
||||||
int32 testEntryCount = sizeof(testEntries) / sizeof(TestEntry*);
|
int32 testEntryCount = sizeof(testEntries) / sizeof(TestEntry*);
|
||||||
for (int32 i = 0; i < testEntryCount; i++) {
|
for (int32 i = 0; i < testEntryCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestEntry *testEntry = testEntries[i];
|
TestEntry *testEntry = testEntries[i];
|
||||||
const char *path = testEntry->cpath;
|
const char *path = testEntry->cpath;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -2205,7 +2205,7 @@ EntryTest::CFunctionsTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// root dir
|
// root dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
entry_ref ref, ref2;
|
entry_ref ref, ref2;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path("/", &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path("/", &ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( get_entry_ref_for_entry("/", ".", &ref2) == B_OK );
|
CPPUNIT_ASSERT( get_entry_ref_for_entry("/", ".", &ref2) == B_OK );
|
||||||
@@ -2214,7 +2214,7 @@ EntryTest::CFunctionsTest()
|
|||||||
CPPUNIT_ASSERT( strcmp(ref.name, ref2.name) == 0 );
|
CPPUNIT_ASSERT( strcmp(ref.name, ref2.name) == 0 );
|
||||||
CPPUNIT_ASSERT( ref == ref2 );
|
CPPUNIT_ASSERT( ref == ref2 );
|
||||||
// fs root dir
|
// fs root dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( get_ref_for_path("/boot", &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path("/boot", &ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( get_entry_ref_for_entry("/", "boot", &ref2) == B_OK );
|
CPPUNIT_ASSERT( get_entry_ref_for_entry("/", "boot", &ref2) == B_OK );
|
||||||
CPPUNIT_ASSERT( ref.device == ref2.device );
|
CPPUNIT_ASSERT( ref.device == ref2.device );
|
||||||
@@ -2222,7 +2222,7 @@ EntryTest::CFunctionsTest()
|
|||||||
CPPUNIT_ASSERT( strcmp(ref.name, ref2.name) == 0 );
|
CPPUNIT_ASSERT( strcmp(ref.name, ref2.name) == 0 );
|
||||||
CPPUNIT_ASSERT( ref == ref2 );
|
CPPUNIT_ASSERT( ref == ref2 );
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
ref = entry_ref();
|
ref = entry_ref();
|
||||||
ref2 = entry_ref();
|
ref2 = entry_ref();
|
||||||
CPPUNIT_ASSERT( ref == ref2 );
|
CPPUNIT_ASSERT( ref == ref2 );
|
||||||
@@ -2670,3 +2670,7 @@ resolve_link(TestEntry *entry)
|
|||||||
}
|
}
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
#ifndef __sk_entry_test_h__
|
#ifndef __sk_entry_test_h__
|
||||||
#define __sk_entry_test_h__
|
#define __sk_entry_test_h__
|
||||||
|
|
||||||
|
#include <TestUtils.h>
|
||||||
#include "StatableTest.h"
|
#include "StatableTest.h"
|
||||||
|
|
||||||
#include "StorageKitTester.h"
|
|
||||||
#include "TestUtils.h"
|
|
||||||
|
|
||||||
class BEntry;
|
class BEntry;
|
||||||
struct TestEntry;
|
struct TestEntry;
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <cppunit/TestCaller.h>
|
#include <cppunit/TestCaller.h>
|
||||||
#include <cppunit/TestSuite.h>
|
#include <cppunit/TestSuite.h>
|
||||||
|
#include <TestShell.h>
|
||||||
|
|
||||||
#include "StorageKitTester.h" // For "shell" global variable
|
|
||||||
#include "FileTest.h"
|
#include "FileTest.h"
|
||||||
|
|
||||||
// Suite
|
// Suite
|
||||||
@@ -87,13 +87,13 @@ FileTest::InitTest1()
|
|||||||
void testAll() const
|
void testAll() const
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < initTestCasesCount; i++) {
|
for (int32 i = 0; i < initTestCasesCount; i++) {
|
||||||
if (shell.BeVerbose()) {
|
if (BTestShell::GlobalBeVerbose()) {
|
||||||
printf("[%ld]", i);
|
printf("[%ld]", i);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
test(initTestCases[i]);
|
test(initTestCases[i]);
|
||||||
}
|
}
|
||||||
if (shell.BeVerbose())
|
if (BTestShell::GlobalBeVerbose())
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,13 +196,13 @@ FileTest::InitTest2()
|
|||||||
void testAll() const
|
void testAll() const
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < initTestCasesCount; i++) {
|
for (int32 i = 0; i < initTestCasesCount; i++) {
|
||||||
if (shell.BeVerbose()) {
|
if (BTestShell::GlobalBeVerbose()) {
|
||||||
printf("[%ld]", i);
|
printf("[%ld]", i);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
test(initTestCases[i]);
|
test(initTestCases[i]);
|
||||||
}
|
}
|
||||||
if (shell.BeVerbose())
|
if (BTestShell::GlobalBeVerbose())
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,31 +310,31 @@ FileTest::InitTest2()
|
|||||||
void
|
void
|
||||||
FileTest::RWAbleTest()
|
FileTest::RWAbleTest()
|
||||||
{
|
{
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file;
|
BFile file;
|
||||||
CPPUNIT_ASSERT( file.IsReadable() == false );
|
CPPUNIT_ASSERT( file.IsReadable() == false );
|
||||||
CPPUNIT_ASSERT( file.IsWritable() == false );
|
CPPUNIT_ASSERT( file.IsWritable() == false );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_READ_ONLY);
|
BFile file(existingFilename, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.IsReadable() == true );
|
CPPUNIT_ASSERT( file.IsReadable() == true );
|
||||||
CPPUNIT_ASSERT( file.IsWritable() == false );
|
CPPUNIT_ASSERT( file.IsWritable() == false );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_WRITE_ONLY);
|
BFile file(existingFilename, B_WRITE_ONLY);
|
||||||
CPPUNIT_ASSERT( file.IsReadable() == false );
|
CPPUNIT_ASSERT( file.IsReadable() == false );
|
||||||
CPPUNIT_ASSERT( file.IsWritable() == true );
|
CPPUNIT_ASSERT( file.IsWritable() == true );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_READ_WRITE);
|
BFile file(existingFilename, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.IsReadable() == true );
|
CPPUNIT_ASSERT( file.IsReadable() == true );
|
||||||
CPPUNIT_ASSERT( file.IsWritable() == true );
|
CPPUNIT_ASSERT( file.IsWritable() == true );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(nonExistingFilename, B_READ_WRITE);
|
BFile file(nonExistingFilename, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.IsReadable() == false );
|
CPPUNIT_ASSERT( file.IsReadable() == false );
|
||||||
@@ -347,7 +347,7 @@ void
|
|||||||
FileTest::RWTest()
|
FileTest::RWTest()
|
||||||
{
|
{
|
||||||
// read/write an uninitialized BFile
|
// read/write an uninitialized BFile
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BFile file;
|
BFile file;
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
CPPUNIT_ASSERT( file.Read(buffer, sizeof(buffer)) < 0 );
|
CPPUNIT_ASSERT( file.Read(buffer, sizeof(buffer)) < 0 );
|
||||||
@@ -356,7 +356,7 @@ FileTest::RWTest()
|
|||||||
CPPUNIT_ASSERT( file.WriteAt(0, buffer, sizeof(buffer)) < 0 );
|
CPPUNIT_ASSERT( file.WriteAt(0, buffer, sizeof(buffer)) < 0 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// read/write an file opened for writing/reading only
|
// read/write an file opened for writing/reading only
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(existingFilename, B_WRITE_ONLY);
|
file.SetTo(existingFilename, B_WRITE_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.Read(buffer, sizeof(buffer)) < 0 );
|
CPPUNIT_ASSERT( file.Read(buffer, sizeof(buffer)) < 0 );
|
||||||
@@ -367,14 +367,14 @@ FileTest::RWTest()
|
|||||||
CPPUNIT_ASSERT( file.WriteAt(0, buffer, sizeof(buffer)) < 0 );
|
CPPUNIT_ASSERT( file.WriteAt(0, buffer, sizeof(buffer)) < 0 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// read from an empty file
|
// read from an empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(existingFilename, B_READ_ONLY);
|
file.SetTo(existingFilename, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.Read(buffer, sizeof(buffer)) == 0 );
|
CPPUNIT_ASSERT( file.Read(buffer, sizeof(buffer)) == 0 );
|
||||||
CPPUNIT_ASSERT( file.ReadAt(0, buffer, sizeof(buffer)) == 0 );
|
CPPUNIT_ASSERT( file.ReadAt(0, buffer, sizeof(buffer)) == 0 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// read from past an empty file
|
// read from past an empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(existingFilename, B_READ_ONLY);
|
file.SetTo(existingFilename, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.Seek(10, SEEK_SET) == 10 );
|
CPPUNIT_ASSERT( file.Seek(10, SEEK_SET) == 10 );
|
||||||
@@ -383,7 +383,7 @@ FileTest::RWTest()
|
|||||||
file.Unset();
|
file.Unset();
|
||||||
// create a new empty file and write some data into it, then
|
// create a new empty file and write some data into it, then
|
||||||
// read the file and check the data
|
// read the file and check the data
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
char writeBuffer[256];
|
char writeBuffer[256];
|
||||||
@@ -406,7 +406,7 @@ FileTest::RWTest()
|
|||||||
file.Unset();
|
file.Unset();
|
||||||
execCommand(string("rm -f ") + testFilename1);
|
execCommand(string("rm -f ") + testFilename1);
|
||||||
// same procedure, just using ReadAt()/WriteAt()
|
// same procedure, just using ReadAt()/WriteAt()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.WriteAt(80, writeBuffer + 80, 50) == 50 );
|
CPPUNIT_ASSERT( file.WriteAt(80, writeBuffer + 80, 50) == 50 );
|
||||||
@@ -431,7 +431,7 @@ FileTest::RWTest()
|
|||||||
file.Unset();
|
file.Unset();
|
||||||
execCommand(string("rm -f ") + testFilename1);
|
execCommand(string("rm -f ") + testFilename1);
|
||||||
// write past the end of a file
|
// write past the end of a file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.Seek(128, SEEK_SET) == 128 );
|
CPPUNIT_ASSERT( file.Seek(128, SEEK_SET) == 128 );
|
||||||
@@ -440,7 +440,7 @@ FileTest::RWTest()
|
|||||||
file.Unset();
|
file.Unset();
|
||||||
// open the file with B_OPEN_AT_END flag, Write() some data to it, close
|
// open the file with B_OPEN_AT_END flag, Write() some data to it, close
|
||||||
// and re-open it to check the file
|
// and re-open it to check the file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY | B_OPEN_AT_END);
|
file.SetTo(testFilename1, B_WRITE_ONLY | B_OPEN_AT_END);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
for (int32 i = 0; i < 256; i++)
|
for (int32 i = 0; i < 256; i++)
|
||||||
@@ -457,7 +457,7 @@ FileTest::RWTest()
|
|||||||
file.Unset();
|
file.Unset();
|
||||||
// open the file with B_OPEN_AT_END flag, WriteAt() some data to it, close
|
// open the file with B_OPEN_AT_END flag, WriteAt() some data to it, close
|
||||||
// and re-open it to check the file
|
// and re-open it to check the file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY | B_OPEN_AT_END);
|
file.SetTo(testFilename1, B_WRITE_ONLY | B_OPEN_AT_END);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
for (int32 i = 0; i < 256; i++)
|
for (int32 i = 0; i < 256; i++)
|
||||||
@@ -471,7 +471,7 @@ FileTest::RWTest()
|
|||||||
CPPUNIT_ASSERT( readBuffer[i] == 42 );
|
CPPUNIT_ASSERT( readBuffer[i] == 42 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// open the file with B_OPEN_AT_END flag, ReadAt() some data
|
// open the file with B_OPEN_AT_END flag, ReadAt() some data
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_READ_ONLY | B_OPEN_AT_END);
|
file.SetTo(testFilename1, B_READ_ONLY | B_OPEN_AT_END);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
for (int32 i = 0; i < 256; i++)
|
for (int32 i = 0; i < 256; i++)
|
||||||
@@ -484,7 +484,7 @@ FileTest::RWTest()
|
|||||||
CPPUNIT_ASSERT( readBuffer[i] == 42 );
|
CPPUNIT_ASSERT( readBuffer[i] == 42 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// same procedure, just using Seek() and Read()
|
// same procedure, just using Seek() and Read()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_READ_ONLY | B_OPEN_AT_END);
|
file.SetTo(testFilename1, B_READ_ONLY | B_OPEN_AT_END);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
for (int32 i = 0; i < 256; i++)
|
for (int32 i = 0; i < 256; i++)
|
||||||
@@ -506,14 +506,14 @@ void
|
|||||||
FileTest::PositionTest()
|
FileTest::PositionTest()
|
||||||
{
|
{
|
||||||
// unitialized file
|
// unitialized file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BFile file;
|
BFile file;
|
||||||
CPPUNIT_ASSERT( file.Position() == B_FILE_ERROR );
|
CPPUNIT_ASSERT( file.Position() == B_FILE_ERROR );
|
||||||
CPPUNIT_ASSERT( file.Seek(10, SEEK_SET) == B_FILE_ERROR );
|
CPPUNIT_ASSERT( file.Seek(10, SEEK_SET) == B_FILE_ERROR );
|
||||||
CPPUNIT_ASSERT( file.Seek(10, SEEK_END) == B_FILE_ERROR );
|
CPPUNIT_ASSERT( file.Seek(10, SEEK_END) == B_FILE_ERROR );
|
||||||
CPPUNIT_ASSERT( file.Seek(10, SEEK_CUR) == B_FILE_ERROR );
|
CPPUNIT_ASSERT( file.Seek(10, SEEK_CUR) == B_FILE_ERROR );
|
||||||
// open new file, write some bytes to it and seek a bit around
|
// open new file, write some bytes to it and seek a bit around
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
file.SetTo(testFilename1, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.Position() == 0 );
|
CPPUNIT_ASSERT( file.Position() == 0 );
|
||||||
@@ -533,7 +533,7 @@ FileTest::PositionTest()
|
|||||||
// means, that all write()s append their data at the end. The behavior
|
// means, that all write()s append their data at the end. The behavior
|
||||||
// of Seek() and Position() is a bit unclear for this case.
|
// of Seek() and Position() is a bit unclear for this case.
|
||||||
/*
|
/*
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_READ_ONLY | B_OPEN_AT_END);
|
file.SetTo(testFilename1, B_READ_ONLY | B_OPEN_AT_END);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.Position() == 256 );
|
CPPUNIT_ASSERT( file.Position() == 256 );
|
||||||
@@ -553,13 +553,13 @@ void
|
|||||||
FileTest::SizeTest()
|
FileTest::SizeTest()
|
||||||
{
|
{
|
||||||
// unitialized file
|
// unitialized file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BFile file;
|
BFile file;
|
||||||
off_t size;
|
off_t size;
|
||||||
CPPUNIT_ASSERT( file.GetSize(&size) != B_OK );
|
CPPUNIT_ASSERT( file.GetSize(&size) != B_OK );
|
||||||
CPPUNIT_ASSERT( file.SetSize(100) != B_OK );
|
CPPUNIT_ASSERT( file.SetSize(100) != B_OK );
|
||||||
// read only file
|
// read only file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_READ_ONLY | B_CREATE_FILE);
|
file.SetTo(testFilename1, B_READ_ONLY | B_CREATE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
||||||
@@ -569,7 +569,7 @@ FileTest::SizeTest()
|
|||||||
CPPUNIT_ASSERT( size == 100 );
|
CPPUNIT_ASSERT( size == 100 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// shorten existing file
|
// shorten existing file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY);
|
file.SetTo(testFilename1, B_WRITE_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
||||||
@@ -579,7 +579,7 @@ FileTest::SizeTest()
|
|||||||
CPPUNIT_ASSERT( size == 73 );
|
CPPUNIT_ASSERT( size == 73 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// enlarge existing file
|
// enlarge existing file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_READ_WRITE);
|
file.SetTo(testFilename1, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
||||||
@@ -589,7 +589,7 @@ FileTest::SizeTest()
|
|||||||
CPPUNIT_ASSERT( size == 147 );
|
CPPUNIT_ASSERT( size == 147 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// erase existing file (read only)
|
// erase existing file (read only)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_READ_ONLY | B_ERASE_FILE);
|
file.SetTo(testFilename1, B_READ_ONLY | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
||||||
@@ -599,7 +599,7 @@ FileTest::SizeTest()
|
|||||||
CPPUNIT_ASSERT( size == 132 );
|
CPPUNIT_ASSERT( size == 132 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// erase existing file (write only)
|
// erase existing file (write only)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_WRITE_ONLY | B_ERASE_FILE);
|
file.SetTo(testFilename1, B_WRITE_ONLY | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
||||||
@@ -609,7 +609,7 @@ FileTest::SizeTest()
|
|||||||
CPPUNIT_ASSERT( size == 93 );
|
CPPUNIT_ASSERT( size == 93 );
|
||||||
file.Unset();
|
file.Unset();
|
||||||
// erase existing file using SetSize()
|
// erase existing file using SetSize()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
file.SetTo(testFilename1, B_READ_WRITE);
|
file.SetTo(testFilename1, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
CPPUNIT_ASSERT( file.GetSize(&size) == B_OK );
|
||||||
@@ -627,7 +627,7 @@ FileTest::AssignmentTest()
|
|||||||
{
|
{
|
||||||
// copy constructor
|
// copy constructor
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file;
|
BFile file;
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( file.InitCheck() == B_NO_INIT );
|
||||||
@@ -636,7 +636,7 @@ FileTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( equals(file2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(file2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
}
|
}
|
||||||
// existing file, different open modes
|
// existing file, different open modes
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_READ_ONLY);
|
BFile file(existingFilename, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -645,7 +645,7 @@ FileTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( file2.IsReadable() == true );
|
CPPUNIT_ASSERT( file2.IsReadable() == true );
|
||||||
CPPUNIT_ASSERT( file2.IsWritable() == false );
|
CPPUNIT_ASSERT( file2.IsWritable() == false );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_WRITE_ONLY);
|
BFile file(existingFilename, B_WRITE_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -654,7 +654,7 @@ FileTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( file2.IsReadable() == false );
|
CPPUNIT_ASSERT( file2.IsReadable() == false );
|
||||||
CPPUNIT_ASSERT( file2.IsWritable() == true );
|
CPPUNIT_ASSERT( file2.IsWritable() == true );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_READ_WRITE);
|
BFile file(existingFilename, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -665,7 +665,7 @@ FileTest::AssignmentTest()
|
|||||||
}
|
}
|
||||||
// assignment operator
|
// assignment operator
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file;
|
BFile file;
|
||||||
BFile file2;
|
BFile file2;
|
||||||
@@ -673,7 +673,7 @@ FileTest::AssignmentTest()
|
|||||||
// R5 returns B_BAD_VALUE instead of B_NO_INIT
|
// R5 returns B_BAD_VALUE instead of B_NO_INIT
|
||||||
CPPUNIT_ASSERT( equals(file2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(file2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file;
|
BFile file;
|
||||||
BFile file2(existingFilename, B_READ_ONLY);
|
BFile file2(existingFilename, B_READ_ONLY);
|
||||||
@@ -683,7 +683,7 @@ FileTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( equals(file2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(file2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
}
|
}
|
||||||
// existing file, different open modes
|
// existing file, different open modes
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_READ_ONLY);
|
BFile file(existingFilename, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -693,7 +693,7 @@ FileTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( file2.IsReadable() == true );
|
CPPUNIT_ASSERT( file2.IsReadable() == true );
|
||||||
CPPUNIT_ASSERT( file2.IsWritable() == false );
|
CPPUNIT_ASSERT( file2.IsWritable() == false );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_WRITE_ONLY);
|
BFile file(existingFilename, B_WRITE_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -703,7 +703,7 @@ FileTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( file2.IsReadable() == false );
|
CPPUNIT_ASSERT( file2.IsReadable() == false );
|
||||||
CPPUNIT_ASSERT( file2.IsWritable() == true );
|
CPPUNIT_ASSERT( file2.IsWritable() == true );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(existingFilename, B_READ_WRITE);
|
BFile file(existingFilename, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -766,3 +766,13 @@ const FileTest::InitTestCase FileTest::initTestCases[] = {
|
|||||||
const int32 FileTest::initTestCasesCount
|
const int32 FileTest::initTestCasesCount
|
||||||
= sizeof(FileTest::initTestCases) / sizeof(FileTest::InitTestCase);
|
= sizeof(FileTest::initTestCases) / sizeof(FileTest::InitTestCase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Volume.h>
|
#include <Volume.h>
|
||||||
|
|
||||||
#include "StorageKitTester.h"
|
|
||||||
|
|
||||||
|
|
||||||
const directory_which directories[] = {
|
const directory_which directories[] = {
|
||||||
@@ -363,30 +362,30 @@ void
|
|||||||
FindDirectoryTest::Test()
|
FindDirectoryTest::Test()
|
||||||
{
|
{
|
||||||
// /boot
|
// /boot
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
dev_t device = dev_for_path("/boot");
|
dev_t device = dev_for_path("/boot");
|
||||||
CPPUNIT_ASSERT( device > 0 );
|
CPPUNIT_ASSERT( device > 0 );
|
||||||
TestDirectories(device);
|
TestDirectories(device);
|
||||||
// /dev
|
// /dev
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
device = dev_for_path("/dev");
|
device = dev_for_path("/dev");
|
||||||
CPPUNIT_ASSERT( device > 0 );
|
CPPUNIT_ASSERT( device > 0 );
|
||||||
TestDirectories(device);
|
TestDirectories(device);
|
||||||
// /
|
// /
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
device = dev_for_path("/");
|
device = dev_for_path("/");
|
||||||
CPPUNIT_ASSERT( device > 0 );
|
CPPUNIT_ASSERT( device > 0 );
|
||||||
TestDirectories(device);
|
TestDirectories(device);
|
||||||
// test image
|
// test image
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
device = dev_for_path(testMountPoint);
|
device = dev_for_path(testMountPoint);
|
||||||
CPPUNIT_ASSERT( device > 0 );
|
CPPUNIT_ASSERT( device > 0 );
|
||||||
TestDirectories(device);
|
TestDirectories(device);
|
||||||
// invalid device ID
|
// invalid device ID
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestDirectories(-1);
|
TestDirectories(-1);
|
||||||
// NULL BVolume
|
// NULL BVolume
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
for (int32 i = 0; i < directoryCount; i++) {
|
for (int32 i = 0; i < directoryCount; i++) {
|
||||||
BPath path;
|
BPath path;
|
||||||
BPath path2;
|
BPath path2;
|
||||||
@@ -397,7 +396,7 @@ FindDirectoryTest::Test()
|
|||||||
CPPUNIT_ASSERT( path == path2 );
|
CPPUNIT_ASSERT( path == path2 );
|
||||||
}
|
}
|
||||||
// no such volume
|
// no such volume
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
device = 213;
|
device = 213;
|
||||||
fs_info info;
|
fs_info info;
|
||||||
while (fs_stat_dev(device, &info) == 0)
|
while (fs_stat_dev(device, &info) == 0)
|
||||||
@@ -417,19 +416,23 @@ FindDirectoryTest::Test()
|
|||||||
}
|
}
|
||||||
// bad args
|
// bad args
|
||||||
// R5: crashes
|
// R5: crashes
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
device = dev_for_path("/boot");
|
device = dev_for_path("/boot");
|
||||||
CPPUNIT_ASSERT( device > 0 );
|
CPPUNIT_ASSERT( device > 0 );
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( find_directory(B_BEOS_DIRECTORY, NULL, false, NULL)
|
CPPUNIT_ASSERT( find_directory(B_BEOS_DIRECTORY, NULL, false, NULL)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( find_directory(B_BEOS_DIRECTORY, device, false, NULL, 50)
|
CPPUNIT_ASSERT( find_directory(B_BEOS_DIRECTORY, device, false, NULL, 50)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
#endif
|
#endif
|
||||||
// small buffer
|
// small buffer
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
char path3[7];
|
char path3[7];
|
||||||
CPPUNIT_ASSERT( find_directory(B_BEOS_DIRECTORY, device, false, path3, 7)
|
CPPUNIT_ASSERT( find_directory(B_BEOS_DIRECTORY, device, false, path3, 7)
|
||||||
== E2BIG );
|
== E2BIG );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
SubDir OBOS_TOP src tests kits storage ;
|
SubDir OBOS_TOP src tests kits storage ;
|
||||||
|
|
||||||
# EntryTest.cpp
|
|
||||||
# FileTest.cpp
|
|
||||||
# FindDirectoryTest.cpp
|
|
||||||
# MimeTypeTest.cpp
|
|
||||||
# PathTest.cpp
|
|
||||||
# QueryTest.cpp
|
|
||||||
# ResourcesTest.cpp
|
|
||||||
# ResourceStringsTest.cpp
|
|
||||||
# StatableTest.cpp
|
|
||||||
# SymLinkTest.cpp
|
|
||||||
# TestApp.cpp
|
|
||||||
|
|
||||||
CommonTestLib libstoragetest.so
|
CommonTestLib libstoragetest.so
|
||||||
: StorageKitTestAddon.cpp
|
: StorageKitTestAddon.cpp
|
||||||
BasicTest.cpp
|
BasicTest.cpp
|
||||||
DirectoryTest.cpp
|
DirectoryTest.cpp
|
||||||
|
EntryTest.cpp
|
||||||
|
FindDirectoryTest.cpp
|
||||||
|
FileTest.cpp
|
||||||
|
MimeTypeTest.cpp
|
||||||
NodeTest.cpp
|
NodeTest.cpp
|
||||||
PathTest.cpp
|
PathTest.cpp
|
||||||
|
QueryTest.cpp
|
||||||
|
ResourcesTest.cpp
|
||||||
|
ResourceStringsTest.cpp
|
||||||
StatableTest.cpp
|
StatableTest.cpp
|
||||||
TestUtils.cpp
|
SymLinkTest.cpp
|
||||||
: <$(SOURCE_GRIST)>libstorage.so be stdc++.r4
|
: <$(SOURCE_GRIST)>libstorage.so be stdc++.r4
|
||||||
: be stdc++.r4
|
: be stdc++.r4
|
||||||
: storage
|
: storage
|
||||||
@@ -39,7 +35,7 @@ CommonTestLib libstoragetest.so
|
|||||||
# To run the tests some test files must be around.
|
# To run the tests some test files must be around.
|
||||||
{
|
{
|
||||||
local resdir = <storage!kit!test!files>resources ;
|
local resdir = <storage!kit!test!files>resources ;
|
||||||
MakeLocate $(resdir) : [ on libstoragetest.so return $(LOCATE[1]) ] ;
|
MakeLocate $(resdir) : [ on UnitTester return $(LOCATE[1]) ] ;
|
||||||
RelSymLink $(resdir) : [ FDirName $(SUBDIR) resources ] ;
|
RelSymLink $(resdir) : [ FDirName $(SUBDIR) resources ] ;
|
||||||
DEPENDS libstoragetest.so : $(resdir) ;
|
DEPENDS libstoragetest.so : $(resdir) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,9 @@
|
|||||||
#include <StorageKit.h>
|
#include <StorageKit.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
#include <cppunit/TestSuite.h>
|
||||||
#include "StorageKitTester.h"
|
#include <TestApp.h>
|
||||||
#include "TestApp.h"
|
#include <TestUtils.h>
|
||||||
#include "TestUtils.h"
|
|
||||||
|
|
||||||
// MIME database directories
|
// MIME database directories
|
||||||
static const char *testDir = "/tmp/mimeTestDir";
|
static const char *testDir = "/tmp/mimeTestDir";
|
||||||
@@ -107,7 +106,7 @@ void FillWithMimeTypes(ContainerAdapter &container, BMessage &typeMessage, const
|
|||||||
// Suite
|
// Suite
|
||||||
CppUnit::Test*
|
CppUnit::Test*
|
||||||
MimeTypeTest::Suite() {
|
MimeTypeTest::Suite() {
|
||||||
StorageKit::TestSuite *suite = new StorageKit::TestSuite();
|
CppUnit::TestSuite *suite = new CppUnit::TestSuite();
|
||||||
typedef CppUnit::TestCaller<MimeTypeTest> TC;
|
typedef CppUnit::TestCaller<MimeTypeTest> TC;
|
||||||
|
|
||||||
// Tyler
|
// Tyler
|
||||||
@@ -465,7 +464,7 @@ MimeTypeTest::AppHintTest() {
|
|||||||
CHK(entry2.InitCheck() == B_OK);
|
CHK(entry2.InitCheck() == B_OK);
|
||||||
CHK(entry2.GetRef(&appRef2) == B_OK);
|
CHK(entry2.GetRef(&appRef2) == B_OK);
|
||||||
// Uninitialized
|
// Uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime;
|
BMimeType mime;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -474,7 +473,7 @@ MimeTypeTest::AppHintTest() {
|
|||||||
CHK(mime.SetAppHint(&ref) != B_OK); // R5 == B_BAD_VALUE
|
CHK(mime.SetAppHint(&ref) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// NULL params
|
// NULL params
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -491,7 +490,7 @@ MimeTypeTest::AppHintTest() {
|
|||||||
CHK(mime.SetAppHint(NULL) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
CHK(mime.SetAppHint(NULL) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
||||||
}
|
}
|
||||||
// Non-installed type
|
// Non-installed type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -508,7 +507,7 @@ MimeTypeTest::AppHintTest() {
|
|||||||
CHK(ref == appRef);
|
CHK(ref == appRef);
|
||||||
}
|
}
|
||||||
// Installed Type
|
// Installed Type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -532,7 +531,7 @@ MimeTypeTest::AppHintTest() {
|
|||||||
CHK(ref != appRef);
|
CHK(ref != appRef);
|
||||||
}
|
}
|
||||||
// Installed Type, invalid entry_ref
|
// Installed Type, invalid entry_ref
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref(-1, -1, NULL);
|
entry_ref ref(-1, -1, NULL);
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -547,7 +546,7 @@ MimeTypeTest::AppHintTest() {
|
|||||||
CHK(mime.SetAppHint(&ref) != B_OK); // R5 == B_BAD_VALUE
|
CHK(mime.SetAppHint(&ref) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Installed Type, fake/invalid entry_ref
|
// Installed Type, fake/invalid entry_ref
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref(0, 0, "__this_ought_not_exist__");
|
entry_ref ref(0, 0, "__this_ought_not_exist__");
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -562,7 +561,7 @@ MimeTypeTest::AppHintTest() {
|
|||||||
CHK(mime.SetAppHint(&ref) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
CHK(mime.SetAppHint(&ref) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
||||||
}
|
}
|
||||||
// Installed Type, abstract entry_ref
|
// Installed Type, abstract entry_ref
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref fakeRef;
|
entry_ref fakeRef;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -644,7 +643,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
CHK(msg2 == msg3);
|
CHK(msg2 == msg3);
|
||||||
|
|
||||||
// Uninitialized
|
// Uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime;
|
BMimeType mime;
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
@@ -655,7 +654,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NULL params
|
// NULL params
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
@@ -669,22 +668,22 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
CHK(!mime.IsInstalled());
|
CHK(!mime.IsInstalled());
|
||||||
CHK(mime.GetAttrInfo(NULL) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
CHK(mime.GetAttrInfo(NULL) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
||||||
CHK(!mime.IsInstalled());
|
CHK(!mime.IsInstalled());
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(mime.SetAttrInfo(NULL)) != B_OK); // R5 == CRASH!!!
|
CHK(RES(mime.SetAttrInfo(NULL)) != B_OK); // R5 == CRASH!!!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Installed
|
// Installed
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(mime.Install() == B_OK);
|
CHK(mime.Install() == B_OK);
|
||||||
CHK(mime.IsInstalled());
|
CHK(mime.IsInstalled());
|
||||||
CHK(mime.GetAttrInfo(NULL) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
CHK(mime.GetAttrInfo(NULL) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(mime.SetAttrInfo(NULL)) != B_OK); // R5 == CRASH!!!
|
CHK(RES(mime.SetAttrInfo(NULL)) != B_OK); // R5 == CRASH!!!
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Improperly formatted BMessages
|
// Improperly formatted BMessages
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -711,7 +710,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set() with improperly formatted message
|
// Set() with improperly formatted message
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -738,7 +737,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set() with empty message
|
// Set() with empty message
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
BMessage msgEmpty(WHAT);
|
BMessage msgEmpty(WHAT);
|
||||||
@@ -761,7 +760,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set() with extra attributes in message
|
// Set() with extra attributes in message
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
@@ -792,13 +791,13 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
CHK(msg != msg1);
|
CHK(msg != msg1);
|
||||||
|
|
||||||
// Get(extra)
|
// Get(extra)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(mime.GetAttrInfo(&msgExtraGet) == B_OK);
|
CHK(mime.GetAttrInfo(&msgExtraGet) == B_OK);
|
||||||
CHK(msgExtraGet == msgExtraSet);
|
CHK(msgExtraGet == msgExtraSet);
|
||||||
CHK(msgExtraGet != msg1);
|
CHK(msgExtraGet != msg1);
|
||||||
|
|
||||||
// Get(extra and then some)
|
// Get(extra and then some)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(msgExtraGet.AddInt32("more_extras", 101112) == B_OK);
|
CHK(msgExtraGet.AddInt32("more_extras", 101112) == B_OK);
|
||||||
msgExtraGet.RemoveName(typeField); // Clear "type" fields to be fair, since SFE() just adds another
|
msgExtraGet.RemoveName(typeField); // Clear "type" fields to be fair, since SFE() just adds another
|
||||||
CHK(mime.GetAttrInfo(&msgExtraGet) == B_OK); // Reinitializes result (clearing extra fields)
|
CHK(mime.GetAttrInfo(&msgExtraGet) == B_OK); // Reinitializes result (clearing extra fields)
|
||||||
@@ -807,7 +806,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
// Normal Function (Non-installed type)
|
// Normal Function (Non-installed type)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
@@ -829,7 +828,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Normal Function
|
// Normal Function
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -855,7 +854,7 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
CHK(msg != msg2);
|
CHK(msg != msg2);
|
||||||
|
|
||||||
// Followup Set()/Get()
|
// Followup Set()/Get()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(msg.MakeEmpty() == B_OK);
|
CHK(msg.MakeEmpty() == B_OK);
|
||||||
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
||||||
msg2.RemoveName(typeField);
|
msg2.RemoveName(typeField);
|
||||||
@@ -869,13 +868,13 @@ MimeTypeTest::AttrInfoTest() {
|
|||||||
CHK(msg == msg2);
|
CHK(msg == msg2);
|
||||||
|
|
||||||
// Clear
|
// Clear
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(msg.MakeEmpty() == B_OK);
|
CHK(msg.MakeEmpty() == B_OK);
|
||||||
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
||||||
msg2.RemoveName(typeField);
|
msg2.RemoveName(typeField);
|
||||||
CHK(msg != msg1);
|
CHK(msg != msg1);
|
||||||
CHK(msg != msg2);
|
CHK(msg != msg2);
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(mime.SetAttrInfo(NULL)) == B_OK); // R5 == CRASH! despite what one might think should happen
|
CHK(RES(mime.SetAttrInfo(NULL)) == B_OK); // R5 == CRASH! despite what one might think should happen
|
||||||
CHK(RES(mime.GetAttrInfo(&msg)) != B_OK);
|
CHK(RES(mime.GetAttrInfo(&msg)) != B_OK);
|
||||||
CHK(msg1.AddString(typeField, testType) == B_OK); // Add in "type" fields as GFE() does
|
CHK(msg1.AddString(typeField, testType) == B_OK); // Add in "type" fields as GFE() does
|
||||||
@@ -913,7 +912,7 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
CHK(msg2 == msg3);
|
CHK(msg2 == msg3);
|
||||||
|
|
||||||
// Uninitialized
|
// Uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
BMimeType mime;
|
BMimeType mime;
|
||||||
@@ -923,7 +922,7 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
CHK(mime.SetFileExtensions(&msg) != B_OK); // R5 == B_BAD_VALUE
|
CHK(mime.SetFileExtensions(&msg) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// NULL params
|
// NULL params
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -936,7 +935,7 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
// Not installed
|
// Not installed
|
||||||
CHK(mime.GetFileExtensions(NULL) != B_OK); // R5 == B_BAD_VALUE
|
CHK(mime.GetFileExtensions(NULL) != B_OK); // R5 == B_BAD_VALUE
|
||||||
CHK(!mime.IsInstalled());
|
CHK(!mime.IsInstalled());
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(mime.SetFileExtensions(NULL)) == B_OK); // R5 == CRASH!
|
CHK(RES(mime.SetFileExtensions(NULL)) == B_OK); // R5 == CRASH!
|
||||||
CHK(mime.IsInstalled());
|
CHK(mime.IsInstalled());
|
||||||
CHK(RES(mime.GetFileExtensions(&msg)) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
CHK(RES(mime.GetFileExtensions(&msg)) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
||||||
@@ -950,7 +949,7 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Set() with empty message
|
// Set() with empty message
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
BMessage msgEmpty(WHAT);
|
BMessage msgEmpty(WHAT);
|
||||||
@@ -972,7 +971,7 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
CHK(msg == msgEmpty);
|
CHK(msg == msgEmpty);
|
||||||
}
|
}
|
||||||
// Set() with extra attributes in message
|
// Set() with extra attributes in message
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
@@ -1003,13 +1002,13 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
CHK(msg != msg1);
|
CHK(msg != msg1);
|
||||||
|
|
||||||
// Get(extra)
|
// Get(extra)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(mime.GetFileExtensions(&msgExtraGet) == B_OK);
|
CHK(mime.GetFileExtensions(&msgExtraGet) == B_OK);
|
||||||
CHK(msgExtraGet == msgExtraSet);
|
CHK(msgExtraGet == msgExtraSet);
|
||||||
CHK(msgExtraGet != msg1);
|
CHK(msgExtraGet != msg1);
|
||||||
|
|
||||||
// Get(extra and then some)
|
// Get(extra and then some)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(msgExtraGet.AddInt32("more_extras", 101112) == B_OK);
|
CHK(msgExtraGet.AddInt32("more_extras", 101112) == B_OK);
|
||||||
msgExtraGet.RemoveName(typeField); // Clear "type" fields to be fair, since SFE() just adds another
|
msgExtraGet.RemoveName(typeField); // Clear "type" fields to be fair, since SFE() just adds another
|
||||||
CHK(mime.GetFileExtensions(&msgExtraGet) == B_OK); // Reinitializes result (clearing extra fields)
|
CHK(mime.GetFileExtensions(&msgExtraGet) == B_OK); // Reinitializes result (clearing extra fields)
|
||||||
@@ -1018,7 +1017,7 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
// Normal function
|
// Normal function
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg(WHAT);
|
BMessage msg(WHAT);
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -1043,7 +1042,7 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
CHK(msg != msg2);
|
CHK(msg != msg2);
|
||||||
|
|
||||||
// Followup Set()/Get()
|
// Followup Set()/Get()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(msg.MakeEmpty() == B_OK);
|
CHK(msg.MakeEmpty() == B_OK);
|
||||||
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
||||||
msg2.RemoveName(typeField);
|
msg2.RemoveName(typeField);
|
||||||
@@ -1057,13 +1056,13 @@ MimeTypeTest::FileExtensionsTest() {
|
|||||||
CHK(msg == msg2);
|
CHK(msg == msg2);
|
||||||
|
|
||||||
// Clear
|
// Clear
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(msg.MakeEmpty() == B_OK);
|
CHK(msg.MakeEmpty() == B_OK);
|
||||||
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
msg1.RemoveName(typeField); // Clear "type" fields, since SFE() just adds another
|
||||||
msg2.RemoveName(typeField);
|
msg2.RemoveName(typeField);
|
||||||
CHK(msg != msg1);
|
CHK(msg != msg1);
|
||||||
CHK(msg != msg2);
|
CHK(msg != msg2);
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(mime.SetFileExtensions(NULL)) == B_OK); // R5 == CRASH! despite what the BeBook says
|
CHK(RES(mime.SetFileExtensions(NULL)) == B_OK); // R5 == CRASH! despite what the BeBook says
|
||||||
CHK(RES(mime.GetFileExtensions(&msg)) != B_OK);
|
CHK(RES(mime.GetFileExtensions(&msg)) != B_OK);
|
||||||
CHK(msg1.AddString(typeField, testType) == B_OK); // Add in "type" fields as GFE() does
|
CHK(msg1.AddString(typeField, testType) == B_OK); // Add in "type" fields as GFE() does
|
||||||
@@ -1081,7 +1080,7 @@ void
|
|||||||
MimeTypeTest::IconTest(IconHelper &helper) {
|
MimeTypeTest::IconTest(IconHelper &helper) {
|
||||||
BBitmap *bmp = helper.TempBitmap();
|
BBitmap *bmp = helper.TempBitmap();
|
||||||
// Unitialized
|
// Unitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime;
|
BMimeType mime;
|
||||||
CHK(mime.InitCheck() == B_NO_INIT);
|
CHK(mime.InitCheck() == B_NO_INIT);
|
||||||
@@ -1089,7 +1088,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
CHK(helper.SetIcon(mime, bmp) != B_OK); // R5 == B_BAD_VALUE
|
CHK(helper.SetIcon(mime, bmp) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Non-installed type
|
// Non-installed type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1106,7 +1105,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
CHK(*bmp == *helper.Bitmap1());
|
CHK(*bmp == *helper.Bitmap1());
|
||||||
}
|
}
|
||||||
// NULL params
|
// NULL params
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1129,7 +1128,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
CHK(helper.GetIcon(mime, bmp) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
CHK(helper.GetIcon(mime, bmp) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
||||||
}
|
}
|
||||||
// Invalid Bitmap Size (small -- 10x10)
|
// Invalid Bitmap Size (small -- 10x10)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1157,7 +1156,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
CHK(helper.GetIcon(mime, &testBmp) != B_OK); // R5 == B_BAD_VALUE
|
CHK(helper.GetIcon(mime, &testBmp) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Invalid Bitmap Size (large -- 100x100)
|
// Invalid Bitmap Size (large -- 100x100)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1185,7 +1184,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
CHK(helper.GetIcon(mime, &testBmp) != B_OK); // R5 == B_BAD_VALUE
|
CHK(helper.GetIcon(mime, &testBmp) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Invalid Bitmap Color Depth
|
// Invalid Bitmap Color Depth
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1198,7 +1197,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
// Init Test Bitmap
|
// Init Test Bitmap
|
||||||
BBitmap testBmp(helper.BitmapBounds(), B_RGBA32);
|
BBitmap testBmp(helper.BitmapBounds(), B_RGBA32);
|
||||||
// Test Set()
|
// Test Set()
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
fill_bitmap(testBmp, 4);
|
fill_bitmap(testBmp, 4);
|
||||||
CHK(testBmp != *helper.Bitmap1());
|
CHK(testBmp != *helper.Bitmap1());
|
||||||
CHK(RES(helper.SetIcon(mime, helper.Bitmap1())) == B_OK);
|
CHK(RES(helper.SetIcon(mime, helper.Bitmap1())) == B_OK);
|
||||||
@@ -1212,7 +1211,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
CHK(*bmp != testBmp);
|
CHK(*bmp != testBmp);
|
||||||
#endif
|
#endif
|
||||||
// Test Get()
|
// Test Get()
|
||||||
#if SK_TEST_R5
|
#if TEST_R5
|
||||||
fill_bitmap(testBmp, 3);
|
fill_bitmap(testBmp, 3);
|
||||||
CHK(helper.SetIcon(mime, helper.Bitmap1()) == B_OK);
|
CHK(helper.SetIcon(mime, helper.Bitmap1()) == B_OK);
|
||||||
CHK(helper.GetIcon(mime, &testBmp) == B_OK); // R5 == B_OK, but testBmp is not actually modified
|
CHK(helper.GetIcon(mime, &testBmp) == B_OK); // R5 == B_OK, but testBmp is not actually modified
|
||||||
@@ -1220,7 +1219,7 @@ MimeTypeTest::IconTest(IconHelper &helper) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Normal Function
|
// Normal Function
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1255,7 +1254,7 @@ MimeTypeTest::IconForTypeTest(IconForTypeHelper &helper) {
|
|||||||
BBitmap *bmp = helper.TempBitmap();
|
BBitmap *bmp = helper.TempBitmap();
|
||||||
|
|
||||||
// Invalid MIME string
|
// Invalid MIME string
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1273,7 +1272,7 @@ MimeTypeTest::IconForTypeTest(IconForTypeHelper &helper) {
|
|||||||
CHK(*bmp != *helper.Bitmap1());
|
CHK(*bmp != *helper.Bitmap1());
|
||||||
}
|
}
|
||||||
// NULL MIME string (just like calling respective {Get,Set}Icon() function)
|
// NULL MIME string (just like calling respective {Get,Set}Icon() function)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1343,39 +1342,39 @@ MimeTypeTest::InstalledTypesTest() {
|
|||||||
// NULL params
|
// NULL params
|
||||||
{
|
{
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(BMimeType::GetInstalledTypes(NULL)) != B_OK); // R5 == CRASH!!!
|
CHK(RES(BMimeType::GetInstalledTypes(NULL)) != B_OK); // R5 == CRASH!!!
|
||||||
#endif
|
#endif
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(BMimeType::GetInstalledTypes("text", NULL)) != B_OK); // R5 == CRASH!!!
|
CHK(RES(BMimeType::GetInstalledTypes("text", NULL)) != B_OK); // R5 == CRASH!!!
|
||||||
#endif
|
#endif
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(BMimeType::GetInstalledTypes(NULL, &msg) == B_OK); // Same as GetInstalledTypes(&msg)
|
CHK(BMimeType::GetInstalledTypes(NULL, &msg) == B_OK); // Same as GetInstalledTypes(&msg)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(BMimeType::GetInstalledTypes(NULL, NULL)) != B_OK); // R5 == CRASH!!!
|
CHK(RES(BMimeType::GetInstalledTypes(NULL, NULL)) != B_OK); // R5 == CRASH!!!
|
||||||
#endif
|
#endif
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(BMimeType::GetInstalledSupertypes(NULL)) != B_OK); // R5 == CRASH!!!
|
CHK(RES(BMimeType::GetInstalledSupertypes(NULL)) != B_OK); // R5 == CRASH!!!
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Invalid supertype param to GetInstalledTypes(char *super, BMessage*)
|
// Invalid supertype param to GetInstalledTypes(char *super, BMessage*)
|
||||||
{
|
{
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(!BMimeType::IsValid(testTypeSuperInvalid));
|
CHK(!BMimeType::IsValid(testTypeSuperInvalid));
|
||||||
CHK(BMimeType::GetInstalledTypes(testTypeSuperInvalid, &msg) != B_OK); // R5 == B_BAD_VALUE
|
CHK(BMimeType::GetInstalledTypes(testTypeSuperInvalid, &msg) != B_OK); // R5 == B_BAD_VALUE
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(BMimeType::IsValid(testTypeSuperValid));
|
CHK(BMimeType::IsValid(testTypeSuperValid));
|
||||||
CHK(BMimeType::GetInstalledTypes(testTypeSuperValid, &msg) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
CHK(BMimeType::GetInstalledTypes(testTypeSuperValid, &msg) != B_OK); // R5 == B_ENTRY_NOT_FOUND
|
||||||
}
|
}
|
||||||
// Normal Function -- GetInstalledTypes(BMessage*)
|
// Normal Function -- GetInstalledTypes(BMessage*)
|
||||||
// This test gets the list of installed types, then iterates through
|
// This test gets the list of installed types, then iterates through
|
||||||
// the actual database directory listings and verifies they're identical.
|
// the actual database directory listings and verifies they're identical.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
|
|
||||||
@@ -1472,7 +1471,7 @@ MimeTypeTest::InstalledTypesTest() {
|
|||||||
// Normal Function -- GetInstalledSupertypes()/GetInstalledTypes(char*,BMessage*)
|
// Normal Function -- GetInstalledSupertypes()/GetInstalledTypes(char*,BMessage*)
|
||||||
// This test gets the list of installed super types, then iterates through
|
// This test gets the list of installed super types, then iterates through
|
||||||
// the actual database directory listings and verifies they're identical.
|
// the actual database directory listings and verifies they're identical.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
|
|
||||||
@@ -1619,7 +1618,7 @@ MimeTypeTest::DescriptionTest(GetDescriptionFunc getDescr, SetDescriptionFunc se
|
|||||||
char str[B_MIME_TYPE_LENGTH+1];
|
char str[B_MIME_TYPE_LENGTH+1];
|
||||||
|
|
||||||
// Uninitialized
|
// Uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime;
|
BMimeType mime;
|
||||||
CPPUNIT_ASSERT(mime.InitCheck() == B_NO_INIT);
|
CPPUNIT_ASSERT(mime.InitCheck() == B_NO_INIT);
|
||||||
@@ -1627,7 +1626,7 @@ MimeTypeTest::DescriptionTest(GetDescriptionFunc getDescr, SetDescriptionFunc se
|
|||||||
CPPUNIT_ASSERT((mime.*setDescr)(str) != B_OK); // R5 == B_BAD_VALUE
|
CPPUNIT_ASSERT((mime.*setDescr)(str) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Non-installed type
|
// Non-installed type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1643,9 +1642,9 @@ MimeTypeTest::DescriptionTest(GetDescriptionFunc getDescr, SetDescriptionFunc se
|
|||||||
CHK(strcmp(str, testDescr) == 0);
|
CHK(strcmp(str, testDescr) == 0);
|
||||||
}
|
}
|
||||||
// Non-installed type, NULL params
|
// Non-installed type, NULL params
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
#if !SK_TEST_R5 // NOTE: These tests crash for R5::LongDescription calls but not for R5::ShortDescription
|
#if !TEST_R5 // NOTE: These tests crash for R5::LongDescription calls but not for R5::ShortDescription
|
||||||
// calls. Considering the general instability exihibited by most R5 calls when passed
|
// calls. Considering the general instability exihibited by most R5 calls when passed
|
||||||
// NULL pointers, however, I wouldn't suggest it, and thus they aren't even tested here.
|
// NULL pointers, however, I wouldn't suggest it, and thus they aren't even tested here.
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -1666,7 +1665,7 @@ MimeTypeTest::DescriptionTest(GetDescriptionFunc getDescr, SetDescriptionFunc se
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Installed type
|
// Installed type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1688,7 +1687,7 @@ MimeTypeTest::DescriptionTest(GetDescriptionFunc getDescr, SetDescriptionFunc se
|
|||||||
CHK(strcmp(str, testDescr2) == 0);
|
CHK(strcmp(str, testDescr2) == 0);
|
||||||
}
|
}
|
||||||
// Installed Type, Description Too Long
|
// Installed Type, Description Too Long
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
CHK(strlen(longDescr) > (B_MIME_TYPE_LENGTH+1));
|
CHK(strlen(longDescr) > (B_MIME_TYPE_LENGTH+1));
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -1719,7 +1718,7 @@ MimeTypeTest::PreferredAppTest() {
|
|||||||
sprintf(str, "%s", testSig);
|
sprintf(str, "%s", testSig);
|
||||||
|
|
||||||
// Uninitialized
|
// Uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime;
|
BMimeType mime;
|
||||||
CPPUNIT_ASSERT(mime.InitCheck() == B_NO_INIT);
|
CPPUNIT_ASSERT(mime.InitCheck() == B_NO_INIT);
|
||||||
@@ -1727,7 +1726,7 @@ MimeTypeTest::PreferredAppTest() {
|
|||||||
CPPUNIT_ASSERT(mime.SetPreferredApp(str) != B_OK); // R5 == B_BAD_VALUE
|
CPPUNIT_ASSERT(mime.SetPreferredApp(str) != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Non-installed type
|
// Non-installed type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1743,7 +1742,7 @@ MimeTypeTest::PreferredAppTest() {
|
|||||||
CHK(strcmp(str, testSig) == 0);
|
CHK(strcmp(str, testSig) == 0);
|
||||||
}
|
}
|
||||||
// Non-installed type, NULL params
|
// Non-installed type, NULL params
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1758,7 +1757,7 @@ MimeTypeTest::PreferredAppTest() {
|
|||||||
CHK(mime.GetPreferredApp(str) == B_ENTRY_NOT_FOUND);
|
CHK(mime.GetPreferredApp(str) == B_ENTRY_NOT_FOUND);
|
||||||
}
|
}
|
||||||
// Installed type, NULL params
|
// Installed type, NULL params
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1773,7 +1772,7 @@ MimeTypeTest::PreferredAppTest() {
|
|||||||
CHK(mime.GetPreferredApp(NULL) != B_OK); // R5 == B_BAD_ADDRESS
|
CHK(mime.GetPreferredApp(NULL) != B_OK); // R5 == B_BAD_ADDRESS
|
||||||
}
|
}
|
||||||
// Installed type
|
// Installed type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
CHK(mime.InitCheck() == B_OK);
|
CHK(mime.InitCheck() == B_OK);
|
||||||
@@ -1795,7 +1794,7 @@ MimeTypeTest::PreferredAppTest() {
|
|||||||
CHK(strcmp(str, testSig2) == 0);
|
CHK(strcmp(str, testSig2) == 0);
|
||||||
}
|
}
|
||||||
// Installed Type, Signature Too Long
|
// Installed Type, Signature Too Long
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
CHK(strlen(longDescr) > (B_MIME_TYPE_LENGTH+1));
|
CHK(strlen(longDescr) > (B_MIME_TYPE_LENGTH+1));
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -1866,7 +1865,7 @@ type_exists(const char *type, const char *databaseDir) {
|
|||||||
void
|
void
|
||||||
MimeTypeTest::InstallDeleteTest() {
|
MimeTypeTest::InstallDeleteTest() {
|
||||||
// Uninitialzized
|
// Uninitialzized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime;
|
BMimeType mime;
|
||||||
CHK(mime.InitCheck() == B_NO_INIT);
|
CHK(mime.InitCheck() == B_NO_INIT);
|
||||||
@@ -1875,7 +1874,7 @@ MimeTypeTest::InstallDeleteTest() {
|
|||||||
CHK(mime.Delete() != B_OK); // R5 == B_BAD_VALUE
|
CHK(mime.Delete() != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Invalid Type String
|
// Invalid Type String
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType mime(testTypeInvalid);
|
BMimeType mime(testTypeInvalid);
|
||||||
CHK(mime.InitCheck() != B_OK); // R5 == B_BAD_VALUE
|
CHK(mime.InitCheck() != B_OK); // R5 == B_BAD_VALUE
|
||||||
@@ -1884,7 +1883,7 @@ MimeTypeTest::InstallDeleteTest() {
|
|||||||
CHK(mime.Delete() != B_OK); // R5 == B_BAD_VALUE
|
CHK(mime.Delete() != B_OK); // R5 == B_BAD_VALUE
|
||||||
}
|
}
|
||||||
// Normal function
|
// Normal function
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
remove_type(testType);
|
remove_type(testType);
|
||||||
BMimeType mime(testType);
|
BMimeType mime(testType);
|
||||||
@@ -1895,7 +1894,7 @@ MimeTypeTest::InstallDeleteTest() {
|
|||||||
CHK(mime.Install() == B_OK);
|
CHK(mime.Install() == B_OK);
|
||||||
CHK(type_exists(testType));
|
CHK(type_exists(testType));
|
||||||
CHK(mime.IsInstalled());
|
CHK(mime.IsInstalled());
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(mime.Install() != B_OK); // We ought to return something standard and logical here
|
CHK(mime.Install() != B_OK); // We ought to return something standard and logical here
|
||||||
#endif
|
#endif
|
||||||
CHK(mime.Delete() == B_OK);
|
CHK(mime.Delete() == B_OK);
|
||||||
@@ -1987,7 +1986,7 @@ MimeTypeTest::SupportingAppsTest() {
|
|||||||
CHK(mime.GetSupportingApps(&msg) == B_OK);
|
CHK(mime.GetSupportingApps(&msg) == B_OK);
|
||||||
msg.PrintToStream();
|
msg.PrintToStream();
|
||||||
} */
|
} */
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
std::queue<std::string> typeList; // Stores all installed MIME types
|
std::queue<std::string> typeList; // Stores all installed MIME types
|
||||||
std::queue<std::string> appList; // Stores all installed application subtypes
|
std::queue<std::string> appList; // Stores all installed application subtypes
|
||||||
@@ -2021,16 +2020,16 @@ MimeTypeTest::SupportingAppsTest() {
|
|||||||
void
|
void
|
||||||
MimeTypeTest::WildcardAppsTest() {
|
MimeTypeTest::WildcardAppsTest() {
|
||||||
// NULL param
|
// NULL param
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
#if SK_TEST_R5
|
#if TEST_R5
|
||||||
CHK(BMimeType::GetWildcardApps(NULL) == B_OK); // R5 == B_OK (???)
|
CHK(BMimeType::GetWildcardApps(NULL) == B_OK); // R5 == B_OK (???)
|
||||||
#else
|
#else
|
||||||
CHK(RES(BMimeType::GetWildcardApps(NULL)) != B_OK); // Personally I think we ought to return B_BAD_VALUE
|
CHK(RES(BMimeType::GetWildcardApps(NULL)) != B_OK); // Personally I think we ought to return B_BAD_VALUE
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Normal function (compare to BMimeType("application/octet-stream").GetSupportingApps())
|
// Normal function (compare to BMimeType("application/octet-stream").GetSupportingApps())
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMessage msg1, msg2;
|
BMessage msg1, msg2;
|
||||||
CHK(BMimeType::GetWildcardApps(&msg1) == B_OK);
|
CHK(BMimeType::GetWildcardApps(&msg1) == B_OK);
|
||||||
@@ -2080,7 +2079,7 @@ MimeTypeTest::InitTest()
|
|||||||
init_long_types(notTooLongType, tooLongType);
|
init_long_types(notTooLongType, tooLongType);
|
||||||
|
|
||||||
// default constructor
|
// default constructor
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.InitCheck() == B_NO_INIT);
|
CHK(type.InitCheck() == B_NO_INIT);
|
||||||
@@ -2092,7 +2091,7 @@ MimeTypeTest::InitTest()
|
|||||||
|
|
||||||
// BMimeType(const char *)
|
// BMimeType(const char *)
|
||||||
// valid type
|
// valid type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type(validType);
|
BMimeType type(validType);
|
||||||
CHK(type.InitCheck() == B_OK);
|
CHK(type.InitCheck() == B_OK);
|
||||||
@@ -2102,7 +2101,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// invalid type
|
// invalid type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type(invalidType);
|
BMimeType type(invalidType);
|
||||||
CHK(type.InitCheck() == B_BAD_VALUE);
|
CHK(type.InitCheck() == B_BAD_VALUE);
|
||||||
@@ -2112,7 +2111,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// long, but not too long type
|
// long, but not too long type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type(notTooLongType);
|
BMimeType type(notTooLongType);
|
||||||
CHK(type.InitCheck() == B_OK);
|
CHK(type.InitCheck() == B_OK);
|
||||||
@@ -2122,7 +2121,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// too long type
|
// too long type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type(tooLongType);
|
BMimeType type(tooLongType);
|
||||||
CHK(type.InitCheck() == B_BAD_VALUE);
|
CHK(type.InitCheck() == B_BAD_VALUE);
|
||||||
@@ -2134,7 +2133,7 @@ MimeTypeTest::InitTest()
|
|||||||
|
|
||||||
// SetTo()
|
// SetTo()
|
||||||
// valid type
|
// valid type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetTo(validType) == B_OK);
|
CHK(type.SetTo(validType) == B_OK);
|
||||||
@@ -2145,7 +2144,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// invalid type
|
// invalid type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetTo(invalidType) == B_BAD_VALUE);
|
CHK(type.SetTo(invalidType) == B_BAD_VALUE);
|
||||||
@@ -2156,7 +2155,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// long, but not too long type
|
// long, but not too long type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetTo(notTooLongType) == B_OK);
|
CHK(type.SetTo(notTooLongType) == B_OK);
|
||||||
@@ -2167,7 +2166,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// too long type
|
// too long type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetTo(tooLongType) == B_BAD_VALUE);
|
CHK(type.SetTo(tooLongType) == B_BAD_VALUE);
|
||||||
@@ -2180,7 +2179,7 @@ MimeTypeTest::InitTest()
|
|||||||
|
|
||||||
// SetType()
|
// SetType()
|
||||||
// valid type
|
// valid type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetType(validType) == B_OK);
|
CHK(type.SetType(validType) == B_OK);
|
||||||
@@ -2191,7 +2190,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// invalid type
|
// invalid type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetType(invalidType) == B_BAD_VALUE);
|
CHK(type.SetType(invalidType) == B_BAD_VALUE);
|
||||||
@@ -2202,7 +2201,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// long, but not too long type
|
// long, but not too long type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetType(notTooLongType) == B_OK);
|
CHK(type.SetType(notTooLongType) == B_OK);
|
||||||
@@ -2213,7 +2212,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
}
|
}
|
||||||
// too long type
|
// too long type
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
CHK(type.SetType(tooLongType) == B_BAD_VALUE);
|
CHK(type.SetType(tooLongType) == B_BAD_VALUE);
|
||||||
@@ -2225,7 +2224,7 @@ MimeTypeTest::InitTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reinitialization
|
// reinitialization
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type(validType);
|
BMimeType type(validType);
|
||||||
CHK(type.InitCheck() == B_OK);
|
CHK(type.InitCheck() == B_OK);
|
||||||
@@ -2235,7 +2234,7 @@ MimeTypeTest::InitTest()
|
|||||||
CHK(string(type.Type()) == validType2);
|
CHK(string(type.Type()) == validType2);
|
||||||
}
|
}
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type(NULL);
|
BMimeType type(NULL);
|
||||||
CHK(type.Type() == NULL);
|
CHK(type.Type() == NULL);
|
||||||
@@ -2339,7 +2338,7 @@ MimeTypeTest::StringTest()
|
|||||||
int32 testCount = sizeof(tests) / sizeof(mime_type_test);
|
int32 testCount = sizeof(tests) / sizeof(mime_type_test);
|
||||||
// test loop
|
// test loop
|
||||||
for (int32 i = 0; i < testCount; i++) {
|
for (int32 i = 0; i < testCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
mime_type_test &test = tests[i];
|
mime_type_test &test = tests[i];
|
||||||
BMimeType type(test.type);
|
BMimeType type(test.type);
|
||||||
CHK(type.InitCheck() == test.error);
|
CHK(type.InitCheck() == test.error);
|
||||||
@@ -2400,11 +2399,11 @@ MimeTypeTest::StringTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BMimeType type("image/gif");
|
BMimeType type("image/gif");
|
||||||
// R5: crashes when passing NULL
|
// R5: crashes when passing NULL
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(BMimeType::IsValid(NULL) == false);
|
CHK(BMimeType::IsValid(NULL) == false);
|
||||||
CHK(type.GetSupertype(NULL) == B_BAD_VALUE);
|
CHK(type.GetSupertype(NULL) == B_BAD_VALUE);
|
||||||
CHK(type.Contains(NULL) == false);
|
CHK(type.Contains(NULL) == false);
|
||||||
@@ -2495,7 +2494,7 @@ MimeTypeTest::MonitoringTest()
|
|||||||
// * change something, check message queue (empty)
|
// * change something, check message queue (empty)
|
||||||
|
|
||||||
CHK(fApplication != NULL);
|
CHK(fApplication != NULL);
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
// StartWatching()
|
// StartWatching()
|
||||||
BMessenger target(&fApplication->Handler(), fApplication);
|
BMessenger target(&fApplication->Handler(), fApplication);
|
||||||
CHK(BMimeType::StartWatching(target) == B_OK);
|
CHK(BMimeType::StartWatching(target) == B_OK);
|
||||||
@@ -2557,7 +2556,7 @@ MimeTypeTest::MonitoringTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the same values once again
|
// set the same values once again
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
// icon
|
// icon
|
||||||
CHK(type.SetIcon(iconHelperLarge.Bitmap1(), B_LARGE_ICON) == B_OK);
|
CHK(type.SetIcon(iconHelperLarge.Bitmap1(), B_LARGE_ICON) == B_OK);
|
||||||
CHK(type.SetIcon(iconHelperMini.Bitmap1(), B_MINI_ICON) == B_OK);
|
CHK(type.SetIcon(iconHelperMini.Bitmap1(), B_MINI_ICON) == B_OK);
|
||||||
@@ -2602,7 +2601,7 @@ MimeTypeTest::MonitoringTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set different values
|
// set different values
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
// icon
|
// icon
|
||||||
CHK(type.SetIcon(iconHelperLarge.Bitmap2(), B_LARGE_ICON) == B_OK);
|
CHK(type.SetIcon(iconHelperLarge.Bitmap2(), B_LARGE_ICON) == B_OK);
|
||||||
CHK(type.SetIcon(iconHelperMini.Bitmap2(), B_MINI_ICON) == B_OK);
|
CHK(type.SetIcon(iconHelperMini.Bitmap2(), B_MINI_ICON) == B_OK);
|
||||||
@@ -2691,7 +2690,7 @@ MimeTypeTest::MonitoringTest()
|
|||||||
|
|
||||||
// bad args
|
// bad args
|
||||||
// StopWatching() another target
|
// StopWatching() another target
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
// install
|
// install
|
||||||
CHK(type.InitCheck() == B_OK);
|
CHK(type.InitCheck() == B_OK);
|
||||||
CHK(type.IsInstalled() == false);
|
CHK(type.IsInstalled() == false);
|
||||||
@@ -2702,11 +2701,11 @@ MimeTypeTest::MonitoringTest()
|
|||||||
BMessenger target3("application/does-not_exist");
|
BMessenger target3("application/does-not_exist");
|
||||||
CHK(target3.IsValid() == false);
|
CHK(target3.IsValid() == false);
|
||||||
// R5: An invalid messenger is fine for any reason?!
|
// R5: An invalid messenger is fine for any reason?!
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(RES(BMimeType::StartWatching(target3)) == B_BAD_VALUE);
|
CHK(RES(BMimeType::StartWatching(target3)) == B_BAD_VALUE);
|
||||||
#endif
|
#endif
|
||||||
CHK(BMimeType::StartWatching(target) == B_OK);
|
CHK(BMimeType::StartWatching(target) == B_OK);
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(BMimeType::StopWatching(target3) == B_BAD_VALUE);
|
CHK(BMimeType::StopWatching(target3) == B_BAD_VALUE);
|
||||||
#endif
|
#endif
|
||||||
CHK(BMimeType::StopWatching(target2) == B_BAD_VALUE);
|
CHK(BMimeType::StopWatching(target2) == B_BAD_VALUE);
|
||||||
@@ -2837,7 +2836,7 @@ MimeTypeTest::UpdateMimeInfoTest()
|
|||||||
// * Updating all files is not tested as it takes too long.
|
// * Updating all files is not tested as it takes too long.
|
||||||
|
|
||||||
// individual files
|
// individual files
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
execCommand(string("mkdir ") + testDir + "/subdir1 "
|
execCommand(string("mkdir ") + testDir + "/subdir1 "
|
||||||
+ testDir + "/subdir2 "
|
+ testDir + "/subdir2 "
|
||||||
+ testDir + "/subdir2/subsubdir1");
|
+ testDir + "/subdir2/subsubdir1");
|
||||||
@@ -2904,7 +2903,7 @@ printf("%s <-> %s\n", type.String(), file.type.c_str());
|
|||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
// directory
|
// directory
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
// create
|
// create
|
||||||
for (int32 i = 0; i < fileCount; i++) {
|
for (int32 i = 0; i < fileCount; i++) {
|
||||||
MimeInfoTestFile &file = files[i];
|
MimeInfoTestFile &file = files[i];
|
||||||
@@ -2944,7 +2943,7 @@ printf("%s <-> %s\n", type.String(), file.type.c_str());
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bad args: non-existing file
|
// bad args: non-existing file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BEntry entry(files[0].name.c_str());
|
BEntry entry(files[0].name.c_str());
|
||||||
CHK(entry.InitCheck() == B_OK);
|
CHK(entry.InitCheck() == B_OK);
|
||||||
CHK(entry.Exists() == false);
|
CHK(entry.Exists() == false);
|
||||||
@@ -3107,7 +3106,7 @@ MimeTypeTest::CreateAppMetaMimeTest()
|
|||||||
// * Updating all apps is not tested as it takes too long.
|
// * Updating all apps is not tested as it takes too long.
|
||||||
|
|
||||||
// attributes and resources
|
// attributes and resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
execCommand(string("mkdir ") + testDir + "/subdir1 "
|
execCommand(string("mkdir ") + testDir + "/subdir1 "
|
||||||
+ testDir + "/subdir2 "
|
+ testDir + "/subdir2 "
|
||||||
+ testDir + "/subdir2/subsubdir1");
|
+ testDir + "/subdir2/subsubdir1");
|
||||||
@@ -3134,7 +3133,7 @@ MimeTypeTest::CreateAppMetaMimeTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attributes only
|
// attributes only
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
for (int32 i = 0; i < fileCount; i++) {
|
for (int32 i = 0; i < fileCount; i++) {
|
||||||
// create file, create_app_meta_mime()
|
// create file, create_app_meta_mime()
|
||||||
AppMimeTestFile &file = files[i];
|
AppMimeTestFile &file = files[i];
|
||||||
@@ -3148,7 +3147,7 @@ MimeTypeTest::CreateAppMetaMimeTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resources only
|
// resources only
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
for (int32 i = 0; i < fileCount; i++) {
|
for (int32 i = 0; i < fileCount; i++) {
|
||||||
// create file, create_app_meta_mime()
|
// create file, create_app_meta_mime()
|
||||||
AppMimeTestFile &file = files[i];
|
AppMimeTestFile &file = files[i];
|
||||||
@@ -3243,7 +3242,7 @@ MimeTypeTest::CreateAppMetaMimeTest()
|
|||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
// no signature
|
// no signature
|
||||||
CHK(files[0].Create(false, false) == B_OK);
|
CHK(files[0].Create(false, false) == B_OK);
|
||||||
CHK(create_app_meta_mime(files[0].name.c_str(), false, true, false)
|
CHK(create_app_meta_mime(files[0].name.c_str(), false, true, false)
|
||||||
@@ -3294,7 +3293,7 @@ MimeTypeTest::GetDeviceIconTest()
|
|||||||
};
|
};
|
||||||
const int testCaseCount = sizeof(testCases) / sizeof(test_case);
|
const int testCaseCount = sizeof(testCases) / sizeof(test_case);
|
||||||
for (int32 i = 0; i < testCaseCount; i++) {
|
for (int32 i = 0; i < testCaseCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
test_case &testCase = testCases[i];
|
test_case &testCase = testCases[i];
|
||||||
// get device name from path name
|
// get device name from path name
|
||||||
fs_info info;
|
fs_info info;
|
||||||
@@ -3318,7 +3317,7 @@ MimeTypeTest::GetDeviceIconTest()
|
|||||||
CheckIconData(deviceName, size, buffer);
|
CheckIconData(deviceName, size, buffer);
|
||||||
// bad args: NULL buffer
|
// bad args: NULL buffer
|
||||||
// R5: Wanna see KDL? Here you go...
|
// R5: Wanna see KDL? Here you go...
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(get_device_icon(deviceName, NULL, size) == B_BAD_VALUE);
|
CHK(get_device_icon(deviceName, NULL, size) == B_BAD_VALUE);
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
@@ -3424,7 +3423,7 @@ MimeTypeTest::SnifferRuleTest()
|
|||||||
CHK(type.SetTo(testType) == B_OK);
|
CHK(type.SetTo(testType) == B_OK);
|
||||||
CHK(type.Install() == B_OK);
|
CHK(type.Install() == B_OK);
|
||||||
for (int32 i = 0; i < testCaseCount; i++) {
|
for (int32 i = 0; i < testCaseCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
test_case &testCase = testCases[i];
|
test_case &testCase = testCases[i];
|
||||||
BString parseError;
|
BString parseError;
|
||||||
status_t error = BMimeType::CheckSnifferRule(testCase.rule,
|
status_t error = BMimeType::CheckSnifferRule(testCase.rule,
|
||||||
@@ -3445,19 +3444,19 @@ printf("error: %s\n", parseError.String());
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bad args: NULL rule/result string
|
// bad args: NULL rule/result string
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BString parseError;
|
BString parseError;
|
||||||
CHK(BMimeType::CheckSnifferRule("0.0 ('')", NULL)
|
CHK(BMimeType::CheckSnifferRule("0.0 ('')", NULL)
|
||||||
== B_BAD_MIME_SNIFFER_RULE);
|
== B_BAD_MIME_SNIFFER_RULE);
|
||||||
// R5: crashes when passing a NULL rule/result buffer.
|
// R5: crashes when passing a NULL rule/result buffer.
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CHK(BMimeType::CheckSnifferRule(NULL, &parseError) == B_BAD_VALUE);
|
CHK(BMimeType::CheckSnifferRule(NULL, &parseError) == B_BAD_VALUE);
|
||||||
CHK(BMimeType::CheckSnifferRule(NULL, NULL) == B_BAD_VALUE);
|
CHK(BMimeType::CheckSnifferRule(NULL, NULL) == B_BAD_VALUE);
|
||||||
CHK(type.GetSnifferRule(NULL) == B_BAD_VALUE);
|
CHK(type.GetSnifferRule(NULL) == B_BAD_VALUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NULL rule to SetSnifferRule unsets the attribute
|
// NULL rule to SetSnifferRule unsets the attribute
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CHK(type.IsInstalled() == true);
|
CHK(type.IsInstalled() == true);
|
||||||
CHK(type.SetSnifferRule(NULL) == B_OK);
|
CHK(type.SetSnifferRule(NULL) == B_OK);
|
||||||
BString rule;
|
BString rule;
|
||||||
@@ -3595,7 +3594,7 @@ MimeTypeTest::SniffingTest()
|
|||||||
};
|
};
|
||||||
int fileCount = sizeof(files) / sizeof(SniffingTestFile);
|
int fileCount = sizeof(files) / sizeof(SniffingTestFile);
|
||||||
for (int32 i = 0; i < fileCount; i++) {
|
for (int32 i = 0; i < fileCount; i++) {
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
SniffingTestFile &file = files[i];
|
SniffingTestFile &file = files[i];
|
||||||
const char *filename = file.name.c_str();
|
const char *filename = file.name.c_str();
|
||||||
//printf("file: %s\n", filename);
|
//printf("file: %s\n", filename);
|
||||||
@@ -3636,7 +3635,7 @@ printf("type: %s, should be: %s\n", type.Type(), realType);
|
|||||||
|
|
||||||
// GuessMimeType(const ref*,), invalid/abstract entry
|
// GuessMimeType(const ref*,), invalid/abstract entry
|
||||||
{
|
{
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
const char *filename = (string(testDir) + "/file100.cpp").c_str();
|
const char *filename = (string(testDir) + "/file100.cpp").c_str();
|
||||||
BMimeType type;
|
BMimeType type;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -3650,7 +3649,7 @@ printf("type: %s, should be: %s\n", type.Type(), realType);
|
|||||||
|
|
||||||
// bad args
|
// bad args
|
||||||
{
|
{
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
SniffingTestFile &file = files[0];
|
SniffingTestFile &file = files[0];
|
||||||
CHK(file.Create() == B_OK);
|
CHK(file.Create() == B_OK);
|
||||||
const char *filename = file.name.c_str();
|
const char *filename = file.name.c_str();
|
||||||
@@ -3759,3 +3758,7 @@ printf("type: %s, should be: %s\n", type.Type(), realType);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,3 +72,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
#endif // __sk_mime_type_test_h__
|
#endif // __sk_mime_type_test_h__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <cppunit/TestCase.h>
|
#include <cppunit/TestCase.h>
|
||||||
#include <cppunit/TestCaller.h>
|
#include <cppunit/TestCaller.h>
|
||||||
#include <cppunit/TestSuite.h>
|
#include <cppunit/TestSuite.h>
|
||||||
|
#include <TestUtils.h>
|
||||||
#include <NodeTest.h>
|
#include <NodeTest.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -18,7 +19,6 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
|
|
||||||
#include "TestUtils.h"
|
|
||||||
|
|
||||||
// == for attr_info
|
// == for attr_info
|
||||||
static
|
static
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ NodeTest::AddBaseClassTests(const char *prefix, CppUnit::TestSuite *suite)
|
|||||||
suite->addTest( new TC(p + "BNode::AttrDir Test", &NodeTest::AttrDirTest) );
|
suite->addTest( new TC(p + "BNode::AttrDir Test", &NodeTest::AttrDirTest) );
|
||||||
suite->addTest( new TC(p + "BNode::Attr Test", &NodeTest::AttrTest) );
|
suite->addTest( new TC(p + "BNode::Attr Test", &NodeTest::AttrTest) );
|
||||||
suite->addTest( new TC(p + "BNode::AttrRename Test"
|
suite->addTest( new TC(p + "BNode::AttrRename Test"
|
||||||
#if SK_TEST_R5
|
#if TEST_R5
|
||||||
" (NOTE: test not actually performed with R5 libraries)"
|
" (NOTE: test not actually performed with R5 libraries)"
|
||||||
#endif
|
#endif
|
||||||
, &NodeTest::AttrRenameTest) );
|
, &NodeTest::AttrRenameTest) );
|
||||||
@@ -114,7 +114,7 @@ NodeTest::AddBaseClassTests(const char *prefix, CppUnit::TestSuite *suite)
|
|||||||
suite->addTest( new TC(p + "BNode::Sync Test", &NodeTest::SyncTest) );
|
suite->addTest( new TC(p + "BNode::Sync Test", &NodeTest::SyncTest) );
|
||||||
suite->addTest( new TC(p + "BNode::Dup Test", &NodeTest::DupTest) );
|
suite->addTest( new TC(p + "BNode::Dup Test", &NodeTest::DupTest) );
|
||||||
suite->addTest( new TC(p + "BNode::Lock Test"
|
suite->addTest( new TC(p + "BNode::Lock Test"
|
||||||
#if SK_TEST_OBOS_POSIX
|
#if TEST_OBOS /* !!!POSIX ONLY!!! */
|
||||||
" (NOTE: test not actually performed with OpenBeOS Posix libraries)"
|
" (NOTE: test not actually performed with OpenBeOS Posix libraries)"
|
||||||
#endif
|
#endif
|
||||||
, &NodeTest::LockTest) );
|
, &NodeTest::LockTest) );
|
||||||
@@ -122,3 +122,7 @@ NodeTest::AddBaseClassTests(const char *prefix, CppUnit::TestSuite *suite)
|
|||||||
|
|
||||||
|
|
||||||
#endif // __sk_node_test_h__
|
#endif // __sk_node_test_h__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,15 +18,14 @@
|
|||||||
#include <Query.h>
|
#include <Query.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <Volume.h>
|
#include <Volume.h>
|
||||||
#include "StorageKitTester.h"
|
#include <TestApp.h>
|
||||||
#include "TestApp.h"
|
#include <TestUtils.h>
|
||||||
#include "TestUtils.h"
|
|
||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
class Query : public BQuery {
|
class Query : public BQuery {
|
||||||
public:
|
public:
|
||||||
#if SK_TEST_R5
|
#if TEST_R5
|
||||||
status_t PushValue(int32 value) { PushInt32(value); return B_OK; }
|
status_t PushValue(int32 value) { PushInt32(value); return B_OK; }
|
||||||
status_t PushValue(uint32 value) { PushUInt32(value); return B_OK; }
|
status_t PushValue(uint32 value) { PushUInt32(value); return B_OK; }
|
||||||
status_t PushValue(int64 value) { PushInt64(value); return B_OK; }
|
status_t PushValue(int64 value) { PushInt64(value); return B_OK; }
|
||||||
@@ -659,7 +658,7 @@ TestOperator(query_op op)
|
|||||||
TestPredicate(OpNode(op, new AttributeNode("attribute"), NULL), B_OK,
|
TestPredicate(OpNode(op, new AttributeNode("attribute"), NULL), B_OK,
|
||||||
B_NO_INIT);
|
B_NO_INIT);
|
||||||
// R5: crashs when pushing B_CONTAINS/B_BEGINS/ENDS_WITH on an empty stack
|
// R5: crashs when pushing B_CONTAINS/B_BEGINS/ENDS_WITH on an empty stack
|
||||||
#if SK_TEST_R5
|
#if TEST_R5
|
||||||
if (op < B_CONTAINS || op > B_ENDS_WITH)
|
if (op < B_CONTAINS || op > B_ENDS_WITH)
|
||||||
#endif
|
#endif
|
||||||
TestPredicate(OpNode(op, NULL, NULL), B_OK, B_NO_INIT);
|
TestPredicate(OpNode(op, NULL, NULL), B_OK, B_NO_INIT);
|
||||||
@@ -677,7 +676,7 @@ QueryTest::PredicateTest()
|
|||||||
// * Push*()
|
// * Push*()
|
||||||
// * Set/GetPredicate(), PredicateLength()
|
// * Set/GetPredicate(), PredicateLength()
|
||||||
// empty predicate
|
// empty predicate
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
@@ -690,12 +689,12 @@ QueryTest::PredicateTest()
|
|||||||
== B_NO_INIT );
|
== B_NO_INIT );
|
||||||
}
|
}
|
||||||
// one element predicates
|
// one element predicates
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestPredicate(Int32Node(42));
|
TestPredicate(Int32Node(42));
|
||||||
TestPredicate(UInt32Node(42));
|
TestPredicate(UInt32Node(42));
|
||||||
TestPredicate(Int64Node(42));
|
TestPredicate(Int64Node(42));
|
||||||
// R5: buggy PushUInt64() implementation.
|
// R5: buggy PushUInt64() implementation.
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
TestPredicate(UInt64Node(42));
|
TestPredicate(UInt64Node(42));
|
||||||
#endif
|
#endif
|
||||||
TestPredicate(FloatNode(42));
|
TestPredicate(FloatNode(42));
|
||||||
@@ -711,7 +710,7 @@ QueryTest::PredicateTest()
|
|||||||
TestPredicate(DateNode("invalid date"), B_BAD_VALUE);
|
TestPredicate(DateNode("invalid date"), B_BAD_VALUE);
|
||||||
TestPredicate(AttributeNode("some attribute"));
|
TestPredicate(AttributeNode("some attribute"));
|
||||||
// operators
|
// operators
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestOperator(B_EQ);
|
TestOperator(B_EQ);
|
||||||
TestOperator(B_GT);
|
TestOperator(B_GT);
|
||||||
TestOperator(B_GE);
|
TestOperator(B_GE);
|
||||||
@@ -733,7 +732,7 @@ QueryTest::PredicateTest()
|
|||||||
TestPredicate(OpNode(B_NOT, NULL), B_OK, B_NO_INIT);
|
TestPredicate(OpNode(B_NOT, NULL), B_OK, B_NO_INIT);
|
||||||
}
|
}
|
||||||
// well formed, legal predicate
|
// well formed, legal predicate
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestPredicate(OpNode(B_AND,
|
TestPredicate(OpNode(B_AND,
|
||||||
new OpNode(B_CONTAINS,
|
new OpNode(B_CONTAINS,
|
||||||
new AttributeNode("attribute"),
|
new AttributeNode("attribute"),
|
||||||
@@ -754,7 +753,7 @@ QueryTest::PredicateTest()
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
// well formed, illegal predicate
|
// well formed, illegal predicate
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestPredicate(OpNode(B_EQ,
|
TestPredicate(OpNode(B_EQ,
|
||||||
new StringNode("hello"),
|
new StringNode("hello"),
|
||||||
new OpNode(B_LE,
|
new OpNode(B_LE,
|
||||||
@@ -768,7 +767,7 @@ QueryTest::PredicateTest()
|
|||||||
// ill formed predicates
|
// ill formed predicates
|
||||||
// Some have already been tested in TestOperator, so we only test a few
|
// Some have already been tested in TestOperator, so we only test a few
|
||||||
// special ones.
|
// special ones.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
TestPredicate(ListNode(new Int32Node(42), new StringNode("hello!")),
|
TestPredicate(ListNode(new Int32Node(42), new StringNode("hello!")),
|
||||||
B_OK, B_NO_INIT);
|
B_OK, B_NO_INIT);
|
||||||
TestPredicate(OpNode(B_EQ,
|
TestPredicate(OpNode(B_EQ,
|
||||||
@@ -776,7 +775,7 @@ QueryTest::PredicateTest()
|
|||||||
new OpNode(B_NOT, NULL)
|
new OpNode(B_NOT, NULL)
|
||||||
), B_OK, B_NO_INIT);
|
), B_OK, B_NO_INIT);
|
||||||
// precedence Push*() over SetPredicate()
|
// precedence Push*() over SetPredicate()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
OpNode predicate1(B_CONTAINS,
|
OpNode predicate1(B_CONTAINS,
|
||||||
@@ -792,7 +791,7 @@ QueryTest::PredicateTest()
|
|||||||
CPPUNIT_ASSERT( predicate == predicate1.toString() );
|
CPPUNIT_ASSERT( predicate == predicate1.toString() );
|
||||||
}
|
}
|
||||||
// GetPredicate() clears the stack
|
// GetPredicate() clears the stack
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
OpNode predicate1(B_CONTAINS,
|
OpNode predicate1(B_CONTAINS,
|
||||||
@@ -810,7 +809,7 @@ QueryTest::PredicateTest()
|
|||||||
CPPUNIT_ASSERT( predicate == predicate2.toString() );
|
CPPUNIT_ASSERT( predicate == predicate2.toString() );
|
||||||
}
|
}
|
||||||
// PredicateLength() clears the stack
|
// PredicateLength() clears the stack
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
OpNode predicate1(B_CONTAINS,
|
OpNode predicate1(B_CONTAINS,
|
||||||
@@ -828,7 +827,7 @@ QueryTest::PredicateTest()
|
|||||||
CPPUNIT_ASSERT( predicate == predicate2.toString() );
|
CPPUNIT_ASSERT( predicate == predicate2.toString() );
|
||||||
}
|
}
|
||||||
// SetPredicate(), Push*() fail after Fetch()
|
// SetPredicate(), Push*() fail after Fetch()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -840,7 +839,7 @@ QueryTest::PredicateTest()
|
|||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExistEither\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExistEither\"")
|
||||||
== B_NOT_ALLOWED );
|
== B_NOT_ALLOWED );
|
||||||
// R5: Push*()ing a new predicate does work, though it doesn't make any sense
|
// R5: Push*()ing a new predicate does work, though it doesn't make any sense
|
||||||
#if SK_TEST_R5
|
#if TEST_R5
|
||||||
CPPUNIT_ASSERT( query.PushDate("20 May 2002") == B_OK );
|
CPPUNIT_ASSERT( query.PushDate("20 May 2002") == B_OK );
|
||||||
CPPUNIT_ASSERT( query.PushValue((int32)42) == B_OK );
|
CPPUNIT_ASSERT( query.PushValue((int32)42) == B_OK );
|
||||||
CPPUNIT_ASSERT( query.PushValue((uint32)42) == B_OK );
|
CPPUNIT_ASSERT( query.PushValue((uint32)42) == B_OK );
|
||||||
@@ -866,8 +865,8 @@ QueryTest::PredicateTest()
|
|||||||
}
|
}
|
||||||
// SetPredicate(): bad args
|
// SetPredicate(): bad args
|
||||||
// R5: crashes when passing NULL to Set/GetPredicate()
|
// R5: crashes when passing NULL to Set/GetPredicate()
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate(NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( query.SetPredicate(NULL) == B_BAD_VALUE );
|
||||||
@@ -888,15 +887,15 @@ QueryTest::ParameterTest()
|
|||||||
|
|
||||||
// SetVolume(), TargetDevice()
|
// SetVolume(), TargetDevice()
|
||||||
// uninitialized BQuery
|
// uninitialized BQuery
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BQuery query;
|
BQuery query;
|
||||||
CPPUNIT_ASSERT( query.TargetDevice() == B_ERROR );
|
CPPUNIT_ASSERT( query.TargetDevice() == B_ERROR );
|
||||||
}
|
}
|
||||||
// NULL volume
|
// NULL volume
|
||||||
// R5: crashs when passing a NULL BVolume
|
// R5: crashs when passing a NULL BVolume
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BQuery query;
|
BQuery query;
|
||||||
CPPUNIT_ASSERT( query.SetVolume(NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( query.SetVolume(NULL) == B_BAD_VALUE );
|
||||||
@@ -904,7 +903,7 @@ QueryTest::ParameterTest()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// invalid volume
|
// invalid volume
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BQuery query;
|
BQuery query;
|
||||||
BVolume volume(-2);
|
BVolume volume(-2);
|
||||||
@@ -913,7 +912,7 @@ QueryTest::ParameterTest()
|
|||||||
CPPUNIT_ASSERT( query.TargetDevice() == B_ERROR );
|
CPPUNIT_ASSERT( query.TargetDevice() == B_ERROR );
|
||||||
}
|
}
|
||||||
// valid volume
|
// valid volume
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BQuery query;
|
BQuery query;
|
||||||
dev_t device = dev_for_path("/boot");
|
dev_t device = dev_for_path("/boot");
|
||||||
@@ -925,13 +924,13 @@ QueryTest::ParameterTest()
|
|||||||
|
|
||||||
// SetTarget(), IsLive()
|
// SetTarget(), IsLive()
|
||||||
// uninitialized BQuery
|
// uninitialized BQuery
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BQuery query;
|
BQuery query;
|
||||||
CPPUNIT_ASSERT( query.IsLive() == false );
|
CPPUNIT_ASSERT( query.IsLive() == false );
|
||||||
}
|
}
|
||||||
// uninitialized BMessenger
|
// uninitialized BMessenger
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BQuery query;
|
BQuery query;
|
||||||
BMessenger messenger;
|
BMessenger messenger;
|
||||||
@@ -940,7 +939,7 @@ QueryTest::ParameterTest()
|
|||||||
CPPUNIT_ASSERT( query.IsLive() == false );
|
CPPUNIT_ASSERT( query.IsLive() == false );
|
||||||
}
|
}
|
||||||
// valid BMessenger
|
// valid BMessenger
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BQuery query;
|
BQuery query;
|
||||||
BMessenger messenger(&fApplication->Handler());
|
BMessenger messenger(&fApplication->Handler());
|
||||||
@@ -950,7 +949,7 @@ QueryTest::ParameterTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetVolume/Target() fail after Fetch()
|
// SetVolume/Target() fail after Fetch()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -966,7 +965,7 @@ QueryTest::ParameterTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch() fails without a valid volume set
|
// Fetch() fails without a valid volume set
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -1102,13 +1101,13 @@ QueryTest::FetchTest()
|
|||||||
|
|
||||||
// Fetch()
|
// Fetch()
|
||||||
// uninitialized BQuery
|
// uninitialized BQuery
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
||||||
}
|
}
|
||||||
// incompletely initialized BQuery (no predicate)
|
// incompletely initialized BQuery (no predicate)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
BVolume volume(dev_for_path("/boot"));
|
BVolume volume(dev_for_path("/boot"));
|
||||||
@@ -1117,7 +1116,7 @@ QueryTest::FetchTest()
|
|||||||
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
||||||
}
|
}
|
||||||
// incompletely initialized BQuery (no volume)
|
// incompletely initialized BQuery (no volume)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -1125,7 +1124,7 @@ QueryTest::FetchTest()
|
|||||||
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
||||||
}
|
}
|
||||||
// incompletely initialized BQuery (invalid predicate)
|
// incompletely initialized BQuery (invalid predicate)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"&&")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"&&")
|
||||||
@@ -1136,7 +1135,7 @@ QueryTest::FetchTest()
|
|||||||
CPPUNIT_ASSERT( query.Fetch() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( query.Fetch() == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
// initialized BQuery, Fetch() twice
|
// initialized BQuery, Fetch() twice
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -1152,7 +1151,7 @@ QueryTest::FetchTest()
|
|||||||
fVolumeCreated = true;
|
fVolumeCreated = true;
|
||||||
create_test_entries(allTestEntries, allTestEntryCount);
|
create_test_entries(allTestEntries, allTestEntryCount);
|
||||||
// ... all files
|
// ... all files
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
QueryTestEntry *entries[] = {
|
QueryTestEntry *entries[] = {
|
||||||
&file11, &file12, &file21, &file22, &file31, &file32, &file1,
|
&file11, &file12, &file21, &file22, &file31, &file32, &file1,
|
||||||
@@ -1163,7 +1162,7 @@ QueryTest::FetchTest()
|
|||||||
entryCount);
|
entryCount);
|
||||||
}
|
}
|
||||||
// ... all entries containing a "l"
|
// ... all entries containing a "l"
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
QueryTestEntry *entries[] = {
|
QueryTestEntry *entries[] = {
|
||||||
&file11, &file12, &link11, &file21, &file22, &link21, &file31,
|
&file11, &file12, &link11, &file21, &file22, &link21, &file31,
|
||||||
@@ -1174,7 +1173,7 @@ QueryTest::FetchTest()
|
|||||||
entryCount);
|
entryCount);
|
||||||
}
|
}
|
||||||
// ... all entries ending on "2"
|
// ... all entries ending on "2"
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
QueryTestEntry *entries[] = {
|
QueryTestEntry *entries[] = {
|
||||||
&subdir12, &file12, &dir2, &subdir22, &file22, &subdir32, &file32,
|
&subdir12, &file12, &dir2, &subdir22, &file22, &subdir32, &file32,
|
||||||
@@ -1187,13 +1186,13 @@ QueryTest::FetchTest()
|
|||||||
|
|
||||||
// Clear()
|
// Clear()
|
||||||
// uninitialized BQuery
|
// uninitialized BQuery
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.Clear() == B_OK );
|
CPPUNIT_ASSERT( query.Clear() == B_OK );
|
||||||
}
|
}
|
||||||
// initialized BQuery, Fetch(), Clear(), Fetch()
|
// initialized BQuery, Fetch(), Clear(), Fetch()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -1206,7 +1205,7 @@ QueryTest::FetchTest()
|
|||||||
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
CPPUNIT_ASSERT( query.Fetch() == B_NO_INIT );
|
||||||
}
|
}
|
||||||
// initialized BQuery, Fetch(), Clear(), re-init, Fetch()
|
// initialized BQuery, Fetch(), Clear(), re-init, Fetch()
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -1225,7 +1224,7 @@ QueryTest::FetchTest()
|
|||||||
|
|
||||||
// BEntryList interface:
|
// BEntryList interface:
|
||||||
// empty queries
|
// empty queries
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -1244,7 +1243,7 @@ QueryTest::FetchTest()
|
|||||||
CPPUNIT_ASSERT( query.GetNextDirents(ents, bufSize, 1) == 0 );
|
CPPUNIT_ASSERT( query.GetNextDirents(ents, bufSize, 1) == 0 );
|
||||||
}
|
}
|
||||||
// uninitialized queries
|
// uninitialized queries
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
@@ -1258,7 +1257,7 @@ QueryTest::FetchTest()
|
|||||||
== B_FILE_ERROR );
|
== B_FILE_ERROR );
|
||||||
}
|
}
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"ThisShouldNotExist\"")
|
||||||
@@ -1269,7 +1268,7 @@ QueryTest::FetchTest()
|
|||||||
CPPUNIT_ASSERT( query.Fetch() == B_OK );
|
CPPUNIT_ASSERT( query.Fetch() == B_OK );
|
||||||
size_t bufSize = (sizeof(dirent) + B_FILE_NAME_LENGTH) * 10;
|
size_t bufSize = (sizeof(dirent) + B_FILE_NAME_LENGTH) * 10;
|
||||||
// R5: crashs when passing a NULL BEntry or entry_ref
|
// R5: crashs when passing a NULL BEntry or entry_ref
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( query.GetNextEntry(NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( query.GetNextEntry(NULL) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( query.GetNextRef(NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( query.GetNextRef(NULL) == B_BAD_VALUE );
|
||||||
#endif
|
#endif
|
||||||
@@ -1380,7 +1379,7 @@ QueryTest::LiveTest()
|
|||||||
BMessenger target(&fApplication->Handler());
|
BMessenger target(&fApplication->Handler());
|
||||||
|
|
||||||
// empty query, add some files, remove some files
|
// empty query, add some files, remove some files
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
CPPUNIT_ASSERT( query.SetPredicate("name=\"*Argh\"")
|
CPPUNIT_ASSERT( query.SetPredicate("name=\"*Argh\"")
|
||||||
@@ -1414,7 +1413,7 @@ QueryTest::LiveTest()
|
|||||||
RemoveLiveEntries(entries, entryCount, queryEntries, queryEntryCount);
|
RemoveLiveEntries(entries, entryCount, queryEntries, queryEntryCount);
|
||||||
}
|
}
|
||||||
// non-empty query, add some files, remove some files
|
// non-empty query, add some files, remove some files
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
Query query;
|
Query query;
|
||||||
TestSet testSet;
|
TestSet testSet;
|
||||||
@@ -1461,3 +1460,7 @@ QueryTest::LiveTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,3 +46,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // __sk_query_test_h__
|
#endif // __sk_query_test_h__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,7 @@
|
|||||||
#include <ResourceStrings.h>
|
#include <ResourceStrings.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
|
#include <TestShell.h>
|
||||||
#include "StorageKitTester.h"
|
|
||||||
|
|
||||||
|
|
||||||
static const char *testDir = "/tmp/testDir";
|
static const char *testDir = "/tmp/testDir";
|
||||||
@@ -186,7 +185,7 @@ void
|
|||||||
ResourceStringsTest::setUp()
|
ResourceStringsTest::setUp()
|
||||||
{
|
{
|
||||||
BasicTest::setUp();
|
BasicTest::setUp();
|
||||||
string resourcesTestDir(shell.TestDir());
|
string resourcesTestDir(BTestShell::GlobalTestDir());
|
||||||
resourcesTestDir += "/resources";
|
resourcesTestDir += "/resources";
|
||||||
execCommand(string("mkdir ") + testDir
|
execCommand(string("mkdir ") + testDir
|
||||||
+ " ; cp " + resourcesTestDir + "/" + x86ResName + " "
|
+ " ; cp " + resourcesTestDir + "/" + x86ResName + " "
|
||||||
@@ -235,7 +234,7 @@ void
|
|||||||
ResourceStringsTest::InitTest1()
|
ResourceStringsTest::InitTest1()
|
||||||
{
|
{
|
||||||
// default constructor
|
// default constructor
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResourceStrings resourceStrings;
|
BResourceStrings resourceStrings;
|
||||||
CPPUNIT_ASSERT( resourceStrings.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( resourceStrings.InitCheck() == B_OK );
|
||||||
@@ -244,7 +243,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
== B_ENTRY_NOT_FOUND );
|
== B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
// application file
|
// application file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = get_app_ref();
|
entry_ref ref = get_app_ref();
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -254,7 +253,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(x86ResFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(x86ResFile, &ref) == B_OK );
|
||||||
@@ -265,7 +264,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(ppcResFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(ppcResFile, &ref) == B_OK );
|
||||||
@@ -276,7 +275,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// ELF executable
|
// ELF executable
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(elfFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(elfFile, &ref) == B_OK );
|
||||||
@@ -287,7 +286,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// PEF executable
|
// PEF executable
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(pefFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(pefFile, &ref) == B_OK );
|
||||||
@@ -298,7 +297,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// test file 1
|
// test file 1
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
||||||
@@ -309,7 +308,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// test file 2
|
// test file 2
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
||||||
@@ -320,7 +319,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// empty file
|
// empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(emptyFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(emptyFile, &ref) == B_OK );
|
||||||
@@ -331,7 +330,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(noResFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(noResFile, &ref) == B_OK );
|
||||||
@@ -343,7 +342,7 @@ ResourceStringsTest::InitTest1()
|
|||||||
B_IO_ERROR) );
|
B_IO_ERROR) );
|
||||||
}
|
}
|
||||||
// non-existing file
|
// non-existing file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(noSuchFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(noSuchFile, &ref) == B_OK );
|
||||||
@@ -355,8 +354,8 @@ ResourceStringsTest::InitTest1()
|
|||||||
}
|
}
|
||||||
// bad args (GetStringFile)
|
// bad args (GetStringFile)
|
||||||
// R5: crashes
|
// R5: crashes
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
||||||
@@ -372,7 +371,7 @@ void
|
|||||||
ResourceStringsTest::InitTest2()
|
ResourceStringsTest::InitTest2()
|
||||||
{
|
{
|
||||||
// application file
|
// application file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = get_app_ref();
|
entry_ref ref = get_app_ref();
|
||||||
BResourceStrings resourceStrings;
|
BResourceStrings resourceStrings;
|
||||||
@@ -383,7 +382,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(x86ResFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(x86ResFile, &ref) == B_OK );
|
||||||
@@ -395,7 +394,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(ppcResFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(ppcResFile, &ref) == B_OK );
|
||||||
@@ -407,7 +406,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// ELF executable
|
// ELF executable
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(elfFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(elfFile, &ref) == B_OK );
|
||||||
@@ -419,7 +418,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// PEF executable
|
// PEF executable
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(pefFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(pefFile, &ref) == B_OK );
|
||||||
@@ -431,7 +430,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// test file 1
|
// test file 1
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
||||||
@@ -443,7 +442,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// test file 2
|
// test file 2
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(testFile1, &ref) == B_OK );
|
||||||
@@ -455,7 +454,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// empty file
|
// empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(emptyFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(emptyFile, &ref) == B_OK );
|
||||||
@@ -467,7 +466,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
CPPUNIT_ASSERT( BEntry(&ref, true) == BEntry(&ref2, true) );
|
||||||
}
|
}
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(noResFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(noResFile, &ref) == B_OK );
|
||||||
@@ -481,7 +480,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
B_IO_ERROR) );
|
B_IO_ERROR) );
|
||||||
}
|
}
|
||||||
// non-existing file
|
// non-existing file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( get_ref_for_path(noSuchFile, &ref) == B_OK );
|
CPPUNIT_ASSERT( get_ref_for_path(noSuchFile, &ref) == B_OK );
|
||||||
@@ -494,7 +493,7 @@ ResourceStringsTest::InitTest2()
|
|||||||
== B_ENTRY_NOT_FOUND );
|
== B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
// NULL ref -> app file
|
// NULL ref -> app file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResourceStrings resourceStrings;
|
BResourceStrings resourceStrings;
|
||||||
CPPUNIT_ASSERT( resourceStrings.SetStringFile(NULL) == B_OK );
|
CPPUNIT_ASSERT( resourceStrings.SetStringFile(NULL) == B_OK );
|
||||||
@@ -527,7 +526,7 @@ void
|
|||||||
ResourceStringsTest::FindStringTest()
|
ResourceStringsTest::FindStringTest()
|
||||||
{
|
{
|
||||||
// app file (default constructor)
|
// app file (default constructor)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResourceStrings resourceStrings;
|
BResourceStrings resourceStrings;
|
||||||
CPPUNIT_ASSERT( resourceStrings.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( resourceStrings.InitCheck() == B_OK );
|
||||||
@@ -542,7 +541,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, false);
|
::FindStringTest(resourceStrings, testResource1, false);
|
||||||
}
|
}
|
||||||
// app file (explicitely)
|
// app file (explicitely)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = get_app_ref();
|
entry_ref ref = get_app_ref();
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -558,7 +557,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, false);
|
::FindStringTest(resourceStrings, testResource1, false);
|
||||||
}
|
}
|
||||||
// test file 1
|
// test file 1
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(testFile1);
|
entry_ref ref = ref_for(testFile1);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -574,7 +573,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, false);
|
::FindStringTest(resourceStrings, testResource1, false);
|
||||||
}
|
}
|
||||||
// test file 2
|
// test file 2
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(testFile2);
|
entry_ref ref = ref_for(testFile2);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -590,7 +589,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, false);
|
::FindStringTest(resourceStrings, testResource1, false);
|
||||||
}
|
}
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(x86ResFile);
|
entry_ref ref = ref_for(x86ResFile);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -606,7 +605,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, true);
|
::FindStringTest(resourceStrings, testResource1, true);
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(ppcResFile);
|
entry_ref ref = ref_for(ppcResFile);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -622,7 +621,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, true);
|
::FindStringTest(resourceStrings, testResource1, true);
|
||||||
}
|
}
|
||||||
// ELF executable
|
// ELF executable
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(elfFile);
|
entry_ref ref = ref_for(elfFile);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -638,7 +637,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, true);
|
::FindStringTest(resourceStrings, testResource1, true);
|
||||||
}
|
}
|
||||||
// PEF executable
|
// PEF executable
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(pefFile);
|
entry_ref ref = ref_for(pefFile);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -654,7 +653,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, true);
|
::FindStringTest(resourceStrings, testResource1, true);
|
||||||
}
|
}
|
||||||
// empty file
|
// empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(emptyFile);
|
entry_ref ref = ref_for(emptyFile);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -670,7 +669,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, false);
|
::FindStringTest(resourceStrings, testResource1, false);
|
||||||
}
|
}
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(noResFile);
|
entry_ref ref = ref_for(noResFile);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -687,7 +686,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
::FindStringTest(resourceStrings, testResource1, false);
|
::FindStringTest(resourceStrings, testResource1, false);
|
||||||
}
|
}
|
||||||
// non-existing file
|
// non-existing file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
entry_ref ref = ref_for(noSuchFile);
|
entry_ref ref = ref_for(noSuchFile);
|
||||||
BResourceStrings resourceStrings(ref);
|
BResourceStrings resourceStrings(ref);
|
||||||
@@ -704,3 +703,7 @@ ResourceStringsTest::FindStringTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,3 +45,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#endif // __sk_resource_strings_test_h__
|
#endif // __sk_resource_strings_test_h__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
#include <Resources.h>
|
#include <Resources.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
|
#include <TestShell.h>
|
||||||
|
|
||||||
#include "StorageKitTester.h"
|
|
||||||
|
|
||||||
static const char *testDir = "/tmp/testDir";
|
static const char *testDir = "/tmp/testDir";
|
||||||
static const char *x86ResFile = "/tmp/testDir/x86.rsrc";
|
static const char *x86ResFile = "/tmp/testDir/x86.rsrc";
|
||||||
@@ -196,7 +196,7 @@ void
|
|||||||
ResourcesTest::setUp()
|
ResourcesTest::setUp()
|
||||||
{
|
{
|
||||||
BasicTest::setUp();
|
BasicTest::setUp();
|
||||||
BString unescapedTestDir(shell.TestDir());
|
BString unescapedTestDir(BTestShell::GlobalTestDir());
|
||||||
unescapedTestDir.CharacterEscape(" \t\n!\"'`$&()?*+{}[]<>|", '\\');
|
unescapedTestDir.CharacterEscape(" \t\n!\"'`$&()?*+{}[]<>|", '\\');
|
||||||
string resourcesTestDir(unescapedTestDir.String());
|
string resourcesTestDir(unescapedTestDir.String());
|
||||||
resourcesTestDir += "/resources";
|
resourcesTestDir += "/resources";
|
||||||
@@ -227,7 +227,7 @@ ResourcesTest::InitTest()
|
|||||||
{
|
{
|
||||||
// 1. existing files, read only
|
// 1. existing files, read only
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
@@ -235,7 +235,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(ppcResFile, B_READ_ONLY);
|
BFile file(ppcResFile, B_READ_ONLY);
|
||||||
@@ -243,7 +243,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary containing resources
|
// ELF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfFile, B_READ_ONLY);
|
BFile file(elfFile, B_READ_ONLY);
|
||||||
@@ -251,7 +251,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary not containing resources
|
// ELF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfNoResFile, B_READ_ONLY);
|
BFile file(elfNoResFile, B_READ_ONLY);
|
||||||
@@ -259,7 +259,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary containing resources
|
// PEF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefFile, B_READ_ONLY);
|
BFile file(pefFile, B_READ_ONLY);
|
||||||
@@ -267,7 +267,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary not containing resources
|
// PEF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefNoResFile, B_READ_ONLY);
|
BFile file(pefNoResFile, B_READ_ONLY);
|
||||||
@@ -275,7 +275,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// empty file
|
// empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(emptyFile, B_READ_ONLY);
|
BFile file(emptyFile, B_READ_ONLY);
|
||||||
@@ -283,7 +283,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(noResFile, B_READ_ONLY);
|
BFile file(noResFile, B_READ_ONLY);
|
||||||
@@ -294,7 +294,7 @@ ResourcesTest::InitTest()
|
|||||||
|
|
||||||
// 2. existing files, read only, clobber
|
// 2. existing files, read only, clobber
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
@@ -302,7 +302,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(ppcResFile, B_READ_ONLY);
|
BFile file(ppcResFile, B_READ_ONLY);
|
||||||
@@ -310,7 +310,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary containing resources
|
// ELF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfFile, B_READ_ONLY);
|
BFile file(elfFile, B_READ_ONLY);
|
||||||
@@ -318,7 +318,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary not containing resources
|
// ELF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfNoResFile, B_READ_ONLY);
|
BFile file(elfNoResFile, B_READ_ONLY);
|
||||||
@@ -326,7 +326,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary containing resources
|
// PEF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefFile, B_READ_ONLY);
|
BFile file(pefFile, B_READ_ONLY);
|
||||||
@@ -334,7 +334,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary not containing resources
|
// PEF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefNoResFile, B_READ_ONLY);
|
BFile file(pefNoResFile, B_READ_ONLY);
|
||||||
@@ -342,7 +342,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
||||||
}
|
}
|
||||||
// empty file
|
// empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(emptyFile, B_READ_ONLY);
|
BFile file(emptyFile, B_READ_ONLY);
|
||||||
@@ -350,7 +350,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, true) == B_OK );
|
||||||
}
|
}
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(noResFile, B_READ_ONLY);
|
BFile file(noResFile, B_READ_ONLY);
|
||||||
@@ -360,7 +360,7 @@ ResourcesTest::InitTest()
|
|||||||
|
|
||||||
// 3. existing files, read/write
|
// 3. existing files, read/write
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(x86ResFile, B_READ_WRITE);
|
BFile file(x86ResFile, B_READ_WRITE);
|
||||||
@@ -368,7 +368,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(ppcResFile, B_READ_WRITE);
|
BFile file(ppcResFile, B_READ_WRITE);
|
||||||
@@ -376,7 +376,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary containing resources
|
// ELF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfFile, B_READ_WRITE);
|
BFile file(elfFile, B_READ_WRITE);
|
||||||
@@ -384,7 +384,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary not containing resources
|
// ELF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfNoResFile, B_READ_WRITE);
|
BFile file(elfNoResFile, B_READ_WRITE);
|
||||||
@@ -392,7 +392,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary containing resources
|
// PEF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefFile, B_READ_WRITE);
|
BFile file(pefFile, B_READ_WRITE);
|
||||||
@@ -400,7 +400,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary not containing resources
|
// PEF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefNoResFile, B_READ_WRITE);
|
BFile file(pefNoResFile, B_READ_WRITE);
|
||||||
@@ -408,7 +408,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// empty file
|
// empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(emptyFile, B_READ_WRITE);
|
BFile file(emptyFile, B_READ_WRITE);
|
||||||
@@ -416,7 +416,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
}
|
}
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(noResFile, B_READ_WRITE);
|
BFile file(noResFile, B_READ_WRITE);
|
||||||
@@ -427,7 +427,7 @@ ResourcesTest::InitTest()
|
|||||||
|
|
||||||
// 4. existing files, read/write, clobber
|
// 4. existing files, read/write, clobber
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(x86ResFile, B_READ_WRITE);
|
BFile file(x86ResFile, B_READ_WRITE);
|
||||||
@@ -436,7 +436,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(ppcResFile, B_READ_WRITE);
|
BFile file(ppcResFile, B_READ_WRITE);
|
||||||
@@ -445,7 +445,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary containing resources
|
// ELF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfFile, B_READ_WRITE);
|
BFile file(elfFile, B_READ_WRITE);
|
||||||
@@ -454,7 +454,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
||||||
}
|
}
|
||||||
// ELF binary not containing resources
|
// ELF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(elfNoResFile, B_READ_WRITE);
|
BFile file(elfNoResFile, B_READ_WRITE);
|
||||||
@@ -463,7 +463,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary containing resources
|
// PEF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefFile, B_READ_WRITE);
|
BFile file(pefFile, B_READ_WRITE);
|
||||||
@@ -472,7 +472,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
||||||
}
|
}
|
||||||
// PEF binary not containing resources
|
// PEF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(pefNoResFile, B_READ_WRITE);
|
BFile file(pefNoResFile, B_READ_WRITE);
|
||||||
@@ -481,7 +481,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
||||||
}
|
}
|
||||||
// empty file
|
// empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(emptyFile, B_READ_WRITE);
|
BFile file(emptyFile, B_READ_WRITE);
|
||||||
@@ -490,7 +490,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
CPPUNIT_ASSERT( resources.Sync() == B_OK );
|
||||||
}
|
}
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(noResFile, B_READ_WRITE);
|
BFile file(noResFile, B_READ_WRITE);
|
||||||
@@ -500,7 +500,7 @@ ResourcesTest::InitTest()
|
|||||||
|
|
||||||
// 5. bad args
|
// 5. bad args
|
||||||
// uninitialized file
|
// uninitialized file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file;
|
BFile file;
|
||||||
@@ -508,7 +508,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_NO_INIT );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_NO_INIT );
|
||||||
}
|
}
|
||||||
// badly initialized file
|
// badly initialized file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(noSuchFile, B_READ_ONLY);
|
BFile file(noSuchFile, B_READ_ONLY);
|
||||||
@@ -516,7 +516,7 @@ ResourcesTest::InitTest()
|
|||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
// NULL file
|
// NULL file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
// R5: A NULL file is B_OK!
|
// R5: A NULL file is B_OK!
|
||||||
@@ -708,7 +708,7 @@ ResourcesTest::ReadTest()
|
|||||||
|
|
||||||
// 1. basic tests
|
// 1. basic tests
|
||||||
// x86 resource file
|
// x86 resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -721,7 +721,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadResTest(resources, testResource5, false);
|
ReadResTest(resources, testResource5, false);
|
||||||
}
|
}
|
||||||
// ppc resource file
|
// ppc resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(ppcResFile, B_READ_ONLY);
|
BFile file(ppcResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -734,7 +734,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadResTest(resources, testResource5, false);
|
ReadResTest(resources, testResource5, false);
|
||||||
}
|
}
|
||||||
// ELF binary containing resources
|
// ELF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(elfFile, B_READ_ONLY);
|
BFile file(elfFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -747,7 +747,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadResTest(resources, testResource5, false);
|
ReadResTest(resources, testResource5, false);
|
||||||
}
|
}
|
||||||
// ELF binary not containing resources
|
// ELF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(elfNoResFile, B_READ_ONLY);
|
BFile file(elfNoResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -760,7 +760,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadResTest(resources, testResource5, false);
|
ReadResTest(resources, testResource5, false);
|
||||||
}
|
}
|
||||||
// PEF binary containing resources
|
// PEF binary containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(pefFile, B_READ_ONLY);
|
BFile file(pefFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -773,7 +773,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadResTest(resources, testResource5, false);
|
ReadResTest(resources, testResource5, false);
|
||||||
}
|
}
|
||||||
// PEF binary not containing resources
|
// PEF binary not containing resources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(pefNoResFile, B_READ_ONLY);
|
BFile file(pefNoResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -788,7 +788,7 @@ ResourcesTest::ReadTest()
|
|||||||
|
|
||||||
// 2. PreloadResource()
|
// 2. PreloadResource()
|
||||||
// Hard to test: just preload all and check, if it still works.
|
// Hard to test: just preload all and check, if it still works.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -808,7 +808,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadResTest(resources, testResource5, false);
|
ReadResTest(resources, testResource5, false);
|
||||||
}
|
}
|
||||||
// uninitialized BResources
|
// uninitialized BResources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
// int32 type
|
// int32 type
|
||||||
@@ -819,7 +819,7 @@ ResourcesTest::ReadTest()
|
|||||||
|
|
||||||
// 3. the index versions of GetResourceInfo()
|
// 3. the index versions of GetResourceInfo()
|
||||||
// index only
|
// index only
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -852,7 +852,7 @@ ResourcesTest::ReadTest()
|
|||||||
&name, &length) == false );
|
&name, &length) == false );
|
||||||
}
|
}
|
||||||
// type and index
|
// type and index
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_WRITE);
|
BFile file(x86ResFile, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -892,7 +892,7 @@ ResourcesTest::ReadTest()
|
|||||||
|
|
||||||
// 4. error cases
|
// 4. error cases
|
||||||
// non-resource file
|
// non-resource file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(noResFile, B_READ_ONLY);
|
BFile file(noResFile, B_READ_ONLY);
|
||||||
@@ -902,7 +902,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadBadResTest(resources, testResource1);
|
ReadBadResTest(resources, testResource1);
|
||||||
}
|
}
|
||||||
// uninitialized file
|
// uninitialized file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file;
|
BFile file;
|
||||||
@@ -911,7 +911,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadBadResTest(resources, testResource1);
|
ReadBadResTest(resources, testResource1);
|
||||||
}
|
}
|
||||||
// badly initialized file
|
// badly initialized file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file(noSuchFile, B_READ_ONLY);
|
BFile file(noSuchFile, B_READ_ONLY);
|
||||||
@@ -920,7 +920,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadBadResTest(resources, testResource1);
|
ReadBadResTest(resources, testResource1);
|
||||||
}
|
}
|
||||||
// NULL file
|
// NULL file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
// R5: A NULL file is B_OK!
|
// R5: A NULL file is B_OK!
|
||||||
@@ -929,7 +929,7 @@ ResourcesTest::ReadTest()
|
|||||||
ReadBadResTest(resources, testResource1);
|
ReadBadResTest(resources, testResource1);
|
||||||
}
|
}
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1087,7 +1087,7 @@ void
|
|||||||
ResourcesTest::SyncTest()
|
ResourcesTest::SyncTest()
|
||||||
{
|
{
|
||||||
// Sync() is not easy to test. We just check its return value for now.
|
// Sync() is not easy to test. We just check its return value for now.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
execCommand(string("cp ") + x86ResFile + " " + testFile1);
|
execCommand(string("cp ") + x86ResFile + " " + testFile1);
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE);
|
BFile file(testFile1, B_READ_WRITE);
|
||||||
@@ -1108,7 +1108,7 @@ ResourcesTest::SyncTest()
|
|||||||
}
|
}
|
||||||
// error cases
|
// error cases
|
||||||
// read only file
|
// read only file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_ONLY);
|
BFile file(testFile1, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1117,13 +1117,13 @@ ResourcesTest::SyncTest()
|
|||||||
CPPUNIT_ASSERT( resources.Sync() == B_NOT_ALLOWED );
|
CPPUNIT_ASSERT( resources.Sync() == B_NOT_ALLOWED );
|
||||||
}
|
}
|
||||||
// uninitialized BResources
|
// uninitialized BResources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
CPPUNIT_ASSERT( resources.Sync() == B_NO_INIT );
|
CPPUNIT_ASSERT( resources.Sync() == B_NO_INIT );
|
||||||
}
|
}
|
||||||
// badly initialized BResources
|
// badly initialized BResources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(noSuchFile, B_READ_ONLY);
|
BFile file(noSuchFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( file.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
@@ -1138,7 +1138,7 @@ void
|
|||||||
ResourcesTest::MergeTest()
|
ResourcesTest::MergeTest()
|
||||||
{
|
{
|
||||||
// empty file, merge with resources from another file
|
// empty file, merge with resources from another file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1154,7 +1154,7 @@ ResourcesTest::MergeTest()
|
|||||||
}
|
}
|
||||||
// empty file, add some resources first and then merge with resources
|
// empty file, add some resources first and then merge with resources
|
||||||
// from another file
|
// from another file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1175,7 +1175,7 @@ ResourcesTest::MergeTest()
|
|||||||
}
|
}
|
||||||
// error cases
|
// error cases
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1186,13 +1186,13 @@ ResourcesTest::MergeTest()
|
|||||||
CPPUNIT_ASSERT( resources.MergeFrom(&file2) == B_IO_ERROR );
|
CPPUNIT_ASSERT( resources.MergeFrom(&file2) == B_IO_ERROR );
|
||||||
// NULL file
|
// NULL file
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( resources.MergeFrom(NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( resources.MergeFrom(NULL) == B_BAD_VALUE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// uninitialized BResources
|
// uninitialized BResources
|
||||||
// R5: returns B_OK!
|
// R5: returns B_OK!
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
BFile file2(x86ResFile, B_READ_ONLY);
|
BFile file2(x86ResFile, B_READ_ONLY);
|
||||||
@@ -1200,7 +1200,7 @@ ResourcesTest::MergeTest()
|
|||||||
}
|
}
|
||||||
// badly initialized BResources
|
// badly initialized BResources
|
||||||
// R5: returns B_OK!
|
// R5: returns B_OK!
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(noSuchFile, B_READ_ONLY);
|
BFile file(noSuchFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( file.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
@@ -1216,7 +1216,7 @@ void
|
|||||||
ResourcesTest::WriteToTest()
|
ResourcesTest::WriteToTest()
|
||||||
{
|
{
|
||||||
// take a file with resources and write them to an empty file
|
// take a file with resources and write them to an empty file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1229,7 +1229,7 @@ ResourcesTest::WriteToTest()
|
|||||||
}
|
}
|
||||||
// take a file with resources and write them to an non-empty non-resource
|
// take a file with resources and write them to an non-empty non-resource
|
||||||
// file
|
// file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1241,7 +1241,7 @@ ResourcesTest::WriteToTest()
|
|||||||
CPPUNIT_ASSERT( resources.File() == file2 );
|
CPPUNIT_ASSERT( resources.File() == file2 );
|
||||||
}
|
}
|
||||||
// take a file with resources and write them to an ELF file
|
// take a file with resources and write them to an ELF file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
execCommand(string("cp ") + elfNoResFile + " " + testFile1);
|
execCommand(string("cp ") + elfNoResFile + " " + testFile1);
|
||||||
{
|
{
|
||||||
BFile file(x86ResFile, B_READ_ONLY);
|
BFile file(x86ResFile, B_READ_ONLY);
|
||||||
@@ -1254,7 +1254,7 @@ ResourcesTest::WriteToTest()
|
|||||||
CPPUNIT_ASSERT( resources.File() == file2 );
|
CPPUNIT_ASSERT( resources.File() == file2 );
|
||||||
}
|
}
|
||||||
// empty file, add a resource, write it to another file
|
// empty file, add a resource, write it to another file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile2, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile2, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1274,7 +1274,7 @@ ResourcesTest::WriteToTest()
|
|||||||
CPPUNIT_ASSERT( fileSize == 0 );
|
CPPUNIT_ASSERT( fileSize == 0 );
|
||||||
}
|
}
|
||||||
// uninitialized BResources
|
// uninitialized BResources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
execCommand(string("cp ") + elfNoResFile + " " + testFile1);
|
execCommand(string("cp ") + elfNoResFile + " " + testFile1);
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
@@ -1285,13 +1285,13 @@ ResourcesTest::WriteToTest()
|
|||||||
}
|
}
|
||||||
// bad args: NULL file
|
// bad args: NULL file
|
||||||
// R5: crashs
|
// R5: crashs
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile2, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile2, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
BResources resources;
|
BResources resources;
|
||||||
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
CPPUNIT_ASSERT( resources.SetTo(&file, false) == B_OK );
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( resources.WriteTo(NULL) == B_BAD_VALUE);
|
CPPUNIT_ASSERT( resources.WriteTo(NULL) == B_BAD_VALUE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1309,7 +1309,7 @@ ResourcesTest::AddRemoveTest()
|
|||||||
// Start with an empty file, add all the resources of our x86 resource
|
// Start with an empty file, add all the resources of our x86 resource
|
||||||
// file and compare the two bytewise.
|
// file and compare the two bytewise.
|
||||||
// This does of course only work on x86 machines.
|
// This does of course only work on x86 machines.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1328,7 +1328,7 @@ ResourcesTest::AddRemoveTest()
|
|||||||
}
|
}
|
||||||
// Now remove all resources and compare the file with an empty resource
|
// Now remove all resources and compare the file with an empty resource
|
||||||
// file.
|
// file.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE);
|
BFile file(testFile1, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1353,7 +1353,7 @@ ResourcesTest::AddRemoveTest()
|
|||||||
CompareFiles(file1, file2);
|
CompareFiles(file1, file2);
|
||||||
}
|
}
|
||||||
// Same file, use the other remove version.
|
// Same file, use the other remove version.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
execCommand(string("cp ") + x86ResFile + " " + testFile1);
|
execCommand(string("cp ") + x86ResFile + " " + testFile1);
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE);
|
BFile file(testFile1, B_READ_WRITE);
|
||||||
@@ -1379,7 +1379,7 @@ ResourcesTest::AddRemoveTest()
|
|||||||
CompareFiles(file1, file2);
|
CompareFiles(file1, file2);
|
||||||
}
|
}
|
||||||
// some arbitrary adding and removing...
|
// some arbitrary adding and removing...
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1401,7 +1401,7 @@ ResourcesTest::AddRemoveTest()
|
|||||||
RemoveResource(resources, resourceSet, testResource4, false);
|
RemoveResource(resources, resourceSet, testResource4, false);
|
||||||
}
|
}
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(testFile1, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1414,7 +1414,7 @@ ResourcesTest::AddRemoveTest()
|
|||||||
"Hey!") == B_BAD_VALUE );
|
"Hey!") == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
// uninitialized BResources
|
// uninitialized BResources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
const ResourceInfo &info = testResource1;
|
const ResourceInfo &info = testResource1;
|
||||||
@@ -1431,7 +1431,7 @@ ResourcesTest::ReadWriteTest()
|
|||||||
// ReadResource() has already been tested in ReadTest(). Thus we focus on
|
// ReadResource() has already been tested in ReadTest(). Thus we focus on
|
||||||
// WriteResource().
|
// WriteResource().
|
||||||
// Open a file and write a little bit into one of its resources.
|
// Open a file and write a little bit into one of its resources.
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
execCommand(string("cp ") + x86ResFile + " " + testFile1);
|
execCommand(string("cp ") + x86ResFile + " " + testFile1);
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE);
|
BFile file(testFile1, B_READ_WRITE);
|
||||||
@@ -1498,7 +1498,7 @@ ResourcesTest::ReadWriteTest()
|
|||||||
}
|
}
|
||||||
// error cases
|
// error cases
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BFile file(testFile1, B_READ_WRITE);
|
BFile file(testFile1, B_READ_WRITE);
|
||||||
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( file.InitCheck() == B_OK );
|
||||||
@@ -1517,7 +1517,7 @@ ResourcesTest::ReadWriteTest()
|
|||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
// uninitialized BResources
|
// uninitialized BResources
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BResources resources;
|
BResources resources;
|
||||||
const ResourceInfo &info = testResource1;
|
const ResourceInfo &info = testResource1;
|
||||||
@@ -1529,3 +1529,7 @@ ResourcesTest::ReadWriteTest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,3 +37,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#endif // __sk_resources_test_h__
|
#endif // __sk_resources_test_h__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,33 @@
|
|||||||
#include <TestSuiteAddon.h>
|
#include <TestSuiteAddon.h>
|
||||||
|
|
||||||
// ##### Include headers for your tests here #####
|
// ##### Include headers for your tests here #####
|
||||||
#include <DirectoryTest.h>
|
#include "DirectoryTest.h"
|
||||||
#include <NodeTest.h>
|
#include "EntryTest.h"
|
||||||
#include <PathTest.h>
|
#include "FileTest.h"
|
||||||
|
#include "FindDirectoryTest.h"
|
||||||
|
#include "MimeTypeTest.h"
|
||||||
|
#include "NodeTest.h"
|
||||||
|
#include "PathTest.h"
|
||||||
|
#include "QueryTest.h"
|
||||||
|
#include "ResourcesTest.h"
|
||||||
|
#include "ResourceStringsTest.h"
|
||||||
|
#include "SymLinkTest.h"
|
||||||
|
|
||||||
BTestSuite* getTestSuite() {
|
BTestSuite* getTestSuite() {
|
||||||
BTestSuite *suite = new BTestSuite("Storage");
|
BTestSuite *suite = new BTestSuite("Storage");
|
||||||
|
|
||||||
// ##### Add test suites for statically linked tests here #####
|
// ##### Add test suites here #####
|
||||||
suite->addTest("BDirectory", DirectoryTest::Suite());
|
suite->addTest("BDirectory", DirectoryTest::Suite());
|
||||||
|
suite->addTest("BEntry", EntryTest::Suite());
|
||||||
|
suite->addTest("BFile", FileTest::Suite());
|
||||||
|
suite->addTest("BMimeType", MimeTypeTest::Suite());
|
||||||
suite->addTest("BNode", NodeTest::Suite());
|
suite->addTest("BNode", NodeTest::Suite());
|
||||||
suite->addTest("BPath", PathTest::Suite());
|
suite->addTest("BPath", PathTest::Suite());
|
||||||
|
suite->addTest("BQuery", QueryTest::Suite());
|
||||||
|
suite->addTest("BResources", ResourcesTest::Suite());
|
||||||
|
suite->addTest("BResourceStrings", ResourceStringsTest::Suite());
|
||||||
|
suite->addTest("BSymLink", SymLinkTest::Suite());
|
||||||
|
suite->addTest("FindDirectory", FindDirectoryTest::Suite());
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <SymLink.h>
|
#include <SymLink.h>
|
||||||
|
|
||||||
#include "StorageKitTester.h"
|
|
||||||
#include "SymLinkTest.h"
|
#include "SymLinkTest.h"
|
||||||
|
|
||||||
// Suite
|
// Suite
|
||||||
@@ -102,76 +101,76 @@ SymLinkTest::InitTest1()
|
|||||||
const char *nonExistingSuper = nonExistingSuperDirname;
|
const char *nonExistingSuper = nonExistingSuperDirname;
|
||||||
const char *nonExistingRel = nonExistingRelDirname;
|
const char *nonExistingRel = nonExistingRelDirname;
|
||||||
// 1. default constructor
|
// 1. default constructor
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link;
|
BSymLink link;
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. BSymLink(const char*)
|
// 2. BSymLink(const char*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(fileLink);
|
BSymLink link(fileLink);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(nonExisting);
|
BSymLink link(nonExisting);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link((const char *)NULL);
|
BSymLink link((const char *)NULL);
|
||||||
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link("");
|
BSymLink link("");
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(existingFile);
|
BSymLink link(existingFile);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(existingDir);
|
BSymLink link(existingDir);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(tooLongEntryname);
|
BSymLink link(tooLongEntryname);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. BSymLink(const BEntry*)
|
// 3. BSymLink(const BEntry*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(dirLink);
|
BEntry entry(dirLink);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
BSymLink link(&entry);
|
BSymLink link(&entry);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(nonExisting);
|
BEntry entry(nonExisting);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
BSymLink link(&entry);
|
BSymLink link(&entry);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link((BEntry *)NULL);
|
BSymLink link((BEntry *)NULL);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BSymLink link(&entry);
|
BSymLink link(&entry);
|
||||||
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
|
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(existingFile);
|
BEntry entry(existingFile);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
@@ -179,7 +178,7 @@ SymLinkTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
|
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(existingDir);
|
BEntry entry(existingDir);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
@@ -187,7 +186,7 @@ SymLinkTest::InitTest1()
|
|||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
|
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(tooLongEntryname);
|
BEntry entry(tooLongEntryname);
|
||||||
// R5 returns E2BIG instead of B_NAME_TOO_LONG
|
// R5 returns E2BIG instead of B_NAME_TOO_LONG
|
||||||
@@ -197,7 +196,7 @@ SymLinkTest::InitTest1()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. BSymLink(const entry_ref*)
|
// 4. BSymLink(const entry_ref*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(dirLink);
|
BEntry entry(dirLink);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
@@ -206,7 +205,7 @@ SymLinkTest::InitTest1()
|
|||||||
BSymLink link(&ref);
|
BSymLink link(&ref);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(nonExisting);
|
BEntry entry(nonExisting);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
@@ -215,12 +214,12 @@ SymLinkTest::InitTest1()
|
|||||||
BSymLink link(&ref);
|
BSymLink link(&ref);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link((entry_ref *)NULL);
|
BSymLink link((entry_ref *)NULL);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(existingFile);
|
BEntry entry(existingFile);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
@@ -229,7 +228,7 @@ SymLinkTest::InitTest1()
|
|||||||
BSymLink link(&ref);
|
BSymLink link(&ref);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BEntry entry(existingDir);
|
BEntry entry(existingDir);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
@@ -240,73 +239,73 @@ SymLinkTest::InitTest1()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 5. BSymLink(const BDirectory*, const char*)
|
// 5. BSymLink(const BDirectory*, const char*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(dirSuperLink);
|
BDirectory pathDir(dirSuperLink);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, dirRelLink);
|
BSymLink link(&pathDir, dirRelLink);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(dirSuperLink);
|
BDirectory pathDir(dirSuperLink);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, dirLink);
|
BSymLink link(&pathDir, dirLink);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(nonExistingSuper);
|
BDirectory pathDir(nonExistingSuper);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, nonExistingRel);
|
BSymLink link(&pathDir, nonExistingRel);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link((BDirectory *)NULL, (const char *)NULL);
|
BSymLink link((BDirectory *)NULL, (const char *)NULL);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link((BDirectory *)NULL, dirLink);
|
BSymLink link((BDirectory *)NULL, dirLink);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(dirSuperLink);
|
BDirectory pathDir(dirSuperLink);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, (const char *)NULL);
|
BSymLink link(&pathDir, (const char *)NULL);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(dirSuperLink);
|
BDirectory pathDir(dirSuperLink);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, "");
|
BSymLink link(&pathDir, "");
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(existingSuperFile);
|
BDirectory pathDir(existingSuperFile);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, existingRelFile);
|
BSymLink link(&pathDir, existingRelFile);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(existingSuperDir);
|
BDirectory pathDir(existingSuperDir);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, existingRelDir);
|
BSymLink link(&pathDir, existingRelDir);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(tooLongSuperEntryname);
|
BDirectory pathDir(tooLongSuperEntryname);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
BSymLink link(&pathDir, tooLongRelEntryname);
|
BSymLink link(&pathDir, tooLongRelEntryname);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BDirectory pathDir(fileSuperDirname);
|
BDirectory pathDir(fileSuperDirname);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
@@ -334,68 +333,68 @@ SymLinkTest::InitTest2()
|
|||||||
const char *nonExistingRel = nonExistingRelDirname;
|
const char *nonExistingRel = nonExistingRelDirname;
|
||||||
BSymLink link;
|
BSymLink link;
|
||||||
// 2. BSymLink(const char*)
|
// 2. BSymLink(const char*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(nonExisting) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo(nonExisting) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( equals(link.SetTo((const char *)NULL), B_BAD_VALUE,
|
CPPUNIT_ASSERT( equals(link.SetTo((const char *)NULL), B_BAD_VALUE,
|
||||||
B_NO_INIT) );
|
B_NO_INIT) );
|
||||||
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo("") == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo("") == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(existingFile) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(existingFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(existingDir) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(existingDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(tooLongEntryname) == B_NAME_TOO_LONG );
|
CPPUNIT_ASSERT( link.SetTo(tooLongEntryname) == B_NAME_TOO_LONG );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
||||||
|
|
||||||
// 3. BSymLink(const BEntry*)
|
// 3. BSymLink(const BEntry*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BEntry entry(dirLink);
|
BEntry entry(dirLink);
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&entry) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&entry) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&entry) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo(&entry) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo((BEntry *)NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.SetTo((BEntry *)NULL) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
entry.Unset();
|
entry.Unset();
|
||||||
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( entry.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( equals(link.SetTo(&entry), B_BAD_ADDRESS, B_BAD_VALUE) );
|
CPPUNIT_ASSERT( equals(link.SetTo(&entry), B_BAD_ADDRESS, B_BAD_VALUE) );
|
||||||
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
|
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&entry) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&entry) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&entry) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&entry) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
// R5 returns E2BIG instead of B_NAME_TOO_LONG
|
// R5 returns E2BIG instead of B_NAME_TOO_LONG
|
||||||
CPPUNIT_ASSERT( equals(entry.SetTo(tooLongEntryname), E2BIG,
|
CPPUNIT_ASSERT( equals(entry.SetTo(tooLongEntryname), E2BIG,
|
||||||
B_NAME_TOO_LONG) );
|
B_NAME_TOO_LONG) );
|
||||||
@@ -403,88 +402,88 @@ SymLinkTest::InitTest2()
|
|||||||
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
|
CPPUNIT_ASSERT( equals(link.InitCheck(), B_BAD_ADDRESS, B_BAD_VALUE) );
|
||||||
|
|
||||||
// 4. BSymLink(const entry_ref*)
|
// 4. BSymLink(const entry_ref*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(dirLink) == B_OK );
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&ref) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(nonExisting) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&ref) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo(&ref) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo((entry_ref *)NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.SetTo((entry_ref *)NULL) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&ref) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
CPPUNIT_ASSERT( entry.GetRef(&ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&ref) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&ref) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
|
|
||||||
// 5. BSymLink(const BDirectory*, const char*)
|
// 5. BSymLink(const BDirectory*, const char*)
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BDirectory pathDir(dirSuperLink);
|
BDirectory pathDir(dirSuperLink);
|
||||||
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( pathDir.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, dirRelLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, dirRelLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, dirLink) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, dirLink) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(nonExistingSuper) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(nonExistingSuper) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, nonExistingRel) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, nonExistingRel) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo((BDirectory *)NULL, (const char *)NULL)
|
CPPUNIT_ASSERT( link.SetTo((BDirectory *)NULL, (const char *)NULL)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo((BDirectory *)NULL, dirLink) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.SetTo((BDirectory *)NULL, dirLink) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, (const char *)NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, (const char *)NULL) == B_BAD_VALUE );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.InitCheck() == B_BAD_VALUE );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(dirSuperLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, "") == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, "") == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(existingSuperFile) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(existingSuperFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, existingRelFile) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, existingRelFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(existingSuperDir) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(existingSuperDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, existingRelDir) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, existingRelDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(tooLongSuperEntryname) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(tooLongSuperEntryname) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, tooLongRelEntryname)
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, tooLongRelEntryname)
|
||||||
== B_NAME_TOO_LONG );
|
== B_NAME_TOO_LONG );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NAME_TOO_LONG );
|
||||||
//
|
//
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( pathDir.SetTo(fileSuperDirname) == B_OK );
|
CPPUNIT_ASSERT( pathDir.SetTo(fileSuperDirname) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(&pathDir, fileRelDirname) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo(&pathDir, fileRelDirname) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.InitCheck() == B_ENTRY_NOT_FOUND );
|
||||||
@@ -506,59 +505,59 @@ SymLinkTest::ReadLinkTest()
|
|||||||
char buffer[B_PATH_NAME_LENGTH + 1];
|
char buffer[B_PATH_NAME_LENGTH + 1];
|
||||||
// uninitialized
|
// uninitialized
|
||||||
// R5: returns B_BAD_ADDRESS instead of (as doc'ed) B_FILE_ERROR
|
// R5: returns B_BAD_ADDRESS instead of (as doc'ed) B_FILE_ERROR
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( equals(link.ReadLink(buffer, sizeof(buffer)),
|
CPPUNIT_ASSERT( equals(link.ReadLink(buffer, sizeof(buffer)),
|
||||||
B_BAD_ADDRESS, B_FILE_ERROR) );
|
B_BAD_ADDRESS, B_FILE_ERROR) );
|
||||||
// existing dir link
|
// existing dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
||||||
== (ssize_t)strlen(existingDir) );
|
== (ssize_t)strlen(existingDir) );
|
||||||
CPPUNIT_ASSERT( strcmp(buffer, existingDir) == 0 );
|
CPPUNIT_ASSERT( strcmp(buffer, existingDir) == 0 );
|
||||||
// existing file link
|
// existing file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
||||||
== (ssize_t)strlen(existingFile) );
|
== (ssize_t)strlen(existingFile) );
|
||||||
CPPUNIT_ASSERT( strcmp(buffer, existingFile) == 0 );
|
CPPUNIT_ASSERT( strcmp(buffer, existingFile) == 0 );
|
||||||
// existing cyclic link
|
// existing cyclic link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(cyclicLink1) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(cyclicLink1) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
||||||
== (ssize_t)strlen(cyclicLink2) );
|
== (ssize_t)strlen(cyclicLink2) );
|
||||||
CPPUNIT_ASSERT( strcmp(buffer, cyclicLink2) == 0 );
|
CPPUNIT_ASSERT( strcmp(buffer, cyclicLink2) == 0 );
|
||||||
// existing link to non-existing entry
|
// existing link to non-existing entry
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(badLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(badLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer))
|
||||||
== (ssize_t)strlen(nonExisting) );
|
== (ssize_t)strlen(nonExisting) );
|
||||||
CPPUNIT_ASSERT( strcmp(buffer, nonExisting) == 0 );
|
CPPUNIT_ASSERT( strcmp(buffer, nonExisting) == 0 );
|
||||||
// non-existing link
|
// non-existing link
|
||||||
// R5: returns B_BAD_ADDRESS instead of (as doc'ed) B_FILE_ERROR
|
// R5: returns B_BAD_ADDRESS instead of (as doc'ed) B_FILE_ERROR
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(nonExisting) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo(nonExisting) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( equals(link.ReadLink(buffer, sizeof(buffer)),
|
CPPUNIT_ASSERT( equals(link.ReadLink(buffer, sizeof(buffer)),
|
||||||
B_BAD_ADDRESS, B_FILE_ERROR) );
|
B_BAD_ADDRESS, B_FILE_ERROR) );
|
||||||
// dir
|
// dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(existingDir) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(existingDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer)) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer)) == B_BAD_VALUE );
|
||||||
// file
|
// file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(existingFile) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(existingFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer)) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.ReadLink(buffer, sizeof(buffer)) == B_BAD_VALUE );
|
||||||
// small buffer
|
// small buffer
|
||||||
// R5: returns the size of the contents, not the number of bytes copied
|
// R5: returns the size of the contents, not the number of bytes copied
|
||||||
// OBOS: ... so do we
|
// OBOS: ... so do we
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
char smallBuffer[2];
|
char smallBuffer[2];
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.ReadLink(smallBuffer, sizeof(smallBuffer))
|
CPPUNIT_ASSERT( link.ReadLink(smallBuffer, sizeof(smallBuffer))
|
||||||
== (ssize_t)strlen(dirLink) );
|
== (ssize_t)strlen(dirLink) );
|
||||||
CPPUNIT_ASSERT( strncmp(smallBuffer, existingDir, sizeof(smallBuffer)) == 0 );
|
CPPUNIT_ASSERT( strncmp(smallBuffer, existingDir, sizeof(smallBuffer)) == 0 );
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( equals(link.ReadLink(NULL, sizeof(buffer)), B_BAD_ADDRESS,
|
CPPUNIT_ASSERT( equals(link.ReadLink(NULL, sizeof(buffer)), B_BAD_ADDRESS,
|
||||||
B_BAD_VALUE) );
|
B_BAD_VALUE) );
|
||||||
@@ -583,14 +582,14 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
BPath path;
|
BPath path;
|
||||||
// 1. MakeLinkedPath(const char*, BPath*)
|
// 1. MakeLinkedPath(const char*, BPath*)
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( equals(link.MakeLinkedPath("/boot", &path), B_BAD_ADDRESS,
|
CPPUNIT_ASSERT( equals(link.MakeLinkedPath("/boot", &path), B_BAD_ADDRESS,
|
||||||
B_FILE_ERROR) );
|
B_FILE_ERROR) );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
path.Unset();
|
path.Unset();
|
||||||
// existing absolute dir link
|
// existing absolute dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", &path)
|
||||||
== (ssize_t)strlen(existingDir) );
|
== (ssize_t)strlen(existingDir) );
|
||||||
@@ -599,7 +598,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
link.Unset();
|
link.Unset();
|
||||||
path.Unset();
|
path.Unset();
|
||||||
// existing absolute file link
|
// existing absolute file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", &path)
|
||||||
== (ssize_t)strlen(existingFile) );
|
== (ssize_t)strlen(existingFile) );
|
||||||
@@ -608,7 +607,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
link.Unset();
|
link.Unset();
|
||||||
path.Unset();
|
path.Unset();
|
||||||
// existing absolute cyclic link
|
// existing absolute cyclic link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(cyclicLink1) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(cyclicLink1) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", &path)
|
||||||
== (ssize_t)strlen(cyclicLink2) );
|
== (ssize_t)strlen(cyclicLink2) );
|
||||||
@@ -617,7 +616,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
link.Unset();
|
link.Unset();
|
||||||
path.Unset();
|
path.Unset();
|
||||||
// existing relative dir link
|
// existing relative dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BPath entryPath;
|
BPath entryPath;
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
||||||
@@ -632,7 +631,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
entryPath.Unset();
|
entryPath.Unset();
|
||||||
// existing relative file link
|
// existing relative file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetPath(&entryPath) == B_OK );
|
CPPUNIT_ASSERT( entry.GetPath(&entryPath) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(relFileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(relFileLink) == B_OK );
|
||||||
@@ -645,16 +644,16 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
entryPath.Unset();
|
entryPath.Unset();
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
// R5: crashs, when passing a NULL path
|
// R5: crashs, when passing a NULL path
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.MakeLinkedPath("/boot", NULL) == B_BAD_VALUE );
|
||||||
#endif
|
#endif
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath((const char*)NULL, &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath((const char*)NULL, &path)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
// R5: crashs, when passing a NULL path
|
// R5: crashs, when passing a NULL path
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath((const char*)NULL, NULL)
|
CPPUNIT_ASSERT( link.MakeLinkedPath((const char*)NULL, NULL)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
#endif
|
#endif
|
||||||
@@ -663,7 +662,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
|
|
||||||
// 2. MakeLinkedPath(const BDirectory*, BPath*)
|
// 2. MakeLinkedPath(const BDirectory*, BPath*)
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
link.Unset();
|
link.Unset();
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
||||||
BDirectory dir;
|
BDirectory dir;
|
||||||
@@ -674,7 +673,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
path.Unset();
|
path.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// existing absolute dir link
|
// existing absolute dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
||||||
@@ -685,7 +684,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
path.Unset();
|
path.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// existing absolute file link
|
// existing absolute file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(fileLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
||||||
@@ -696,7 +695,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
path.Unset();
|
path.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// existing absolute cyclic link
|
// existing absolute cyclic link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(cyclicLink1) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(cyclicLink1) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
||||||
@@ -707,7 +706,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
path.Unset();
|
path.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// existing relative dir link
|
// existing relative dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetPath(&entryPath) == B_OK );
|
CPPUNIT_ASSERT( entry.GetPath(&entryPath) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(relDirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(relDirLink) == B_OK );
|
||||||
@@ -722,7 +721,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
entryPath.Unset();
|
entryPath.Unset();
|
||||||
// existing relative file link
|
// existing relative file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
CPPUNIT_ASSERT( entry.SetTo(existingFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( entry.GetPath(&entryPath) == B_OK );
|
CPPUNIT_ASSERT( entry.GetPath(&entryPath) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.SetTo(relFileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(relFileLink) == B_OK );
|
||||||
@@ -737,7 +736,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
entry.Unset();
|
entry.Unset();
|
||||||
entryPath.Unset();
|
entryPath.Unset();
|
||||||
// absolute link, uninitialized dir
|
// absolute link, uninitialized dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT);
|
CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT);
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
||||||
@@ -745,7 +744,7 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
CPPUNIT_ASSERT( path.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( path.InitCheck() == B_OK );
|
||||||
CPPUNIT_ASSERT( string(existingDir) == path.Path() );
|
CPPUNIT_ASSERT( string(existingDir) == path.Path() );
|
||||||
// absolute link, badly initialized dir
|
// absolute link, badly initialized dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND);
|
CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND);
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, &path)
|
||||||
@@ -756,14 +755,14 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
path.Unset();
|
path.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// relative link, uninitialized dir
|
// relative link, uninitialized dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(relDirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(relDirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT);
|
CPPUNIT_ASSERT( dir.InitCheck() == B_NO_INIT);
|
||||||
CPPUNIT_ASSERT( equals(link.MakeLinkedPath(&dir, &path), B_NO_INIT,
|
CPPUNIT_ASSERT( equals(link.MakeLinkedPath(&dir, &path), B_NO_INIT,
|
||||||
B_BAD_VALUE) );
|
B_BAD_VALUE) );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
// relative link, badly initialized dir
|
// relative link, badly initialized dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(relDirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(relDirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND);
|
CPPUNIT_ASSERT( dir.SetTo(nonExisting) == B_ENTRY_NOT_FOUND);
|
||||||
CPPUNIT_ASSERT( equals(link.MakeLinkedPath(&dir, &path), B_NO_INIT,
|
CPPUNIT_ASSERT( equals(link.MakeLinkedPath(&dir, &path), B_NO_INIT,
|
||||||
@@ -772,18 +771,18 @@ SymLinkTest::MakeLinkedPathTest()
|
|||||||
path.Unset();
|
path.Unset();
|
||||||
dir.Unset();
|
dir.Unset();
|
||||||
// bad args
|
// bad args
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
CPPUNIT_ASSERT( dir.SetTo("/boot") == B_OK);
|
||||||
// R5: crashs, when passing a NULL path
|
// R5: crashs, when passing a NULL path
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, NULL) == B_BAD_VALUE );
|
CPPUNIT_ASSERT( link.MakeLinkedPath(&dir, NULL) == B_BAD_VALUE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath((const BDirectory*)NULL, &path)
|
CPPUNIT_ASSERT( link.MakeLinkedPath((const BDirectory*)NULL, &path)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
// R5: crashs, when passing a NULL path
|
// R5: crashs, when passing a NULL path
|
||||||
#if !SK_TEST_R5
|
#if !TEST_R5
|
||||||
CPPUNIT_ASSERT( link.MakeLinkedPath((const BDirectory*)NULL, NULL)
|
CPPUNIT_ASSERT( link.MakeLinkedPath((const BDirectory*)NULL, NULL)
|
||||||
== B_BAD_VALUE );
|
== B_BAD_VALUE );
|
||||||
#endif
|
#endif
|
||||||
@@ -803,32 +802,32 @@ SymLinkTest::IsAbsoluteTest()
|
|||||||
const char *nonExisting = nonExistingDirname;
|
const char *nonExisting = nonExistingDirname;
|
||||||
BSymLink link;
|
BSymLink link;
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
||||||
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
// existing absolute dir link
|
// existing absolute dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(dirLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.IsAbsolute() == true );
|
CPPUNIT_ASSERT( link.IsAbsolute() == true );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
// existing relative file link
|
// existing relative file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(relFileLink) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(relFileLink) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
// non-existing link
|
// non-existing link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(nonExisting) == B_ENTRY_NOT_FOUND );
|
CPPUNIT_ASSERT( link.SetTo(nonExisting) == B_ENTRY_NOT_FOUND );
|
||||||
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
// dir
|
// dir
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(existingDir) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(existingDir) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
// file
|
// file
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
CPPUNIT_ASSERT( link.SetTo(existingFile) == B_OK );
|
CPPUNIT_ASSERT( link.SetTo(existingFile) == B_OK );
|
||||||
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
CPPUNIT_ASSERT( link.IsAbsolute() == false );
|
||||||
link.Unset();
|
link.Unset();
|
||||||
@@ -842,7 +841,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
const char *fileLink = fileLinkname;
|
const char *fileLink = fileLinkname;
|
||||||
// 1. copy constructor
|
// 1. copy constructor
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link;
|
BSymLink link;
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
CPPUNIT_ASSERT( link.InitCheck() == B_NO_INIT );
|
||||||
@@ -851,7 +850,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( equals(link2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(link2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
}
|
}
|
||||||
// existing dir link
|
// existing dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(dirLink);
|
BSymLink link(dirLink);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
@@ -859,7 +858,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( link2.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link2.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
// existing file link
|
// existing file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(fileLink);
|
BSymLink link(fileLink);
|
||||||
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link.InitCheck() == B_OK );
|
||||||
@@ -869,7 +868,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
|
|
||||||
// 2. assignment operator
|
// 2. assignment operator
|
||||||
// uninitialized
|
// uninitialized
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link;
|
BSymLink link;
|
||||||
BSymLink link2;
|
BSymLink link2;
|
||||||
@@ -877,7 +876,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
// R5 returns B_BAD_VALUE instead of B_NO_INIT
|
// R5 returns B_BAD_VALUE instead of B_NO_INIT
|
||||||
CPPUNIT_ASSERT( equals(link2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(link2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
}
|
}
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link;
|
BSymLink link;
|
||||||
BSymLink link2(dirLink);
|
BSymLink link2(dirLink);
|
||||||
@@ -886,7 +885,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( equals(link2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
CPPUNIT_ASSERT( equals(link2.InitCheck(), B_BAD_VALUE, B_NO_INIT) );
|
||||||
}
|
}
|
||||||
// existing dir link
|
// existing dir link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(dirLink);
|
BSymLink link(dirLink);
|
||||||
BSymLink link2;
|
BSymLink link2;
|
||||||
@@ -894,7 +893,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
CPPUNIT_ASSERT( link2.InitCheck() == B_OK );
|
CPPUNIT_ASSERT( link2.InitCheck() == B_OK );
|
||||||
}
|
}
|
||||||
// existing file link
|
// existing file link
|
||||||
nextSubTest();
|
NextSubTest();
|
||||||
{
|
{
|
||||||
BSymLink link(fileLink);
|
BSymLink link(fileLink);
|
||||||
BSymLink link2;
|
BSymLink link2;
|
||||||
@@ -904,3 +903,7 @@ SymLinkTest::AssignmentTest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,3 +36,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // __sk_sym_link_test_h__
|
#endif // __sk_sym_link_test_h__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ rule CppUnitLibrary
|
|||||||
|
|
||||||
CppUnitLibrary
|
CppUnitLibrary
|
||||||
SemaphoreSyncObject.cpp
|
SemaphoreSyncObject.cpp
|
||||||
|
TestApp.cpp
|
||||||
TestCase.cpp
|
TestCase.cpp
|
||||||
TestListener.cpp
|
TestListener.cpp
|
||||||
TestShell.cpp
|
TestShell.cpp
|
||||||
TestSuite.cpp
|
TestSuite.cpp
|
||||||
|
TestUtils.cpp
|
||||||
ThreadedTestCase.cpp
|
ThreadedTestCase.cpp
|
||||||
cppunit/Asserter.cpp
|
cppunit/Asserter.cpp
|
||||||
cppunit/CompilerOutputter.cpp
|
cppunit/CompilerOutputter.cpp
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
// TestApp.cpp
|
||||||
|
|
||||||
|
#include <TestApp.h>
|
||||||
|
|
||||||
|
// TestHandler
|
||||||
|
|
||||||
|
// MessageReceived
|
||||||
|
void
|
||||||
|
TestHandler::MessageReceived(BMessage *message)
|
||||||
|
{
|
||||||
|
// clone and push it
|
||||||
|
BMessage *clone = new BMessage(*message);
|
||||||
|
fQueue.Lock();
|
||||||
|
fQueue.AddMessage(clone);
|
||||||
|
fQueue.Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Queue
|
||||||
|
BMessageQueue &
|
||||||
|
TestHandler::Queue()
|
||||||
|
{
|
||||||
|
return fQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TestApp
|
||||||
|
|
||||||
|
// constructor
|
||||||
|
TestApp::TestApp(const char *signature)
|
||||||
|
: BApplication(signature),
|
||||||
|
fAppThread(B_ERROR),
|
||||||
|
fHandler()
|
||||||
|
{
|
||||||
|
AddHandler(&fHandler);
|
||||||
|
Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init
|
||||||
|
status_t
|
||||||
|
TestApp::Init()
|
||||||
|
{
|
||||||
|
status_t error = B_OK;
|
||||||
|
fAppThread = spawn_thread(&_AppThreadStart, "query app",
|
||||||
|
B_NORMAL_PRIORITY, this);
|
||||||
|
if (fAppThread < 0)
|
||||||
|
error = fAppThread;
|
||||||
|
else {
|
||||||
|
error = resume_thread(fAppThread);
|
||||||
|
if (error != B_OK)
|
||||||
|
kill_thread(fAppThread);
|
||||||
|
}
|
||||||
|
if (error != B_OK)
|
||||||
|
fAppThread = B_ERROR;
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Terminate
|
||||||
|
void
|
||||||
|
TestApp::Terminate()
|
||||||
|
{
|
||||||
|
PostMessage(B_QUIT_REQUESTED, this);
|
||||||
|
int32 result;
|
||||||
|
wait_for_thread(fAppThread, &result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadyToRun
|
||||||
|
void
|
||||||
|
TestApp::ReadyToRun()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handler
|
||||||
|
TestHandler &
|
||||||
|
TestApp::Handler()
|
||||||
|
{
|
||||||
|
return fHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
// _AppThreadStart
|
||||||
|
int32
|
||||||
|
TestApp::_AppThreadStart(void *data)
|
||||||
|
{
|
||||||
|
if (TestApp *app = (TestApp*)data) {
|
||||||
|
app->Lock();
|
||||||
|
app->Run();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ BTestCase::tearDown() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
BTestCase::NextSubTest() {
|
BTestCase::NextSubTest() {
|
||||||
if (BeVerbose()) {
|
if (BTestShell::GlobalBeVerbose()) {
|
||||||
printf("[%ld]", fSubTestNum++);
|
printf("[%ld]", fSubTestNum++);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
@@ -26,13 +26,13 @@ BTestCase::NextSubTest() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
BTestCase::NextSubTestBlock() {
|
BTestCase::NextSubTestBlock() {
|
||||||
if (BeVerbose())
|
if (BTestShell::GlobalBeVerbose())
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BTestCase::Outputf(const char *str, ...) {
|
BTestCase::Outputf(const char *str, ...) {
|
||||||
if (BeVerbose()) {
|
if (BTestShell::GlobalBeVerbose()) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, str);
|
va_start(args, str);
|
||||||
vprintf(str, args);
|
vprintf(str, args);
|
||||||
@@ -60,8 +60,3 @@ BTestCase::RestoreCWD(const char *alternate) {
|
|||||||
chdir(alternate);
|
chdir(alternate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
BTestCase::BeVerbose() {
|
|
||||||
BTestShell *shell = BTestShell::Shell();
|
|
||||||
return ((shell && shell->BeVerbose()) || !shell);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -23,9 +23,15 @@ BTestShell::BTestShell(const std::string &description, SyncObject *syncObject)
|
|||||||
, fDescription(description)
|
, fDescription(description)
|
||||||
, fTestResults(syncObject)
|
, fTestResults(syncObject)
|
||||||
, fListTestsAndExit(false)
|
, fListTestsAndExit(false)
|
||||||
|
, fTestDir(NULL)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BTestShell::~BTestShell() {
|
||||||
|
delete fTestDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BTestShell::AddSuite(BTestSuite *suite) {
|
BTestShell::AddSuite(BTestSuite *suite) {
|
||||||
if (suite) {
|
if (suite) {
|
||||||
@@ -95,6 +101,9 @@ BTestShell::LoadSuitesFrom(BDirectory *libDir) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
BTestShell::Run(int argc, char *argv[]) {
|
BTestShell::Run(int argc, char *argv[]) {
|
||||||
|
// Make note of which directory we started in
|
||||||
|
UpdateTestDir(argv);
|
||||||
|
|
||||||
// Parse the command line args
|
// Parse the command line args
|
||||||
if (!ProcessArguments(argc, argv))
|
if (!ProcessArguments(argc, argv))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -154,6 +163,11 @@ BTestShell::Verbosity() const {
|
|||||||
return fVerbosityLevel;
|
return fVerbosityLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
BTestShell::TestDir() const {
|
||||||
|
return (fTestDir ? fTestDir->Path() : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BTestShell::PrintDescription(int argc, char *argv[]) {
|
BTestShell::PrintDescription(int argc, char *argv[]) {
|
||||||
cout << endl << fDescription;
|
cout << endl << fDescription;
|
||||||
@@ -253,8 +267,8 @@ BTestShell::InitOutput() {
|
|||||||
cout << "Tests" << endl;
|
cout << "Tests" << endl;
|
||||||
cout << "------------------------------------------------------------------------------" << endl;
|
cout << "------------------------------------------------------------------------------" << endl;
|
||||||
fTestResults.addListener(new BTestListener);
|
fTestResults.addListener(new BTestListener);
|
||||||
fTestResults.addListener(&fResultsCollector);
|
|
||||||
}
|
}
|
||||||
|
fTestResults.addListener(&fResultsCollector);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -319,3 +333,16 @@ BTestShell::LoadDynamicSuites() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BTestShell::UpdateTestDir(char *argv[]) {
|
||||||
|
BPath path(argv[0]);
|
||||||
|
if (path.InitCheck() == B_OK) {
|
||||||
|
delete fTestDir;
|
||||||
|
fTestDir = new BPath();
|
||||||
|
if (path.GetParent(fTestDir) != B_OK)
|
||||||
|
cout << "Couldn't get test dir." << endl;
|
||||||
|
} else
|
||||||
|
cout << "Couldn't find the path to the test app." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,199 @@
|
|||||||
|
// TestUtils.cpp
|
||||||
|
|
||||||
|
#include <TestUtils.h>
|
||||||
|
#include <TestShell.h>
|
||||||
|
|
||||||
|
status_t DecodeResult(status_t result) {
|
||||||
|
if (!BTestShell::GlobalBeVerbose())
|
||||||
|
return result;
|
||||||
|
|
||||||
|
std::string str;
|
||||||
|
switch (result) {
|
||||||
|
|
||||||
|
case B_OK:
|
||||||
|
str = "B_OK";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_ERROR:
|
||||||
|
str = "B_ERROR";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
// Storage Kit Errors
|
||||||
|
case B_FILE_ERROR:
|
||||||
|
str = "B_FILE_ERROR";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_FILE_NOT_FOUND:
|
||||||
|
str = "B_FILE_NOT_FOUND";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_FILE_EXISTS:
|
||||||
|
str = "B_FILE_EXISTS";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_ENTRY_NOT_FOUND:
|
||||||
|
str = "B_ENTRY_NOT_FOUND";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_NAME_TOO_LONG:
|
||||||
|
str = "B_NAME_TOO_LONG";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_DIRECTORY_NOT_EMPTY:
|
||||||
|
str = "B_DIRECTORY_NOT_EMPTY";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_DEVICE_FULL:
|
||||||
|
str = "B_DEVICE_FULL";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_READ_ONLY_DEVICE:
|
||||||
|
str = "B_READ_ONLY_DEVICE";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_IS_A_DIRECTORY:
|
||||||
|
str = "B_IS_A_DIRECTORY";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_NO_MORE_FDS:
|
||||||
|
str = "B_NO_MORE_FDS";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_CROSS_DEVICE_LINK:
|
||||||
|
str = "B_CROSS_DEVICE_LINK";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_LINK_LIMIT:
|
||||||
|
str = "B_LINK_LIMIT";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_BUSTED_PIPE:
|
||||||
|
str = "B_BUSTED_PIPE";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_UNSUPPORTED:
|
||||||
|
str = "B_UNSUPPORTED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_PARTITION_TOO_SMALL:
|
||||||
|
str = "B_PARTITION_TOO_SMALL";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
// General Errors
|
||||||
|
case B_NO_MEMORY:
|
||||||
|
str = "B_NO_MEMORY";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_IO_ERROR:
|
||||||
|
str = "B_IO_ERROR";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_PERMISSION_DENIED:
|
||||||
|
str = "B_PERMISSION_DENIED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_BAD_INDEX:
|
||||||
|
str = "B_BAD_INDEX";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_BAD_TYPE:
|
||||||
|
str = "B_BAD_TYPE";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_BAD_VALUE:
|
||||||
|
str = "B_BAD_VALUE";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_MISMATCHED_VALUES:
|
||||||
|
str = "B_MISMATCHED_VALUES";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_NAME_NOT_FOUND:
|
||||||
|
str = "B_NAME_NOT_FOUND";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_NAME_IN_USE:
|
||||||
|
str = "B_NAME_IN_USE";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_TIMED_OUT:
|
||||||
|
str = "B_TIMED_OUT";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_INTERRUPTED:
|
||||||
|
str = "B_INTERRUPTED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_WOULD_BLOCK:
|
||||||
|
str = "B_WOULD_BLOCK";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_CANCELED:
|
||||||
|
str = "B_CANCELED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_NO_INIT:
|
||||||
|
str = "B_NO_INIT";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_BUSY:
|
||||||
|
str = "B_BUSY";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_NOT_ALLOWED:
|
||||||
|
str = "B_NOT_ALLOWED";
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
// Kernel Errors
|
||||||
|
case B_BAD_ADDRESS:
|
||||||
|
str = "B_BAD_ADDRESS";
|
||||||
|
break;
|
||||||
|
|
||||||
|
// OS Errors
|
||||||
|
case B_BAD_PORT_ID:
|
||||||
|
str = "B_BAD_PORT_ID";
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Anything Else
|
||||||
|
default:
|
||||||
|
str = "??????????";
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << endl << "DecodeResult() -- " "0x" << hex << result << " (" << dec << result << ") == " << str << endl;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecCommand(const char *command) {
|
||||||
|
if (command)
|
||||||
|
system(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecCommand(const char *command, const char *parameter) {
|
||||||
|
if (command && parameter) {
|
||||||
|
char *cmdLine = new char[strlen(command) + strlen(parameter) + 1];
|
||||||
|
strcpy(cmdLine, command);
|
||||||
|
strcat(cmdLine, parameter);
|
||||||
|
system(cmdLine);
|
||||||
|
delete[] cmdLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecCommand(const char *command, const char *parameter1,
|
||||||
|
const char *parameter2) {
|
||||||
|
if (command && parameter1 && parameter2) {
|
||||||
|
char *cmdLine = new char[strlen(command) + strlen(parameter1)
|
||||||
|
+ 1 + strlen(parameter2) + 1];
|
||||||
|
strcpy(cmdLine, command);
|
||||||
|
strcat(cmdLine, parameter1);
|
||||||
|
strcat(cmdLine, " ");
|
||||||
|
strcat(cmdLine, parameter2);
|
||||||
|
system(cmdLine);
|
||||||
|
delete[] cmdLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include <TestShell.h>
|
||||||
#include <ThreadedTestCase.h>
|
#include <ThreadedTestCase.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -48,7 +49,7 @@ BThreadedTestCase::NextSubTest() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
BThreadedTestCase::Outputf(const char *str, ...) {
|
BThreadedTestCase::Outputf(const char *str, ...) {
|
||||||
if (BeVerbose()) {
|
if (BTestShell::GlobalBeVerbose()) {
|
||||||
// Figure out if this is a multithreaded test or not
|
// Figure out if this is a multithreaded test or not
|
||||||
thread_id id = find_thread(NULL);
|
thread_id id = find_thread(NULL);
|
||||||
bool isSingleThreaded;
|
bool isSingleThreaded;
|
||||||
|
|||||||
Reference in New Issue
Block a user