本文整理汇总了C++中TA类的典型用法代码示例。如果您正苦于以下问题:C++ TA类的具体用法?C++ TA怎么用?C++ TA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TA类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(Invaliditetsdaekning_KI_OSV_25_49, Invaliditetsdaekning_Kortvarig_Overbygning_Obligatorisk) {
RuleEngine::_printDebugAtValidation = true;
TA ta { "15124040" };
ta.setValue(kKortTAE_Daekning, "Obligatorisk");
auto r = re.validate(ta, false);
// if (!r.isAllOk())
cout << r;
EXPECT_FALSE(r.isAllOk()); // should be missing both KortTAE_Min_obl_faktor and KortTAE_Daekningsperiode
EXPECT_EQ(2, r.getValidationResults().size());
EXPECT_TRUE(r.hasMessages(kKortTAE_Min_obl_faktor, kProductElementRequired));
EXPECT_TRUE(r.hasMessages(kKortTAE_Daekningsperiode, kProductElementRequired));
ta.setValue(kKortTAE_Min_obl_faktor, "2");
r = re.validate(ta, false);
cout << r;
EXPECT_FALSE(r.isAllOk());
EXPECT_EQ(1, r.getValidationResults().size());
EXPECT_TRUE(r.hasMessages(kKortTAE_Daekningsperiode, kProductElementRequired));
ta.setValue(kKortTAE_Daekningsperiode, "6");
r = re.validate(ta, false);
cout << r;
EXPECT_TRUE(r.isAllOk());
ta.setValue(kKortTAE_Min_obl_faktor, "4");
re.printConstantsInParser();
r = re.validate(ta, false);
cout << r;
EXPECT_FALSE(r.isAllOk());
EXPECT_EQ(1, r.getValidationResults().size());
EXPECT_TRUE(r.hasMessages(kKortTAE_Min_obl_faktor, kValueNotAllowed));
}
示例2: eT
arma_hot
inline
eT
op_dot::dot_and_copy_row(eT* out, const TA& A, const uword row, const eT* B_mem, const uword N)
{
eT acc1 = eT(0);
eT acc2 = eT(0);
uword i,j;
for(i=0, j=1; j < N; i+=2, j+=2)
{
const eT val_i = A.at(row, i);
const eT val_j = A.at(row, j);
out[i] = val_i;
out[j] = val_j;
acc1 += val_i * B_mem[i];
acc2 += val_j * B_mem[j];
}
if(i < N)
{
const eT val_i = A.at(row, i);
out[i] = val_i;
acc1 += val_i * B_mem[i];
}
return acc1 + acc2;
}
示例3: TEST_F
TEST_F(UnionAgreementParsing, UAIncluded_Udbetalingsperiode) {
KonceptInfo ki {PROSA, 5, 0,
{ {11, "true"}, // Parameter-Basis
{1, "true"}, // Solidarisk faellestarif
{15, "true"}, // FG span
{6, "true"} // SEB Firmapensionspulje
} };
re.initContext(ki, OUTSIDE);
RuleEngine::_printDebug = true;
RuleEngine::_printDebugAtValidation = true;
re.getContainer().printConstantsFromContext(kUdbetalingsperiode);
TA ta {"20247940"};
ta.setValue(kUdbetalingsperiode, 13);
ta.setValue(kAftaleIkraftdato, 20150701);
ta.setValue(kBidragEjFoesteTrin_MK, false);
auto r = re.validate(ta, false);
cout << r;
EXPECT_TRUE(r.isAllOk());
re.initContext(ki, INCLUDED, 6);
r = re.validate(ta, false);
cout << r;
EXPECT_FALSE(r.isAllOk());
EXPECT_TRUE(r.hasMessages(kUdbetalingsperiode, kValueNotAllowed));
ta.setValue(kUdbetalingsperiode, 25);
r = re.validate(ta, false);
cout << r;
EXPECT_TRUE(r.isAllOk());
}
示例4: intersects
static bool intersects(TA const & a, B const & b)
{
if (a.hasTransform())
return IntersectionTester::intersects<N, T>(Transformer::transform<N, T>(a.getObject(), a.getTransform()), b);
else
return IntersectionTester::intersects<N, T>(a.getObject(), b);
}
示例5: TEST_F
TEST_F(Behandlingsforsikring_KI_OSV_25_49, Behandlingsforsikring_POSITIVE) {
RuleEngine::_printDebugAtValidation = true;
TA ta { "15124040"}; // KonceptOid 4 - OSV
ta.setValue(kHospitalsdaekning_MK, false);
auto r = re.validate(ta, {kHospitalsdaekning_MK, kHospitalsdaekningFrivillig_MK, kHospitalsdaekningLeverandoer});
EXPECT_TRUE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
ta.setValue(kHospitalsdaekning_MK, true);
r = re.validate(ta, false);//{kHospitalsdaekning_MK, kHospitalsdaekningFrivillig_MK, kHospitalsdaekningLeverandoer});
EXPECT_FALSE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
EXPECT_EQ(2, r.getValidationResults().size());
EXPECT_TRUE(r.hasMessages(kHospitalsdaekningFrivillig_MK, kProductElementRequired));
EXPECT_TRUE(r.hasMessages(kHospitalsdaekningLeverandoer, kProductElementRequired));
ta.setValue(kHospitalsdaekningFrivillig_MK, true);
r = re.validate(ta, false); //{kHospitalsdaekning_MK, kHospitalsdaekningFrivillig_MK, kHospitalsdaekningLeverandoer});
EXPECT_FALSE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
EXPECT_EQ(1, r.getValidationResults().size());
EXPECT_TRUE(r.hasMessages(kHospitalsdaekningLeverandoer, kProductElementRequired));
ta.setValue(kHospitalsdaekningLeverandoer, re.getDefaultValue(kHospitalsdaekningLeverandoer)->stringValue());
r = re.validate(ta, false); //{kHospitalsdaekning_MK, kHospitalsdaekningFrivillig_MK, kHospitalsdaekningLeverandoer});
EXPECT_TRUE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
}
示例6: kernel_matrix
explicit kernel_matrix(const expansion_type& e,
const TA& targets,
const SA& sources)
: e_(e),
targets_(targets.begin(), targets.end()),
sources_(sources.begin(), sources.end()),
plan(nullptr) {
}
示例7: TEST_F
TEST_F(TAE_RFY_KI_OSV_25_49, InsuranceCondition_2) {
RuleEngine::_printDebugAtValidation = true;
TA ta { "15124040" };
ta.setValue(kInsuranceConditionVersion, "2");
ta.setValue(kTAE_RFY, re.getDefaultValue(kTAE_RFY)->stringValue());
auto r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk()); // Ingen is allowed for insurance condition version 1
}
示例8: throw
void VIXTrader::run(void) throw(TraderException)
{
TA ta;
_invested_days = days(0);
Series::EODSeries::const_iterator vix_iter(_vix_db.begin());
advance(vix_iter, 100); // Skip first 100 bars to give enough room too BBANDS calculation
for( ; vix_iter != _vix_db.end(); ++vix_iter ) {
try {
// Calculate current invested days
if( ! _miPositions.open().empty() )
_invested_days = _invested_days + days(1);
// Calculate VIX BBANDS
TA::BBRes resBBANDS3 = ta.BBANDS(_vix_db.close(vix_iter, 100), 100, 3, 3);
TA::BBRes resBBANDS1 = ta.BBANDS(_vix_db.close(vix_iter, 100), 100, 1, 1);
// Check buy signal
if( _miPositions.open().empty() && vix_iter->second.close > resBBANDS3.upper_band[0] ) {
// Buy tomorrow's close
Series::EODSeries::const_iterator iter_entry = _spx_db.after(vix_iter->first);
if( iter_entry == _spx_db.end() ) {
cerr << "Can't open position after " << vix_iter->first << endl;
continue;
}
buy(_spx_db.name(), iter_entry->first, Price(iter_entry->second.open));
}
// Check sell signal
if( ! _miPositions.open().empty() && vix_iter->second.close < resBBANDS1.upper_band[0] ) {
// Get next bar
Series::EODSeries::const_iterator iter_exit = _spx_db.after(vix_iter->first);
if( iter_exit == _spx_db.end() ) {
cerr << "Can't close position after " << vix_iter->first << endl;
continue;
}
// Close all open positions at tomorrow's close
PositionSet ps = _miPositions.open();
for( PositionSet::const_iterator pos_iter = ps.begin(); pos_iter != ps.end(); ++pos_iter ) {
PositionPtr pPos = (*pos_iter);
close(pPos->id(), iter_exit->first, Price(iter_exit->second.open));
} // end of all open positions
}
} catch( std::exception& e ) {
cerr << e.what() << endl;
continue;
}
} // for each bar
}
示例9: TEST_F
TEST_F(ContributionLadder_Anciennitet_CONTEXT_KI_OSV_25_50, Bidragsstigningsform_Anciennitet_3_Steps_Inkl_POSITIVE) {
RuleEngine::_printDebugAtValidation = true;
TA ta { "15124040"}; // KonceptOid 4 - OSV
// ta.setValue(kUnionAgreementRelationship, kOUTSIDE);
ta.setValue(kPrivate_Taxed_MK, false);
ta.setValue(kBidragsstigningsform, "Anciennitet" );
ta.setValue(kHospitalsdaekning_MK, true);
ta.setValue(kHospitalsdaekningLeverandoer, "Codan");
ta.setValue(kHospitalsdaekningFrivillig_MK, false);
ta.addContributionStep( {0, 2.6, 3} );
auto r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
cout << r;
ta.addContributionStep( {2, 3, 4} );
r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
cout << r;
ta.addContributionStep( {5, 4, 3.2} );
r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
cout << r;
}
示例10: TEST_F
// Test kIndmeldelsesalder and getting options prior to that
TEST_F(ContributionLadder_Ingen_CONTEXT_KI_OSV_25_50, Bidragsstigningsform_Ingen_No_Hospitalsdaekning)
{
RuleEngine::_printDebugAtValidation = true;
TA ta { "15124040"}; // KonceptOid 4 - OSV
ta.setValue(kPrivate_Taxed_MK, false);
ta.setValue(kBidragsstigningsform, "Ingen");
// ta.setValue(kUnionAgreementRelationship, kOUTSIDE);
ta.setValue(kHospitalsdaekning_MK, false);
// expecting complains about missing step
auto r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_EQ(1, r.getValidationResults(kBidragstrappe).size());
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kProductElementRequired));
r = re.validate(ta, (unsigned short) kBidragsstigningsform);
EXPECT_TRUE(r.isAllOk());
// if (r.isAllOk())
cout << r;
r = re.validate(ta, { kBidragsstigningsform, kBidragstrappe });
EXPECT_TRUE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_EQ(2, r.getWarnings(kBidragstrappe).size());
EXPECT_TRUE(r.hasWarnings(kBidragstrappe, kProductElementRequired));
// now add one step, but let it start from 3 (!=0), and it should fail
ta.addContributionStep( { 3, 3.4, 5.3 });
r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kValueNotAllowed));
// now remove that step, and add one that starts from 0 and no complains
ta.removeContributionStep( { 3, 0, 0 });
ta.addContributionStep( { 0, 3.4, 5.3 });
r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
// then add one more and it should complain again, that only 1 step is allowed, when "Ingen" is selected in Bidragsstigningsform
ta.addContributionStep( { 1, 4, 6 });
r = re.validate(ta, false);
EXPECT_FALSE(r.isAllOk());
// if (r.isAllOk())
cout << r;
EXPECT_TRUE(r.hasMessages(kBidragstrappe, kValueNotAllowed));
// now remove the last step (index!=0), and everything should be fine again
ta.removeContributionStep( { 1, 0, 0 });
r = re.validate(ta, false);
EXPECT_TRUE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
}
示例11: TEST_F
// Test DoedBlGrMin
// Allowed values: [0 - 5,000,000]
// Expected result:
// Validation of value for DoedBlGrMin should be ok
// But a warning should be set that says the DoedReguleringskode is not set in the parser
TEST_F(Doedsfaldsdaekning_I_Procent_KI_OSV_25_49, DoedBlGrMin_Single_Value_OK_With_Warning2) {
TA ta { "15124040" };
ta.setValue(kDoedBlGrMin, (long) 100000);
RuleEngine::_printDebugAtValidation = true;
auto r = re.validate(ta, {kDoedBlGrMin, kDoedReguleringskode});
EXPECT_TRUE(r.isAllOk());
// if (!r.isAllOk())
cout << r;
auto v = r.getWarnings(kDoedReguleringskode);
EXPECT_EQ(kTokenNotDefined, v.at(0).getValidationCode());
}
示例12: arma_extra_debug_sigprint
arma_hot
inline
void
op_strans::apply_noalias(Mat<eT>& out, const TA& A)
{
arma_extra_debug_sigprint();
const uword A_n_cols = A.n_cols;
const uword A_n_rows = A.n_rows;
out.set_size(A_n_cols, A_n_rows);
if( (TA::is_row) || (TA::is_col) || (A_n_cols == 1) || (A_n_rows == 1) )
{
arrayops::copy( out.memptr(), A.memptr(), A.n_elem );
}
else
{
if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) )
{
op_strans::apply_noalias_tinysq(out, A);
}
else
{
for(uword k=0; k < A_n_cols; ++k)
{
uword i, j;
const eT* colptr = A.colptr(k);
for(i=0, j=1; j < A_n_rows; i+=2, j+=2)
{
const eT tmp_i = colptr[i];
const eT tmp_j = colptr[j];
out.at(k, i) = tmp_i;
out.at(k, j) = tmp_j;
}
if(i < A_n_rows)
{
out.at(k, i) = colptr[i];
}
}
}
}
}