CADSTAR Parts: Add QA test for +N0 root with no parts
This commit is contained in:
parent
dd933b7d0e
commit
09f1df6c94
File diff suppressed because it is too large
Load Diff
|
@ -2,9 +2,17 @@
|
|||
from math import factorial
|
||||
from itertools import permutations,islice
|
||||
|
||||
with open('cadstarDummy.lib', 'w', newline='\r\n') as f:
|
||||
for fileindex, filename in enumerate(["dummycadstarlib.lib", "dummycadstarlibwithheader.lib"]):
|
||||
with open(filename, 'w', newline='\r\n') as f:
|
||||
f.write('# FORMAT 32\n')
|
||||
|
||||
if fileindex > 0:
|
||||
f.write('+N0 \'root\'\n')
|
||||
f.write('+N1 N0 ')
|
||||
|
||||
for i in range(100):
|
||||
f.write(f'\'PartName{i}\'&\n')
|
||||
|
||||
for i in range(100):
|
||||
f.write('\n')
|
||||
f.write(f'.PartName{i} ({i*5}) :2 ;Part {i} Description\n')
|
||||
|
|
|
@ -101,9 +101,12 @@ BOOST_AUTO_TEST_CASE( CheckHeader )
|
|||
BOOST_AUTO_TEST_CASE( ReadFile )
|
||||
{
|
||||
CADSTAR_PARTS_LIB_PARSER p;
|
||||
// Test a programatically generated files (see writeCadstarFile.py)
|
||||
std::vector<std::string> testFiles = { "dummycadstarlib.lib", "dummycadstarlibwithheader.lib" };
|
||||
|
||||
// Test a programatically generated file (see writeCadstarFile.py)
|
||||
auto ret = p.ReadFile( getCadstarTestFile( "cadstarDummy.lib" ) );
|
||||
for( auto testFile : testFiles )
|
||||
{
|
||||
auto ret = p.ReadFile( getCadstarTestFile( testFile ) );
|
||||
|
||||
KI_CHECK_OPT_EQUAL( ret.m_FormatNumber, 32 );
|
||||
BOOST_CHECK_EQUAL( ret.m_PartEntries.size(), 100 );
|
||||
|
@ -164,16 +167,19 @@ BOOST_AUTO_TEST_CASE( ReadFile )
|
|||
"readOnly" + std::to_string( i ) );
|
||||
|
||||
// PCB and SCH attributes (@ lines)
|
||||
BOOST_CHECK_EQUAL( partEntry.m_SchAndPcbAttributes["SCH and PCB val1"].m_ReadOnly, false );
|
||||
BOOST_CHECK_EQUAL( partEntry.m_SchAndPcbAttributes["SCH and PCB val1"].m_ReadOnly,
|
||||
false );
|
||||
BOOST_CHECK_EQUAL( partEntry.m_SchAndPcbAttributes["SCH and PCB val1"].m_Value,
|
||||
"val" + std::to_string( i ) );
|
||||
BOOST_CHECK_EQUAL( partEntry.m_SchAndPcbAttributes["SCH and PCB val2"].m_ReadOnly, true );
|
||||
BOOST_CHECK_EQUAL( partEntry.m_SchAndPcbAttributes["SCH and PCB val2"].m_ReadOnly,
|
||||
true );
|
||||
BOOST_CHECK_EQUAL( partEntry.m_SchAndPcbAttributes["SCH and PCB val2"].m_Value,
|
||||
"readOnly" + std::to_string( i ) );
|
||||
|
||||
// Check symbol name and pins
|
||||
BOOST_REQUIRE_EQUAL( partEntry.m_Symbols.size(), 1 );
|
||||
BOOST_CHECK_EQUAL( partEntry.m_Symbols[0].m_SymbolName, "Symbol" + std::to_string( i ) );
|
||||
BOOST_CHECK_EQUAL( partEntry.m_Symbols[0].m_SymbolName,
|
||||
"Symbol" + std::to_string( i ) );
|
||||
KI_CHECK_OPT_EQUAL( partEntry.m_Symbols[0].m_SymbolAlternateName,
|
||||
std::optional<std::string>() );
|
||||
BOOST_REQUIRE_EQUAL( partEntry.m_Symbols[0].m_Pins.size(), 2 );
|
||||
|
@ -186,6 +192,7 @@ BOOST_AUTO_TEST_CASE( ReadFile )
|
|||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( ReadContent )
|
||||
|
|
Loading…
Reference in New Issue