49 void copyFile(
string dstFile,
string srcFile )
51 ifstream src(srcFile.c_str(), ios_base::binary);
52 ofstream dst(dstFile.c_str(), ios_base::out | ios_base::binary | ios_base::trunc);
55 while( src.get(ch)) dst.put(ch);
57 if( !src.eof() || !dst )
throw exception();
63 fh=fopen(fileName.c_str(),
"rb");
73 string programDirname = getCppunitTopDirectory();
74 string writeDirectory = getWritableDirectory();
78 string memdumpOrigFile = programDirname + getTestDirectory() +
"/memdump.dat";
80 memdumpOrigFile = getTestDirectory() +
"/memdump.dat";
81 string memdumpCopyFile = writeDirectory +
"/memdump-copy.dat";
82 copyFile( memdumpCopyFile, memdumpOrigFile );
86 string cmosOrigFile = programDirname + getTestDirectory() +
"/cmos.dat";
88 cmosOrigFile = getTestDirectory() +
"/cmos.dat";
89 string cmosCopyFile = writeDirectory +
"/cmos-copy.dat";
90 copyFile( cmosCopyFile, cmosOrigFile );
93 string smiOutput = writeDirectory +
"/smi-output.dat";
183 CPPUNIT_ASSERT_EQUAL( item1->getHandle(), item2->
getHandle() );
185 CPPUNIT_ASSERT_EQUAL( item1->getLength(), item2->
getLength() );
187 CPPUNIT_ASSERT_EQUAL( item1->getType(), item2->
getType() );
207 int tableEntriesCounted = 0;
209 while( item != table->
end() )
211 tableEntriesCounted++;
212 ost << *item << endl;
231 int tableEntriesCounted = 0;
233 while( item != constTable->
end() )
235 tableEntriesCounted++;
253 int tableEntriesCounted = 0;
258 tableEntriesCounted++;
306 int tableEntriesCounted = 0;
310 tableEntriesCounted++;
312 CPPUNIT_ASSERT( 1 < tableEntriesCounted );
335 ost << *table << endl;
340 ost << *item << endl;
373 CPPUNIT_ASSERT_EQUAL( &item1, &item2 );
374 CPPUNIT_ASSERT_EQUAL( &(*position1), &item2 );
375 CPPUNIT_ASSERT_EQUAL( &item1 , &(*position2) );
376 CPPUNIT_ASSERT_EQUAL( &(*position1), &(*position2) );
383 CPPUNIT_ASSERT( &item1 != &item3 );
384 CPPUNIT_ASSERT( &item2 != &item3 );
408 while( item != table->
end() )
412 CPPUNIT_ASSERT_EQUAL( type1, type2 );
416 CPPUNIT_ASSERT_EQUAL( len1, len2 );
420 CPPUNIT_ASSERT_EQUAL( handle1, handle2 );
446 auto_ptr<smbios::ISmbiosTable>p(factory->
makeNew());
447 auto_ptr<const smbios::ISmbiosTable>q(factory->
makeNew());
454 ost << *item1 << endl;
456 CPPUNIT_ASSERT_EQUAL( item1->getHandle(), item2->
getHandle() );
457 CPPUNIT_ASSERT_EQUAL( item1->getHandle(),
getU16_FromItem(*item2, 2) );
458 CPPUNIT_ASSERT_EQUAL( item1->getLength(), item2->
getLength() );
459 CPPUNIT_ASSERT_EQUAL( item1->getLength(),
getU8_FromItem(*item2, 1) );
460 CPPUNIT_ASSERT_EQUAL( item1->getType() , item2->
getType() );
461 CPPUNIT_ASSERT_EQUAL( item1->getType() ,
getU8_FromItem(*item2, 0) );
475 CPPUNIT_ASSERT_EQUAL(
isBitSet( &(*item), 0xA, 0x7 ),
true );
493 int len = item->getLength();
555 CPPUNIT_ASSERT_EQUAL ( b, 254 );
579 while( token != tokenTable->
end() )
581 ost << *token << endl;
600 smi->setClass( 0xAABB );
601 smi->setSelect( 0xCCDD );
602 smi->setArg( 0, 0xA1A2A3A4 );
603 smi->setArg( 1, 0xB1B2B3B4 );
604 smi->setArg( 2, 0xC1C2C3C4 );
605 smi->setArg( 3, 0xD1D2D3D4 );
610 catch(
const smi::UnhandledSmi & ) {}
621 smi->setClass( 0xAABB );
622 smi->setSelect( 0xCCDD );
623 smi->setArgAsPhysicalAddress(0, 0);
624 smi->setArgAsPhysicalAddress(1, 1);
625 smi->setArgAsPhysicalAddress(2, 2);
626 smi->setArgAsPhysicalAddress(3, 3);
631 catch(
const smi::UnhandledSmi & ) {}
640 string fromSystem =
"";
657 CPPUNIT_ASSERT_EQUAL ( testInput, fromSystem );
665 std::string actual =
"";
668 string expected =
"";
672 foo.
setParameter(
"recursiverecursive",
"%(recursive)s");
674 source =
"The %% cat is %(foo)s. The best number is %(bar)i. %";
675 expected =
"The % cat is happy. The best number is 42. %";
678 CPPUNIT_ASSERT_EQUAL( expected, actual );
683 CPPUNIT_ASSERT_EQUAL( expected, actual );
685 source =
"The %% cat is %(recursive)s. The best number is %(bar)i. %";
688 CPPUNIT_ASSERT_EQUAL( expected, actual );
690 source =
"The %% cat is %(recursiverecursive)s. The best number is %(bar)i. %";
693 CPPUNIT_ASSERT_EQUAL( expected, actual );
695 source =
"The %% cat %is %(recursiverecursive)s. The best number is %(bar)i. %";
696 expected =
"The % cat %is happy. The best number is 42. %";
699 CPPUNIT_ASSERT_EQUAL( expected, actual );
701 source =
" %(a_really_long_variable_longer_than_32_characters)s";
702 expected =
" %(a_really_long_variable_longer_than_32_characters)s";
705 CPPUNIT_ASSERT_EQUAL( expected, actual );
707 source =
" %(no_closing_paren";
708 expected =
" %(no_closing_paren";
711 CPPUNIT_ASSERT_EQUAL( expected, actual );
713 source =
" %(a_var_with_no_type)";
714 expected =
" %(a_var_with_no_type)";
717 CPPUNIT_ASSERT_EQUAL( expected, actual );
719 source =
" %(a_var_with_no_type) ";
720 expected =
" %(a_var_with_no_type) ";
723 CPPUNIT_ASSERT_EQUAL( expected, actual );
729 CPPUNIT_ASSERT_EQUAL( expected, actual );