@ -96,314 +96,314 @@ class TestNamingConvention(unittest.TestCase):
p8 . wait ( )
def test_naming_convention_contract ( self ) :
out FD1 = open ( self . testFilePath1 + " .out " , " r " )
outFD1_lines = out FD1. readlines ( )
out FD1. close ( )
for i in range ( len ( out FD1_lines) ) :
out FD1_lines[ i ] = out FD1_lines[ i ] . strip ( )
err FD1 = open ( self . testFilePath1 + " .err " , " r " )
errFD1_lines = err FD1. readlines ( )
err FD1. close ( )
for i in range ( len ( err FD1_lines) ) :
err FD1_lines[ i ] = err FD1_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath1 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD1_lines[ 0 ] , " Number of Slither results: 2 " )
self . assertEqual ( out FD1_lines[ 1 ] , " Number of patches: 10 " )
self . assertEqual ( out FD1_lines. count ( " Detector: naming-convention (contract definition) " ) , 2 )
self . assertEqual ( out FD1_lines. count ( " Detector: naming-convention (contract state variable) " ) , 2 )
self . assertEqual ( out FD1_lines. count ( " Detector: naming-convention (contract function variable) " ) , 5 )
self . assertEqual ( out FD1_lines. count ( " Detector: naming-convention (contract new object) " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: contract one " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: contract One " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 53 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 65 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: three k " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: Three k " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 117 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 124 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: three l " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: Three l " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 206 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 213 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: one m " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: One m " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 343 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 348 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: one n " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: One n " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 423 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 428 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: contract three " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: contract Three " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 498 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 512 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: one " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: One " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 646 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 649 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: one r = new one() " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: One r = new one() " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 773 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 790 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: one q " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: One q " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 871 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 876 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Old string: new one() " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " New string: new One() " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location start: 781 " ) , 1 )
self . assertEqual ( out FD1_lines. count ( " Location end: 788 " ) , 1 )
self . assertEqual ( err FD1_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 2" )
self . assertEqual ( err FD1_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 10" )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Detector: naming-convention (contract definition)" ) , 2 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Detector: naming-convention (contract state variable)" ) , 2 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Detector: naming-convention (contract function variable)" ) , 5 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Detector: naming-convention (contract new object)" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: contract one" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: contract One" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 53" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 65" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: three k" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: Three k" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 117" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 124" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: three l" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: Three l" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 206" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 213" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: one m" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: One m" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 343" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 348" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: one n" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: One n" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 423" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 428" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: contract three" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: contract Three" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 498" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 512" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: one" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: One" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 646" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 649" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: one r = new one()" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: One r = new one()" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 773" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 790" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: one q" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: One q" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 871" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 876" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Old string: new one()" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: New string: new One()" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location start: 781" ) , 1 )
self . assertEqual ( err FD1_lines. count ( " INFO:Slither.Format: Location end: 788" ) , 1 )
def test_naming_convention_modifier ( self ) :
out FD2 = open ( self . testFilePath2 + " .out " , " r " )
outFD2_lines = out FD2. readlines ( )
out FD2. close ( )
for i in range ( len ( out FD2_lines) ) :
out FD2_lines[ i ] = out FD2_lines[ i ] . strip ( )
err FD2 = open ( self . testFilePath2 + " .err " , " r " )
errFD2_lines = err FD2. readlines ( )
err FD2. close ( )
for i in range ( len ( err FD2_lines) ) :
err FD2_lines[ i ] = err FD2_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath2 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD2_lines[ 0 ] , " Number of Slither results: 2 " )
self . assertEqual ( out FD2_lines[ 1 ] , " Number of patches: 5 " )
self . assertEqual ( out FD2_lines. count ( " Detector: naming-convention (modifier definition) " ) , 2 )
self . assertEqual ( out FD2_lines. count ( " Detector: naming-convention (modifier uses) " ) , 3 )
self . assertEqual ( out FD2_lines. count ( " Old string: modifier One " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " New string: modifier one " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location start: 215 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location end: 227 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Old string: () One " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " New string: () one " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location start: 288 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location end: 295 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Old string: modifier Two " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " New string: modifier two " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location start: 423 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location end: 435 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Old string: () one Two returns " ) , 2 )
self . assertEqual ( out FD2_lines. count ( " New string: () one two returns " ) , 2 )
self . assertEqual ( out FD2_lines. count ( " Location start: 503 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location end: 522 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location start: 718 " ) , 1 )
self . assertEqual ( out FD2_lines. count ( " Location end: 737 " ) , 1 )
self . assertEqual ( err FD2_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 2" )
self . assertEqual ( err FD2_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 5" )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Detector: naming-convention (modifier definition)" ) , 2 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Detector: naming-convention (modifier uses)" ) , 3 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Old string: modifier One" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: New string: modifier one" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location start: 215" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location end: 227" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Old string: () One" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: New string: () one" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location start: 288" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location end: 295" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Old string: modifier Two" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: New string: modifier two" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location start: 423" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location end: 435" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Old string: () one Two returns" ) , 2 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: New string: () one two returns" ) , 2 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location start: 503" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location end: 522" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location start: 718" ) , 1 )
self . assertEqual ( err FD2_lines. count ( " INFO:Slither.Format: Location end: 737" ) , 1 )
def test_naming_convention_structure ( self ) :
out FD3 = open ( self . testFilePath3 + " .out " , " r " )
outFD3_lines = out FD3. readlines ( )
out FD3. close ( )
for i in range ( len ( out FD3_lines) ) :
out FD3_lines[ i ] = out FD3_lines[ i ] . strip ( )
err FD3 = open ( self . testFilePath3 + " .err " , " r " )
errFD3_lines = err FD3. readlines ( )
err FD3. close ( )
for i in range ( len ( err FD3_lines) ) :
err FD3_lines[ i ] = err FD3_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath3 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD3_lines[ 0 ] , " Number of Slither results: 2 " )
self . assertEqual ( out FD3_lines[ 1 ] , " Number of patches: 8 " )
self . assertEqual ( out FD3_lines. count ( " Detector: naming-convention (struct definition) " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " Detector: naming-convention (struct use) " ) , 6 )
self . assertEqual ( out FD3_lines. count ( " Old string: struct s { uint i; } " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " New string: struct S { uint i; } " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " Location start: 108 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 134 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location start: 434 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 460 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Old string: s s1 " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " New string: S s1 " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " Location start: 171 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 175 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location start: 497 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 501 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Old string: s sA " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " New string: S sA " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " Location start: 570 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 574 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location start: 715 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 719 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Old string: s " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " New string: S " ) , 2 )
self . assertEqual ( out FD3_lines. count ( " Location start: 585 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 586 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location start: 730 " ) , 1 )
self . assertEqual ( out FD3_lines. count ( " Location end: 731 " ) , 1 )
self . assertEqual ( err FD3_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 2" )
self . assertEqual ( err FD3_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 8" )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Detector: naming-convention (struct definition)" ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Detector: naming-convention (struct use)" ) , 6 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Old string: struct s { uint i; } " ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: New string: struct S { uint i; } " ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 108" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 134" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 434" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 460" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Old string: s s1" ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: New string: S s1" ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 171" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 175" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 497" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 501" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Old string: s sA" ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: New string: S sA" ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 570" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 574" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 715" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 719" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Old string: s" ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: New string: S" ) , 2 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 585" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 586" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location start: 730" ) , 1 )
self . assertEqual ( err FD3_lines. count ( " INFO:Slither.Format: Location end: 731" ) , 1 )
def test_naming_convention_enum ( self ) :
out FD4 = open ( self . testFilePath4 + " .out " , " r " )
outFD4_lines = out FD4. readlines ( )
out FD4. close ( )
for i in range ( len ( out FD4_lines) ) :
out FD4_lines[ i ] = out FD4_lines[ i ] . strip ( )
err FD4 = open ( self . testFilePath4 + " .err " , " r " )
errFD4_lines = err FD4. readlines ( )
err FD4. close ( )
for i in range ( len ( err FD4_lines) ) :
err FD4_lines[ i ] = err FD4_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath4 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD4_lines[ 0 ] , " Number of Slither results: 2 " )
self . assertEqual ( out FD4_lines[ 1 ] , " Number of patches: 11 " )
self . assertEqual ( out FD4_lines. count ( " Detector: naming-convention (enum definition) " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " Detector: naming-convention (enum use) " ) , 9 )
self . assertEqual ( out FD4_lines. count ( " Old string: enum e { ONE, TWO} " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " New string: enum E { ONE, TWO} " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " Location start: 73 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 90 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location start: 426 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 443 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Old string: e e1 " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " New string: E e1 " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " Location start: 125 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 129 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location start: 478 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 482 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Old string: e eA " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " New string: E eA " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " Location start: 549 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 553 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location start: 690 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 694 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Old string: e e2 = eA " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " New string: E e2 = eA " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " Location start: 573 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 582 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location start: 714 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 723 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Old string: e.ONE " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " New string: E.ONE " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location start: 186 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 192 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Old string: e " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " New string: E " ) , 2 )
self . assertEqual ( out FD4_lines. count ( " Location start: 564 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 565 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location start: 705 " ) , 1 )
self . assertEqual ( out FD4_lines. count ( " Location end: 706 " ) , 1 )
self . assertEqual ( err FD4_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 2" )
self . assertEqual ( err FD4_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 11" )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Detector: naming-convention (enum definition)" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Detector: naming-convention (enum use)" ) , 9 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Old string: enum e { ONE, TWO} " ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: New string: enum E { ONE, TWO} " ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 73" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 90" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 426" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 443" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Old string: e e1" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: New string: E e1" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 125" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 129" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 478" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 482" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Old string: e eA" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: New string: E eA" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 549" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 553" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 690" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 694" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Old string: e e2 = eA" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: New string: E e2 = eA" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 573" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 582" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 714" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 723" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Old string: e.ONE" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: New string: E.ONE" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 186" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 192" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Old string: e" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: New string: E" ) , 2 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 564" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 565" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location start: 705" ) , 1 )
self . assertEqual ( err FD4_lines. count ( " INFO:Slither.Format: Location end: 706" ) , 1 )
def test_naming_convention_event ( self ) :
out FD5 = open ( self . testFilePath5 + " .out " , " r " )
outFD5_lines = out FD5. readlines ( )
out FD5. close ( )
for i in range ( len ( out FD5_lines) ) :
out FD5_lines[ i ] = out FD5_lines[ i ] . strip ( )
err FD5 = open ( self . testFilePath5 + " .err " , " r " )
errFD5_lines = err FD5. readlines ( )
err FD5. close ( )
for i in range ( len ( err FD5_lines) ) :
err FD5_lines[ i ] = err FD5_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath5 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD5_lines[ 0 ] , " Number of Slither results: 2 " )
self . assertEqual ( out FD5_lines[ 1 ] , " Number of patches: 5 " )
self . assertEqual ( out FD5_lines. count ( " Detector: naming-convention (event definition) " ) , 2 )
self . assertEqual ( out FD5_lines. count ( " Detector: naming-convention (event calls) " ) , 3 )
self . assertEqual ( out FD5_lines. count ( " Old string: event e(uint); " ) , 2 )
self . assertEqual ( out FD5_lines. count ( " New string: event E(uint); " ) , 2 )
self . assertEqual ( out FD5_lines. count ( " Location start: 75 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location end: 89 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location start: 148 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location end: 152 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Old string: e(i) " ) , 3 )
self . assertEqual ( out FD5_lines. count ( " New string: E(i) " ) , 3 )
self . assertEqual ( out FD5_lines. count ( " Location start: 148 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location end: 152 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location start: 438 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location end: 442 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location start: 550 " ) , 1 )
self . assertEqual ( out FD5_lines. count ( " Location end: 554 " ) , 1 )
self . assertEqual ( err FD5_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 2" )
self . assertEqual ( err FD5_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 5" )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Detector: naming-convention (event definition)" ) , 2 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Detector: naming-convention (event calls)" ) , 3 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Old string: event e(uint);" ) , 2 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: New string: event E(uint);" ) , 2 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location start: 75" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location end: 89" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location start: 148" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location end: 152" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Old string: e(i)" ) , 3 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: New string: E(i)" ) , 3 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location start: 148" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location end: 152" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location start: 438" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location end: 442" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location start: 550" ) , 1 )
self . assertEqual ( err FD5_lines. count ( " INFO:Slither.Format: Location end: 554" ) , 1 )
def test_naming_convention_function ( self ) :
out FD6 = open ( self . testFilePath6 + " .out " , " r " )
outFD6_lines = out FD6. readlines ( )
out FD6. close ( )
for i in range ( len ( out FD6_lines) ) :
out FD6_lines[ i ] = out FD6_lines[ i ] . strip ( )
err FD6 = open ( self . testFilePath6 + " .err " , " r " )
errFD6_lines = err FD6. readlines ( )
err FD6. close ( )
for i in range ( len ( err FD6_lines) ) :
err FD6_lines[ i ] = err FD6_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath6 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD6_lines[ 0 ] , " Number of Slither results: 2 " )
self . assertEqual ( out FD6_lines[ 1 ] , " Number of patches: 4 " )
self . assertEqual ( out FD6_lines. count ( " Detector: naming-convention (function definition) " ) , 2 )
self . assertEqual ( out FD6_lines. count ( " Detector: naming-convention (function calls) " ) , 2 )
self . assertEqual ( out FD6_lines. count ( " Old string: function Foo " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " New string: function foo " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location start: 76 " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location end: 88 " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Old string: function Foobar " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " New string: function foobar " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location start: 189 " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location end: 204 " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Old string: Foobar(10) " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " New string: foobar(10) " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location start: 136 " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location end: 146 " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Old string: a.Foobar(10) " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " New string: a.foobar(10) " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location start: 516 " ) , 1 )
self . assertEqual ( out FD6_lines. count ( " Location end: 528 " ) , 1 )
self . assertEqual ( err FD6_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 2" )
self . assertEqual ( err FD6_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 4" )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Detector: naming-convention (function definition)" ) , 2 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Detector: naming-convention (function calls)" ) , 2 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Old string: function Foo" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: New string: function foo" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location start: 76" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location end: 88" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Old string: function Foobar" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: New string: function foobar" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location start: 189" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location end: 204" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Old string: Foobar(10)" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: New string: foobar(10)" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location start: 136" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location end: 146" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Old string: a.Foobar(10)" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: New string: a.foobar(10)" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location start: 516" ) , 1 )
self . assertEqual ( err FD6_lines. count ( " INFO:Slither.Format: Location end: 528" ) , 1 )
def test_naming_convention_parameter ( self ) :
out FD7 = open ( self . testFilePath7 + " .out " , " r " )
outFD7_lines = out FD7. readlines ( )
out FD7. close ( )
for i in range ( len ( out FD7_lines) ) :
out FD7_lines[ i ] = out FD7_lines[ i ] . strip ( )
err FD7 = open ( self . testFilePath7 + " .err " , " r " )
errFD7_lines = err FD7. readlines ( )
err FD7. close ( )
for i in range ( len ( err FD7_lines) ) :
err FD7_lines[ i ] = err FD7_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath7 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD7_lines[ 0 ] , " Number of Slither results: 6 " )
self . assertEqual ( out FD7_lines[ 1 ] , " Number of patches: 12 " )
self . assertEqual ( out FD7_lines. count ( " Detector: naming-convention (parameter declaration) " ) , 6 )
self . assertEqual ( out FD7_lines. count ( " Detector: naming-convention (parameter uses) " ) , 6 )
self . assertEqual ( out FD7_lines. count ( " Old string: uint Count " ) , 3 )
self . assertEqual ( out FD7_lines. count ( " New string: uint _Count " ) , 3 )
self . assertEqual ( out FD7_lines. count ( " Location start: 91 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 101 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 215 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 225 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: Count " ) , 3 )
self . assertEqual ( out FD7_lines. count ( " New string: _Count " ) , 3 )
self . assertEqual ( out FD7_lines. count ( " Location start: 148 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 153 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 308 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 313 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 489 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 499 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 580 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 585 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: Count) " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " New string: _Count) " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 506 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 512 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: uint Number " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " New string: uint _Number " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 227 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 238 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: Number " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " New string: _Number " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 314 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 320 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: address _to " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " New string: address _To " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 708 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 719 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: address _from " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " New string: address _From " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 721 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 734 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: _to " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " New string: _To " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location start: 811 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Location end: 814 " ) , 1 )
self . assertEqual ( out FD7_lines. count ( " Old string: _from " ) , 1 , " Index variables of writes are not captured by node._expression_vars_read of Slither " )
self . assertEqual ( out FD7_lines. count ( " New string: _From " ) , 1 )
self . assertEqual ( err FD7_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 6" )
self . assertEqual ( err FD7_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 12" )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Detector: naming-convention (parameter declaration)" ) , 6 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Detector: naming-convention (parameter uses)" ) , 6 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: uint Count" ) , 3 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: uint _Count" ) , 3 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 91" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 101" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 215" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 225" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: Count" ) , 3 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: _Count" ) , 3 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 148" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 153" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 308" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 313" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 489" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 499" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 580" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 585" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: Count)" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: _Count)" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 506" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 512" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: uint Number" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: uint _Number" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 227" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 238" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: Number" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: _Number" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 314" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 320" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: address _to" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: address _To" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 708" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 719" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: address _from" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: address _From" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 721" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 734" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: _to" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: _To" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location start: 811" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Location end: 814" ) , 1 )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: Old string: _from" ) , 1 , " Index variables of writes are not captured by node._expression_vars_read of Slither " )
self . assertEqual ( err FD7_lines. count ( " INFO:Slither.Format: New string: _From" ) , 1 )
def test_naming_convention_state_variable ( self ) :
out FD8 = open ( self . testFilePath8 + " .out " , " r " )
outFD8_lines = out FD8. readlines ( )
out FD8. close ( )
for i in range ( len ( out FD8_lines) ) :
out FD8_lines[ i ] = out FD8_lines[ i ] . strip ( )
err FD8 = open ( self . testFilePath8 + " .err " , " r " )
errFD8_lines = err FD8. readlines ( )
err FD8. close ( )
for i in range ( len ( err FD8_lines) ) :
err FD8_lines[ i ] = err FD8_lines[ i ] . strip ( )
self . assertTrue ( os . path . isfile ( self . testFilePath8 + " .format " ) , " Patched .format file is not created?! " )
self . assertEqual ( out FD8_lines[ 0 ] , " Number of Slither results: 3 " )
self . assertEqual ( out FD8_lines[ 1 ] , " Number of patches: 9 " )
self . assertEqual ( out FD8_lines. count ( " Detector: naming-convention (state variable declaration) " ) , 3 )
self . assertEqual ( out FD8_lines. count ( " Detector: naming-convention (state variable uses) " ) , 6 )
self . assertEqual ( out FD8_lines. count ( " Old string: number " ) , 3 )
self . assertEqual ( out FD8_lines. count ( " New string: NUMBER " ) , 3 )
self . assertEqual ( out FD8_lines. count ( " Location start: 469 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 475 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location start: 716 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 722 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location start: 850 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 856 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Old string: Count " ) , 3 )
self . assertEqual ( out FD8_lines. count ( " New string: count " ) , 3 )
self . assertEqual ( out FD8_lines. count ( " Location start: 547 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 552 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location start: 725 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 730 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location start: 745 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 750 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Old string: Maxnum " ) , 3 )
self . assertEqual ( out FD8_lines. count ( " New string: maxnum " ) , 3 )
self . assertEqual ( out FD8_lines. count ( " Location start: 634 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 640 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location start: 733 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 739 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location start: 859 " ) , 1 )
self . assertEqual ( out FD8_lines. count ( " Location end: 865 " ) , 1 )
self . assertEqual ( err FD8_lines[ 0 ] , " INFO:Slither.Format: Number of Slither results: 3" )
self . assertEqual ( err FD8_lines[ 1 ] , " INFO:Slither.Format: Number of patches: 9" )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Detector: naming-convention (state variable declaration)" ) , 3 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Detector: naming-convention (state variable uses)" ) , 6 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Old string: number" ) , 3 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: New string: NUMBER" ) , 3 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 469" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 475" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 716" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 722" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 850" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 856" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Old string: Count" ) , 3 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: New string: count" ) , 3 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 547" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 552" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 725" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 730" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 745" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 750" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Old string: Maxnum" ) , 3 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: New string: maxnum" ) , 3 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 634" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 640" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 733" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 739" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location start: 859" ) , 1 )
self . assertEqual ( err FD8_lines. count ( " INFO:Slither.Format: Location end: 865" ) , 1 )
if __name__ == ' __main__ ' :
unittest . main ( )