////////////////////////////////////////////////////////////////////////////////
// tools
////////////////////////////////////////////////////////////////////////////////
-template<class _Tp>
-inline const _Tp & max( const _Tp & lhs, const _Tp & rhs )
+template<class Tp>
+inline const Tp & max( const Tp & lhs, const Tp & rhs )
{ return lhs < rhs ? rhs : lhs; }
-template<class _Tp, int N>
-inline _Tp * begin( _Tp (& _array)[N] ) { return _array; }
+template<class Tp, int N>
+inline Tp * begin( Tp (& _array)[N] ) { return _array; }
-template<class _Tp, int N>
-inline _Tp * end( _Tp (& _array)[N] ) { return _array + (sizeof(_array)/sizeof(_Tp)); }
+template<class Tp, int N>
+inline Tp * end( Tp (& _array)[N] ) { return _array + (sizeof(_array)/sizeof(Tp)); }
ResStatus::TransactByValue transactByValues[] = {
ResStatus::USER, ResStatus::APPL_HIGH, ResStatus::APPL_LOW, ResStatus::SOLVER
testTable( &ResStatus::setSoftTransact, &evaluateSetSoftTransact );
testTable( &ResStatus::setLock, &evaluateSetLock );
}
+
+
+bool WhilePoolItemSameStateIsPrivate( ResStatus ostatus, ResStatus nstatus )
+{
+ if ( nstatus == ostatus )
+ return true;
+ // some bits changed...
+ if ( nstatus.getTransactValue() != ostatus.getTransactValue()
+ && ( ! nstatus.isBySolver() // ignore solver state changes
+ // removing a user lock also goes to bySolver
+ || ostatus.getTransactValue() == ResStatus::LOCKED ) )
+ return false;
+ if ( nstatus.isLicenceConfirmed() != ostatus.isLicenceConfirmed() )
+ return false;
+ return true;
+}
+
+BOOST_AUTO_TEST_CASE(savestate)
+{
+ ResStatus ostatus;
+ ResStatus nstatus;
+
+ BOOST_CHECK_EQUAL( WhilePoolItemSameStateIsPrivate( ostatus, nstatus ), true );
+ nstatus.setLock( true, ResStatus::USER );
+ BOOST_CHECK_EQUAL( WhilePoolItemSameStateIsPrivate( ostatus, nstatus ), false );
+ ostatus = nstatus;
+ nstatus.setLock( false, ResStatus::USER );
+ BOOST_CHECK_EQUAL( WhilePoolItemSameStateIsPrivate( ostatus, nstatus ), false );
+}
+
+
+