WIP create empty unit tests for time quantisation/handling

This commit is contained in:
Fischlurch 2010-12-22 04:09:27 +01:00
parent cce72e611e
commit 000486e126
7 changed files with 300 additions and 24 deletions

View file

@ -36,27 +36,15 @@ namespace lumiera {
/**
* C++ convenience wrapper representing a time value, which could denote
* a temporal position (time point) relative to an (implicit) timeline zero
* point, or it could represent a time interval.
* Lumiera's internal time data.
* Time denotes a time point, specified as opaque value on an
* quasi continuous ("sufficiently precise") internal time scale, relative
* to an (implicit) timeline zero point. The actual implementation relies
* on gavl_time_t (long) values.
*
* This wrapper is deliberately kept rather limited as not to be completely
* interchangeable with and integral type. The rationale is that time values
* should be kept separate and tagged as time values. The following is supported:
* - conversions from / to gavl_time_t (which is effectively a int64_t)
* - additions and subtractions of time values
* - multiplication with an integral factor
* - comparisons between time values and gavl_time_t values
* @see lib::time::TimeVar for an number-like time value usable for calculations
*
* @todo consider the possible extensions
* - parsing and pretty printing
* - quantising of floating point values
* - conversion to boost::rational
* - define a Framerate type
*
* @note this is currently (10/08) an experimental implementation to ease
* the time handling within C++ code. It is advisable not to use it
* on external interfaces (use gavl_time_t there please).
* @todo it is not clear to which degree Time is mutable...
*/
class Time
: boost::additive<Time,

View file

@ -627,12 +627,27 @@ return: 0
END
TEST "Time Wrapper" TimeWrapper_test <<END
TEST "Lumiera Time Wrapper" LumiTime_test <<END
out: ..:..:..\....
return: 0
END
PLANNED "Times and time intervals" TimeValue_test <<END
return: 0
END
PLANNED "Time Quantisation" TimeQuantisation_test <<END
return: 0
END
PLANNED "Time formats and timecodes" TimeFormats_test <<END
return: 0
END
TEST "Symbol_test" Symbol_test <<END
out: one
out: sizeof.+lib.Literal.+ = (4|8)

View file

@ -102,7 +102,10 @@ test_lib_SOURCES = \
$(testlib_srcdir)/test/testoptiontest.cpp \
$(testlib_srcdir)/thread-wrapper-join-test.cpp \
$(testlib_srcdir)/thread-wrapper-test.cpp \
$(testlib_srcdir)/time-wrapper-test.cpp \
$(testlib_srcdir)/lumitime-test.cpp \
$(testlib_srcdir)/time/time-value-test.cpp \
$(testlib_srcdir)/time/time-quantisation-test.cpp \
$(testlib_srcdir)/time/time-formats-test.cpp \
$(testlib_srcdir)/typed-allocation-manager-test.cpp \
$(testlib_srcdir)/typed-counter-test.cpp \
$(testlib_srcdir)/util-foreach-test.cpp \

View file

@ -1,5 +1,5 @@
/*
TimeWrapper(Test) - working with gavl_time_t values in C++...
LumiTime(Test) - working with Lumiera's internal Time values
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
@ -47,7 +47,7 @@ namespace test {
/********************************************
* @test sanity of the C++ time wrapper.
*/
class TimeWrapper_test : public Test
class LumiTime_test : public Test
{
virtual void
run (Arg arg)
@ -166,7 +166,7 @@ namespace test {
/** Register this test class... */
LAUNCHER (TimeWrapper_test, "unit common");
LAUNCHER (LumiTime_test, "unit common");

View file

@ -0,0 +1,90 @@
/*
TimeFormats(Test) - timecode handling and formatting
Copyright (C) Lumiera.org
2010, Hermann Vosseler <Ichthyostega@web.de>
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/time/timecode.hpp"
#include "lib/util.hpp"
//#include <boost/lexical_cast.hpp>
//#include <iostream>
//#include <cstdlib>
//using boost::lexical_cast;
//using util::isnil;
//using std::rand;
//using std::cout;
//using std::endl;
namespace lib {
namespace time{
namespace test{
/********************************************************
* @test verify handling of grid aligned timecode values.
* - creating timecode values
* - some conversions
* - formatting
*/
class TimeFormats_test : public Test
{
virtual void
run (Arg arg)
{
long refval= isnil(arg)? 1 : lexical_cast<long> (arg[1]);
Time ref (refval);
checkBasics (ref);
checkComparisons (ref);
checkComponentAccess();
}
void
checkBasics (Time const& ref)
{
}
void
checkComparisons (Time const& ref)
{
}
void
checkComponentAccess()
{
}
};
/** Register this test class... */
LAUNCHER (TimeFormats_test, "unit common");
}}} // namespace lib::time::test

View file

@ -0,0 +1,90 @@
/*
TimeQuantisation(Test) - handling of virtually grid aligned time values
Copyright (C) Lumiera.org
2010, Hermann Vosseler <Ichthyostega@web.de>
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/time/quantiser.hpp"
#include "lib/util.hpp"
//#include <boost/lexical_cast.hpp>
//#include <iostream>
//#include <cstdlib>
//using boost::lexical_cast;
//using util::isnil;
//using std::rand;
//using std::cout;
//using std::endl;
namespace lib {
namespace time{
namespace test{
/********************************************************
* @test verify handling of time values, time intervals.
* - creating times and time intervals
* - comparisons
* - time arithmetics
*/
class TimeQuantisation_test : public Test
{
virtual void
run (Arg arg)
{
long refval= isnil(arg)? 1 : lexical_cast<long> (arg[1]);
Time ref (refval);
checkBasics (ref);
checkComparisons (ref);
checkComponentAccess();
}
void
checkBasics (Time const& ref)
{
}
void
checkComparisons (Time const& ref)
{
}
void
checkComponentAccess()
{
}
};
/** Register this test class... */
LAUNCHER (TimeQuantisation_test, "unit common");
}}} // namespace lib::time::test

View file

@ -0,0 +1,90 @@
/*
TimeValue(Test) - working with time values and time intervals in C++...
Copyright (C) Lumiera.org
2010, Hermann Vosseler <Ichthyostega@web.de>
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/time/timevalue.hpp"
#include "lib/util.hpp"
//#include <boost/lexical_cast.hpp>
//#include <iostream>
//#include <cstdlib>
//using boost::lexical_cast;
//using util::isnil;
//using std::rand;
//using std::cout;
//using std::endl;
namespace lib {
namespace time{
namespace test{
/********************************************************
* @test verify handling of time values, time intervals.
* - creating times and time intervals
* - comparisons
* - time arithmetics
*/
class TimeValue_test : public Test
{
virtual void
run (Arg arg)
{
long refval= isnil(arg)? 1 : lexical_cast<long> (arg[1]);
Time ref (refval);
checkBasics (ref);
checkComparisons (ref);
checkComponentAccess();
}
void
checkBasics (Time const& ref)
{
}
void
checkComparisons (Time const& ref)
{
}
void
checkComponentAccess()
{
}
};
/** Register this test class... */
LAUNCHER (TimeValue_test, "unit common");
}}} // namespace lib::time::test