Created
April 17, 2013 10:33
-
-
Save N3MIS15/5403299 to your computer and use it in GitHub Desktop.
rom test hackery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Copyright (C) 2013 Garrett Brown | |
# See Copyright Notice in rominfo.py | |
import testutils | |
import unittest | |
import os | |
import json | |
nintendo64 = testutils.loadModule("nintendo64") | |
class TestNintendo64Parser(unittest.TestCase): | |
def setUp(self): | |
self.n64Parser = nintendo64.Nintendo64Parser() | |
def test_nintendo64(self): | |
empty = self.n64Parser.parse("data/empty") | |
self.assertEquals(len(empty), 0) | |
n64_results = list() | |
rom_count = 0 | |
failed_count = 0 | |
for x in os.listdir(os.path.join(os.getcwd(), "data", "N64", "ROMS")): | |
print x | |
path_x = os.path.join(os.getcwd(), "data", "N64", "ROMS", x) | |
try: | |
props = self.n64Parser.parse(path_x) | |
rom_count +=1 | |
except Exception as e: | |
props = {"failed": str(e)} | |
failed_count +=1 | |
n64_results.append({"filename": x, "result": props}) | |
f = file("n64_output.json", "w") | |
f.write(json.dumps({"total": rom_count, "failed": failed_count, "result": n64_results}, sort_keys=True, indent=4)) | |
f.close() | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment