Skip to content

Commit

Permalink
Merged sundhaug92's tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devttys0 committed Mar 15, 2017
1 parent 9c77840 commit 8b3ea0a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/input-vectors/hello-world.ihex
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:0B00000048656C6C6F20576F726C64D9
:00000001FF
2 changes: 2 additions & 0 deletions tests/input-vectors/hello-world.srec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
S3100000000048656C6C6F20576F726C64D3
S5030001FB
24 changes: 24 additions & 0 deletions tests/test_ihex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from os.path import dirname

import binwalk
from nose.tools import eq_, ok_


def test_hello_world_simple_scan():
'''
Test: Open hello-world.ihex, scan for signatures
verify that only one signature is returned
verify that the only signature returned is Intel HEX data-signature
'''
scan_result = binwalk.scan(
dirname(__file__) + '/input-vectors/hello-world.ihex',
signature=True,
quiet=True,
extract=True) # Throws a warning for missing external extractor
# Test number of modules used
eq_(len(scan_result), 1)
# Test number of results for that module
eq_(len(scan_result[0].results), 1)
# Test result-description
eq_(scan_result[0].results[0].description,
'Intel HEX data, record type: data')
24 changes: 24 additions & 0 deletions tests/test_srec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from os.path import dirname

import binwalk
from nose.tools import eq_, ok_


def test_hello_world_simple_scan():
'''
Test: Open hello-world.srec, scan for signatures
verify that only one signature is returned
verify that the only signature returned is Motorola S-rec data-signature
'''
scan_result = binwalk.scan(
dirname(__file__) + '/input-vectors/hello-world.srec',
signature=True,
quiet=True,
extract=True) # Throws a warning for missing external extractor
# Test number of modules used
eq_(len(scan_result), 1)
# Test number of results for that module
eq_(len(scan_result[0].results), 1)
# Test result-description
eq_(scan_result[0].results[0].description,
'Motorola S-Record; binary data in text format, record type: data (32-bit)')

0 comments on commit 8b3ea0a

Please sign in to comment.