import unittest
import multiprocessing
import time

import app.programs.original

class TestPrograms(unittest.TestCase):

    def program_helper(self, func, params=dict()):
        self.process = multiprocessing.Process(target=func, args=(params,))
        self.process.start()
        time.sleep(0.2)
        self.process.terminate()

    def test_ascii_text(self):
        self.program_helper(app.programs.original.ascii_text.run, { "text": "Hello World" }) 

    def test_cheertree(self):
        self.program_helper(app.programs.original.cheertree.run)

    def test_cross(self):
        self.program_helper(app.programs.original.cross.run)

    def test_demo(self):
        self.program_helper(app.programs.original.demo.run)

    def test_dna(self):
        self.program_helper(app.programs.original.dna.run)

    def test_game_of_life(self):
        self.program_helper(app.programs.original.game_of_life.run)

    def test_matrix(self):
        self.program_helper(app.programs.original.matrix.run)

    def test_psychedelia(self):
        self.program_helper(app.programs.original.psychedelia.run)

    def test_rain(self):
        self.program_helper(app.programs.original.rain.run)

    def test_rainbow(self):
        self.program_helper(app.programs.original.rainbow.run)

    def test_random_blinky(self):
        self.program_helper(app.programs.original.random_blinky.run)

    def test_random_sparkles(self):
        self.program_helper(app.programs.original.random_sparkles.run)

    def test_simple(self):
        self.program_helper(app.programs.original.simple.run)

    def test_snow(self):
        self.program_helper(app.programs.original.snow.run)

    def test_trig(self):
        self.program_helper(app.programs.original.trig.run)


if __name__ == '__main__':
    unittest.main()
@@ -65,24 +65,361 @@
 rograms.
-original
+hd%0Aimport app.programs.original%0A%0A%0AHD_PROGRAMS_LIST = %5B%22candle%22, %22demo%22, %22forest_fire%22, %22game_of_life%22, %22rainbow%22, %0A    %22stars%22, %22trig%22%5D%0AORIGINAL_PROGRAMS_LIST = %5B%22ascii_text%22, %22cheertree%22, %22cross%22, %22demo%22, %22dna%22, %0A    %22game_of_life%22, %22matrix%22, %22psychedelia%22, %22rain%22, %22rainbow%22, %0A    %22random_blinky%22, %22random_sparkles%22, %22simple%22, %22snow%22, %22trig%22%5D%0A
 %0A%0Aclass 
@@ -460,30 +460,27 @@
     def 
+run_
 program
-_helper
 (self, f
@@ -677,25 +677,21 @@
 f test_a
-scii_text
+ll_hd
 (self):%0A
@@ -702,1436 +702,415 @@
     
-self.program_helper(app.programs.original.ascii_text.run, %7B %22text%22: %22Hello World%22 %7D) %0A%0A    def test_cheertree(self):%0A
+for program in HD_PROGRAMS_LIST:%0A     
        
+with
  self.
-program_helper(app.programs.original.cheertree.run)%0A%0A    def test_cross(self):%0A        self.program_helper(app.programs.original.cross.run)%0A%0A    def test_demo(self):%0A        self.program_helper(app.programs.original.demo.run)%0A%0A    def test_dna(self):%0A        self.program_helper(app.programs.original.dna.run)%0A%0A    def test_game_of_life(self):%0A        self.program_helper(app.programs.original.game_of_life
+subTest(program=program):%0A                run = getattr(app.programs.hd, program)
 .run
-)%0A%0A
+%0A  
     
-def test_matrix(self):%0A        self.program_helper(app.programs.original.matrix.run)%0A%0A    def test_psychedelia(self):%0A        self.program_helper(app.programs.original.psychedelia.run)%0A%0A    def test_rain(self):%0A        self.program_helper(app.programs.original.rain.run)%0A%0A    def test_rainbow(self):%0A
+          self.run_program(run)%0A%0A    def test_all_original(self):%0A        for program in ORIGINAL_PROGRAMS_LIST:%0A     
        
+with
  self.
-program_helper(app.programs.original.rainbow.run)%0A%0A    def test_random_blinky(self):%0A        self.program_helper(app.programs.original.random_blinky.run)%0A%0A    def test_random_sparkles(self):%0A        self.program_helper(app.programs.original.random_sparkles.run)%0A%0A    def test_simple(self):%0A        self.program_helper(app.programs.original.simple.run)%0A%0A    def test_snow(self):%0A        self.program_helper(app.programs.original.snow
+subTest(program=program):%0A                run = getattr(app.programs.original, program)
 .run
-)%0A
 %0A    
-def test_trig(self):%0A        self.program_helper(app.programs.original.trig.run)%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main(
+            self.run_program(run
 )

Add program tests for hd programs