2026-09-05 18:08:51 +02:00
|
|
|
|
/*
|
|
|
|
|
|
ParameterScale(Test) - verify parameter value scales
|
|
|
|
|
|
|
|
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2026, 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 parameter-test.cpp
|
|
|
|
|
|
** unit test \ref ParameterScale_test
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "test/run.hpp"
|
|
|
|
|
|
//#include "test/test-helper.hpp"
|
2026-09-11 23:22:03 +02:00
|
|
|
|
#include "lib/par/scale.hpp"
|
2026-09-05 18:08:51 +02:00
|
|
|
|
#include "test/diagnostic-output.hpp"/////////////TODO
|
|
|
|
|
|
|
|
|
|
|
|
//#include <utility>
|
|
|
|
|
|
//#include <string>
|
|
|
|
|
|
//#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
//using std::string;
|
|
|
|
|
|
//using std::vector;
|
|
|
|
|
|
//using std::swap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace lib {
|
|
|
|
|
|
namespace par {
|
|
|
|
|
|
namespace test{
|
|
|
|
|
|
|
|
|
|
|
|
// using lumiera::error::LUMIERA_ERROR_LOGIC;
|
|
|
|
|
|
|
|
|
|
|
|
namespace {//Test fixture....
|
|
|
|
|
|
|
|
|
|
|
|
}//(End)Test fixture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************//**
|
|
|
|
|
|
* @test cover properties of generic parameter containers.
|
|
|
|
|
|
*/
|
|
|
|
|
|
class ParameterScale_test : public Test
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
|
|
run (Arg)
|
|
|
|
|
|
{
|
|
|
|
|
|
simpleUsage();
|
2026-09-16 19:42:55 +02:00
|
|
|
|
verify_Conforming();
|
2026-09-05 18:08:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
simpleUsage()
|
|
|
|
|
|
{
|
2026-09-11 23:22:03 +02:00
|
|
|
|
Scale<int> scale = {.minVal = -5, .maxVal = 23};
|
|
|
|
|
|
CHECK (scale.isValid());
|
|
|
|
|
|
|
|
|
|
|
|
CHECK (-5 == scale.conform (-55));
|
|
|
|
|
|
CHECK (23 == scale.conform (+55));
|
|
|
|
|
|
|
|
|
|
|
|
CHECK ( 5 == scale.join (2,3) );
|
|
|
|
|
|
CHECK (-5 == scale.join (23,-55));
|
2026-09-05 18:08:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @test
|
|
|
|
|
|
* @todo WIP 9/26 🔁 define ⟶ implement
|
|
|
|
|
|
*/
|
|
|
|
|
|
void
|
2026-09-16 19:42:55 +02:00
|
|
|
|
verify_Conforming()
|
2026-09-05 18:08:51 +02:00
|
|
|
|
{
|
2026-09-16 19:42:55 +02:00
|
|
|
|
Scale<float> scale;
|
|
|
|
|
|
CHECK (1e5f == scale.conform (1e5f));
|
|
|
|
|
|
|
|
|
|
|
|
scale.maxVal = -5.0f;
|
|
|
|
|
|
CHECK (-5.0f == scale.conform (1e5f));
|
2026-09-05 18:08:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Register this test class... */
|
|
|
|
|
|
LAUNCHER (ParameterScale_test, "unit lib");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}}} // namespace lib::par::test
|