gplate/gplate

Add a meson build system

14 months ago, Gary Kramlich
1f5081f3c6b5
Parents fdd90f62dd23
Children 731a7f64ad4f
Add a meson build system

The unit tests are currently broken and i'm not sure how they're working under
cmake right now, but I'll figure that out later.
  • +2 -24
    .hgignore
  • +38 -0
    gplate/gplate.h.in
  • +147 -0
    gplate/meson.build
  • +38 -0
    gplate/reference/gplate.toml.in
  • +31 -0
    gplate/reference/meson.build
  • +8 -0
    gplate/reference/urlmap.js
  • +5 -0
    gplate/resources/gplate.gresource.xml
  • +29 -0
    gplate/tests/CMakeLists.txt
  • +15 -0
    gplate/tests/functions/CMakeLists.txt
  • +181 -0
    gplate/tests/functions/test-gplate-for-function.c
  • +29 -0
    gplate/tests/functions/test-gplate-functions.c
  • +36 -0
    gplate/tests/functions/test-gplate-functions.h
  • +132 -0
    gplate/tests/functions/test-gplate-include-function.c
  • +14 -0
    gplate/tests/meson.build
  • +16 -0
    gplate/tests/tags/CMakeLists.txt
  • +74 -0
    gplate/tests/tags/test-gplate-comment-tag.c
  • +73 -0
    gplate/tests/tags/test-gplate-tag.c
  • +58 -0
    gplate/tests/tags/test-gplate-tag.h
  • +63 -0
    gplate/tests/tags/test-gplate-text-tag.c
  • +232 -0
    gplate/tests/tags/test-gplate-variable-tag.c
  • +2 -0
    gplate/tests/templates/footer.gplate
  • +5 -0
    gplate/tests/templates/header.gplate
  • +1 -0
    gplate/tests/templates/html.gplate
  • +1 -0
    gplate/tests/templates/simple-include.gplate
  • +4 -0
    gplate/tests/templates/simple.gplate
  • +29 -0
    gplate/tests/test-collection.c
  • +255 -0
    gplate/tests/test-dictionary-variable.c
  • +179 -0
    gplate/tests/test-file-variable.c
  • +35 -0
    gplate/tests/test-gplate-collection-interface.c
  • +60 -0
    gplate/tests/test-gplate-utility-functions.c
  • +39 -0
    gplate/tests/test-gplate.c
  • +13 -0
    gplate/tests/variables/CMakeLists.txt
  • +112 -0
    gplate/tests/variables/test-gplate-variables.c
  • +30 -0
    gplate/tests/variables/test-gplate-variables.h
  • +79 -0
    meson.build
  • +5 -0
    meson_options.txt
  • +5 -0
    subprojects/gi-docgen.wrap
  • +0 -29
    tests/CMakeLists.txt
  • +0 -15
    tests/functions/CMakeLists.txt
  • +0 -181
    tests/functions/test-gplate-for-function.c
  • +0 -29
    tests/functions/test-gplate-functions.c
  • +0 -36
    tests/functions/test-gplate-functions.h
  • +0 -132
    tests/functions/test-gplate-include-function.c
  • +0 -16
    tests/tags/CMakeLists.txt
  • +0 -74
    tests/tags/test-gplate-comment-tag.c
  • +0 -73
    tests/tags/test-gplate-tag.c
  • +0 -58
    tests/tags/test-gplate-tag.h
  • +0 -63
    tests/tags/test-gplate-text-tag.c
  • +0 -232
    tests/tags/test-gplate-variable-tag.c
  • +0 -2
    tests/templates/footer.gplate
  • +0 -5
    tests/templates/header.gplate
  • +0 -1
    tests/templates/html.gplate
  • +0 -1
    tests/templates/simple-include.gplate
  • +0 -4
    tests/templates/simple.gplate
  • +0 -29
    tests/test-collection.c
  • +0 -255
    tests/test-dictionary-variable.c
  • +0 -179
    tests/test-file-variable.c
  • +0 -35
    tests/test-gplate-collection-interface.c
  • +0 -60
    tests/test-gplate-utility-functions.c
  • +0 -39
    tests/test-gplate.c
  • +0 -13
    tests/variables/CMakeLists.txt
  • +0 -112
    tests/variables/test-gplate-variables.c
  • +0 -30
    tests/variables/test-gplate-variables.h
  • --- a/.hgignore Sat Mar 04 10:36:35 2023 -0600
    +++ b/.hgignore Sat Mar 04 11:27:30 2023 -0600
    @@ -1,26 +1,4 @@
    syntax: glob
    -*.a
    -*.so*
    -.*.swp
    -CMakeCache.txt
    -CMakeFiles
    -CTestTestfile.cmake
    -cmake_install.cmake
    -doc/gplate/tmpl/*.bak
    -INSTALL
    -Makefile
    +build**/*
    +subprojects/*/*
    -syntax: regexp
    -^doc/gplate/.+\.stamp$
    -^doc/gplate/gplate-un(declared|documented|used)\.txt$
    -^doc/gplate/gplate-decl(-list)?\.txt$
    -^doc/gplate/gplate\.(args|hierarchy|interfaces|prerequisites|signals)$
    -^doc/gplate/(ht|x)ml$
    -^doc/gplate/overview\.sgml$
    -^gplate/configs/.+\.(dot|png)$
    -^gplate\.pc$
    -^gplate/libgplate\.dylib$
    -Testing\/
    -tests/test-([a-zA-Z0-9-]+)(\.exe|\.log)?$
    -^build(-.+)?\/
    -
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/gplate.h.in Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,38 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#ifndef GPLATE_GPLATE_H
    +#define GPLATE_GPLATE_H
    +
    +#ifndef __GI_SCANNER__ /* hide this bit from g-ir-scanner */
    +# ifdef GPLATE_COMPILATION
    +# error "gplate source files should not be including gplate.h"
    +# endif /* GPLATE_COMPILATION */
    +#endif /* __GI_SCANNER__ */
    +
    +#include <glib.h>
    +
    +#ifndef GPLATE_GLOBAL_HEADER_INSIDE
    +# define GPLATE_GLOBAL_HEADER_INSIDE
    +#endif /* GPLATE_GLOBAL_HEADER_INSIDE */
    +
    +@GPLATE_H_INCLUDES@
    +
    +#undef GPLATE_GLOBAL_HEADER_INSIDE
    +
    +#endif /* GPLATE_PURPLE_H */
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/meson.build Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,147 @@
    +GPLATE_SOURCES = [
    + 'functions/gplate-for-function.c',
    + 'functions/gplate-include-function.c',
    + 'functions/gplate-noop-function.c',
    + 'functions/gplate-print-function.c',
    + 'functions/gplate-text-function.c',
    + 'gplate-collection.c',
    + 'gplate-config.c',
    + 'gplate-errors.c',
    + 'gplate-function.c',
    + 'gplate-iterator.c',
    + 'gplate-library.c',
    + 'gplate-tag.c',
    + 'gplate-template.c',
    + 'gplate-util.c',
    + 'gplate-variable.c',
    + 'tags/gplate-code-tag.c',
    + 'tags/gplate-comment-tag.c',
    + 'tags/gplate-text-tag.c',
    + 'tags/gplate-variable-tag.c',
    + 'variables/gplate-dictionary-variable.c',
    + 'variables/gplate-directory-variable.c',
    + 'variables/gplate-file-variable.c',
    + 'variables/gplate-object-variable.c',
    +]
    +
    +GPLATE_HEADERS = [
    + 'functions/gplate-for-function.h',
    + 'functions/gplate-include-function.h',
    + 'functions/gplate-noop-function.h',
    + 'functions/gplate-print-function.h',
    + 'functions/gplate-text-function.h',
    + 'gplate-collection.h',
    + 'gplate-config.h',
    + 'gplate-errors.h',
    + 'gplate-function.h',
    + 'gplate-iterator.h',
    + 'gplate-library.h',
    + 'gplate-tag.h',
    + 'gplate-template.h',
    + 'gplate-util.h',
    + 'gplate-variable.h',
    + 'gplate.h',
    + 'tags/gplate-code-tag.h',
    + 'tags/gplate-comment-tag.h',
    + 'tags/gplate-text-tag.h',
    + 'tags/gplate-variable-tag.h',
    + 'variables/gplate-dictionary-variable.h',
    + 'variables/gplate-directory-variable.h',
    + 'variables/gplate-file-variable.h',
    + 'variables/gplate-object-variable.h',
    +]
    +
    +GPLATE_ENUM_HEADERS = [
    + 'gplate-errors.h',
    +]
    +
    +GPLATE_BUILT_SOURCES = []
    +GPLATE_BUILT_HEADERS = []
    +
    +GPLATE_DEPENDENCIES = [GLIB, GOBJECT]
    +
    +gplate_filebase = 'gplate-1'
    +gplate_include_base = gplate_filebase / 'gplate'
    +
    +GPLATE_ENUMS = gnome.mkenums_simple('gplateenums',
    + sources : GPLATE_ENUM_HEADERS,
    + install_header : true,
    + install_dir : get_option('includedir') / gplate_include_base)
    +GPLATE_BUILT_SOURCES += GPLATE_ENUMS[0]
    +GPLATE_BUILT_HEADERS += GPLATE_ENUMS[1]
    +
    +GPLATE_H_INCLUDES = []
    +foreach header : GPLATE_HEADERS + ['gplateenums.h']
    + GPLATE_H_INCLUDES += '#include <gplate/@0@>'.format(header)
    +endforeach
    +gplate_h_conf = configuration_data()
    +gplate_h_conf.set('GPLATE_H_INCLUDES', '\n'.join(GPLATE_H_INCLUDES))
    +
    +gplate_h = configure_file(
    + input : 'gplate.h.in',
    + output : 'gplate.h',
    + configuration : gplate_h_conf,
    + install : true,
    + install_dir : get_option('includedir') / gplate_filebase)
    +GPLATE_BUILT_HEADERS += gplate_h
    +
    +#gplate_resources = gnome.compile_resources('gplateresources',
    +# 'resources/gplate.gresource.xml',
    +# source_dir : 'resources',
    +# c_name : 'gplate')
    +#GPLATE_BUILT_SOURCES += gplate_resources[0]
    +#GPLATE_BUILT_HEADERS += gplate_resources[1]
    +
    +gplate_inc = include_directories('.')
    +
    +GPLATE_ALL_SOURCES = GPLATE_SOURCES + GPLATE_HEADERS + GPLATE_BUILT_SOURCES + GPLATE_BUILT_HEADERS
    +
    +GPLATE_CFLAGS = [
    + '-DGPLATE_COMPILATION',
    + '-DGPLATE_RESOURCE_PATH="/org/imfreedom/keep/gplate/gplate"',
    +]
    +
    +libgplate = library('gplate',
    + GPLATE_ALL_SOURCES,
    + dependencies : GPLATE_DEPENDENCIES,
    + c_args : GPLATE_CFLAGS,
    + version : GPLATE_VERSION,
    + include_directories : [toplevel_inc, gplate_inc],
    +)
    +
    +gplate_dep = declare_dependency(
    + # Ensure headers built before any dependencies:
    + sources : GPLATE_BUILT_HEADERS,
    + include_directories : [toplevel_inc, gplate_inc],
    + link_with : libgplate,
    + dependencies : GPLATE_DEPENDENCIES)
    +
    +meson.override_dependency(gplate_filebase, gplate_dep)
    +
    +install_headers(GPLATE_HEADERS, subdir : gplate_include_base)
    +
    +pkgconfig.generate(
    + libgplate,
    + name : 'gplate',
    + description : 'gobject based templating library',
    + version : meson.project_version(),
    + filebase : gplate_filebase,
    + subdirs : [gplate_filebase],
    + requires : [GLIB, GOBJECT])
    +
    +if get_option('introspection')
    + gplate_gir = gnome.generate_gir(libgplate,
    + sources : GPLATE_ALL_SOURCES,
    + header : 'gplate.h',
    + includes : ['GLib-2.0', 'GObject-2.0'],
    + namespace : 'GPlate',
    + symbol_prefix : 'gplate',
    + identifier_prefix : 'GPlate',
    + export_packages : gplate_filebase,
    + nsversion : '1.0',
    + install : true,
    + extra_args : ['-DGPLATE_COMPILATION', '--quiet'])
    +endif
    +
    +subdir('reference')
    +subdir('tests')
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/reference/gplate.toml.in Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,38 @@
    +[library]
    +version = "@GPLATE_VERSION@"
    +browse_url = "https://keep.imfreedom.org/gplate/gplate/"
    +repository_url = "https://keep.imfreedom.org/gplate/gplate/"
    +website_url = "https://keep.imfreedom.org/gplate/gplate/"
    +authors = "GPlate Developers"
    +logo_url = ""
    +license = "LGPL-2.1-or-later"
    +description = "GPlate GObject Template Library"
    +dependencies = [ "GLib-2.0", "GObject-2.0" ]
    +devhelp = true
    +search_index = true
    +
    + [dependencies."GLib-2.0"]
    + name = "GLib"
    + description = "General-purpose, portable utility library."
    + docs_url = "https://docs.gtk.org/glib/"
    +
    + [dependencies."GObject-2.0"]
    + name = "GObject"
    + description = "The base type system library"
    + docs_url = "https://docs.gtk.org/gobject/"
    +
    +[theme]
    +name = "basic"
    +show_index_summary = true
    +show_class_hierarchy = true
    +
    +[source-location]
    +base_url = "https://keep.imfreedom.org/gplate/gplate/file/default/"
    +
    +[extra]
    +# The same order will be used when generating the index
    +content_files = [
    +]
    +content_images = [
    +]
    +urlmap_file = "urlmap.js"
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/reference/meson.build Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,31 @@
    +gplate_doc_content_files = []
    +
    +if get_option('doc')
    + gplate_toml = configure_file(
    + input : 'gplate.toml.in',
    + output : 'gplate.toml',
    + configuration : version_conf,
    + install : true,
    + install_dir : docs_dir / 'gplate',
    + )
    +
    + gplate_doc = custom_target('gplate-doc',
    + input : [ gplate_toml, gplate_gir[0] ],
    + output : 'gplate',
    + command : [
    + gidocgen,
    + 'generate',
    + '--quiet',
    + '--fatal-warnings',
    + '--config=@INPUT0@',
    + '--output-dir=@OUTPUT@',
    + '--no-namespace-dir',
    + '--content-dir=@0@'.format(meson.current_source_dir()),
    + '@INPUT1@'
    + ],
    + depend_files : [ gplate_doc_content_files ],
    + build_by_default : true,
    + install : true,
    + install_dir : docs_dir,
    + )
    +endif
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/reference/urlmap.js Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,8 @@
    +// SPDX-FileCopyrightText: 2021 GNOME Foundation
    +// SPDX-License-Identifier: LGPL-2.1-or-later
    +
    +// A map between namespaces and base URLs for their online documentation
    +baseURLs = [
    + [ 'GLib', 'https://docs.gtk.org/glib/' ],
    + [ 'GObject', 'https://docs.gtk.org/gobject/' ],
    +]
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/resources/gplate.gresource.xml Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,5 @@
    +<?xml version="1.0" encoding="UTF-8"?>
    +<gresources>
    + <gresource prefix="/org/imfreedom/keep/gplate/gplate/">
    + </gresource>
    +</gresources>
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/CMakeLists.txt Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,29 @@
    +add_definitions(
    + -DTEST_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
    +)
    +
    +add_subdirectory(functions)
    +add_subdirectory(tags)
    +add_subdirectory(variables)
    +
    +add_executable(test-gplate test-gplate.c)
    +
    +target_link_libraries(test-gplate
    + ${GLIB_LIBRARIES}
    + gplate
    + test-gplate-functions
    + test-gplate-tags
    + test-gplate-variables
    +)
    +
    +###############################################################################
    +# Main Target
    +###############################################################################
    +set(GTESTER_TESTS "${TESTS}")
    +set(GTESTER_LOG "testgplate.log")
    +
    +add_custom_target(tests ALL
    + COMMAND ${GTESTER} -k --verbose -o ${GTESTER_LOG} test-gplate
    + DEPENDS test-gplate
    +)
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/functions/CMakeLists.txt Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,15 @@
    +set(TEST_GPLATE_FUNCTIONS_HEADERS
    + test-gplate-functions.h
    +)
    +
    +set(TEST_GPLATE_FUNCTIONS_SOURCES
    + test-gplate-functions.c
    + test-gplate-for-function.c
    + test-gplate-include-function.c
    +)
    +
    +add_library(test-gplate-functions STATIC
    + ${TEST_GPLATE_FUNCTIONS_HEADERS}
    + ${TEST_GPLATE_FUNCTIONS_SOURCES}
    +)
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/functions/test-gplate-for-function.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,181 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +#include <gplate/variables/gplate-dictionary-variable.h>
    +
    +#include <glib.h>
    +
    +/******************************************************************************
    + * Structs
    + *****************************************************************************/
    +typedef struct {
    + const gchar *name;
    + const gchar *value;
    +} TestGPlateForFunctionData;
    +
    +typedef struct {
    + GPlateTemplate *template;
    +
    + GPlateVariable *dict;
    +
    + const gchar *template_string;
    +
    + gchar *actual;
    + const gchar *expected;
    +
    + GError *error;
    +
    + TestGPlateForFunctionData *data;
    +} TestGPlateForFunctionFixture;
    +
    +/******************************************************************************
    + * Fixtures
    + *****************************************************************************/
    +static void
    +test_gplate_for_function_setup(TestGPlateForFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + fixture->template = gplate_template_new();
    + fixture->dict = gplate_dictionary_variable_new("list");
    +
    + gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    + fixture->dict);
    +}
    +
    +static void
    +test_gplate_for_function_teardown(TestGPlateForFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + g_object_unref(fixture->template);
    + fixture->template = NULL;
    +
    + g_object_unref(fixture->dict);
    + fixture->dict = NULL;
    +
    + g_free(fixture->actual);
    + fixture->actual = NULL;
    +
    + fixture->expected = NULL;
    +
    + if(fixture->error) {
    + g_error_free(fixture->error);
    + fixture->error = NULL;
    + }
    +}
    +
    +/******************************************************************************
    + * Helpers
    + *****************************************************************************/
    +static void
    +test_gplate_for_function(TestGPlateForFunctionFixture *fixture) {
    + gint i = 0;
    +
    + /* add the variables */
    + for(i = 0; fixture->data[i].name; i++) {
    + gplate_collection_add_string(fixture->dict,
    + fixture->data[i].name,
    + fixture->data[i].value);
    + }
    +
    + fixture->actual = gplate_template_render(fixture->template,
    + fixture->template_string,
    + &fixture->error);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    +/******************************************************************************
    + * Simple For's
    + *****************************************************************************/
    +static void
    +test_gplate_for_function_zero_elements(TestGPlateForFunctionFixture *fixture,
    + gconstpointer user_data)
    +{
    + TestGPlateForFunctionData data[] = {
    + { NULL, NULL },
    + };
    +
    + fixture->data = data;
    + fixture->template_string = "{% for in in line %}{{ i }}{% endfor %}";
    + fixture->expected = "";
    +
    + test_gplate_for_function(fixture);
    +}
    +
    +static void
    +test_gplate_for_function_one_element(TestGPlateForFunctionFixture *fixture,
    + gconstpointer user_data)
    +{
    + TestGPlateForFunctionData data[] = {
    + { "one", "1" },
    + { NULL, NULL },
    + };
    +
    + fixture->data = data;
    + fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    + fixture->expected = "1";
    +
    + test_gplate_for_function(fixture);
    +}
    +
    +static void
    +test_gplate_for_function_two_elements(TestGPlateForFunctionFixture *fixture,
    + gconstpointer user_data)
    +{
    + TestGPlateForFunctionData data[] = {
    + { "a", "A" },
    + { "b", "B" },
    + { NULL, NULL },
    + };
    +
    + fixture->data = data;
    + fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    + fixture->expected = "AB";
    +
    + test_gplate_for_function(fixture);
    +}
    +
    +/******************************************************************************
    + * Main!
    + *****************************************************************************/
    +void
    +test_gplate_for_function_add_tests(void) {
    + g_test_add("/functions/foo/zero_elements",
    + TestGPlateForFunctionFixture,
    + NULL,
    + test_gplate_for_function_setup,
    + test_gplate_for_function_zero_elements,
    + test_gplate_for_function_teardown);
    +
    + g_test_add("/functions/foo/one_element",
    + TestGPlateForFunctionFixture,
    + NULL,
    + test_gplate_for_function_setup,
    + test_gplate_for_function_one_element,
    + test_gplate_for_function_teardown);
    +
    + g_test_add("/functions/foo/two_elements",
    + TestGPlateForFunctionFixture,
    + NULL,
    + test_gplate_for_function_setup,
    + test_gplate_for_function_two_elements,
    + test_gplate_for_function_teardown);
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/functions/test-gplate-functions.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,29 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include "test-gplate-functions.h"
    +
    +/******************************************************************************
    + * API
    + *****************************************************************************/
    +void
    +test_gplate_functions_add_tests(void) {
    + test_gplate_for_function_add_tests();
    + test_gplate_include_function_add_tests();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/functions/test-gplate-functions.h Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,36 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#ifndef TEST_GPLATE_FUNCTIONS_H
    +#define TEST_GPLATE_FUNCTIONS_H
    +
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +G_BEGIN_DECLS
    +
    +void test_gplate_functions_add_tests(void);
    +
    +/* external prototypes */
    +void test_gplate_for_function_add_tests(void);
    +void test_gplate_include_function_add_tests(void);
    +
    +G_END_DECLS
    +
    +#endif /* TEST_GPLATE_FUNCTIONS_H */
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/functions/test-gplate-include-function.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,132 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +/******************************************************************************
    + * Structs
    + *****************************************************************************/
    +typedef struct {
    + GPlateTemplate *template;
    +
    + const gchar *template_string;
    +
    + gchar *actual;
    + const gchar *expected;
    +
    + GError *error;
    +} TestGPlateIncludeFunctionFixture;
    +
    +/******************************************************************************
    + * Fixtures
    + *****************************************************************************/
    +static void
    +test_gplate_include_function_setup(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + fixture->template = gplate_template_new();
    +}
    +
    +static void
    +test_gplate_include_function_teardown(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer d)
    +{
    + g_object_unref(fixture->template);
    + fixture->template = NULL;
    +
    + g_free(fixture->actual);
    + fixture->actual = NULL;
    +
    + fixture->expected = NULL;
    +
    + if(fixture->error) {
    + g_error_free(fixture->error);
    + fixture->error = NULL;
    + }
    +}
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_include_function_simple(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer data)
    +{
    + gchar *path = NULL;
    +
    + fixture->expected = "including\nincluded!\n\ndone\n\n";
    +
    + path = g_build_filename(TEST_DIR, "templates", "simple.gplate", NULL);
    + fixture->actual = gplate_template_render_file(fixture->template,
    + path,
    + &fixture->error);
    + g_free(path);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    +static void
    +test_gplate_include_function_double(TestGPlateIncludeFunctionFixture *fixture,
    + gconstpointer data)
    +{
    + gchar *path = NULL;
    +
    + fixture->expected = "\
    +<html>\n\
    + <head>\n\
    + <title>test</title>\n\
    + </head>\n\
    + <body>\n\
    +in the body\
    + </body>\n\
    +</html>\n\n";
    +
    + path = g_build_filename(TEST_DIR, "templates", "html.gplate", NULL);
    + fixture->actual = gplate_template_render_file(fixture->template,
    + path,
    + &fixture->error);
    + g_free(path);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    +/******************************************************************************
    + * Main!
    + *****************************************************************************/
    +void
    +test_gplate_include_function_add_tests(void) {
    + g_test_add("/functions/include/simple",
    + TestGPlateIncludeFunctionFixture,
    + NULL,
    + test_gplate_include_function_setup,
    + test_gplate_include_function_simple,
    + test_gplate_include_function_teardown);
    +
    + g_test_add("/functions/include/double",
    + TestGPlateIncludeFunctionFixture,
    + NULL,
    + test_gplate_include_function_setup,
    + test_gplate_include_function_double,
    + test_gplate_include_function_teardown);
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/meson.build Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,14 @@
    +PROGRAMS = [
    + 'collection',
    + 'dictionary-variable',
    + 'file-variable',
    + 'gplate-collection-interface',
    + 'gplate-utility-functions',
    +]
    +
    +foreach program : PROGRAMS
    + e = executable(f'test-@program@', f'test-@program@.c',
    + dependencies : [gplate_dep, GLIB],
    + )
    + test(program, e)
    +endforeach
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/tags/CMakeLists.txt Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,16 @@
    +set(TEST_GPLATE_TAGS_HEADERS
    + test-gplate-tag.h
    +)
    +
    +set(TEST_GPLATE_TAGS_SOURCES
    + test-gplate-tag.c
    + test-gplate-comment-tag.c
    + test-gplate-text-tag.c
    + test-gplate-variable-tag.c
    +)
    +
    +add_library(test-gplate-tags STATIC
    + ${TEST_GPLATE_TAGS_HEADERS}
    + ${TEST_GPLATE_TAGS_SOURCES}
    +)
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/tags/test-gplate-comment-tag.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,74 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#include "test-gplate-tag.h"
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data, "{##}", "");
    +}
    +
    +static void
    +test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data, "{# #}", "");
    + test_gplate_tag_output(fixture, data, "{#\t#}", "");
    + test_gplate_tag_output(fixture, data, "{#\n#}", "");
    + test_gplate_tag_output(fixture, data, "{#\r#}", "");
    + test_gplate_tag_output(fixture, data, "{#\r\n#}", "");
    + test_gplate_tag_output(fixture, data, "{#\n\r#}", "");
    +}
    +
    +static void
    +test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data, "{# foo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo #}", "");
    + test_gplate_tag_output(fixture, data, "{#\tfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\t#}", "");
    + test_gplate_tag_output(fixture, data, "{#\nfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\n#}", "");
    + test_gplate_tag_output(fixture, data, "{#\rfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\r#}", "");
    + test_gplate_tag_output(fixture, data, "{#\r\nfoo#}", "");
    + test_gplate_tag_output(fixture, data, "{#foo\r\n#}", "");
    +}
    +
    +/******************************************************************************
    + * Main
    + *****************************************************************************/
    +void
    +test_gplate_comment_tag_add_tests(void) {
    + test_gplate_tag_add("/tags/comment/empty",
    + test_gplate_comment_tag_empty);
    + test_gplate_tag_add("/tags/comment/whitespace",
    + test_gplate_comment_tag_whitespace);
    + test_gplate_tag_add("/tags/comment/simple",
    + test_gplate_comment_tag_simple);
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/tags/test-gplate-tag.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,73 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include "test-gplate-tag.h"
    +
    +/******************************************************************************
    + * Fixtures
    + *****************************************************************************/
    +void
    +test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data) {
    + gplate_config_load_default();
    +
    + fixture->template = gplate_template_new();
    +}
    +
    +void
    +test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data) {
    + g_object_unref(fixture->template);
    + fixture->template = NULL;
    +
    + if(fixture->error) {
    + g_error_free(fixture->error);
    + fixture->error = NULL;
    + }
    +
    + g_free(fixture->actual);
    + fixture->actual = NULL;
    +}
    +
    +/******************************************************************************
    + * Simple Tests
    + *****************************************************************************/
    +void
    +test_gplate_tag_output(TestGPlateTagFixture *fixture,
    + gconstpointer data,
    + const gchar *template_string,
    + const gchar *expected)
    +{
    + fixture->template_string = template_string;
    + fixture->expected = expected;
    +
    + fixture->actual = gplate_template_render(fixture->template,
    + fixture->template_string,
    + &fixture->error);
    +
    + g_assert(fixture->error == NULL);
    +
    + g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    +}
    +
    +/******************************************************************************
    + * API
    + *****************************************************************************/
    +void
    +test_gplate_tag_add_tests(void) {
    + test_gplate_text_tag_add_tests();
    + test_gplate_variable_tag_add_tests();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/tags/test-gplate-tag.h Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,58 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#ifndef TEST_GPLATE_TAG_H
    +#define TEST_GPLATE_TAG_H
    +
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#define test_gplate_tag_add(path, func) \
    + g_test_add((path), TestGPlateTagFixture, NULL, test_gplate_tag_setup, (func), test_gplate_tag_teardown)
    +
    +typedef struct _TestGPlateTagFixture TestGPlateTagFixture;
    +
    +typedef void (*TestGPlateTagFixtureFunc)(TestGPlateTagFixture *fixture, gconstpointer data);
    +
    +struct _TestGPlateTagFixture {
    + GPlateTemplate *template;
    + GError *error;
    +
    + const gchar *template_string;
    +
    + const gchar *expected;
    + gchar *actual;
    +};
    +
    +G_BEGIN_DECLS
    +
    +void test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data);
    +void test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data);
    +void test_gplate_tag_output(TestGPlateTagFixture *fixture, gconstpointer data, const gchar *template_string, const gchar *expected);
    +
    +void test_gplate_tag_add_tests(void);
    +
    +/* external prototypes */
    +void test_gplate_comment_tag_add_tests(void);
    +void test_gplate_text_tag_add_tests(void);
    +void test_gplate_variable_tag_add_tests(void);
    +
    +G_END_DECLS
    +
    +#endif /* TEST_GPLATE_TAG_H */
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/tags/test-gplate-text-tag.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,63 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#include "test-gplate-tag.h"
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_text_tag_syntax_plain(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data,
    + "simple template", "simple template");
    +}
    +
    +static void
    +test_gplate_text_tag_syntax_keywords(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data,
    + "extends if else endif for endfor",
    + "extends if else endif for endfor");
    +}
    +
    +static void
    +test_gplate_text_tag_syntax_keywords_case_sensitive(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_tag_output(fixture, data,
    + "EXteNds iF eLse enDif fOr enDFor",
    + "EXteNds iF eLse enDif fOr enDFor");
    +}
    +
    +
    +void
    +test_gplate_text_tag_add_tests(void) {
    + test_gplate_tag_add("/tags/text/plain",
    + test_gplate_text_tag_syntax_plain);
    + test_gplate_tag_add("/tags/text/keywords",
    + test_gplate_text_tag_syntax_keywords);
    + test_gplate_tag_add("/tags/text/keywords_case_sensitive",
    + test_gplate_text_tag_syntax_keywords_case_sensitive);
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/tags/test-gplate-variable-tag.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,232 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +#include "test-gplate-tag.h"
    +
    +/******************************************************************************
    + * Helpers
    + *****************************************************************************/
    +static void
    +test_gplate_variable_tag(TestGPlateTagFixture *fixture, gconstpointer data,
    + const gchar *template_string, const gchar *expected,
    + ...)
    +{
    + va_list vargs;
    + const gchar *name = NULL, *value = NULL;
    +
    + va_start(vargs, expected);
    + while((name = va_arg(vargs, const gchar *))) {
    + value = va_arg(vargs, const gchar *);
    +
    + gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    + name, value);
    + }
    + va_end(vargs);
    +
    + test_gplate_tag_output(fixture, data, template_string, expected);
    +}
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +static void
    +test_gplate_variable_tag_single(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{ foo }}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_double(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{ foo }}{{ bar }}", "foobar",
    + "foo", "foo",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_tripple(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{ foo }}{{ bar }}{{ baz }}", "foobarbaz",
    + "foo", "foo",
    + "bar", "bar",
    + "baz", "baz",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_newline_prefix(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{\nfoo}}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_newline_suffix(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{foo\n}}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_newline_wrapped(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "{{\nfoo\n}}", "foo",
    + "foo", "foo",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_single_quotes(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "foo '{{ bar }}' baz", "foo 'bar' baz",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_double_quotes(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "foo \"{{ bar }}\" baz", "foo \"bar\" baz",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_mixed_quotes(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "foo \"{{ bar }}' baz", "foo \"bar' baz",
    + "bar", "bar",
    + NULL);
    +
    + test_gplate_variable_tag(fixture, data,
    + "foo '{{ bar }}\" baz", "foo 'bar\" baz",
    + "bar", "bar",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_two_vars_one_block(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + test_gplate_variable_tag(fixture, data,
    + "one {{ two five }} three",
    + "one 2 three",
    + "two", "2",
    + "five", "5",
    + NULL);
    +}
    +
    +static void
    +test_gplate_variable_tag_nested_single(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + GPlateVariable *dict = gplate_dictionary_variable_new("foo");
    +
    + gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    + dict);
    +
    + gplate_collection_add_string(GPLATE_COLLECTION(dict),
    + "bar", "baz");
    +
    + test_gplate_tag_output(fixture, data, "{{ foo.bar }}", "baz");
    +}
    +
    +static void
    +test_gplate_variable_tag_nested_double(TestGPlateTagFixture *fixture,
    + gconstpointer data)
    +{
    + GPlateVariable *dict1 = gplate_dictionary_variable_new("foo");
    + GPlateVariable *dict2 = gplate_dictionary_variable_new("bar");
    +
    + gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    + dict1);
    + gplate_collection_add_variable(GPLATE_COLLECTION(dict1), dict2);
    + gplate_collection_add_string(GPLATE_COLLECTION(dict2),
    + "baz", "42");
    +
    + test_gplate_tag_output(fixture, data, "{{ foo.bar.baz }}", "42");
    +}
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +void
    +test_gplate_variable_tag_add_tests(void) {
    + test_gplate_tag_add("/tags/variable/single",
    + test_gplate_variable_tag_single);
    +
    + test_gplate_tag_add("/tags/variable/double",
    + test_gplate_variable_tag_double);
    +
    + test_gplate_tag_add("/tags/variable/tripple",
    + test_gplate_variable_tag_tripple);
    +
    + test_gplate_tag_add("/tags/variable/newline_prefix",
    + test_gplate_variable_tag_newline_prefix);
    +
    + test_gplate_tag_add("/tags/variable/newline_suffix",
    + test_gplate_variable_tag_newline_suffix);
    +
    + test_gplate_tag_add("/tags/variable/newline_wrapped",
    + test_gplate_variable_tag_newline_wrapped);
    +
    + test_gplate_tag_add("/tags/variable/quotes/single",
    + test_gplate_variable_tag_single_quotes);
    +
    + test_gplate_tag_add("/tags/variable/quotes/double",
    + test_gplate_variable_tag_double_quotes);
    +
    + test_gplate_tag_add("/tags/variable/quotes/mixed",
    + test_gplate_variable_tag_mixed_quotes);
    +
    + test_gplate_tag_add("/tags/variable/two_vars_one_block",
    + test_gplate_variable_tag_two_vars_one_block);
    +
    + test_gplate_tag_add("/tags/variable/nested/single",
    + test_gplate_variable_tag_nested_single);
    +
    + test_gplate_tag_add("/tags/variable/nested/double",
    + test_gplate_variable_tag_nested_double);
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/templates/footer.gplate Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,2 @@
    + </body>
    +</html>
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/templates/header.gplate Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,5 @@
    +<html>
    + <head>
    + <title>test</title>
    + </head>
    + <body>
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/templates/html.gplate Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,1 @@
    +{% include "header.gplate" %}in the body{% include "footer.gplate" %}
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/templates/simple-include.gplate Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,1 @@
    +included!
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/templates/simple.gplate Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,4 @@
    +including
    +{% include "simple-include.gplate" %}
    +done
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/test-collection.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,29 @@
    +#include "test-collection.h"
    +
    +#include "test.h"
    +
    +void
    +test_collection_lookup(GPlateCollection *collection, const gchar *name,
    + const gchar *expected)
    +{
    + const gchar *v = NULL;
    +
    + v = gplate_collection_lookup(collection, name);
    +
    + test_string(expected, v);
    +}
    +
    +void
    +test_collection_lookup_int(GPlateCollection *collection, const gchar *name,
    + gint expected)
    +{
    + const gchar *v = NULL;
    + gchar *e = NULL;
    +
    + v = gplate_collection_lookup(collection, name);
    +
    + e = g_strdup_printf("%d", expected);
    +
    + test_string(e, v);
    + g_free(e);
    +}
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/test-dictionary-variable.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,255 @@
    +#ifdef HAVE_CONFIG_H
    +# include <config.h>
    +#endif /* HAVE_CONFIG_H */
    +
    +#include <check.h>
    +
    +#include <gplate/gplate.h>
    +
    +#include "test.h"
    +#include "test-collection.h"
    +#include "test-object.h"
    +
    +/******************************************************************************
    + * Structs
    + *****************************************************************************/
    +typedef struct {
    + const gchar *name;
    + const gchar *value;
    +} VariableData;
    +
    +/******************************************************************************
    + * Globals
    + *****************************************************************************/
    +static GPlateVariable *dict = NULL;
    +static GPlateIterator *iter = NULL;
    +
    +/******************************************************************************
    + * Helpers
    + *****************************************************************************/
    +static void
    +iterator_test(VariableData *vd) {
    + gint i = 0, count = 0;
    +
    + /* add all the values and make sure they got entered correctly */
    + for(i = 0, count = 0; vd[i].name; i++, count++) {
    + gplate_collection_add_string(dict, vd[i].name, vd[i].value);
    + test_collection_lookup(GPLATE_COLLECTION(dict),
    + vd[i].name, vd[i].value);
    + }
    +
    + i = 0;
    +
    + iter = gplate_collection_get_iterator(GPLATE_COLLECTION(dict));
    + while(gplate_iterator_has_next(iter)) {
    + GPlateVariable *var = gplate_iterator_next(iter);
    + const gchar *value = gplate_variable_get_value(var);
    +
    + test_string(vd[i++].value, value);
    + }
    +
    + fail_unless(i == count, "Iterated over %d/%d elements.", i, count);
    +}
    +
    +/******************************************************************************
    + * Fixtures
    + *****************************************************************************/
    +static void
    +collection_interface_setup(void) {
    + dict = gplate_dictionary_variable_new("dict");
    +}
    +
    +static void
    +collection_interface_teardown(void) {
    + g_object_unref(G_OBJECT(dict));
    +
    + if(iter) {
    + g_object_unref(G_OBJECT(iter));
    + iter = NULL;
    + }
    +}
    +
    +/******************************************************************************
    + * Object Hierarchy Tests
    + *****************************************************************************/
    +START_TEST(test_dictionary_hierarchy_type)
    + test_object_is_a(G_OBJECT(dict), GPLATE_TYPE_DICTIONARY_VARIABLE);
    +END_TEST
    +
    +START_TEST(test_dictionary_hierarchy_parent)
    + test_object_is_a(G_OBJECT(dict), GPLATE_TYPE_VARIABLE);
    +END_TEST
    +
    +START_TEST(test_dictionary_hierarchy_collection)
    + test_object_is_a(G_OBJECT(dict), GPLATE_TYPE_COLLECTION);
    +END_TEST
    +
    +/******************************************************************************
    + * Collection Interface Tests
    + *****************************************************************************/
    +START_TEST(test_dictionary_add_string_null)
    + gplate_collection_add_string(dict, "null", NULL);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "null", NULL);
    +END_TEST
    +
    +START_TEST(test_dictionary_add_string_empty)
    + gplate_collection_add_string(dict, "empty", "");
    + test_collection_lookup(GPLATE_COLLECTION(dict), "empty", "");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_string)
    + gplate_collection_add_string(dict, "string", "string");
    + test_collection_lookup(GPLATE_COLLECTION(dict), "string", "string");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_boolean_true)
    + gplate_collection_add_boolean(dict, "true", TRUE);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "true", "TRUE");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_boolean_false)
    + gplate_collection_add_boolean(dict, "false", FALSE);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "false", "FALSE");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_float_positive)
    + gplate_collection_add_float(dict, "pi", 3.14f);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "pi", "3.140000");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_float_positive_whole)
    + gplate_collection_add_float(dict, "three", 3.0f);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "three", "3.000000");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_float_negative)
    + gplate_collection_add_float(dict, "negativepi", -3.14f);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "negativepi", "-3.140000");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_float_negative_whole)
    + gplate_collection_add_float(dict, "negativethree", -3.0f);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "negativethree", "-3.000000");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_double_positive)
    + gplate_collection_add_double(dict, "e", 2.71);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "e", "2.71");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_double_positive_whole)
    + gplate_collection_add_double(dict, "two", 2.0);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "two", "2");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_double_negative)
    + gplate_collection_add_double(dict, "negativee", -2.71);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "negativee", "-2.71");
    +END_TEST
    +
    +START_TEST(test_dictionary_add_double_negative_whole)
    + gplate_collection_add_double(dict, "negativetwo", -2.0);
    + test_collection_lookup(GPLATE_COLLECTION(dict), "negativetwo", "-2");
    +END_TEST
    +
    +START_TEST(test_dictionary_nested)
    + GPlateVariable *nested = gplate_dictionary_variable_new("nested");
    +
    + gplate_collection_add_variable(GPLATE_COLLECTION(dict), nested);
    +
    + gplate_collection_add_string(GPLATE_COLLECTION(nested), "nestedstring",
    + "nested");
    +
    + test_collection_lookup(GPLATE_COLLECTION(dict), "nested.nestedstring",
    + "nested");
    +END_TEST
    +
    +START_TEST(test_dictionary_iterator_empty)
    + VariableData vd[] = {
    + { NULL, NULL },
    + };
    +
    + iterator_test(vd);
    +END_TEST
    +
    +START_TEST(test_dictionary_iterator_one_element)
    + VariableData vd[] = {
    + { "one", "1" },
    + { NULL, NULL },
    + };
    +
    + iterator_test(vd);
    +END_TEST
    +
    +START_TEST(test_dictionary_iterator_many_elements_sorted)
    + VariableData vd[] = {
    + { "eight", "8" },
    + { "five", "5" },
    + { "four", "4" },
    + { "nine", "9" },
    + { "one", "1" },
    + { "seven", "7" },
    + { "six", "6" },
    + { "ten", "10" },
    + { "three", "3" },
    + { "two", "2" },
    + { NULL, NULL },
    + };
    +
    + iterator_test(vd);
    +END_TEST
    +
    +/******************************************************************************
    + * API
    + *****************************************************************************/
    +Suite *
    +dictionary_variable_suite(void) {
    + Suite *s = suite_create("Dictionary Variable Suite");
    + TCase *tc = NULL;
    +
    + /* object heirarchy */
    + tc = tcase_create("Object hierarchy");
    +
    + tcase_add_checked_fixture(tc, collection_interface_setup,
    + collection_interface_teardown);
    +
    + tcase_add_test(tc, test_dictionary_hierarchy_type);
    + tcase_add_test(tc, test_dictionary_hierarchy_parent);
    + tcase_add_test(tc, test_dictionary_hierarchy_collection);
    +
    + suite_add_tcase(s, tc);
    +
    + /* collection interface */
    + tc = tcase_create("Collection Interface");
    +
    + tcase_add_checked_fixture(tc, collection_interface_setup,
    + collection_interface_teardown);
    +
    + tcase_add_test(tc, test_dictionary_add_string_null);
    + tcase_add_test(tc, test_dictionary_add_string_empty);
    + tcase_add_test(tc, test_dictionary_add_string);
    +
    + tcase_add_test(tc, test_dictionary_add_boolean_true);
    + tcase_add_test(tc, test_dictionary_add_boolean_false);
    +
    + tcase_add_test(tc, test_dictionary_add_float_positive);
    + tcase_add_test(tc, test_dictionary_add_float_positive_whole);
    + tcase_add_test(tc, test_dictionary_add_float_negative);
    + tcase_add_test(tc, test_dictionary_add_float_negative_whole);
    +
    + tcase_add_test(tc, test_dictionary_add_double_positive);
    + tcase_add_test(tc, test_dictionary_add_double_positive_whole);
    + tcase_add_test(tc, test_dictionary_add_double_negative);
    + tcase_add_test(tc, test_dictionary_add_double_negative_whole);
    +
    + tcase_add_test(tc, test_dictionary_nested);
    +
    + tcase_add_test(tc, test_dictionary_iterator_empty);
    + tcase_add_test(tc, test_dictionary_iterator_one_element);
    + tcase_add_test(tc, test_dictionary_iterator_many_elements_sorted);
    +
    + suite_add_tcase(s, tc);
    +
    + return s;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/test-file-variable.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,179 @@
    +#ifdef HAVE_CONFIG_H
    +# include <config.h>
    +#endif /* HAVE_CONFIG_H */
    +
    +#include <check.h>
    +
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +#include <glib/gstdio.h>
    +
    +#include <stdlib.h>
    +#include <string.h>
    +#include <unistd.h>
    +
    +#include "test.h"
    +#include "test-collection.h"
    +#include "test-object.h"
    +
    +/******************************************************************************
    + * Globals
    + *****************************************************************************/
    +static GPlateVariable *file = NULL;
    +
    +/******************************************************************************
    + * Helpers
    + *****************************************************************************/
    +static gchar *
    +create_temp_file(void) {
    + gint fd = 0;
    + gchar *filename = NULL;
    +
    + fd = g_file_open_tmp("gplate-test-XXXXXX", &filename, NULL);
    +
    + fail_unless(fd >= 0);
    +
    + /* close the fd, basically we just did a touch ;) */
    + close(fd);
    +
    + return filename;
    +}
    +
    +static void
    +test_file(GPlateFileVariable *file, const gchar *filename) {
    + GPlateCollection *c = GPLATE_COLLECTION(file);
    + struct stat st;
    + gint r = 0;
    +
    + test_collection_lookup(c, "filename", filename);
    +
    + /* do a g_stat on the file */
    + r = g_lstat(filename, &st);
    +
    + fail_unless(r == 0, "Failed to stat '%s'", filename);
    +
    + /* now run through and compare all of the values */
    + test_collection_lookup_int(c, "dev", st.st_dev);
    + test_collection_lookup_int(c, "inode", st.st_ino);
    + test_collection_lookup_int(c, "mode", st.st_mode);
    + test_collection_lookup_int(c, "nlink", st.st_nlink);
    + test_collection_lookup_int(c, "uid", st.st_uid);
    + test_collection_lookup_int(c, "gid", st.st_gid);
    + test_collection_lookup_int(c, "rdev", st.st_rdev);
    + test_collection_lookup_int(c, "size", st.st_size);
    + test_collection_lookup_int(c, "blocksize", st.st_blksize);
    + test_collection_lookup_int(c, "blocks", st.st_blocks);
    + test_collection_lookup_int(c, "atime", st.st_atime);
    + test_collection_lookup_int(c, "mtime", st.st_mtime);
    + test_collection_lookup_int(c, "ctime", st.st_ctime);
    +}
    +
    +/******************************************************************************
    + * Fixtures
    + *****************************************************************************/
    +static void
    +object_hierarchy_setup(void) {
    + gchar *filename = create_temp_file();
    +
    + file = gplate_file_variable_new("file", filename);
    + g_free(filename);
    +}
    +
    +static void
    +common_teardown(void) {
    + if(G_IS_OBJECT(file)) {
    + GPlateCollection *c = GPLATE_COLLECTION(file);
    + const gchar *filename = NULL;
    +
    + filename = gplate_collection_lookup(c, "filename");
    +
    + if(filename)
    + g_unlink(filename);
    +
    + g_object_unref(G_OBJECT(file));
    + }
    +
    + file = NULL;
    +}
    +
    +/******************************************************************************
    + * Object Hierarchy Tests
    + *****************************************************************************/
    +START_TEST(test_file_hierarchy_type)
    + test_object_is_a(G_OBJECT(file), GPLATE_TYPE_FILE_VARIABLE);
    +END_TEST
    +
    +START_TEST(test_file_hierarchy_parent)
    + test_object_is_a(G_OBJECT(file), GPLATE_TYPE_DICTIONARY_VARIABLE);
    +END_TEST
    +
    +START_TEST(test_file_hierarchy_grandparent)
    + test_object_is_a(G_OBJECT(file), GPLATE_TYPE_VARIABLE);
    +END_TEST
    +
    +START_TEST(test_file_hierarchy_collection)
    + test_object_is_a(G_OBJECT(file), GPLATE_TYPE_COLLECTION);
    +END_TEST
    +
    +/******************************************************************************
    + * File Tests
    + *****************************************************************************/
    +START_TEST(test_file_normal)
    + gchar *filename = create_temp_file();
    +
    + file = gplate_file_variable_new("file", filename);
    +
    + fail_unless(GPLATE_IS_FILE_VARIABLE(file),
    + "Failed to create a GPlateFileVariable instance for '%s'",
    + filename);
    +
    + test_file(GPLATE_FILE_VARIABLE(file), filename);
    +
    + g_free(filename);
    +END_TEST
    +
    +START_TEST(test_file_does_not_exist)
    + const gchar *filename = "non-existant file";
    +
    + file = gplate_file_variable_new("file", filename);
    +
    + fail_unless(file != NULL,
    + "We should not have been able to create a GPlateFileVariable "
    + "instance for '%s'\n",
    + filename);
    +END_TEST
    +
    +/******************************************************************************
    + * API
    + *****************************************************************************/
    +Suite *
    +file_variable_suite(void) {
    + Suite *s = suite_create("File Variable Suite");
    + TCase *tc = NULL;
    +
    + /* object heirarchy */
    + tc = tcase_create("Object hierarchy");
    +
    + tcase_add_checked_fixture(tc, object_hierarchy_setup, common_teardown);
    +
    + tcase_add_test(tc, test_file_hierarchy_type);
    + tcase_add_test(tc, test_file_hierarchy_parent);
    + tcase_add_test(tc, test_file_hierarchy_grandparent);
    + tcase_add_test(tc, test_file_hierarchy_collection);
    +
    + suite_add_tcase(s, tc);
    +
    + /* file tests */
    + tc = tcase_create("File Tests");
    +
    + tcase_add_checked_fixture(tc, NULL, common_teardown);
    +
    + tcase_add_test(tc, test_file_normal);
    + tcase_add_test(tc, test_file_does_not_exist);
    +
    + suite_add_tcase(s, tc);
    +
    + return s;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/test-gplate-collection-interface.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,35 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +#include <glib.h>
    +
    +/******************************************************************************
    + * Main
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/test-gplate-utility-functions.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,60 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplate/gplate.h>
    +
    +static void
    +gplate_util_test_quoted_string_helper(const gchar *string,
    + const gchar *contents, gboolean value)
    +{
    + gboolean r = FALSE;
    + gchar *c = NULL;
    +
    + r = gplate_util_is_quoted_string(string, &c);
    + g_assert_cmpint(r, ==, value);
    +
    + if(contents)
    + g_assert_cmpstr(c, ==, contents);
    +
    + g_free(c);
    +}
    +
    +static void
    +gplate_util_test_quoted_string(void) {
    + gplate_util_test_quoted_string_helper("\"abc\"", "abc", TRUE);
    + gplate_util_test_quoted_string_helper("\"abc def\"", "abc def", TRUE);
    + gplate_util_test_quoted_string_helper("\"abc\tdef\bghi\"", "abc\tdef\bghi", TRUE);
    + gplate_util_test_quoted_string_helper("abc \"def\"", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("\"abc\" def", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("'abc'", "abc", TRUE);
    + gplate_util_test_quoted_string_helper("'abc def'", "abc def", TRUE);
    + gplate_util_test_quoted_string_helper("'abc\tdef\bghi'", "abc\tdef\bghi", TRUE);
    + gplate_util_test_quoted_string_helper("abc 'def'", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("'abc' def", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("'abc\"", NULL, FALSE);
    + gplate_util_test_quoted_string_helper("\"abc'", NULL, FALSE);
    +}
    +
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_test_add_func("/util/quoted_string", gplate_util_test_quoted_string);
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/test-gplate.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,39 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include <glib.h>
    +
    +#include <gplate.h>
    +
    +#include "tags/test-gplate-tag.h"
    +
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + g_type_init();
    +
    + gplate_config_load_default();
    +
    + test_gplate_functions_add_tests();
    + test_gplate_tag_add_tests();
    + test_gplate_variables_add_tests();
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/variables/CMakeLists.txt Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,13 @@
    +set(TEST_GPLATE_VARIABLES_HEADERS
    + test-gplate-variables.h
    +)
    +
    +set(TEST_GPLATE_VARIABLES_SOURCES
    + test-gplate-variables.c
    +)
    +
    +add_library(test-gplate-variables STATIC
    + ${TEST_GPLATE_VARIABLES_HEADERS}
    + ${TEST_GPLATE_VARIABLES_SOURCES}
    +)
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/variables/test-gplate-variables.c Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,112 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include <gplate/gplate.h>
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +#define gplate_variable_test_value(v, expected) \
    + G_STMT_START { \
    + g_assert_cmpstr(gplate_variable_get_value((v)), ==, (expected)); \
    + g_object_unref(G_OBJECT((v))); \
    + } G_STMT_END
    +
    +#define gplate_variable_test_from_string_helper(input, output) \
    + G_STMT_START { \
    + GPlateVariable *v = gplate_variable_new_from_string("test", (input)); \
    + gplate_variable_test_value(v, (output)); \
    + } G_STMT_END
    +
    +static void
    +gplate_variable_test_from_string(void) {
    + gplate_variable_test_from_string_helper(NULL, NULL);
    + gplate_variable_test_from_string_helper("", "");
    + gplate_variable_test_from_string_helper(
    + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
    + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
    + gplate_variable_test_from_string_helper("☀☁☂☃☄", "☀☁☂☃☄");
    +}
    +
    +#define gplate_variable_test_from_boolean_helper(input, output) \
    + G_STMT_START { \
    + GPlateVariable *v = gplate_variable_new_from_boolean("test", (input)); \
    + gplate_variable_test_value(v, (output)); \
    + } G_STMT_END
    +
    +static void
    +gplate_variable_test_from_boolean(void) {
    + gplate_variable_test_from_boolean_helper(TRUE, "TRUE");
    + gplate_variable_test_from_boolean_helper(FALSE, "FALSE");
    +}
    +
    +#define gplate_variable_test_from_integer_helper(input, output) \
    + G_STMT_START { \
    + GPlateVariable *v = gplate_variable_new_from_integer("test", (input)); \
    + gplate_variable_test_value(v, (output)); \
    + } G_STMT_END
    +
    +static void
    +gplate_variable_test_from_integer(void) {
    + gplate_variable_test_from_integer_helper(-1, "-1");
    + gplate_variable_test_from_integer_helper(0, "0");
    + gplate_variable_test_from_integer_helper(1, "1");
    +}
    +
    +#define gplate_variable_test_from_float_helper(input, output) \
    + G_STMT_START { \
    + GPlateVariable *v = gplate_variable_new_from_float("test", (input)); \
    + gplate_variable_test_value(v, (output)); \
    + } G_STMT_END
    +
    +static void
    +gplate_variable_test_from_float(void) {
    + gplate_variable_test_from_float_helper(-1.0f, "-1.000000");
    + gplate_variable_test_from_float_helper(-0.5f, "-0.500000");
    + gplate_variable_test_from_float_helper(0.0f, "0.000000");
    + gplate_variable_test_from_float_helper(0.5f, "0.500000");
    + gplate_variable_test_from_float_helper(1.0f, "1.000000");
    +}
    +
    +#define gplate_variable_test_from_double_helper(input, output) \
    + G_STMT_START { \
    + GPlateVariable *v = gplate_variable_new_from_double("test", (input)); \
    + gplate_variable_test_value(v, (output)); \
    + } G_STMT_END
    +
    +static void
    +gplate_variable_test_from_double(void) {
    + gplate_variable_test_from_double_helper(-1.0, "-1");
    + gplate_variable_test_from_double_helper(-0.5, "-0.5");
    + gplate_variable_test_from_double_helper(0.0, "0");
    + gplate_variable_test_from_double_helper(0.5, "0.5");
    + gplate_variable_test_from_double_helper(1.0, "1");
    +}
    +
    +/******************************************************************************
    + * MIZAN
    + *****************************************************************************/
    +void
    +test_gplate_variables_add_tests(void) {
    + g_test_add_func("/variable/from_string", gplate_variable_test_from_string);
    + g_test_add_func("/variable/from_boolean", gplate_variable_test_from_boolean);
    + g_test_add_func("/variable/from_integer", gplate_variable_test_from_integer);
    + g_test_add_func("/variable/from_float", gplate_variable_test_from_float);
    + g_test_add_func("/variable/from_double", gplate_variable_test_from_double);
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplate/tests/variables/test-gplate-variables.h Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,30 @@
    +/*
    + * GPlate - GObject based templating library
    + * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    + *
    + * 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 3 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, see <http://www.gnu.org/licenses/>.
    + */
    +#ifndef TEST_GPLATE_VARIABLES_H
    +#define TEST_GPLATE_VARIABLES_H
    +
    +#include <glib.h>
    +
    +G_BEGIN_DECLS
    +
    +void test_gplate_variables_add_tests(void);
    +
    +G_END_DECLS
    +
    +#endif /* TEST_GPLATE_VARIABLES_H */
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/meson.build Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,79 @@
    +project('gplate', 'C',
    + license : 'LGPL-2.0-or-later',
    + version : '0.0.3-dev',
    + meson_version : '>=0.63.0',
    + default_options : ['c_std=c17', 'warning_level=2'])
    +
    +###############################################################################
    +# Version Stuff
    +###############################################################################
    +gplate_soversion = 0
    +
    +parts = meson.project_version().split('-')
    +if parts.length() > 1
    + gplate_extra_version = parts[1]
    +else
    + gplate_extra_version = ''
    +endif
    +
    +parts = parts[0].split('.')
    +gplate_major_version = parts[0]
    +gplate_minor_version = parts[1]
    +gplate_micro_version = parts[2]
    +
    +GPLATE_VERSION = '@0@.@1@.@2@'.format(gplate_soversion,
    + gplate_minor_version,
    + gplate_micro_version)
    +
    +version_conf = configuration_data()
    +version_conf.set('GPLATE_MAJOR_VERSION', gplate_major_version)
    +version_conf.set('GPLATE_MINOR_VERSION', gplate_minor_version)
    +version_conf.set('GPLATE_MICRO_VERSION', gplate_micro_version)
    +version_conf.set('GPLATE_EXTRA_VERSION', gplate_extra_version)
    +version_conf.set('GPLATE_VERSION', meson.project_version())
    +version_conf.set('GPLATE_API_VERSION', gplate_soversion)
    +
    +###############################################################################
    +# Module imports
    +###############################################################################
    +gnome = import('gnome')
    +pkgconfig = import('pkgconfig')
    +
    +###############################################################################
    +# Basic Variables
    +###############################################################################
    +toplevel_inc = include_directories('.')
    +
    +###############################################################################
    +# Main Dependencies
    +###############################################################################
    +GLIB = dependency('glib-2.0', version : '>=2.70.0')
    +add_project_arguments(
    + '-D_GNU_SOURCE',
    + '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_70',
    + '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_70',
    + language : 'c',
    +)
    +
    +GOBJECT = dependency('gobject-2.0')
    +
    +###############################################################################
    +# Documentation
    +###############################################################################
    +if get_option('doc') and not get_option('introspection')
    + error('Documentation requires GObject Introspection.')
    +endif
    +
    +gidocgen_dep = dependency(
    + 'gi-docgen', version: '>= 2021.1',
    + fallback: ['gi-docgen', 'dummy_dep'],
    + required: get_option('doc')
    +)
    +
    +gidocgen = find_program('gi-docgen', required : get_option('doc'))
    +docs_dir = get_option('prefix') / get_option('datadir') / 'doc'
    +
    +###############################################################################
    +# Subdirectories
    +###############################################################################
    +subdir('gplate')
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/meson_options.txt Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,5 @@
    +option('doc', type : 'boolean', value : false,
    + description : 'build documentation')
    +
    +option('introspection', type : 'boolean', value : true,
    + description : 'build introspection data')
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/subprojects/gi-docgen.wrap Sat Mar 04 11:27:30 2023 -0600
    @@ -0,0 +1,5 @@
    +[wrap-file]
    +directory = gi-docgen-2023.1
    +source_url = https://download.gnome.org/sources/gi-docgen/2023/gi-docgen-2023.1.tar.xz
    +source_filename = gi-docgen-2023.1.tar.xz
    +source_hash = a9a687c1b7c4a4139a214bd451e01ca86131a3161f68aa3e07325b06002bbfb6
    --- a/tests/CMakeLists.txt Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,29 +0,0 @@
    -add_definitions(
    - -DTEST_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
    -)
    -
    -add_subdirectory(functions)
    -add_subdirectory(tags)
    -add_subdirectory(variables)
    -
    -add_executable(test-gplate test-gplate.c)
    -
    -target_link_libraries(test-gplate
    - ${GLIB_LIBRARIES}
    - gplate
    - test-gplate-functions
    - test-gplate-tags
    - test-gplate-variables
    -)
    -
    -###############################################################################
    -# Main Target
    -###############################################################################
    -set(GTESTER_TESTS "${TESTS}")
    -set(GTESTER_LOG "testgplate.log")
    -
    -add_custom_target(tests ALL
    - COMMAND ${GTESTER} -k --verbose -o ${GTESTER_LOG} test-gplate
    - DEPENDS test-gplate
    -)
    -
    --- a/tests/functions/CMakeLists.txt Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,15 +0,0 @@
    -set(TEST_GPLATE_FUNCTIONS_HEADERS
    - test-gplate-functions.h
    -)
    -
    -set(TEST_GPLATE_FUNCTIONS_SOURCES
    - test-gplate-functions.c
    - test-gplate-for-function.c
    - test-gplate-include-function.c
    -)
    -
    -add_library(test-gplate-functions STATIC
    - ${TEST_GPLATE_FUNCTIONS_HEADERS}
    - ${TEST_GPLATE_FUNCTIONS_SOURCES}
    -)
    -
    --- a/tests/functions/test-gplate-for-function.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,181 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -#include <gplate/variables/gplate-dictionary-variable.h>
    -
    -#include <glib.h>
    -
    -/******************************************************************************
    - * Structs
    - *****************************************************************************/
    -typedef struct {
    - const gchar *name;
    - const gchar *value;
    -} TestGPlateForFunctionData;
    -
    -typedef struct {
    - GPlateTemplate *template;
    -
    - GPlateVariable *dict;
    -
    - const gchar *template_string;
    -
    - gchar *actual;
    - const gchar *expected;
    -
    - GError *error;
    -
    - TestGPlateForFunctionData *data;
    -} TestGPlateForFunctionFixture;
    -
    -/******************************************************************************
    - * Fixtures
    - *****************************************************************************/
    -static void
    -test_gplate_for_function_setup(TestGPlateForFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - fixture->template = gplate_template_new();
    - fixture->dict = gplate_dictionary_variable_new("list");
    -
    - gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    - fixture->dict);
    -}
    -
    -static void
    -test_gplate_for_function_teardown(TestGPlateForFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - g_object_unref(fixture->template);
    - fixture->template = NULL;
    -
    - g_object_unref(fixture->dict);
    - fixture->dict = NULL;
    -
    - g_free(fixture->actual);
    - fixture->actual = NULL;
    -
    - fixture->expected = NULL;
    -
    - if(fixture->error) {
    - g_error_free(fixture->error);
    - fixture->error = NULL;
    - }
    -}
    -
    -/******************************************************************************
    - * Helpers
    - *****************************************************************************/
    -static void
    -test_gplate_for_function(TestGPlateForFunctionFixture *fixture) {
    - gint i = 0;
    -
    - /* add the variables */
    - for(i = 0; fixture->data[i].name; i++) {
    - gplate_collection_add_string(fixture->dict,
    - fixture->data[i].name,
    - fixture->data[i].value);
    - }
    -
    - fixture->actual = gplate_template_render(fixture->template,
    - fixture->template_string,
    - &fixture->error);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    -/******************************************************************************
    - * Simple For's
    - *****************************************************************************/
    -static void
    -test_gplate_for_function_zero_elements(TestGPlateForFunctionFixture *fixture,
    - gconstpointer user_data)
    -{
    - TestGPlateForFunctionData data[] = {
    - { NULL, NULL },
    - };
    -
    - fixture->data = data;
    - fixture->template_string = "{% for in in line %}{{ i }}{% endfor %}";
    - fixture->expected = "";
    -
    - test_gplate_for_function(fixture);
    -}
    -
    -static void
    -test_gplate_for_function_one_element(TestGPlateForFunctionFixture *fixture,
    - gconstpointer user_data)
    -{
    - TestGPlateForFunctionData data[] = {
    - { "one", "1" },
    - { NULL, NULL },
    - };
    -
    - fixture->data = data;
    - fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    - fixture->expected = "1";
    -
    - test_gplate_for_function(fixture);
    -}
    -
    -static void
    -test_gplate_for_function_two_elements(TestGPlateForFunctionFixture *fixture,
    - gconstpointer user_data)
    -{
    - TestGPlateForFunctionData data[] = {
    - { "a", "A" },
    - { "b", "B" },
    - { NULL, NULL },
    - };
    -
    - fixture->data = data;
    - fixture->template_string = "{% for i in list %}{{ i }}{% endfor %}";
    - fixture->expected = "AB";
    -
    - test_gplate_for_function(fixture);
    -}
    -
    -/******************************************************************************
    - * Main!
    - *****************************************************************************/
    -void
    -test_gplate_for_function_add_tests(void) {
    - g_test_add("/functions/foo/zero_elements",
    - TestGPlateForFunctionFixture,
    - NULL,
    - test_gplate_for_function_setup,
    - test_gplate_for_function_zero_elements,
    - test_gplate_for_function_teardown);
    -
    - g_test_add("/functions/foo/one_element",
    - TestGPlateForFunctionFixture,
    - NULL,
    - test_gplate_for_function_setup,
    - test_gplate_for_function_one_element,
    - test_gplate_for_function_teardown);
    -
    - g_test_add("/functions/foo/two_elements",
    - TestGPlateForFunctionFixture,
    - NULL,
    - test_gplate_for_function_setup,
    - test_gplate_for_function_two_elements,
    - test_gplate_for_function_teardown);
    -}
    -
    --- a/tests/functions/test-gplate-functions.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,29 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -
    -#include "test-gplate-functions.h"
    -
    -/******************************************************************************
    - * API
    - *****************************************************************************/
    -void
    -test_gplate_functions_add_tests(void) {
    - test_gplate_for_function_add_tests();
    - test_gplate_include_function_add_tests();
    -}
    -
    --- a/tests/functions/test-gplate-functions.h Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,36 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#ifndef TEST_GPLATE_FUNCTIONS_H
    -#define TEST_GPLATE_FUNCTIONS_H
    -
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -G_BEGIN_DECLS
    -
    -void test_gplate_functions_add_tests(void);
    -
    -/* external prototypes */
    -void test_gplate_for_function_add_tests(void);
    -void test_gplate_include_function_add_tests(void);
    -
    -G_END_DECLS
    -
    -#endif /* TEST_GPLATE_FUNCTIONS_H */
    -
    --- a/tests/functions/test-gplate-include-function.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,132 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -/******************************************************************************
    - * Structs
    - *****************************************************************************/
    -typedef struct {
    - GPlateTemplate *template;
    -
    - const gchar *template_string;
    -
    - gchar *actual;
    - const gchar *expected;
    -
    - GError *error;
    -} TestGPlateIncludeFunctionFixture;
    -
    -/******************************************************************************
    - * Fixtures
    - *****************************************************************************/
    -static void
    -test_gplate_include_function_setup(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - fixture->template = gplate_template_new();
    -}
    -
    -static void
    -test_gplate_include_function_teardown(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer d)
    -{
    - g_object_unref(fixture->template);
    - fixture->template = NULL;
    -
    - g_free(fixture->actual);
    - fixture->actual = NULL;
    -
    - fixture->expected = NULL;
    -
    - if(fixture->error) {
    - g_error_free(fixture->error);
    - fixture->error = NULL;
    - }
    -}
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_include_function_simple(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer data)
    -{
    - gchar *path = NULL;
    -
    - fixture->expected = "including\nincluded!\n\ndone\n\n";
    -
    - path = g_build_filename(TEST_DIR, "templates", "simple.gplate", NULL);
    - fixture->actual = gplate_template_render_file(fixture->template,
    - path,
    - &fixture->error);
    - g_free(path);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    -static void
    -test_gplate_include_function_double(TestGPlateIncludeFunctionFixture *fixture,
    - gconstpointer data)
    -{
    - gchar *path = NULL;
    -
    - fixture->expected = "\
    -<html>\n\
    - <head>\n\
    - <title>test</title>\n\
    - </head>\n\
    - <body>\n\
    -in the body\
    - </body>\n\
    -</html>\n\n";
    -
    - path = g_build_filename(TEST_DIR, "templates", "html.gplate", NULL);
    - fixture->actual = gplate_template_render_file(fixture->template,
    - path,
    - &fixture->error);
    - g_free(path);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    -/******************************************************************************
    - * Main!
    - *****************************************************************************/
    -void
    -test_gplate_include_function_add_tests(void) {
    - g_test_add("/functions/include/simple",
    - TestGPlateIncludeFunctionFixture,
    - NULL,
    - test_gplate_include_function_setup,
    - test_gplate_include_function_simple,
    - test_gplate_include_function_teardown);
    -
    - g_test_add("/functions/include/double",
    - TestGPlateIncludeFunctionFixture,
    - NULL,
    - test_gplate_include_function_setup,
    - test_gplate_include_function_double,
    - test_gplate_include_function_teardown);
    -}
    -
    --- a/tests/tags/CMakeLists.txt Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,16 +0,0 @@
    -set(TEST_GPLATE_TAGS_HEADERS
    - test-gplate-tag.h
    -)
    -
    -set(TEST_GPLATE_TAGS_SOURCES
    - test-gplate-tag.c
    - test-gplate-comment-tag.c
    - test-gplate-text-tag.c
    - test-gplate-variable-tag.c
    -)
    -
    -add_library(test-gplate-tags STATIC
    - ${TEST_GPLATE_TAGS_HEADERS}
    - ${TEST_GPLATE_TAGS_SOURCES}
    -)
    -
    --- a/tests/tags/test-gplate-comment-tag.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,74 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#include "test-gplate-tag.h"
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_comment_tag_empty(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data, "{##}", "");
    -}
    -
    -static void
    -test_gplate_comment_tag_whitespace(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data, "{# #}", "");
    - test_gplate_tag_output(fixture, data, "{#\t#}", "");
    - test_gplate_tag_output(fixture, data, "{#\n#}", "");
    - test_gplate_tag_output(fixture, data, "{#\r#}", "");
    - test_gplate_tag_output(fixture, data, "{#\r\n#}", "");
    - test_gplate_tag_output(fixture, data, "{#\n\r#}", "");
    -}
    -
    -static void
    -test_gplate_comment_tag_simple(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data, "{# foo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo #}", "");
    - test_gplate_tag_output(fixture, data, "{#\tfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\t#}", "");
    - test_gplate_tag_output(fixture, data, "{#\nfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\n#}", "");
    - test_gplate_tag_output(fixture, data, "{#\rfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\r#}", "");
    - test_gplate_tag_output(fixture, data, "{#\r\nfoo#}", "");
    - test_gplate_tag_output(fixture, data, "{#foo\r\n#}", "");
    -}
    -
    -/******************************************************************************
    - * Main
    - *****************************************************************************/
    -void
    -test_gplate_comment_tag_add_tests(void) {
    - test_gplate_tag_add("/tags/comment/empty",
    - test_gplate_comment_tag_empty);
    - test_gplate_tag_add("/tags/comment/whitespace",
    - test_gplate_comment_tag_whitespace);
    - test_gplate_tag_add("/tags/comment/simple",
    - test_gplate_comment_tag_simple);
    -}
    -
    --- a/tests/tags/test-gplate-tag.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,73 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include "test-gplate-tag.h"
    -
    -/******************************************************************************
    - * Fixtures
    - *****************************************************************************/
    -void
    -test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data) {
    - gplate_config_load_default();
    -
    - fixture->template = gplate_template_new();
    -}
    -
    -void
    -test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data) {
    - g_object_unref(fixture->template);
    - fixture->template = NULL;
    -
    - if(fixture->error) {
    - g_error_free(fixture->error);
    - fixture->error = NULL;
    - }
    -
    - g_free(fixture->actual);
    - fixture->actual = NULL;
    -}
    -
    -/******************************************************************************
    - * Simple Tests
    - *****************************************************************************/
    -void
    -test_gplate_tag_output(TestGPlateTagFixture *fixture,
    - gconstpointer data,
    - const gchar *template_string,
    - const gchar *expected)
    -{
    - fixture->template_string = template_string;
    - fixture->expected = expected;
    -
    - fixture->actual = gplate_template_render(fixture->template,
    - fixture->template_string,
    - &fixture->error);
    -
    - g_assert(fixture->error == NULL);
    -
    - g_assert_cmpstr(fixture->expected, ==, fixture->actual);
    -}
    -
    -/******************************************************************************
    - * API
    - *****************************************************************************/
    -void
    -test_gplate_tag_add_tests(void) {
    - test_gplate_text_tag_add_tests();
    - test_gplate_variable_tag_add_tests();
    -}
    -
    --- a/tests/tags/test-gplate-tag.h Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,58 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#ifndef TEST_GPLATE_TAG_H
    -#define TEST_GPLATE_TAG_H
    -
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#define test_gplate_tag_add(path, func) \
    - g_test_add((path), TestGPlateTagFixture, NULL, test_gplate_tag_setup, (func), test_gplate_tag_teardown)
    -
    -typedef struct _TestGPlateTagFixture TestGPlateTagFixture;
    -
    -typedef void (*TestGPlateTagFixtureFunc)(TestGPlateTagFixture *fixture, gconstpointer data);
    -
    -struct _TestGPlateTagFixture {
    - GPlateTemplate *template;
    - GError *error;
    -
    - const gchar *template_string;
    -
    - const gchar *expected;
    - gchar *actual;
    -};
    -
    -G_BEGIN_DECLS
    -
    -void test_gplate_tag_setup(TestGPlateTagFixture *fixture, gconstpointer data);
    -void test_gplate_tag_teardown(TestGPlateTagFixture *fixture, gconstpointer data);
    -void test_gplate_tag_output(TestGPlateTagFixture *fixture, gconstpointer data, const gchar *template_string, const gchar *expected);
    -
    -void test_gplate_tag_add_tests(void);
    -
    -/* external prototypes */
    -void test_gplate_comment_tag_add_tests(void);
    -void test_gplate_text_tag_add_tests(void);
    -void test_gplate_variable_tag_add_tests(void);
    -
    -G_END_DECLS
    -
    -#endif /* TEST_GPLATE_TAG_H */
    -
    --- a/tests/tags/test-gplate-text-tag.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,63 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#include "test-gplate-tag.h"
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_text_tag_syntax_plain(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data,
    - "simple template", "simple template");
    -}
    -
    -static void
    -test_gplate_text_tag_syntax_keywords(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data,
    - "extends if else endif for endfor",
    - "extends if else endif for endfor");
    -}
    -
    -static void
    -test_gplate_text_tag_syntax_keywords_case_sensitive(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_tag_output(fixture, data,
    - "EXteNds iF eLse enDif fOr enDFor",
    - "EXteNds iF eLse enDif fOr enDFor");
    -}
    -
    -
    -void
    -test_gplate_text_tag_add_tests(void) {
    - test_gplate_tag_add("/tags/text/plain",
    - test_gplate_text_tag_syntax_plain);
    - test_gplate_tag_add("/tags/text/keywords",
    - test_gplate_text_tag_syntax_keywords);
    - test_gplate_tag_add("/tags/text/keywords_case_sensitive",
    - test_gplate_text_tag_syntax_keywords_case_sensitive);
    -}
    -
    --- a/tests/tags/test-gplate-variable-tag.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,232 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -#include "test-gplate-tag.h"
    -
    -/******************************************************************************
    - * Helpers
    - *****************************************************************************/
    -static void
    -test_gplate_variable_tag(TestGPlateTagFixture *fixture, gconstpointer data,
    - const gchar *template_string, const gchar *expected,
    - ...)
    -{
    - va_list vargs;
    - const gchar *name = NULL, *value = NULL;
    -
    - va_start(vargs, expected);
    - while((name = va_arg(vargs, const gchar *))) {
    - value = va_arg(vargs, const gchar *);
    -
    - gplate_collection_add_string(GPLATE_COLLECTION(fixture->template),
    - name, value);
    - }
    - va_end(vargs);
    -
    - test_gplate_tag_output(fixture, data, template_string, expected);
    -}
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -static void
    -test_gplate_variable_tag_single(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{ foo }}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_double(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{ foo }}{{ bar }}", "foobar",
    - "foo", "foo",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_tripple(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{ foo }}{{ bar }}{{ baz }}", "foobarbaz",
    - "foo", "foo",
    - "bar", "bar",
    - "baz", "baz",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_newline_prefix(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{\nfoo}}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_newline_suffix(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{foo\n}}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_newline_wrapped(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "{{\nfoo\n}}", "foo",
    - "foo", "foo",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_single_quotes(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "foo '{{ bar }}' baz", "foo 'bar' baz",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_double_quotes(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "foo \"{{ bar }}\" baz", "foo \"bar\" baz",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_mixed_quotes(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "foo \"{{ bar }}' baz", "foo \"bar' baz",
    - "bar", "bar",
    - NULL);
    -
    - test_gplate_variable_tag(fixture, data,
    - "foo '{{ bar }}\" baz", "foo 'bar\" baz",
    - "bar", "bar",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_two_vars_one_block(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - test_gplate_variable_tag(fixture, data,
    - "one {{ two five }} three",
    - "one 2 three",
    - "two", "2",
    - "five", "5",
    - NULL);
    -}
    -
    -static void
    -test_gplate_variable_tag_nested_single(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - GPlateVariable *dict = gplate_dictionary_variable_new("foo");
    -
    - gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    - dict);
    -
    - gplate_collection_add_string(GPLATE_COLLECTION(dict),
    - "bar", "baz");
    -
    - test_gplate_tag_output(fixture, data, "{{ foo.bar }}", "baz");
    -}
    -
    -static void
    -test_gplate_variable_tag_nested_double(TestGPlateTagFixture *fixture,
    - gconstpointer data)
    -{
    - GPlateVariable *dict1 = gplate_dictionary_variable_new("foo");
    - GPlateVariable *dict2 = gplate_dictionary_variable_new("bar");
    -
    - gplate_collection_add_variable(GPLATE_COLLECTION(fixture->template),
    - dict1);
    - gplate_collection_add_variable(GPLATE_COLLECTION(dict1), dict2);
    - gplate_collection_add_string(GPLATE_COLLECTION(dict2),
    - "baz", "42");
    -
    - test_gplate_tag_output(fixture, data, "{{ foo.bar.baz }}", "42");
    -}
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -void
    -test_gplate_variable_tag_add_tests(void) {
    - test_gplate_tag_add("/tags/variable/single",
    - test_gplate_variable_tag_single);
    -
    - test_gplate_tag_add("/tags/variable/double",
    - test_gplate_variable_tag_double);
    -
    - test_gplate_tag_add("/tags/variable/tripple",
    - test_gplate_variable_tag_tripple);
    -
    - test_gplate_tag_add("/tags/variable/newline_prefix",
    - test_gplate_variable_tag_newline_prefix);
    -
    - test_gplate_tag_add("/tags/variable/newline_suffix",
    - test_gplate_variable_tag_newline_suffix);
    -
    - test_gplate_tag_add("/tags/variable/newline_wrapped",
    - test_gplate_variable_tag_newline_wrapped);
    -
    - test_gplate_tag_add("/tags/variable/quotes/single",
    - test_gplate_variable_tag_single_quotes);
    -
    - test_gplate_tag_add("/tags/variable/quotes/double",
    - test_gplate_variable_tag_double_quotes);
    -
    - test_gplate_tag_add("/tags/variable/quotes/mixed",
    - test_gplate_variable_tag_mixed_quotes);
    -
    - test_gplate_tag_add("/tags/variable/two_vars_one_block",
    - test_gplate_variable_tag_two_vars_one_block);
    -
    - test_gplate_tag_add("/tags/variable/nested/single",
    - test_gplate_variable_tag_nested_single);
    -
    - test_gplate_tag_add("/tags/variable/nested/double",
    - test_gplate_variable_tag_nested_double);
    -}
    -
    --- a/tests/templates/footer.gplate Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,2 +0,0 @@
    - </body>
    -</html>
    --- a/tests/templates/header.gplate Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,5 +0,0 @@
    -<html>
    - <head>
    - <title>test</title>
    - </head>
    - <body>
    --- a/tests/templates/html.gplate Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,1 +0,0 @@
    -{% include "header.gplate" %}in the body{% include "footer.gplate" %}
    --- a/tests/templates/simple-include.gplate Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,1 +0,0 @@
    -included!
    --- a/tests/templates/simple.gplate Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,4 +0,0 @@
    -including
    -{% include "simple-include.gplate" %}
    -done
    -
    --- a/tests/test-collection.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,29 +0,0 @@
    -#include "test-collection.h"
    -
    -#include "test.h"
    -
    -void
    -test_collection_lookup(GPlateCollection *collection, const gchar *name,
    - const gchar *expected)
    -{
    - const gchar *v = NULL;
    -
    - v = gplate_collection_lookup(collection, name);
    -
    - test_string(expected, v);
    -}
    -
    -void
    -test_collection_lookup_int(GPlateCollection *collection, const gchar *name,
    - gint expected)
    -{
    - const gchar *v = NULL;
    - gchar *e = NULL;
    -
    - v = gplate_collection_lookup(collection, name);
    -
    - e = g_strdup_printf("%d", expected);
    -
    - test_string(e, v);
    - g_free(e);
    -}
    --- a/tests/test-dictionary-variable.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,255 +0,0 @@
    -#ifdef HAVE_CONFIG_H
    -# include <config.h>
    -#endif /* HAVE_CONFIG_H */
    -
    -#include <check.h>
    -
    -#include <gplate/gplate.h>
    -
    -#include "test.h"
    -#include "test-collection.h"
    -#include "test-object.h"
    -
    -/******************************************************************************
    - * Structs
    - *****************************************************************************/
    -typedef struct {
    - const gchar *name;
    - const gchar *value;
    -} VariableData;
    -
    -/******************************************************************************
    - * Globals
    - *****************************************************************************/
    -static GPlateVariable *dict = NULL;
    -static GPlateIterator *iter = NULL;
    -
    -/******************************************************************************
    - * Helpers
    - *****************************************************************************/
    -static void
    -iterator_test(VariableData *vd) {
    - gint i = 0, count = 0;
    -
    - /* add all the values and make sure they got entered correctly */
    - for(i = 0, count = 0; vd[i].name; i++, count++) {
    - gplate_collection_add_string(dict, vd[i].name, vd[i].value);
    - test_collection_lookup(GPLATE_COLLECTION(dict),
    - vd[i].name, vd[i].value);
    - }
    -
    - i = 0;
    -
    - iter = gplate_collection_get_iterator(GPLATE_COLLECTION(dict));
    - while(gplate_iterator_has_next(iter)) {
    - GPlateVariable *var = gplate_iterator_next(iter);
    - const gchar *value = gplate_variable_get_value(var);
    -
    - test_string(vd[i++].value, value);
    - }
    -
    - fail_unless(i == count, "Iterated over %d/%d elements.", i, count);
    -}
    -
    -/******************************************************************************
    - * Fixtures
    - *****************************************************************************/
    -static void
    -collection_interface_setup(void) {
    - dict = gplate_dictionary_variable_new("dict");
    -}
    -
    -static void
    -collection_interface_teardown(void) {
    - g_object_unref(G_OBJECT(dict));
    -
    - if(iter) {
    - g_object_unref(G_OBJECT(iter));
    - iter = NULL;
    - }
    -}
    -
    -/******************************************************************************
    - * Object Hierarchy Tests
    - *****************************************************************************/
    -START_TEST(test_dictionary_hierarchy_type)
    - test_object_is_a(G_OBJECT(dict), GPLATE_TYPE_DICTIONARY_VARIABLE);
    -END_TEST
    -
    -START_TEST(test_dictionary_hierarchy_parent)
    - test_object_is_a(G_OBJECT(dict), GPLATE_TYPE_VARIABLE);
    -END_TEST
    -
    -START_TEST(test_dictionary_hierarchy_collection)
    - test_object_is_a(G_OBJECT(dict), GPLATE_TYPE_COLLECTION);
    -END_TEST
    -
    -/******************************************************************************
    - * Collection Interface Tests
    - *****************************************************************************/
    -START_TEST(test_dictionary_add_string_null)
    - gplate_collection_add_string(dict, "null", NULL);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "null", NULL);
    -END_TEST
    -
    -START_TEST(test_dictionary_add_string_empty)
    - gplate_collection_add_string(dict, "empty", "");
    - test_collection_lookup(GPLATE_COLLECTION(dict), "empty", "");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_string)
    - gplate_collection_add_string(dict, "string", "string");
    - test_collection_lookup(GPLATE_COLLECTION(dict), "string", "string");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_boolean_true)
    - gplate_collection_add_boolean(dict, "true", TRUE);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "true", "TRUE");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_boolean_false)
    - gplate_collection_add_boolean(dict, "false", FALSE);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "false", "FALSE");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_float_positive)
    - gplate_collection_add_float(dict, "pi", 3.14f);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "pi", "3.140000");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_float_positive_whole)
    - gplate_collection_add_float(dict, "three", 3.0f);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "three", "3.000000");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_float_negative)
    - gplate_collection_add_float(dict, "negativepi", -3.14f);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "negativepi", "-3.140000");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_float_negative_whole)
    - gplate_collection_add_float(dict, "negativethree", -3.0f);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "negativethree", "-3.000000");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_double_positive)
    - gplate_collection_add_double(dict, "e", 2.71);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "e", "2.71");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_double_positive_whole)
    - gplate_collection_add_double(dict, "two", 2.0);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "two", "2");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_double_negative)
    - gplate_collection_add_double(dict, "negativee", -2.71);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "negativee", "-2.71");
    -END_TEST
    -
    -START_TEST(test_dictionary_add_double_negative_whole)
    - gplate_collection_add_double(dict, "negativetwo", -2.0);
    - test_collection_lookup(GPLATE_COLLECTION(dict), "negativetwo", "-2");
    -END_TEST
    -
    -START_TEST(test_dictionary_nested)
    - GPlateVariable *nested = gplate_dictionary_variable_new("nested");
    -
    - gplate_collection_add_variable(GPLATE_COLLECTION(dict), nested);
    -
    - gplate_collection_add_string(GPLATE_COLLECTION(nested), "nestedstring",
    - "nested");
    -
    - test_collection_lookup(GPLATE_COLLECTION(dict), "nested.nestedstring",
    - "nested");
    -END_TEST
    -
    -START_TEST(test_dictionary_iterator_empty)
    - VariableData vd[] = {
    - { NULL, NULL },
    - };
    -
    - iterator_test(vd);
    -END_TEST
    -
    -START_TEST(test_dictionary_iterator_one_element)
    - VariableData vd[] = {
    - { "one", "1" },
    - { NULL, NULL },
    - };
    -
    - iterator_test(vd);
    -END_TEST
    -
    -START_TEST(test_dictionary_iterator_many_elements_sorted)
    - VariableData vd[] = {
    - { "eight", "8" },
    - { "five", "5" },
    - { "four", "4" },
    - { "nine", "9" },
    - { "one", "1" },
    - { "seven", "7" },
    - { "six", "6" },
    - { "ten", "10" },
    - { "three", "3" },
    - { "two", "2" },
    - { NULL, NULL },
    - };
    -
    - iterator_test(vd);
    -END_TEST
    -
    -/******************************************************************************
    - * API
    - *****************************************************************************/
    -Suite *
    -dictionary_variable_suite(void) {
    - Suite *s = suite_create("Dictionary Variable Suite");
    - TCase *tc = NULL;
    -
    - /* object heirarchy */
    - tc = tcase_create("Object hierarchy");
    -
    - tcase_add_checked_fixture(tc, collection_interface_setup,
    - collection_interface_teardown);
    -
    - tcase_add_test(tc, test_dictionary_hierarchy_type);
    - tcase_add_test(tc, test_dictionary_hierarchy_parent);
    - tcase_add_test(tc, test_dictionary_hierarchy_collection);
    -
    - suite_add_tcase(s, tc);
    -
    - /* collection interface */
    - tc = tcase_create("Collection Interface");
    -
    - tcase_add_checked_fixture(tc, collection_interface_setup,
    - collection_interface_teardown);
    -
    - tcase_add_test(tc, test_dictionary_add_string_null);
    - tcase_add_test(tc, test_dictionary_add_string_empty);
    - tcase_add_test(tc, test_dictionary_add_string);
    -
    - tcase_add_test(tc, test_dictionary_add_boolean_true);
    - tcase_add_test(tc, test_dictionary_add_boolean_false);
    -
    - tcase_add_test(tc, test_dictionary_add_float_positive);
    - tcase_add_test(tc, test_dictionary_add_float_positive_whole);
    - tcase_add_test(tc, test_dictionary_add_float_negative);
    - tcase_add_test(tc, test_dictionary_add_float_negative_whole);
    -
    - tcase_add_test(tc, test_dictionary_add_double_positive);
    - tcase_add_test(tc, test_dictionary_add_double_positive_whole);
    - tcase_add_test(tc, test_dictionary_add_double_negative);
    - tcase_add_test(tc, test_dictionary_add_double_negative_whole);
    -
    - tcase_add_test(tc, test_dictionary_nested);
    -
    - tcase_add_test(tc, test_dictionary_iterator_empty);
    - tcase_add_test(tc, test_dictionary_iterator_one_element);
    - tcase_add_test(tc, test_dictionary_iterator_many_elements_sorted);
    -
    - suite_add_tcase(s, tc);
    -
    - return s;
    -}
    -
    --- a/tests/test-file-variable.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,179 +0,0 @@
    -#ifdef HAVE_CONFIG_H
    -# include <config.h>
    -#endif /* HAVE_CONFIG_H */
    -
    -#include <check.h>
    -
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -#include <glib/gstdio.h>
    -
    -#include <stdlib.h>
    -#include <string.h>
    -#include <unistd.h>
    -
    -#include "test.h"
    -#include "test-collection.h"
    -#include "test-object.h"
    -
    -/******************************************************************************
    - * Globals
    - *****************************************************************************/
    -static GPlateVariable *file = NULL;
    -
    -/******************************************************************************
    - * Helpers
    - *****************************************************************************/
    -static gchar *
    -create_temp_file(void) {
    - gint fd = 0;
    - gchar *filename = NULL;
    -
    - fd = g_file_open_tmp("gplate-test-XXXXXX", &filename, NULL);
    -
    - fail_unless(fd >= 0);
    -
    - /* close the fd, basically we just did a touch ;) */
    - close(fd);
    -
    - return filename;
    -}
    -
    -static void
    -test_file(GPlateFileVariable *file, const gchar *filename) {
    - GPlateCollection *c = GPLATE_COLLECTION(file);
    - struct stat st;
    - gint r = 0;
    -
    - test_collection_lookup(c, "filename", filename);
    -
    - /* do a g_stat on the file */
    - r = g_lstat(filename, &st);
    -
    - fail_unless(r == 0, "Failed to stat '%s'", filename);
    -
    - /* now run through and compare all of the values */
    - test_collection_lookup_int(c, "dev", st.st_dev);
    - test_collection_lookup_int(c, "inode", st.st_ino);
    - test_collection_lookup_int(c, "mode", st.st_mode);
    - test_collection_lookup_int(c, "nlink", st.st_nlink);
    - test_collection_lookup_int(c, "uid", st.st_uid);
    - test_collection_lookup_int(c, "gid", st.st_gid);
    - test_collection_lookup_int(c, "rdev", st.st_rdev);
    - test_collection_lookup_int(c, "size", st.st_size);
    - test_collection_lookup_int(c, "blocksize", st.st_blksize);
    - test_collection_lookup_int(c, "blocks", st.st_blocks);
    - test_collection_lookup_int(c, "atime", st.st_atime);
    - test_collection_lookup_int(c, "mtime", st.st_mtime);
    - test_collection_lookup_int(c, "ctime", st.st_ctime);
    -}
    -
    -/******************************************************************************
    - * Fixtures
    - *****************************************************************************/
    -static void
    -object_hierarchy_setup(void) {
    - gchar *filename = create_temp_file();
    -
    - file = gplate_file_variable_new("file", filename);
    - g_free(filename);
    -}
    -
    -static void
    -common_teardown(void) {
    - if(G_IS_OBJECT(file)) {
    - GPlateCollection *c = GPLATE_COLLECTION(file);
    - const gchar *filename = NULL;
    -
    - filename = gplate_collection_lookup(c, "filename");
    -
    - if(filename)
    - g_unlink(filename);
    -
    - g_object_unref(G_OBJECT(file));
    - }
    -
    - file = NULL;
    -}
    -
    -/******************************************************************************
    - * Object Hierarchy Tests
    - *****************************************************************************/
    -START_TEST(test_file_hierarchy_type)
    - test_object_is_a(G_OBJECT(file), GPLATE_TYPE_FILE_VARIABLE);
    -END_TEST
    -
    -START_TEST(test_file_hierarchy_parent)
    - test_object_is_a(G_OBJECT(file), GPLATE_TYPE_DICTIONARY_VARIABLE);
    -END_TEST
    -
    -START_TEST(test_file_hierarchy_grandparent)
    - test_object_is_a(G_OBJECT(file), GPLATE_TYPE_VARIABLE);
    -END_TEST
    -
    -START_TEST(test_file_hierarchy_collection)
    - test_object_is_a(G_OBJECT(file), GPLATE_TYPE_COLLECTION);
    -END_TEST
    -
    -/******************************************************************************
    - * File Tests
    - *****************************************************************************/
    -START_TEST(test_file_normal)
    - gchar *filename = create_temp_file();
    -
    - file = gplate_file_variable_new("file", filename);
    -
    - fail_unless(GPLATE_IS_FILE_VARIABLE(file),
    - "Failed to create a GPlateFileVariable instance for '%s'",
    - filename);
    -
    - test_file(GPLATE_FILE_VARIABLE(file), filename);
    -
    - g_free(filename);
    -END_TEST
    -
    -START_TEST(test_file_does_not_exist)
    - const gchar *filename = "non-existant file";
    -
    - file = gplate_file_variable_new("file", filename);
    -
    - fail_unless(file != NULL,
    - "We should not have been able to create a GPlateFileVariable "
    - "instance for '%s'\n",
    - filename);
    -END_TEST
    -
    -/******************************************************************************
    - * API
    - *****************************************************************************/
    -Suite *
    -file_variable_suite(void) {
    - Suite *s = suite_create("File Variable Suite");
    - TCase *tc = NULL;
    -
    - /* object heirarchy */
    - tc = tcase_create("Object hierarchy");
    -
    - tcase_add_checked_fixture(tc, object_hierarchy_setup, common_teardown);
    -
    - tcase_add_test(tc, test_file_hierarchy_type);
    - tcase_add_test(tc, test_file_hierarchy_parent);
    - tcase_add_test(tc, test_file_hierarchy_grandparent);
    - tcase_add_test(tc, test_file_hierarchy_collection);
    -
    - suite_add_tcase(s, tc);
    -
    - /* file tests */
    - tc = tcase_create("File Tests");
    -
    - tcase_add_checked_fixture(tc, NULL, common_teardown);
    -
    - tcase_add_test(tc, test_file_normal);
    - tcase_add_test(tc, test_file_does_not_exist);
    -
    - suite_add_tcase(s, tc);
    -
    - return s;
    -}
    -
    --- a/tests/test-gplate-collection-interface.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,35 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -#include <glib.h>
    -
    -/******************************************************************************
    - * Main
    - *****************************************************************************/
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - return g_test_run();
    -}
    -
    --- a/tests/test-gplate-utility-functions.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,60 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#include <gplate/gplate.h>
    -
    -static void
    -gplate_util_test_quoted_string_helper(const gchar *string,
    - const gchar *contents, gboolean value)
    -{
    - gboolean r = FALSE;
    - gchar *c = NULL;
    -
    - r = gplate_util_is_quoted_string(string, &c);
    - g_assert_cmpint(r, ==, value);
    -
    - if(contents)
    - g_assert_cmpstr(c, ==, contents);
    -
    - g_free(c);
    -}
    -
    -static void
    -gplate_util_test_quoted_string(void) {
    - gplate_util_test_quoted_string_helper("\"abc\"", "abc", TRUE);
    - gplate_util_test_quoted_string_helper("\"abc def\"", "abc def", TRUE);
    - gplate_util_test_quoted_string_helper("\"abc\tdef\bghi\"", "abc\tdef\bghi", TRUE);
    - gplate_util_test_quoted_string_helper("abc \"def\"", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("\"abc\" def", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("'abc'", "abc", TRUE);
    - gplate_util_test_quoted_string_helper("'abc def'", "abc def", TRUE);
    - gplate_util_test_quoted_string_helper("'abc\tdef\bghi'", "abc\tdef\bghi", TRUE);
    - gplate_util_test_quoted_string_helper("abc 'def'", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("'abc' def", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("'abc\"", NULL, FALSE);
    - gplate_util_test_quoted_string_helper("\"abc'", NULL, FALSE);
    -}
    -
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_test_add_func("/util/quoted_string", gplate_util_test_quoted_string);
    -
    - return g_test_run();
    -}
    -
    --- a/tests/test-gplate.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,39 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -
    -#include <glib.h>
    -
    -#include <gplate.h>
    -
    -#include "tags/test-gplate-tag.h"
    -
    -gint
    -main(gint argc, gchar **argv) {
    - g_test_init(&argc, &argv, NULL);
    -
    - g_type_init();
    -
    - gplate_config_load_default();
    -
    - test_gplate_functions_add_tests();
    - test_gplate_tag_add_tests();
    - test_gplate_variables_add_tests();
    -
    - return g_test_run();
    -}
    -
    --- a/tests/variables/CMakeLists.txt Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,13 +0,0 @@
    -set(TEST_GPLATE_VARIABLES_HEADERS
    - test-gplate-variables.h
    -)
    -
    -set(TEST_GPLATE_VARIABLES_SOURCES
    - test-gplate-variables.c
    -)
    -
    -add_library(test-gplate-variables STATIC
    - ${TEST_GPLATE_VARIABLES_HEADERS}
    - ${TEST_GPLATE_VARIABLES_SOURCES}
    -)
    -
    --- a/tests/variables/test-gplate-variables.c Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,112 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -
    -#include <gplate/gplate.h>
    -
    -/******************************************************************************
    - * Tests
    - *****************************************************************************/
    -#define gplate_variable_test_value(v, expected) \
    - G_STMT_START { \
    - g_assert_cmpstr(gplate_variable_get_value((v)), ==, (expected)); \
    - g_object_unref(G_OBJECT((v))); \
    - } G_STMT_END
    -
    -#define gplate_variable_test_from_string_helper(input, output) \
    - G_STMT_START { \
    - GPlateVariable *v = gplate_variable_new_from_string("test", (input)); \
    - gplate_variable_test_value(v, (output)); \
    - } G_STMT_END
    -
    -static void
    -gplate_variable_test_from_string(void) {
    - gplate_variable_test_from_string_helper(NULL, NULL);
    - gplate_variable_test_from_string_helper("", "");
    - gplate_variable_test_from_string_helper(
    - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
    - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
    - gplate_variable_test_from_string_helper("☀☁☂☃☄", "☀☁☂☃☄");
    -}
    -
    -#define gplate_variable_test_from_boolean_helper(input, output) \
    - G_STMT_START { \
    - GPlateVariable *v = gplate_variable_new_from_boolean("test", (input)); \
    - gplate_variable_test_value(v, (output)); \
    - } G_STMT_END
    -
    -static void
    -gplate_variable_test_from_boolean(void) {
    - gplate_variable_test_from_boolean_helper(TRUE, "TRUE");
    - gplate_variable_test_from_boolean_helper(FALSE, "FALSE");
    -}
    -
    -#define gplate_variable_test_from_integer_helper(input, output) \
    - G_STMT_START { \
    - GPlateVariable *v = gplate_variable_new_from_integer("test", (input)); \
    - gplate_variable_test_value(v, (output)); \
    - } G_STMT_END
    -
    -static void
    -gplate_variable_test_from_integer(void) {
    - gplate_variable_test_from_integer_helper(-1, "-1");
    - gplate_variable_test_from_integer_helper(0, "0");
    - gplate_variable_test_from_integer_helper(1, "1");
    -}
    -
    -#define gplate_variable_test_from_float_helper(input, output) \
    - G_STMT_START { \
    - GPlateVariable *v = gplate_variable_new_from_float("test", (input)); \
    - gplate_variable_test_value(v, (output)); \
    - } G_STMT_END
    -
    -static void
    -gplate_variable_test_from_float(void) {
    - gplate_variable_test_from_float_helper(-1.0f, "-1.000000");
    - gplate_variable_test_from_float_helper(-0.5f, "-0.500000");
    - gplate_variable_test_from_float_helper(0.0f, "0.000000");
    - gplate_variable_test_from_float_helper(0.5f, "0.500000");
    - gplate_variable_test_from_float_helper(1.0f, "1.000000");
    -}
    -
    -#define gplate_variable_test_from_double_helper(input, output) \
    - G_STMT_START { \
    - GPlateVariable *v = gplate_variable_new_from_double("test", (input)); \
    - gplate_variable_test_value(v, (output)); \
    - } G_STMT_END
    -
    -static void
    -gplate_variable_test_from_double(void) {
    - gplate_variable_test_from_double_helper(-1.0, "-1");
    - gplate_variable_test_from_double_helper(-0.5, "-0.5");
    - gplate_variable_test_from_double_helper(0.0, "0");
    - gplate_variable_test_from_double_helper(0.5, "0.5");
    - gplate_variable_test_from_double_helper(1.0, "1");
    -}
    -
    -/******************************************************************************
    - * MIZAN
    - *****************************************************************************/
    -void
    -test_gplate_variables_add_tests(void) {
    - g_test_add_func("/variable/from_string", gplate_variable_test_from_string);
    - g_test_add_func("/variable/from_boolean", gplate_variable_test_from_boolean);
    - g_test_add_func("/variable/from_integer", gplate_variable_test_from_integer);
    - g_test_add_func("/variable/from_float", gplate_variable_test_from_float);
    - g_test_add_func("/variable/from_double", gplate_variable_test_from_double);
    -}
    -
    --- a/tests/variables/test-gplate-variables.h Sat Mar 04 10:36:35 2023 -0600
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,30 +0,0 @@
    -/*
    - * GPlate - GObject based templating library
    - * Copyright (C) 2007-2012 Gary Kramlich <grim@reaperworld.com>
    - *
    - * 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 3 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, see <http://www.gnu.org/licenses/>.
    - */
    -#ifndef TEST_GPLATE_VARIABLES_H
    -#define TEST_GPLATE_VARIABLES_H
    -
    -#include <glib.h>
    -
    -G_BEGIN_DECLS
    -
    -void test_gplate_variables_add_tests(void);
    -
    -G_END_DECLS
    -
    -#endif /* TEST_GPLATE_VARIABLES_H */
    -