Attempt to fix test expectation.

I'm pretty sure this will fix it, but I've never been able to
build the tests on my Mac so I'm not sure.

Fixes https://gitlab.com/kicad/code/kicad/issues/3928
This commit is contained in:
Jeff Young 2020-02-22 21:47:44 +00:00
parent c68b554c8e
commit 7fdb74569f
3 changed files with 6 additions and 5 deletions

View File

@ -112,9 +112,9 @@ BOOST_AUTO_TEST_CASE( NonEmpty )
BOOST_CHECK_EQUAL( m_linear.Last(), &m_sheets[2] );
BOOST_CHECK_EQUAL( m_linear.LastScreen(), nullptr );
// don't know what the timestamps will be, but we know the format: /<8 chars>/<8 chars>/
// don't know what the uuids will be, but we know the format: /<8-4-4-4-12>/<8-4-4-4-12>/
BOOST_CHECK_PREDICATE(
KI_TEST::IsTimestampStringWithLevels, ( m_linear.PathAsString().ToStdString() )( 2 ) );
KI_TEST::IsUUIDPathWithLevels, ( m_linear.PathAsString().ToStdString() )( 2 ) );
// Sheet0 is the root sheet and isn't in the path
BOOST_CHECK_EQUAL( m_linear.PathHumanReadable(), "/Sheet1/Sheet2/" );

View File

@ -39,9 +39,10 @@ bool EndsInTimestamp( const std::string& aStr )
return IsTimeStampish( aStr.end() - 8, aStr.end() );
}
bool IsTimestampStringWithLevels( const std::string& aStr, unsigned aLevels )
bool IsUUIDPathWithLevels( const std::string& aStr, unsigned aLevels )
{
const unsigned tsLen = 8;
// A UUID is formated as 8-4-4-4-12
const unsigned tsLen = 36;
const unsigned levelLen = tsLen + 1; // add the /
if( aStr.size() != aLevels * levelLen + 1 )

View File

@ -75,7 +75,7 @@ bool EndsInTimestamp( const std::string& aStr );
* @param levels expected levels
* @return true if format matches
*/
bool IsTimestampStringWithLevels( const std::string& aStr, unsigned aLevels );
bool IsUUIDPathWithLevels( const std::string& aStr, unsigned aLevels );
} // namespace KI_TEST