source: trunk/lib_ir/test_s2p.py @ 4067

Last change on this file since 4067 was 3909, checked in by linmengl, 5 years ago

initial commit of lib_ir

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#! /bin/python
2
3import subprocess
4import sys
5failed = False
6
7def check(res, should):
8    if res.strip() != should.strip():
9        print "Test faild."
10        failed = True
11        sys.exit(1)
12
13res = subprocess.check_output(["./test_s2p", "1231"])
14should = """
1500010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001
1600010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001
1700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1900010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001
2000110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011
2100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001
2200010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001
23"""
24check(res, should)
25
26res = subprocess.check_output(["./test_s2p", "121231231"])
27should = """
2800100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010
2900110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011
3001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101
3101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111
3201010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101
3310111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011
3410111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011
3511111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
36"""
37check(res, should)
38
39res = subprocess.check_output(["./test_s2p", "535353"])
40should = """
4100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
4200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
4300110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011
4400010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001
4501110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111011101110111
4600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
4700100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010
4800110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011
49"""
50check(res, should)
51
52if not failed:
53    print "Test succeed!"
Note: See TracBrowser for help on using the repository browser.