Esempio n. 1
0
 def testSelfDecrement( self ):
     ticks = self.ts1.getLocalTicks() + 30000
     self.ts2 = Timestamp( ticks )
     self.ts2 -= 30000
     assertEquals( 'Ticks',
                   self.ts2.getLocalTicks() ,
                   self.ts1.getLocalTicks() )
Esempio n. 2
0
 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)
Esempio n. 3
0
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(['']), [''])
Esempio n. 4
0
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'])
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)
Esempio n. 7
0
 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 )
Esempio n. 8
0
 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 )
Esempio n. 9
0
 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)
Esempio n. 10
0
 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 )                     
Esempio n. 11
0
 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 )
Esempio n. 12
0
 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 )
Esempio n. 13
0
 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 )
Esempio n. 14
0
 def testGetDefaults( self ):
     """SuccessfulSetupTestCase::getDefaults()"""
     assertEquals( 'Default object list count' ,
                   len( self.bif.getDefaults() ), 
                   1 )
Esempio n. 15
0
 def testGetDefaultOptions(self):
     """SuccessfulSetupTestCase::getDefaultOptions()"""
     assertEquals('Default options', self.bif.getDefaultOptions(),
                  'test_option')
Esempio n. 16
0
 def testGetDefaultCVSRoot(self):
     """SuccessfulSetupTestCase::getDefaultCVSRoot()"""
     assertEquals('Default CVS root', self.bif.getDefaultCVSRoot(),
                  'test_root')
Esempio n. 17
0
 def testGetDataSource(self):
     """SuccessfulSetupTestCase::getDataSource()"""
     assertEquals('Data source', self.bif.getDataSource(), self.dataSource)
Esempio n. 18
0
 def testGetDataAsFormattedString(self):
     """SuccessfulSetupTestCase::getDataAsFormattedString()"""
     assertEquals('Formatted string length',
                  len(self.bif.getDataAsFormattedString().split('\n')), 32)
Esempio n. 19
0
 def testGetDefaultOptions( self ):
     """SuccessfulSetupTestCase::getDefaultOptions()"""
     assertEquals( 'Default options' , 
                   self.bif.getDefaultOptions() ,
                   'test_option' )
Esempio n. 20
0
 def testSetDefaultCVSTagType(self):
     """SuccessfulSetupTestCase::setDefaultCVSTagType()"""
     self.bif.setDefaultCVSTagType('branch')
     assertEquals('Setting CVS type', self.bif.getDefaultCVSTagType(),
                  'branch')
Esempio n. 21
0
 def testSetDefaultCVSRoot( self ):
     """SuccessfulSetupTestCase::setDefaultCVSRoot()"""
     self.bif.setDefaultCVSRoot( 'new_root' )
     assertEquals( 'Setting CVS root' , 
                   self.bif.getDefaultCVSRoot() , 
                   'new_root' )
Esempio n. 22
0
 def testSetBuildID( self ):
     """SuccessfulSetupTestCase::setBuildID()"""
     self.bif.setBuildID( 'new_id' )
     assertEquals( 'Setting Build ID' , self.bif.getBuildID() , 'new_id' )
Esempio n. 23
0
 def testGetModules( self ):
     """SuccessfulSetupTestCase::getModules()"""
     assertEquals( 'Number of modules' ,
                   len( self.bif.getModules() ),
                   3 )
Esempio n. 24
0
 def testGetModuleName( self ):
     """SuccessfulSetupTestCase::getModuleName()"""
     assertEquals( 'Module name' ,
                   self.bif.getModuleName( 'module2' ) , 
                   'test_name' )
Esempio n. 25
0
 def testGetExpiration( self ):
     """SuccessfulSetupTestCase::getExpiration()"""
     # Invokes a method of the Timestamp class.
     assertEquals( 'Expires ticks' ,
                   self.bif.getExpiration().getLocalTicks() ,
                   1167638400 )
