def testSelfDecrement( self ): ticks = self.ts1.getLocalTicks() + 30000 self.ts2 = Timestamp( ticks ) self.ts2 -= 30000 assertEquals( 'Ticks', self.ts2.getLocalTicks() , self.ts1.getLocalTicks() )
def testAddModule(self): """SuccessfulSetupTestCase::addModule()""" modules = self.bif.getModules() newModule = modules[0] newModule.id = 'new_module' self.bif.addModule(newModule) assertEquals('Number of modules', len(self.bif.getModules()), 4)
def test_cut_labels(): test.assertEquals(trim.cut_labels(['hallo welt_sdf']), ['hallo welt_sdf']) test.assertEquals(trim.cut_labels(['hallo_welt _sdf']), ['hallo_welt']) test.assertEquals(trim.cut_labels(['hallo welt _sdf usw ']), ['hallo welt _sdf usw ']) test.assertEquals(trim.cut_labels(['hallo welt _??']), ['hallo welt _??']) test.assertEquals(trim.cut_labels(['']), [''])
def test_cut_whitespace_lines(): test.assertEquals(trim.cut_whitespace_lines(['hallo', '\n', 'naa']), ['hallo', 'naa']) test.assertEquals(trim.cut_whitespace_lines(['']), []) test.assertEquals(trim.cut_whitespace_lines(['\t', 'a']), ['a']) test.assertEquals(trim.cut_whitespace_lines(['\n']), []) test.assertEquals(trim.cut_whitespace_lines(['hallo', '', 'hallo']), ['hallo', 'hallo'])
def testNumberOfTimesInFile(self): self.basefile.recordDLL(self.dllName, self.newBase, self.newSize) count = 0 for line in open(scratchFile, "r").readlines(): l = string.split(line, ";")[0] l = string.replace(l, "\t", " ") if l == 'server\\fs\\adminfs\\rel32\\bogus.dll 0x60000000 0x30000 ': count += 1 assertEquals('# of occurences of dll found in file: ', count, 1)
def testNumberOfTimesInFile(self): self.basefile.recordDLL(self.dllName, self.newBase, self.newSize) count = 0 for line in open(scratchFile, "r").readlines(): l = string.split(line, ";")[0] l = string.replace(l, "\t", " ") if l == 'common\\lang\\xml\\rel32\\hxxml.dll 0x601c0000 0x40000 ': count += 1 assertEquals('# of occurences of dll found in file: ', count, 1)
def testAddModule( self ): """SuccessfulSetupTestCase::addModule()""" modules = self.bif.getModules() newModule = modules[ 0 ] newModule.id = 'new_module' self.bif.addModule( newModule ) assertEquals( 'Number of modules' , len( self.bif.getModules() ), 4 )
def testAdd( self ): target = self.ts1.getLocalTicks() + 29000 self.ts1 = self.ts3 + 29000 assertEquals( 'Ticks' , self.ts1.getLocalTicks() , target ) # Make sure ts3 was unchanged by the operation. assertEquals( 'Ticks' , self.ts3.getLocalTicks() , ticks1 )
def testSaveData(self): """SuccessfulSetupTestCase::saveData()""" tempSource = os.path.join(testRoot, 'test-out.bif') self.bif.setDataSource(tempSource) self.bif.saveData() self.bif.removeModule('module1') assertEquals('Modules in memory', len(self.bif.getModules()), 2) self.bif.loadData() # Only 2 modules in test-out because it is deleting the shadow module. # Is this desired behavior? assertEquals('Modules in test-out.bif', len(self.bif.getModules()), 2)
def testNumberOfTimesInFile( self ): self.basefile.recordDLL( self.dllName , self.newBase , self.newSize ) count = 0 for line in open( scratchFile , "r" ).readlines(): l = string.split(line,";")[0] l = string.replace(l,"\t"," ") if l == 'server\\fs\\adminfs\\rel32\\bogus.dll 0x60000000 0x30000 ': count += 1 assertEquals( '# of occurences of dll found in file: ', count, 1 )
def testNumberOfTimesInFile( self ): self.basefile.recordDLL( self.dllName , self.newBase , self.newSize ) count = 0 for line in open( scratchFile , "r" ).readlines(): l = string.split(line,";")[0] l = string.replace(l,"\t"," ") if l == 'common\\lang\\xml\\rel32\\hxxml.dll 0x601c0000 0x40000 ': count += 1 assertEquals( '# of occurences of dll found in file: ', count, 1 )
def testSubtract( self ): ticks = self.ts1.getLocalTicks() + 30000 self.ts2 = Timestamp( ticks ) self.ts1 = self.ts2 - 30000 assertEquals( 'Ticks' , self.ts1.getLocalTicks(), ticks1 ) # Make sure ts2 was unchanged by the operation. assertEquals( 'Ticks' , self.ts2.getLocalTicks() , ticks )
def testSaveData( self ): """SuccessfulSetupTestCase::saveData()""" tempSource = os.path.join( testRoot , 'test-out.bif' ) self.bif.setDataSource( tempSource ) self.bif.saveData() self.bif.removeModule( 'module1' ) assertEquals( 'Modules in memory' , len( self.bif.getModules() ), 2 ) self.bif.loadData() # Only 2 modules in test-out because it is deleting the shadow module. # Is this desired behavior? assertEquals( 'Modules in test-out.bif' , len( self.bif.getModules() ), 2 )
def testGetDefaults( self ): """SuccessfulSetupTestCase::getDefaults()""" assertEquals( 'Default object list count' , len( self.bif.getDefaults() ), 1 )
def testGetDefaultOptions(self): """SuccessfulSetupTestCase::getDefaultOptions()""" assertEquals('Default options', self.bif.getDefaultOptions(), 'test_option')
def testGetDefaultCVSRoot(self): """SuccessfulSetupTestCase::getDefaultCVSRoot()""" assertEquals('Default CVS root', self.bif.getDefaultCVSRoot(), 'test_root')
def testGetDataSource(self): """SuccessfulSetupTestCase::getDataSource()""" assertEquals('Data source', self.bif.getDataSource(), self.dataSource)
def testGetDataAsFormattedString(self): """SuccessfulSetupTestCase::getDataAsFormattedString()""" assertEquals('Formatted string length', len(self.bif.getDataAsFormattedString().split('\n')), 32)
def testGetDefaultOptions( self ): """SuccessfulSetupTestCase::getDefaultOptions()""" assertEquals( 'Default options' , self.bif.getDefaultOptions() , 'test_option' )
def testSetDefaultCVSTagType(self): """SuccessfulSetupTestCase::setDefaultCVSTagType()""" self.bif.setDefaultCVSTagType('branch') assertEquals('Setting CVS type', self.bif.getDefaultCVSTagType(), 'branch')
def testSetDefaultCVSRoot( self ): """SuccessfulSetupTestCase::setDefaultCVSRoot()""" self.bif.setDefaultCVSRoot( 'new_root' ) assertEquals( 'Setting CVS root' , self.bif.getDefaultCVSRoot() , 'new_root' )
def testSetBuildID( self ): """SuccessfulSetupTestCase::setBuildID()""" self.bif.setBuildID( 'new_id' ) assertEquals( 'Setting Build ID' , self.bif.getBuildID() , 'new_id' )
def testGetModules( self ): """SuccessfulSetupTestCase::getModules()""" assertEquals( 'Number of modules' , len( self.bif.getModules() ), 3 )
def testGetModuleName( self ): """SuccessfulSetupTestCase::getModuleName()""" assertEquals( 'Module name' , self.bif.getModuleName( 'module2' ) , 'test_name' )
def testGetExpiration( self ): """SuccessfulSetupTestCase::getExpiration()""" # Invokes a method of the Timestamp class. assertEquals( 'Expires ticks' , self.bif.getExpiration().getLocalTicks() , 1167638400 )
def testGetDefaultTarget( self ): """SuccessfulSetupTestCase::getDefaultTarget()""" assertEquals( 'Default target' , self.bif.getDefaultTarget() , 'test_default_target' )
def testGetModules(self): """SuccessfulSetupTestCase::getModules()""" assertEquals('Number of modules', len(self.bif.getModules()), 3)
def testSetDefaultCVSRoot(self): """SuccessfulSetupTestCase::setDefaultCVSRoot()""" self.bif.setDefaultCVSRoot('new_root') assertEquals('Setting CVS root', self.bif.getDefaultCVSRoot(), 'new_root')
def testSetDefaultCVSTag( self ): """SuccessfulSetupTestCase::setDefaultCVSTag()""" self.bif.setDefaultCVSTag( 'new_tag' ) assertEquals( 'Setting CVS tag' , self.bif.getDefaultCVSTag() , 'new_tag' )
def testRemoveModule(self): """SuccessfulSetupTestCase::removeModule()""" self.bif.removeModule('module1') assertEquals('Number of modules', len(self.bif.getModules()), 2)
def testSetDefaultCVSTagType( self ): """SuccessfulSetupTestCase::setDefaultCVSTagType()""" self.bif.setDefaultCVSTagType( 'branch' ) assertEquals( 'Setting CVS type' , self.bif.getDefaultCVSTagType() , 'branch' )
def testGetDefaultCVSRoot( self ): """SuccessfulSetupTestCase::getDefaultCVSRoot()""" assertEquals( 'Default CVS root' , self.bif.getDefaultCVSRoot() , 'test_root' )
def testGetDataSource( self ): """SuccessfulSetupTestCase::getDataSource()""" assertEquals( 'Data source' , self.bif.getDataSource() , self.dataSource )
def testGetDataAsString(self): """SuccessfulSetupTestCase::getDataAsString()""" assertEquals('Data string length', len(self.bif.getDataAsString().split('\n')), 28)
def testRemoveModule( self ): """SuccessfulSetupTestCase::removeModule()""" self.bif.removeModule( 'module1' ) assertEquals( 'Number of modules' , len( self.bif.getModules() ), 2 )
def testGetDefaultCVSDate(self): """SuccessfulSetupTestCase::getDefaultCVSDate()""" assertEquals('Default CVS date', self.bif.getDefaultCVSDate(), '2006-04-05')
def testGetDefaults(self): """SuccessfulSetupTestCase::getDefaults()""" assertEquals('Default object list count', len(self.bif.getDefaults()), 1)
def testGetDefaultCVSTagType(self): """SuccessfulSetupTestCase::getDefaultCVSTagType()""" assertEquals('Default CVS tag type', self.bif.getDefaultCVSTagType(), 'tag')
def testGetExpiration(self): """SuccessfulSetupTestCase::getExpiration()""" # Invokes a method of the Timestamp class. assertEquals('Expires ticks', self.bif.getExpiration().getLocalTicks(), 1167638400)
def testGetDefaultProfile(self): """SuccessfulSetupTestCase::getDefaultProfile()""" assertEquals('Default profile', self.bif.getDefaultProfile(), 'test_profile')
def testGetDefaultProfile( self ): """SuccessfulSetupTestCase::getDefaultProfile()""" assertEquals( 'Default profile' , self.bif.getDefaultProfile() , 'test_profile' )
def testGetDefaultTarget(self): """SuccessfulSetupTestCase::getDefaultTarget()""" assertEquals('Default target', self.bif.getDefaultTarget(), 'test_default_target')
def testGetBaseAddressOfFile( self ): assertEquals( 'Base address: ', self.basefile.getBaseAddressOfFile( self.dllName ), self.base )
def testGetModuleName(self): """SuccessfulSetupTestCase::getModuleName()""" assertEquals('Module name', self.bif.getModuleName('module2'), 'test_name')
def testGetSizeOfFile( self ): assertEquals( 'DLL Size: ', self.basefile.getSizeOfFile( self.dllName ), self.size )
def testSetBuildID(self): """SuccessfulSetupTestCase::setBuildID()""" self.bif.setBuildID('new_id') assertEquals('Setting Build ID', self.bif.getBuildID(), 'new_id')
def testGetNextBaseAddress( self ): assertEquals( 'Base address: ', self.basefile.getNextBaseAddress( self.dllName ) , self.newBase )
def testSetDefaultCVSTag(self): """SuccessfulSetupTestCase::setDefaultCVSTag()""" self.bif.setDefaultCVSTag('new_tag') assertEquals('Setting CVS tag', self.bif.getDefaultCVSTag(), 'new_tag')
def test_cut_comments(): test.assertEquals(trim.cut_comments(['hallo #sdfe']), ['hallo ']) test.assertEquals(trim.cut_comments(['hallo #sdfe', 'wie gehts #sdf']), ['hallo ', 'wie gehts ']) test.assertEquals(trim.cut_comments(['hallo welt _sdf #hier erst cutten']), ['hallo welt _sdf ']) test.assertEquals(trim.cut_comments(['hallo welt _sdf#hier erst cutten']), ['hallo welt _sdf']) test.assertEquals( trim.cut_comments( ['hallo welt #hier erst cutten _keine_labels_mitzählen']), ['hallo welt ']) test.assertEquals( trim.cut_comments(['#hallo welt _sdf #hier erst cutten']), [''])
def testGetDataAsString( self ): """SuccessfulSetupTestCase::getDataAsString()""" assertEquals( 'Data string length' , len( self.bif.getDataAsString().split('\n') ) , 28 )
def test_trim_word_gap(): test.assertEquals(trim.trim_word_gap(['hallo\t', '\n', 'naa']), ['hallo ', ' ', 'naa'])
def testRecordDLL( self ): self.basefile.recordDLL( self.dllName , self.newBase , self.newSize ) assertEquals( 'Base address: ', self.basefile.getNextBaseAddress( 'bogus' ), self.newBase + self.newSize )
def testGetDefaultCVSTagType( self ): """SuccessfulSetupTestCase::getDefaultCVSTagType()""" assertEquals( 'Default CVS tag type' , self.bif.getDefaultCVSTagType() , 'tag' )
def testGetDataAsFormattedString( self ): """SuccessfulSetupTestCase::getDataAsFormattedString()""" assertEquals( 'Formatted string length' , len( self.bif.getDataAsFormattedString().split('\n') ) , 32 )
def testGetBuildID(self): """SuccessfulSetupTestCase::getBuildID()""" assertEquals('Build ID', self.bif.getBuildID(), 'test_build_id')
def testIsDLLRecorded( self ): assertEquals( 'isDLLRecorded: ', self.basefile.isDLLRecorded( self.dllName ), 0 )
def testGetDefaultCVSDate( self ): """SuccessfulSetupTestCase::getDefaultCVSDate()""" assertEquals( 'Default CVS date' , self.bif.getDefaultCVSDate() , '2006-04-05' )