Commit 548db385 authored by Pavel Vainerman's avatar Pavel Vainerman

(IOBase): добавил ещё тесты по AsDI,AsDO

parent 9b3a7f26
......@@ -431,6 +431,58 @@ TEST_CASE("[IOBase::calibration]: AI calibration (precision)","[iobase][calibrat
}
}
// -----------------------------------------------------------------------------
TEST_CASE("[IOBase::calibration]: asDI, asDO","[iobase][di][do][extensions]")
{
CHECK( uniset_conf()!=nullptr );
auto conf = uniset_conf();
init_test();
SECTION("AI as DI,DO..")
{
ObjectId ai = conf->getSensorID("AsDI1_AS");
CHECK( ai != DefaultObjectId );
IOBase ib;
CHECK( init_iobase(&ib,"AsDI1_AS") );
IOBase::processingAsDI(&ib,false,shm,true);
REQUIRE( shm->getValue(ai) == 0 );
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == false );
IOBase::processingAsDI(&ib,true,shm,true);
REQUIRE( shm->getValue(ai) == 1 );
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == true );
shm->setValue(ai,-10);
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == 1 );
shm->setValue(ai,0);
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == false );
shm->setValue(ai,10);
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == true );
}
SECTION("DI as DI,DO..")
{
ObjectId di = conf->getSensorID("AsDI2_S");
CHECK( di != DefaultObjectId );
IOBase ib;
CHECK( init_iobase(&ib,"AsDI2_S") );
IOBase::processingAsDI(&ib,false,shm,true);
REQUIRE( shm->getValue(di) == 0 );
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == false );
IOBase::processingAsDI(&ib,true,shm,true);
REQUIRE( shm->getValue(di) == 1 );
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == true );
shm->setValue(di,0);
REQUIRE( IOBase::processingAsDO(&ib,shm,true) == false );
}
}
// -----------------------------------------------------------------------------
TEST_CASE("IOBase with SM","[iobase][extensions]")
{
WARN("IOBase with SM: Not all tests implemented!");
......
......@@ -259,6 +259,11 @@
<item id="114" iotype="AI" name="CalibrationTest_AI1_AS" textname="Calibration test: AI1" rmin="-100" rmax="100" cmin="-1000" cmax="1000"/>
<item id="115" iotype="AI" name="CalibrationTest_AI2_AS" textname="Calibration test: AI2" rmin="-100" rmax="100" cmin="-1000" cmax="1000" precision="2"/>
<!-- asDI, asDO -->
<item id="116" iotype="AI" name="AsDI1_AS" textname="AsDI1"/>
<item id="117" iotype="DI" name="AsDI2_S" textname="AsDI2"/>
<item id="118" iotype="DO" name="AsDO_S" textname="AsDO"/>
</sensors>
<thresholds name="thresholds">
<sensor iotype="AI" name="AI_AS">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment