#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""GDBump - Mass value editor for when manually editing .GDB files.

Created 2014 Triangle717
<http://Triangle717.WordPress.com/>

Licensed under The MIT License
<http://opensource.org/licenses/MIT/>

"""

import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import GDBump

def validateLines(shouldBe):
    """Confirm the values were correctly changed."""
    print()
    for i in range(0, len(gdbump.linesChanged)):
        line = gdbump._splitLine(gdbump.linesChanged[i])[1]
        value = shouldBe[i]

        print("{0} should be {1}".format(line, value))
        assert line == value, False
    print("\nAll values were correctly changed.")


axis = "y"
changeValue = "20"
testDir = os.path.join(os.getcwd(), "files")
inFile = os.path.join(testDir,  "y-axis.txt")
outFile = os.path.join(testDir,  "y-axis-changed.txt")

# Create an instance of GDBump
gdbump = GDBump.GDBump(axis, changeValue, inFile, outFile)
gdbump.changeValues()

# Value addition
validateLines((0, -30, 0, -40))

# Write the file and confirm it's length
gdbump.writeFile()
if os.path.isfile(outFile):
    with open(outFile, "rt") as f:
        numOfLines = f.readlines()[:]

    print("\nThere are {0} lines".format(len(numOfLines) + 1))
    assert len(numOfLines) == 38, False
    print("File is the correct length.\n")

print("*" * 7, "All tests passed.", "*" * 7)

@@ -364,37 +364,414 @@
 mp%0A%0A
-def validateLines(shouldBe):%0A
+%0Aclass TestRunner(object):%0A%0A    def __init__(self, axis, changeValue, inFile, outFile):%0A        self.axis = axis%0A        self.changeValue = changeValue%0A        self.inFile = inFile%0A        self.outFile = outFile%0A%0A        # Create an instance of GDBump%0A        self.gdbump = GDBump.GDBump(axis, changeValue, inFile, outFile)%0A        self.gdbump.changeValues()%0A%0A    def validateLines(self, shouldEqual):%0A    
     
@@ -819,16 +819,20 @@
 ged.%22%22%22%0A
+    
     prin
@@ -835,16 +835,20 @@
 print()%0A
+    
     for 
@@ -865,16 +865,21 @@
 (0, len(
+self.
 gdbump.l
@@ -905,15 +905,24 @@
     
+    
 line = 
+self.
 gdbu
@@ -935,16 +935,21 @@
 litLine(
+self.
 gdbump.l
@@ -967,16 +967,20 @@
 %5Bi%5D)%5B1%5D%0A
+    
         
@@ -997,15 +997,22 @@
 ould
-Be
+Equal
 %5Bi%5D%0A%0A
+    
     
@@ -1066,24 +1066,28 @@
 e))%0A        
+    
 assert line 
@@ -1102,24 +1102,28 @@
 , False%0A    
+  
+  
 print(%22%5CnAll
@@ -1162,38 +1162,8 @@
 )%0A%0A%0A
-axis = %22y%22%0AchangeValue = %2220%22%0A
 test
@@ -1319,108 +1319,79 @@
 te a
-n instance of GDBump%0Agdbump = GDBump.GDBump(axis, changeValue, inFile, outFile)%0Agdbump.changeValues(
+ test runner instance%0AyAxisTest = TestRunner(%22y%22, %2220%22, inFile, outFile
 )%0A%0A#
@@ -1406,16 +1406,26 @@
 ddition%0A
+yAxisTest.
 validate
@@ -1490,16 +1490,26 @@
  length%0A
+yAxisTest.
 gdbump.w

Convert TestRunner into class