|
Packit Service |
2781ba |
/*
|
|
Packit Service |
2781ba |
* This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
2781ba |
* it under the terms of the GNU General Public License as published by
|
|
Packit Service |
2781ba |
* the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
2781ba |
* (at your option) any later version.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
2781ba |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
2781ba |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
2781ba |
* GNU General Public License for more details.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
2781ba |
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Copyright (C) 2011 Jon Nordby <jononor@gmail.com>
|
|
Packit Service |
2781ba |
*/
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/* Common code used when testing XML serialization */
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
/* Fails assert if actual != expected and prints the two strings
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* Note: XML strings tested as literal strings.
|
|
Packit Service |
2781ba |
* Vunerable to changes in whitespace and other insigificant things.
|
|
Packit Service |
2781ba |
*
|
|
Packit Service |
2781ba |
* It would be better to use a proper xml parser and/or xpath,
|
|
Packit Service |
2781ba |
* but we don't want to have more dependencies than
|
|
Packit Service |
2781ba |
* GEGL itself, to ensure that the tests are always available. */
|
|
Packit Service |
2781ba |
static void
|
|
Packit Service |
2781ba |
assert_equivalent_xml(const gchar *actual, const gchar *expected)
|
|
Packit Service |
2781ba |
{
|
|
Packit Service |
2781ba |
gboolean equal;
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
g_assert(actual);
|
|
Packit Service |
2781ba |
g_assert(expected);
|
|
Packit Service |
2781ba |
|
|
Packit Service |
2781ba |
equal = (g_strcmp0(actual, expected) == 0);
|
|
Packit Service |
2781ba |
if (!equal) {
|
|
Packit Service |
2781ba |
g_print("\n\"%s\"\n!= (not equal)\n\"%s\"\n", actual, expected);
|
|
Packit Service |
2781ba |
}
|
|
Packit Service |
2781ba |
g_assert(equal);
|
|
Packit Service |
2781ba |
}
|