codegen: removed hardcoded test image file name

This commit is contained in:
András Veres-Szentkirályi 2016-04-20 14:07:35 +02:00
parent 5d38b3b52d
commit ff15c3a63a
2 changed files with 3 additions and 5 deletions

View file

@ -106,14 +106,13 @@ def gen_matches(same_as, history, n):
cur_start = i
cur_end = tmp
def test():
def test(img_file):
from subprocess import Popen, PIPE, check_output
from os import remove, path
from PIL import Image
from datetime import datetime
import struct
exe = './codegen-test-executable'
img_file = '320x256rgb.png'
if not path.exists('stb_image.h'):
from urllib import urlretrieve
urlretrieve('https://raw.githubusercontent.com/nothings/stb/master/stb_image.h', 'stb_image.h')
@ -162,7 +161,7 @@ def test():
if __name__ == '__main__':
from sys import argv
if len(argv) > 1 and argv[1] == 'test':
test()
if len(argv) > 2 and argv[1] == 'test':
test(argv[2])
else:
print '\n'.join(main())

View file

@ -1,7 +1,6 @@
#include <stdio.h>
#define STB_IMAGE_IMPLEMENTATION
#define STBI_ONLY_PNG
#include "stb_image.h"
#include "codegen.c"