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