1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#include "unit/TestRunner.h"
#include "plugin/PluginPreset.h"
#include "PluginMock.h"
const char *TEST_PRESET_FILENAME = "test.fxp";
static int _testGuessPluginPresetType(void)
{
CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
PluginPreset p = pluginPresetFactory(c);
assertIntEquals(PRESET_TYPE_FXP, p->presetType);
freePluginPreset(p);
freeCharString(c);
return 0;
}
static int _testGuessPluginPresetTypeInvalid(void)
{
CharString c = newCharStringWithCString("invalid");
PluginPreset p = pluginPresetFactory(c);
assertIsNull(p);
freePluginPreset(p);
freeCharString(c);
return 0;
}
static int _testNewObject(void)
{
CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
PluginPreset p = pluginPresetFactory(c);
assertIntEquals(p->presetType, PRESET_TYPE_FXP);
assertCharStringEquals(TEST_PRESET_FILENAME, p->presetName);
freePluginPreset(p);
freeCharString(c);
return 0;
}
static int _testIsPresetCompatibleWithPlugin(void)
{
CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
PluginPreset p = pluginPresetFactory(c);
Plugin mockPlugin = newPluginMock();
pluginPresetSetCompatibleWith(p, PLUGIN_TYPE_INTERNAL);
assert(pluginPresetIsCompatibleWith(p, mockPlugin));
freePlugin(mockPlugin);
freeCharString(c);
freePluginPreset(p);
return 0;
}
static int _testIsPresetNotCompatibleWithPlugin(void)
{
CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
PluginPreset p = pluginPresetFactory(c);
Plugin mockPlugin = newPluginMock();
pluginPresetSetCompatibleWith(p, PLUGIN_TYPE_VST_2X);
assertFalse(pluginPresetIsCompatibleWith(p, mockPlugin));
freePlugin(mockPlugin);
freeCharString(c);
freePluginPreset(p);
return 0;
}
TestSuite addPluginPresetTests(void);
TestSuite addPluginPresetTests(void)
{
TestSuite testSuite = newTestSuite("PluginPreset", NULL, NULL);
addTest(testSuite, "GuessPluginPresetType", _testGuessPluginPresetType);
addTest(testSuite, "GuessPluginPresetTypeInvalid", _testGuessPluginPresetTypeInvalid);
addTest(testSuite, "NewObject", _testNewObject);
addTest(testSuite, "IsPresetCompatibleWithPlugin", _testIsPresetCompatibleWithPlugin);
addTest(testSuite, "IsPresetNotCompatibleWithPlugin", _testIsPresetNotCompatibleWithPlugin);
return testSuite;
}
|