Esempio n. 26
0
 def testGetDefaultTarget( self ):
     """SuccessfulSetupTestCase::getDefaultTarget()"""
     assertEquals( 'Default target' , 
                   self.bif.getDefaultTarget() , 
                   'test_default_target' )
Esempio n. 27
0
 def testGetModules(self):
     """SuccessfulSetupTestCase::getModules()"""
     assertEquals('Number of modules', len(self.bif.getModules()), 3)
Esempio n. 28
0
 def testSetDefaultCVSRoot(self):
     """SuccessfulSetupTestCase::setDefaultCVSRoot()"""
     self.bif.setDefaultCVSRoot('new_root')
     assertEquals('Setting CVS root', self.bif.getDefaultCVSRoot(),
                  'new_root')
Esempio n. 29
0
 def testSetDefaultCVSTag( self ):
     """SuccessfulSetupTestCase::setDefaultCVSTag()"""
     self.bif.setDefaultCVSTag( 'new_tag' )
     assertEquals( 'Setting CVS tag' , 
                   self.bif.getDefaultCVSTag() , 
                   'new_tag' )
Esempio n. 30
0
 def testRemoveModule(self):
     """SuccessfulSetupTestCase::removeModule()"""
     self.bif.removeModule('module1')
     assertEquals('Number of modules', len(self.bif.getModules()), 2)
Esempio n. 31
0
 def testSetDefaultCVSTagType( self ):
     """SuccessfulSetupTestCase::setDefaultCVSTagType()"""
     self.bif.setDefaultCVSTagType( 'branch' )
     assertEquals( 'Setting CVS type' ,
                   self.bif.getDefaultCVSTagType() ,
                   'branch' )
Esempio n. 32
0
 def testGetDefaultCVSRoot( self ):
     """SuccessfulSetupTestCase::getDefaultCVSRoot()"""
     assertEquals( 'Default CVS root' , 
                   self.bif.getDefaultCVSRoot() , 
                   'test_root' )
Esempio n. 33
0
 def testGetDataSource( self ):
     """SuccessfulSetupTestCase::getDataSource()"""
     assertEquals( 'Data source' , 
                   self.bif.getDataSource() , 
                   self.dataSource )
Esempio n. 34
0
 def testGetDataAsString(self):
     """SuccessfulSetupTestCase::getDataAsString()"""
     assertEquals('Data string length',
                  len(self.bif.getDataAsString().split('\n')), 28)
Esempio n. 35
0
 def testRemoveModule( self ):
     """SuccessfulSetupTestCase::removeModule()"""
     self.bif.removeModule( 'module1' )
     assertEquals( 'Number of modules' ,
                   len( self.bif.getModules() ),
                   2 )
Esempio n. 36
0
 def testGetDefaultCVSDate(self):
     """SuccessfulSetupTestCase::getDefaultCVSDate()"""
     assertEquals('Default CVS date', self.bif.getDefaultCVSDate(),
                  '2006-04-05')
Esempio n. 37
0
 def testGetDefaults(self):
     """SuccessfulSetupTestCase::getDefaults()"""
     assertEquals('Default object list count', len(self.bif.getDefaults()),
                  1)
Esempio n. 38
0
 def testGetDefaultCVSTagType(self):
     """SuccessfulSetupTestCase::getDefaultCVSTagType()"""
     assertEquals('Default CVS tag type', self.bif.getDefaultCVSTagType(),
                  'tag')
Esempio n. 39
0
 def testGetExpiration(self):
     """SuccessfulSetupTestCase::getExpiration()"""
     # Invokes a method of the Timestamp class.
     assertEquals('Expires ticks',
                  self.bif.getExpiration().getLocalTicks(), 1167638400)
Esempio n. 40
0
 def testGetDefaultProfile(self):
     """SuccessfulSetupTestCase::getDefaultProfile()"""
     assertEquals('Default profile', self.bif.getDefaultProfile(),
                  'test_profile')
