rewrite (planned) test to reflect the new metadata design

This commit is contained in:
Fischlurch 2011-09-24 15:27:58 +02:00
parent 5188982e71
commit bc756e42d9
3 changed files with 72 additions and 7 deletions

View file

@ -106,8 +106,10 @@ namespace engine {
public:
struct Entry
{
BufferState state () const;
BufferState state() const;
HashVal parentKey() const;
Entry& mark (BufferState newState);
Entry& markLocked (const void* buffer);
};
@ -122,12 +124,42 @@ namespace engine {
UNIMPLEMENTED ("combine the distinguishing properties into a single hash");
}
HashVal
key (HashVal parentKey, TypeHandler instanceFunc)
{
UNIMPLEMENTED ("create sub-type key");
}
HashVal
key (HashVal parentKey, LocalKey specifics)
{
UNIMPLEMENTED ("create sub-type key");
}
HashVal
key (HashVal parentKey, const void* concreteBuffer)
{
UNIMPLEMENTED ("create sub-object key for concrete buffer");
}
Entry&
get (HashVal key)
{
UNIMPLEMENTED ("access, possibly create metadata records");
}
bool
isKnown (HashVal key) const
{
UNIMPLEMENTED ("diagnostics: known record?");
}
bool
isLocked (HashVal key) const
{
UNIMPLEMENTED ("diagnostics: actually locked buffer instance record?");
}
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #834
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #834
};
@ -144,6 +176,13 @@ namespace engine {
UNIMPLEMENTED ("buffer state accounting");
}
/** */
HashVal
Metadata::Entry::parentKey () const
{
UNIMPLEMENTED ("retrieve the sparent (object or type) key");
}
Metadata::Entry&
Metadata::Entry::mark (BufferState newState)
{
@ -151,6 +190,12 @@ namespace engine {
return *this;
}
Metadata::Entry&
Metadata::Entry::markLocked (const void* buffer)
{
UNIMPLEMENTED ("transition to locked state");
return *this;
}

View file

@ -2,16 +2,16 @@ TESTING "Component Test Suite: Render Engine parts" ./test-components --group=en
PLANNED "BufferProviderProtocol_test" Buffer provider diagnostics <<END
PLANNED "Buffer provider diagnostics" BufferProviderProtocol_test <<END
return: 0
END
PLANNED "BufferMetadata_test" buffer metadata and state transitions <<END
PLANNED "buffer metadata and state transitions" BufferMetadata_test <<END
END
PLANNED "BuffTable_tsst" buffer table <<END
PLANNED "buffer table" BuffTable_test <<END
return: 0
END

View file

@ -66,6 +66,7 @@ namespace test {
const size_t SIZE_B = 1 + rand() % TEST_MAX_SIZE;
const HashVal JUST_SOMETHING = 123;
const void* const SOME_POINTER = &JUST_SOMETHING;
// const uint TEST_SIZE = 1024*1024;
// const uint TEST_ELMS = 20;
@ -131,12 +132,31 @@ namespace test {
Metadata::Entry& m1 = meta_->get(key);
CHECK (NIL == m1.state());
CHECK (!meta_->isLocked(key));
VERIFY_ERROR (LIFECYCLE, m1.mark(EMITTED) );
VERIFY_ERROR (LIFECYCLE, m1.mark(LOCKED) );
m1.mark (LOCKED);
CHECK (LOCKED == m1.state());
CHECK (LOCKED == meta_->get(key1).state());
Metadata::Entry& m2 = m1.markLocked (SOME_POINTER);
CHECK (!isSameObject (m1,m2));
CHECK (NIL == m1.state());
CHECK (LOCKED == m2.state());
HashVal keyX = meta_->key(key1, SOME_POINTER);
CHECK (meta_->isLocked(keyX));
CHECK (keyX != key1);
CHECK (keyX);
CHECK ( isSameObject (m1, meta_->get(key)));
CHECK ( isSameObject (m1, meta_->get(key1)));
CHECK ( isSameObject (m2, meta_->get(keyX)));
CHECK ( key1 == m2.parentKey());
m2.mark(FREE); // Warning: don't use the m2 reference anymore!
CHECK (!meta_->isLocked(keyX));
CHECK (!meta_->isKnown(keyX));
CHECK ( meta_->isKnown(key1));
VERIFY_ERROR (INVALID, meta_->get(keyX));
}