Adjusted some tests to make the OBOS version of BNodeInfo pass them.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@781 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2002-08-16 17:47:54 +00:00
parent 7835957412
commit 5f514448e1

View File

@ -333,13 +333,13 @@ void
NodeInfoTest::TypeTest() NodeInfoTest::TypeTest()
{ {
// status_t GetType(char *type) const // status_t GetType(char *type) const
// * NULL type => B_BAD_ADDRESS // * NULL type => B_BAD_ADDRESS/B_BAD_VALUE
NextSubTest(); NextSubTest();
{ {
BNode node(testFile1); BNode node(testFile1);
BNodeInfo nodeInfo; BNodeInfo nodeInfo;
CHK(nodeInfo.SetTo(&node) == B_OK); CHK(nodeInfo.SetTo(&node) == B_OK);
CHK(nodeInfo.GetType(NULL) == B_BAD_ADDRESS); CHK(equals(nodeInfo.GetType(NULL), B_BAD_ADDRESS, B_BAD_VALUE));
} }
// * uninitialized => B_NO_INIT // * uninitialized => B_NO_INIT
NextSubTest(); NextSubTest();
@ -410,21 +410,28 @@ NodeInfoTest::TypeTest()
CHK(strcmp(invalidTestType, type) == 0); CHK(strcmp(invalidTestType, type) == 0);
CheckTypeAttr(node, invalidTestType); CheckTypeAttr(node, invalidTestType);
} }
// * type string too long => B_OK // * type string too long => B_OK/B_BAD_VALUE
NextSubTest(); NextSubTest();
{ {
BNode node(testFile1); BNode node(testFile1);
BNodeInfo nodeInfo; BNodeInfo nodeInfo;
CHK(nodeInfo.SetTo(&node) == B_OK); CHK(nodeInfo.SetTo(&node) == B_OK);
// remove attr first
CHK(nodeInfo.SetType(NULL) == B_OK);
// R5: Doesn't complain when setting a too long string.
// OBOS: Handles this as an error case.
#ifdef TEST_R5
CHK(nodeInfo.SetType(tooLongTestType) == B_OK); CHK(nodeInfo.SetType(tooLongTestType) == B_OK);
// get // get
char type[1024]; char type[1024];
CHK(nodeInfo.GetType(type) == B_OK); CHK(nodeInfo.GetType(type) == B_OK);
// R5: Returns a string one character shorter than the original string // R5: Returns a string one character shorter than the original string
#ifndef TEST_R5 // CHK(strcmp(tooLongTestType, type) == 0);
CHK(strcmp(tooLongTestType, type) == 0);
#endif
CheckTypeAttr(node, tooLongTestType); CheckTypeAttr(node, tooLongTestType);
#else
CHK(nodeInfo.SetType(tooLongTestType) == B_BAD_VALUE);
CheckNoAttr(node, kTypeAttribute);
#endif
} }
} }
@ -583,13 +590,14 @@ void
NodeInfoTest::PreferredAppTest() NodeInfoTest::PreferredAppTest()
{ {
// status_t GetPreferredApp(char *signature, app_verb verb = B_OPEN) const // status_t GetPreferredApp(char *signature, app_verb verb = B_OPEN) const
// * NULL signature => B_BAD_ADDRESS // * NULL signature => B_BAD_ADDRESS/B_BAD_VALUE
NextSubTest(); NextSubTest();
{ {
BNode node(testFile1); BNode node(testFile1);
BNodeInfo nodeInfo; BNodeInfo nodeInfo;
CHK(nodeInfo.SetTo(&node) == B_OK); CHK(nodeInfo.SetTo(&node) == B_OK);
CHK(nodeInfo.GetPreferredApp(NULL) == B_BAD_ADDRESS); CHK(equals(nodeInfo.GetPreferredApp(NULL), B_BAD_ADDRESS,
B_BAD_VALUE));
} }
// * uninitialized => B_NO_INIT // * uninitialized => B_NO_INIT
NextSubTest(); NextSubTest();