KPath.Adopt(): Fixed path length.
* Issue was hidden due to inappropriate test values; changed test to uncover it.
This commit is contained in:
@@ -96,6 +96,7 @@ KPath::Adopt(KPath& other)
|
|||||||
|
|
||||||
fBuffer = other.fBuffer;
|
fBuffer = other.fBuffer;
|
||||||
fBufferSize = other.fBufferSize;
|
fBufferSize = other.fBufferSize;
|
||||||
|
fPathLength = other.fPathLength;
|
||||||
|
|
||||||
other.fBuffer = NULL;
|
other.fBuffer = NULL;
|
||||||
other.fBufferSize = 0;
|
other.fBufferSize = 0;
|
||||||
|
|||||||
@@ -179,19 +179,19 @@ KPathTest::TestRemoveLeaf()
|
|||||||
void
|
void
|
||||||
KPathTest::TestAdopt()
|
KPathTest::TestAdopt()
|
||||||
{
|
{
|
||||||
KPath one("one", false, 10);
|
KPath one("first", false, 10);
|
||||||
CPPUNIT_ASSERT(one.InitCheck() == B_OK);
|
CPPUNIT_ASSERT(one.InitCheck() == B_OK);
|
||||||
CPPUNIT_ASSERT(one.BufferSize() == 10);
|
CPPUNIT_ASSERT(one.BufferSize() == 10);
|
||||||
CPPUNIT_ASSERT(one.Length() == 3);
|
CPPUNIT_ASSERT(one.Length() == 5);
|
||||||
KPath two("two", false, 20);
|
KPath two("second", false, 20);
|
||||||
CPPUNIT_ASSERT(two.InitCheck() == B_OK);
|
CPPUNIT_ASSERT(two.InitCheck() == B_OK);
|
||||||
CPPUNIT_ASSERT(two.BufferSize() == 20);
|
CPPUNIT_ASSERT(two.BufferSize() == 20);
|
||||||
|
|
||||||
one.Adopt(two);
|
one.Adopt(two);
|
||||||
CPPUNIT_ASSERT(one.InitCheck() == B_OK);
|
CPPUNIT_ASSERT(one.InitCheck() == B_OK);
|
||||||
CPPUNIT_ASSERT(one.BufferSize() == 20);
|
CPPUNIT_ASSERT(one.BufferSize() == 20);
|
||||||
CPPUNIT_ASSERT(one.Length() == 3);
|
CPPUNIT_ASSERT(one.Length() == 6);
|
||||||
CPPUNIT_ASSERT(strcmp(one.Path(), "two") == 0);
|
CPPUNIT_ASSERT(strcmp(one.Path(), "second") == 0);
|
||||||
CPPUNIT_ASSERT(two.Length() == 0);
|
CPPUNIT_ASSERT(two.Length() == 0);
|
||||||
CPPUNIT_ASSERT(two.BufferSize() == 0);
|
CPPUNIT_ASSERT(two.BufferSize() == 0);
|
||||||
// CPPUNIT_ASSERT(two.InitCheck() == B_NO_INIT);
|
// CPPUNIT_ASSERT(two.InitCheck() == B_NO_INIT);
|
||||||
|
|||||||
Reference in New Issue
Block a user