LMMS
Loading...
Searching...
No Matches
ControllerTest.h
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 ControllerTest.h - CxxTest for Params/Controller
5 Copyright (C) 2009-2011 Mark McCurry
6 Author: Mark McCurry
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of version 2 of the GNU General Public License
10 as published by the Free Software Foundation.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License (version 2 or later) for more details.
16
17 You should have received a copy of the GNU General Public License (version 2)
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21*/
22#include <cxxtest/TestSuite.h>
23#include <iostream>
25#include "../globals.h"
27
28class ControllerTest:public CxxTest::TestSuite
29{
30 public:
31 void setUp() {
32 synth = new SYNTH_T;
33 testCtl = new Controller();
34 }
35
36 void tearDown() {
37 delete testCtl;
38 delete synth;
39 }
40
41
43 //Initialize portamento
44 testCtl->setportamento(127);
45 testCtl->portamento.time = 127;
46 testCtl->initportamento(40.0f, 400.0f, false);
47 //Bounds Check
48 while(testCtl->portamento.used) {
49 TS_ASSERT((0.0f <= testCtl->portamento.x)
50 && (testCtl->portamento.x <= 1.0f));
51 TS_ASSERT((0.1f <= testCtl->portamento.freqrap)
52 && (testCtl->portamento.freqrap <= 1.0f));
53 testCtl->updateportamento();
54 }
55 TS_ASSERT((0.0f <= testCtl->portamento.x)
56 && (testCtl->portamento.x <= 1.0f));
57 TS_ASSERT((0.1f <= testCtl->portamento.freqrap)
58 && (testCtl->portamento.freqrap <= 1.0f));
59 }
60
62 testCtl->setportamento(127);
63 testCtl->portamento.time = 127;
64 testCtl->initportamento(40.0f, 400.0f, false);
65 int i;
66 for(i = 0; i < 10; ++i)
67 testCtl->updateportamento();
68 //Assert that the numbers are the same as they were at release
69 TS_ASSERT_DELTA(testCtl->portamento.x, 0.0290249f, 0.000001f)
70 TS_ASSERT_DELTA(testCtl->portamento.freqrap, 0.126122f, 0.000001f)
71 }
72
73 private:
75};
SYNTH_T * synth
Definition ControllerTest.h:26
SYNTH_T * synth
Definition LocalZynAddSubFx.cpp:47
Definition Controller.h:9
Definition ControllerTest.h:29
Controller * testCtl
Definition ControllerTest.h:74
void setUp()
Definition ControllerTest.h:31
void testPortamentoRange()
Definition ControllerTest.h:42
void tearDown()
Definition ControllerTest.h:36
void testPortamentoValue()
Definition ControllerTest.h:61
register unsigned i
Definition inflate.c:1575
Definition globals.h:204