<s> import nose <EOL> import angr <EOL> import subprocess <EOL> import logging <EOL> l = logging . getLogger ( '<STR_LIT>' ) <EOL> import os <EOL> test_location = str ( os . path . dirname ( os . path . realpath ( __file__ ) ) ) <EOL> def run_sscanf ( threads ) : <EOL> test_bin = os . path . join ( test_location , "<STR_LIT>" ) <EOL> b = angr . Project ( test_bin ) <EOL> pg = b . factory . path_group ( immutable = False , threads = threads ) <EOL> expected_outputs = { <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> } <EOL> pg . explore ( find = <NUM_LIT> , num_find = len ( expected_outputs ) ) <EOL> nose . tools . assert_equal ( len ( pg . found ) , len ( expected_outputs ) ) <EOL> pipe = subprocess . PIPE <EOL> for f in pg . found : <EOL> test_input = f . state . posix . dumps ( <NUM_LIT:0> ) <EOL> test_output = f . state . posix . dumps ( <NUM_LIT:1> ) <EOL> expected_outputs . remove ( test_output ) <EOL> p = subprocess . Popen ( test_bin , stdout = pipe , stderr = pipe , stdin = pipe ) <EOL> ret = p . communicate ( test_input ) [ <NUM_LIT:0> ] <EOL> nose . tools . assert_equal ( ret , test_output ) <EOL> nose . tools . assert_equal ( len ( expected_outputs ) , <NUM_LIT:0> ) <EOL> def test_sscanf ( ) : <EOL> yield run_sscanf , None <EOL> yield run_sscanf , <NUM_LIT:8> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> run_sscanf ( <NUM_LIT:4> ) </s>