Esempio n. 41
0
 def testGetDefaultProfile( self ):
     """SuccessfulSetupTestCase::getDefaultProfile()"""
     assertEquals( 'Default profile' ,
                   self.bif.getDefaultProfile() ,
                   'test_profile' )
Esempio n. 42
0
 def testGetDefaultTarget(self):
     """SuccessfulSetupTestCase::getDefaultTarget()"""
     assertEquals('Default target', self.bif.getDefaultTarget(),
                  'test_default_target')
Esempio n. 43
0
 def testGetBaseAddressOfFile( self ):
     assertEquals( 'Base address: ',
                   self.basefile.getBaseAddressOfFile( self.dllName ),
                   self.base )
Esempio n. 44
0
 def testGetModuleName(self):
     """SuccessfulSetupTestCase::getModuleName()"""
     assertEquals('Module name', self.bif.getModuleName('module2'),
                  'test_name')
Esempio n. 45
0
 def testGetSizeOfFile( self ):
     assertEquals( 'DLL Size: ',
                   self.basefile.getSizeOfFile( self.dllName ),
                   self.size )
Esempio n. 46
0
 def testSetBuildID(self):
     """SuccessfulSetupTestCase::setBuildID()"""
     self.bif.setBuildID('new_id')
     assertEquals('Setting Build ID', self.bif.getBuildID(), 'new_id')
Esempio n. 47
0
 def testGetNextBaseAddress( self ):
     assertEquals( 'Base address: ',
                   self.basefile.getNextBaseAddress( self.dllName ) ,
                   self.newBase )
Esempio n. 48
0
 def testSetDefaultCVSTag(self):
     """SuccessfulSetupTestCase::setDefaultCVSTag()"""
     self.bif.setDefaultCVSTag('new_tag')
     assertEquals('Setting CVS tag', self.bif.getDefaultCVSTag(), 'new_tag')
Esempio n. 49
0
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']), [''])
Esempio n. 50
0
 def testGetDataAsString( self ):
     """SuccessfulSetupTestCase::getDataAsString()"""
     assertEquals( 'Data string length' ,
                   len( self.bif.getDataAsString().split('\n') ) ,
                   28 )
Esempio n. 51
0
def test_trim_word_gap():
    test.assertEquals(trim.trim_word_gap(['hallo\t', '\n', 'naa']),
                      ['hallo ', ' ', 'naa'])
Esempio n. 52
0
 def testRecordDLL( self ):
     self.basefile.recordDLL( self.dllName , self.newBase , self.newSize )
     assertEquals( 'Base address: ',
                   self.basefile.getNextBaseAddress( 'bogus' ),
                   self.newBase + self.newSize )
Esempio n. 53
0
 def testGetDefaultCVSTagType( self ):        
     """SuccessfulSetupTestCase::getDefaultCVSTagType()"""
     assertEquals( 'Default CVS tag type' , 
                   self.bif.getDefaultCVSTagType() ,
                   'tag' )
Esempio n. 54
0
 def testGetDataAsFormattedString( self ):
     """SuccessfulSetupTestCase::getDataAsFormattedString()"""
     assertEquals( 'Formatted string length' , 
                   len( self.bif.getDataAsFormattedString().split('\n') ) , 
                   32 )
Esempio n. 55
0
 def testGetBuildID(self):
     """SuccessfulSetupTestCase::getBuildID()"""
     assertEquals('Build ID', self.bif.getBuildID(), 'test_build_id')
Esempio n. 56
0
 def testIsDLLRecorded( self ):
     assertEquals( 'isDLLRecorded: ',
                   self.basefile.isDLLRecorded( self.dllName ),
                   0 )
Esempio n. 57
0
 def testGetDefaultCVSDate( self ):
     """SuccessfulSetupTestCase::getDefaultCVSDate()"""
     assertEquals( 'Default CVS date' , 
                   self.bif.getDefaultCVSDate() , 
                   '2006-04-05' )