outline of the function-closure-test

This commit is contained in:
Fischlurch 2009-06-21 02:51:37 +02:00
parent 231834d2e9
commit 2a182a2016

View file

@ -32,7 +32,10 @@
#include "lib/test/run.hpp" #include "lib/test/run.hpp"
#include "lib/meta/typelist.hpp" ////////////TODO really? #include "lib/test/test-helper.hpp"
#include "lib/meta/typelist.hpp"
#include "lib/meta/typelistutil.hpp"
#include "lib/meta/function.hpp"
#include "lib/meta/function-closure.hpp" #include "lib/meta/function-closure.hpp"
#include "meta/dummy-functions.hpp" #include "meta/dummy-functions.hpp"
#include "meta/typelist-diagnostics.hpp" #include "meta/typelist-diagnostics.hpp"
@ -42,9 +45,13 @@
//#include <boost/format.hpp> //#include <boost/format.hpp>
#include <iostream> #include <iostream>
using lib::test::showSizeof;
using lib::test::showType;
using ::test::Test; using ::test::Test;
using std::string; using std::string;
using std::cout; using std::cout;
using std::endl;
namespace lumiera { namespace lumiera {
@ -85,8 +92,12 @@ namespace test {
/************************************************************************* /*************************************************************************
* @test building a function closure for a given functor * @test building a function closure for a given functor
* and arguments passed in as tuple * and arguments passed in as tuple
* //////////////////////////////////////////TODO * - accessing signatures as typelists
* - building * - apply free function to tuple
* - apply functor to tuple
* - bind free function to tuple
* - bind functor to tuple
* - build a simple "tuple closure"
*/ */
class FunctionClosure_test : public Test class FunctionClosure_test : public Test
{ {
@ -94,9 +105,12 @@ namespace test {
run (Arg) run (Arg)
{ {
check_diagnostics (); check_diagnostics ();
check_append (); check_signatureTypeManip ();
check_applyFree ();
UNIMPLEMENTED ("verify function closure utils"); check_applyFunc ();
check_bindFree ();
check_bindFunc ();
build_closure ();
} }
@ -116,11 +130,56 @@ namespace test {
void void
check_append () check_signatureTypeManip ()
{ {
/////////////////////////////////////////////TODO typedef int someFunc(Num<5>,Num<9>);
typedef Append<Num<111>,List2> Append7; typedef FunctionSignature<function<someFunc> >::Ret RetType; // should be int
DISPLAY (Append7); typedef FunctionSignature<function<someFunc> >::Args Args;
DISPLAY (Args);
typedef Prepend<Num<1>, Args>::Tuple NewArgs; // manipulate the argument type(s)
DISPLAY (NewArgs);
typedef FunctionTypedef<RetType,NewArgs>::Sig NewSig; // re-build a new function signature
NewSig& fun = getNumberz<1,5,9>; //...which is compatible to an existing real function signature!
ASSERT (1+5+9 == fun(Num<1>(), Num<5>(), Num<9>()));
}
void
check_applyFree ()
{
UNIMPLEMENTED ("verify apply free function to tuple");
}
void
check_applyFunc ()
{
UNIMPLEMENTED ("verify apply functor to tuple");
}
void
check_bindFree ()
{
UNIMPLEMENTED ("verify bind free function to tuple");
}
void
check_bindFunc ()
{
UNIMPLEMENTED ("verify bind functor to tuple");
}
void
build_closure ()
{
UNIMPLEMENTED ("build a simple tuple closure");
} }
}; };