From 5f514448e1dbe84bf6ef47b8308bde1ac8e98033 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 16 Aug 2002 17:47:54 +0000 Subject: [PATCH] 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 --- src/tests/kits/storage/NodeInfoTest.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/tests/kits/storage/NodeInfoTest.cpp b/src/tests/kits/storage/NodeInfoTest.cpp index a021ff33e9..790571ad1a 100644 --- a/src/tests/kits/storage/NodeInfoTest.cpp +++ b/src/tests/kits/storage/NodeInfoTest.cpp @@ -333,13 +333,13 @@ void NodeInfoTest::TypeTest() { // status_t GetType(char *type) const - // * NULL type => B_BAD_ADDRESS + // * NULL type => B_BAD_ADDRESS/B_BAD_VALUE NextSubTest(); { BNode node(testFile1); BNodeInfo nodeInfo; 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 NextSubTest(); @@ -410,21 +410,28 @@ NodeInfoTest::TypeTest() CHK(strcmp(invalidTestType, type) == 0); CheckTypeAttr(node, invalidTestType); } - // * type string too long => B_OK + // * type string too long => B_OK/B_BAD_VALUE NextSubTest(); { BNode node(testFile1); BNodeInfo nodeInfo; 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); // get char type[1024]; CHK(nodeInfo.GetType(type) == B_OK); // R5: Returns a string one character shorter than the original string -#ifndef TEST_R5 - CHK(strcmp(tooLongTestType, type) == 0); -#endif +// CHK(strcmp(tooLongTestType, type) == 0); CheckTypeAttr(node, tooLongTestType); +#else + CHK(nodeInfo.SetType(tooLongTestType) == B_BAD_VALUE); + CheckNoAttr(node, kTypeAttribute); +#endif } } @@ -583,13 +590,14 @@ void NodeInfoTest::PreferredAppTest() { // 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(); { BNode node(testFile1); BNodeInfo nodeInfo; 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 NextSubTest();