...
authoralex <[email protected]>
Sun, 6 Feb 2022 07:35:29 +0000 (23:35 -0800)
committeralex <[email protected]>
Sun, 6 Feb 2022 07:35:29 +0000 (23:35 -0800)
test/unit/Makefile.am
test/unit/feed.tests.c
test/unit/opt.tests.c
test/unit/session.tests.c
test/unit/torrent.tests.c

index 17fb5313bcb7580555de96adb958f7f0ddc4a1ea..83cb82f2ac5211975a05097c8aeb673e01672227 100644 (file)
@@ -30,12 +30,11 @@ torrent_SOURCES = \
        $(top_srcdir)/src/file.c \
        $(top_srcdir)/src/hashmap.c \
        $(top_srcdir)/src/torrent/add.c \
-       $(top_srcdir)/src/torrent/file.c \
        $(top_srcdir)/src/torrent/free.c \
        $(top_srcdir)/src/torrent/init.c \
+       $(top_srcdir)/src/torrent/info.c \
        $(top_srcdir)/src/torrent/infohash.c \
        $(top_srcdir)/src/torrent/magnet.c \
-       $(top_srcdir)/src/torrent/path.c \
        $(top_srcdir)/src/torrent/piece.c \
        $(top_srcdir)/src/torrent/remove.c \
        $(top_srcdir)/src/tree.c
@@ -67,12 +66,15 @@ feed_tests_SOURCES = \
        $(top_srcdir)/src/rss/footer.c \
        $(top_srcdir)/src/rss/header.c \
        $(top_srcdir)/src/rss/info.c \
-       $(top_srcdir)/src/rss/init.c
+       $(top_srcdir)/src/rss/init.c \
+       $(top_srcdir)/src/torrent/file.c \
+       $(top_srcdir)/src/torrent/path.c
 
+# feed/gen.c requires overwriting of FEED_DIRECTORY for testing
+# feed/path.c requires overwriting of FEED_DIRECTORY for testing
 feed_tests_CPPFLAGS = $(AM_CPPFLAGS) \
        -DFEED_GEN_SRC_FILE="$(top_srcdir)/src/feed/gen.c" \
-       -DFEED_PATH_SRC_FILE="$(top_srcdir)/src/feed/path.c" \
-       -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c"
+       -DFEED_PATH_SRC_FILE="$(top_srcdir)/src/feed/path.c"
 
 file_tests_SOURCES = \
        $(common_SOURCES) \
@@ -110,6 +112,7 @@ meta_tests_SOURCES = \
        $(top_srcdir)/src/rss/free.c \
        $(top_srcdir)/src/rss/init.c
 
+# src/meta.c requires strptime dummy function defined in meta.tests.c
 meta_tests_CPPFLAGS = $(AM_CPPFLAGS) \
        -DMETA_SRC_FILE="$(top_srcdir)/src/meta.c"
 
@@ -135,9 +138,6 @@ opt_tests_SOURCES = \
        $(top_srcdir)/src/opt/worker.c \
        $(top_srcdir)/src/session.c
 
-opt_tests_CPPFLAGS = $(AM_CPPFLAGS) \
-       -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c"
-
 rss_tests_SOURCES = \
        $(common_SOURCES) \
        rss.tests.c \
@@ -158,9 +158,6 @@ session_tests_SOURCES = \
        $(top_srcdir)/src/hash.c \
        $(top_srcdir)/src/session.c
 
-session_tests_CPPFLAGS = $(AM_CPPFLAGS) \
-       -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c"
-
 torrent_tests_SOURCES = \
        $(common_SOURCES) \
        $(torrent_SOURCES) \
@@ -169,8 +166,11 @@ torrent_tests_SOURCES = \
        $(top_srcdir)/src/fs/dir.c \
        $(top_srcdir)/src/hash.c
 
+# src/torrent/file.c requires TORRENT_FILE_DIRECTORY to be overwritten for testing
+# src/torrent/path.c requires TORRENT_FILE_DIRECTORY to be overwritten for testing
 torrent_tests_CPPFLAGS = $(AM_CPPFLAGS) \
-       -DTORRENT_INFO_SRC_FILE="$(top_srcdir)/src/torrent/info.c"
+       -DTORRENT_FILE_SRC_FILE="$(top_srcdir)/src/torrent/file.c" \
+       -DTORRENT_PATH_SRC_FILE="$(top_srcdir)/src/torrent/path.c"
 
 tree_tests_SOURCES = \
        $(common_SOURCES) \
index 278218ff3c7bf8298ca18085a595c4bcd235ebd9..9d3dc6b113d2aec24534d9f8a7c388d5285ca622 100644 (file)
@@ -4,7 +4,6 @@
 
 #include INCLUDE(FEED_PATH_SRC_FILE)
 #include INCLUDE(FEED_GEN_SRC_FILE)
-#include INCLUDE(TORRENT_INFO_SRC_FILE)
 
 int main();
 static void feed_entries_basic_test();
index 8de1d2441a951d4e467a0563865b81980000daaa..3b8e4da2173b52ca34715f2620729abe7bde40d3 100644 (file)
@@ -2,8 +2,6 @@
 
 #include<opt.h>
 
-#include INCLUDE(TORRENT_INFO_SRC_FILE)
-
 pthread_t logging_thread;
 pthread_mutex_t logging_mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -78,6 +76,7 @@ static void opt_add_watch_basic_test() {
        assert(-1==opt_add_watch("notarealexistingdirectorylksdjflkajsdfklajsklf"));
        
        opt_set_log_level(LOG_LEVEL_SILENT);
+       assert(1==session_init());
        assert(1==opt_add_watch(TEST_DIRECTORY));
 
        assert(1==defaults());
index 55bb859f41ad2d52d4d58437f69d6ba9e2a967df..1065ad07cfdff5a26821f78059db67d9c6394681 100644 (file)
@@ -2,8 +2,6 @@
 
 #include<session.h>
 
-#include INCLUDE(TORRENT_INFO_SRC_FILE)
-
 int main();
 static void session_init_basic_test();
 static void session_torrent_add_basic_test();
index 7be05b49a95731429df3018c475210aadd2b2fda..9fc62dbed80e8242b416fc8ff5fa7ad0be347b02 100644 (file)
@@ -2,7 +2,8 @@
 
 #include<torrent.h>
 
-#include INCLUDE(TORRENT_INFO_SRC_FILE)
+#include INCLUDE(TORRENT_FILE_SRC_FILE)
+#include INCLUDE(TORRENT_PATH_SRC_FILE)
 
 int main();
 static void torrent_add_basic_test();