2 * This file is part of the libsigrokflow project.
4 * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de>
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.
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.
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/>.
20 #include <catch2/catch.hpp>
21 #include <libsigrokflow/libsigrokflow.hpp>
23 TEST_CASE("init/deinit", "[init]")
25 SECTION("Srf::init() before successful Gst::init() should throw") {
26 CHECK_THROWS(Srf::init());
29 REQUIRE_NOTHROW(Gst::init());
31 SECTION("Srf::init() after successful Gst::init() should not throw") {
32 CHECK_NOTHROW(Srf::init());
33 SECTION("Multiple Srf::init() calls should throw") {
34 for (int i = 0; i < 10; ++i)
35 CHECK_THROWS(Srf::init());
36 CHECK_NOTHROW(Srf::deinit());
38 SECTION("Srf::deinit() should not throw") {
39 CHECK_NOTHROW(Srf::deinit());
41 SECTION("Multiple Srf::deinit() calls should throw") {
42 CHECK_NOTHROW(Srf::deinit());
43 for (int i = 0; i < 10; ++i)
44 CHECK_THROWS(Srf::deinit());
48 REQUIRE_NOTHROW(Gst::deinit());