zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

XMLwrapperTest.cpp (1781B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   XMLwrapperTest.h - CxxTest for Misc/XMLwrapper
      5   Copyright (C) 2009-2009 Mark McCurry
      6   Author: Mark McCurry
      7 
      8   This program is free software; you can redistribute it and/or
      9   modify it under the terms of the GNU General Public License
     10   as published by the Free Software Foundation; either version 2
     11   of the License, or (at your option) any later version.
     12 */
     13 #include "test-suite.h"
     14 #include "../Misc/XMLwrapper.h"
     15 #include <string>
     16 #include "../globals.h"
     17 using namespace std;
     18 using namespace zyn;
     19 
     20 SYNTH_T *synth;
     21 
     22 class XMLwrapperTest
     23 {
     24     public:
     25         void setUp() {
     26             xmla = new XMLwrapper;
     27             xmlb = new XMLwrapper;
     28         }
     29 
     30 
     31         void testAddPar() {
     32             xmla->addpar("my Pa*_ramet@er", 75);
     33             TS_ASSERT_EQUAL_INT(xmla->getpar("my Pa*_ramet@er", 0, -200, 200), 75);
     34         }
     35 
     36         //here to verify that no leaks occur
     37         void testLoad() {
     38             string location = string(SOURCE_DIR) + string(
     39                 "/Tests/guitar-adnote.xmz");
     40             xmla->loadXMLfile(location);
     41         }
     42 
     43         void testAnotherLoad()
     44         {
     45             string dat =
     46                 "\n<?xml version=\"1.0f\" encoding=\"UTF-8\"?>\n\
     47 <!DOCTYPE ZynAddSubFX-data>\n\
     48 <ZynAddSubFX-data version-major=\"2\" version-minor=\"4\"\n\
     49 version-revision=\"1\" ZynAddSubFX-author=\"Nasca Octavian Paul\">\n\
     50 </ZynAddSubFX-data>\n";
     51             xmlb->putXMLdata(dat.c_str());
     52         }
     53 
     54         void tearDown() {
     55             delete xmla;
     56             delete xmlb;
     57         }
     58 
     59 
     60     private:
     61         XMLwrapper *xmla;
     62         XMLwrapper *xmlb;
     63 };
     64 
     65 int main()
     66 {
     67     XMLwrapperTest test;
     68     RUN_TEST(testAddPar);
     69     RUN_TEST(testLoad);
     70     RUN_TEST(testAnotherLoad);
     71     return test_summary();
     72 }
     73