]> sigrok.org Git - libsigrokflow.git/commitdiff
Add tests/init.cpp and first unit test.
authorUwe Hermann <redacted>
Tue, 8 Jan 2019 22:10:37 +0000 (23:10 +0100)
committerUwe Hermann <redacted>
Tue, 8 Jan 2019 23:57:10 +0000 (00:57 +0100)
Makefile.am
tests/init.cpp [new file with mode: 0644]

index 5370af1bd4ae7a3a728328bc5a9bcdb0c870194f..533813a95ea127b19fc87a5132d419ad42e397f4 100644 (file)
@@ -45,7 +45,8 @@ check_PROGRAMS = tests/main
 
 tests_main_SOURCES = \
        include/libsigrokflow/libsigrokflow.hpp \
-       tests/main.cpp
+       tests/main.cpp \
+       tests/init.cpp
 
 tests_main_LDADD = libsigrokflow.la $(LIBSIGROKFLOW_LIBS)
 
diff --git a/tests/init.cpp b/tests/init.cpp
new file mode 100644 (file)
index 0000000..18b7438
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the libsigrokflow project.
+ *
+ * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <catch2/catch.hpp>
+#include <libsigrokflow/libsigrokflow.hpp>
+
+TEST_CASE("init/deinit", "[init]")
+{
+       REQUIRE_NOTHROW(Gst::init());
+
+       SECTION("Srf::init() after successful Gst::init() should not throw") {
+               CHECK_NOTHROW(Srf::init());
+       }
+
+       REQUIRE_NOTHROW(Gst::deinit());
+}