summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-06-20 12:29:17 -0400
committerMatthias Clasen <mclasen@redhat.com>2010-06-20 16:53:38 -0400
commit08d6e535be868b04fe83d02cb8a99a8db96d2192 (patch)
treeb8fa7653c0cf3163e454cda92748a38207531ddf /tests
parent87df095de3246142c9407f088b300c3a18846a94 (diff)
Move scanner tests to glib/tests
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/scannerapi.c139
2 files changed, 0 insertions, 146 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 283422a2d..9f7d69ace 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -67,9 +67,6 @@ noinst_PROGRAMS = $(TEST_PROGS) \
errorcheck-mutex-test \
assert-msg-test
-TEST_PROGS += scannerapi
-scannerapi_SOURCES = scannerapi.c
-scannerapi_LDADD = $(progs_ldadd)
TEST_PROGS += testglib
testglib_SOURCES = testglib.c
testglib_LDADD = $(libglib)
@@ -91,7 +88,6 @@ endif
test_programs = \
atomic-test \
- base64-test \
bit-test \
$(CXX_TEST) \
checksum-test \
@@ -118,7 +114,6 @@ test_programs = \
asyncqueue-test \
qsort-test \
relation-test \
- sequence-test \
shell-test \
slist-test \
slice-test \
@@ -154,7 +149,6 @@ thread_ldadd = $(libgthread) $(G_THREAD_LIBS) $(progs_ldadd)
module_ldadd = $(libgmodule) $(G_MODULE_LIBS) $(progs_ldadd)
atomic_test_LDADD = $(progs_ldadd)
-base64_test_LDADD = $(progs_ldadd)
bit_test_LDADD = $(progs_ldadd)
bookmarkfile_test_LDADD = $(progs_ldadd)
checksum_test_LDADD = $(progs_ldadd)
@@ -181,7 +175,6 @@ queue_test_LDADD = $(progs_ldadd)
asyncqueue_test_LDADD = $(thread_ldadd)
qsort_test_LDADD = $(progs_ldadd)
relation_test_LDADD = $(progs_ldadd)
-sequence_test_LDADD = $(progs_ldadd)
shell_test_LDADD = $(progs_ldadd)
slist_test_LDADD = $(progs_ldadd)
slice_test_SOURCES = slice-test.c memchunks.c
diff --git a/tests/scannerapi.c b/tests/scannerapi.c
deleted file mode 100644
index d33fed917..000000000
--- a/tests/scannerapi.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Gtk+ object tests
- * Copyright (C) 2007 Patrick Hulin
- * Copyright (C) 2007 Imendio AB
- * Authors: Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <glib.h>
-#include <string.h>
-#include <stdlib.h>
-
-
-/* GScanner fixture */
-typedef struct {
- GScanner *scanner;
-} ScannerFixture;
-static void
-scanner_fixture_setup (ScannerFixture *fix,
- gconstpointer test_data)
-{
- fix->scanner = g_scanner_new (NULL);
- g_assert (fix->scanner != NULL);
-}
-static void
-scanner_fixture_teardown (ScannerFixture *fix,
- gconstpointer test_data)
-{
- g_assert (fix->scanner != NULL);
- g_scanner_destroy (fix->scanner);
-}
-
-static void
-scanner_msg_func (GScanner *scanner,
- gchar *message,
- gboolean error)
-{
- g_assert_cmpstr (message, ==, "test");
-}
-
-static void
-test_scanner_warn (ScannerFixture *fix,
- gconstpointer test_data)
-{
- fix->scanner->msg_handler = scanner_msg_func;
- g_scanner_warn (fix->scanner, "test");
-}
-
-static void
-test_scanner_error (ScannerFixture *fix,
- gconstpointer test_data)
-{
- if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
- {
- int pe = fix->scanner->parse_errors;
- g_scanner_error (fix->scanner, "scanner-error-message-test");
- g_assert_cmpint (fix->scanner->parse_errors, ==, pe + 1);
- exit (0);
- }
- g_test_trap_assert_passed();
- g_test_trap_assert_stderr ("*scanner-error-message-test*");
-}
-
-static void
-check_keys (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- g_assert_cmpint (GPOINTER_TO_INT (value), ==, g_ascii_strtoull (key, NULL, 0));
-}
-
-static void
-test_scanner_symbols (ScannerFixture *fix,
- gconstpointer test_data)
-{
- gint i;
- gchar buf[2];
-
- g_scanner_set_scope (fix->scanner, 1);
-
- for (i = 0; i < 10; i++)
- g_scanner_scope_add_symbol (fix->scanner,
- 1,
- g_ascii_dtostr (buf, 2, (gdouble)i),
- GINT_TO_POINTER (i));
- g_scanner_scope_foreach_symbol (fix->scanner, 1, check_keys, NULL);
- g_scanner_scope_remove_symbol (fix->scanner, 1, "5");
- g_assert_cmpint (GPOINTER_TO_INT (g_scanner_scope_lookup_symbol (fix->scanner, 1, "4")), ==, 4);
- g_assert_cmpint (GPOINTER_TO_INT (g_scanner_scope_lookup_symbol (fix->scanner, 1, "5")), ==, 0);
-}
-
-static void
-test_scanner_tokens (ScannerFixture *fix,
- gconstpointer test_data)
-{
- gchar buf[] = "(\t\n\r\\){}";
- const gint buflen = strlen (buf);
- gchar tokbuf[] = "(\\){}";
- const gint tokbuflen = strlen (tokbuf);
- guint i;
-
- g_scanner_input_text (fix->scanner, buf, buflen);
-
- g_assert_cmpint (g_scanner_cur_token (fix->scanner), ==, G_TOKEN_NONE);
- g_scanner_get_next_token (fix->scanner);
- g_assert_cmpint (g_scanner_cur_token (fix->scanner), ==, tokbuf[0]);
- g_assert_cmpint (g_scanner_cur_line (fix->scanner), ==, 1);
-
- for (i = 1; i < tokbuflen; i++)
- g_assert_cmpint (g_scanner_get_next_token (fix->scanner), ==, tokbuf[i]);
- g_assert_cmpint (g_scanner_get_next_token (fix->scanner), ==, G_TOKEN_EOF);
- return;
-}
-
-int
-main (int argc,
- char *argv[])
-{
- g_test_init (&argc, &argv, NULL);
-
- g_test_add ("/scanner/warn", ScannerFixture, 0, scanner_fixture_setup, test_scanner_warn, scanner_fixture_teardown);
- g_test_add ("/scanner/error", ScannerFixture, 0, scanner_fixture_setup, test_scanner_error, scanner_fixture_teardown);
- g_test_add ("/scanner/symbols", ScannerFixture, 0, scanner_fixture_setup, test_scanner_symbols, scanner_fixture_teardown);
- g_test_add ("/scanner/tokens", ScannerFixture, 0, scanner_fixture_setup, test_scanner_tokens, scanner_fixture_teardown);
-
- return g_test_run();
-}