aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/DivideStringTest.hxx54
-rw-r--r--test/DumpDatabase.cxx16
-rw-r--r--test/FakeDecoderAPI.cxx9
-rw-r--r--test/FakeDecoderAPI.hxx2
-rw-r--r--test/FakeReplayGainConfig.cxx2
-rw-r--r--test/ScopeIOThread.hxx2
-rw-r--r--test/ShutdownHandler.cxx2
-rw-r--r--test/ShutdownHandler.hxx2
-rw-r--r--test/SplitStringTest.hxx65
-rw-r--r--test/TestCircularBuffer.hxx7
-rw-r--r--test/TestIcu.cxx82
-rw-r--r--test/UriUtilTest.hxx66
-rw-r--r--test/dump_playlist.cxx14
-rw-r--r--test/dump_rva2.cxx2
-rw-r--r--test/dump_text_file.cxx14
-rw-r--r--test/read_conf.cxx2
-rw-r--r--test/read_mixer.cxx12
-rw-r--r--test/read_tags.cxx12
-rw-r--r--test/run_avahi.cxx2
-rw-r--r--test/run_convert.cxx2
-rw-r--r--test/run_decoder.cxx12
-rw-r--r--test/run_encoder.cxx2
-rw-r--r--test/run_filter.cxx14
-rw-r--r--test/run_gunzip.cxx2
-rw-r--r--test/run_gzip.cxx2
-rw-r--r--test/run_inotify.cxx2
-rw-r--r--test/run_input.cxx14
-rw-r--r--test/run_neighbor_explorer.cxx2
-rw-r--r--test/run_normalize.cxx2
-rw-r--r--test/run_output.cxx12
-rw-r--r--test/run_resolver.cxx2
-rw-r--r--test/run_storage.cxx14
-rw-r--r--test/software_volume.cxx2
-rw-r--r--test/stdbin.h2
-rw-r--r--test/test_byte_reverse.cxx2
-rw-r--r--test/test_pcm_all.hxx2
-rw-r--r--test/test_pcm_channels.cxx2
-rw-r--r--test/test_pcm_dither.cxx2
-rw-r--r--test/test_pcm_export.cxx2
-rw-r--r--test/test_pcm_format.cxx2
-rw-r--r--test/test_pcm_main.cxx2
-rw-r--r--test/test_pcm_mix.cxx2
-rw-r--r--test/test_pcm_pack.cxx2
-rw-r--r--test/test_pcm_util.hxx2
-rw-r--r--test/test_pcm_volume.cxx2
-rw-r--r--test/test_util.cxx62
-rw-r--r--test/test_vorbis_encoder.cxx4
-rw-r--r--test/visit_archive.cxx14
48 files changed, 323 insertions, 232 deletions
diff --git a/test/DivideStringTest.hxx b/test/DivideStringTest.hxx
new file mode 100644
index 000000000..f6c01bdde
--- /dev/null
+++ b/test/DivideStringTest.hxx
@@ -0,0 +1,54 @@
+/*
+ * Unit tests for src/util/
+ */
+
+#include "check.h"
+#include "util/DivideString.hxx"
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <string.h>
+
+class DivideStringTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(DivideStringTest);
+ CPPUNIT_TEST(TestBasic);
+ CPPUNIT_TEST(TestEmpty);
+ CPPUNIT_TEST(TestFail);
+ CPPUNIT_TEST(TestStrip);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void TestBasic() {
+ constexpr char input[] = "foo.bar";
+ const DivideString ds(input, '.');
+ CPPUNIT_ASSERT(ds.IsDefined());
+ CPPUNIT_ASSERT(!ds.IsEmpty());
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(ds.GetFirst(), "foo"));
+ CPPUNIT_ASSERT_EQUAL(input + 4, ds.GetSecond());
+ }
+
+ void TestEmpty() {
+ constexpr char input[] = ".bar";
+ const DivideString ds(input, '.');
+ CPPUNIT_ASSERT(ds.IsDefined());
+ CPPUNIT_ASSERT(ds.IsEmpty());
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(ds.GetFirst(), ""));
+ CPPUNIT_ASSERT_EQUAL(input + 1, ds.GetSecond());
+ }
+
+ void TestFail() {
+ constexpr char input[] = "foo!bar";
+ const DivideString ds(input, '.');
+ CPPUNIT_ASSERT(!ds.IsDefined());
+ }
+
+ void TestStrip() {
+ constexpr char input[] = " foo\t.\nbar\r";
+ const DivideString ds(input, '.', true);
+ CPPUNIT_ASSERT(ds.IsDefined());
+ CPPUNIT_ASSERT(!ds.IsEmpty());
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(ds.GetFirst(), "foo"));
+ CPPUNIT_ASSERT_EQUAL(input + 7, ds.GetSecond());
+ }
+};
diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx
index 07f342319..a78a421e1 100644
--- a/test/DumpDatabase.cxx
+++ b/test/DumpDatabase.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -33,10 +33,6 @@
#include "event/Loop.hxx"
#include "util/Error.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <iostream>
using std::cout;
using std::cerr;
@@ -44,7 +40,7 @@ using std::endl;
#include <stdlib.h>
-#ifdef HAVE_LIBUPNP
+#ifdef ENABLE_UPNP
#include "input/InputStream.hxx"
size_t
InputStream::LockRead(void *, size_t, Error &)
@@ -107,14 +103,6 @@ main(int argc, char **argv)
return EXIT_FAILURE;
}
- /* initialize GLib */
-
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(nullptr);
-#endif
-#endif
-
/* initialize MPD */
config_global_init();
diff --git a/test/FakeDecoderAPI.cxx b/test/FakeDecoderAPI.cxx
index 3c7453a4f..49f7a7a5e 100644
--- a/test/FakeDecoderAPI.cxx
+++ b/test/FakeDecoderAPI.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -145,8 +145,13 @@ decoder_data(gcc_unused Decoder &decoder,
DecoderCommand
decoder_tag(gcc_unused Decoder &decoder,
gcc_unused InputStream *is,
- gcc_unused Tag &&tag)
+ Tag &&tag)
{
+ fprintf(stderr, "TAG: duration=%f\n", tag.duration.ToDoubleS());
+
+ for (const auto &i : tag)
+ fprintf(stderr, " %s=%s\n", tag_item_names[i.type], i.value);
+
return DecoderCommand::NONE;
}
diff --git a/test/FakeDecoderAPI.hxx b/test/FakeDecoderAPI.hxx
index 6f1933977..20bdee799 100644
--- a/test/FakeDecoderAPI.hxx
+++ b/test/FakeDecoderAPI.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/FakeReplayGainConfig.cxx b/test/FakeReplayGainConfig.cxx
index 0cb282050..a95f3e888 100644
--- a/test/FakeReplayGainConfig.cxx
+++ b/test/FakeReplayGainConfig.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/ScopeIOThread.hxx b/test/ScopeIOThread.hxx
index 06d27a4b8..1eb16912f 100644
--- a/test/ScopeIOThread.hxx
+++ b/test/ScopeIOThread.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/ShutdownHandler.cxx b/test/ShutdownHandler.cxx
index c04834444..b55b9ff6a 100644
--- a/test/ShutdownHandler.cxx
+++ b/test/ShutdownHandler.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/ShutdownHandler.hxx b/test/ShutdownHandler.hxx
index 9db88a1b4..e808bbeb1 100644
--- a/test/ShutdownHandler.hxx
+++ b/test/ShutdownHandler.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/SplitStringTest.hxx b/test/SplitStringTest.hxx
new file mode 100644
index 000000000..87ed385ea
--- /dev/null
+++ b/test/SplitStringTest.hxx
@@ -0,0 +1,65 @@
+/*
+ * Unit tests for src/util/
+ */
+
+#include "check.h"
+#include "util/SplitString.hxx"
+#include "util/Macros.hxx"
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <string.h>
+
+class SplitStringTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(SplitStringTest);
+ CPPUNIT_TEST(TestBasic);
+ CPPUNIT_TEST(TestStrip);
+ CPPUNIT_TEST(TestNoStrip);
+ CPPUNIT_TEST(TestEmpty);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void TestBasic() {
+ constexpr char input[] = "foo.bar";
+ const char *const output[] = { "foo", "bar" };
+ size_t i = 0;
+ for (auto p : SplitString(input, '.')) {
+ CPPUNIT_ASSERT(i < ARRAY_SIZE(output));
+ CPPUNIT_ASSERT(p == output[i]);
+ ++i;
+ }
+
+ CPPUNIT_ASSERT_EQUAL(ARRAY_SIZE(output), i);
+ }
+
+ void TestStrip() {
+ constexpr char input[] = " foo\t.\r\nbar\r\n2";
+ const char *const output[] = { "foo", "bar\r\n2" };
+ size_t i = 0;
+ for (auto p : SplitString(input, '.')) {
+ CPPUNIT_ASSERT(i < ARRAY_SIZE(output));
+ CPPUNIT_ASSERT(p == output[i]);
+ ++i;
+ }
+
+ CPPUNIT_ASSERT_EQUAL(ARRAY_SIZE(output), i);
+ }
+
+ void TestNoStrip() {
+ constexpr char input[] = " foo\t.\r\nbar\r\n2";
+ const char *const output[] = { " foo\t", "\r\nbar\r\n2" };
+ size_t i = 0;
+ for (auto p : SplitString(input, '.', false)) {
+ CPPUNIT_ASSERT(i < ARRAY_SIZE(output));
+ CPPUNIT_ASSERT(p == output[i]);
+ ++i;
+ }
+
+ CPPUNIT_ASSERT_EQUAL(ARRAY_SIZE(output), i);
+ }
+
+ void TestEmpty() {
+ CPPUNIT_ASSERT(SplitString("", '.').empty());
+ }
+};
diff --git a/test/TestCircularBuffer.hxx b/test/TestCircularBuffer.hxx
index c808d85dc..4283be45b 100644
--- a/test/TestCircularBuffer.hxx
+++ b/test/TestCircularBuffer.hxx
@@ -2,17 +2,12 @@
* Unit tests for class CircularBuffer.
*/
-#include "config.h"
+#include "check.h"
#include "util/CircularBuffer.hxx"
#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
-#include <string.h>
-#include <stdlib.h>
-
class TestCircularBuffer : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(TestCircularBuffer);
CPPUNIT_TEST(TestIt);
diff --git a/test/TestIcu.cxx b/test/TestIcu.cxx
new file mode 100644
index 000000000..9d525d698
--- /dev/null
+++ b/test/TestIcu.cxx
@@ -0,0 +1,82 @@
+/*
+ * Unit tests for src/util/
+ */
+
+#include "config.h"
+#include "lib/icu/Converter.hxx"
+#include "util/Error.hxx"
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef HAVE_ICU_CONVERTER
+
+static const char *const invalid_utf8[] = {
+ "\xfc",
+};
+
+struct StringPair {
+ const char *utf8, *other;
+};
+
+static constexpr StringPair latin1_tests[] = {
+ { "foo", "foo" },
+ { "\xc3\xbc", "\xfc" },
+};
+
+class TestIcuConverter : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(TestIcuConverter);
+ CPPUNIT_TEST(TestInvalidCharset);
+ CPPUNIT_TEST(TestLatin1);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void TestInvalidCharset() {
+ CPPUNIT_ASSERT_EQUAL((IcuConverter *)nullptr,
+ IcuConverter::Create("doesntexist",
+ IgnoreError()));
+ }
+
+ void TestLatin1() {
+ IcuConverter *const converter =
+ IcuConverter::Create("iso-8859-1", IgnoreError());
+ CPPUNIT_ASSERT(converter != nullptr);
+
+ for (const auto i : invalid_utf8) {
+ auto f = converter->FromUTF8(i);
+ CPPUNIT_ASSERT_EQUAL(true, f.empty());
+ }
+
+ for (const auto i : latin1_tests) {
+ auto f = converter->FromUTF8(i.utf8);
+ CPPUNIT_ASSERT_EQUAL(true, f == i.other);
+
+ auto t = converter->ToUTF8(i.other);
+ CPPUNIT_ASSERT_EQUAL(true, t == i.utf8);
+ }
+
+ delete converter;
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TestIcuConverter);
+
+#endif
+
+int
+main(gcc_unused int argc, gcc_unused char **argv)
+{
+#ifdef HAVE_ICU_CONVERTER
+ CppUnit::TextUi::TestRunner runner;
+ auto &registry = CppUnit::TestFactoryRegistry::getRegistry();
+ runner.addTest(registry.makeTest());
+ return runner.run() ? EXIT_SUCCESS : EXIT_FAILURE;
+#else
+ return EXIT_SUCCESS;
+#endif
+}
diff --git a/test/UriUtilTest.hxx b/test/UriUtilTest.hxx
new file mode 100644
index 000000000..07f52a475
--- /dev/null
+++ b/test/UriUtilTest.hxx
@@ -0,0 +1,66 @@
+/*
+ * Unit tests for src/util/
+ */
+
+#include "check.h"
+#include "util/UriUtil.hxx"
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <string.h>
+
+class UriUtilTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(UriUtilTest);
+ CPPUNIT_TEST(TestSuffix);
+ CPPUNIT_TEST(TestRemoveAuth);
+ CPPUNIT_TEST_SUITE_END();
+
+public:
+ void TestSuffix() {
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix("/foo/bar"));
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix("/foo.jpg/bar"));
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg"),
+ "jpg"));
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo.png/bar.jpg"),
+ "jpg"));
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix(".jpg"));
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix("/foo/.jpg"));
+
+ /* the first overload does not eliminate the query
+ string */
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg?query_string"),
+ "jpg?query_string"));
+
+ /* ... but the second one does */
+ UriSuffixBuffer buffer;
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg?query_string",
+ buffer),
+ "jpg"));
+
+ /* repeat some of the above tests with the second overload */
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix("/foo/bar", buffer));
+ CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
+ uri_get_suffix("/foo.jpg/bar", buffer));
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg", buffer),
+ "jpg"));
+ }
+
+ void TestRemoveAuth() {
+ CPPUNIT_ASSERT_EQUAL(std::string(),
+ uri_remove_auth("http://www.example.com/"));
+ CPPUNIT_ASSERT_EQUAL(std::string("http://www.example.com/"),
+ uri_remove_auth("http://foo:bar@www.example.com/"));
+ CPPUNIT_ASSERT_EQUAL(std::string("http://www.example.com/"),
+ uri_remove_auth("http://foo@www.example.com/"));
+ CPPUNIT_ASSERT_EQUAL(std::string(),
+ uri_remove_auth("http://www.example.com/f:oo@bar"));
+ CPPUNIT_ASSERT_EQUAL(std::string("ftp://ftp.example.com/"),
+ uri_remove_auth("ftp://foo:bar@ftp.example.com/"));
+ }
+};
diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx
index 0047ef427..4a21e2df5 100644
--- a/test/dump_playlist.cxx
+++ b/test/dump_playlist.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -35,10 +35,6 @@
#include "thread/Cond.hxx"
#include "Log.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <unistd.h>
#include <stdlib.h>
@@ -64,14 +60,6 @@ int main(int argc, char **argv)
const Path config_path = Path::FromFS(argv[1]);
uri = argv[2];
- /* initialize GLib */
-
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
/* initialize MPD */
config_global_init();
diff --git a/test/dump_rva2.cxx b/test/dump_rva2.cxx
index fd46ee36c..fff0aa044 100644
--- a/test/dump_rva2.cxx
+++ b/test/dump_rva2.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx
index 5bfd316a5..686adb744 100644
--- a/test/dump_text_file.cxx
+++ b/test/dump_text_file.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -32,10 +32,6 @@
#include "archive/ArchiveList.hxx"
#endif
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -79,14 +75,6 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- /* initialize GLib */
-
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
/* initialize MPD */
config_global_init();
diff --git a/test/read_conf.cxx b/test/read_conf.cxx
index 42afdfb4b..494fd4cd4 100644
--- a/test/read_conf.cxx
+++ b/test/read_conf.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/read_mixer.cxx b/test/read_mixer.cxx
index de77a00c4..791816c08 100644
--- a/test/read_mixer.cxx
+++ b/test/read_mixer.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -28,10 +28,6 @@
#include "util/Error.hxx"
#include "Log.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <assert.h>
#include <string.h>
#include <unistd.h>
@@ -52,12 +48,6 @@ int main(int argc, gcc_unused char **argv)
return EXIT_FAILURE;
}
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
EventLoop event_loop;
Error error;
diff --git a/test/read_tags.cxx b/test/read_tags.cxx
index 91ac9c674..a00e87529 100644
--- a/test/read_tags.cxx
+++ b/test/read_tags.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -32,10 +32,6 @@
#include "thread/Cond.hxx"
#include "Log.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
@@ -90,12 +86,6 @@ int main(int argc, char **argv)
decoder_name = argv[1];
const Path path = Path::FromFS(argv[2]);
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
const ScopeIOThread io_thread;
Error error;
diff --git a/test/run_avahi.cxx b/test/run_avahi.cxx
index b3b20365c..5c1c77d27 100644
--- a/test/run_avahi.cxx
+++ b/test/run_avahi.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_convert.cxx b/test/run_convert.cxx
index 8b9b15cf0..7673c25ca 100644
--- a/test/run_convert.cxx
+++ b/test/run_convert.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx
index 0e9af6a1a..ebebc1188 100644
--- a/test/run_decoder.cxx
+++ b/test/run_decoder.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -30,10 +30,6 @@
#include "Log.hxx"
#include "stdbin.h"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
@@ -50,12 +46,6 @@ int main(int argc, char **argv)
const char *const decoder_name = argv[1];
const char *const uri = argv[2];
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
const ScopeIOThread io_thread;
Error error;
diff --git a/test/run_encoder.cxx b/test/run_encoder.cxx
index f16d8cb0a..e48bbfc9e 100644
--- a/test/run_encoder.cxx
+++ b/test/run_encoder.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index ab99c9a1e..46357b597 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -33,10 +33,6 @@
#include "system/FatalError.hxx"
#include "Log.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -86,14 +82,6 @@ int main(int argc, char **argv)
AudioFormat audio_format(44100, SampleFormat::S16, 2);
- /* initialize GLib */
-
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
/* read configuration file (mpd.conf) */
config_global_init();
diff --git a/test/run_gunzip.cxx b/test/run_gunzip.cxx
index 51bdb532e..7ea70678a 100644
--- a/test/run_gunzip.cxx
+++ b/test/run_gunzip.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_gzip.cxx b/test/run_gzip.cxx
index c52b32ac7..15b769f0a 100644
--- a/test/run_gzip.cxx
+++ b/test/run_gzip.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_inotify.cxx b/test/run_inotify.cxx
index df4046356..ae4f196f8 100644
--- a/test/run_inotify.cxx
+++ b/test/run_inotify.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_input.cxx b/test/run_input.cxx
index 6864a5d64..9cce593ef 100644
--- a/test/run_input.cxx
+++ b/test/run_input.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -35,10 +35,6 @@
#include "archive/ArchiveList.hxx"
#endif
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <unistd.h>
#include <stdlib.h>
@@ -105,14 +101,6 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- /* initialize GLib */
-
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
/* initialize MPD */
config_global_init();
diff --git a/test/run_neighbor_explorer.cxx b/test/run_neighbor_explorer.cxx
index c79948d6e..29582fc55 100644
--- a/test/run_neighbor_explorer.cxx
+++ b/test/run_neighbor_explorer.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_normalize.cxx b/test/run_normalize.cxx
index 9a361b790..881ff4696 100644
--- a/test/run_normalize.cxx
+++ b/test/run_normalize.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_output.cxx b/test/run_output.cxx
index 345127556..de0aae306 100644
--- a/test/run_output.cxx
+++ b/test/run_output.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -36,10 +36,6 @@
#include "util/Error.hxx"
#include "Log.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <assert.h>
#include <string.h>
#include <unistd.h>
@@ -163,12 +159,6 @@ int main(int argc, char **argv)
AudioFormat audio_format(44100, SampleFormat::S16, 2);
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
/* read configuration file (mpd.conf) */
config_global_init();
diff --git a/test/run_resolver.cxx b/test/run_resolver.cxx
index 71cadbeec..284f50d7b 100644
--- a/test/run_resolver.cxx
+++ b/test/run_resolver.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/run_storage.cxx b/test/run_storage.cxx
index 9fc6e6e76..302dd566b 100644
--- a/test/run_storage.cxx
+++ b/test/run_storage.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,10 +24,6 @@
#include "storage/FileInfo.hxx"
#include "util/Error.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <memory>
#include <unistd.h>
@@ -102,14 +98,6 @@ main(int argc, char **argv)
return EXIT_FAILURE;
}
- /* initialize GLib */
-
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
const char *const command = argv[1];
const char *const storage_uri = argv[2];
diff --git a/test/software_volume.cxx b/test/software_volume.cxx
index 1e41f95fd..7aa89ec0c 100644
--- a/test/software_volume.cxx
+++ b/test/software_volume.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/stdbin.h b/test/stdbin.h
index 8b5502e6f..d69bbb4ee 100644
--- a/test/stdbin.h
+++ b/test/stdbin.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_byte_reverse.cxx b/test/test_byte_reverse.cxx
index 0ab97e4d1..a57753e38 100644
--- a/test/test_byte_reverse.cxx
+++ b/test/test_byte_reverse.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_all.hxx b/test/test_pcm_all.hxx
index 7cdd8b63f..b97b20b69 100644
--- a/test/test_pcm_all.hxx
+++ b/test/test_pcm_all.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_channels.cxx b/test/test_pcm_channels.cxx
index 748a76351..fa6aa32da 100644
--- a/test/test_pcm_channels.cxx
+++ b/test/test_pcm_channels.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_dither.cxx b/test/test_pcm_dither.cxx
index 09a2b5cf9..f1a375f6c 100644
--- a/test/test_pcm_dither.cxx
+++ b/test/test_pcm_dither.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_export.cxx b/test/test_pcm_export.cxx
index 410e64e4d..347e2394a 100644
--- a/test/test_pcm_export.cxx
+++ b/test/test_pcm_export.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_format.cxx b/test/test_pcm_format.cxx
index 825a8bd84..ac9e47240 100644
--- a/test/test_pcm_format.cxx
+++ b/test/test_pcm_format.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_main.cxx b/test/test_pcm_main.cxx
index 0e397a15c..d8861a370 100644
--- a/test/test_pcm_main.cxx
+++ b/test/test_pcm_main.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_mix.cxx b/test/test_pcm_mix.cxx
index 973b58f4d..9abe476fa 100644
--- a/test/test_pcm_mix.cxx
+++ b/test/test_pcm_mix.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_pack.cxx b/test/test_pcm_pack.cxx
index fff3e10f0..20732f0b6 100644
--- a/test/test_pcm_pack.cxx
+++ b/test/test_pcm_pack.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_util.hxx b/test/test_pcm_util.hxx
index f1efbc666..7fc1db5e5 100644
--- a/test/test_pcm_util.hxx
+++ b/test/test_pcm_util.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_pcm_volume.cxx b/test/test_pcm_volume.cxx
index 2d908f6c1..55b54244c 100644
--- a/test/test_pcm_volume.cxx
+++ b/test/test_pcm_volume.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/test/test_util.cxx b/test/test_util.cxx
index 3e79aeca0..c2d73d7d9 100644
--- a/test/test_util.cxx
+++ b/test/test_util.cxx
@@ -3,7 +3,9 @@
*/
#include "config.h"
-#include "util/UriUtil.hxx"
+#include "DivideStringTest.hxx"
+#include "SplitStringTest.hxx"
+#include "UriUtilTest.hxx"
#include "TestCircularBuffer.hxx"
#include <cppunit/TestFixture.h>
@@ -11,64 +13,10 @@
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
-#include <string.h>
#include <stdlib.h>
-class UriUtilTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(UriUtilTest);
- CPPUNIT_TEST(TestSuffix);
- CPPUNIT_TEST(TestRemoveAuth);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- void TestSuffix() {
- CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
- uri_get_suffix("/foo/bar"));
- CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
- uri_get_suffix("/foo.jpg/bar"));
- CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg"),
- "jpg"));
- CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo.png/bar.jpg"),
- "jpg"));
- CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
- uri_get_suffix(".jpg"));
- CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
- uri_get_suffix("/foo/.jpg"));
-
- /* the first overload does not eliminate the query
- string */
- CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg?query_string"),
- "jpg?query_string"));
-
- /* ... but the second one does */
- UriSuffixBuffer buffer;
- CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg?query_string",
- buffer),
- "jpg"));
-
- /* repeat some of the above tests with the second overload */
- CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
- uri_get_suffix("/foo/bar", buffer));
- CPPUNIT_ASSERT_EQUAL((const char *)nullptr,
- uri_get_suffix("/foo.jpg/bar", buffer));
- CPPUNIT_ASSERT_EQUAL(0, strcmp(uri_get_suffix("/foo/bar.jpg", buffer),
- "jpg"));
- }
-
- void TestRemoveAuth() {
- CPPUNIT_ASSERT_EQUAL(std::string(),
- uri_remove_auth("http://www.example.com/"));
- CPPUNIT_ASSERT_EQUAL(std::string("http://www.example.com/"),
- uri_remove_auth("http://foo:bar@www.example.com/"));
- CPPUNIT_ASSERT_EQUAL(std::string("http://www.example.com/"),
- uri_remove_auth("http://foo@www.example.com/"));
- CPPUNIT_ASSERT_EQUAL(std::string(),
- uri_remove_auth("http://www.example.com/f:oo@bar"));
- CPPUNIT_ASSERT_EQUAL(std::string("ftp://ftp.example.com/"),
- uri_remove_auth("ftp://foo:bar@ftp.example.com/"));
- }
-};
-
+CPPUNIT_TEST_SUITE_REGISTRATION(DivideStringTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(SplitStringTest);
CPPUNIT_TEST_SUITE_REGISTRATION(UriUtilTest);
CPPUNIT_TEST_SUITE_REGISTRATION(TestCircularBuffer);
diff --git a/test/test_vorbis_encoder.cxx b/test/test_vorbis_encoder.cxx
index 59b901da2..e716b8536 100644
--- a/test/test_vorbis_encoder.cxx
+++ b/test/test_vorbis_encoder.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -90,7 +90,7 @@ main(gcc_unused int argc, gcc_unused char **argv)
tag_builder.Commit(tag);
}
- success = encoder_tag(encoder, &tag, IgnoreError());
+ success = encoder_tag(encoder, tag, IgnoreError());
assert(success);
encoder_to_stdout(*encoder);
diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx
index 1ff3ba484..5e8634def 100644
--- a/test/visit_archive.cxx
+++ b/test/visit_archive.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -30,10 +30,6 @@
#include "fs/Path.hxx"
#include "util/Error.hxx"
-#ifdef HAVE_GLIB
-#include <glib.h>
-#endif
-
#include <unistd.h>
#include <stdlib.h>
@@ -57,14 +53,6 @@ main(int argc, char **argv)
const char *plugin_name = argv[1];
const Path path = Path::FromFS(argv[2]);
- /* initialize GLib */
-
-#ifdef HAVE_GLIB
-#if !GLIB_CHECK_VERSION(2,32,0)
- g_thread_init(NULL);
-#endif
-#endif
-
/* initialize MPD */
config_global_init();