diff --git a/tests/46engine.tests b/tests/46engine.tests index f2059ab32..b5464d3e0 100644 --- a/tests/46engine.tests +++ b/tests/46engine.tests @@ -7,5 +7,17 @@ return: 0 END -PLANNED "SourceNode_test" SourceNode_test < + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "lib/test/run.hpp" +#include "lib/error.hpp" + +#include "proc/engine/procnode.hpp" +#include "proc/engine/bufftable.hpp" +#include "lib/refarray.hpp" + +#include +#include +#include + +using test::Test; +using std::cout; +using std::rand; + + +namespace engine{ +namespace test { + + namespace { // used internally + + const uint TABLE_SIZ = 100000; + const uint CHUNK_MAX = 8000; + const uint WIDTH_MAX = 3; + + + /** just some crap to pass in as ctor argument... */ + template + struct DummyArray : lib::RefArray + { + E decoy; + E const& operator[] (size_t) const { return decoy; } + size_t size() const { return CHUNK_MAX;} + }; + DummyArray dummy1; + DummyArray dummy2; + + + /** a "hijacked" WiringDescriptor requesting + * a random number of inputs and outputs */ + struct MockSizeRequest + : WiringDescriptor + { + uint ii,oo; + + MockSizeRequest() + : WiringDescriptor(dummy1,dummy2,0,NodeID()), + ii(rand() % CHUNK_MAX), + oo(rand() % CHUNK_MAX) + { } + + virtual uint getNrI() const { return ii; } + virtual uint getNrO() const { return oo; } + + virtual BuffHandle callDown (State&, uint) const + { throw lumiera::Error("not intended to be called"); } + }; + + + + void* + detect_start_level (BuffTableStorage& sto) + { + return BuffTableChunk(MockSizeRequest(), sto ).outHandle; + } // address of first available storage element + + + inline void* + first_behind (BuffTable const& thisChunk, const uint nrI) + { + return &thisChunk.inHandle[nrI]; + } + + + inline bool + not_within(void* candidate, void* lower, void* upper) + { + return (candidate < lower) || (upper <= candidate); + } + + + bool + consistencyCheck (BuffTable const& b, WiringDescriptor const& num, void* lastLevel) + { + return (b.outHandle == lastLevel ) // storage is allocated continuously + && (b.outBuff <= b.inBuff ) // input slots are behind the output slots + && (b.outHandle <= b.inHandle) + && (b.inBuff == &b.outBuff [num.getNrO()]) + && (b.inHandle == &b.outHandle[num.getNrO()]) + && (not_within(b.outBuff, b.outHandle, &b.inHandle[num.getNrO()])) // storage doesn't overlap + && (not_within(b.inBuff, b.outHandle, &b.inHandle[num.getNrO()])) + && (not_within(b.outHandle, b.outBuff, &b.inBuff[num.getNrO()])) + && (not_within(b.inHandle, b.outBuff, &b.inBuff[num.getNrO()])) + ; + } + } // (End) internal defs + + + + /******************************************************************* + * @test create a random pattern of recursive invocations, each + * allocating a chunk out of a global buffer table storage. + * After returning, each allocation should be cleanly + * deallocated and the internal level in the storage vector + * should have doped to zero again. + */ + class BuffTable_test : public Test + { + typedef boost::scoped_ptr PSto; + + PSto pStorage; + ulong counter; + + virtual void run(Arg) + { + counter = 0; + std::srand (time (NULL)); + + // allocate storage block to be used chunk wise + pStorage.reset (new BuffTableStorage (TABLE_SIZ)); + + invocation (0, detect_start_level(*pStorage)); + + pStorage.reset(0); // dtor throws assertion error if corrupted + + cout << "BuffTable chunks allocated: "< - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -* *****************************************************/ - - -#include "lib/test/run.hpp" -#include "lib/error.hpp" - -#include "proc/engine/procnode.hpp" -#include "proc/engine/bufftable.hpp" -#include "lib/refarray.hpp" - -#include -#include -#include - -using test::Test; -using std::cout; -using std::rand; - - -namespace engine { - namespace test { - - namespace { // used internally - - const uint TABLE_SIZ = 100000; - const uint CHUNK_MAX = 8000; - const uint WIDTH_MAX = 3; - - - /** just some crap to pass in as ctor argument... */ - template - struct DummyArray : lib::RefArray - { - E decoy; - E const& operator[] (size_t) const { return decoy; } - size_t size() const { return CHUNK_MAX;} - }; - DummyArray dummy1; - DummyArray dummy2; - - - /** a "hijacked" WiringDescriptor requesting - * a random number of inputs and outputs */ - struct MockSizeRequest - : WiringDescriptor - { - uint ii,oo; - - MockSizeRequest() - : WiringDescriptor(dummy1,dummy2,0,NodeID()), - ii(rand() % CHUNK_MAX), - oo(rand() % CHUNK_MAX) - { } - - virtual uint getNrI() const { return ii; } - virtual uint getNrO() const { return oo; } - - virtual BuffHandle callDown (State&, uint) const - { throw lumiera::Error("not intended to be called"); } - }; - - - - void* - detect_start_level (BuffTableStorage& sto) - { - return BuffTableChunk(MockSizeRequest(), sto ).outHandle; - } // address of first available storage element - - - inline void* - first_behind (BuffTable const& thisChunk, const uint nrI) - { - return &thisChunk.inHandle[nrI]; - } - - - inline bool - not_within(void* candidate, void* lower, void* upper) - { - return (candidate < lower) || (upper <= candidate); - } - - - bool - consistencyCheck (BuffTable const& b, WiringDescriptor const& num, void* lastLevel) - { - return (b.outHandle == lastLevel ) // storage is allocated continuously - && (b.outBuff <= b.inBuff ) // input slots are behind the output slots - && (b.outHandle <= b.inHandle) - && (b.inBuff == &b.outBuff [num.getNrO()]) - && (b.inHandle == &b.outHandle[num.getNrO()]) - && (not_within(b.outBuff, b.outHandle, &b.inHandle[num.getNrO()])) // storage doesn't overlap - && (not_within(b.inBuff, b.outHandle, &b.inHandle[num.getNrO()])) - && (not_within(b.outHandle, b.outBuff, &b.inBuff[num.getNrO()])) - && (not_within(b.inHandle, b.outBuff, &b.inBuff[num.getNrO()])) - ; - } - } // (End) internal defs - - - - /******************************************************************* - * @test create a random pattern of recursive invocations, each - * allocating a chunk out of a global buffer table storage. - * After returning, each allocation should be cleanly - * deallocated and the internal level in the storage vector - * should have doped to zero again. - */ - class BuffTable_test : public Test - { - typedef boost::scoped_ptr PSto; - - PSto pStorage; - ulong counter; - - virtual void run(Arg) - { - counter = 0; - std::srand (time (NULL)); - - // allocate storage block to be used chunk wise - pStorage.reset (new BuffTableStorage (TABLE_SIZ)); - - invocation (0, detect_start_level(*pStorage)); - - pStorage.reset(0); // dtor throws assertion error if corrupted - - cout << "BuffTable chunks allocated: "< + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "lib/test/run.hpp" +//#include "lib/factory.hpp" +//#include "lib/util.hpp" + +//#include +#include + +//using boost::format; +using std::string; +using std::cout; + + +namespace engine{ +namespace test { + + + + + /******************************************************************* + * @test basic render node properties and behaviour. + */ + class NodeBasic_test : public Test + { + virtual void run(Arg) + { + UNIMPLEMENTED ("build a simple render node and then activate it"); + } + }; + + + /** Register this test class... */ + LAUNCHER (NodeBasic_test, "unit engine"); + + + +}} // namespace engine::test diff --git a/tests/components/proc/engine/node-fabrication-test.cpp b/tests/components/proc/engine/node-fabrication-test.cpp new file mode 100644 index 000000000..5827a77df --- /dev/null +++ b/tests/components/proc/engine/node-fabrication-test.cpp @@ -0,0 +1,59 @@ +/* + NodeFabrication(Test) - building render nodes + + Copyright (C) Lumiera.org + 2009, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "lib/test/run.hpp" +//#include "lib/factory.hpp" +//#include "lib/util.hpp" + +//#include +#include + +//using boost::format; +using std::string; +using std::cout; + + +namespace engine{ +namespace test { + + + + + /******************************************************************* + * @test creating and wiring various kinds of render nodes. + */ + class NodeFabrication_test : public Test + { + virtual void run(Arg) + { + UNIMPLEMENTED ("build and wire some render nodes"); + } + }; + + + /** Register this test class... */ + LAUNCHER (NodeFabrication_test, "unit engine"); + + + +}} // namespace engine::test diff --git a/tests/components/proc/engine/node-operation-test.cpp b/tests/components/proc/engine/node-operation-test.cpp new file mode 100644 index 000000000..f83c3eaf5 --- /dev/null +++ b/tests/components/proc/engine/node-operation-test.cpp @@ -0,0 +1,59 @@ +/* + NodeOperation(Test) - verify proper render node operation and calldown + + Copyright (C) Lumiera.org + 2009, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + + +#include "lib/test/run.hpp" +//#include "lib/factory.hpp" +//#include "lib/util.hpp" + +//#include +#include + +//using boost::format; +using std::string; +using std::cout; + + +namespace engine{ +namespace test { + + + + + /******************************************************************* + * @test check render node operation modes and collaboration. + */ + class NodeOperation_test : public Test + { + virtual void run(Arg) + { + UNIMPLEMENTED ("operate some render nodes as linked together"); + } + }; + + + /** Register this test class... */ + LAUNCHER (NodeOperation_test, "unit engine"); + + + +}} // namespace engine::test diff --git a/tests/components/proc/engine/sourcenodetest.cpp b/tests/components/proc/engine/node-source-test.cpp similarity index 64% rename from tests/components/proc/engine/sourcenodetest.cpp rename to tests/components/proc/engine/node-source-test.cpp index 47530f894..7a3b52f23 100644 --- a/tests/components/proc/engine/sourcenodetest.cpp +++ b/tests/components/proc/engine/node-source-test.cpp @@ -1,5 +1,5 @@ /* - SourceNode(Test) - unit test of the source reading render node + NodeSource(Test) - unit test of the source reading render node Copyright (C) Lumiera.org 2008, Hermann Vosseler @@ -33,31 +33,27 @@ using std::string; using std::cout; -namespace engine - { - namespace test +namespace engine{ +namespace test { + + + + + /******************************************************************* + * @test the source reading render node. + */ + class NodeSource_test : public Test { - - - - - /******************************************************************* - * @test the source reading render node. - */ - class SourceNode_test : public Test - { - virtual void run(Arg) - { - UNIMPLEMENTED ("render node pulling source data from backend"); - } - }; - - - /** Register this test class... */ - LAUNCHER (SourceNode_test, "unit engine"); - - - - } // namespace test - -} // namespace engine + virtual void run(Arg) + { + UNIMPLEMENTED ("render node pulling source data from backend"); + } + }; + + + /** Register this test class... */ + LAUNCHER (NodeSource_test, "unit engine"); + + + +}} // namespace engine::test