diff options
author | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2014-10-20 18:43:38 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2014-10-20 18:43:38 +0200 |
commit | c3ccf5e3e6737f81863b085289fd830e732b41f9 (patch) | |
tree | 1818bff2d8c4323edd4b65a419b1a6b76932c2c9 /test/VersionSuite.cpp | |
parent | 886e5076c8e81fd0cdfe82dbf4a80d19e778d594 (diff) |
Imported Upstream version 0.8.1upstream/0.8.1
Diffstat (limited to 'test/VersionSuite.cpp')
-rw-r--r-- | test/VersionSuite.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/VersionSuite.cpp b/test/VersionSuite.cpp new file mode 100644 index 0000000..82deddc --- /dev/null +++ b/test/VersionSuite.cpp @@ -0,0 +1,48 @@ +/* + * uriparser - RFC 3986 URI parsing library + * + * Copyright (C) 2014, Sebastian Pipping <webmaster@hartwork.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "VersionSuite.h" + +#ifndef _GNU_SOURCE +# define _GNU_SOURCE // for asprintf +#endif +#include <stdio.h> + + +#include <config.h> // for PACKAGE_VERSION +#include <uriparser/UriBase.h> + + +void VersionSuite::ensure_version_defines_in_sync() { + char * INSIDE_VERSION = NULL; + const int bytes_printed = asprintf(&INSIDE_VERSION, "%d.%d.%d%s", + URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_ANSI); + TEST_ASSERT(bytes_printed != -1); + printf("bytes_printed: %d\n", bytes_printed); + + const bool equal = !strcmp(INSIDE_VERSION, PACKAGE_VERSION); + if (! equal) { + printf("Inside/outside version mismatch detected:\n"); + printf(" Tarball version: <%s>\n", PACKAGE_VERSION); + printf(" Header defines version: <%s>\n", INSIDE_VERSION); + } + free(INSIDE_VERSION); + TEST_ASSERT(equal); +} |