2 * Carla Exception Tests
3 * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #include "CarlaDefines.h"
19 #include "CarlaJuceUtils.hpp"
21 // -----------------------------------------------------------------------
24 Struct1() noexcept
: leakDetector_Struct1() {}
25 ~Struct1() noexcept
{}
32 CARLA_LEAK_DETECTOR(Struct1
)
36 Struct2() : leakDetector_Struct2() { throw 2; }
37 ~Struct2() noexcept
{}
39 CARLA_LEAK_DETECTOR(Struct2
)
42 // -----------------------------------------------------------------------
46 carla_safe_assert("test here", __FILE__
, __LINE__
);
50 Struct2
* c2
= nullptr;
54 } CARLA_SAFE_EXCEPTION("Struct1 a throw");
58 } CARLA_SAFE_EXCEPTION("NOT POSSIBLE! Struct1 b throw constructor");
60 assert(b1
!= nullptr);
64 } CARLA_SAFE_EXCEPTION("Struct1 b throw runtime");
71 } CARLA_SAFE_EXCEPTION("Struct2 c throw");
73 assert(c2
== nullptr);
78 // -----------------------------------------------------------------------