File: server_test.cpp

package info (click to toggle)
supercollider 1%3A3.10.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 45,496 kB
  • sloc: cpp: 283,513; lisp: 74,040; ansic: 72,252; sh: 23,016; python: 7,175; makefile: 1,087; perl: 766; java: 677; yacc: 314; lex: 175; ruby: 136; objc: 65; xml: 15
file content (90 lines) | stat: -rw-r--r-- 2,119 bytes parent folder | download | duplicates (2)
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
79
80
81
82
83
84
85
86
87
88
89
90
#include <boost/test/unit_test.hpp>

#include "server/server.hpp"
#include "server/server_args.hpp"

#include "test_synth.hpp"

using namespace nova;
using namespace boost;


namespace
{
struct test_synth_definition:
    public synth_definition
{
    test_synth_definition(void):
        synth_definition(symbol("foo"))
    {}

    abstract_synth * create_instance(int node_id)
    {
        return new test_synth(node_id, this);
    }
};
}


BOOST_AUTO_TEST_CASE( server_test_1 )
{
    rt_pool.init(1024 * 1024);

    {
        nova_server server(server_arguments::initialize(0, 0));
        rt_pool.init(1024*1024);

        server.synth_factory::register_definition(new test_synth_definition());

        node_position_constraint to_root = std::make_pair(server.root_group(), insert);

        abstract_synth * s = server.add_synth("foo", 1, to_root);
        server.free_node(s);
    }

    instance = 0;
}

BOOST_AUTO_TEST_CASE( server_test_2 )
{
    {
        nova_server server(server_arguments::initialize(0, 0));
        server.synth_factory::register_definition(new test_synth_definition());

        node_position_constraint to_root = std::make_pair(server.root_group(), insert);

        abstract_synth * s = server.add_synth("foo", 1, to_root);
        server.tick();
        server.tick();
        server.tick();
        server.free_node(s);
    }

    instance = 0;
}

BOOST_AUTO_TEST_CASE( server_test_3 )
{
    {
        nova_server server(server_arguments::initialize(0, 0));
        server.synth_factory::register_definition(new test_synth_definition());

        parallel_group * g = new parallel_group(1);

        server.add_node(g);

        node_position_constraint to_group = std::make_pair(g, insert);

        abstract_synth * s1 = server.add_synth("foo", 2, to_group);
        abstract_synth * s2 = server.add_synth("foo", 3, to_group);
        abstract_synth * s3 = server.add_synth("foo", 4, to_group);
        server.tick();
        server.tick();
        server.tick();
        server.free_node(s1);
        server.free_node(s2);
        server.free_node(s3);
    }

    instance = 0;
}