Mercurial > hg > vampy-host
comparison test_process.py @ 50:4aee7f2060ca
Update tests
author | Chris Cannam |
---|---|
date | Tue, 13 Jan 2015 12:11:34 +0000 |
parents | 22f64060ffb4 |
children |
comparison
equal
deleted
inserted
replaced
49:d4a3cd9dcf2c | 50:4aee7f2060ca |
---|---|
7 ##!!! todo: support for, and test for, correct version of test plugin (with parameter) | 7 ##!!! todo: support for, and test for, correct version of test plugin (with parameter) |
8 | 8 |
9 rate = 44100 | 9 rate = 44100 |
10 | 10 |
11 def test_load_unload(): | 11 def test_load_unload(): |
12 plug = vh.loadPlugin(testPluginKey, rate) | 12 plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone) |
13 plug.unload() | 13 plug.unload() |
14 try: | 14 try: |
15 plug.unload() # should throw but not crash | 15 plug.unload() # should throw but not crash |
16 assert(False) | 16 assert(False) |
17 except AttributeError: | 17 except AttributeError: |
18 pass | 18 pass |
19 | 19 |
20 def test_get_set_parameter(): | 20 def test_get_set_parameter(): |
21 plug = vh.loadPlugin(testPluginKey, rate) | 21 plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone) |
22 value = plug.getParameterValue("produce_output") | 22 value = plug.getParameterValue("produce_output") |
23 assert(value == 1.0) | 23 assert(value == 1.0) |
24 plug.setParameterValue("produce_output", 0.0) | 24 plug.setParameterValue("produce_output", 0.0) |
25 value = plug.getParameterValue("produce_output") | 25 value = plug.getParameterValue("produce_output") |
26 assert(value == 0.0) | 26 assert(value == 0.0) |
27 | 27 |
28 def test_process_without_initialise(): | 28 def test_process_without_initialise(): |
29 plug = vh.loadPlugin(testPluginKey, rate) | 29 plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone) |
30 try: | 30 try: |
31 plug.process([[1,2,3,4]], vh.RealTime(0, 0)) | 31 plug.process([[1,2,3,4]], vh.RealTime(0, 0)) |
32 assert False | 32 assert False |
33 except StandardError: | 33 except StandardError: |
34 pass | 34 pass |
35 | 35 |
36 def test_process_input_format(): | 36 def test_process_input_format(): |
37 plug = vh.loadPlugin(testPluginKey, rate) | 37 plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone) |
38 plug.initialise(2, 4, 4) # channels, stepsize, blocksize | 38 plug.initialise(2, 4, 4) # channels, stepsize, blocksize |
39 result = plug.process([[1,2,3,4],[5,6,7,8]], vh.RealTime(0, 0)) | 39 result = plug.process([[1,2,3,4],[5,6,7,8]], vh.RealTime(0, 0)) |
40 result = plug.process([np.array([1,2,3,4]),np.array([5,6,7,8])], vh.RealTime(0, 0)) | 40 result = plug.process([np.array([1,2,3,4]),np.array([5,6,7,8])], vh.RealTime(0, 0)) |
41 result = plug.process(np.array([[1,2,3,4],[5,6,7,8]]), vh.RealTime(0, 0)) | 41 result = plug.process(np.array([[1,2,3,4],[5,6,7,8]]), vh.RealTime(0, 0)) |
42 try: | 42 try: |
57 assert False | 57 assert False |
58 except TypeError: | 58 except TypeError: |
59 pass | 59 pass |
60 | 60 |
61 def test_process_output_1ch(): | 61 def test_process_output_1ch(): |
62 plug = vh.loadPlugin(testPluginKey, rate) | 62 plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone) |
63 plug.initialise(1, 2, 2) | 63 plug.initialise(1, 2, 2) |
64 try: | 64 try: |
65 # Too many channels | 65 # Too many channels |
66 result = plug.process([[3,4],[5,6]], vh.RealTime(0, 0)) | 66 result = plug.process([[3,4],[5,6]], vh.RealTime(0, 0)) |
67 assert False | 67 assert False |
71 assert result[8] == [ { "label" : "", "values" : np.array([5.0]) } ] | 71 assert result[8] == [ { "label" : "", "values" : np.array([5.0]) } ] |
72 result = plug.process([[3,0]], vh.RealTime(0, 0)) | 72 result = plug.process([[3,0]], vh.RealTime(0, 0)) |
73 assert result[8] == [ { "label" : "", "values" : np.array([4.0]) } ] | 73 assert result[8] == [ { "label" : "", "values" : np.array([4.0]) } ] |
74 | 74 |
75 def test_process_output_2ch(): | 75 def test_process_output_2ch(): |
76 plug = vh.loadPlugin(testPluginKey, rate) | 76 plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone) |
77 plug.initialise(2, 2, 2) | 77 plug.initialise(2, 2, 2) |
78 try: | 78 try: |
79 # Too few channels | 79 # Too few channels |
80 result = plug.process([[3,4]], vh.RealTime(0, 0)) | 80 result = plug.process([[3,4]], vh.RealTime(0, 0)) |
81 assert False | 81 assert False |
91 assert (result[8][0]["values"] == np.array([5.0,6.0])).all() | 91 assert (result[8][0]["values"] == np.array([5.0,6.0])).all() |
92 result = plug.process([[3,0],[4,0]], vh.RealTime(0, 0)) | 92 result = plug.process([[3,0],[4,0]], vh.RealTime(0, 0)) |
93 assert (result[8][0]["values"] == np.array([4.0,5.0])).all() | 93 assert (result[8][0]["values"] == np.array([4.0,5.0])).all() |
94 | 94 |
95 def test_process_output_3ch(): | 95 def test_process_output_3ch(): |
96 plug = vh.loadPlugin(testPluginKey, rate) | 96 plug = vh.loadPlugin(testPluginKey, rate, vh.AdaptNone) |
97 plug.initialise(3, 2, 2) | 97 plug.initialise(3, 2, 2) |
98 try: | 98 try: |
99 # Too few channels | 99 # Too few channels |
100 result = plug.process([[3,4],[5,6]], vh.RealTime(0, 0)) | 100 result = plug.process([[3,4],[5,6]], vh.RealTime(0, 0)) |
101 assert False | 101 assert False |