LUMIERA.clone/tests/core/steam/engine/node-base-test.cpp

109 lines
3.2 KiB
C++
Raw Normal View History

2007-09-03 02:33:47 +02:00
/*
NodeBase(Test) - unit test to cover the render node base elements
2010-12-17 23:28:49 +01:00
Copyright: clarify and simplify the file headers * Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
Copyright (C)
2009, Hermann Vosseler <Ichthyostega@web.de>
2010-12-17 23:28:49 +01:00
Copyright: clarify and simplify the file headers * Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
  **Lumiera** 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. See the file COPYING for further details.
2010-12-17 23:28:49 +01:00
Copyright: clarify and simplify the file headers * Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
* *****************************************************************/
2007-09-03 02:33:47 +02:00
/** @file node-base-test.cpp
** Unit test \ref NodeBase_test covers elementary components of render nodes.
*/
2007-09-03 02:33:47 +02:00
#include "lib/test/run.hpp"
//#include "lib/test/test-helper.hpp"
#include "lib/meta/function.hpp"
#include "steam/engine/proc-node.hpp"
#include "steam/engine/turnout.hpp"
#include "steam/engine/turnout-system.hpp"
#include "steam/engine/feed-manifold.hpp"
#include "steam/engine/diagnostic-buffer-provider.hpp"
#include "steam/engine/buffhandle-attach.hpp"
//#include "lib/format-cout.hpp"
//#include "lib/util.hpp"
2007-09-03 02:33:47 +02:00
//using std::string;
2007-09-03 02:33:47 +02:00
namespace steam {
namespace engine{
namespace test {
namespace { // Test fixture
/**
*/
}
/***************************************************************//**
* @test basic render node properties and behaviour.
*/
class NodeBase_test : public Test
2007-09-03 02:33:47 +02:00
{
virtual void
run (Arg)
{
seedRand();
verify_TurnoutSystem();
verify_FeedManifold();
UNIMPLEMENTED ("build a simple render node and then activate it");
}
/** @test the TurnoutSystem as transient coordinator for node invocation
*/
void
verify_TurnoutSystem()
{
Time nomTime{rani(10'000),0}; // drive test with a random »nominal Time« <10s with ms granularity
TurnoutSystem invoker{nomTime}; // a time spec is mandatory, all further parameters are optional
}
/** @test the FeedManifold as adapter between Engine and processing library
*/
void
verify_FeedManifold()
{
// some random numbers to test...
long r1 = rani(100);
// Type setup to build a suitable FeedManifold
using Buffer = long;
auto fun_singleOut = [&](Buffer* buff) { *buff = r1; };
using M1 = FeedManifold<decltype(fun_singleOut)>;
CHECK (not M1::hasInput());
CHECK (not M1::hasParam());
M1 m1{};
CHECK (1 == m1.outBuff.array().size());
CHECK (nullptr == m1.outArgs );
// CHECK (m1.inArgs ); // does not compile because storage field is not provided
// CHECK (m1.param );
BufferProvider& provider = DiagnosticBufferProvider::build();
BuffHandle buff = provider.lockBufferFor<long> (-55);
CHECK (buff.isValid());
CHECK (buff.accessAs<long>() == -55);
m1.outBuff.createAt (0, buff);
CHECK (m1.outBuff[0].isValid());
CHECK (m1.outBuff[0].accessAs<long>() == -55);
}
};
/** Register this test class... */
LAUNCHER (NodeBase_test, "unit node");
}}} // namespace steam::engine::test