]> sigrok.org Git - libsigrokflow.git/blob - tests/init.cpp
7dbd8d54ed2b409533f47755f06ba4cae0f4fc91
[libsigrokflow.git] / tests / init.cpp
1 /*
2  * This file is part of the libsigrokflow project.
3  *
4  * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include <catch2/catch.hpp>
21 #include <libsigrokflow/libsigrokflow.hpp>
22
23 TEST_CASE("init/deinit", "[init]")
24 {
25         REQUIRE_NOTHROW(Gst::init());
26
27         SECTION("Srf::init() after successful Gst::init() should not throw") {
28                 CHECK_NOTHROW(Srf::init());
29                 SECTION("Multiple Srf::init() calls should throw") {
30                         for (int i = 0; i < 10; ++i)
31                                 CHECK_THROWS(Srf::init());
32                         CHECK_NOTHROW(Srf::deinit());
33                 }
34                 SECTION("Srf::deinit() should not throw") {
35                         CHECK_NOTHROW(Srf::deinit());
36                 }
37         }
38
39         REQUIRE_NOTHROW(Gst::deinit());
40 }