lumiera_/tests/basics/time/format-support-test.cpp
Ichthyostega acc77654d1 clean-up: can now switch remaining downstream usages
after all the relevant library components do support both kinds of
type sequences transparently, any usages in core code can now be
switched over to the new, variadic type sequences.
2025-06-07 01:07:36 +02:00

79 lines
2.5 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
FormatSupport(Test) - verify the configuration to support a specific format
Copyright (C)
2011, Hermann Vosseler <Ichthyostega@web.de>
  **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.
* *****************************************************************/
/** @file format-support-test.cpp
** unit test \ref FormatSupport_test
*/
#include "lib/test/run.hpp"
#include "lib/time/formats.hpp"
namespace lib {
namespace time {
namespace format{
namespace test {
/****************************************************//**
* @test check how support for a specific timecode format
* can be enabled and detected. Actually this test
* verifies a simple metaprogramming facility,
* which allows to check type support at runtime.
*/
class FormatSupport_test : public Test
{
virtual void
run (Arg)
{
SupportStandardTimecode just_fine;
Supported just_smpte = Supported::formats< TySeq<Smpte> >();
Supported just_simple = Supported::formats< TySeq<Frames,Seconds> >();
Supported& support1 (just_fine);
Supported& support2 (just_smpte);
Supported& support3 (just_simple);
CHECK ( support1.check<Hms>());
CHECK ( support1.check<Smpte>());
CHECK ( support1.check<Frames>());
CHECK ( support1.check<Seconds>());
CHECK (!support2.check<Hms>());
CHECK ( support2.check<Smpte>());
CHECK (!support2.check<Frames>());
CHECK (!support2.check<Seconds>());
CHECK (!support3.check<Hms>());
CHECK (!support3.check<Smpte>());
CHECK ( support3.check<Frames>());
CHECK ( support3.check<Seconds>());
// format support descriptors are assignable
just_smpte = just_simple;
CHECK (support2.check<Hms>() == support3.check<Hms>());
CHECK (support2.check<Smpte>() == support3.check<Smpte>());
CHECK (support2.check<Frames>() == support3.check<Frames>());
CHECK (support2.check<Seconds>() == support3.check<Seconds>());
}
};
/** Register this test class... */
LAUNCHER (FormatSupport_test, "unit common");
}}}} // namespace lib::time::format::test