API
Tests of INDI Communications
Collaboration diagram for Tests of INDI Communications:

Macros

#define XWCTEST_INDI_CALLBACK_VALIDATION
 This turns on the success-return in the callback validator. More...
 
#define XWCTEST_MAKE_INDI_PROP(stub, propname)    stub ## propname
 Make an indi property variable name. More...
 
#define XWCTEST_INDI_NEW_CALLBACK(testclass, propname)
 Catch-2 tests for whether a NEW callback properly validates the input property properly. More...
 
#define XWCTEST_INDI_SET_CALLBACK(testclass, varname, device, propname)
 Catch-2 tests for whether a SET callback properly validates the input property properly. More...
 
#define XWCTEST_INDI_ARBNEW_CALLBACK(testclass, callback, propname)
 Catch-2 tests for whether an arbitrary callback properly validates the input property properly. More...
 

Detailed Description

Macro Definition Documentation

◆ XWCTEST_INDI_ARBNEW_CALLBACK

#define XWCTEST_INDI_ARBNEW_CALLBACK (   testclass,
  callback,
  propname 
)
Value:
GIVEN("A Callback for " # propname ) \
{ \
WHEN("Wrong Device") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice("wrong"); \
ip.setName( #propname ); \
int rv = sdgt. callback (ip); \
REQUIRE(rv == -1); \
} \
WHEN("Wrong name") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice("right"); \
ip.setName("wrong" #propname ); \
int rv = sdgt. callback (ip); \
REQUIRE(rv == -1); \
} \
WHEN("Right Device.Name") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice("right"); \
ip.setName( #propname ); \
int rv = sdgt. callback (ip); \
REQUIRE(rv == 0); \
} \
}
#define GIVEN(desc)
Definition: catch.hpp:17763
int callback(void *app, const pcf::IndiProperty &ipRecv)

Catch-2 tests for whether an arbitrary callback properly validates the input property properly.

Parameters
testclass[in] the class being tested
callback[in] the name of the callback
device[in] the device source of the property
propname[in] the in-INDI name of the property

Definition at line 136 of file testMacrosINDI.hpp.

◆ XWCTEST_INDI_CALLBACK_VALIDATION

#define XWCTEST_INDI_CALLBACK_VALIDATION

This turns on the success-return in the callback validator.

See INDI_VALIDATE_CALLBACK_PROPS and INDI_VALIDATE_CALLBACK_PROPS_DERIVED

Definition at line 10 of file testMacrosINDI.hpp.

◆ XWCTEST_INDI_NEW_CALLBACK

#define XWCTEST_INDI_NEW_CALLBACK (   testclass,
  propname 
)
Value:
GIVEN("A New Callback for " # propname ) \
{ \
WHEN("Wrong Device") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice("wrong"); \
ip.setName( #propname ); \
int rv = sdgt.XWCTEST_MAKE_INDI_CALLBACK(newCallBack_m_indiP_,propname)(ip); \
REQUIRE(rv == -1); \
} \
WHEN("Wrong name") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice("right"); \
ip.setName("wrong"); \
int rv = sdgt.XWCTEST_MAKE_INDI_CALLBACK(newCallBack_m_indiP_,propname)(ip); \
REQUIRE(rv == -1); \
} \
WHEN("Right Device.Name") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice("right"); \
ip.setName( #propname ); \
int rv = sdgt.XWCTEST_MAKE_INDI_CALLBACK(newCallBack_m_indiP_,propname)(ip); \
REQUIRE(rv == 0); \
} \
}

Catch-2 tests for whether a NEW callback properly validates the input property properly.

Parameters
testclass[in] the name of class being tested
propname[in] the in-INDI name of the property

Definition at line 47 of file testMacrosINDI.hpp.

◆ XWCTEST_INDI_SET_CALLBACK

#define XWCTEST_INDI_SET_CALLBACK (   testclass,
  varname,
  device,
  propname 
)
Value:
GIVEN("A Set Callback for " # propname ) \
{ \
WHEN("Wrong Device") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice("wrong"); \
ip.setName( #propname ); \
int rv = sdgt.XWCTEST_MAKE_INDI_CALLBACK(setCallBack_,varname)(ip); \
REQUIRE(rv == -1); \
} \
WHEN("Wrong name") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice(#device); \
ip.setName("wrong"); \
int rv = sdgt.XWCTEST_MAKE_INDI_CALLBACK(setCallBack_,varname)(ip); \
REQUIRE(rv == -1); \
} \
WHEN("Right Device.Name") \
{ \
testclass ## _test sdgt("right"); \
pcf::IndiProperty ip; \
ip.setDevice(#device); \
ip.setName( #propname ); \
int rv = sdgt.XWCTEST_MAKE_INDI_CALLBACK(setCallBack_,varname)(ip); \
REQUIRE(rv == 0); \
} \
}

Catch-2 tests for whether a SET callback properly validates the input property properly.

Parameters
testclass[in] the class being tested
varname[in] the in-class variable name
device[in] the device source of the property
propname[in] the in-INDI name of the property

Definition at line 90 of file testMacrosINDI.hpp.

◆ XWCTEST_MAKE_INDI_PROP

#define XWCTEST_MAKE_INDI_PROP (   stub,
  propname 
)     stub ## propname

Make an indi property variable name.

This takes m_indiP_ and voltage and creates m_indiP_voltage, which is the standard way to name an INDI property which takes new requests.

Parameters
stub[in] the first part of the variable name, e.g. m_indiP_
propname[in] the property name, e.g. voltage

Definition at line 21 of file testMacrosINDI.hpp.